mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
fully locked down the back-end in monitoring mode
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
include_once('includes/status_messages.php');
|
||||
require_once 'config.php';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -72,25 +73,34 @@ function DisplaySystem()
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['SaveServerPort'])) {
|
||||
if (isset($_POST['serverPort'])) {
|
||||
if (strlen($_POST['serverPort']) > 4 || !is_numeric($_POST['serverPort'])) {
|
||||
$status->addMessage('Invalid value for port number', 'danger');
|
||||
} else {
|
||||
$serverPort = escapeshellarg($_POST['serverPort']);
|
||||
exec("sudo /etc/raspap/lighttpd/configport.sh $serverPort " .RASPI_LIGHTTPD_CONFIG. " ".$_SERVER['SERVER_NAME'], $return);
|
||||
foreach ($return as $line) {
|
||||
$status->addMessage($line, 'info');
|
||||
if (!RASPI_MONITOR_ENABLED) {
|
||||
if (isset($_POST['SaveServerPort'])) {
|
||||
if (isset($_POST['serverPort'])) {
|
||||
if (strlen($_POST['serverPort']) > 4 || !is_numeric($_POST['serverPort'])) {
|
||||
$status->addMessage('Invalid value for port number', 'danger');
|
||||
} else {
|
||||
$serverPort = escapeshellarg($_POST['serverPort']);
|
||||
exec("sudo /etc/raspap/lighttpd/configport.sh $serverPort " .RASPI_LIGHTTPD_CONFIG. " ".$_SERVER['SERVER_NAME'], $return);
|
||||
foreach ($return as $line) {
|
||||
$status->addMessage($line, 'info');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_POST['system_reboot'])) {
|
||||
$status->addMessage("System Rebooting Now!", "warning", false);
|
||||
$result = shell_exec("sudo /sbin/reboot");
|
||||
}
|
||||
if (isset($_POST['system_shutdown'])) {
|
||||
$status->addMessage("System Shutting Down Now!", "warning", false);
|
||||
$result = shell_exec("sudo /sbin/shutdown -h now");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['RestartLighttpd'])) {
|
||||
$status->addMessage('Restarting lighttpd in 3 seconds...','info');
|
||||
exec('sudo /etc/raspap/lighttpd/configport.sh --restart');
|
||||
}
|
||||
|
||||
exec('cat '. RASPI_LIGHTTPD_CONFIG, $return);
|
||||
$conf = ParseConfig($return);
|
||||
$ServerPort = $conf['server.port'];
|
||||
@@ -118,14 +128,5 @@ function DisplaySystem()
|
||||
'el_GR.UTF-8' => 'Ελληνικά'
|
||||
);
|
||||
|
||||
if (isset($_POST['system_reboot'])) {
|
||||
$status->addMessage("System Rebooting Now!", "warning", false);
|
||||
$result = shell_exec("sudo /sbin/reboot");
|
||||
}
|
||||
if (isset($_POST['system_shutdown'])) {
|
||||
$status->addMessage("System Shutting Down Now!", "warning", false);
|
||||
$result = shell_exec("sudo /sbin/shutdown -h now");
|
||||
}
|
||||
|
||||
echo renderTemplate("system", compact("arrLocales", "status", "system", "ServerPort"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user