aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/havp/havp_log.php42
1 files changed, 30 insertions, 12 deletions
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>