diff options
author | Renato Botelho <renato@netgate.com> | 2015-09-09 07:57:50 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-09-09 07:57:50 -0300 |
commit | 9b86077a929e727fe7d86fb8ed8d831e602fdd2d (patch) | |
tree | 9d9d25a5d949817699c5f0578e6dc1d8432ca6ad /config | |
parent | a10decb034a9860173709071cab8cba78c8c5ca6 (diff) | |
parent | 147ce57e45367a9d3b727c10800cc033334a1109 (diff) | |
download | pfsense-packages-9b86077a929e727fe7d86fb8ed8d831e602fdd2d.tar.gz pfsense-packages-9b86077a929e727fe7d86fb8ed8d831e602fdd2d.tar.bz2 pfsense-packages-9b86077a929e727fe7d86fb8ed8d831e602fdd2d.zip |
Merge pull request #1055 from doktornotor/patch-6
Diffstat (limited to 'config')
-rw-r--r-- | config/havp/antivirus.php | 3 | ||||
-rw-r--r-- | config/havp/havp.xml | 6 | ||||
-rw-r--r-- | config/havp/havp_avset.xml | 7 | ||||
-rw-r--r-- | config/havp/havp_log.php | 42 |
4 files changed, 43 insertions, 15 deletions
diff --git a/config/havp/antivirus.php b/config/havp/antivirus.php index 1c1fc7cc..bfb0c523 100644 --- a/config/havp/antivirus.php +++ b/config/havp/antivirus.php @@ -179,7 +179,8 @@ if ($_POST['clearlog_x'] != '') { $tab_array[] = array(gettext("General page"), true, "antivirus.php"); $tab_array[] = array(gettext("HTTP proxy"), false, "pkg_edit.php?xml=havp.xml"); $tab_array[] = array(gettext("Settings"), false, "pkg_edit.php?xml=havp_avset.xml"); - $tab_array[] = array(gettext("HAVP Log"), false, "havp_log.php"); + $tab_array[] = array(gettext("HAVP Log"), false, "havp_log.php?logtab=havp"); + $tab_array[] = array(gettext("Clamd Log"), false, "havp_log.php?logtab=clamd"); display_top_tabs($tab_array); ?> diff --git a/config/havp/havp.xml b/config/havp/havp.xml index 08ff873f..c99bf8c4 100644 --- a/config/havp/havp.xml +++ b/config/havp/havp.xml @@ -99,7 +99,11 @@ </tab> <tab> <text>HAVP Log</text> - <url>/havp_log.php</url> + <url>/havp_log.php?logtab=havp</url> + </tab> + <tab> + <text>Clamd Log</text> + <url>/havp_log.php?logtab=clamd</url> </tab> </tabs> <fields> diff --git a/config/havp/havp_avset.xml b/config/havp/havp_avset.xml index 381cf3ba..c6429724 100644 --- a/config/havp/havp_avset.xml +++ b/config/havp/havp_avset.xml @@ -68,7 +68,12 @@ </tab> <tab> <text>HAVP Log</text> - <url>/havp_log.php</url> + <url>/havp_log.php?logtab=havp</url> + </tab> + </tabs> + <tab> + <text>Clamd Log</text> + <url>/havp_log.php?logtab=clamd</url> </tab> </tabs> <fields> diff --git a/config/havp/havp_log.php b/config/havp/havp_log.php index 56a89928..6011f137 100644 --- a/config/havp/havp_log.php +++ b/config/havp/havp_log.php @@ -31,9 +31,16 @@ require("guiconfig.inc"); require_once("/usr/local/pkg/havp.inc"); $nentries = $config['syslog']['nentries'] ?: "50"; +if ($_GET['logtab'] === 'havp') { + define('HAVP_CLAMDTAB', false); + define('HAVP_LOGFILE', HVDEF_HAVP_ERRORLOG); +} else { + define('HAVP_CLAMDTAB', true); + define('HAVP_LOGFILE', HVDEF_CLAM_LOG); +} if ($_POST['clear']) { - file_put_contents(HVDEF_HAVP_ERRORLOG, ''); + file_put_contents(HAVP_LOGFILE, ''); } function dump_havp_errorlog($logfile, $tail) { @@ -44,22 +51,32 @@ function dump_havp_errorlog($logfile, $tail) { if (is_dir($logfile)) { $logarr = array("$logfile is a directory."); } elseif (file_exists($logfile) && filesize($logfile) == 0) { - $logarr = array("Log file is empty."); + $logarr = array(" -> Log file is empty."); } else { exec("/bin/cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); } foreach ($logarr as $logent) { + if (HAVP_CLAMDTAB) { + $logent = explode(" -> ", $logent); + $entry_date_time = htmlspecialchars($logent[0]); + $entry_text = htmlspecialchars($logent[1]); + } else { $logent = preg_split("/\s+/", $logent, 3); - echo "<tr valign=\"top\">\n"; - $entry_date_time = htmlspecialchars($logent[0] . " " . $logent[1]); + $entry_date_time = htmlspecialchars($logent[0] . " " . $logent[1]); $entry_text = htmlspecialchars($logent[2]); - echo "<td class=\"listlr\" nowrap=\"nowrap\" width=\"130\">{$entry_date_time}</td>\n"; - echo "<td class=\"listr\">{$entry_text}</td>\n"; - echo "</tr>\n"; + } + echo "<tr valign=\"top\">\n"; + echo "<td class=\"listlr\" nowrap=\"nowrap\" width=\"130\">{$entry_date_time}</td>\n"; + echo "<td class=\"listr\">{$entry_text}</td>\n"; + echo "</tr>\n"; } } -$pgtitle = "Antivirus: HAVP log"; +if ($_GET['logtab'] === 'havp') { + $pgtitle = "Antivirus: HAVP log"; +} else { + $pgtitle = "Antivirus: Clamd log"; +} include("head.inc"); ?> @@ -73,7 +90,8 @@ include("head.inc"); $tab_array[] = array(gettext("General Page"), false, "antivirus.php"); $tab_array[] = array(gettext("HTTP Proxy"), false, "pkg_edit.php?xml=havp.xml"); $tab_array[] = array(gettext("Settings"), false, "pkg_edit.php?xml=havp_avset.xml"); - $tab_array[] = array(gettext("HAVP Log"), true, "havp_log.php"); + $tab_array[] = array(gettext("HAVP Log"), !HAVP_CLAMDTAB, "havp_log.php?logtab=havp"); + $tab_array[] = array(gettext("Clamd Log"), HAVP_CLAMDTAB, "havp_log.php?logtab=clamd"); display_top_tabs($tab_array); ?> </td></tr> @@ -82,12 +100,12 @@ include("head.inc"); <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" class="listtopic"> - <?php printf(gettext("Last %s HAVP log entries"), $nentries);?></td> + <?php printf(gettext("Last %s log entries"), $nentries);?></td> </tr> - <?php dump_havp_errorlog(HVDEF_HAVP_ERRORLOG, $nentries); ?> + <?php dump_havp_errorlog(HAVP_LOGFILE, $nentries); ?> <tr> <td><br/> - <form action="havp_log.php" method="post"> + <form action="havp_log.php?logtab=<?=(HAVP_CLAMDTAB ? 'clamd' : 'havp'); ?>" method="post"> <input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>" /> </form> </td> |