Project

General

Profile

Download (29.8 KB) Statistics
| Branch: | Tag: | Revision:
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 45818646 Phil Davis
	Copyright (C) 2009 Ermal Luçi
7 fff3d2b9 jim-p
	Copyright (C) 2010 Jim Pingle
8 2e9ab96b Scott Ullrich
	All rights reserved.
9
10
	originially part of m0n0wall (http://m0n0.ch/wall)
11 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
12
	All rights reserved.
13 d2cfb7a4 Scott Ullrich
14 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
15
	modification, are permitted provided that the following conditions are met:
16 d2cfb7a4 Scott Ullrich
17 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
18
	   this list of conditions and the following disclaimer.
19 d2cfb7a4 Scott Ullrich
20 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
21
	   notice, this list of conditions and the following disclaimer in the
22
	   documentation and/or other materials provided with the distribution.
23 d2cfb7a4 Scott Ullrich
24 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
25
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
28
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
	POSSIBILITY OF SUCH DAMAGE.
34
*/
35 7ac5a4cb Scott Ullrich
/*
36
	pfSense_BUILDER_BINARIES:	/bin/rm	/bin/mkdir	/usr/bin/fetch
37
	pfSense_MODULE:	aliases
38
*/
39 5b237745 Scott Ullrich
40 6b07c15a Matthew Grooms
##|+PRIV
41
##|*IDENT=page-firewall-alias-edit
42
##|*NAME=Firewall: Alias: Edit page
43
##|*DESCR=Allow access to the 'Firewall: Alias: Edit' page.
44
##|*MATCH=firewall_aliases_edit.php*
45
##|-PRIV
46
47 5b237745 Scott Ullrich
require("guiconfig.inc");
48 7a927e67 Scott Ullrich
require_once("functions.inc");
49
require_once("filter.inc");
50
require_once("shaper.inc");
51 5b237745 Scott Ullrich
52 b13f7f80 Carlos Eduardo Ramos
$pgtitle = array(gettext("Firewall"),gettext("Aliases"),gettext("Edit"));
53
54 78b0e51e Renato Botelho
// Keywords not allowed in names
55
$reserved_keywords = array("all", "pass", "block", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec");
56
57
// Add all Load balance names to resrved_keywords
58
if (is_array($config['load_balancer']['lbpool']))
59
	foreach ($config['load_balancer']['lbpool'] as $lbpool)
60
		$reserved_keywords[] = $lbpool['name'];
61
62 7c9d8d71 Ermal Lu?i
$reserved_ifs = get_configured_interface_list(false, true);
63 78b0e51e Renato Botelho
$reserved_keywords = array_merge($reserved_keywords, $reserved_ifs, $reserved_table_names);
64 7c9d8d71 Ermal Lu?i
65 5b237745 Scott Ullrich
if (!is_array($config['aliases']['alias']))
66
	$config['aliases']['alias'] = array();
67
$a_aliases = &$config['aliases']['alias'];
68 f29109d0 Renato Botelho
69 ac7f1763 Renato Botelho
$tab = $_REQUEST['tab'];
70
71 ed0b7949 Scott Ullrich
if($_POST)
72
	$origname = $_POST['origname'];
73
74
// Debugging
75 f5200c44 Scott Ullrich
if($debug)
76 4bdb08e3 Renato Botelho
	unlink_if_exists("{$g['tmp_path']}/alias_rename_log.txt");
77 ed0b7949 Scott Ullrich
78 5e34cdb2 Ermal Lu?i
function alias_same_type($name, $type) {
79
	global $config;
80 f29109d0 Renato Botelho
81 5e34cdb2 Ermal Lu?i
	foreach ($config['aliases']['alias'] as $alias) {
82
		if ($name == $alias['name']) {
83 d6c9ab97 Ermal Lu?i
			if (in_array($type, array("host", "network")) &&
84 5e34cdb2 Ermal Lu?i
				in_array($alias['type'], array("host", "network")))
85
				return true;
86
			if ($type  == $alias['type'])
87
				return true;
88
			else
89
				return false;
90
		}
91
	}
92
	return true;
93
}
94
95 0e6cf71b Renato Botelho
if (is_numericint($_GET['id']))
96
	$id = $_GET['id'];
97
if (isset($_POST['id']) && is_numericint($_POST['id']))
98 5b237745 Scott Ullrich
	$id = $_POST['id'];
99
100
if (isset($id) && $a_aliases[$id]) {
101 ed0b7949 Scott Ullrich
	$original_alias_name = $a_aliases[$id]['name'];
102 5b237745 Scott Ullrich
	$pconfig['name'] = $a_aliases[$id]['name'];
103 ba393f6c Scott Dale
	$pconfig['detail'] = $a_aliases[$id]['detail'];
104
	$pconfig['address'] = $a_aliases[$id]['address'];
105 b4deddce Ermal Lu?i
	$pconfig['type'] = $a_aliases[$id]['type'];
106 ba393f6c Scott Dale
	$pconfig['descr'] = html_entity_decode($a_aliases[$id]['descr']);
107 e47c266d Scott Ullrich
108 9bc8788a Erik Fonnesbeck
	/* interface list */
109
	$iflist = get_configured_interface_with_descr(false, true);
110 cbe3ea96 Ermal Luçi
	foreach ($iflist as $if => $ifdesc)
111 f29109d0 Renato Botelho
		if($ifdesc == $pconfig['descr'])
112 24148939 Carlos Eduardo Ramos
			$input_errors[] = sprintf(gettext("Sorry, an interface is already named %s."), $pconfig['descr']);
113 e47c266d Scott Ullrich
114 c7de8be4 jim-p
	if($a_aliases[$id]['type'] == "urltable") {
115
		$pconfig['address'] = $a_aliases[$id]['url'];
116
		$pconfig['updatefreq'] = $a_aliases[$id]['updatefreq'];
117
	}
118 5a1eebc7 Scott Ullrich
	if($a_aliases[$id]['aliasurl'] <> "") {
119
		$pconfig['type'] = "url";
120 c5eaef8e Renato Botelho
		if(is_array($a_aliases[$id]['aliasurl']))
121
			$pconfig['address'] = implode(" ", $a_aliases[$id]['aliasurl']);
122
		else
123 5a1eebc7 Scott Ullrich
			$pconfig['address'] = $a_aliases[$id]['aliasurl'];
124
	}
125 5b237745 Scott Ullrich
}
126
127
if ($_POST) {
128
	unset($input_errors);
129
130
	/* input validation */
131 0cd7ed19 Scott Ullrich
132 69d2ad77 Erik Fonnesbeck
	$reqdfields = explode(" ", "name");
133 bd413d76 Renato Botelho
	$reqdfieldsn = array(gettext("Name"));
134 69d2ad77 Erik Fonnesbeck
135
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
136
137 0df6adf8 Bill Marquette
	$x = is_validaliasname($_POST['name']);
138
	if (!isset($x)) {
139 24148939 Carlos Eduardo Ramos
		$input_errors[] = gettext("Reserved word used for alias name.");
140 3deb92f7 Renato Botelho
	} else if ($_POST['type'] == "port" && (getservbyname($_POST['name'], "tcp") || getservbyname($_POST['name'], "udp"))) {
141 bd413d76 Renato Botelho
		$input_errors[] = gettext("Reserved word used for alias name.");
142 3deb92f7 Renato Botelho
	} else {
143
		if (is_validaliasname($_POST['name']) == false)
144 bac9941b jim-p
			$input_errors[] = gettext("The alias name must be less than 32 characters long and may only consist of the characters") . " a-z, A-Z, 0-9, _.";
145 3deb92f7 Renato Botelho
	}
146 5b237745 Scott Ullrich
	/* check for name conflicts */
147 6c33fb4b Ermal
	if (empty($a_aliases[$id])) {
148 6b487ec6 Ermal
		foreach ($a_aliases as $alias) {
149
			if ($alias['name'] == $_POST['name']) {
150 24148939 Carlos Eduardo Ramos
				$input_errors[] = gettext("An alias with this name already exists.");
151 6b487ec6 Ermal
				break;
152
			}
153 5b237745 Scott Ullrich
		}
154
	}
155 5a1eebc7 Scott Ullrich
156 f76a479d sullrich
	/* Check for reserved keyword names */
157 f29109d0 Renato Botelho
	foreach($reserved_keywords as $rk)
158 f76a479d sullrich
		if($rk == $_POST['name'])
159 24148939 Carlos Eduardo Ramos
			$input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk);
160 f76a479d sullrich
161 cfa466bb Scott Ullrich
	/* check for name interface description conflicts */
162
	foreach($config['interfaces'] as $interface) {
163
		if($interface['descr'] == $_POST['name']) {
164 24148939 Carlos Eduardo Ramos
			$input_errors[] = gettext("An interface description with this name already exists.");
165 5a1eebc7 Scott Ullrich
			break;
166 cfa466bb Scott Ullrich
		}
167 5a1eebc7 Scott Ullrich
	}
168 f29109d0 Renato Botelho
169 ba393f6c Scott Dale
	$alias = array();
170 6c33fb4b Ermal
	$address = array();
171
	$final_address_details = array();
172 ba393f6c Scott Dale
	$alias['name'] = $_POST['name'];
173 c7de8be4 jim-p
174
	if ($_POST['type'] == "urltable") {
175
		$address = "";
176
		$isfirst = 0;
177
178
		/* item is a url type */
179
		if ($_POST['address0']) {
180
			/* fetch down and add in */
181 fd86d829 Cristian Feldman
			$_POST['address0'] = trim($_POST['address0']);
182 c7de8be4 jim-p
			$isfirst = 0;
183 578c81b6 bcyrill
			$address[] = $_POST['address0'];
184 c7de8be4 jim-p
			$alias['url'] = $_POST['address0'];
185
			$alias['updatefreq'] = $_POST['address_subnet0'] ? $_POST['address_subnet0'] : 7;
186
			if (!is_URL($alias['url']) || empty($alias['url'])) {
187 24148939 Carlos Eduardo Ramos
				$input_errors[] = gettext("You must provide a valid URL.");
188 c7de8be4 jim-p
			} elseif (! process_alias_urltable($alias['name'], $alias['url'], 0, true)) {
189 24148939 Carlos Eduardo Ramos
				$input_errors[] = gettext("Unable to fetch usable data.");
190 c7de8be4 jim-p
			}
191 0b9e4e8f Renato Botelho
			if ($_POST["detail0"] <> "")
192
				$final_address_details[] = $_POST["detail0"];
193
			else
194
				$final_address_details[] = sprintf(gettext("Entry added %s"), date('r'));
195 c7de8be4 jim-p
		}
196
	} elseif($_POST['type'] == "url") {
197 d2cfb7a4 Scott Ullrich
		$isfirst = 0;
198 ba393f6c Scott Dale
		$address_count = 2;
199
200
		/* item is a url type */
201 ae5f96c8 Renato Botelho
		for($x=0; $x<4999; $x++) {
202 fd86d829 Cristian Feldman
			$_POST['address' . $x] = trim($_POST['address' . $x]);
203 ba393f6c Scott Dale
			if($_POST['address' . $x]) {
204
				/* fetch down and add in */
205
				$isfirst = 0;
206 7c872d3b Scott Ullrich
				$temp_filename = tempnam("{$g['tmp_path']}/", "alias_import");
207 4bdb08e3 Renato Botelho
				unlink_if_exists($temp_filename);
208 7ac5a4cb Scott Ullrich
				mwexec("/bin/mkdir -p {$temp_filename}");
209 1eb03024 Renato Botelho
				mwexec("/usr/bin/fetch -q -o \"{$temp_filename}/aliases\" " . escapeshellarg($_POST['address' . $x]));
210 ba393f6c Scott Dale
				/* if the item is tar gzipped then extract */
211
				if(stristr($_POST['address' . $x], ".tgz"))
212
					process_alias_tgz($temp_filename);
213 810c6a96 Renato Botelho
				else if(stristr($_POST['address' . $x], ".zip"))
214
					process_alias_unzip($temp_filename);
215 ae5f96c8 Renato Botelho
216
				if (!isset($alias['aliasurl']))
217
					$alias['aliasurl'] = array();
218
219
				$alias['aliasurl'][] = $_POST['address' . $x];
220
				if ($_POST["detail{$x}"] <> "")
221
					$final_address_details[] = $_POST["detail{$x}"];
222
				else
223
					$final_address_details[] = sprintf(gettext("Entry added %s"), date('r'));
224
225 ba393f6c Scott Dale
				if(file_exists("{$temp_filename}/aliases")) {
226
					$file_contents = file_get_contents("{$temp_filename}/aliases");
227
					$file_contents = str_replace("#", "\n#", $file_contents);
228 cfbfd941 smos
					$file_contents_split = explode("\n", $file_contents);
229 ba393f6c Scott Dale
					foreach($file_contents_split as $fc) {
230 c7de8be4 jim-p
						// Stop at 3000 items, aliases larger than that tend to break both pf and the WebGUI.
231
						if ($address_count >= 3000)
232
							break;
233 ba393f6c Scott Dale
						$tmp = trim($fc);
234
						if(stristr($fc, "#")) {
235 cfbfd941 smos
							$tmp_split = explode("#", $tmp);
236 ba393f6c Scott Dale
							$tmp = trim($tmp_split[0]);
237 5a1eebc7 Scott Ullrich
						}
238 74e861e3 jim-p
						$tmp = trim($tmp);
239
						if(!empty($tmp) && (is_ipaddr($tmp) || is_subnet($tmp))) {
240 6c33fb4b Ermal
							$address[] = $tmp;
241 ae5f96c8 Renato Botelho
							$isfirst = 1;
242 c7de8be4 jim-p
							$address_count++;
243 5a1eebc7 Scott Ullrich
						}
244 ba393f6c Scott Dale
					}
245
					if($isfirst == 0) {
246
						/* nothing was found */
247 7cbeade1 Renato Botelho
						$input_errors[] = sprintf(gettext("You must provide a valid URL. Could not fetch usable data from '%s'."), $_POST['address' . $x]);
248 5a1eebc7 Scott Ullrich
					}
249 1eb03024 Renato Botelho
					mwexec("/bin/rm -rf " . escapeshellarg($temp_filename));
250 ba393f6c Scott Dale
				} else {
251 7cbeade1 Renato Botelho
					$input_errors[] = sprintf(gettext("URL '%s' is not valid."), $_POST['address' . $x]);
252 5a1eebc7 Scott Ullrich
				}
253
			}
254 ba393f6c Scott Dale
		}
255
	} else {
256
		/* item is a normal alias type */
257 8543a5bb Renato Botelho
		$used_for_routes = 0;
258
		if (isset($config['staticroutes']['route']) && is_array($config['staticroutes']['route'])) {
259
			foreach($config['staticroutes']['route'] as $route) {
260
				if ($route['network'] == $_POST['origname']) {
261
					$used_for_routes = 1;
262
					break;
263
				}
264
			}
265
		}
266 5e34cdb2 Ermal Lu?i
		$wrongaliases = "";
267 42626418 Renato Botelho
		$wrongaliases_fqdn = "";
268 a2d8d3dd Ermal Luçi
		for($x=0; $x<4999; $x++) {
269 b6f3005c Ermal Luçi
			if($_POST["address{$x}"] <> "") {
270 fd86d829 Cristian Feldman
				$_POST["address{$x}"] = trim($_POST["address{$x}"]);
271 f71e0ac6 Ermal Lu?i
				if (is_alias($_POST["address{$x}"])) {
272
					if (!alias_same_type($_POST["address{$x}"], $_POST['type']))
273 ae660b3c Evgeny Yurchenko
						// But alias type network can include alias type urltable. Feature#1603.
274
						if (!($_POST['type'] == 'network' &&
275 5ffa3389 Ermal
						      alias_get_type($_POST["address{$x}"]) == 'urltable'))
276 ae660b3c Evgeny Yurchenko
							$wrongaliases .= " " . $_POST["address{$x}"];
277 42626418 Renato Botelho
					if ($used_for_routes === 1) {
278
						foreach (filter_expand_alias_array($_POST["address{$x}"], true) as $tgt) {
279
							if (is_ipaddrv4($tgt))
280
								$tgt .= "/32";
281
							if (is_ipaddrv6($tgt))
282
								$tgt .= "/128";
283
							if (!is_subnet($tgt) && is_fqdn($tgt)) {
284
								$wrongaliases_fqdn .= " " . $_POST["address{$x}"];
285
								break;
286
							}
287
						}
288
					}
289 f71e0ac6 Ermal Lu?i
				} else if ($_POST['type'] == "port") {
290 231e0606 Ermal Lu?i
					if (!is_port($_POST["address{$x}"]))
291 24148939 Carlos Eduardo Ramos
						$input_errors[] = $_POST["address{$x}"] . " " . gettext("is not a valid port or alias.");
292 f71e0ac6 Ermal Lu?i
				} else if ($_POST['type'] == "host" || $_POST['type'] == "network") {
293 f188be51 Ermal
					if (is_subnet($_POST["address{$x}"]) || (!is_ipaddr($_POST["address{$x}"])
294 ecd1f2d9 jim-p
					 && !is_hostname($_POST["address{$x}"])
295 f188be51 Ermal
					 && !is_iprange($_POST["address{$x}"])))
296 ddc55e12 Erik Fonnesbeck
						$input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']);
297 8543a5bb Renato Botelho
					if (($used_for_routes === 1)
298
					 && !is_ipaddr($_POST["address{$x}"])
299
					 && !is_iprange($_POST["address{$x}"])
300
					 && is_hostname($_POST["address{$x}"]))
301
						$input_errors[] = gettext('This alias is used on a static route and cannot contain FQDNs.');
302 f71e0ac6 Ermal Lu?i
				}
303 6c33fb4b Ermal
				if (is_iprange($_POST["address{$x}"])) {
304
					list($startip, $endip) = explode('-', $_POST["address{$x}"]);
305
					$rangesubnets = ip_range_to_subnet_array($startip, $endip);
306 9ae9a7fc Ermal
					$address = array_merge($address, $rangesubnets);
307 6c33fb4b Ermal
				} else {
308
					$tmpaddress = $_POST["address{$x}"];
309 18b4e253 Renato Botelho
					if($_POST['type'] != "host" && is_ipaddr($_POST["address{$x}"]) && $_POST["address_subnet{$x}"] <> "") {
310
						if (!is_subnet($_POST["address{$x}"] . "/" . $_POST["address_subnet{$x}"]))
311
							$input_errors[] = sprintf(gettext('%s/%s is not a valid subnet.'), $_POST["address{$x}"], $_POST["address_subnet{$x}"]);
312
						else
313
							$tmpaddress .= "/" . $_POST["address_subnet{$x}"];
314
					}
315 6c33fb4b Ermal
					$address[] = $tmpaddress;
316
				}
317
				if ($_POST["detail{$x}"] <> "")
318
					$final_address_details[] = $_POST["detail{$x}"];
319
				else
320 24148939 Carlos Eduardo Ramos
					$final_address_details[] = sprintf(gettext("Entry added %s"), date('r'));
321 5e34cdb2 Ermal Lu?i
			}
322 d2cfb7a4 Scott Ullrich
		}
323 5e34cdb2 Ermal Lu?i
		if ($wrongaliases <> "")
324 bcc8d8a3 Erik Fonnesbeck
			$input_errors[] = sprintf(gettext('The alias(es): %s cannot be nested because they are not of the same type.'), $wrongaliases);
325 42626418 Renato Botelho
		if ($wrongaliases_fqdn <> "")
326
			$input_errors[] = sprintf(gettext('The alias(es): %s cannot be nested because they contain FQDNs and this alias is used on at least one static route.'), $wrongaliases_fqdn);
327 ba393f6c Scott Dale
	}
328 d2cfb7a4 Scott Ullrich
329 f29109d0 Renato Botelho
	// Allow extending of the firewall edit page and include custom input validation
330 439cc13f Scott Ullrich
	pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/input_validation");
331
332 ba393f6c Scott Dale
	if (!$input_errors) {
333 c7de8be4 jim-p
		$alias['address'] = is_array($address) ? implode(" ", $address) : $address;
334 d865241e jim-p
		$alias['descr'] = $_POST['descr'];
335 ba393f6c Scott Dale
		$alias['type'] = $_POST['type'];
336 6c33fb4b Ermal
		$alias['detail'] = implode("||", $final_address_details);
337 d2cfb7a4 Scott Ullrich
338 ed0b7949 Scott Ullrich
		/*   Check to see if alias name needs to be
339
		 *   renamed on referenced rules and such
340
		 */
341
		if ($_POST['name'] <> $_POST['origname']) {
342
			// Firewall rules
343 f1ac1733 Erik Fonnesbeck
			update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $_POST['name'], $origname);
344
			update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $_POST['name'], $origname);
345
			update_alias_names_upon_change(array('filter', 'rule'), array('source', 'port'), $_POST['name'], $origname);
346
			update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'port'), $_POST['name'], $origname);
