Project

General

Profile

Download (32.8 KB) Statistics
| Branch: | Tag: | Revision:
1 658292ef Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 658292ef Scott Ullrich
/*
4 57333fa0 Scott Ullrich
    wizard.php
5 658292ef Scott Ullrich
    Copyright (C) 2004 Scott Ullrich
6 a3db8d75 Ermal
    Copyright (C) 2010 Ermal Lu?i
7 658292ef Scott Ullrich
    All rights reserved.
8
9
    Redistribution and use in source and binary forms, with or without
10
    modification, are permitted provided that the following conditions are met:
11
12
    1. Redistributions of source code must retain the above copyright notice,
13
       this list of conditions and the following disclaimer.
14
15
    2. Redistributions in binary form must reproduce the above copyright
16
       notice, this list of conditions and the following disclaimer in the
17
       documentation and/or other materials provided with the distribution.
18
19
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
    POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31 6b07c15a Matthew Grooms
##|+PRIV
32
##|*IDENT=page-pfsensewizardsubsystem
33
##|*NAME=pfSense wizard subsystem page
34
##|*DESCR=Allow access to the 'pfSense wizard subsystem' page.
35
##|*MATCH=wizard.php*
36
##|-PRIV
37
38
39 658292ef Scott Ullrich
require("guiconfig.inc");
40 f9fc88cc sullrich
require("functions.inc");
41
require("filter.inc");
42
require("shaper.inc");
43
require("rrd.inc");
44 658292ef Scott Ullrich
45
function gentitle_pkg($pgname) {
46 2fbd6806 Scott Ullrich
	global $config;
47
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
48 658292ef Scott Ullrich
}
49
50 d8c1a6c5 Scott Ullrich
$stepid = htmlspecialchars($_GET['stepid']);
51 658292ef Scott Ullrich
if (isset($_POST['stepid']))
52 d8c1a6c5 Scott Ullrich
    $stepid = htmlspecialchars($_POST['stepid']);
53 72a5f424 Ermal Lu?i
if (!$stepid)
54
	$stepid = "0";
55 658292ef Scott Ullrich
56 d8c1a6c5 Scott Ullrich
$xml = htmlspecialchars($_GET['xml']);
57 5a8a69b3 Ermal Lu?i
if($_POST['xml'])
58
	$xml = htmlspecialchars($_POST['xml']);
59 658292ef Scott Ullrich
60 5a8a69b3 Ermal Lu?i
if(empty($xml)) {
61 bb0c9569 Bill Marquette
	$xml = "not_defined";
62
	print_info_box_np("ERROR:  Could not open " . $xml . ".");
63
	die;
64 658292ef Scott Ullrich
} else {
65 bd31336e Scott Ullrich
	if (file_exists("{$g['www_path']}/wizards/{$xml}"))
66 fc19d371 Scott Ullrich
		$pkg = parse_xml_config_pkg("{$g['www_path']}/wizards/" . $xml, "pfsensewizard");
67 bb0c9569 Bill Marquette
	else {
68
		print_info_box_np("ERROR:  Could not open " . $xml . ".");
69
		die;
70
	}
71 658292ef Scott Ullrich
}
72
73 5a8a69b3 Ermal Lu?i
if (!is_array($pkg)) {
74
	print_info_box_np("ERROR: Could not parse {$g['www_path']}/wizards/{$xml} file.");
75
	die;
76
}
77
78 658292ef Scott Ullrich
$title          = $pkg['step'][$stepid]['title'];
79
$description    = $pkg['step'][$stepid]['description'];
80 46985f19 Scott Ullrich
$totalsteps     = $pkg['totalsteps'];
81 658292ef Scott Ullrich
82 2ca50c87 Ermal Lu?i
if ($pkg['includefile'])
83
        require_once($pkg['includefile']);
84
85 b3f4e57c Scott Ullrich
if ($pkg['step'][$stepid]['includefile'])
86 5a8a69b3 Ermal Lu?i
	require_once($pkg['step'][$stepid]['includefile']);
87 b3f4e57c Scott Ullrich
88 e1e7a425 Scott Ullrich
if($pkg['step'][$stepid]['stepsubmitbeforesave']) {
89 a314bebc Ermal
	eval($pkg['step'][$stepid]['stepsubmitbeforesave']);
90 e1e7a425 Scott Ullrich
}
91
92 658292ef Scott Ullrich
if ($_POST) {
93 e48fc17d Scott Ullrich
    foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
94 ba9e9bbf Ermal Lu?i
        if(!empty($field['bindstofield']) and $field['type'] <> "submit") {
95 e48fc17d Scott Ullrich
		$fieldname = $field['name'];
96 72a5f424 Ermal Lu?i
		$fieldname = str_replace(" ", "", $fieldname);
97 e48fc17d Scott Ullrich
		$fieldname = strtolower($fieldname);
98
		// update field with posted values.
99 ba9e9bbf Ermal Lu?i
                if($field['unsetfield'] <> "")
100
			$unset_fields = "yes";
101
		else
102
			$unset_fields = "";
103
		if($field['arraynum'] <> "")
104
			$arraynum = $field['arraynum'];
105
		else
106
			$arraynum = "";
107 72a5f424 Ermal Lu?i
108
		update_config_field( $field['bindstofield'], $_POST[$fieldname], $unset_fields, $arraynum, $field['type']);
109 658292ef Scott Ullrich
        }
110 3ed807e4 Scott Ullrich
111 2fbd6806 Scott Ullrich
    }
112 3ed807e4 Scott Ullrich
    // run custom php code embedded in xml config.
113
    if($pkg['step'][$stepid]['stepsubmitphpaction'] <> "") {
114
		eval($pkg['step'][$stepid]['stepsubmitphpaction']);
115
    }
116
	write_config();
117 e48fc17d Scott Ullrich
    $stepid++;
118 72a5f424 Ermal Lu?i
    if($stepid > $totalsteps)
119
	$stepid = $totalsteps;
120 658292ef Scott Ullrich
}
121
122 46985f19 Scott Ullrich
$title          = $pkg['step'][$stepid]['title'];
123
$description    = $pkg['step'][$stepid]['description'];
124
125 3f83de3d Scott Ullrich
function update_config_field($field, $updatetext, $unset, $arraynum, $field_type) {
126 eb20f3c5 Ermal Lu?i
	global $config;
127 e48fc17d Scott Ullrich
	$field_split = split("->",$field);
128 72a5f424 Ermal Lu?i
	foreach ($field_split as $f)
129
		$field_conv .= "['" . $f . "']";
130
	if($field_conv == "")
131
		return;
132
	if(($field_type == "checkbox" and $updatetext <> "on") || $updatetext == "") {
133 3f83de3d Scott Ullrich
		/*
134
		    item is a checkbox, it should have the value "on"
135
		    if it was checked
136
                */
