diff options
author | Renato Botelho <renato@netgate.com> | 2015-09-08 10:05:18 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-09-08 10:05:18 -0300 |
commit | b3b0a9a5d9c60512bdcefa648aade9ae9f9b3b1d (patch) | |
tree | 9bb85efa7eb338a13a5da355ea2c13fcbc8cd409 | |
parent | 0b7596d98d9cf4b8b89b77f7748dd5ed48c9df2a (diff) | |
parent | efb20df72431546285d3f462cbaf60393eb2f025 (diff) | |
download | pfsense-packages-b3b0a9a5d9c60512bdcefa648aade9ae9f9b3b1d.tar.gz pfsense-packages-b3b0a9a5d9c60512bdcefa648aade9ae9f9b3b1d.tar.bz2 pfsense-packages-b3b0a9a5d9c60512bdcefa648aade9ae9f9b3b1d.zip |
Merge pull request #1031 from doktornotor/patch-5
-rw-r--r-- | config/widget-antivirus/antivirus_status.inc | 2 | ||||
-rw-r--r-- | config/widget-antivirus/antivirus_status.widget.php | 34 | ||||
-rw-r--r-- | config/widget-antivirus/widget-antivirus.inc | 8 | ||||
-rw-r--r-- | config/widget-antivirus/widget-antivirus.xml | 10 |
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> |