347 ed0b7949 Scott Ullrich
			// NAT Rules
348 f1ac1733 Erik Fonnesbeck
			update_alias_names_upon_change(array('nat', 'rule'), array('source', 'address'), $_POST['name'], $origname);
349
			update_alias_names_upon_change(array('nat', 'rule'), array('source', 'port'), $_POST['name'], $origname);
350
			update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $_POST['name'], $origname);
351
			update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'port'), $_POST['name'], $origname);
352
			update_alias_names_upon_change(array('nat', 'rule'), array('target'), $_POST['name'], $origname);
353
			update_alias_names_upon_change(array('nat', 'rule'), array('local-port'), $_POST['name'], $origname);
354 b43b7613 Erik Fonnesbeck
			// NAT 1:1 Rules
355
			//update_alias_names_upon_change(array('nat', 'onetoone'), array('external'), $_POST['name'], $origname);
356
			//update_alias_names_upon_change(array('nat', 'onetoone'), array('source', 'address'), $_POST['name'], $origname);
357
			update_alias_names_upon_change(array('nat', 'onetoone'), array('destination', 'address'), $_POST['name'], $origname);
358
			// NAT Outbound Rules
359
			update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('source', 'network'), $_POST['name'], $origname);
360 ca640261 Erik Fonnesbeck
			update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('sourceport'), $_POST['name'], $origname);