137
		$text = "unset(\$config" . $field_conv . ");";
138
		eval($text);
139
		return;
140 496f9155 Scott Ullrich
	}
141 e881d1f3 Scott Ullrich
142 496f9155 Scott Ullrich
	if($field_type == "interfaces_selection") {
143
		$text = "unset(\$config" . $field_conv . ");";
144
		eval($text);
145
		$text = "\$config" . $field_conv . " = \"" . $updatetext . "\";";
146
		eval($text);
147
		return;
148
	}
149 e881d1f3 Scott Ullrich
150 e48fc17d Scott Ullrich
	if($unset <> "") {
151
		$text = "unset(\$config" . $field_conv . ");";
152
		eval($text);
153 46985f19 Scott Ullrich
		$text = "\$config" . $field_conv . "[" . $arraynum . "] = \"" . $updatetext . "\";";
154 e48fc17d Scott Ullrich
		eval($text);
155
	} else {
156 46985f19 Scott Ullrich
		if($arraynum <> "") {
157
			$text = "\$config" . $field_conv . "[" . $arraynum . "] = \"" . $updatetext . "\";";
158
		} else {
159
			$text = "\$config" . $field_conv . " = \"" . $updatetext . "\";";
160
		}
161 e48fc17d Scott Ullrich
		eval($text);
162
	}
163 658292ef Scott Ullrich
}
164
165 a314bebc Ermal
// handle before form display event.
166
do {
167
	$oldstepid = $stepid;
168
	if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "")
169
		eval($pkg['step'][$stepid]['stepbeforeformdisplay']);
170
} while ($oldstepid != $stepid);
171 34b5c5a0 Scott Ullrich
172 d88c6a9f Scott Ullrich
$pgtitle = array($title);
173 4df96eff Scott Ullrich
include("head.inc");
174 6bb5c9aa Bill Marquette
175 4df96eff Scott Ullrich
?>
176 1ae55320 Ermal
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" >
177 4e3391a3 Scott Ullrich
178 8c01d3bb Scott Ullrich
<?php
179 ba21539c Scott Ullrich
	if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) 
180 8c01d3bb Scott Ullrich
		echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n";
181 4e3391a3 Scott Ullrich
	else 
182
		echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />";
