diff options
Diffstat (limited to 'modules-available/systemstatus')
-rw-r--r-- | modules-available/systemstatus/page.inc.php | 40 | ||||
-rw-r--r-- | modules-available/systemstatus/templates/_page.html | 9 |
2 files changed, 45 insertions, 4 deletions
diff --git a/modules-available/systemstatus/page.inc.php b/modules-available/systemstatus/page.inc.php index bcce816b..b9fef0fd 100644 --- a/modules-available/systemstatus/page.inc.php +++ b/modules-available/systemstatus/page.inc.php @@ -266,7 +266,39 @@ class Page_SystemStatus extends Page } else { $start = strpos($data, "\n") + 1; } - echo '<pre>', htmlspecialchars(substr($data, $start)), '</pre>'; + echo '<pre>', htmlspecialchars(substr($data, $start), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), '</pre>'; + } + + protected function ajaxLighttpdLog() + { + $fh = @fopen('/var/log/lighttpd/error.log', 'r'); + if ($fh === false) { + echo 'Error opening log file'; + return; + } + fseek($fh, -6000, SEEK_END); + $data = fread($fh, 6000); + @fclose($fh); + if ($data === false) { + echo 'Error reading from log file'; + return; + } + // If we could read less, try the .1 file too + $amount = 6000 - strlen($data); + if ($amount > 100) { + $fh = @fopen('/var/log/lighttpd/error.log.1', 'r'); + if ($fh !== false) { + fseek($fh, -$amount, SEEK_END); + $data = fread($fh, $amount) . $data; + @fclose($fh); + } + } + if (strlen($data) < 5990) { + $start = 0; + } else { + $start = strpos($data, "\n") + 1; + } + echo '<pre>', htmlspecialchars(substr($data, $start), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), '</pre>'; } protected function ajaxLdadpLog() @@ -303,7 +335,7 @@ class Page_SystemStatus extends Page } else { $start = strpos($data, "\n") + 1; } - echo '<pre>', htmlspecialchars(substr($data, $start)), '</pre>'; + echo '<pre>', htmlspecialchars(substr($data, $start), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), '</pre>'; } } @@ -319,7 +351,7 @@ class Page_SystemStatus extends Page else $data = 'Taskmanager error'; - echo '<pre>', htmlspecialchars($data), '</pre>'; + echo '<pre>', htmlspecialchars($data, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), '</pre>'; } protected function ajaxPsList() @@ -334,7 +366,7 @@ class Page_SystemStatus extends Page else $data = 'Taskmanager error'; - echo '<pre>', htmlspecialchars($data), '</pre>'; + echo '<pre>', htmlspecialchars($data, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), '</pre>'; } private function usageColor($percent) diff --git a/modules-available/systemstatus/templates/_page.html b/modules-available/systemstatus/templates/_page.html index 51aa5b55..0573a20c 100644 --- a/modules-available/systemstatus/templates/_page.html +++ b/modules-available/systemstatus/templates/_page.html @@ -97,6 +97,14 @@ </div> <div class="panel panel-default"> <div class="panel-heading"> + {{lang_lighttpdLog}} + </div> + <div class="panel-body" id="lighttpd-log"> + <span class="glyphicon glyphicon-refresh slx-rotation"></span> + </div> +</div> +<div class="panel panel-default"> + <div class="panel-heading"> netstat -tulpn </div> <div class="panel-body" id="netstat"> @@ -124,6 +132,7 @@ $('#netstat').load('?do=SystemStatus&action=Netstat'); $('#pslist').load('?do=SystemStatus&action=PsList'); $('#ldadp-log').load('?do=SystemStatus&action=LdadpLog'); + $('#lighttpd-log').load('?do=SystemStatus&action=LighttpdLog'); }, 300); }, false); </script> |