From 3e7fcc5bc0ff436c58b42ae3d07c58dbdc55f0c1 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Mon, 17 Feb 2014 19:08:02 -0500 Subject: Fix problem with saving empty custom rules element. --- config/snort/snort_rules.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'config/snort') diff --git a/config/snort/snort_rules.php b/config/snort/snort_rules.php index 86c0eba2..afc764fc 100755 --- a/config/snort/snort_rules.php +++ b/config/snort/snort_rules.php @@ -37,6 +37,7 @@ global $g, $rebuild_rules; $snortdir = SNORTDIR; $rules_map = array(); +$pconfig = array(); if (!is_array($config['installedpackages']['snortglobal']['rule'])) $config['installedpackages']['snortglobal']['rule'] = array(); @@ -53,8 +54,6 @@ if (is_null($id)) { if (isset($id) && $a_rule[$id]) { $pconfig['interface'] = $a_rule[$id]['interface']; $pconfig['rulesets'] = $a_rule[$id]['rulesets']; - if (!empty($a_rule[$id]['customrules'])) - $pconfig['customrules'] = base64_decode($a_rule[$id]['customrules']); } function truncate($string, $length) { @@ -365,8 +364,11 @@ if ($_POST['clear']) { exit; } -if ($_POST['customrules']) { - $a_rule[$id]['customrules'] = base64_encode($_POST['customrules']); +if ($_POST['submit']) { + if ($_POST['customrules']) + $a_rule[$id]['customrules'] = base64_encode($_POST['customrules']); + else + unset($a_rule[$id]['customrules']); write_config(); $rebuild_rules = true; snort_generate_conf($a_rule[$id]); @@ -500,12 +502,12 @@ if ($savemsg) { - + - " title=" "/>   + " title=" "/>   " title=""/>   " onclick="return confirm('')" title=""/> -- cgit v1.2.3