183 8c01d3bb Scott Ullrich
?>
184
185 33a56b27 Colin Smith
<?php if($pkg['step'][$stepid]['fields']['field'] <> "") { ?>
186 44c10295 Scott Ullrich
<script type="text/javascript">
187 f9e35766 Scott Ullrich
<!--
188 38e7d556 Scott Ullrich
189 e881d1f3 Scott Ullrich
function  FieldValidate(userinput,  regexp,  message)
190
{
191 2465ff5b Ermal
	if(!userinput.match(regexp))
192
		alert(message);
193 e881d1f3 Scott Ullrich
}
194 38e7d556 Scott Ullrich
195 33a56b27 Colin Smith
function enablechange() {
196
<?php
197
        foreach($pkg['step'][$stepid]['fields']['field'] as $field) {
198
                if(isset($field['enablefields']) or isset($field['checkenablefields'])) {
199 ba374e4b Ermal
                        print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked) {' . "\n";
200 33a56b27 Colin Smith
                        if(isset($field['enablefields'])) {
201
                                $enablefields = explode(',', $field['enablefields']);
202
                                foreach($enablefields as $enablefield) {
203
                                        $enablefield = strtolower($enablefield);
204
                                        print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 1;' . "\n";
205
                                }
206
                        }
207
                        if(isset($field['checkenablefields'])) {
208
                                $checkenablefields = explode(',', $field['checkenablefields']);
209
                                foreach($checkenablefields as $checkenablefield) {
210
                                        $checkenablefield = strtolower($checkenablefield);
211
                                        print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 0;' . "\n";
212
                                }
213
                        }
214
                        print "\t" . '} else {' . "\n";
215
                        if(isset($field['enablefields'])) {
216 2465ff5b Ermal
                                $enablefields = explode(',', $field['enablefields']);
217 33a56b27 Colin Smith
                                foreach($enablefields as $enablefield) {
218
                                        $enablefield = strtolower($enablefield);
219
                                        print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n";
220
                                }
221
                        }
222
                        if(isset($field['checkenablefields'])) {
223 2465ff5b Ermal
                                $checkenablefields = explode(',', $field['checkenablefields']);
224 33a56b27 Colin Smith
                                foreach($checkenablefields as $checkenablefield) {
225
                                        $checkenablefield = strtolower($checkenablefield);
226
                                        print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n";
227
                                }
228 e881d1f3 Scott Ullrich
                        }
229 33a56b27 Colin Smith
                        print "\t" . '}' . "\n";
230
                }
231
        }
232
?>
233 6bb5c9aa Bill Marquette
}
234 2465ff5b Ermal
235 1ae55320 Ermal
function disablechange() {
236
<?php
237
        foreach($pkg['step'][$stepid]['fields']['field'] as $field) {
238
                if(isset($field['disablefields']) or isset($field['checkdisablefields'])) {
239
                        print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked) {' . "\n";
240
                        if(isset($field['disablefields'])) {
241
                                $enablefields = explode(',', $field['disablefields']);
242
                                foreach($enablefields as $enablefield) {
243
                                        $enablefield = strtolower($enablefield);
244
                                        print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 1;' . "\n";
245
                                }
246
                        }
247
                        if(isset($field['checkdisablefields'])) {
248
                                $checkenablefields = explode(',', $field['checkdisablefields']);
249
                                foreach($checkenablefields as $checkenablefield) {
250
                                        $checkenablefield = strtolower($checkenablefield);
251
                                        print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 0;' . "\n";
252
                                }
253
                        }
254
                        print "\t" . '} else {' . "\n";
255
                        if(isset($field['disablefields'])) {
256
                                $enablefields = explode(',', $field['disablefields']);
257
                                foreach($enablefields as $enablefield) {
258
                                        $enablefield = strtolower($enablefield);
259
                                        print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n";
260
                                }
261
                        }
262
                        if(isset($field['checkdisablefields'])) {
263
                                $checkenablefields = explode(',', $field['checkdisablefields']);
264
                                foreach($checkenablefields as $checkenablefield) {
265
                                        $checkenablefield = strtolower($checkenablefield);
266
                                        print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n";
267
                                }
268
                        }
269
                        print "\t" . '}' . "\n";
270
                }
271
        }
272
?>
273
}
274
275 2465ff5b Ermal
function showchange() {
276
<?php
277
        foreach($pkg['step'][$stepid]['fields']['field'] as $field) {
278 1ae55320 Ermal
                if(isset($field['showfields'])) {
279 2465ff5b Ermal
                        print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked == false) {' . "\n";
280
                        if(isset($field['showfields'])) {
281
                                $showfields = explode(',', $field['showfields']);
282
                                foreach($showfields as $showfield) {
283
                                        $showfield = strtolower($showfield);
284 1ae55320 Ermal
                                        //print "\t\t" . 'document.iform.' . $showfield . ".display =\"none\";\n";
285
					print "\t\t \$('". $showfield . "').hide();";
286 2465ff5b Ermal
                                }
287
                        }
288
                        print "\t" . '} else {' . "\n";
289
                        if(isset($field['showfields'])) {
290
                                $showfields = explode(',', $field['showfields']);
291
                                foreach($showfields as $showfield) {
292
                                        $showfield = strtolower($showfield);
293 1ae55320 Ermal
                                        #print "\t\t" . 'document.iform.' . $showfield . ".display =\"\";\n";
294
					print "\t\t \$('". $showfield . "').show();";
295 2465ff5b Ermal
                                }
296
                        }
297
                        print "\t" . '}' . "\n";
298
                }
299
	}
300
?>
301
}
302 6bb5c9aa Bill Marquette
//-->
303
</script>
304 33a56b27 Colin Smith
<?php } ?>
305 6bb5c9aa Bill Marquette
306 33a56b27 Colin Smith
<form action="wizard.php" method="post" name="iform" id="iform">
307 658292ef Scott Ullrich
<input type="hidden" name="xml" value="<?= $xml ?>">
308 e48fc17d Scott Ullrich
<input type="hidden" name="stepid" value="<?= $stepid ?>">
309 658292ef Scott Ullrich
310 e48fc17d Scott Ullrich
<center>
311
312
&nbsp;<br>
313 1c3d61fe Scott Ullrich
314 fe2bfbfc Scott Ullrich
<?php
315 1c3d61fe Scott Ullrich
	if($title == "Reload in progress") {
316 3f394d09 Erik Fonnesbeck
		$ip = fixup_string("\$myurl");
317 1c3d61fe Scott Ullrich
	} else {
318 fe2bfbfc Scott Ullrich
		$ip = "/";
319 1c3d61fe Scott Ullrich
	}
320 2576dace Ermal Luçi
	echo "<a href='$ip'>";
321 fe2bfbfc Scott Ullrich
?>
322 1c3d61fe Scott Ullrich
<img border="0" src="./themes/<?= $g['theme']; ?>/images/logo.gif"></a>
323 d51f86e0 Scott Ullrich
<p>
324 b7bb1711 Ermal Lu?i
<div style="width:800px;background-color:#ffffff" id="roundme">
325
<table bgcolor="#ffffff" width="95%" border="0" cellspacing="0" cellpadding="2">
326 34b5c5a0 Scott Ullrich
    <!-- wizard goes here -->
327
    <tr><td>&nbsp;</td></tr>
328 77851510 Scott Ullrich
    <tr><td colspan='2'>
329 55b8d602 Scott Ullrich
<?php
330 eb20f3c5 Ermal Lu?i
	if ($savemsg)
331
		print_info_box($savemsg);
332 55b8d602 Scott Ullrich
	if ($_GET['message'] != "")
333 d8c1a6c5 Scott Ullrich
		print_info_box(htmlspecialchars($_GET['message']));
334 55b8d602 Scott Ullrich
	if ($_POST['message'] != "")
335 d8c1a6c5 Scott Ullrich
		print_info_box(htmlspecialchars($_POST['message']));
336 77851510 Scott Ullrich
?></td></tr>
337 b7bb1711 Ermal Lu?i
 <tr>
338
	<td class="tabcont">
339
	<table width="100%" border="0" cellpadding="6" cellspacing="0">
340
341
    <tr><td colspan='2'><center><font size="2"><b><?= fixup_string($description) ?></b></font></center></td></tr><tr><td>&nbsp;</td></tr>
342 34b5c5a0 Scott Ullrich
    <?php
343
	if(!$pkg['step'][$stepid]['disableheader'])
