From 36bf13fd637a1ad3c0d8e57cdcf3d51519ec51e1 Mon Sep 17 00:00:00 2001 From: NOYB Date: Thu, 11 Feb 2016 00:09:37 -0800 Subject: Firewall / Rules - Display Separators Efficiency Use a list of separator rows 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. --- src/usr/local/www/firewall_rules.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/usr/local/www/firewall_rules.php') diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php index a65fab5..bd50734 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); + } ?> > @@ -800,10 +806,13 @@ for ($i = 0; isset($a_filter[$i]); $i++): -- cgit v1.1