diff --git a/src/www/firewall_nat_1to1.php b/src/www/firewall_nat_1to1.php index f73937a3e..f6fab4ef0 100644 --- a/src/www/firewall_nat_1to1.php +++ b/src/www/firewall_nat_1to1.php @@ -1,29 +1,29 @@ . - All rights reserved. + Copyright (C) 2014 Deciso B.V. + Copyright (C) 2003-2004 Manuel Kasper . + All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ require_once("guiconfig.inc"); @@ -31,96 +31,96 @@ require_once("interfaces.inc"); require_once("filter.inc"); if (!isset($config['nat']['onetoone'])) { - $config['nat']['onetoone'] = array(); + $config['nat']['onetoone'] = array(); } $a_1to1 = &$config['nat']['onetoone']; if ($_SERVER['REQUEST_METHOD'] === 'POST') { - $pconfig = $_POST; - if (isset($pconfig['id']) && isset($a_1to1[$pconfig['id']])) { - // id found and valid - $id = $pconfig['id']; - } + $pconfig = $_POST; + if (isset($pconfig['id']) && isset($a_1to1[$pconfig['id']])) { + // id found and valid + $id = $pconfig['id']; + } - if (isset($pconfig['apply'])) { - filter_configure(); - $savemsg = get_std_save_message(); - clear_subsystem_dirty('natconf'); - clear_subsystem_dirty('filter'); - } elseif (isset($pconfig['action']) && $pconfig['action'] == 'del' && isset($id)) { - // delete single entry - unset($a_1to1[$id]); - if (write_config()) { - mark_subsystem_dirty('natconf'); - } - header("Location: firewall_nat_1to1.php"); - exit; - } elseif (isset($pconfig['action']) && $pconfig['action'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) { - // delete selected - foreach ($pconfig['rule'] as $rulei) { - unset($a_1to1[$rulei]); - } - if (write_config()) { - mark_subsystem_dirty('natconf'); - } - header("Location: firewall_nat_1to1.php"); - exit; - } elseif (isset($pconfig['action']) && $pconfig['action'] == 'move') { - // move selected - if (isset($pconfig['rule']) && count($pconfig['rule']) > 0) { - // if rule not set/found, move to end - if (!isset($id)) { - $id = count($a_1to1); - } - $a_1to1_new = array(); + if (isset($pconfig['apply'])) { + filter_configure(); + $savemsg = get_std_save_message(); + clear_subsystem_dirty('natconf'); + clear_subsystem_dirty('filter'); + } elseif (isset($pconfig['action']) && $pconfig['action'] == 'del' && isset($id)) { + // delete single entry + unset($a_1to1[$id]); + if (write_config()) { + mark_subsystem_dirty('natconf'); + } + header("Location: firewall_nat_1to1.php"); + exit; + } elseif (isset($pconfig['action']) && $pconfig['action'] == 'del_x' && isset($pconfig['rule']) && count($pconfig['rule']) > 0) { + // delete selected + foreach ($pconfig['rule'] as $rulei) { + unset($a_1to1[$rulei]); + } + if (write_config()) { + mark_subsystem_dirty('natconf'); + } + header("Location: firewall_nat_1to1.php"); + exit; + } elseif (isset($pconfig['action']) && $pconfig['action'] == 'move') { + // move selected + if (isset($pconfig['rule']) && count($pconfig['rule']) > 0) { + // if rule not set/found, move to end + if (!isset($id)) { + $id = count($a_1to1); + } + $a_1to1_new = array(); - /* copy all rules < $id and not selected */ - for ($i = 0; $i < $id; $i++) { - if (!in_array($i, $pconfig['rule'])) { - $a_1to1_new[] = $a_1to1[$i]; - } - } + /* copy all rules < $id and not selected */ + for ($i = 0; $i < $id; $i++) { + if (!in_array($i, $pconfig['rule'])) { + $a_1to1_new[] = $a_1to1[$i]; + } + } - /* copy all selected rules */ - for ($i = 0; $i < count($a_1to1); $i++) { - if ($i == $id) - continue; - if (in_array($i, $pconfig['rule'])) { - $a_1to1_new[] = $a_1to1[$i]; - } - } + /* copy all selected rules */ + for ($i = 0; $i < count($a_1to1); $i++) { + if ($i == $id) + continue; + if (in_array($i, $pconfig['rule'])) { + $a_1to1_new[] = $a_1to1[$i]; + } + } - /* copy $id rule */ - if ($id < count($a_1to1)) { - $a_1to1_new[] = $a_1to1[$id]; - } + /* copy $id rule */ + if ($id < count($a_1to1)) { + $a_1to1_new[] = $a_1to1[$id]; + } - /* copy all rules > $id and not selected */ - for ($i = $id+1; $i < count($a_1to1); $i++) { - if (!in_array($i, $pconfig['rule'])) { - $a_1to1_new[] = $a_1to1[$i]; - } - } - $a_1to1 = $a_1to1_new; - } - if (write_config()) { - mark_subsystem_dirty('natconf'); - } - header("Location: firewall_nat_1to1.php"); - exit; - } elseif (isset($pconfig['action']) && $pconfig['action'] == 'toggle' && isset($id)) { - // toggle item - if(isset($a_1to1[$id]['disabled'])) { - unset($a_1to1[$id]['disabled']); - } else { - $a_1to1[$id]['disabled'] = true; - } - if (write_config("Firewall: NAT: Outbound, enable/disable NAT rule")) { - mark_subsystem_dirty('natconf'); - } - header("Location: firewall_nat_1to1.php"); - exit; - } + /* copy all rules > $id and not selected */ + for ($i = $id+1; $i < count($a_1to1); $i++) { + if (!in_array($i, $pconfig['rule'])) { + $a_1to1_new[] = $a_1to1[$i]; + } + } + $a_1to1 = $a_1to1_new; + } + if (write_config()) { + mark_subsystem_dirty('natconf'); + } + header("Location: firewall_nat_1to1.php"); + exit; + } elseif (isset($pconfig['action']) && $pconfig['action'] == 'toggle' && isset($id)) { + // toggle item + if(isset($a_1to1[$id]['disabled'])) { + unset($a_1to1[$id]['disabled']); + } else { + $a_1to1[$id]['disabled'] = true; + } + if (write_config("Firewall: NAT: Outbound, enable/disable NAT rule")) { + mark_subsystem_dirty('natconf'); + } + header("Location: firewall_nat_1to1.php"); + exit; + } } legacy_html_escape_form_data($a_1to1); @@ -128,242 +128,242 @@ $pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("1:1")); include("head.inc"); $main_buttons = array( - array('label'=>gettext("add rule"), 'href'=>'firewall_nat_1to1_edit.php'), + array('label'=>gettext("add rule"), 'href'=>'firewall_nat_1to1_edit.php'), ); ?> - + }); + -
-
-
+
+
+
" . - gettext("You must apply the changes in order for them to take effect.")); + if (isset($savemsg)) + print_info_box($savemsg); + 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.")); ?> -
+
-
-
- - - - - - - - - - - - - - - - +
+ + + +
  