344 d51f86e0 Scott Ullrich
		echo "<tr><td colspan=\"2\" class=\"listtopic\">" . fixup_string($title) . "</td></tr>";
345 34b5c5a0 Scott Ullrich
    ?>
346
347
    <?php
348 44c10295 Scott Ullrich
	$inputaliases = array();
349 34b5c5a0 Scott Ullrich
	if($pkg['step'][$stepid]['fields']['field'] <> "") {
350
		foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
351
352
		    $value = $field['value'];
353 2fbd6806 Scott Ullrich
		    $name  = $field['name'];
354 658292ef Scott Ullrich
355 2fbd6806 Scott Ullrich
		    $name = ereg_replace(" ", "", $name);
356
		    $name = strtolower($name);
357 658292ef Scott Ullrich
358 a8df0181 Scott Ullrich
		    if($field['bindstofield'] <> "") {
359 b1919dd0 Scott Ullrich
				$arraynum = "";
360
				$field_conv = "";
361
				$field_split = split("->", $field['bindstofield']);
362
				// arraynum is used in cases where there is an array of the same field
363
				// name such as dnsserver (2 of them)
364 a314bebc Ermal
				if($field['arraynum'] <> "")
365
					$arraynum = "[" . $field['arraynum'] . "]";
366
				foreach ($field_split as $f)
367
					$field_conv .= "['" . $f . "']";
368 373a1e7b Ermal
				$toeval = "if (isset(\$config" . $field_conv . $arraynum . ")) { \$value = \$config" . $field_conv . $arraynum . "; if (empty(\$value)) \$value = true; }";
369 a314bebc Ermal
				eval($toeval);
370 a8df0181 Scott Ullrich
		    }
371
372 34b5c5a0 Scott Ullrich
		    if(!$field['combinefieldsend'])
373
			echo "<tr>";
374
375 b7bb1711 Ermal Lu?i
		    switch ($field['type']) {
376
		    case "input":
377 7a29f783 Ermal Lu?i
			if ($field['displayname']) {
378
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
379 8984dc5e Ermal
				echo $field['displayname'];
380
				echo ":</td>\n";
381 7a29f783 Ermal Lu?i
			} else if(!$field['dontdisplayname']) {
382 34b5c5a0 Scott Ullrich
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
383 d51f86e0 Scott Ullrich
				echo fixup_string($field['name']);
384 34b5c5a0 Scott Ullrich
				echo ":</td>\n";
385
			}
386
			if(!$field['dontcombinecells'])
387
				echo "<td class=\"vtable\">\n";
388 6bb5c9aa Bill Marquette
389 66f773b4 Ermal Lu?i
			echo "<input class='formfld unknown' id='" . $name . "' name='" . $name . "' value='" . $value . "'";
390
			if($field['size'])
391
				echo " size='" . $field['size'] . "' ";
392 6bb5c9aa Bill Marquette
			if($field['validate'])
393
				echo " onChange='FieldValidate(this.value, \"{$field['validate']}\", \"{$field['message']}\");'";
394
			echo ">\n";
395 62a48760 Scott Ullrich
396 66f773b4 Ermal Lu?i
			if($field['description'] <> "") {
397
				echo "<br /> " . $field['description'];
398
		    	}
399 b7bb1711 Ermal Lu?i
			break;
400
		    case "text":
401 66f773b4 Ermal Lu?i
			echo "<td colspan=\"2\" align=\"center\" class=\"vncell\">\n";
402
			if($field['description'] <> "") {
403 b7bb1711 Ermal Lu?i
                                echo "<center><br /> " . $field['description'] . "</center>";
404 66f773b4 Ermal Lu?i
                        }
405 b7bb1711 Ermal Lu?i
			break;
406
		    case "inputalias":
407 7a29f783 Ermal Lu?i
			if ($field['displayname']) {
408
                                echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
409 d6f53204 Ermal Lu?i
                                echo $field['displayname'];
410 7a29f783 Ermal Lu?i
                                echo ":</td>\n";
411
			} else if(!$field['dontdisplayname']) {
412 62a48760 Scott Ullrich
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
413
				echo fixup_string($field['name']);
414
				echo ":</td>\n";
415
			}
416
			if(!$field['dontcombinecells'])
417
				echo "<td class=\"vtable\">\n";
418
419 40050fab Ermal
			$inputaliases[] = $name;
420
			echo "<input class='formfldalias' autocomplete='off' class='formfldalias' id='" . $name . "' name='" . $name . "' value='" . $value . "'";
421 66f773b4 Ermal Lu?i
			if($field['size'])
422
				echo " size='" . $field['size'] . "' ";
423 62a48760 Scott Ullrich
			if($field['validate'])
424
				echo " onChange='FieldValidate(this.value, \"{$field['validate']}\", \"{$field['message']}\");'";
425 e881d1f3 Scott Ullrich
			echo ">\n";
426
427 66f773b4 Ermal Lu?i
			if($field['description'] <> "") {
428
				echo "<br /> " . $field['description'];
429
		    	}
430 b7bb1711 Ermal Lu?i
			break;
431
		    case "interfaces_selection":
432 496f9155 Scott Ullrich
			$size = "";
433
			$multiple = "";
434
			$name = strtolower($name);
435
			echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
436 7a29f783 Ermal Lu?i
			echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n";
437 496f9155 Scott Ullrich
			echo "</td>";
438
			echo "<td class=\"vtable\">\n";
439 7b4710f9 Scott Ullrich
			if($field['size'] <> "") $size = "size=\"{$field['size']}\"";
440 496f9155 Scott Ullrich
			if($field['multiple'] <> "" and $field['multiple'] <> "0") {
441 7b4710f9 Scott Ullrich
			  $multiple = "multiple=\"multiple\"";
442 496f9155 Scott Ullrich
			  $name .= "[]";
443
			}
444 66f773b4 Ermal Lu?i
			echo "<select class='formselect' id='{$name}' name='{$name}' {$size} {$multiple}>\n";
445 496f9155 Scott Ullrich
			if($field['add_to_interfaces_selection'] <> "") {
446
				$SELECTED = "";
447
				if($field['add_to_interfaces_selection'] == $value) $SELECTED = " SELECTED";
448
				echo "<option value='" . $field['add_to_interfaces_selection'] . "'" . $SELECTED . ">" . $field['add_to_interfaces_selection'] . "</option>\n";
449
			}
450 203de6bf Ermal Lu?i
			$interfaces = get_configured_interface_with_descr();
451 496f9155 Scott Ullrich
			foreach ($interfaces as $ifname => $iface) {
452
			  $SELECTED = "";
453 aecffb0a Scott Ullrich
			  if ($value == $ifname) $SELECTED = " SELECTED";
454 203de6bf Ermal Lu?i
			  $to_echo = "<option value='" . $ifname . "'" . $SELECTED . ">" . $iface . "</option>\n";
455 496f9155 Scott Ullrich
			  $to_echo .= "<!-- {$value} -->";
456
			  $canecho = 0;
457
			  if($field['interface_filter'] <> "") {
458 203de6bf Ermal Lu?i
				if(stristr($ifname, $field['interface_filter']) == true)
459 496f9155 Scott Ullrich
					$canecho = 1;
460
			  } else {
461
				$canecho = 1;
462
			  }
463 e881d1f3 Scott Ullrich
			  if($canecho == 1)
464 496f9155 Scott Ullrich
				echo $to_echo;
465
			}
466
				echo "</select>\n";
467 66f773b4 Ermal Lu?i
468
			if($field['description'] <> "") {
469
				echo "<br /> " . $field['description'];
470
		    	}
471 b7bb1711 Ermal Lu?i
472
			break;
473
		    case "password":
474 c062a711 jim-p
			if ($field['displayname']) {
475
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
476
				echo $field['displayname'];
477
				echo ":</td>\n";
478
			} else if(!$field['dontdisplayname']) {
479 34b5c5a0 Scott Ullrich
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
480 d51f86e0 Scott Ullrich
				echo fixup_string($field['name']);
481 34b5c5a0 Scott Ullrich
				echo ":</td>\n";
482
			}
483
			if(!$field['dontcombinecells'])
484
				echo "<td class=\"vtable\">";
485 c062a711 jim-p
			echo "<input class='formfld pwd' id='" . $name . "' name='" . $name . "' value='" . $value . "' type='password' ";
486 66f773b4 Ermal Lu?i
			if($field['size'])
487
				echo " size='" . $field['size'] . "' ";
488
			echo ">\n";
489
490
			if($field['description'] <> "") {
491
				echo "<br /> " . $field['description'];
492
		    	}
493 b7bb1711 Ermal Lu?i
494
			break;
495
		    case "certca_selection":
496 66f773b4 Ermal Lu?i
                        $size = "";
497
                        $multiple = "";
498
                        $name = strtolower($name);
499
                        echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
500
                        echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n";
501
                        echo "</td>";
502
                        echo "<td class=\"vtable\">\n";
503
                        if($field['size'] <> "") $size = "size=\"{$field['size']}\"";
504
                        echo "<select id='{$name}' name='{$name}' {$size}>\n";
505
                        if($field['add_to_certca_selection'] <> "") {
506
                                $SELECTED = "";
507
                                if($field['add_to_certca_selection'] == $value) $SELECTED = " SELECTED";
508
                                echo "<option value='" . $field['add_to_certca_selection'] . "'" . $SELECTED . ">" . $field['add_to_certca_selection'] . "</option>\n";
509
                        }
510
			foreach($config['system']['ca'] as $ca) {
511
				$name = htmlspecialchars($ca['name']);
512
                          $SELECTED = "";
513
                          if ($value == $name) $SELECTED = " SELECTED";
514
                          $to_echo = "<option value='" . $ca['refid'] . "'" . $SELECTED . ">" . $name . "</option>\n";
515
                          $to_echo .= "<!-- {$value} -->";
516
                          $canecho = 0;
517
                          if($field['certca_filter'] <> "") {
518
                                if(stristr($name, $field['certca_filter']) == true)
519
                                        $canecho = 1;
520
                          } else {
521
                                $canecho = 1;
522
                          }
523
                          if($canecho == 1)
524
                                echo $to_echo;
525
                        }
526
                                echo "</select>\n";
527
528
			if($field['description'] <> "") {
529
				echo "<br /> " . $field['description'];
530
		    	}
531 b7bb1711 Ermal Lu?i
532
			break;
533
		    case "cert_selection":
534 66f773b4 Ermal Lu?i
                        $size = "";
535
                        $multiple = "";
536
                        $name = strtolower($name);
537
                        echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
538
                        echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n";
539
                        echo "</td>";
540
                        echo "<td class=\"vtable\">\n";
541
                        if($field['size'] <> "") $size = "size=\"{$field['size']}\"";
542
                        echo "<select id='{$name}' name='{$name}' {$size}>\n";
543
                        if($field['add_to_cert_selection'] <> "") {
544
                                $SELECTED = "";
545
                                if($field['add_to_cert_selection'] == $value) $SELECTED = " SELECTED";
546
                                echo "<option value='" . $field['add_to_cert_selection'] . "'" . $SELECTED . ">" . $field['add_to_cert_selection'] . "</option>\n";
547
                        }
548
                        foreach($config['system']['cert'] as $ca) {
549
				if (stristr($ca['name'], "webconf"))
550
					continue;
551
                                $name = htmlspecialchars($ca['name']);
552
                          $SELECTED = "";
553
                          if ($value == $name) $SELECTED = " SELECTED";
554
                          $to_echo = "<option value='" . $ca['refid'] . "'" . $SELECTED . ">" . $name . "</option>\n";
555
                          $to_echo .= "<!-- {$value} -->";
556
                          $canecho = 0;
557
                          if($field['cert_filter'] <> "") {
558
                                if(stristr($name, $field['cert_filter']) == true)
559
                                        $canecho = 1;
560
                          } else {
561
                                $canecho = 1;
562
                          }
563
                          if($canecho == 1)
564
                                echo $to_echo;
565
                        }
566
                                echo "</select>\n";
567
568
			if($field['description'] <> "") {
569
				echo "<br /> " . $field['description'];
570
		    	}
571 b7bb1711 Ermal Lu?i
572
			break;
573
		    case "select":
574 7a29f783 Ermal Lu?i
			if ($field['displayname']) {
575
                                echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
576 d6f53204 Ermal Lu?i
                                echo $field['displayname'];
577 7a29f783 Ermal Lu?i
                                echo ":</td>\n";
578
			} else if(!$field['dontdisplayname']) {
579 34b5c5a0 Scott Ullrich
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
580 d51f86e0 Scott Ullrich
				echo fixup_string($field['name']);
581 34b5c5a0 Scott Ullrich
				echo ":</td>\n";
582
			}
583
			if($field['size']) $size = " size='" . $field['size'] . "' ";
584
			if($field['multiple'] == "yes") $multiple = "MULTIPLE ";
585
			if(!$field['dontcombinecells'])
586
				echo "<td class=\"vtable\">\n";
587
			$onchange = "";
588
			foreach ($field['options']['option'] as $opt) {
589
				if($opt['enablefields'] <> "") {
590
					$onchange = "onchange=\"enableitems(this.selectedIndex);\" ";
591
				}
592
			}
593 66f773b4 Ermal Lu?i
			echo "<select class='formselect' " . $onchange . $multiple . $size . "id='" . $name . "' name='" . $name . "'>\n";
594 34b5c5a0 Scott Ullrich
			foreach ($field['options']['option'] as $opt) {
595 46985f19 Scott Ullrich
				$selected = "";
596 47aa4fc4 Ermal
				if($value == $opt['value'])
597
					$selected = " SELECTED";
598
				echo "\t<option name='" . $opt['name'] . "' value='" . $opt['value'] . "'" . $selected . ">";
599 d6f53204 Ermal Lu?i
				if ($opt['displayname'])
600
					echo $opt['displayname'];
601
				else
602
					echo $opt['name'];
603
				echo "</option>\n";
604 34b5c5a0 Scott Ullrich
			}
605
			echo "</select>\n";
606 a314bebc Ermal
                        echo "<!-- {$value} -->\n";
607 66f773b4 Ermal Lu?i
608
			if($field['description'] <> "") {
609
				echo $field['description'];
610
		    	}
611 b7bb1711 Ermal Lu?i
612
			break;
613
		    case "textarea":
614 7a29f783 Ermal Lu?i
			if ($field['displayname']) {
615
                                echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
616 d6f53204 Ermal Lu?i
                                echo $field['displayname'];
617 7a29f783 Ermal Lu?i
                                echo ":</td>\n";
618
			} else if(!$field['dontdisplayname']) {
619 34b5c5a0 Scott Ullrich
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
620 d51f86e0 Scott Ullrich
				echo fixup_string($field['name']);
621 34b5c5a0 Scott Ullrich
				echo ":</td>";
622
			}
623
			if(!$field['dontcombinecells'])
624
				echo "<td class=\"vtable\">";
625 66f773b4 Ermal Lu?i
			echo "<textarea class='formpre' id='" . $name . "' name='" . $name . "'";
626
			if ($field['rows'])
627
				echo " rows='" . $field['rows'] . "' ";
628
			if ($field['cols'])
629
				echo " cols='" . $field['cols'] . "' ";
630
			echo ">" . $value . "</textarea>\n";
631
				
632
633
			if($field['description'] <> "") {
634
				echo "<br /> " . $field['description'];
635
		    	}
636 b7bb1711 Ermal Lu?i
637
			break;
638
		    case "submit":
639 34b5c5a0 Scott Ullrich
			echo "<td>&nbsp;<br></td></tr>";
640 2fbd6806 Scott Ullrich
			echo "<tr><td colspan='2'><center>";
641
			echo "<input type='submit' name='" . $name . "' value='" . $field['name'] . "'>\n";
642 66f773b4 Ermal Lu?i
643
			if($field['description'] <> "") {
644
				echo "<br /> " . $field['description'];
645
		    	}
646 b7bb1711 Ermal Lu?i
647
			break;
648
		    case "listtopic":
649
			echo "<td>&nbsp;</td></tr>";
650
			echo "<tr><td colspan=\"2\" class=\"listtopic\">" . $field['name'] . "<br ></td>\n";
651
652
			break;
653
		    case "subnet_select":
654 7a29f783 Ermal Lu?i
			if ($field['displayname']) {
655
                                echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
656 d6f53204 Ermal Lu?i
                                echo $field['displayname'];
657 7a29f783 Ermal Lu?i
                                echo ":</td>\n";
658
			} else if(!$field['dontdisplayname']) {
659 bd31336e Scott Ullrich
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
660
				echo fixup_string($field['name']);
661
				echo ":</td>";
662
			}
663
			if(!$field['dontcombinecells'])
664
				echo "<td class=\"vtable\">";
665 66f773b4 Ermal Lu?i
			echo "<select class='formselect' name='{$name}'>\n";
666 bd31336e Scott Ullrich
			for($x=1; $x<33; $x++) {
667
				$CHECKED = "";
668
				if($value == $x) $CHECKED = " SELECTED";
669
				if($x <> 31)
670
					echo "<option value='{$x}' {$CHECKED}>{$x}</option>\n";
671
			}
672
			echo "</select>\n";
673 66f773b4 Ermal Lu?i
674
			if($field['description'] <> "") {
675
				echo "<br /> " . $field['description'];
676
		    	}
677 b7bb1711 Ermal Lu?i
678
			break;
679
		    case "timezone_select":
680 5a8a69b3 Ermal Lu?i
			exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist);
681
			$timezonelist = array_filter($timezonelist, 'is_timezone');
682
			sort($timezonelist);
683
684
			/* kill carriage returns */
685
			for($x=0; $x<count($timezonelist); $x++)
686
				$timezonelist[$x] = str_replace("\n", "", $timezonelist[$x]);
687
688 7a29f783 Ermal Lu?i
			if ($field['displayname']) {
689
                                echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
690 d6f53204 Ermal Lu?i
                                echo $field['displayname'];
691 7a29f783 Ermal Lu?i
                                echo ":</td>\n";
692
			} else if(!$field['dontdisplayname']) {
693 bd31336e Scott Ullrich
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
694
				echo fixup_string($field['name']);
695
				echo ":</td>";
696
			}
697
			if(!$field['dontcombinecells'])
698
				echo "<td class=\"vtable\">";
699 66f773b4 Ermal Lu?i
			echo "<select class='formselect' name='{$name}'>\n";
700 bd31336e Scott Ullrich
			foreach ($timezonelist as $tz) {
701
				$SELECTED = "";
702
				if ($value == $tz) $SELECTED = " SELECTED";
703
				echo "<option value='" . htmlspecialchars($tz) . "' {$SELECTED}>";
704
				echo htmlspecialchars($tz);
705
				echo "</option>\n";
706
			}
707
			echo "</select>\n";
708 66f773b4 Ermal Lu?i
709
			if($field['description'] <> "") {
710
				echo "<br /> " . $field['description'];
711
		    	}
712 b7bb1711 Ermal Lu?i
713
			break;
714
		    case "checkbox":
715 7a29f783 Ermal Lu?i
			if ($field['displayname']) {
716
                                echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
717 d6f53204 Ermal Lu?i
                                echo $field['displayname'];
718 7a29f783 Ermal Lu?i
                                echo ":</td>\n";
719
			} else if(!$field['dontdisplayname']) {
720 34b5c5a0 Scott Ullrich
				echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
721
				echo $field['name'];
722
				echo ":</td>";
723
			}
724
			$checked = "";
725 eb20f3c5 Ermal Lu?i
			if($value <> "")
726
				$checked = " CHECKED";
727 72a5f424 Ermal Lu?i
			echo "<td class=\"vtable\"><input value=\"on\" type='checkbox' id='" . $name . "' name='" . $name . "' " . $checked;
728 b7bb1711 Ermal Lu?i
			if(isset($field['enablefields']) or isset($field['checkenablefields']))
729
				echo " onClick=\"enablechange()\"";
730 1ae55320 Ermal
			else if(isset($field['disablefields']) or isset($field['checkdisablefields']))
731
				echo " onClick=\"disablechange()\"";
732 33a56b27 Colin Smith
			echo ">\n";
733 66f773b4 Ermal Lu?i
734
			if($field['description'] <> "") {
735
				echo $field['description'];
736
		    	}
737 b7bb1711 Ermal Lu?i
738
			break;
739 34b5c5a0 Scott Ullrich
		    }
