aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/widget-antivirus/antivirus_status.inc2
-rw-r--r--config/widget-antivirus/antivirus_status.widget.php34
-rw-r--r--config/widget-antivirus/widget-antivirus.inc8
-rw-r--r--config/widget-antivirus/widget-antivirus.xml10
4 files changed, 14 insertions, 40 deletions
diff --git a/config/widget-antivirus/antivirus_status.inc b/config/widget-antivirus/antivirus_status.inc
index 48c06f9e..be1d6333 100644
--- a/config/widget-antivirus/antivirus_status.inc
+++ b/config/widget-antivirus/antivirus_status.inc
@@ -4,4 +4,4 @@
$antivirus_status_title = "Antivirus Status";
$antivirus_status_title_link = "";
-?> \ No newline at end of file
+?>
diff --git a/config/widget-antivirus/antivirus_status.widget.php b/config/widget-antivirus/antivirus_status.widget.php
index 9c18d3f6..f1079ea9 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,17 @@ 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 {
+ pkg_exec("query '%v' havp", $version, $err);
+ echo $version;
+ }
?>
</td>
</tr>
diff --git a/config/widget-antivirus/widget-antivirus.inc b/config/widget-antivirus/widget-antivirus.inc
deleted file mode 100644
index 620d8e82..00000000
--- a/config/widget-antivirus/widget-antivirus.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-function widget_antivirus_uninstall() {
- unlink("/usr/local/www/widgets/include/antivirus_status.inc");
- unlink("/usr/local/www/widgets/widgets/antivirus_status.widget.php");
-}
-
-?> \ No newline at end of file
diff --git a/config/widget-antivirus/widget-antivirus.xml b/config/widget-antivirus/widget-antivirus.xml
index 91a6a392..8a18c2bb 100644
--- a/config/widget-antivirus/widget-antivirus.xml
+++ b/config/widget-antivirus/widget-antivirus.xml
@@ -44,13 +44,8 @@
<description>Antivirus status widget add-on for HAVP</description>
<requirements>HAVP package</requirements>
<name>widget-antivirus</name>
- <version>0.1.1</version>
+ <version>0.1.2</version>
<title>Widget - Antivirus Status</title>
- <include_file>/usr/local/pkg/widget-antivirus.inc</include_file>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <item>https://packages.pfsense.org/packages/config/widget-antivirus/widget-antivirus.inc</item>
- </additional_files_needed>
<additional_files_needed>
<prefix>/usr/local/www/widgets/include/</prefix>
<item>https://packages.pfsense.org/packages/config/widget-antivirus/antivirus_status.inc</item>
@@ -59,7 +54,4 @@
<prefix>/usr/local/www/widgets/widgets/</prefix>
<item>https://packages.pfsense.org/packages/config/widget-antivirus/antivirus_status.widget.php</item>
</additional_files_needed>
- <custom_php_deinstall_command>
- widget_antivirus_uninstall();
- </custom_php_deinstall_command>
</packagegui>