361 b43b7613 Erik Fonnesbeck
			update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('destination', 'address'), $_POST['name'], $origname);
362 ca640261 Erik Fonnesbeck
			update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('dstport'), $_POST['name'], $origname);
363 b43b7613 Erik Fonnesbeck
			update_alias_names_upon_change(array('nat', 'advancedoutbound', 'rule'), array('target'), $_POST['name'], $origname);
364 f43ba926 Scott Ullrich
			// Alias in an alias
365 f1ac1733 Erik Fonnesbeck
			update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $_POST['name'], $origname);
366 ed0b7949 Scott Ullrich
		}
367
368 b22bf161 Scott Ullrich
		pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/pre_write_config");
369
370 171aa30d Ermal Lu?i
		if (isset($id) && $a_aliases[$id]) {
371
			if ($a_aliases[$id]['name'] <> $alias['name']) {
372
				foreach ($a_aliases as $aliasid => $aliasd) {
373 16f78ff0 Ermal Lu?i
					if ($aliasd['address'] <> "") {
374 96b4269c Ermal Lu?i
						$tmpdirty = false;
375 16f78ff0 Ermal Lu?i
						$tmpaddr = explode(" ", $aliasd['address']);
376
						foreach ($tmpaddr as $tmpidx => $tmpalias) {
377 96b4269c Ermal Lu?i
							if ($tmpalias == $a_aliases[$id]['name']) {
378 16f78ff0 Ermal Lu?i
								$tmpaddr[$tmpidx] = $alias['name'];
379 96b4269c Ermal Lu?i
								$tmpdirty = true;
380
							}
381 16f78ff0 Ermal Lu?i
						}
382 96b4269c Ermal Lu?i
						if ($tmpdirty == true)
383
							$a_aliases[$aliasid]['address'] = implode(" ", $tmpaddr);
384 16f78ff0 Ermal Lu?i
					}
385 171aa30d Ermal Lu?i
				}
386
			}
387 ba393f6c Scott Dale
			$a_aliases[$id] = $alias;
388 171aa30d Ermal Lu?i
		} else