740
741
		    if($field['typehint'] <> "") {
742
			echo $field['typehint'];
743 2fbd6806 Scott Ullrich
		    }
744 f3c6fdc0 Bill Marquette
		    if($field['warning'] <> "") {
745 b7bb1711 Ermal Lu?i
			echo "<br ><b><font color=\"red\">" . $field['warning'] . "</font></b>";
746 f3c6fdc0 Bill Marquette
		    }
747
748 8984dc5e Ermal
		    if(!$field['combinefieldsbegin']) {
749
		    	if (!$field['dontcombinecells'])
750
		    		echo "</td>";
751
752
			 echo "</tr>\n";
753
		    }
754 1ae55320 Ermal
755 34b5c5a0 Scott Ullrich
		}
756
	}
757
    ?>
758 b7bb1711 Ermal Lu?i
	</table>
759
	</td></tr>
760 658292ef Scott Ullrich
</table>
761 85dc4438 Scott Ullrich
<br>&nbsp;
762 5adb3375 Scott Ullrich
</div>
763 658292ef Scott Ullrich
</form>
764 44c10295 Scott Ullrich
<script type="text/javascript">
765 62a48760 Scott Ullrich
<!--
766
	if (typeof ext_change != 'undefined') {
767
		ext_change();
768
	}