+ + + + + + + + + + + + + - valign="top" ondblclick="document.location='firewall_nat_1to1_edit.php?id=';"> - - - - - - - - - + valign="top" ondblclick="document.location='firewall_nat_1to1_edit.php?id=';"> + + + + + + + + + - - - + - - - - - - - - - - - - - - - - - - - - - - -
  
- - - " class="act_toggle glyphicon glyphicon glyphicon-play "> - - - - - - -   - - - - -   - - - - -   - - -   - - " class="act_move btn btn-default btn-xs"> - - - "> - - - " data-toggle="tooltip" class="act_delete btn btn-default btn-xs"> - - - " class="btn btn-default btn-xs"> - - -
+ + + " class="act_toggle glyphicon glyphicon glyphicon-play "> + + + + + + +   + + + + +   + + + + +   + + +   + + " class="act_move btn btn-default btn-xs"> + + + "> + + + " data-toggle="tooltip" class="act_delete btn btn-default btn-xs"> + + + " class="btn btn-default btn-xs"> + + +
- + + - " class="btn btn-default btn-xs"> - - - -" class="btn btn-default btn-xs"> + + + + - " class="act_move btn btn-default btn-xs"> - - -" name="move__x" data-toggle="tooltip" data-placement="left" title="" class="act_move btn btn-default btn-xs"> + + + - - " data-toggle="tooltip" class="btn btn-default btn-xs"> - - -" data-toggle="tooltip" class="btn btn-default btn-xs"> + + + - " data-toggle="tooltip" class="act_delete btn btn-default btn-xs"> - - -" data-toggle="tooltip" class="act_delete btn btn-default btn-xs"> + + + - " class="btn btn-default btn-xs"> -
 
-

- -
-
-
- -
- -

-
-
-
-
-
-
-
+ " class="btn btn-default btn-xs"> + + + + + +   + + + + + + + + + + + + + + + +

+ +
+
+
+ +
+ +

+ + + + + +
+
+ + +