From 8c650e1dbcd643fef077c77f3416401b2521037f Mon Sep 17 00:00:00 2001 From: doktornotor Date: Thu, 27 Aug 2015 21:46:09 +0200 Subject: havp code style cleanup - Update copyright header - Fix indentation/whitespace - XHTML fixes --- config/havp/havp_log.php | 65 +++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 34 deletions(-) (limited to 'config/havp') diff --git a/config/havp/havp_log.php b/config/havp/havp_log.php index f4a2dc2e..56a89928 100644 --- a/config/havp/havp_log.php +++ b/config/havp/havp_log.php @@ -1,10 +1,9 @@ . - Copyright (C) 2005 Bill Marquette . - Copyright (C) 2003-2004 Manuel Kasper . + Copyright (C) 2015 ESF, LLC All rights reserved. Redistribution and use in source and binary forms, with or without @@ -28,19 +27,14 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - require("guiconfig.inc"); +require_once("/usr/local/pkg/havp.inc"); -if (file_exists("/usr/local/pkg/havp.inc")) - require_once("/usr/local/pkg/havp.inc"); -else echo "No havp.inc found"; - -$nentries = $config['syslog']['nentries']; -if (!$nentries) - $nentries = 50; +$nentries = $config['syslog']['nentries'] ?: "50"; -if ($_POST['clear']) +if ($_POST['clear']) { file_put_contents(HVDEF_HAVP_ERRORLOG, ''); +} function dump_havp_errorlog($logfile, $tail) { global $g, $config; @@ -48,18 +42,18 @@ function dump_havp_errorlog($logfile, $tail) { $logarr = ""; $grepline = " "; if (is_dir($logfile)) { - $logarr = array("File $logfile is a directory."); - } elseif(file_exists($logfile) && filesize($logfile) == 0) { - $logarr = array(" ... Log file is empty."); + $logarr = array("$logfile is a directory."); + } elseif (file_exists($logfile) && filesize($logfile) == 0) { + $logarr = array("Log file is empty."); } else { - exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); + exec("/bin/cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); } foreach ($logarr as $logent) { $logent = preg_split("/\s+/", $logent, 3); echo "\n"; - $entry_date_time = htmlspecialchars($logent[0] . " " . $logent[1]); + $entry_date_time = htmlspecialchars($logent[0] . " " . $logent[1]); $entry_text = htmlspecialchars($logent[2]); - echo "{$entry_date_time}\n"; + echo "{$entry_date_time}\n"; echo "{$entry_text}\n"; echo "\n"; } @@ -73,33 +67,36 @@ include("head.inc"); - - - + - +
+
-
+
- + - - - + + + + + +
-

-
- " />

+
+ " /> +
+
-
+ -- cgit v1.2.3