summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/etc/inc/filter.inc17
-rw-r--r--src/usr/local/www/firewall_nat.php23
-rw-r--r--src/usr/local/www/firewall_rules.php21
3 files changed, 22 insertions, 39 deletions
diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc
index 9dea90a..81b7a7a 100644
--- a/src/etc/inc/filter.inc
+++ b/src/etc/inc/filter.inc
@@ -4236,7 +4236,7 @@ function filter_get_antilockout_ports($wantarray = false) {
}
-// get rule index within interface
+/* get rule index within interface */
function ifridx($if, $ridx) {
global $config;
@@ -4257,4 +4257,19 @@ function ifridx($if, $ridx) {
return $i;
}
+/* display rules separators */
+function display_separator($separators, $nrules, $columns_in_table) {
+ if (!empty($separators)) {
+ foreach ($separators as $sepn => $separator) {
+ if ($separator['row'][0] == "fr" . $nrules) {
+ $cellcolor = $separator['color'];
+ print('<tr class="ui-sortable-handle separator">' .
+ '<td class="' . $cellcolor . '" colspan="' . ($columns_in_table -1) . '">' . '<span class="' . $cellcolor . '">' . $separator['text'] . '</span></td>' .
+ '<td class="' . $cellcolor . '"><a href="#"><i class="fa fa-trash no-confirm sepdel" title="delete this separator"></i></a></td>' .
+ '</tr>' . "\n");
+ }
+ }
+ }
+}
+
?>
diff --git a/src/usr/local/www/firewall_nat.php b/src/usr/local/www/firewall_nat.php
index 99e0914..80f603e 100644
--- a/src/usr/local/www/firewall_nat.php
+++ b/src/usr/local/www/firewall_nat.php
@@ -69,24 +69,6 @@ require_once("filter.inc");
require_once("shaper.inc");
require_once("itemid.inc");
-// This display separators function can be made generic and placed in filter.inc along with it's counter part of firewall rules.
-// Things that would need to be passed instead of global are the config and nnats/nrules count.
-function display_separator() {
- global $config, $if, $nnats, $columns_in_table;
-
- if (!empty($config['nat']['separator'])) {
- foreach ($config['nat']['separator'] as $sepn => $separator) {
- if ($separator['row'][0] == "fr" . $nnats) {
- $cellcolor = $separator['color'];
- print('<tr class="ui-sortable-handle separator">' .
- '<td class="' . $cellcolor . '" colspan="' . ($columns_in_table -1) . '">' . '<span class="' . $cellcolor . '">' . $separator['text'] . '</span></td>' .
- '<td class="' . $cellcolor . '"><a href="#"><i class="fa fa-trash no-confirm sepdel" title="delete this separator"></i></a></td>' .
- '</tr>' . "\n");
- }
- }
- }
-}
-
if (!is_array($config['nat']['rule'])) {
$config['nat']['rule'] = array();
}
@@ -276,9 +258,10 @@ $columns_in_table = 13;
<?php
$nnats = $i = 0;
+$separators = $config['nat']['separator'];
// There can be a separator before any rules are listed
-display_separator();
+display_separator($separators, $nnats, $columns_in_table);
foreach ($a_nat as $natent):
@@ -444,7 +427,7 @@ foreach ($a_nat as $natent):
$nnats++;
// There can be a separator before the next rule listed, or after the last rule listed
- display_separator();
+ display_separator($separators, $nnats, $columns_in_table);
endforeach;
?>
diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php
index b64b506..365a081 100644
--- a/src/usr/local/www/firewall_rules.php
+++ b/src/usr/local/www/firewall_rules.php
@@ -133,22 +133,6 @@ function delete_nat_association($id) {
}
}
-function display_separator() {
- global $config, $if, $nrules, $columns_in_table;
-
- if (!empty($config['filter']['separator'][strtolower($if)])) {
- foreach ($config['filter']['separator'][strtolower($if)] as $sepn => $separator) {
- if ($separator['row'][0] == "fr" . $nrules) {
- $cellcolor = $separator['color'];
- print('<tr class="ui-sortable-handle separator">' .
- '<td class="' . $cellcolor . '" colspan="' . ($columns_in_table -1) . '">' . '<span class="' . $cellcolor . '">' . $separator['text'] . '</span></td>' .
- '<td class="' . $cellcolor . '"><a href="#"><i class="fa fa-trash no-confirm sepdel" title="delete this separator"></i></a></td>' .
- '</tr>' . "\n");
- }
- }
- }
-}
-
if (!is_array($config['filter']['rule'])) {
$config['filter']['rule'] = array();
}
@@ -502,9 +486,10 @@ $columns_in_table = 13;
<tbody class="user-entries">
<?php
$nrules = 0;
+$separators = $config['filter']['separator'][strtolower($if)];
// There can be a separator before any rules are listed
-display_separator();
+display_separator($separators, $nrules, $columns_in_table);
for ($i = 0; isset($a_filter[$i]); $i++):
$filterent = $a_filter[$i];
@@ -812,7 +797,7 @@ for ($i = 0; isset($a_filter[$i]); $i++):
<?php
$nrules++;
// There can be a separator before the next rule listed, or after the last rule listed
- display_separator();
+ display_separator($separators, $nrules, $columns_in_table);
}
endfor;
?>
OpenPOWER on IntegriCloud