From 67c2baf157c50ae1b545f36bcf6afee6cdf6f67c Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 14 Dec 2015 23:18:15 +0545 Subject: Coe style firewall * --- src/usr/local/www/firewall_nat_out.php | 85 ++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 34 deletions(-) (limited to 'src/usr/local/www/firewall_nat_out.php') diff --git a/src/usr/local/www/firewall_nat_out.php b/src/usr/local/www/firewall_nat_out.php index 0fa4f09..1679be2 100644 --- a/src/usr/local/www/firewall_nat_out.php +++ b/src/usr/local/www/firewall_nat_out.php @@ -87,7 +87,7 @@ $a_out = &$config['nat']['outbound']['rule']; // update rule order, POST[rule] is an array of ordered IDs // All rule are 'checked' before posting if (isset($_POST['order-store'])) { - if(is_array($_POST['rule']) && !empty($_POST['rule'])) { + if (is_array($_POST['rule']) && !empty($_POST['rule'])) { $a_out_new = array(); @@ -98,8 +98,9 @@ if (isset($_POST['order-store'])) { $a_out = $a_out_new; - if (write_config()) + if (write_config()) { mark_subsystem_dirty('natconf'); + } header("Location: firewall_nat_out.php"); exit; @@ -107,8 +108,9 @@ if (isset($_POST['order-store'])) { } } -if (!isset($config['nat']['outbound']['mode'])) +if (!isset($config['nat']['outbound']['mode'])) { $config['nat']['outbound']['mode'] = "automatic"; +} $mode = $config['nat']['outbound']['mode']; @@ -159,10 +161,10 @@ if ($_POST['save']) { $found = false; foreach ($a_out as $rule) { if ($rule['interface'] == $natent['interface'] && - $rule['source']['network'] == $natent['source']['network'] && - $rule['dstport'] == $natent['dstport'] && - $rule['target'] == $natent['target'] && - $rule['descr'] == $natent['descr']) { + $rule['source']['network'] == $natent['source']['network'] && + $rule['dstport'] == $natent['dstport'] && + $rule['target'] == $natent['target'] && + $rule['descr'] == $natent['descr']) { $found = true; break; } @@ -240,11 +242,13 @@ if (isset($_POST['del_x'])) { $pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Outbound")); include("head.inc"); -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} -if (is_subsystem_dirty('natconf')) +if (is_subsystem_dirty('natconf')) { print_info_box_np(gettext("The NAT configuration has been changed.")."
".gettext("You must apply the changes in order for them to take effect.")); +} $tab_array = array(); $tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php"); @@ -325,8 +329,9 @@ print($form); foreach ($a_out as $natent): $iconfn = "pass"; $textss = $textse = ""; - if ($mode == "disabled" || $mode == "automatic" || isset($natent['disabled'])) + if ($mode == "disabled" || $mode == "automatic" || isset($natent['disabled'])) { $iconfn .= "_d"; + } $alias = rule_columns_with_alias( @@ -413,8 +418,9 @@ print($form); if (isset($natent['destination']['any'])) { echo "*"; } else { - if (isset($natent['destination']['not'])) + if (isset($natent['destination']['not'])) { echo "! "; + } if (isset($alias['dst'])): @@ -461,32 +467,35 @@ print($form); NO NAT'; - elseif (!$natent['target']) + } elseif (!$natent['target']) { echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address"; - elseif ($natent['target'] == "other-subnet") + } elseif ($natent['target'] == "other-subnet") { echo $natent['targetip'] . '/' . $natent['targetip_subnet']; - else + } else { echo $natent['target']; + } ?> @@ -531,11 +540,13 @@ print($form); @@ -588,8 +600,9 @@ if ($mode == "automatic" || $mode == "hybrid"): if (isset($natent['destination']['any'])) { echo "*"; } else { - if (isset($natent['destination']['not'])) + if (isset($natent['destination']['not'])) { echo "! "; + } echo $natent['destination']['address']; } @@ -598,38 +611,42 @@ if ($mode == "automatic" || $mode == "hybrid"): -- cgit v1.1