diff options
Diffstat (limited to 'usr/local/www/firewall_nat_1to1.php')
-rw-r--r-- | usr/local/www/firewall_nat_1to1.php | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/usr/local/www/firewall_nat_1to1.php b/usr/local/www/firewall_nat_1to1.php index 56adc69..fea2dd4 100644 --- a/usr/local/www/firewall_nat_1to1.php +++ b/usr/local/www/firewall_nat_1to1.php @@ -46,8 +46,9 @@ require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); -if (!is_array($config['nat']['onetoone'])) +if (!is_array($config['nat']['onetoone'])) { $config['nat']['onetoone'] = array(); +} $a_1to1 = &$config['nat']['onetoone']; @@ -69,8 +70,9 @@ if ($_POST) { if ($_GET['act'] == "del") { if ($a_1to1[$_GET['id']]) { unset($a_1to1[$_GET['id']]); - if (write_config()) + if (write_config()) { mark_subsystem_dirty('natconf'); + } header("Location: firewall_nat_1to1.php"); exit; } @@ -82,20 +84,23 @@ if (isset($_POST['del_x'])) { foreach ($_POST['rule'] as $rulei) { unset($a_1to1[$rulei]); } - if (write_config()) + if (write_config()) { mark_subsystem_dirty('natconf'); + } header("Location: firewall_nat_1to1.php"); exit; } } else if ($_GET['act'] == "toggle") { if ($a_1to1[$_GET['id']]) { - if(isset($a_1to1[$_GET['id']]['disabled'])) + if (isset($a_1to1[$_GET['id']]['disabled'])) { unset($a_1to1[$_GET['id']]['disabled']); - else + } else { $a_1to1[$_GET['id']]['disabled'] = true; - if (write_config("Firewall: NAT: Outbound, enable/disable NAT rule")) + } + if (write_config("Firewall: NAT: Outbound, enable/disable NAT rule")) { mark_subsystem_dirty('natconf'); + } header("Location: firewall_nat_1to1.php"); exit; } @@ -114,32 +119,39 @@ if (isset($_POST['del_x'])) { /* copy all rules < $movebtn and not selected */ for ($i = 0; $i < $movebtn; $i++) { - if (!in_array($i, $_POST['rule'])) + if (!in_array($i, $_POST['rule'])) { $a_1to1_new[] = $a_1to1[$i]; + } } /* copy all selected rules */ for ($i = 0; $i < count($a_1to1); $i++) { - if ($i == $movebtn) + if ($i == $movebtn) { continue; - if (in_array($i, $_POST['rule'])) + } + if (in_array($i, $_POST['rule'])) { $a_1to1_new[] = $a_1to1[$i]; + } } /* copy $movebtn rule */ - if ($movebtn < count($a_1to1)) + if ($movebtn < count($a_1to1)) { $a_1to1_new[] = $a_1to1[$movebtn]; + } /* copy all rules > $movebtn and not selected */ for ($i = $movebtn+1; $i < count($a_1to1); $i++) { - if (!in_array($i, $_POST['rule'])) + if (!in_array($i, $_POST['rule'])) { $a_1to1_new[] = $a_1to1[$i]; + } } - if (count($a_1to1_new) > 0) + if (count($a_1to1_new) > 0) { $a_1to1 = $a_1to1_new; + } - if (write_config()) + if (write_config()) { mark_subsystem_dirty('natconf'); + } header("Location: firewall_nat_1to1.php"); exit; } @@ -154,12 +166,14 @@ include("head.inc"); <form action="firewall_nat_1to1.php" method="post"> <script type="text/javascript" src="/javascript/row_toggle.js"></script> <?php -if ($savemsg) +if ($savemsg) { print_info_box($savemsg); -if (is_subsystem_dirty('natconf')) +} +if (is_subsystem_dirty('natconf')) { print_info_box_np(gettext("The NAT configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect.")); +} ?> <br /> <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall nat 1to1"> @@ -222,10 +236,11 @@ if (is_subsystem_dirty('natconf')) <td class="listlr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';"> <?php echo $textss; - if (!$natent['interface']) + if (!$natent['interface']) { echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan")); - else + } else { echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); + } echo $textse; ?> </td> |