389 ba393f6c Scott Dale
			$a_aliases[] = $alias;
390 a18b6b97 Scott Ullrich
391 974cbfe0 Ermal Lu?i
		// Sort list
392
		$a_aliases = msort($a_aliases, "name");
393
394 3a343d73 jim-p
		if (write_config())
395
			mark_subsystem_dirty('aliases');
396 d2cfb7a4 Scott Ullrich
397 ac7f1763 Renato Botelho
		if(!empty($tab))
398
			header("Location: firewall_aliases.php?tab=" . htmlspecialchars ($tab));
399 a5416de2 Warren Baker
		else
400
			header("Location: firewall_aliases.php");
401
		exit;
402 ba393f6c Scott Dale
	}
403
	//we received input errors, copy data to prevent retype
404
	else
405
	{
406 c7de8be4 jim-p
		$pconfig['name'] = $_POST['name'];
407 d865241e jim-p
		$pconfig['descr'] = $_POST['descr'];
408 6a45942f Renato Botelho
		if ($_POST['type'] == 'url')
409
			$pconfig['address'] = implode(" ", $alias['aliasurl']);
410
		else
411
			$pconfig['address'] = implode(" ", $address);
412 ba393f6c Scott Dale
		$pconfig['type'] = $_POST['type'];
413 6c33fb4b Ermal
		$pconfig['detail'] = implode("||", $final_address_details);
414 5b237745 Scott Ullrich
	}
