From 079d1952fdd2aeb668f785a804bcedfd6b8115ef Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 4 Jul 2013 10:42:48 -0300 Subject: Add a new alias type, URLs containing Ports --- usr/local/www/firewall_aliases_edit.php | 41 +++++++++++++++++----- usr/local/www/firewall_nat_edit.php | 2 +- usr/local/www/firewall_nat_out_edit.php | 2 +- usr/local/www/firewall_rules_edit.php | 2 +- usr/local/www/load_balancer_pool_edit.php | 2 +- .../www/load_balancer_virtual_server_edit.php | 2 +- 6 files changed, 37 insertions(+), 14 deletions(-) (limited to 'usr') diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php index 115ee92..c2b0f44 100755 --- a/usr/local/www/firewall_aliases_edit.php +++ b/usr/local/www/firewall_aliases_edit.php @@ -111,7 +111,6 @@ if (isset($id) && $a_aliases[$id]) { $pconfig['updatefreq'] = $a_aliases[$id]['updatefreq']; } if($a_aliases[$id]['aliasurl'] <> "") { - $pconfig['type'] = "url"; if(is_array($a_aliases[$id]['aliasurl'])) $pconfig['address'] = implode(" ", $a_aliases[$id]['aliasurl']); else @@ -190,7 +189,7 @@ if ($_POST) { else $final_address_details[] = sprintf(gettext("Entry added %s"), date('r')); } - } elseif($_POST['type'] == "url") { + } else if ($_POST['type'] == "url" || $_POST['type'] == "url_ports") { $isfirst = 0; $address_count = 2; @@ -234,7 +233,12 @@ if ($_POST) { $tmp = trim($tmp_split[0]); } $tmp = trim($tmp); - if(!empty($tmp) && (is_ipaddr($tmp) || is_subnet($tmp))) { + if ($_POST['type'] == "url") + $is_valid = (is_ipaddr($tmp) || is_subnet($tmp)); + else + $is_valid = (is_port($tmp) || is_portrange($tmp)); + + if (!empty($tmp) && $is_valid) { $address[] = $tmp; $isfirst = 1; $address_count++; @@ -252,6 +256,8 @@ if ($_POST) { } } } + if ($_POST['type'] == "url_ports") + $address = group_ports($address); } else { /* item is a normal alias type */ $wrongaliases = ""; @@ -372,7 +378,7 @@ if ($_POST) { { $pconfig['name'] = $_POST['name']; $pconfig['descr'] = $_POST['descr']; - if ($_POST['type'] == 'url') + if (($_POST['type'] == 'url') || ($_POST['type'] == 'url_ports')) $pconfig['address'] = implode(" ", $alias['aliasurl']); else $pconfig['address'] = implode(" ", $address); @@ -441,8 +447,15 @@ function typesel_change() { eval(comd); } break; - - case 4: /* urltable */ + case 4: /* url_ports */ + var cmd; + newrows = totalrows; + for(i=0; i > - + + diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php index 87de18f..26e4a35 100755 --- a/usr/local/www/firewall_nat_edit.php +++ b/usr/local/www/firewall_nat_edit.php @@ -912,7 +912,7 @@ $has_updated_time = (isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['upda diff --git a/usr/local/www/load_balancer_virtual_server_edit.php b/usr/local/www/load_balancer_virtual_server_edit.php index b2e73b1..3cdc9b5 100755 --- a/usr/local/www/load_balancer_virtual_server_edit.php +++ b/usr/local/www/load_balancer_virtual_server_edit.php @@ -186,7 +186,7 @@ include("head.inc");
-- cgit v1.1