769
	if (typeof proto_change != 'undefined') {
770
		ext_change();
771
	}
772
	if (typeof proto_change != 'undefined') {
773
		proto_change();
774
	}
775 5adb3375 Scott Ullrich
776 62a48760 Scott Ullrich
<?php
777
	$isfirst = 0;
778
	$aliases = "";
779
	$addrisfirst = 0;
780
	$aliasesaddr = "";
781
	if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias']))
782
		foreach($config['aliases']['alias'] as $alias_name) {
783 40050fab Ermal
				if($isfirst == 1)
784
					$aliases .= ",";
785 62a48760 Scott Ullrich
				$aliases .= "'" . $alias_name['name'] . "'";
786
				$isfirst = 1;
787
		}
788
?>
789
790
	var customarray=new Array(<?php echo $aliases; ?>);
791
792 44c10295 Scott Ullrich
	window.onload = function () {
793
794
		<?php
795
			$counter=0;
796
			foreach($inputaliases as $alias) {
797 40050fab Ermal
				echo "var oTextbox$counter = new AutoSuggestControl(document.getElementById(\"$alias\"), new StateSuggestions(customarray));\n";
798 44c10295 Scott Ullrich
				$counter++;
799
			}
800
		?>
801
802
	}
803
804 62a48760 Scott Ullrich
//-->
805
</script>
806 5adb3375 Scott Ullrich
<script type="text/javascript">
807
NiftyCheck();
808 e881d1f3 Scott Ullrich
var bgcolor = document.getElementsByTagName("body")[0].style.backgroundColor;
809
Rounded("div#roundme","all",bgcolor,"#FFFFFF","smooth");
810 1ae55320 Ermal
enablechange();
811
disablechange();
812
showchange();
813 5adb3375 Scott Ullrich
</script>
814
815 34b5c5a0 Scott Ullrich
<?php
816
817
$fieldnames_array = Array();
818
if($pkg['step'][$stepid]['disableallfieldsbydefault'] <> "") {
819
	// create a fieldname loop that can be used with javascript
820
	// hide and enable features.
821 44c10295 Scott Ullrich
	echo "\n<script type=\"text/javascript\">\n";
822 34b5c5a0 Scott Ullrich
	echo "function disableall() {\n";
823
	foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
824
		if($field['type'] <> "submit" and $field['type'] <> "listtopic") {
825
			if(!$field['donotdisable'] <> "") {
826
				array_push($fieldnames_array, $field['name']);
827
				$fieldname = ereg_replace(" ", "", $field['name']);
828
				$fieldname = strtolower($fieldname);
829
				echo "\tdocument.forms[0]." . $fieldname . ".disabled = 1;\n";
830
			}
831
		}
832
	}