415
}
416 da7ae7ef Bill Marquette
417
include("head.inc");
418
419 5a1eebc7 Scott Ullrich
$jscriptstr = <<<EOD
420 da7ae7ef Bill Marquette
421 5a1eebc7 Scott Ullrich
<script type="text/javascript">
422 709e62f0 Colin Fleming
//<![CDATA[
423 0cea9a23 Ermal Lu?i
var objAlias = new Array(4999);
424 5b237745 Scott Ullrich
function typesel_change() {
425 53523624 Renato Botelho
	var field_disabled = 0;
426
	var field_value = "";
427
	var set_value = false;
428 5b237745 Scott Ullrich
	switch (document.iform.type.selectedIndex) {
429
		case 0:	/* host */
430 53523624 Renato Botelho
			field_disabled = 1;
431
			field_value = "";
432
			set_value = true;
433 5b237745 Scott Ullrich
			break;
434
		case 1:	/* network */
435 53523624 Renato Botelho
			field_disabled = 0;
436 5b237745 Scott Ullrich
			break;
437 4d6b6263 Scott Ullrich
		case 2:	/* port */
438 53523624 Renato Botelho
			field_disabled = 1;
439
			field_value = "128";
440
			set_value = true;
441 4d6b6263 Scott Ullrich
			break;
442 aa11af07 jim-p
		case 3:	/* url */
443 53523624 Renato Botelho
			field_disabled = 1;
444 6e7e1814 Scott Ullrich
			break;
445 c7de8be4 jim-p
446 aa11af07 jim-p
		case 4:	/* urltable */
447 53523624 Renato Botelho
			field_disabled = 0;
448 c7de8be4 jim-p
			break;
449 5b237745 Scott Ullrich
	}
450 53523624 Renato Botelho
451 f70adc82 Phil Davis
	jQuery("select[id^='address_subnet']").prop("disabled", field_disabled);
452
	if (set_value == true)
453
		jQuery("select[id^='address_subnet']").prop("value", field_value);
454 5b237745 Scott Ullrich
}
455 d2cfb7a4 Scott Ullrich
456 0cea9a23 Ermal Lu?i
function add_alias_control() {
457
	var name = "address" + (totalrows - 1);
458
	obj = document.getElementById(name);
459
	obj.setAttribute('class', 'formfldalias');
460
	obj.setAttribute('autocomplete', 'off');
461
	objAlias[totalrows - 1] = new AutoSuggestControl(obj, new StateSuggestions(addressarray));
462
}
463 5a1eebc7 Scott Ullrich
EOD;
464
465
$network_str = gettext("Network");
466
$networks_str = gettext("Network(s)");
467
$cidr_str = gettext("CIDR");
468
$description_str = gettext("Description");
469
$hosts_str = gettext("Host(s)");
470
$ip_str = gettext("IP");
471
$ports_str = gettext("Port(s)");
472
$port_str = gettext("Port");
473
$url_str = gettext("URL");
474 c7de8be4 jim-p
$urltable_str = gettext("URL Table");
475 f144493c Renato Botelho
$update_freq_str = gettext("Update Freq. (days)");
476 5a1eebc7 Scott Ullrich
477 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.");
478 e8e2ffbd jim-p
$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.");
479 eab652e4 Renato Botelho
$ports_help = gettext("Enter as many ports as you wish.  Port ranges can be expressed by separating with a colon.");
480 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']);
481
$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']);
482 5a1eebc7 Scott Ullrich
483 3ebd97eb Scott Ullrich
$openvpn_str = gettext("Username");
484
$openvpn_user_str = gettext("OpenVPN Users");
485
$openvpn_help = gettext("Enter as many usernames as you wish.");
486 bd413d76 Renato Botelho
$openvpn_freq = "";
487 3ebd97eb Scott Ullrich
488 5a1eebc7 Scott Ullrich
$jscriptstr .= <<<EOD
489
490 d2cfb7a4 Scott Ullrich
function update_box_type() {
491
	var indexNum = document.forms[0].type.selectedIndex;
492
	var selected = document.forms[0].type.options[indexNum].text;
493 5a1eebc7 Scott Ullrich
	if(selected == '{$networks_str}') {
494
		document.getElementById ("addressnetworkport").firstChild.data = "{$networks_str}";
495
		document.getElementById ("onecolumn").firstChild.data = "{$network_str}";
496
		document.getElementById ("twocolumn").firstChild.data = "{$cidr_str}";
497
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
498
		document.getElementById ("itemhelp").firstChild.data = "{$networks_help}";
499 c7de8be4 jim-p
		document.getElementById ("addrowbutton").style.display = 'block';
500 5a1eebc7 Scott Ullrich
	} else if(selected == '{$hosts_str}') {
501
		document.getElementById ("addressnetworkport").firstChild.data = "{$hosts_str}";
502
		document.getElementById ("onecolumn").firstChild.data = "{$ip_str}";
503
		document.getElementById ("twocolumn").firstChild.data = "";
504
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
505
		document.getElementById ("itemhelp").firstChild.data = "{$hosts_help}";
506 c7de8be4 jim-p
		document.getElementById ("addrowbutton").style.display = 'block';
507 5a1eebc7 Scott Ullrich
	} else if(selected == '{$ports_str}') {
508
		document.getElementById ("addressnetworkport").firstChild.data = "{$ports_str}";
509
		document.getElementById ("onecolumn").firstChild.data = "{$port_str}";
510
		document.getElementById ("twocolumn").firstChild.data = "";
511
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
512
		document.getElementById ("itemhelp").firstChild.data = "{$ports_help}";
513 c7de8be4 jim-p
		document.getElementById ("addrowbutton").style.display = 'block';
514 5a1eebc7 Scott Ullrich
	} else if(selected == '{$url_str}') {
515
		document.getElementById ("addressnetworkport").firstChild.data = "{$url_str}";
516
		document.getElementById ("onecolumn").firstChild.data = "{$url_str}";
517 a0fc25ae Scott Ullrich
		document.getElementById ("twocolumn").firstChild.data = "";
518 5a1eebc7 Scott Ullrich
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
519
		document.getElementById ("itemhelp").firstChild.data = "{$url_help}";
520 c7de8be4 jim-p
		document.getElementById ("addrowbutton").style.display = 'block';
521 6e7e1814 Scott Ullrich
	} else if(selected == '{$openvpn_user_str}') {
522
		document.getElementById ("addressnetworkport").firstChild.data = "{$openvpn_user_str}";
523 3ebd97eb Scott Ullrich
		document.getElementById ("onecolumn").firstChild.data = "{$openvpn_str}";
524 4c743413 Scott Ullrich
		document.getElementById ("twocolumn").firstChild.data = "{$openvpn_freq}";
525 6e7e1814 Scott Ullrich
		document.getElementById ("threecolumn").firstChild.data = "{$description_str}";
526 3ebd97eb Scott Ullrich
		document.getElementById ("itemhelp").firstChild.data = "{$openvpn_help}";
527 c7de8be4 jim-p
		document.getElementById ("addrowbutton").style.display = 'block';
528
	} else if(selected == '{$urltable_str}') {
529
		if ((typeof(totalrows) == "undefined") || (totalrows < 1)) {
530
			addRowTo('maintable', 'formfldalias');
531
			typesel_change();
532
			add_alias_control(this);
533
		}
534
		document.getElementById ("addressnetworkport").firstChild.data = "{$url_str}";
535
		document.getElementById ("onecolumn").firstChild.data = "{$url_str}";
536
		document.getElementById ("twocolumn").firstChild.data = "{$update_freq_str}";
537
		document.getElementById ("threecolumn").firstChild.data = "";
538
		document.getElementById ("threecolumn").style.display = 'none';
539
		document.getElementById ("itemhelp").firstChild.data = "{$urltable_help}";
540
		document.getElementById ("addrowbutton").style.display = 'none';
541 d2cfb7a4 Scott Ullrich
	}
542
}
543 709e62f0 Colin Fleming
//]]>
544 5b237745 Scott Ullrich
</script>
545
546 66138bf6 Scott Dale
EOD;
547 d2cfb7a4 Scott Ullrich
548 5a1eebc7 Scott Ullrich
?>
549 d2cfb7a4 Scott Ullrich
550 5a1eebc7 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
551
<?php
552
	include("fbegin.inc");
