aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-08-29 22:05:03 +0200
committerdoktornotor <notordoktor@gmail.com>2015-08-29 22:05:03 +0200
commit1e4d066f5d8e8b70cb91653874484a2d626f3358 (patch)
tree573e6ad7c31e1e0bfc6cfb82e345d36252f183c8
parent42d5fcf916f0fd0ccbe8a909450f2ff2e2e5b748 (diff)
downloadpfsense-packages-1e4d066f5d8e8b70cb91653874484a2d626f3358.tar.gz
pfsense-packages-1e4d066f5d8e8b70cb91653874484a2d626f3358.tar.bz2
pfsense-packages-1e4d066f5d8e8b70cb91653874484a2d626f3358.zip
Remove disfunctional junk and fix HAVP version check
-rw-r--r--config/widget-antivirus/antivirus_status.widget.php33
1 files changed, 11 insertions, 22 deletions
diff --git a/config/widget-antivirus/antivirus_status.widget.php b/config/widget-antivirus/antivirus_status.widget.php
index 9c18d3f6..77685c20 100644
--- a/config/widget-antivirus/antivirus_status.widget.php
+++ b/config/widget-antivirus/antivirus_status.widget.php
@@ -30,6 +30,7 @@
require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
require_once("functions.inc");
+require_once("pkg-utils.inc");
define('PATH_CLAMDB', '/var/db/clamav');
define('PATH_HAVPLOG', '/var/log/access.log');
@@ -91,26 +92,6 @@ function dwg_av_statistic() {
$log = file_get_contents(PATH_HAVPLOG);
$count = substr_count(strtolower($log), "virus clamd:");
$s = "Found $count viruses (total).";
-
-/*
-# slowly worked - need apply cache or preparse stat
-
- $log = explode("\n", $log);
- # counters: day, week, mon, total
- $count = 0;
- foreach($log as $ln) {
- $ln = explode(' ', $ln);
- # 0:date 1:time 2:ip 3:get 4:len 5:url 6:xx 7:status
- if (strpos(strtolower($ln[7]), "virus") !== false) {
- $count++;
- }
- }
- $s = "Found viruses:<br>";
- $s .= "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tbody>";
- $s .= "<tr align='center'><td>today</td><td>week</td><td>mon</td><td>total</td></tr>";
- $s .= "<tr align='center'><td>0</td><td>0</td><td>0</td><td>$count</td></tr>";
- $s .= "</tbody></table>";
-*/
}
return $s;
}
@@ -123,8 +104,16 @@ function dwg_av_statistic() {
<td class="vncellt">HTTP Scanner</td>
<td class="listr" width="75%">
<?php
- // HAVP version; note - obviously broken now
- echo exec("pkg_info | grep \"[h]avp\"");
+ // HAVP version
+ $pfs_version = substr(trim(file_get_contents("/etc/version")), 0, 3);
+ if ($pfs_version == "2.1") {
+ echo exec("pkg_info | grep \"[h]avp\"");
+ } elseif ($pfs_version == "2.2") {
+ // Show package version at least, no good quick way to get the PBI version
+ echo "pkg v{$config['installedpackages']['package'][get_pkg_id("havp")]['version']}";
+ } else {
+ echo exec("/usr/sbin/pkg info havp | /usr/bin/head -n 1");
+ }
?>
</td>
</tr>