833
	echo "}\ndisableall();\n";
834
	echo "function enableitems(selectedindex) {\n";
835
	echo "disableall();\n";
836
	$idcounter = 0;
837
	if($pkg['step'][$stepid]['fields']['field'] <> "") {
838
		echo "\tswitch(selectedindex) {\n";
839
		foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
840
			if($field['options']['option'] <> "") {
841
				foreach ($field['options']['option'] as $opt) {
842
					if($opt['enablefields'] <> "") {
843
						echo "\t\tcase " . $idcounter . ":\n";
844
						$enablefields_split = split(",", $opt['enablefields']);
845
						foreach ($enablefields_split as $efs) {
846
							$fieldname = ereg_replace(" ", "", $efs);
847
							$fieldname = strtolower($fieldname);
848
							if($fieldname <> "") {
849
								$onchange = "\t\t\tdocument.forms[0]." . $fieldname . ".disabled = 0; \n";
850
								echo $onchange;
851
							}
852
						}
853
						echo "\t\t\tbreak;\n";
854
					}
855
					$idcounter = $idcounter + 1;
856
				}
857
			}
858
		}
859
		echo "\t}\n";
860
	}
861
	echo "}\n";
862
	echo "</script>\n\n";
863
}
864
865
866
if($pkg['step'][$stepid]['stepafterformdisplay'] <> "") {
867
	// handle after form display event.
868
	eval($pkg['step'][$stepid]['stepafterformdisplay']);
869
}
870
871
if($pkg['step'][$stepid]['javascriptafterformdisplay'] <> "") {
872
	// handle after form display event.
873 44c10295 Scott Ullrich
        echo "\n<script type=\"text/javascript\">\n";
874 34b5c5a0 Scott Ullrich
	echo $pkg['step'][$stepid]['javascriptafterformdisplay'] . "\n";
875
	echo "</script>\n\n";
876
}
877
878 d51f86e0 Scott Ullrich
/*
879
 *  HELPER FUNCTIONS
880
 */
