1 |
d2cfb7a4
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
firewall_aliases_edit.php
|
5 |
2e9ab96b
|
Scott Ullrich
|
Copyright (C) 2004 Scott Ullrich
|
6 |
09a68ea4
|
Phil Davis
|
Copyright (C) 2009 Ermal Luçi
|
7 |
fff3d2b9
|
jim-p
|
Copyright (C) 2010 Jim Pingle
|
8 |
dd447bde
|
Jim Thompson
|
Copyright (C) 2013-2014 Electric Sheep Fencing, LP
|
9 |
2e9ab96b
|
Scott Ullrich
|
All rights reserved.
|
10 |
|
|
|
11 |
bbd1f783
|
Phil Davis
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
12 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
13 |
|
|
All rights reserved.
|
14 |
d2cfb7a4
|
Scott Ullrich
|
|
15 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
16 |
|
|
modification, are permitted provided that the following conditions are met:
|
17 |
d2cfb7a4
|
Scott Ullrich
|
|
18 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
19 |
|
|
this list of conditions and the following disclaimer.
|
20 |
d2cfb7a4
|
Scott Ullrich
|
|
21 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
22 |
|
|
notice, this list of conditions and the following disclaimer in the
|
23 |
|
|
documentation and/or other materials provided with the distribution.
|
24 |
d2cfb7a4
|
Scott Ullrich
|
|
25 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
26 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
27 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
28 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
29 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
30 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
32 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
33 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
34 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
35 |
|
|
*/
|
36 |
7ac5a4cb
|
Scott Ullrich
|
/*
|
37 |
|
|
pfSense_BUILDER_BINARIES: /bin/rm /bin/mkdir /usr/bin/fetch
|
38 |
|
|
pfSense_MODULE: aliases
|
39 |
|
|
*/
|
40 |
5b237745
|
Scott Ullrich
|
|
41 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
42 |
|
|
##|*IDENT=page-firewall-alias-edit
|
43 |
|
|
##|*NAME=Firewall: Alias: Edit page
|
44 |
|
|
##|*DESCR=Allow access to the 'Firewall: Alias: Edit' page.
|
45 |
|
|
##|*MATCH=firewall_aliases_edit.php*
|
46 |
|
|
##|-PRIV
|
47 |
|
|
|
48 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
49 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
50 |
|
|
require_once("filter.inc");
|
51 |
|
|
require_once("shaper.inc");
|
52 |
5b237745
|
Scott Ullrich
|
|
53 |
b13f7f80
|
Carlos Eduardo Ramos
|
$pgtitle = array(gettext("Firewall"),gettext("Aliases"),gettext("Edit"));
|
54 |
|
|
|
55 |
62424bdb
|
Renato Botelho
|
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php');
|
56 |
|
|
|
57 |
c48fdaa4
|
Renato Botelho
|
// Keywords not allowed in names
|
58 |
|
|
$reserved_keywords = array("all", "pass", "block", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec");
|
59 |
|
|
|
60 |
24445691
|
Phil Davis
|
// Add all Load balance names to reserved_keywords
|
61 |
c48fdaa4
|
Renato Botelho
|
if (is_array($config['load_balancer']['lbpool']))
|
62 |
|
|
foreach ($config['load_balancer']['lbpool'] as $lbpool)
|
63 |
|
|
$reserved_keywords[] = $lbpool['name'];
|
64 |
|
|
|
65 |
7c9d8d71
|
Ermal Lu?i
|
$reserved_ifs = get_configured_interface_list(false, true);
|
66 |
c48fdaa4
|
Renato Botelho
|
$reserved_keywords = array_merge($reserved_keywords, $reserved_ifs, $reserved_table_names);
|
67 |
feb1953e
|
Phil Davis
|
$max_alias_addresses = 5000;
|
68 |
7c9d8d71
|
Ermal Lu?i
|
|
69 |
5b237745
|
Scott Ullrich
|
if (!is_array($config['aliases']['alias']))
|
70 |
|
|
$config['aliases']['alias'] = array();
|
71 |
|
|
$a_aliases = &$config['aliases']['alias'];
|
72 |
f29109d0
|
Renato Botelho
|
|
73 |
ac7f1763
|
Renato Botelho
|
$tab = $_REQUEST['tab'];
|
74 |
|
|
|
75 |
ed0b7949
|
Scott Ullrich
|
if($_POST)
|
76 |
|
|
$origname = $_POST['origname'];
|
77 |
|
|
|
78 |
|
|
// Debugging
|
79 |
f5200c44
|
Scott Ullrich
|
if($debug)
|
80 |
552f5a6a
|
Renato Botelho
|
unlink_if_exists("{$g['tmp_path']}/alias_rename_log.txt");
|
81 |
ed0b7949
|
Scott Ullrich
|
|
82 |
5e34cdb2
|
Ermal Lu?i
|
function alias_same_type($name, $type) {
|
83 |
|
|
global $config;
|
84 |
f29109d0
|
Renato Botelho
|
|
85 |
5e34cdb2
|
Ermal Lu?i
|
foreach ($config['aliases']['alias'] as $alias) {
|
86 |
|
|
if ($name == $alias['name']) {
|
87 |
d6c9ab97
|
Ermal Lu?i
|
if (in_array($type, array("host", "network")) &&
|
88 |
5e34cdb2
|
Ermal Lu?i
|
in_array($alias['type'], array("host", "network")))
|
89 |
|
|
return true;
|
90 |
|
|
if ($type == $alias['type'])
|
91 |
|
|
return true;
|
92 |
|
|
else
|
93 |
|
|
return false;
|
94 |
|
|
}
|
95 |
|
|
}
|
96 |
|
|
return true;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
e41ec584
|
Renato Botelho
|
if (is_numericint($_GET['id']))
|
100 |
|
|
$id = $_GET['id'];
|
101 |
|
|
if (isset($_POST['id']) && is_numericint($_POST['id']))
|
102 |
5b237745
|
Scott Ullrich
|
$id = $_POST['id'];
|
103 |
|
|
|
104 |
|
|
if (isset($id) && $a_aliases[$id]) {
|
105 |
ed0b7949
|
Scott Ullrich
|
$original_alias_name = $a_aliases[$id]['name'];
|
106 |
5b237745
|
Scott Ullrich
|
$pconfig['name'] = $a_aliases[$id]['name'];
|
107 |
ba393f6c
|
Scott Dale
|
$pconfig['detail'] = $a_aliases[$id]['detail'];
|
108 |
|
|
$pconfig['address'] = $a_aliases[$id]['address'];
|
109 |
b4deddce
|
Ermal Lu?i
|
$pconfig['type'] = $a_aliases[$id]['type'];
|
110 |
ba393f6c
|
Scott Dale
|
$pconfig['descr'] = html_entity_decode($a_aliases[$id]['descr']);
|
111 |
e47c266d
|
Scott Ullrich
|
|
112 |
dd042c51
|
Renato Botelho
|
if(preg_match("/urltable/i", $a_aliases[$id]['type'])) {
|
113 |
c7de8be4
|
jim-p
|
$pconfig['address'] = $a_aliases[$id]['url'];
|
114 |
|
|
$pconfig['updatefreq'] = $a_aliases[$id]['updatefreq'];
|
115 |
|
|
}
|
116 |
5a1eebc7
|
Scott Ullrich
|
if($a_aliases[$id]['aliasurl'] <> "") {
|
117 |
c5eaef8e
|
Renato Botelho
|
if(is_array($a_aliases[$id]['aliasurl']))
|
118 |
|
|
$pconfig['address'] = implode(" ", $a_aliases[$id]['aliasurl']);
|
119 |
|
|
else
|
120 |
5a1eebc7
|
Scott Ullrich
|
$pconfig['address'] = $a_aliases[$id]['aliasurl'];
|
121 |
|
|
}
|
122 |
5b237745
|
Scott Ullrich
|
}
|
123 |
|
|
|
124 |
|
|
if ($_POST) {
|
125 |
|
|
unset($input_errors);
|
126 |
24445691
|
Phil Davis
|
$vertical_bar_err_text = gettext("Vertical bars (|) at start or end, or double in the middle of descriptions not allowed. Descriptions have been cleaned. Check and save again.");
|
127 |
5b237745
|
Scott Ullrich
|
|
128 |
|
|
/* input validation */
|
129 |
0cd7ed19
|
Scott Ullrich
|
|
130 |
69d2ad77
|
Erik Fonnesbeck
|
$reqdfields = explode(" ", "name");
|
131 |
bd413d76
|
Renato Botelho
|
$reqdfieldsn = array(gettext("Name"));
|
132 |
69d2ad77
|
Erik Fonnesbeck
|
|
133 |
1e9b4611
|
Renato Botelho
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
134 |
69d2ad77
|
Erik Fonnesbeck
|
|
135 |
0df6adf8
|
Bill Marquette
|
$x = is_validaliasname($_POST['name']);
|
136 |
|
|
if (!isset($x)) {
|
137 |
24148939
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("Reserved word used for alias name.");
|
138 |
3deb92f7
|
Renato Botelho
|
} else if ($_POST['type'] == "port" && (getservbyname($_POST['name'], "tcp") || getservbyname($_POST['name'], "udp"))) {
|
139 |
bd413d76
|
Renato Botelho
|
$input_errors[] = gettext("Reserved word used for alias name.");
|
140 |
3deb92f7
|
Renato Botelho
|
} else {
|
141 |
|
|
if (is_validaliasname($_POST['name']) == false)
|
142 |
dc4a8b9e
|
Chris Buechler
|
$input_errors[] = gettext("The alias name must be less than 32 characters long, may not consist of only numbers, and may only contain the following characters") . " a-z, A-Z, 0-9, _.";
|
143 |
3deb92f7
|
Renato Botelho
|
}
|
144 |
5b237745
|
Scott Ullrich
|
/* check for name conflicts */
|
145 |
6c33fb4b
|
Ermal
|
if (empty($a_aliases[$id])) {
|
146 |
6b487ec6
|
Ermal
|
foreach ($a_aliases as $alias) {
|
147 |
|
|
if ($alias['name'] == $_POST['name']) {
|
148 |
24148939
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("An alias with this name already exists.");
|
149 |
6b487ec6
|
Ermal
|
break;
|
150 |
|
|
}
|
151 |
5b237745
|
Scott Ullrich
|
}
|
152 |
|
|
}
|
153 |
5a1eebc7
|
Scott Ullrich
|
|
154 |
f76a479d
|
sullrich
|
/* Check for reserved keyword names */
|
155 |
f29109d0
|
Renato Botelho
|
foreach($reserved_keywords as $rk)
|
156 |
f76a479d
|
sullrich
|
if($rk == $_POST['name'])
|
157 |
24148939
|
Carlos Eduardo Ramos
|
$input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk);
|
158 |
f76a479d
|
sullrich
|
|
159 |
cfa466bb
|
Scott Ullrich
|
/* check for name interface description conflicts */
|
160 |
|
|
foreach($config['interfaces'] as $interface) {
|
161 |
|
|
if($interface['descr'] == $_POST['name']) {
|
162 |
24148939
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("An interface description with this name already exists.");
|
163 |
5a1eebc7
|
Scott Ullrich
|
break;
|
164 |
cfa466bb
|
Scott Ullrich
|
}
|
165 |
5a1eebc7
|
Scott Ullrich
|
}
|
166 |
f29109d0
|
Renato Botelho
|
|
167 |
ba393f6c
|
Scott Dale
|
$alias = array();
|
168 |
6c33fb4b
|
Ermal
|
$address = array();
|
169 |
|
|
$final_address_details = array();
|
170 |
ba393f6c
|
Scott Dale
|
$alias['name'] = $_POST['name'];
|
171 |
c7de8be4
|
jim-p
|
|
172 |
dd042c51
|
Renato Botelho
|
if (preg_match("/urltable/i", $_POST['type'])) {
|
173 |
c7de8be4
|
jim-p
|
$address = "";
|
174 |
|
|
$isfirst = 0;
|
175 |
|
|
|
176 |
24445691
|
Phil Davis
|
/* item is a url table type */
|
177 |
c7de8be4
|
jim-p
|
if ($_POST['address0']) {
|
178 |
|
|
/* fetch down and add in */
|
179 |
fd86d829
|
Cristian Feldman
|
$_POST['address0'] = trim($_POST['address0']);
|
180 |
c7de8be4
|
jim-p
|
$isfirst = 0;
|
181 |
578c81b6
|
bcyrill
|
$address[] = $_POST['address0'];
|
182 |
c7de8be4
|
jim-p
|
$alias['url'] = $_POST['address0'];
|
183 |
|
|
$alias['updatefreq'] = $_POST['address_subnet0'] ? $_POST['address_subnet0'] : 7;
|
184 |
|
|
if (!is_URL($alias['url']) || empty($alias['url'])) {
|
185 |
24148939
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("You must provide a valid URL.");
|
186 |
c7de8be4
|
jim-p
|
} elseif (! process_alias_urltable($alias['name'], $alias['url'], 0, true)) {
|
187 |
24148939
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("Unable to fetch usable data.");
|
188 |
c7de8be4
|
jim-p
|
}
|
189 |
24445691
|
Phil Davis
|
if ($_POST["detail0"] <> "") {
|
190 |
|
|
if ((strpos($_POST["detail0"], "||") === false) && (substr($_POST["detail0"], 0, 1) != "|") && (substr($_POST["detail0"], -1, 1) != "|")) {
|
191 |
|
|
$final_address_details[] = $_POST["detail0"];
|
192 |
|
|
} else {
|
193 |
|
|
/* Remove leading and trailing vertical bars and replace multiple vertical bars with single, */
|
194 |
|
|
/* and put in the output array so the text is at least redisplayed for the user. */
|
195 |
|
|
$final_address_details[] = preg_replace('/\|\|+/', '|', trim($_POST["detail0"], "|"));
|
196 |
|
|
$input_errors[] = $vertical_bar_err_text;
|
197 |
|
|
}
|
198 |
|
|
} else
|
199 |
0b9e4e8f
|
Renato Botelho
|
$final_address_details[] = sprintf(gettext("Entry added %s"), date('r'));
|
200 |
c7de8be4
|
jim-p
|
}
|
201 |
079d1952
|
Renato Botelho
|
} else if ($_POST['type'] == "url" || $_POST['type'] == "url_ports") {
|
202 |
d2cfb7a4
|
Scott Ullrich
|
$isfirst = 0;
|
203 |
ba393f6c
|
Scott Dale
|
$address_count = 2;
|
204 |
24445691
|
Phil Davis
|
$desc_fmt_err_found = false;
|
205 |
ba393f6c
|
Scott Dale
|
|
206 |
|
|
/* item is a url type */
|
207 |
feb1953e
|
Phil Davis
|
for($x=0; $x<$max_alias_addresses-1; $x++) {
|
208 |
fd86d829
|
Cristian Feldman
|
$_POST['address' . $x] = trim($_POST['address' . $x]);
|
209 |
ba393f6c
|
Scott Dale
|
if($_POST['address' . $x]) {
|
210 |
|
|
/* fetch down and add in */
|
211 |
|
|
$isfirst = 0;
|
212 |
7c872d3b
|
Scott Ullrich
|
$temp_filename = tempnam("{$g['tmp_path']}/", "alias_import");
|
213 |
552f5a6a
|
Renato Botelho
|
unlink_if_exists($temp_filename);
|
214 |
76590ffe
|
Renato Botelho
|
$verify_ssl = isset($config['system']['checkaliasesurlcert']);
|
215 |
d31ca336
|
Renato Botelho
|
mkdir($temp_filename);
|
216 |
76590ffe
|
Renato Botelho
|
download_file($_POST['address' . $x], $temp_filename . "/aliases", $verify_ssl);
|
217 |
|
|
|
218 |
ba393f6c
|
Scott Dale
|
/* if the item is tar gzipped then extract */
|
219 |
|
|
if(stristr($_POST['address' . $x], ".tgz"))
|
220 |
|
|
process_alias_tgz($temp_filename);
|
221 |
86ffa26d
|
Renato Botelho
|
else if(stristr($_POST['address' . $x], ".zip"))
|
222 |
|
|
process_alias_unzip($temp_filename);
|
223 |
ae5f96c8
|
Renato Botelho
|
|
224 |
|
|
if (!isset($alias['aliasurl']))
|
225 |
|
|
$alias['aliasurl'] = array();
|
226 |
|
|
|
227 |
|
|
$alias['aliasurl'][] = $_POST['address' . $x];
|
228 |
24445691
|
Phil Davis
|
if ($_POST["detail{$x}"] <> "") {
|
229 |
|
|
if ((strpos($_POST["detail{$x}"], "||") === false) && (substr($_POST["detail{$x}"], 0, 1) != "|") && (substr($_POST["detail{$x}"], -1, 1) != "|")) {
|
230 |
|
|
$final_address_details[] = $_POST["detail{$x}"];
|
231 |
|
|
} else {
|
232 |
|
|
/* Remove leading and trailing vertical bars and replace multiple vertical bars with single, */
|
233 |
|
|
/* and put in the output array so the text is at least redisplayed for the user. */
|
234 |
|
|
$final_address_details[] = preg_replace('/\|\|+/', '|', trim($_POST["detail{$x}"], "|"));
|
235 |
|
|
if (!$desc_fmt_err_found) {
|
236 |
|
|
$input_errors[] = $vertical_bar_err_text;
|
237 |
|
|
$desc_fmt_err_found = true;
|
238 |
|
|
}
|
239 |
|
|
}
|
240 |
|
|
} else
|
241 |
ae5f96c8
|
Renato Botelho
|
$final_address_details[] = sprintf(gettext("Entry added %s"), date('r'));
|
242 |
|
|
|
243 |
ba393f6c
|
Scott Dale
|
if(file_exists("{$temp_filename}/aliases")) {
|
244 |
|
|
$file_contents = file_get_contents("{$temp_filename}/aliases");
|
245 |
|
|
$file_contents = str_replace("#", "\n#", $file_contents);
|
246 |
cfbfd941
|
smos
|
$file_contents_split = explode("\n", $file_contents);
|
247 |
ba393f6c
|
Scott Dale
|
foreach($file_contents_split as $fc) {
|
248 |
c7de8be4
|
jim-p
|
// Stop at 3000 items, aliases larger than that tend to break both pf and the WebGUI.
|
249 |
|
|
if ($address_count >= 3000)
|
250 |
|
|
break;
|
251 |
ba393f6c
|
Scott Dale
|
$tmp = trim($fc);
|
252 |
|
|
if(stristr($fc, "#")) {
|
253 |
cfbfd941
|
smos
|
$tmp_split = explode("#", $tmp);
|
254 |
ba393f6c
|
Scott Dale
|
$tmp = trim($tmp_split[0]);
|
255 |
5a1eebc7
|
Scott Ullrich
|
}
|
256 |
74e861e3
|
jim-p
|
$tmp = trim($tmp);
|
257 |
079d1952
|
Renato Botelho
|
if ($_POST['type'] == "url")
|
258 |
|
|
$is_valid = (is_ipaddr($tmp) || is_subnet($tmp));
|
259 |
|
|
else
|
260 |
|
|
$is_valid = (is_port($tmp) || is_portrange($tmp));
|
261 |
|
|
|
262 |
|
|
if (!empty($tmp) && $is_valid) {
|
263 |
6c33fb4b
|
Ermal
|
$address[] = $tmp;
|
264 |
ae5f96c8
|
Renato Botelho
|
$isfirst = 1;
|
265 |
c7de8be4
|
jim-p
|
$address_count++;
|
266 |
5a1eebc7
|
Scott Ullrich
|
}
|
267 |
ba393f6c
|
Scott Dale
|
}
|
268 |
|
|
if($isfirst == 0) {
|
269 |
|
|
/* nothing was found */
|
270 |
7cbeade1
|
Renato Botelho
|
$input_errors[] = sprintf(gettext("You must provide a valid URL. Could not fetch usable data from '%s'."), $_POST['address' . $x]);
|
271 |
5a1eebc7
|
Scott Ullrich
|
}
|
272 |
d31ca336
|
Renato Botelho
|
mwexec("/bin/rm -rf " . escapeshellarg($temp_filename));
|
273 |
ba393f6c
|
Scott Dale
|
} else {
|
274 |
7cbeade1
|
Renato Botelho
|
$input_errors[] = sprintf(gettext("URL '%s' is not valid."), $_POST['address' . $x]);
|
275 |
5a1eebc7
|
Scott Ullrich
|
}
|
276 |
|
|
}
|
277 |
ba393f6c
|
Scott Dale
|
}
|
278 |
24445691
|
Phil Davis
|
unset($desc_fmt_err_found);
|
279 |
079d1952
|
Renato Botelho
|
if ($_POST['type'] == "url_ports")
|
280 |
|
|
$address = group_ports($address);
|
281 |
ba393f6c
|
Scott Dale
|
} else {
|
282 |
|
|
/* item is a normal alias type */
|
283 |
5e34cdb2
|
Ermal Lu?i
|
$wrongaliases = "";
|
284 |
24445691
|
Phil Davis
|
$desc_fmt_err_found = false;
|
285 |
feb1953e
|
Phil Davis
|
$alias_address_count = 0;
|
286 |
055a43d2
|
Phil Davis
|
|
287 |
|
|
// First trim and expand the input data.
|
288 |
|
|
// Users can paste strings like "10.1.2.0/24 10.3.0.0/16 9.10.11.0/24" into an address box.
|
289 |
|
|
// They can also put an IP range.
|
290 |
|
|
// This loop expands out that stuff so it can easily be validated.
|
291 |
feb1953e
|
Phil Davis
|
for($x=0; $x<($max_alias_addresses-1); $x++) {
|
292 |
b6f3005c
|
Ermal Luçi
|
if($_POST["address{$x}"] <> "") {
|
293 |
24445691
|
Phil Davis
|
if ($_POST["detail{$x}"] <> "") {
|
294 |
|
|
if ((strpos($_POST["detail{$x}"], "||") === false) && (substr($_POST["detail{$x}"], 0, 1) != "|") && (substr($_POST["detail{$x}"], -1, 1) != "|")) {
|
295 |
055a43d2
|
Phil Davis
|
$detail_text = $_POST["detail{$x}"];
|
296 |
24445691
|
Phil Davis
|
} else {
|
297 |
|
|
/* Remove leading and trailing vertical bars and replace multiple vertical bars with single, */
|
298 |
|
|
/* and put in the output array so the text is at least redisplayed for the user. */
|
299 |
055a43d2
|
Phil Davis
|
$detail_text = preg_replace('/\|\|+/', '|', trim($_POST["detail{$x}"], "|"));
|
300 |
24445691
|
Phil Davis
|
if (!$desc_fmt_err_found) {
|
301 |
|
|
$input_errors[] = $vertical_bar_err_text;
|
302 |
|
|
$desc_fmt_err_found = true;
|
303 |
|
|
}
|
304 |
|
|
}
|
305 |
6b18c66b
|
Phil Davis
|
} else {
|
306 |
055a43d2
|
Phil Davis
|
$detail_text = sprintf(gettext("Entry added %s"), date('r'));
|
307 |
|
|
}
|
308 |
|
|
$address_items = explode(" ", trim($_POST["address{$x}"]));
|
309 |
|
|
foreach ($address_items as $address_item) {
|
310 |
feb1953e
|
Phil Davis
|
$iprange_type = is_iprange($address_item);
|
311 |
|
|
if ($iprange_type == 4) {
|
312 |
055a43d2
|
Phil Davis
|
list($startip, $endip) = explode('-', $address_item);
|
313 |
feb1953e
|
Phil Davis
|
if ($_POST['type'] == "network") {
|
314 |
|
|
// For network type aliases, expand an IPv4 range into an array of subnets.
|
315 |
|
|
$rangesubnets = ip_range_to_subnet_array($startip, $endip);
|
316 |
|
|
foreach ($rangesubnets as $rangesubnet) {
|
317 |
|
|
if ($alias_address_count > $max_alias_addresses) {
|
318 |
|
|
break;
|
319 |
|
|
}
|
320 |
|
|
list($address_part, $subnet_part) = explode("/", $rangesubnet);
|
321 |
|
|
$input_addresses[] = $address_part;
|
322 |
|
|
$input_address_subnet[] = $subnet_part;
|
323 |
|
|
$final_address_details[] = $detail_text;
|
324 |
|
|
$alias_address_count++;
|
325 |
|
|
}
|
326 |
|
|
} else {
|
327 |
|
|
// For host type aliases, expand an IPv4 range into a list of individual IPv4 addresses.
|
328 |
|
|
$rangeaddresses = ip_range_to_address_array($startip, $endip, $max_alias_addresses - $alias_address_count);
|
329 |
|
|
if (is_array($rangeaddresses)) {
|
330 |
|
|
foreach ($rangeaddresses as $rangeaddress) {
|
331 |
|
|
$input_addresses[] = $rangeaddress;
|
332 |
|
|
$input_address_subnet[] = "";
|
333 |
|
|
$final_address_details[] = $detail_text;
|
334 |
|
|
$alias_address_count++;
|
335 |
|
|
}
|
336 |
|
|
} else {
|
337 |
|
|
$input_errors[] = sprintf(gettext('Range is too large to expand into individual host IP addresses (%s)'), $address_item);
|
338 |
|
|
$input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses);
|
339 |
|
|
// Put the user-entered data in the output anyway, so it will be re-displayed for correction.
|
340 |
|
|
$input_addresses[] = $address_item;
|
341 |
|
|
$input_address_subnet[] = "";
|
342 |
|
|
$final_address_details[] = $detail_text;
|
343 |
|
|
}
|
344 |
055a43d2
|
Phil Davis
|
}
|
345 |
feb1953e
|
Phil Davis
|
} else if ($iprange_type == 6) {
|
346 |
|
|
$input_errors[] = sprintf(gettext('IPv6 address ranges are not supported (%s)'), $address_item);
|
347 |
|
|
// Put the user-entered data in the output anyway, so it will be re-displayed for correction.
|
348 |
|
|
$input_addresses[] = $address_item;
|
349 |
|
|
$input_address_subnet[] = "";
|
350 |
055a43d2
|
Phil Davis
|
$final_address_details[] = $detail_text;
|
351 |
feb1953e
|
Phil Davis
|
} else {
|
352 |
|
|
$subnet_type = is_subnet($address_item);
|
353 |
|
|
if (($_POST['type'] == "host") && $subnet_type) {
|
354 |
|
|
if ($subnet_type == 4) {
|
355 |
|
|
// For host type aliases, if the user enters an IPv4 subnet, expand it into a list of individual IPv4 addresses.
|
356 |
|
|
if (subnet_size($address_item) <= ($max_alias_addresses - $alias_address_count)) {
|
357 |
|
|
$rangeaddresses = subnetv4_expand($address_item);
|
358 |
|
|
foreach ($rangeaddresses as $rangeaddress) {
|
359 |
|
|
$input_addresses[] = $rangeaddress;
|
360 |
|
|
$input_address_subnet[] = "";
|
361 |
|
|
$final_address_details[] = $detail_text;
|
362 |
|
|
$alias_address_count++;
|
363 |
|
|
}
|
364 |
|
|
} else {
|
365 |
|
|
$input_errors[] = sprintf(gettext('Subnet is too large to expand into individual host IP addresses (%s)'), $address_item);
|
366 |
|
|
$input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses);
|
367 |
|
|
// Put the user-entered data in the output anyway, so it will be re-displayed for correction.
|
368 |
|
|
$input_addresses[] = $address_item;
|
369 |
|
|
$input_address_subnet[] = "";
|
370 |
|
|
$final_address_details[] = $detail_text;
|
371 |
|
|
}
|
372 |
|
|
} else {
|
373 |
|
|
$input_errors[] = sprintf(gettext('IPv6 subnets are not supported in host aliases (%s)'), $address_item);
|
374 |
|
|
// Put the user-entered data in the output anyway, so it will be re-displayed for correction.
|
375 |
|
|
$input_addresses[] = $address_item;
|
376 |
|
|
$input_address_subnet[] = "";
|
377 |
|
|
$final_address_details[] = $detail_text;
|
378 |
|
|
}
|
379 |
|
|
} else {
|
380 |
|
|
list($address_part, $subnet_part) = explode("/", $address_item);
|
381 |
|
|
if (!empty($subnet_part)) {
|
382 |
|
|
if (is_subnet($address_item)) {
|
383 |
|
|
$input_addresses[] = $address_part;
|
384 |
|
|
$input_address_subnet[] = $subnet_part;
|
385 |
|
|
} else {
|
386 |
|
|
// The user typed something like "1.2.3.444/24" or "1.2.3.0/36" or similar rubbish.
|
387 |
|
|
// Feed it through without splitting it apart, then it will be caught by the validation loop below.
|
388 |
|
|
$input_addresses[] = $address_item;
|
389 |
|
|
$input_address_subnet[] = "";
|
390 |
|
|
}
|
391 |
|
|
} else {
|
392 |
|
|
$input_addresses[] = $address_part;
|
393 |
|
|
$input_address_subnet[] = $_POST["address_subnet{$x}"];
|
394 |
|
|
}
|
395 |
|
|
$final_address_details[] = $detail_text;
|
396 |
|
|
$alias_address_count++;
|
397 |
|
|
}
|
398 |
|
|
}
|
399 |
|
|
if ($alias_address_count > $max_alias_addresses) {
|
400 |
|
|
$input_errors[] = sprintf(gettext('The maximum number of entries in an alias has been exceeded (%s)'), $max_alias_addresses);
|
401 |
|
|
break;
|
402 |
055a43d2
|
Phil Davis
|
}
|
403 |
|
|
}
|
404 |
|
|
}
|
405 |
|
|
}
|
406 |
|
|
|
407 |
|
|
// Validate the input data expanded above.
|
408 |
|
|
foreach($input_addresses as $idx => $input_address) {
|
409 |
|
|
if (is_alias($input_address)) {
|
410 |
|
|
if (!alias_same_type($input_address, $_POST['type']))
|
411 |
|
|
// But alias type network can include alias type urltable. Feature#1603.
|
412 |
|
|
if (!($_POST['type'] == 'network' &&
|
413 |
|
|
preg_match("/urltable/i", alias_get_type($input_address))))
|
414 |
|
|
$wrongaliases .= " " . $input_address;
|
415 |
|
|
} else if ($_POST['type'] == "port") {
|
416 |
|
|
if (!is_port($input_address) && !is_portrange($input_address))
|
417 |
|
|
$input_errors[] = $input_address . " " . gettext("is not a valid port or alias.");
|
418 |
|
|
} else if ($_POST['type'] == "host" || $_POST['type'] == "network") {
|
419 |
|
|
if (is_subnet($input_address) ||
|
420 |
|
|
(!is_ipaddr($input_address) && !is_hostname($input_address)))
|
421 |
|
|
$input_errors[] = sprintf(gettext('%1$s is not a valid %2$s address, FQDN or alias.'), $input_address, $_POST['type']);
|
422 |
|
|
}
|
423 |
|
|
$tmpaddress = $input_address;
|
424 |
|
|
if ($_POST['type'] != "host" && is_ipaddr($input_address) && $input_address_subnet[$idx] <> "") {
|
425 |
|
|
if (!is_subnet($input_address . "/" . $input_address_subnet[$idx]))
|
426 |
|
|
$input_errors[] = sprintf(gettext('%s/%s is not a valid subnet.'), $input_address, $input_address_subnet[$idx]);
|
427 |
|
|
else
|
428 |
|
|
$tmpaddress .= "/" . $input_address_subnet[$idx];
|
429 |
5e34cdb2
|
Ermal Lu?i
|
}
|
430 |
055a43d2
|
Phil Davis
|
$address[] = $tmpaddress;
|
431 |
d2cfb7a4
|
Scott Ullrich
|
}
|
432 |
24445691
|
Phil Davis
|
unset($desc_fmt_err_found);
|
433 |
5e34cdb2
|
Ermal Lu?i
|
if ($wrongaliases <> "")
|
434 |
bcc8d8a3
|
Erik Fonnesbeck
|
$input_errors[] = sprintf(gettext('The alias(es): %s cannot be nested because they are not of the same type.'), $wrongaliases);
|
435 |
ba393f6c
|
Scott Dale
|
}
|
436 |
d2cfb7a4
|
Scott Ullrich
|
|
437 |
24445691
|
Phil Davis
|
unset($vertical_bar_err_text);
|
438 |
|
|
|
439 |
f29109d0
|
Renato Botelho
|
// Allow extending of the firewall edit page and include custom input validation
|
440 |
439cc13f
|
Scott Ullrich
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/input_validation");
|
441 |
|
|
|
442 |
ba393f6c
|
Scott Dale
|
if (!$input_errors) {
|
443 |
c7de8be4
|
jim-p
|
$alias['address'] = is_array($address) ? implode(" ", $address) : $address;
|
444 |
d865241e
|
jim-p
|
$alias['descr'] = $_POST['descr'];
|
445 |
ba393f6c
|
Scott Dale
|
$alias['type'] = $_POST['type'];
|
446 |
6c33fb4b
|
Ermal
|
$alias['detail'] = implode("||", $final_address_details);
|
447 |
d2cfb7a4
|
Scott Ullrich
|
|
448 |
ed0b7949
|
Scott Ullrich
|
/* Check to see if alias name needs to be
|
449 |
|
|
* renamed on referenced rules and such
|
450 |
|
|
*/
|
451 |
|
|
if ($_POST['name'] <> $_POST['origname']) {
|
452 |
|
|
// Firewall rules
|
453 |
f1ac1733
|
Erik Fonnesbeck
|
update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $_POST['name'], $origname);
|
454 |
|
|
update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $_POST['name'], $origname);
|
455 |
|
|
update_alias_names_upon_change(array('filter', 'rule'), array('source', 'port'), $_POST['name'], $origname);
|
456 |
|
|
update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'port'), $_POST['name'], $origname);
|
457 |
ed0b7949
|
Scott Ullrich
|
// NAT Rules
|
458 |
f1ac1733
|
Erik Fonnesbeck
|
update_alias_names_upon_change(array('nat', 'rule'), array('source', 'address'), $_POST['name'], $origname);
|
459 |
|
|
update_alias_names_upon_change(array('nat', 'rule'), array('source', 'port'), $_POST['name'], $origname);
|
460 |
|
|
update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $_POST['name'], $origname);
|
461 |
|
|
update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'port'), $_POST['name'], $origname);
|
462 |
|
|
update_alias_names_upon_change(array('nat', 'rule'), array('target'), $_POST['name'], $origname);
|
463 |
|
|
update_alias_names_upon_change(array('nat', 'rule'), array('local-port'), $_POST['name'], $origname);
|
464 |
b43b7613
|
Erik Fonnesbeck
|
// NAT 1:1 Rules
|
465 |
|
|
//update_alias_names_upon_change(array('nat', 'onetoone'), array('external'), $_POST['name'], $origname);
|
466 |
|
|
//update_alias_names_upon_change(array('nat', 'onetoone'), array('source', 'address'), $_POST['name'], $origname);
|
467 |
|
|
update_alias_names_upon_change(array('nat', 'onetoone'), array('destination', 'address'), $_POST['name'], $origname);
|
468 |
|
|
// NAT Outbound Rules
|
469 |
|
|
update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('source', 'network'), $_POST['name'], $origname);
|
470 |
ca640261
|
Erik Fonnesbeck
|
update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('sourceport'), $_POST['name'], $origname);
|
471 |
b43b7613
|
Erik Fonnesbeck
|
update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('destination', 'address'), $_POST['name'], $origname);
|
472 |
ca640261
|
Erik Fonnesbeck
|
update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('dstport'), $_POST['name'], $origname);
|
473 |
b43b7613
|
Erik Fonnesbeck
|
update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('target'), $_POST['name'], $origname);
|
474 |
f43ba926
|
Scott Ullrich
|
// Alias in an alias
|
475 |
f1ac1733
|
Erik Fonnesbeck
|
update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $_POST['name'], $origname);
|
476 |
ed0b7949
|
Scott Ullrich
|
}
|
477 |
|
|
|
478 |
b22bf161
|
Scott Ullrich
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/pre_write_config");
|
479 |
|
|
|
480 |
171aa30d
|
Ermal Lu?i
|
if (isset($id) && $a_aliases[$id]) {
|
481 |
|
|
if ($a_aliases[$id]['name'] <> $alias['name']) {
|
482 |
|
|
foreach ($a_aliases as $aliasid => $aliasd) {
|
483 |
16f78ff0
|
Ermal Lu?i
|
if ($aliasd['address'] <> "") {
|
484 |
96b4269c
|
Ermal Lu?i
|
$tmpdirty = false;
|
485 |
16f78ff0
|
Ermal Lu?i
|
$tmpaddr = explode(" ", $aliasd['address']);
|
486 |
|
|
foreach ($tmpaddr as $tmpidx => $tmpalias) {
|
487 |
96b4269c
|
Ermal Lu?i
|
if ($tmpalias == $a_aliases[$id]['name']) {
|
488 |
16f78ff0
|
Ermal Lu?i
|
$tmpaddr[$tmpidx] = $alias['name'];
|
489 |
96b4269c
|
Ermal Lu?i
|
$tmpdirty = true;
|
490 |
|
|
}
|
491 |
16f78ff0
|
Ermal Lu?i
|
}
|
492 |
96b4269c
|
Ermal Lu?i
|
if ($tmpdirty == true)
|
493 |
|
|
$a_aliases[$aliasid]['address'] = implode(" ", $tmpaddr);
|
494 |
16f78ff0
|
Ermal Lu?i
|
}
|
495 |
171aa30d
|
Ermal Lu?i
|
}
|
496 |
|
|
}
|
497 |
ba393f6c
|
Scott Dale
|
$a_aliases[$id] = $alias;
|
498 |
171aa30d
|
Ermal Lu?i
|
} else
|
499 |
ba393f6c
|
Scott Dale
|
$a_aliases[] = $alias;
|
500 |
a18b6b97
|
Scott Ullrich
|
|
501 |
974cbfe0
|
Ermal Lu?i
|
// Sort list
|
502 |
|
|
$a_aliases = msort($a_aliases, "name");
|
503 |
|
|
|
504 |
3a343d73
|
jim-p
|
if (write_config())
|
505 |
|
|
mark_subsystem_dirty('aliases');
|
506 |
d2cfb7a4
|
Scott Ullrich
|
|
507 |
ac7f1763
|
Renato Botelho
|
if(!empty($tab))
|
508 |
|
|
header("Location: firewall_aliases.php?tab=" . htmlspecialchars ($tab));
|
509 |
a5416de2
|
Warren Baker
|
else
|
510 |
|
|
header("Location: firewall_aliases.php");
|
511 |
|
|
exit;
|
512 |
ba393f6c
|
Scott Dale
|
}
|
513 |
|
|
//we received input errors, copy data to prevent retype
|
514 |
|
|
else
|
515 |
|
|
{
|
516 |
c7de8be4
|
jim-p
|
$pconfig['name'] = $_POST['name'];
|
517 |
d865241e
|
jim-p
|
$pconfig['descr'] = $_POST['descr'];
|
518 |
079d1952
|
Renato Botelho
|
if (($_POST['type'] == 'url') || ($_POST['type'] == 'url_ports'))
|
519 |
6a45942f
|
Renato Botelho
|
$pconfig['address'] = implode(" ", $alias['aliasurl']);
|
520 |
|
|
else
|
521 |
|
|
$pconfig['address'] = implode(" ", $address);
|
522 |
ba393f6c
|
Scott Dale
|
$pconfig['type'] = $_POST['type'];
|
523 |
6c33fb4b
|
Ermal
|
$pconfig['detail'] = implode("||", $final_address_details);
|
524 |
5b237745
|
Scott Ullrich
|
}
|
525 |
|
|
}
|
526 |
da7ae7ef
|
Bill Marquette
|
|
527 |
|
|
include("head.inc");
|
528 |
|
|
|
529 |
5a1eebc7
|
Scott Ullrich
|
$jscriptstr = <<<EOD
|
530 |
da7ae7ef
|
Bill Marquette
|
|
531 |
5a1eebc7
|
Scott Ullrich
|
<script type="text/javascript">
|
532 |
709e62f0
|
Colin Fleming
|
//<![CDATA[
|
533 |
0cea9a23
|
Ermal Lu?i
|
var objAlias = new Array(4999);
|
534 |
5b237745
|
Scott Ullrich
|
function typesel_change() {
|
535 |
6794e407
|
Renato Botelho
|
var field_disabled = 0;
|
536 |
|
|
var field_value = "";
|
537 |
|
|
var set_value = false;
|
538 |
5b237745
|
Scott Ullrich
|
switch (document.iform.type.selectedIndex) {
|
539 |
|
|
case 0: /* host */
|
540 |
6794e407
|
Renato Botelho
|
field_disabled = 1;
|
541 |
|
|
field_value = "";
|
542 |
|
|
set_value = true;
|
543 |
5b237745
|
Scott Ullrich
|
break;
|
544 |
|
|
case 1: /* network */
|
545 |
6794e407
|
Renato Botelho
|
field_disabled = 0;
|
546 |
5b237745
|
Scott Ullrich
|
break;
|
547 |
4d6b6263
|
Scott Ullrich
|
case 2: /* port */
|
548 |
6794e407
|
Renato Botelho
|
field_disabled = 1;
|
549 |
|
|
field_value = "128";
|
550 |
|
|
set_value = true;
|
551 |
4d6b6263
|
Scott Ullrich
|
break;
|
552 |
aa11af07
|
jim-p
|
case 3: /* url */
|
553 |
6794e407
|
Renato Botelho
|
field_disabled = 1;
|
554 |
6e7e1814
|
Scott Ullrich
|
break;
|
555 |
079d1952
|
Renato Botelho
|
case 4: /* url_ports */
|
556 |
6794e407
|
Renato Botelho
|
field_disabled = 1;
|
557 |
079d1952
|
Renato Botelho
|
break;
|
558 |
|
|
case 5: /* urltable */
|
559 |
6794e407
|
Renato Botelho
|
field_disabled = 0;
|
560 |
c7de8be4
|
jim-p
|
break;
|
561 |
dd042c51
|
Renato Botelho
|
case 6: /* urltable_ports */
|
562 |
6794e407
|
Renato Botelho
|
field_disabled = 0;
|
563 |
dd042c51
|
Renato Botelho
|
break;
|
564 |
5b237745
|
Scott Ullrich
|
}
|
565 |
6794e407
|
Renato Botelho
|
|
566 |
4dd00d25
|
Phil Davis
|
jQuery("select[id^='address_subnet']").prop("disabled", field_disabled);
|
567 |
|
|
if (set_value == true)
|
568 |
|
|
jQuery("select[id^='address_subnet']").prop("value", field_value);
|
569 |
5b237745
|
Scott Ullrich
|
}
|
570 |
d2cfb7a4
|
Scott Ullrich
|
|
571 |
0cea9a23
|
Ermal Lu?i
|
function add_alias_control() {
|
572 |
|
|
var name = "address" + (totalrows - 1);
|
573 |
|
|
obj = document.getElementById(name);
|
574 |
|
|
obj.setAttribute('class', 'formfldalias');
|
575 |
|
|
obj.setAttribute('autocomplete', 'off');
|
576 |
|
|
objAlias[totalrows - 1] = new AutoSuggestControl(obj, new StateSuggestions(addressarray));
|
577 |
|
|
}
|
578 |
5a1eebc7
|
Scott Ullrich
|
EOD;
|
579 |
|
|
|
580 |
bbd1f783
|
Phil Davis
|
$network_str = gettext("Network or FQDN");
|
581 |
5a1eebc7
|
Scott Ullrich
|
$networks_str = gettext("Network(s)");
|
582 |
|
|
$cidr_str = gettext("CIDR");
|
583 |
|
|
$description_str = gettext("Description");
|
584 |
|
|
$hosts_str = gettext("Host(s)");
|
585 |
bbd1f783
|
Phil Davis
|
$ip_str = gettext("IP or FQDN");
|
586 |
5a1eebc7
|
Scott Ullrich
|
$ports_str = gettext("Port(s)");
|
587 |
|
|
$port_str = gettext("Port");
|
588 |
079d1952
|
Renato Botelho
|
$url_str = gettext("URL (IPs)");
|
589 |
|
|
$url_ports_str = gettext("URL (Ports)");
|
590 |
dd042c51
|
Renato Botelho
|
$urltable_str = gettext("URL Table (IPs)");
|
591 |
|
|
$urltable_ports_str = gettext("URL Table (Ports)");
|
592 |
2b6e6fee
|
Renato Botelho
|
$update_freq_str = gettext("Update Freq. (days)");
|
593 |
5a1eebc7
|
Scott Ullrich
|
|
594 |
2936a57e
|
Seth Mos
|
$networks_help = gettext("Networks are specified in CIDR format. Select the CIDR mask that pertains to each entry. /32 specifies a single IPv4 host, /128 specifies a single IPv6 host, /24 specifies 255.255.255.0, /64 specifies a normal IPv6 network, etc. Hostnames (FQDNs) may also be specified, using a /32 mask for IPv4 or /128 for IPv6. You may also enter an IP range such as 192.168.1.1-192.168.1.254 and a list of CIDR networks will be derived to fill the range.");
|
595 |
feb1953e
|
Phil Davis
|
$hosts_help = gettext("Enter as many hosts as you would like. Hosts must be specified by their IP address or fully qualified domain name (FQDN). FQDN hostnames are periodically re-resolved and updated. If multiple IPs are returned by a DNS query, all are used. You may also enter an IP range such as 192.168.1.1-192.168.1.10 or a small subnet such as 192.168.1.16/28 and a list of individual IP addresses will be generated.");
|
596 |
5aa68a55
|
Renato Botelho
|
$ports_help = gettext("Enter as many ports as you wish. Port ranges can be expressed by separating with a colon.");
|
597 |
24148939
|
Carlos Eduardo Ramos
|
$url_help = sprintf(gettext("Enter as many URLs as you wish. After saving %s will download the URL and import the items into the alias. Use only with small sets of IP addresses (less than 3000)."), $g['product_name']);
|
598 |
079d1952
|
Renato Botelho
|
$url_ports_help = sprintf(gettext("Enter as many URLs as you wish. After saving %s will download the URL and import the items into the alias. Use only with small sets of Ports (less than 3000)."), $g['product_name']);
|
599 |
24148939
|
Carlos Eduardo Ramos
|
$urltable_help = sprintf(gettext("Enter a single URL containing a large number of IPs and/or Subnets. After saving %s will download the URL and create a table file containing these addresses. This will work with large numbers of addresses (30,000+) or small numbers."), $g['product_name']);
|
600 |
dd042c51
|
Renato Botelho
|
$urltable_ports_help = sprintf(gettext("Enter a single URL containing a list of Port numbers and/or Port ranges. After saving %s will download the URL."), $g['product_name']);
|
601 |
5a1eebc7
|
Scott Ullrich
|
|
602 |
3ebd97eb
|
Scott Ullrich
|
$openvpn_str = gettext("Username");
|
603 |
|
|
$openvpn_user_str = gettext("OpenVPN Users");
|
604 |
|
|
$openvpn_help = gettext("Enter as many usernames as you wish.");
|
605 |
bd413d76
|
Renato Botelho
|
$openvpn_freq = "";
|
606 |
3ebd97eb
|
Scott Ullrich
|
|
607 |
5a1eebc7
|
Scott Ullrich
|
$jscriptstr .= <<<EOD
|
608 |
|
|
|
609 |
d2cfb7a4
|
Scott Ullrich
|
function update_box_type() {
|
610 |
|
|
var indexNum = document.forms[0].type.selectedIndex;
|
611 |
|
|
var selected = document.forms[0].type.options[indexNum].text;
|
612 |
5a1eebc7
|
Scott Ullrich
|
if(selected == '{$networks_str}') {
|
613 |
|
|
document.getElementById ("addressnetworkport").firstChild.data = "{$networks_str}";
|
614 |
|
|
document.getElementById ("onecolumn").firstChild.data = "{$network_str}";
|
615 |
|
|
document.getElementById ("twocolumn").firstChild.data = "{$cidr_str}";
|
616 |
|
|
document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
|
617 |
bbd1f783
|
Phil Davis
|
document.getElementById ("threecolumn").style.display = 'block';
|
618 |
5a1eebc7
|
Scott Ullrich
|
document.getElementById ("itemhelp").firstChild.data = "{$networks_help}";
|
619 |
c7de8be4
|
jim-p
|
document.getElementById ("addrowbutton").style.display = 'block';
|
620 |
5a1eebc7
|
Scott Ullrich
|
} else if(selected == '{$hosts_str}') {
|
621 |
|
|
document.getElementById ("addressnetworkport").firstChild.data = "{$hosts_str}";
|
622 |
|
|
document.getElementById ("onecolumn").firstChild.data = "{$ip_str}";
|
623 |
|
|
document.getElementById ("twocolumn").firstChild.data = "";
|
624 |
|
|
document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
|
625 |
bbd1f783
|
Phil Davis
|
document.getElementById ("threecolumn").style.display = 'block';
|
626 |
5a1eebc7
|
Scott Ullrich
|
document.getElementById ("itemhelp").firstChild.data = "{$hosts_help}";
|
627 |
c7de8be4
|
jim-p
|
document.getElementById ("addrowbutton").style.display = 'block';
|
628 |
5a1eebc7
|
Scott Ullrich
|
} else if(selected == '{$ports_str}') {
|
629 |
|
|
document.getElementById ("addressnetworkport").firstChild.data = "{$ports_str}";
|
630 |
|
|
document.getElementById ("onecolumn").firstChild.data = "{$port_str}";
|
631 |
|
|
document.getElementById ("twocolumn").firstChild.data = "";
|
632 |
|
|
document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
|
633 |
bbd1f783
|
Phil Davis
|
document.getElementById ("threecolumn").style.display = 'block';
|
634 |
5a1eebc7
|
Scott Ullrich
|
document.getElementById ("itemhelp").firstChild.data = "{$ports_help}";
|
635 |
c7de8be4
|
jim-p
|
document.getElementById ("addrowbutton").style.display = 'block';
|
636 |
5a1eebc7
|
Scott Ullrich
|
} else if(selected == '{$url_str}') {
|
637 |
|
|
document.getElementById ("addressnetworkport").firstChild.data = "{$url_str}";
|
638 |
|
|
document.getElementById ("onecolumn").firstChild.data = "{$url_str}";
|
639 |
a0fc25ae
|
Scott Ullrich
|
document.getElementById ("twocolumn").firstChild.data = "";
|
640 |
5a1eebc7
|
Scott Ullrich
|
document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
|
641 |
bbd1f783
|
Phil Davis
|
document.getElementById ("threecolumn").style.display = 'block';
|
642 |
5a1eebc7
|
Scott Ullrich
|
document.getElementById ("itemhelp").firstChild.data = "{$url_help}";
|
643 |
c7de8be4
|
jim-p
|
document.getElementById ("addrowbutton").style.display = 'block';
|
644 |
079d1952
|
Renato Botelho
|
} else if(selected == '{$url_ports_str}') {
|
645 |
|
|
document.getElementById ("addressnetworkport").firstChild.data = "{$url_ports_str}";
|
646 |
|
|
document.getElementById ("onecolumn").firstChild.data = "{$url_ports_str}";
|
647 |
|
|
document.getElementById ("twocolumn").firstChild.data = "";
|
648 |
|
|
document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
|
649 |
bbd1f783
|
Phil Davis
|
document.getElementById ("threecolumn").style.display = 'block';
|
650 |
079d1952
|
Renato Botelho
|
document.getElementById ("itemhelp").firstChild.data = "{$url_ports_help}";
|
651 |
|
|
document.getElementById ("addrowbutton").style.display = 'block';
|
652 |
6e7e1814
|
Scott Ullrich
|
} else if(selected == '{$openvpn_user_str}') {
|
653 |
|
|
document.getElementById ("addressnetworkport").firstChild.data = "{$openvpn_user_str}";
|
654 |
3ebd97eb
|
Scott Ullrich
|
document.getElementById ("onecolumn").firstChild.data = "{$openvpn_str}";
|
655 |
4c743413
|
Scott Ullrich
|
document.getElementById ("twocolumn").firstChild.data = "{$openvpn_freq}";
|
656 |
6e7e1814
|
Scott Ullrich
|
document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
|
657 |
bbd1f783
|
Phil Davis
|
document.getElementById ("threecolumn").style.display = 'block';
|
658 |
3ebd97eb
|
Scott Ullrich
|
document.getElementById ("itemhelp").firstChild.data = "{$openvpn_help}";
|
659 |
c7de8be4
|
jim-p
|
document.getElementById ("addrowbutton").style.display = 'block';
|
660 |
|
|
} else if(selected == '{$urltable_str}') {
|
661 |
|
|
if ((typeof(totalrows) == "undefined") || (totalrows < 1)) {
|
662 |
|
|
addRowTo('maintable', 'formfldalias');
|
663 |
|
|
typesel_change();
|
664 |
|
|
add_alias_control(this);
|
665 |
|
|
}
|
666 |
|
|
document.getElementById ("addressnetworkport").firstChild.data = "{$url_str}";
|
667 |
|
|
document.getElementById ("onecolumn").firstChild.data = "{$url_str}";
|
668 |
|
|
document.getElementById ("twocolumn").firstChild.data = "{$update_freq_str}";
|
669 |
|
|
document.getElementById ("threecolumn").firstChild.data = "";
|
670 |
|
|
document.getElementById ("threecolumn").style.display = 'none';
|
671 |
|
|
document.getElementById ("itemhelp").firstChild.data = "{$urltable_help}";
|
672 |
|
|
document.getElementById ("addrowbutton").style.display = 'none';
|
673 |
dd042c51
|
Renato Botelho
|
} else if(selected == '{$urltable_ports_str}') {
|
674 |
|
|
if ((typeof(totalrows) == "undefined") || (totalrows < 1)) {
|
675 |
|
|
addRowTo('maintable', 'formfldalias');
|
676 |
|
|
typesel_change();
|
677 |
|
|
add_alias_control(this);
|
678 |
|
|
}
|
679 |
|
|
document.getElementById ("addressnetworkport").firstChild.data = "{$url_str}";
|
680 |
|
|
document.getElementById ("onecolumn").firstChild.data = "{$url_str}";
|
681 |
|
|
document.getElementById ("twocolumn").firstChild.data = "{$update_freq_str}";
|
682 |
|
|
document.getElementById ("threecolumn").firstChild.data = "";
|
683 |
|
|
document.getElementById ("threecolumn").style.display = 'none';
|
684 |
|
|
document.getElementById ("itemhelp").firstChild.data = "{$urltable_ports_help}";
|
685 |
|
|
document.getElementById ("addrowbutton").style.display = 'none';
|
686 |
d2cfb7a4
|
Scott Ullrich
|
}
|
687 |
|
|
}
|
688 |
709e62f0
|
Colin Fleming
|
//]]>
|
689 |
5b237745
|
Scott Ullrich
|
</script>
|
690 |
|
|
|
691 |
66138bf6
|
Scott Dale
|
EOD;
|
692 |
d2cfb7a4
|
Scott Ullrich
|
|
693 |
5a1eebc7
|
Scott Ullrich
|
?>
|
694 |
d2cfb7a4
|
Scott Ullrich
|
|
695 |
5a1eebc7
|
Scott Ullrich
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
|
696 |
|
|
<?php
|
697 |
|
|
include("fbegin.inc");
|
698 |
|
|
echo $jscriptstr;
|
699 |
|
|
?>
|
700 |
|
|
|
701 |
709e62f0
|
Colin Fleming
|
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
|
702 |
|
|
<script type="text/javascript" src="/javascript/row_helper.js"></script>
|
703 |
|
|
<script type="text/javascript" src="/javascript/autosuggest.js"></script>
|
704 |
|
|
<script type="text/javascript" src="/javascript/suggestions.js"></script>
|
705 |
d2cfb7a4
|
Scott Ullrich
|
|
706 |
5a1eebc7
|
Scott Ullrich
|
<input type='hidden' name='address_type' value='textbox' />
|
707 |
|
|
<input type='hidden' name='address_subnet_type' value='select' />
|
708 |
d2cfb7a4
|
Scott Ullrich
|
|
709 |
5a1eebc7
|
Scott Ullrich
|
<script type="text/javascript">
|
710 |
709e62f0
|
Colin Fleming
|
//<![CDATA[
|
711 |
5a1eebc7
|
Scott Ullrich
|
rowname[0] = "address";
|
712 |
a8fe61f1
|
Darren Embry
|
rowtype[0] = "textbox,ipv4v6";
|
713 |
5a1eebc7
|
Scott Ullrich
|
rowsize[0] = "30";
|
714 |
d2cfb7a4
|
Scott Ullrich
|
|
715 |
5a1eebc7
|
Scott Ullrich
|
rowname[1] = "address_subnet";
|
716 |
a8fe61f1
|
Darren Embry
|
rowtype[1] = "select,ipv4v6";
|
717 |
5a1eebc7
|
Scott Ullrich
|
rowsize[1] = "1";
|
718 |
d2cfb7a4
|
Scott Ullrich
|
|
719 |
5a1eebc7
|
Scott Ullrich
|
rowname[2] = "detail";
|
720 |
|
|
rowtype[2] = "textbox";
|
721 |
b6f3005c
|
Ermal Luçi
|
rowsize[2] = "50";
|
722 |
709e62f0
|
Colin Fleming
|
//]]>
|
723 |
d2cfb7a4
|
Scott Ullrich
|
</script>
|
724 |
|
|
|
725 |
193716d0
|
Scott Ullrich
|
<?php pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/pre_input_errors"); ?>
|
726 |
5b237745
|
Scott Ullrich
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
727 |
5a1eebc7
|
Scott Ullrich
|
<div id="inputerrors"></div>
|
728 |
|
|
|
729 |
|
|
<form action="firewall_aliases_edit.php" method="post" name="iform" id="iform">
|
730 |
ac7f1763
|
Renato Botelho
|
<?php
|
731 |
|
|
if (empty($tab)) {
|
732 |
079d1952
|
Renato Botelho
|
if (preg_match("/url/i", $pconfig['type']))
|
733 |
ac7f1763
|
Renato Botelho
|
$tab = 'url';
|
734 |
|
|
else if ($pconfig['type'] == 'host')
|
735 |
|
|
$tab = 'ip';
|
736 |
|
|
else
|
737 |
|
|
$tab = $pconfig['type'];
|
738 |
|
|
}
|
739 |
|
|
?>
|
740 |
|
|
<input name="tab" type="hidden" id="tab" value="<?=htmlspecialchars($tab);?>" />
|
741 |
709e62f0
|
Colin Fleming
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="firewall aliases edit">
|
742 |
f29109d0
|
Renato Botelho
|
<tr>
|
743 |
|
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Alias Edit"); ?></td>
|
744 |
|
|
</tr>
|
745 |
|
|
<tr>
|
746 |
|
|
<td valign="top" class="vncellreq"><?=gettext("Name"); ?></td>
|
747 |
|
|
<td class="vtable">
|
748 |
|
|
<input name="origname" type="hidden" id="origname" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
|
749 |
eab05c00
|
Renato Botelho
|
<input name="name" type="text" id="name" class="formfld unknown" size="40" maxlength="31" value="<?=htmlspecialchars($pconfig['name']);?>" />
|
750 |
f29109d0
|
Renato Botelho
|
<?php if (isset($id) && $a_aliases[$id]): ?>
|
751 |
|
|
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
|
752 |
|
|
<?php endif; ?>
|
753 |
|
|
<br />
|
754 |
|
|
<span class="vexpl">
|
755 |
|
|
<?=gettext("The name of the alias may only consist of the characters \"a-z, A-Z, 0-9 and _\"."); ?>
|
756 |
|
|
</span>
|
757 |
|
|
</td>
|
758 |
|
|
</tr>
|
759 |
|
|
<?php pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/after_first_tr"); ?>
|
760 |
|
|
<tr>
|
761 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
|
762 |
|
|
<td width="78%" class="vtable">
|
763 |
|
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
|
764 |
|
|
<br />
|
765 |
|
|
<span class="vexpl">
|
766 |
|
|
<?=gettext("You may enter a description here for your reference (not parsed)."); ?>
|
767 |
|
|
</span>
|
768 |
|
|
</td>
|
769 |
|
|
</tr>
|
770 |
|
|
<tr>
|
771 |
|
|
<td valign="top" class="vncellreq"><?=gettext("Type"); ?></td>
|
772 |
|
|
<td class="vtable">
|
773 |
|
|
<select name="type" class="formselect" id="type" onchange="update_box_type(); typesel_change();">
|
774 |
709e62f0
|
Colin Fleming
|
<option value="host" <?php if ($pconfig['type'] == "host") echo "selected=\"selected\""; ?>><?=gettext("Host(s)"); ?></option>
|
775 |
|
|
<option value="network" <?php if ($pconfig['type'] == "network") echo "selected=\"selected\""; ?>><?=gettext("Network(s)"); ?></option>
|
776 |
09a68ea4
|
Phil Davis
|
<option value="port" <?php if (($pconfig['type'] == "port") || (empty($pconfig['type']) && ($tab == "port"))) echo "selected=\"selected\""; ?>><?=gettext("Port(s)"); ?></option>
|
777 |
709e62f0
|
Colin Fleming
|
<!--<option value="openvpn" <?php if ($pconfig['type'] == "openvpn") echo "selected=\"selected\""; ?>><?=gettext("OpenVPN Users"); ?></option> -->
|
778 |
09a68ea4
|
Phil Davis
|
<option value="url" <?php if (($pconfig['type'] == "url") || (empty($pconfig['type']) && ($tab == "url"))) echo "selected=\"selected\""; ?>><?=gettext("URL (IPs)");?></option>
|
779 |
079d1952
|
Renato Botelho
|
<option value="url_ports" <?php if ($pconfig['type'] == "url_ports") echo "selected=\"selected\""; ?>><?=gettext("URL (Ports)");?></option>
|
780 |
dd042c51
|
Renato Botelho
|
<option value="urltable" <?php if ($pconfig['type'] == "urltable") echo "selected=\"selected\""; ?>><?=gettext("URL Table (IPs)"); ?></option>
|
781 |
|
|
<option value="urltable_ports" <?php if ($pconfig['type'] == "urltable_ports") echo "selected=\"selected\""; ?>><?=gettext("URL Table (Ports)"); ?></option>
|
782 |
f29109d0
|
Renato Botelho
|
</select>
|
783 |
|
|
</td>
|
784 |
|
|
</tr>
|
785 |
|
|
<tr>
|
786 |
|
|
<td width="22%" valign="top" class="vncellreq"><div id="addressnetworkport"><?=gettext("Host(s)"); ?></div></td>
|
787 |
|
|
<td width="78%" class="vtable">
|
788 |
709e62f0
|
Colin Fleming
|
<table id="maintable" summary="maintable">
|
789 |
f29109d0
|
Renato Botelho
|
<tbody>
|
790 |
|
|
<tr>
|
791 |
|
|
<td colspan="4">
|
792 |
|
|
<div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp"><?=gettext("Item information"); ?></div>
|
793 |
|
|
</td>
|
794 |
|
|
</tr>
|
795 |
|
|
<tr>
|
796 |
|
|
<td><div id="onecolumn"><?=gettext("Network"); ?></div></td>
|
797 |
|
|
<td><div id="twocolumn">CIDR</div></td>
|
798 |
|
|
<td><div id="threecolumn"><?=gettext("Description"); ?></div></td>
|
799 |
|
|
</tr>
|
800 |
|
|
|
801 |
|
|
<?php
|
802 |
|
|
$counter = 0;
|
803 |
4e8a79a8
|
Renato Botelho
|
if ($pconfig['address'] <> ""):
|
804 |
|
|
$addresses = explode(" ", $pconfig['address']);
|
805 |
|
|
$details = explode("||", $pconfig['detail']);
|
806 |
|
|
while ($counter < count($addresses)):
|
807 |
feb1953e
|
Phil Davis
|
if (($pconfig['type'] != "host") && is_subnet($addresses[$counter])) {
|
808 |
4e8a79a8
|
Renato Botelho
|
list($address, $address_subnet) = explode("/", $addresses[$counter]);
|
809 |
|
|
} else {
|
810 |
|
|
$address = $addresses[$counter];
|
811 |
|
|
$address_subnet = "";
|
812 |
f29109d0
|
Renato Botelho
|
}
|
813 |
|
|
?>
|
814 |
|
|
<tr>
|
815 |
|
|
<td>
|
816 |
4e8a79a8
|
Renato Botelho
|
<input autocomplete="off" name="address<?php echo $counter; ?>" type="text" class="formfldalias ipv4v6" id="address<?php echo $counter; ?>" size="30" value="<?=htmlspecialchars($address);?>" />
|
817 |
f29109d0
|
Renato Botelho
|
</td>
|
818 |
|
|
<td>
|
819 |
4e8a79a8
|
Renato Botelho
|
<select name="address_subnet<?php echo $counter; ?>" class="formselect ipv4v6" id="address_subnet<?php echo $counter; ?>">
|
820 |
f29109d0
|
Renato Botelho
|
<option></option>
|
821 |
|
|
<?php for ($i = 128; $i >= 1; $i--): ?>
|
822 |
709e62f0
|
Colin Fleming
|
<option value="<?=$i;?>" <?php if (($i == $address_subnet) || ($i == $pconfig['updatefreq'])) echo "selected=\"selected\""; ?>><?=$i;?></option>
|
823 |
f29109d0
|
Renato Botelho
|
<?php endfor; ?>
|
824 |
|
|
</select>
|
825 |
|
|
</td>
|
826 |
|
|
<td>
|
827 |
92ca4bc3
|
jim-p
|
<input name="detail<?php echo $counter; ?>" type="text" class="formfld unknown" id="detail<?php echo $counter; ?>" size="50" value="<?=htmlspecialchars($details[$counter]);?>" />
|
828 |
f29109d0
|
Renato Botelho
|
</td>
|
829 |
|
|
<td>
|
830 |
|
|
<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" alt="" title="<?=gettext("remove this entry"); ?>" /></a>
|
831 |
|
|
</td>
|
832 |
|
|
</tr>
|
833 |
|
|
<?php
|
834 |
|
|
$counter++;
|
835 |
|
|
|
836 |
4e8a79a8
|
Renato Botelho
|
endwhile;
|
837 |
|
|
endif;
|
838 |
f29109d0
|
Renato Botelho
|
?>
|
839 |
|
|
</tbody>
|
840 |
|
|
</table>
|
841 |
|
|
<div id="addrowbutton">
|
842 |
|
|
<a onclick="javascript:addRowTo('maintable', 'formfldalias'); typesel_change(); add_alias_control(this); return false;" href="#">
|
843 |
|
|
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry"); ?>" />
|
844 |
|
|
</a>
|
845 |
|
|
</div>
|
846 |
|
|
</td>
|
847 |
|
|
</tr>
|
848 |
|
|
<tr>
|
849 |
|
|
<td width="22%" valign="top"> </td>
|
850 |
|
|
<td width="78%">
|
851 |
|
|
<input id="submit" name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
|
852 |
62424bdb
|
Renato Botelho
|
<input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
|
853 |
5a1eebc7
|
Scott Ullrich
|
</td>
|
854 |
f29109d0
|
Renato Botelho
|
</tr>
|
855 |
5a1eebc7
|
Scott Ullrich
|
</table>
|
856 |
5b237745
|
Scott Ullrich
|
</form>
|
857 |
5a1eebc7
|
Scott Ullrich
|
|
858 |
|
|
<script type="text/javascript">
|
859 |
4dfd930e
|
Darren Embry
|
//<![CDATA[
|
860 |
5a1eebc7
|
Scott Ullrich
|
field_counter_js = 3;
|
861 |
|
|
rows = 1;
|
862 |
|
|
totalrows = <?php echo $counter; ?>;
|
863 |
|
|
loaded = <?php echo $counter; ?>;
|
864 |
|
|
typesel_change();
|
865 |
|
|
update_box_type();
|
866 |
0cea9a23
|
Ermal Lu?i
|
|
867 |
dd760cfc
|
r-duran
|
var addressarray = <?= json_encode(array_exclude($pconfig['name'], get_alias_list($pconfig['type']))) ?>;
|
868 |
0cea9a23
|
Ermal Lu?i
|
|
869 |
4dfd930e
|
Darren Embry
|
function createAutoSuggest() {
|
870 |
f29109d0
|
Renato Botelho
|
<?php
|
871 |
4dfd930e
|
Darren Embry
|
for ($jv = 0; $jv < $counter; $jv++)
|
872 |
|
|
echo "objAlias[{$jv}] = new AutoSuggestControl(document.getElementById(\"address{$jv}\"), new StateSuggestions(addressarray));\n";
|
873 |
|
|
?>
|
874 |
|
|
}
|
875 |
0cea9a23
|
Ermal Lu?i
|
|
876 |
4dfd930e
|
Darren Embry
|
setTimeout("createAutoSuggest();", 500);
|
877 |
|
|
//]]>
|
878 |
5b237745
|
Scott Ullrich
|
</script>
|
879 |
5a1eebc7
|
Scott Ullrich
|
|
880 |
5b237745
|
Scott Ullrich
|
<?php include("fend.inc"); ?>
|
881 |
|
|
</body>
|
882 |
|
|
</html>
|