summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-02-16 07:47:33 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-02-16 07:47:33 -0500
commit7dbfba5e680db13fca574d5fc46259f3f285512f (patch)
treeb18ba57de08b18a111f10c9d175434423c00ecf1 /src/usr
parent3e3165c2f83e5e3a9a0d0d7b05fb3f6a5291a4cd (diff)
parentacd05d2bd7df13598316214a2339eaf6416d8050 (diff)
downloadpfsense-7dbfba5e680db13fca574d5fc46259f3f285512f.zip
pfsense-7dbfba5e680db13fca574d5fc46259f3f285512f.tar.gz
Merge pull request #2650 from NOYB/Firewall_/_Rules_-_Simplify_Order-Store_Loops
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/firewall_rules.php29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php
index 0891dcf..cd05fbf 100644
--- a/src/usr/local/www/firewall_rules.php
+++ b/src/usr/local/www/firewall_rules.php
@@ -292,23 +292,30 @@ if (isset($_POST['del_x'])) {
if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
$a_filter_new = array();
- // get the rules of other interfaces listed in config before this interface.
- for ($i = 0; (isset($a_filter[$i]) &&
- (($a_filter[$i]['interface'] != $if && !isset($a_filter[$i]['floating'])) || (isset($a_filter[$i]['floating']) && "FloatingRules" != $if))
- ); $i++) {
- $a_filter_new[] = $a_filter[$i];
+ // Include the rules of other interfaces listed in config before this (the selected) interface.
+ foreach ($a_filter as $filteri_before => $filterent) {
+ if (($filterent['interface'] == $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" == $if)) {
+ break;
+ } else {
+ $a_filter_new[] = $filterent;
+ }
}
- // include the rules of this interface.
- // if a rule is not in POST[rule], it has been deleted by the user
+ // Include the rules of this (the selected) interface.
+ // If a rule is not in POST[rule], it has been deleted by the user
foreach ($_POST['rule'] as $id) {
$a_filter_new[] = $a_filter[$id];
}
- // get the rules of other interfaces listed in config after this interface.
- for ( ; (isset($a_filter[$i])); $i++) {
- if (($a_filter[$i]['interface'] != $if && !isset($a_filter[$i]['floating'])) || (isset($a_filter[$i]['floating']) && "FloatingRules" != $if)) {
- $a_filter_new[] = $a_filter[$i];
+ // Include the rules of other interfaces listed in config after this (the selected) interface.
+ foreach ($a_filter as $filteri_after => $filterent) {
+ if ($filteri_before > $filteri_after) {
+ continue;
+ }
+ if (($filterent['interface'] == $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" == $if)) {
+ continue;
+ } else {
+ $a_filter_new[] = $filterent;
}
}
OpenPOWER on IntegriCloud