Auslesen von Netzwerkinformationen
This commit is contained in:
@@ -1,60 +1,51 @@
|
||||
<?php
|
||||
if (!defined('PICONTROL')) exit();
|
||||
|
||||
(include_once LIBRARY_PATH.'main/rpi.function.php') or die('Error: 0x0010');
|
||||
(include_once LIBRARY_PATH.'network/network.function.php') or die('Error: 0x0011');
|
||||
(include_once LIBRARY_PATH . 'main/rpi.function.php') or die('Error: 0x0010');
|
||||
(include_once LIBRARY_PATH . 'network/network.function.php') or die('Error: 0x0011');
|
||||
$tpl->setHeaderTitle(_t('Netzwerk'));
|
||||
|
||||
if (isset($_GET['hostname']))
|
||||
{
|
||||
if (isset($_POST['submit']) && $_POST['submit'] != '')
|
||||
{
|
||||
if (isset($_POST['hostname']) && trim($pHostname = trim($_POST['hostname'])) != '')
|
||||
{
|
||||
if (preg_match('/^([a-z][a-z0-9\-\.]*[^\-]){1,24}$/im', $pHostname))
|
||||
{
|
||||
if (isset($_GET['hostname'])) {
|
||||
if (isset($_POST['submit']) && $_POST['submit'] != '') {
|
||||
if (isset($_POST['hostname']) && trim($pHostname = trim($_POST['hostname'])) != '') {
|
||||
if (preg_match('/^([a-z][a-z0-9\-\.]*[^\-]){1,24}$/im', $pHostname)) {
|
||||
if (($status = editHostname($pHostname)) === true)
|
||||
$tpl->msg('success', _t('Hostname gespeichert'), _t('Damit die Änderung wirksam wird, muss dein Raspberry Pi neu gestartet werden. <a href="%s">Jetzt neu starten.</a>', '?s=shutdown&restart'));
|
||||
else
|
||||
$tpl->msg('error', _t('Fehler'), _t('Fehler beim Ändern des Hostname! Fehlercode: %s', $status));
|
||||
}
|
||||
else
|
||||
} else
|
||||
$tpl->msg('error', _t('Fehler'), _t('Der Hostname ist ungültig! Er muss aus mindestens 1 bis 24 Zeichen bestehen und darf nur folgende Zeichen enthalten: A-Z a-z 0-9 -<br />Der Hostname darf nicht mit einem Bindestrich Anfangen oder Enden.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tpl->assign('hostname', rpi_getHostname());
|
||||
|
||||
|
||||
$tpl->draw('network_hostname');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$networkConnections = getAllNetworkConnections();
|
||||
|
||||
|
||||
$networkCounts = unserialize(htmlspecialchars_decode(getConfig('main:network.overflowCount', 'a:0:{}')));
|
||||
$counter = 0;
|
||||
|
||||
foreach ($networkConnections as $network)
|
||||
{
|
||||
|
||||
foreach ($networkConnections as $network) {
|
||||
$countSent = 0;
|
||||
$countReceive = 0;
|
||||
|
||||
|
||||
if (isset($networkCounts[$network['interface']]['sent']))
|
||||
$countSent = $networkCounts[$network['interface']]['sent'];
|
||||
|
||||
|
||||
if (isset($networkCounts[$network['interface']]['receive']))
|
||||
$countReceive = $networkCounts[$network['interface']]['receive'];
|
||||
|
||||
|
||||
$networkConnections[$counter]['sent'] = (4294967295 * $countSent) + $network['sent'];
|
||||
$networkConnections[$counter]['receive'] = (4294967295 * $countReceive) + $network['receive'];
|
||||
|
||||
|
||||
$counter += 1;
|
||||
}
|
||||
|
||||
|
||||
$tpl->assign('network_connections', $networkConnections);
|
||||
$tpl->assign('hostname', rpi_getHostname());
|
||||
$tpl->assign('wlan', scanAccessPoints($networkConnections, (isset($_GET['refresh_wlan'])) ? true : false));
|
||||
|
||||
|
||||
$tpl->draw('network');
|
||||
}
|
||||
?>
|
||||
@@ -38,7 +38,7 @@ $tpl->assign('configHelpFilesFolders', $config['url']['help'].'?s=view&i=1'.
|
||||
$tpl->assign('configHelpCron', $config['url']['help'].'?s=view&i=10'.getURLLangParam());
|
||||
$tpl->assign('cronEntry', $cronEntry);
|
||||
$tpl->assign('cronMatch', $cronMatch);
|
||||
$tpl->assign('cronPHPCLI', ($cronPHPCLI = (trim(exec('dpkg -s php7.0-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '') ? true : false));
|
||||
$tpl->assign('cronPHPCLI', ($cronPHPCLI = (trim(exec('dpkg -s php-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '') ? true : false));
|
||||
$tpl->assign('cronLastExecution', formatTime(getConfig('cron:execution.cron', 0)));
|
||||
$tpl->assign('cronLastExecutionBool', ($cronLastExecutionBool = (getConfig('cron:execution.cron', 0) > time()-150) ? true : false));
|
||||
$tpl->assign('cronLastExecutionLog', formatTime($lastExecutionLog[0]));
|
||||
|
||||
Reference in New Issue
Block a user