553
	echo $jscriptstr;
554
?>
555
556 709e62f0 Colin Fleming
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
557
<script type="text/javascript" src="/javascript/row_helper.js"></script>
558
<script type="text/javascript" src="/javascript/autosuggest.js"></script>
559
<script type="text/javascript" src="/javascript/suggestions.js"></script>
560 d2cfb7a4 Scott Ullrich
561 5a1eebc7 Scott Ullrich
<input type='hidden' name='address_type' value='textbox' />
562
<input type='hidden' name='address_subnet_type' value='select' />
563 d2cfb7a4 Scott Ullrich
564 5a1eebc7 Scott Ullrich
<script type="text/javascript">
565 709e62f0 Colin Fleming
//<![CDATA[
566 5a1eebc7 Scott Ullrich
	rowname[0] = "address";
567 a8fe61f1 Darren Embry
	rowtype[0] = "textbox,ipv4v6";
568 5a1eebc7 Scott Ullrich
	rowsize[0] = "30";
569 d2cfb7a4 Scott Ullrich
570 5a1eebc7 Scott Ullrich
	rowname[1] = "address_subnet";
571 a8fe61f1 Darren Embry
	rowtype[1] = "select,ipv4v6";
572 5a1eebc7 Scott Ullrich
	rowsize[1] = "1";
