aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2013-04-23 22:03:25 -0400
committerbmeeks8 <bmeeks8@bellsouth.net>2013-04-23 22:03:25 -0400
commit02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc (patch)
treef1fef818c0fb1085dd410874fffc7045f26eb2eb
parente6ddbc6805970912ba7550e782db3de7506fdae2 (diff)
downloadpfsense-packages-02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc.tar.gz
pfsense-packages-02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc.tar.bz2
pfsense-packages-02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc.zip
Add uninstall function to Snort Dashboard Widget and bump version.
-rw-r--r--config/widget-snort/snort_alerts.widget.php1
-rw-r--r--config/widget-snort/widget-snort.inc28
-rw-r--r--config/widget-snort/widget-snort.xml11
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
5 files changed, 40 insertions, 4 deletions
diff --git a/config/widget-snort/snort_alerts.widget.php b/config/widget-snort/snort_alerts.widget.php
index 3c41dd54..e488bc49 100644
--- a/config/widget-snort/snort_alerts.widget.php
+++ b/config/widget-snort/snort_alerts.widget.php
@@ -90,7 +90,6 @@ if (file_exists("/usr/local/pkg/snort/snort.inc")) {
$snort_alerts[$counter]['instanceid'] = $a_instance[$instanceid]['interface'];
$snort_alerts[$counter]['timestamp'] = $fields[0];
- /* Look for the dash separating date and time so we can handle entries with year in them */
$snort_alerts[$counter]['timeonly'] = substr($fields[0], strpos($fields[0], '-')+1, -8);
$snort_alerts[$counter]['dateonly'] = substr($fields[0], 0, strpos($fields[0], '-'));
$snort_alerts[$counter]['src'] = $fields[6];
diff --git a/config/widget-snort/widget-snort.inc b/config/widget-snort/widget-snort.inc
new file mode 100644
index 00000000..b33059e4
--- /dev/null
+++ b/config/widget-snort/widget-snort.inc
@@ -0,0 +1,28 @@
+<?php
+
+require_once("guiconfig.inc");
+require_once("config.inc");
+
+function widget_snort_uninstall() {
+
+ global $config;
+
+ /* Remove the Snort widget from the Dashboard display list */
+ $widgets = $config['widgets']['sequence'];
+ if (!empty($widgets)) {
+ $widgetlist = explode(",", $widgets);
+ foreach ($widgetlist as $key => $widget) {
+ if (strstr($widget, "snort_alerts-container"))
+ unset($widgetlist[$key]);
+ }
+ $config['widgets']['sequence'] = implode(",", $widgetlist);
+ write_config();
+ }
+
+ /* Remove our associated file */
+ unlink("/usr/local/www/widgets/include/widget-snort.inc");
+ unlink("/usr/local/www/widgets/widgets/snort_alerts.widget.php");
+ unlink("/usr/local/www/widgets/javascript/snort_alerts.js");
+}
+
+?>
diff --git a/config/widget-snort/widget-snort.xml b/config/widget-snort/widget-snort.xml
index f677eee4..ef89c1bb 100644
--- a/config/widget-snort/widget-snort.xml
+++ b/config/widget-snort/widget-snort.xml
@@ -46,8 +46,9 @@
<requirements>Dashboard package and Snort</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>widget-snort</name>
- <version>1.0</version>
+ <version>0.3.3</version>
<title>Widget - Snort</title>
+ <include_file>/usr/local/www/widgets/include/widget-snort.inc</include_file>
<additional_files_needed>
<prefix>/usr/local/www/widgets/javascript/</prefix>
<chmod>0644</chmod>
@@ -58,4 +59,12 @@
<chmod>0644</chmod>
<item>http://www.pfsense.com/packages/config/widget-snort/snort_alerts.widget.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/widgets/include/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/widget-snort/widget-snort.inc</item>
+ </additional_files_needed>
+ <custom_php_deinstall_command>
+ widget_snort_uninstall();
+ </custom_php_deinstall_command>
</packagegui>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index c0752199..5f4c6252 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1481,7 +1481,7 @@
<descr>Dashboard widget for Snort.</descr>
<category>System</category>
<config_file>http://www.pfsense.com/packages/config/widget-snort/widget-snort.xml</config_file>
- <version>0.3.2</version>
+ <version>0.3.3</version>
<status>BETA</status>
<required_version>1.2</required_version>
<configurationfile>widget-snort.xml</configurationfile>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 4afc7a4f..f4d22e97 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1468,7 +1468,7 @@
<descr>Dashboard widget for Snort.</descr>
<category>System</category>
<config_file>http://www.pfsense.com/packages/config/widget-snort/widget-snort.xml</config_file>
- <version>0.3.2</version>
+ <version>0.3.3</version>
<status>BETA</status>
<required_version>1.2</required_version>
<configurationfile>widget-snort.xml</configurationfile>