diff options
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/local/www/firewall_nat.php | 72 | ||||
-rw-r--r-- | src/usr/local/www/firewall_nat_edit.php | 20 |
2 files changed, 43 insertions, 49 deletions
diff --git a/src/usr/local/www/firewall_nat.php b/src/usr/local/www/firewall_nat.php index d8951d5..860f90f 100644 --- a/src/usr/local/www/firewall_nat.php +++ b/src/usr/local/www/firewall_nat.php @@ -74,41 +74,41 @@ if (array_key_exists('order-store', $_POST)) { } /* if a custom message has been passed along, lets process it */ -if ($_GET['savemsg']) { - $savemsg = $_GET['savemsg']; +if ($_POST['savemsg']) { + $savemsg = $_POST['savemsg']; } if ($_POST) { $pconfig = $_POST; +} - if ($_POST['apply']) { +if ($_POST['apply']) { - $retval = 0; + $retval = 0; - $retval |= filter_configure(); + $retval |= filter_configure(); - pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/apply"); - - if ($retval == 0) { - clear_subsystem_dirty('natconf'); - clear_subsystem_dirty('filter'); - } + pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/apply"); + if ($retval == 0) { + clear_subsystem_dirty('natconf'); + clear_subsystem_dirty('filter'); } + } -if ($_GET['act'] == "del") { - if ($a_nat[$_GET['id']]) { +if ($_POST['act'] == "del") { + if ($a_nat[$_POST['id']]) { - if (isset($a_nat[$_GET['id']]['associated-rule-id'])) { - delete_id($a_nat[$_GET['id']]['associated-rule-id'], $config['filter']['rule']); + if (isset($a_nat[$_POST['id']]['associated-rule-id'])) { + delete_id($a_nat[$_POST['id']]['associated-rule-id'], $config['filter']['rule']); $want_dirty_filter = true; } - unset($a_nat[$_GET['id']]); + unset($a_nat[$_POST['id']]); // Update the separators $a_separators = &$config['nat']['separator']; - $ridx = $_GET['id']; + $ridx = $_POST['id']; $mvnrows = -1; move_separators($a_separators, $ridx, $mvnrows); @@ -156,19 +156,19 @@ if (isset($_POST['del_x'])) { header("Location: firewall_nat.php"); exit; } -} else if ($_GET['act'] == "toggle") { - if ($a_nat[$_GET['id']]) { - if (isset($a_nat[$_GET['id']]['disabled'])) { - unset($a_nat[$_GET['id']]['disabled']); +} else if ($_POST['act'] == "toggle") { + if ($a_nat[$_POST['id']]) { + if (isset($a_nat[$_POST['id']]['disabled'])) { + unset($a_nat[$_POST['id']]['disabled']); $rule_status = true; } else { - $a_nat[$_GET['id']]['disabled'] = true; + $a_nat[$_POST['id']]['disabled'] = true; $rule_status = false; } // Check for filter rule associations - if (isset($a_nat[$_GET['id']]['associated-rule-id'])) { - toggle_id($a_nat[$_GET['id']]['associated-rule-id'], + if (isset($a_nat[$_POST['id']]['associated-rule-id'])) { + toggle_id($a_nat[$_POST['id']]['associated-rule-id'], $config['filter']['rule'], $rule_status); unset($rule_status); mark_subsystem_dirty('filter'); @@ -289,7 +289,7 @@ foreach ($a_nat as $natent): <input type="checkbox" id="frc<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" name="rule[]" value="<?=$i;?>"/> </td> <td> - <a href="?act=toggle&id=<?=$i?>"> + <a href="?act=toggle&id=<?=$i?>" usepost> <i class="fa fa-check" title="<?=gettext("click to toggle enabled/disabled status")?>"></i> <?php if (isset($natent['nordr'])) { ?> <i class="fa fa-hand-stop-o text-danger" title="<?=gettext("Negated: This rule excludes NAT from a later rule")?>"></i> @@ -331,7 +331,7 @@ foreach ($a_nat as $natent): <?php if (isset($alias['src'])): ?> - <a href="/firewall_aliases_edit.php?id=<?=$alias['src']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['src'])?>" data-html="true"> + <a href="/firewall_aliases_edit.php?id=<?=$alias['src']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['src'])?>" data-html="true" usepost> <?php endif; ?> @@ -348,7 +348,7 @@ foreach ($a_nat as $natent): <?php if (isset($alias['srcport'])): ?> - <a href="/firewall_aliases_edit.php?id=<?=$alias['srcport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['srcport'])?>" data-html="true"> + <a href="/firewall_aliases_edit.php?id=<?=$alias['srcport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['srcport'])?>" data-html="true" usepost> <?php endif; ?> @@ -366,7 +366,7 @@ foreach ($a_nat as $natent): <?php if (isset($alias['dst'])): ?> - <a href="/firewall_aliases_edit.php?id=<?=$alias['dst']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['dst'])?>" data-html="true"> + <a href="/firewall_aliases_edit.php?id=<?=$alias['dst']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['dst'])?>" data-html="true" usepost> <?php endif; ?> @@ -383,7 +383,7 @@ foreach ($a_nat as $natent): <?php if (isset($alias['dstport'])): ?> - <a href="/firewall_aliases_edit.php?id=<?=$alias['dstport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['dstport'])?>" data-html="true"> + <a href="/firewall_aliases_edit.php?id=<?=$alias['dstport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['dstport'])?>" data-html="true" usepost> <?php endif; ?> @@ -400,7 +400,7 @@ foreach ($a_nat as $natent): <?php if (isset($alias['target'])): ?> - <a href="/firewall_aliases_edit.php?id=<?=$alias['target']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['target'])?>" data-html="true"> + <a href="/firewall_aliases_edit.php?id=<?=$alias['target']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['target'])?>" data-html="true" usepost> <?php endif; ?> @@ -418,7 +418,7 @@ foreach ($a_nat as $natent): <?php if (isset($alias['targetport'])): ?> - <a href="/firewall_aliases_edit.php?id=<?=$alias['targetport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['targetport'])?>" data-html="true"> + <a href="/firewall_aliases_edit.php?id=<?=$alias['targetport']?>" data-toggle="popover" data-trigger="hover focus" title="<?=gettext('Alias details')?>" data-content="<?=alias_info_popup($alias['targetport'])?>" data-html="true" usepost> <?php endif; ?> @@ -436,9 +436,9 @@ foreach ($a_nat as $natent): <?=htmlspecialchars($natent['descr'])?> </td> <td> - <a class="fa fa-pencil" title="<?=gettext("Edit rule"); ?>" href="firewall_nat_edit.php?id=<?=$i?>"></a> - <a class="fa fa-clone" title="<?=gettext("Add a new NAT based on this one")?>" href="firewall_nat_edit.php?dup=<?=$i?>"></a> - <a class="fa fa-trash" title="<?=gettext("Delete rule")?>" href="firewall_nat.php?act=del&id=<?=$i?>"></a> + <a class="fa fa-pencil" title="<?=gettext("Edit rule"); ?>" href="firewall_nat_edit.php?id=<?=$i?>" usepost></a> + <a class="fa fa-clone" title="<?=gettext("Add a new NAT based on this one")?>" href="firewall_nat_edit.php?dup=<?=$i?>" usepost></a> + <a class="fa fa-trash" title="<?=gettext("Delete rule")?>" href="firewall_nat.php?act=del&id=<?=$i?>" usepost></a> </td> </tr> <?php @@ -458,11 +458,11 @@ if ($seprows[$nnats]) { </div> <nav class="action-buttons"> - <a href="firewall_nat_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the top of the list')?>"> + <a href="firewall_nat_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the top of the list')?>" usepost> <i class="fa fa-level-up icon-embed-btn"></i> <?=gettext('Add')?> </a> - <a href="firewall_nat_edit.php" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the end of the list')?>"> + <a href="firewall_nat_edit.php" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the end of the list')?>" usepost> <i class="fa fa-level-down icon-embed-btn"></i> <?=gettext('Add')?> </a> diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php index 6803436..ba6d86b 100644 --- a/src/usr/local/www/firewall_nat_edit.php +++ b/src/usr/local/www/firewall_nat_edit.php @@ -52,23 +52,17 @@ if (!is_array($config['nat']['rule'])) { $a_nat = &$config['nat']['rule']; -if (is_numericint($_GET['id'])) { - $id = $_GET['id']; -} if (isset($_POST['id']) && is_numericint($_POST['id'])) { $id = $_POST['id']; } -if (is_numericint($_GET['after']) || $_GET['after'] == "-1") { - $after = $_GET['after']; -} if (isset($_POST['after']) && (is_numericint($_POST['after']) || $_POST['after'] == "-1")) { $after = $_POST['after']; } -if (isset($_GET['dup']) && is_numericint($_GET['dup'])) { - $id = $_GET['dup']; - $after = $_GET['dup']; +if (isset($_POST['dup']) && is_numericint($_POST['dup'])) { + $id = $_POST['dup']; + $after = $_POST['dup']; } if (isset($id) && $a_nat[$id]) { @@ -110,7 +104,7 @@ if (isset($id) && $a_nat[$id]) { $pconfig['srcendport'] = "any"; } -if (isset($_GET['dup']) && is_numericint($_GET['dup'])) { +if (isset($_POST['dup']) && is_numericint($_POST['dup'])) { unset($id); } @@ -127,7 +121,7 @@ foreach ($_POST as $key => $value) { } } -if ($_POST) { +if ($_POST['save']) { if (strtoupper($_POST['proto']) == "TCP" || strtoupper($_POST['proto']) == "UDP" || strtoupper($_POST['proto']) == "TCP/UDP") { if ($_POST['srcbeginport_cust'] && !$_POST['srcbeginport']) { @@ -907,7 +901,7 @@ $section->addInput(new Form_Select( ) )); -if (isset($id) && $a_nat[$id] && (!isset($_GET['dup']) || !is_numericint($_GET['dup']))) { +if (isset($id) && $a_nat[$id] && (!isset($_POST['dup']) || !is_numericint($_POST['dup']))) { $hlpstr = ''; $rulelist = array('' => gettext('None'), 'pass' => gettext('Pass')); @@ -920,7 +914,7 @@ if (isset($id) && $a_nat[$id] && (!isset($_GET['dup']) || !is_numericint($_GET[' $rulelist[$filter_rule['associated-rule-id']] = sprintf(gettext('Rule %s'), $filter_rule['descr']); if ($filter_rule['associated-rule-id'] == $pconfig['associated-rule-id']) { - $hlpstr = '<a href="firewall_rules_edit.php?id=' . $filter_id . '">' . gettext("View the filter rule") . '</a><br />'; + $hlpstr = '<a href="firewall_rules_edit.php?id=' . $filter_id . '" usepost>' . gettext("View the filter rule") . '</a><br />'; } } } |