diff options
author | Ermal Luçi <eri@pfsense.org> | 2013-04-24 00:26:26 -0700 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2013-04-24 00:26:26 -0700 |
commit | 9c773ca84fe7884884676a9b5925556abfec5c88 (patch) | |
tree | f1fef818c0fb1085dd410874fffc7045f26eb2eb | |
parent | e6ddbc6805970912ba7550e782db3de7506fdae2 (diff) | |
parent | 02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc (diff) | |
download | pfsense-packages-9c773ca84fe7884884676a9b5925556abfec5c88.tar.gz pfsense-packages-9c773ca84fe7884884676a9b5925556abfec5c88.tar.bz2 pfsense-packages-9c773ca84fe7884884676a9b5925556abfec5c88.zip |
Merge pull request #431 from bmeeks8/master
Add Uninstall Function to Snort Dashboard Widget
-rw-r--r-- | config/widget-snort/snort_alerts.widget.php | 1 | ||||
-rw-r--r-- | config/widget-snort/widget-snort.inc | 28 | ||||
-rw-r--r-- | config/widget-snort/widget-snort.xml | 11 | ||||
-rw-r--r-- | pkg_config.8.xml | 2 | ||||
-rw-r--r-- | pkg_config.8.xml.amd64 | 2 |
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> |