aboutsummaryrefslogtreecommitdiffstats
path: root/config/havp
diff options
context:
space:
mode:
Diffstat (limited to 'config/havp')
-rw-r--r--config/havp/antivirus.php3
-rw-r--r--config/havp/havp.xml6
-rw-r--r--config/havp/havp_avset.xml7
-rw-r--r--config/havp/havp_log.php42
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>