573 d2cfb7a4 Scott Ullrich
574 5a1eebc7 Scott Ullrich
	rowname[2] = "detail";
575
	rowtype[2] = "textbox";
576 b6f3005c Ermal Luçi
	rowsize[2] = "50";
577 709e62f0 Colin Fleming
//]]>
578 d2cfb7a4 Scott Ullrich
</script>
579
580 193716d0 Scott Ullrich
<?php pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/pre_input_errors"); ?>
581 5b237745 Scott Ullrich
<?php if ($input_errors) print_input_errors($input_errors); ?>
582 5a1eebc7 Scott Ullrich
<div id="inputerrors"></div>
583
584
<form action="firewall_aliases_edit.php" method="post" name="iform" id="iform">
585 ac7f1763 Renato Botelho
<?php
586
if (empty($tab)) {
587
	if ($pconfig['type'] == 'urltable')
588
		$tab = 'url';
589
	else if ($pconfig['type'] == 'host')
590
		$tab = 'ip';
591
	else
592
		$tab = $pconfig['type'];
593
}
594
?>
595
<input name="tab" type="hidden" id="tab" value="<?=htmlspecialchars($tab);?>" />
596 709e62f0 Colin Fleming
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="firewall aliases edit">
597 f29109d0 Renato Botelho
	<tr>
598
		<td colspan="2" valign="top" class="listtopic"><?=gettext("Alias Edit"); ?></td>
599
	</tr>
600
	<tr>
601
		<td valign="top" class="vncellreq"><?=gettext("Name"); ?></td>
602
		<td class="vtable">
603
			<input name="origname" type="hidden" id="origname" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
604
			<input name="name" type="text" id="name" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['name']);?>" />
605
			<?php if (isset($id) && $a_aliases[$id]): ?>
606
				<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
607
			<?php endif; ?>
608
			<br />
609
			<span class="vexpl">
610
				<?=gettext("The name of the alias may only consist of the characters \"a-z, A-Z, 0-9 and _\"."); ?>
611
			</span>
612
		</td>
613
	</tr>
614
	<?php pfSense_handle_custom_code("/usr/local/pkg/firewall_aliases_edit/after_first_tr"); ?>
615
	<tr>
616
		<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
617
		<td width="78%" class="vtable">
618
			<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
619
			<br />
620
			<span class="vexpl">
621
				<?=gettext("You may enter a description here for your reference (not parsed)."); ?>
622
			</span>
623
		</td>
624
	</tr>
625
	<tr>
626
		<td valign="top" class="vncellreq"><?=gettext("Type"); ?></td>
627
		<td class="vtable">
628
			<select name="type" class="formselect" id="type" onchange="update_box_type(); typesel_change();">
629 709e62f0 Colin Fleming
				<option value="host" <?php if ($pconfig['type'] == "host") echo "selected=\"selected\""; ?>><?=gettext("Host(s)"); ?></option>
630
				<option value="network" <?php if ($pconfig['type'] == "network") echo "selected=\"selected\""; ?>><?=gettext("Network(s)"); ?></option>
631 45818646 Phil Davis
				<option value="port" <?php if (($pconfig['type'] == "port") || (empty($pconfig['type']) && ($tab == "port"))) echo "selected=\"selected\""; ?>><?=gettext("Port(s)"); ?></option>
632 709e62f0 Colin Fleming
				<!--<option value="openvpn" <?php if ($pconfig['type'] == "openvpn") echo "selected=\"selected\""; ?>><?=gettext("OpenVPN Users"); ?></option> -->
633 45818646 Phil Davis
				<option value="url" <?php if (($pconfig['type'] == "url") || (empty($pconfig['type']) && ($tab == "url"))) echo "selected=\"selected\""; ?>><?=gettext("URL");?></option>
634 709e62f0 Colin Fleming
				<option value="urltable" <?php if ($pconfig['type'] == "urltable") echo "selected=\"selected\""; ?>><?=gettext("URL Table"); ?></option>
