* All rights reserved. * * originally based on m0n0wall (http://m0n0.ch/wall) * Copyright (c) 2003-2004 Manuel Kasper . * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ##|+PRIV ##|*IDENT=page-firewall-nat-npt ##|*NAME=Firewall: NAT: NPt ##|*DESCR=Allow access to the 'Firewall: NAT: NPt' page. ##|*MATCH=firewall_nat_npt.php* ##|-PRIV require_once("guiconfig.inc"); require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); if (!is_array($config['nat']['npt'])) { $config['nat']['npt'] = array(); } $a_npt = &$config['nat']['npt']; /* update rule order, POST[rule] is an array of ordered IDs */ if (array_key_exists('order-store', $_REQUEST)) { if (is_array($_POST['rule']) && !empty($_REQUEST['rule'])) { $a_npt_new = array(); // if a rule is not in POST[rule], it has been deleted by the user foreach ($_REQUEST['rule'] as $id) { $a_npt_new[] = $a_npt[$id]; } $a_npt = $a_npt_new; if (write_config(gettext("Firewall: NAT: NPt - reordered NPt mappings."))) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_npt.php"); exit; } } if ($_POST['apply']) { $retval = 0; $retval |= filter_configure(); if ($retval == 0) { clear_subsystem_dirty('natconf'); clear_subsystem_dirty('filter'); } } if ($_POST['act'] == "del") { if ($a_npt[$_POST['id']]) { unset($a_npt[$_POST['id']]); if (write_config(gettext("Firewall: NAT: NPt - deleted NPt mapping."))) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_npt.php"); exit; } } if (isset($_POST['del_x'])) { /* delete selected rules */ if (is_array($_POST['rule']) && count($_POST['rule'])) { foreach ($_POST['rule'] as $rulei) { unset($a_npt[$rulei]); } if (write_config(gettext("Firewall: NAT: NPt - deleted selected NPt mappings."))) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_npt.php"); exit; } } else if ($_POST['act'] == "toggle") { if ($a_npt[$_POST['id']]) { if (isset($a_npt[$_POST['id']]['disabled'])) { unset($a_npt[$_POST['id']]['disabled']); $wc_msg = gettext('Firewall: NAT: NPt - enabled NPt rule.'); } else { $a_npt[$_POST['id']]['disabled'] = true; $wc_msg = gettext('Firewall: NAT: NPt - disabled NPt rule.'); } if (write_config($wc_msg)) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_npt.php"); exit; } } $pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("NPt")); $pglinks = array("", "firewall_nat.php", "@self"); include("head.inc"); if ($_POST['apply']) { print_apply_result_box($retval); } if (is_subsystem_dirty('natconf')) { print_apply_box(gettext('The NAT configuration has been changed.') . '
' . gettext('The changes must be applied for them to take effect.')); } $tab_array = array(); $tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php"); $tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php"); $tab_array[] = array(gettext("Outbound"), false, "firewall_nat_out.php"); $tab_array[] = array(gettext("NPt"), true, "firewall_nat_npt.php"); display_top_tabs($tab_array); ?>

"; $i = 0; foreach ($a_npt as $natent): if (isset($natent['disabled'])) { $textss = ""; $iconfn = "pass_d"; $trclass = 'class="disabled"'; } else { $textss = ""; $iconfn = "pass"; $trclass = ''; } ?> onClick="fr_toggle()" ondblclick="document.location='firewall_nat_npt_edit.php?id=';">
" title=""> " href="firewall_nat_npt_edit.php?id="> " href="firewall_nat_npt_edit.php?dup="> " href="firewall_nat_npt.php?act=del&id=" usepost>