summaryrefslogtreecommitdiffstats
path: root/src/usr/local
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-02-13 16:38:54 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-02-13 16:38:54 -0500
commit6a5fc3d7108e30f5a6867fe730804fe3064931d8 (patch)
tree981ef19809c070d2f42df0a986a6398e4481061d /src/usr/local
parent26e6c8a5528d18ed38397f571fda41c93b853f95 (diff)
parent227c11812309c832303ccc1765025b60ef289606 (diff)
downloadpfsense-6a5fc3d7108e30f5a6867fe730804fe3064931d8.zip
pfsense-6a5fc3d7108e30f5a6867fe730804fe3064931d8.tar.gz
Merge pull request #2630 from NOYB/Firewall_Rules_-_for/foreach
Diffstat (limited to 'src/usr/local')
-rw-r--r--src/usr/local/www/firewall_rules.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php
index 2d262fb..ebf3e7b 100644
--- a/src/usr/local/www/firewall_rules.php
+++ b/src/usr/local/www/firewall_rules.php
@@ -78,9 +78,10 @@ function get_pf_rules($rules, $tracker) {
return (NULL);
$arr = array();
- for ($i = 0; $i < count($rules); $i++) {
- if ($rules[$i]['tracker'] === $tracker)
- $arr[] = $rules[$i];
+ foreach ($rules as $rule) {
+ if ($rule['tracker'] === $tracker) {
+ $arr[] = $rule;
+ }
}
if (count($arr) == 0)
@@ -99,16 +100,20 @@ function print_states($tracker) {
$evaluations = 0;
$stcreations = 0;
$rules = get_pf_rules($rulescnt, $tracker);
- for ($j = 0; is_array($rules) && $j < count($rules); $j++) {
- $bytes += $rules[$j]['bytes'];
- $states += $rules[$j]['states'];
- $packets += $rules[$j]['packets'];
- $evaluations += $rules[$j]['evaluations'];
- $stcreations += $rules[$j]['state creations'];
- if (strlen($rulesid) > 0)
- $rulesid .= ",";
- $rulesid .= "{$rules[$j]['id']}";
+ if (is_array($rules)) {
+ foreach ($rules as $rule) {
+ $bytes += $rule['bytes'];
+ $states += $rule['states'];
+ $packets += $rule['packets'];
+ $evaluations += $rule['evaluations'];
+ $stcreations += $rule['state creations'];
+ if (strlen($rulesid) > 0) {
+ $rulesid .= ",";
+ }
+ $rulesid .= "{$rule['id']}";
+ }
}
+
printf("<a href=\"diag_dump_states.php?ruleid=%s\" data-toggle=\"popover\" data-trigger=\"hover focus\" title=\"%s\" ",
$rulesid, gettext("States details"));
printf("data-content=\"evaluations: %s<br>packets: %s<br>bytes: %s<br>states: %s<br>state creations: %s\" data-html=\"true\">",
@@ -479,8 +484,9 @@ $separators = $config['filter']['separator'][strtolower($if)];
// More efficient than looping through the list of separators on every row.
$seprows = separator_rows($separators);
-for ($i = 0; isset($a_filter[$i]); $i++):
- $filterent = $a_filter[$i];
+foreach ($a_filter as $filteri => $filterent):
+
+ $i = $filteri;
if (($filterent['interface'] == $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" == $if)) {
@@ -794,7 +800,7 @@ for ($i = 0; isset($a_filter[$i]); $i++):
<?php
$nrules++;
}
-endfor;
+endforeach;
// There can be separator(s) after the last rule listed.
if ($seprows[$nrules]) {
OpenPOWER on IntegriCloud