635 f29109d0 Renato Botelho
			</select>
636
		</td>
637
	</tr>
638
	<tr>
639
		<td width="22%" valign="top" class="vncellreq"><div id="addressnetworkport"><?=gettext("Host(s)"); ?></div></td>
640
		<td width="78%" class="vtable">
641 709e62f0 Colin Fleming
			<table id="maintable" summary="maintable">
642 f29109d0 Renato Botelho
				<tbody>
643
					<tr>
644
						<td colspan="4">
645
							<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>
646
						</td>
647
					</tr>
648
					<tr>
649
						<td><div id="onecolumn"><?=gettext("Network"); ?></div></td>
650
						<td><div id="twocolumn">CIDR</div></td>
651
						<td><div id="threecolumn"><?=gettext("Description"); ?></div></td>
652
					</tr>
653
654
					<?php
655
					$counter = 0;
656 2db5f9c2 Renato Botelho
					if ($pconfig['address'] <> ""):
657
						$addresses = explode(" ", $pconfig['address']);
658
						$details = explode("||", $pconfig['detail']);
659
						while ($counter < count($addresses)):
660
							if (is_subnet($addresses[$counter])) {
661
								list($address, $address_subnet) = explode("/", $addresses[$counter]);
662
							} else {
663
								$address = $addresses[$counter];
664
								$address_subnet = "";
665 f29109d0 Renato Botelho
							}
666
					?>
667
					<tr>
668
						<td>
669 76b1d814 N0YB
							<input style="autocomplete:off" name="address<?php echo $counter; ?>" type="text" class="formfldalias ipv4v6" id="address<?php echo $counter; ?>" size="30" value="<?=htmlspecialchars($address);?>" />
670 f29109d0 Renato Botelho
						</td>
671
						<td>
672 2db5f9c2 Renato Botelho
							<select name="address_subnet<?php echo $counter; ?>" class="formselect ipv4v6" id="address_subnet<?php echo $counter; ?>">
673 f29109d0 Renato Botelho
								<option></option>
674
								<?php for ($i = 128; $i >= 1; $i--): ?>
675 709e62f0 Colin Fleming
									<option value="<?=$i;?>" <?php if (($i == $address_subnet) || ($i == $pconfig['updatefreq'])) echo "selected=\"selected\""; ?>><?=$i;?></option>
676 f29109d0 Renato Botelho
								<?php endfor; ?>
677
							</select>
678
						</td>
679
						<td>
680 6666ef48 Renato Botelho
							<input name="detail<?php echo $counter; ?>" type="text" class="formfld unknown" id="detail<?php echo $counter; ?>" size="50" value="<?=$details[$counter];?>" />
681 f29109d0 Renato Botelho
						</td>
682
						<td>
683
							<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>
684
						</td>
685
					</tr>
686
					<?php
687
						$counter++;
688
689 2db5f9c2 Renato Botelho
						endwhile;
690
					endif;
691 f29109d0 Renato Botelho
					?>
692
				</tbody>
693
			</table>
694
			<div id="addrowbutton">
695
				<a onclick="javascript:addRowTo('maintable', 'formfldalias'); typesel_change(); add_alias_control(this); return false;" href="#">
696
					<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry"); ?>" />
697
				</a>
698
			</div>
699
		</td>
700
	</tr>
701
	<tr>
702
		<td width="22%" valign="top">&nbsp;</td>
703
		<td width="78%">
704
			<input id="submit" name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
705 5a815dc7 Renato Botelho
			<a href="firewall_aliases.php?tab=<?=$tab;?>"><input id="cancelbutton" name="cancelbutton" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" /></a>
706 5a1eebc7 Scott Ullrich
		</td>
707 f29109d0 Renato Botelho
	</tr>
708 5a1eebc7 Scott Ullrich
</table>
709 5b237745 Scott Ullrich
</form>
710 5a1eebc7 Scott Ullrich
711 76b1d814 N0YB
<script type="text/javascript">
712
//<![CDATA[
713
var autocomplete_off = ['address'];
714
for (var i = 0; i < autocomplete_off.length; i++) {
715
	var node = document.getElementById(autocomplete_off[i]);
716
	node.setAttribute("autocomplete",node.style.autocomplete);
717
}
718
//]]>
719
</script>
720
721 5a1eebc7 Scott Ullrich
<script type="text/javascript">
722 4dfd930e Darren Embry
//<![CDATA[
723 5a1eebc7 Scott Ullrich
	field_counter_js = 3;
724
	rows = 1;
725
	totalrows = <?php echo $counter; ?>;
726
	loaded = <?php echo $counter; ?>;
727
	typesel_change();
728
	update_box_type();
729 0cea9a23 Ermal Lu?i
730 dd760cfc r-duran
	var addressarray = <?= json_encode(array_exclude($pconfig['name'], get_alias_list($pconfig['type']))) ?>;
731 0cea9a23 Ermal Lu?i
732 4dfd930e Darren Embry
	function createAutoSuggest() {
733 f29109d0 Renato Botelho
		<?php
734 4dfd930e Darren Embry
		for ($jv = 0; $jv < $counter; $jv++)
735
			echo "objAlias[{$jv}] = new AutoSuggestControl(document.getElementById(\"address{$jv}\"), new StateSuggestions(addressarray));\n";
736
		?>
737
	}
738 0cea9a23 Ermal Lu?i
739 4dfd930e Darren Embry
	setTimeout("createAutoSuggest();", 500);
740
//]]>
741 5b237745 Scott Ullrich
</script>
742 5a1eebc7 Scott Ullrich
743 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
744
</body>
745
</html>