881
882
function fixup_string($string) {
883 a0190b50 Scott Ullrich
	global $config, $myurl;
884 78818d7a Scott Ullrich
	$newstring = $string;
885 d51f86e0 Scott Ullrich
	// fixup #1: $myurl -> http[s]://ip_address:port/
886 43d9a2d3 jim-p
	switch($config['system']['webgui']['protocol']) {
887 037304d8 Scott Ullrich
		case "http":
888
			$proto = "http";
889
			break;
890
		case "https":
891
			$proto = "https";
892
			break;
893
		default:
894
			$proto = "http";
895
			break;
896
	}
897 43d9a2d3 jim-p
	$port = $config['system']['webgui']['port'];
898 037304d8 Scott Ullrich
	if($port != "") {
899
		if(($port == "443" and $proto != "https") or ($port == "80" and $proto != "http")) {
900
			$urlport = ":" . $port;
901
		} elseif ($port != "80" and $port != "443") {
902
			$urlport = ":" . $port;
903
		} else {
904
			$urlport = "";
905
		}
906
	}
907 39d1c22d sullrich
	$myurl = $proto . "://" . $_SERVER['HTTP_HOST'] . $urlport . "/";
908 d70a5ac6 Ermal Lu?i
909
	if (strstr($newstring, "\$myurl"))
910
		$newstring = str_replace("\$myurl", $myurl, $newstring);
911 d2133701 Scott Ullrich
	// fixup #2: $wanip
912 d70a5ac6 Ermal Lu?i
	if (strstr($newstring, "\$wanip")) {
913
		$curwanip = get_interface_ip();
914
		$newstring = str_replace("\$wanip", $curwanip, $newstring);
915
	}
916 d2133701 Scott Ullrich
	// fixup #3: $lanip
917 d70a5ac6 Ermal Lu?i
	if (strstr($newstring, "\$lanip")) {
918
		$lanip = get_interface_ip("lan");
919
		$newstring = str_replace("\$lanip", $lanip, $newstring);
920
	}
921 d2133701 Scott Ullrich
	// fixup #4: fix'r'up here.
922 d51f86e0 Scott Ullrich
	return $newstring;
923
}
924
925 bd31336e Scott Ullrich
function is_timezone($elt) {
926
	return !preg_match("/\/$/", $elt);
927
}
928 d51f86e0 Scott Ullrich
929 c8000491 Scott Ullrich
?>
930
931
</body>
932
</html>