summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/firewall_rules.php
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-02-11 09:46:26 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-02-11 09:46:26 -0500
commitf5051b64f87d06c37f74f5d47d40295a5a2f00f7 (patch)
tree95a7106172833d5249972c3d28b12e3dcaeccb6f /src/usr/local/www/firewall_rules.php
parent671488589da31f1f426397c92cc773fb9a00b123 (diff)
parent36bf13fd637a1ad3c0d8e57cdcf3d51519ec51e1 (diff)
downloadpfsense-f5051b64f87d06c37f74f5d47d40295a5a2f00f7.zip
pfsense-f5051b64f87d06c37f74f5d47d40295a5a2f00f7.tar.gz
Merge pull request #2619 from NOYB/Firewall_/_Rules_-_Display_Separators_Efficiency
Diffstat (limited to 'src/usr/local/www/firewall_rules.php')
-rw-r--r--src/usr/local/www/firewall_rules.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php
index e2917ca..1220bad 100644
--- a/src/usr/local/www/firewall_rules.php
+++ b/src/usr/local/www/firewall_rules.php
@@ -488,13 +488,19 @@ $columns_in_table = 13;
$nrules = 0;
$separators = $config['filter']['separator'][strtolower($if)];
-// There can be a separator before any rules are listed
-display_separator($separators, $nrules, $columns_in_table);
+// Get a list of separator rows and use it to call the display separator function only for rows which there are separator(s).
+// 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];
if (($filterent['interface'] == $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" == $if)) {
+
+ // Display separator(s) for section beginning at rule n
+ if ($seprows[$nrules]) {
+ display_separator($separators, $nrules, $columns_in_table);
+ }
?>
<tr id="fr<?=$nrules;?>" onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" <?=(isset($filterent['disabled']) ? ' class="disabled"' : '')?>>
<td>
@@ -800,10 +806,13 @@ for ($i = 0; isset($a_filter[$i]); $i++):
</tr>
<?php
$nrules++;
- // There can be a separator before the next rule listed, or after the last rule listed
- display_separator($separators, $nrules, $columns_in_table);
}
endfor;
+
+// There can be separator(s) after the last rule listed.
+if ($seprows[$nrules]) {
+ display_separator($separators, $nrules, $columns_in_table);
+}
?>
</tbody>
</table>
OpenPOWER on IntegriCloud