Project

General

Profile

Download (15.7 KB) Statistics
| Branch: | Tag: | Revision:
1 04ad7c7c Scott Ullrich
<?php
2 5b237745 Scott Ullrich
/*
3
	system.php
4
*/
5 54c605d4 Stephen Beaver
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7 191cb31d Stephen Beaver
 *
8
 *  Some or all of this file is based on the m0n0wall project which is
9
 *  Copyright (c)  2004 Manuel Kasper (BSD 2 clause)
10 54c605d4 Stephen Beaver
 *
11
 *	Redistribution and use in source and binary forms, with or without modification,
12
 *	are permitted provided that the following conditions are met:
13
 *
14
 *	1. Redistributions of source code must retain the above copyright notice,
15
 *		this list of conditions and the following disclaimer.
16
 *
17
 *	2. Redistributions in binary form must reproduce the above copyright
18
 *		notice, this list of conditions and the following disclaimer in
19
 *		the documentation and/or other materials provided with the
20
 *		distribution.
21
 *
22
 *	3. All advertising materials mentioning features or use of this software
23
 *		must display the following acknowledgment:
24
 *		"This product includes software developed by the pfSense Project
25
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
26
 *
27
 *	4. The names "pfSense" and "pfSense Project" must not be used to
28
 *		 endorse or promote products derived from this software without
29
 *		 prior written permission. For written permission, please contact
30
 *		 coreteam@pfsense.org.
31
 *
32
 *	5. Products derived from this software may not be called "pfSense"
33
 *		nor may "pfSense" appear in their names without prior written
34
 *		permission of the Electric Sheep Fencing, LLC.
35
 *
36
 *	6. Redistributions of any form whatsoever must retain the following
37
 *		acknowledgment:
38
 *
39
 *	"This product includes software developed by the pfSense Project
40
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
41
 *
42
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
43
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
45
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
46
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
51
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
54
 *
55
 *	====================================================================
56
 *
57
 */
58 1d333258 Scott Ullrich
/*
59
	pfSense_BUILDER_BINARIES:	/bin/kill	/usr/bin/tar
60 64c3b4cd sbeaver
	pfSense_MODULE: system
61 1d333258 Scott Ullrich
*/
62 5b237745 Scott Ullrich
63 6b07c15a Matthew Grooms
##|+PRIV
64
##|*IDENT=page-system-generalsetup
65
##|*NAME=System: General Setup page
66
##|*DESCR=Allow access to the 'System: General Setup' page.
67
##|*MATCH=system.php*
68
##|-PRIV
69
70 5b237745 Scott Ullrich
require("guiconfig.inc");
71 7a927e67 Scott Ullrich
require_once("functions.inc");
72
require_once("filter.inc");
73
require_once("shaper.inc");
74 60ff91f1 Renato Botelho
require_once("system.inc");
75 5b237745 Scott Ullrich
76
$pconfig['hostname'] = $config['system']['hostname'];
77
$pconfig['domain'] = $config['system']['domain'];
78 2ee8dea1 Phil Davis
list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $config['system']['dnsserver'];
79 0d8a219e Scott Ullrich
80 d623f2da Seth Mos
$arr_gateways = return_gateways_array();
81
82
$pconfig['dns1gw'] = $config['system']['dns1gw'];
83
$pconfig['dns2gw'] = $config['system']['dns2gw'];
84
$pconfig['dns3gw'] = $config['system']['dns3gw'];
85
$pconfig['dns4gw'] = $config['system']['dns4gw'];
86 e180a6e3 Scott Ullrich
87 5b237745 Scott Ullrich
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']);
88
$pconfig['timezone'] = $config['system']['timezone'];
89
$pconfig['timeupdateinterval'] = $config['system']['time-update-interval'];
90
$pconfig['timeservers'] = $config['system']['timeservers'];
91 3e139f90 Vinicius Coque
$pconfig['language'] = $config['system']['language'];
92 5b237745 Scott Ullrich
93 8ca95ed8 jim-p
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
94
95 2ee8dea1 Phil Davis
if (!isset($pconfig['timeupdateinterval'])) {
96 5b237745 Scott Ullrich
	$pconfig['timeupdateinterval'] = 300;
97 2ee8dea1 Phil Davis
}
98
if (!$pconfig['timezone']) {
99 5b237745 Scott Ullrich
	$pconfig['timezone'] = "Etc/UTC";
100 2ee8dea1 Phil Davis
}
101
if (!$pconfig['timeservers']) {
102 5b237745 Scott Ullrich
	$pconfig['timeservers'] = "pool.ntp.org";
103 2ee8dea1 Phil Davis
}
104 04ad7c7c Scott Ullrich
105 79eaddf4 Renato Botelho
$changedesc = gettext("System") . ": ";
106 62d01225 Bill Marquette
$changecount = 0;
107 417c6042 Bill Marquette
108 5b237745 Scott Ullrich
function is_timezone($elt) {
109
	return !preg_match("/\/$/", $elt);
110
}
111
112 2ee8dea1 Phil Davis
if ($pconfig['timezone'] <> $_POST['timezone']) {
113 744306c6 jim-p
	filter_pflog_start(true);
114 aa1ab1da Scott Ullrich
}
115
116 60ff91f1 Renato Botelho
$timezonelist = system_get_timezone_list();
117 5b237745 Scott Ullrich
118 77446beb Matthew Grooms
$multiwan = false;
119 7922db8a Seth Mos
$interfaces = get_configured_interface_list();
120 2ee8dea1 Phil Davis
foreach ($interfaces as $interface) {
121
	if (interface_has_gateway($interface)) {
122 77446beb Matthew Grooms
		$multiwan = true;
123 7922db8a Seth Mos
	}
124
}
125 77446beb Matthew Grooms
126 5b237745 Scott Ullrich
if ($_POST) {
127
128 c668c964 Scott Ullrich
	$changecount++;
129 1180e4f0 Sjon Hortensius
130 5b237745 Scott Ullrich
	unset($input_errors);
131
	$pconfig = $_POST;
132
133
	/* input validation */
134 cfbfd941 smos
	$reqdfields = explode(" ", "hostname domain");
135 2ee8dea1 Phil Davis
	$reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
136 04ad7c7c Scott Ullrich
137 1e9b4611 Renato Botelho
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
138 04ad7c7c Scott Ullrich
139 2d86ee95 Phil Davis
	if ($_POST['hostname']) {
140
		if (!is_hostname($_POST['hostname'])) {
141
			$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
142
		} else {
143
			if (!is_unqualified_hostname($_POST['hostname'])) {
144
				$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
145
			}
146
		}
147 5b237745 Scott Ullrich
	}
148
	if ($_POST['domain'] && !is_domain($_POST['domain'])) {
149 7465d12c Carlos Eduardo Ramos
		$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
150 5b237745 Scott Ullrich
	}
151 d623f2da Seth Mos
152 df4471e2 Phil Davis
	$ignore_posted_dnsgw = array();
153
154 2ee8dea1 Phil Davis
	for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
155 d623f2da Seth Mos
		$dnsname="dns{$dnscounter}";
156
		$dnsgwname="dns{$dnscounter}gw";
157
		if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
158 52acb1ff Phil Davis
			$input_errors[] = gettext("A valid IP address must be specified for DNS server $dnscounter.");
159
		} else {
160 2ee8dea1 Phil Davis
			if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
161 52acb1ff Phil Davis
				// A real gateway has been selected.
162
				if (is_ipaddr($_POST[$dnsname])) {
163 2ee8dea1 Phil Davis
					if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
164 52acb1ff Phil Davis
						$input_errors[] = gettext("You can not specify IPv6 gateway '{$_POST[$dnsgwname]}' for IPv4 DNS server '{$_POST[$dnsname]}'");
165
					}
166 2ee8dea1 Phil Davis
					if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
167 52acb1ff Phil Davis
						$input_errors[] = gettext("You can not specify IPv4 gateway '{$_POST[$dnsgwname]}' for IPv6 DNS server '{$_POST[$dnsname]}'");
168
					}
169
				} else {
170 df4471e2 Phil Davis
					// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
171
					$ignore_posted_dnsgw[$dnsgwname] = true;
172 52acb1ff Phil Davis
				}
173 13ea7caa smos
			}
174 d623f2da Seth Mos
		}
175 5b237745 Scott Ullrich
	}
176 d623f2da Seth Mos
177 985fc0fb Ermal Lu?i
	$direct_networks_list = explode(" ", filter_get_direct_networks_list());
178 c98d28e1 Seth Mos
	for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
179
		$dnsitem = "dns{$dnscounter}";
180 d623f2da Seth Mos
		$dnsgwitem = "dns{$dnscounter}gw";
181 c98d28e1 Seth Mos
		if ($_POST[$dnsgwitem]) {
182 2ee8dea1 Phil Davis
			if (interface_has_gateway($_POST[$dnsgwitem])) {
183
				foreach ($direct_networks_list as $direct_network) {
184
					if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
185
						$input_errors[] = sprintf(gettext("You can not assign a gateway to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
186 c98d28e1 Seth Mos
					}
187
				}
188
			}
189
		}
190
	}
191
192 5b237745 Scott Ullrich
	$t = (int)$_POST['timeupdateinterval'];
193
	if (($t < 0) || (($t > 0) && ($t < 6)) || ($t > 1440)) {
194 7465d12c Carlos Eduardo Ramos
		$input_errors[] = gettext("The time update interval must be either 0 (disabled) or between 6 and 1440.");
195 5b237745 Scott Ullrich
	}
196 8adb814b David P Hilton
	# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
197
	$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
198
	$_POST['timeservers'] = trim($_POST['timeservers']);
199 5b237745 Scott Ullrich
	foreach (explode(' ', $_POST['timeservers']) as $ts) {
200
		if (!is_domain($ts)) {
201 7465d12c Carlos Eduardo Ramos
			$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
202 5b237745 Scott Ullrich
		}
203
	}
204
205
	if (!$input_errors) {
206 f1a34790 N0YB
		update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
207
		update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
208 9eab73da Bill Marquette
		update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
209
		update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
210
		update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']);
211 04ad7c7c Scott Ullrich
212 2ee8dea1 Phil Davis
		if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
213 3e139f90 Vinicius Coque
			$config['system']['language'] = $_POST['language'];
214
			set_language($config['system']['language']);
215
		}
216
217 4fbf63aa Bill Marquette
		/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
218 52acb1ff Phil Davis
		$olddnsservers = $config['system']['dnsserver'];
219 5b237745 Scott Ullrich
		unset($config['system']['dnsserver']);
220 2ee8dea1 Phil Davis
		if ($_POST['dns1']) {
221 5b237745 Scott Ullrich
			$config['system']['dnsserver'][] = $_POST['dns1'];
222 2ee8dea1 Phil Davis
		}
223
		if ($_POST['dns2']) {
224 5b237745 Scott Ullrich
			$config['system']['dnsserver'][] = $_POST['dns2'];
225 2ee8dea1 Phil Davis
		}
226
		if ($_POST['dns3']) {
227 93e0800d Scott Ullrich
			$config['system']['dnsserver'][] = $_POST['dns3'];
228 2ee8dea1 Phil Davis
		}
229
		if ($_POST['dns4']) {
230 93e0800d Scott Ullrich
			$config['system']['dnsserver'][] = $_POST['dns4'];
231 2ee8dea1 Phil Davis
		}
232 04ad7c7c Scott Ullrich
233 07bd3f83 Scott Ullrich
		$olddnsallowoverride = $config['system']['dnsallowoverride'];
234 20b90e0a Scott Ullrich
235 0d8a219e Scott Ullrich
		unset($config['system']['dnsallowoverride']);
236 5b237745 Scott Ullrich
		$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
237 e180a6e3 Scott Ullrich
238 2ee8dea1 Phil Davis
		if ($_POST['dnslocalhost'] == "yes") {
239 8ca95ed8 jim-p
			$config['system']['dnslocalhost'] = true;
240 2ee8dea1 Phil Davis
		} else {
241 8ca95ed8 jim-p
			unset($config['system']['dnslocalhost']);
242 2ee8dea1 Phil Davis
		}
243 8ca95ed8 jim-p
244 e180a6e3 Scott Ullrich
		/* which interface should the dns servers resolve through? */
245 df4471e2 Phil Davis
		$outdnscounter = 0;
246 d623f2da Seth Mos
		for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
247
			$dnsname="dns{$dnscounter}";
248
			$dnsgwname="dns{$dnscounter}gw";
249 52acb1ff Phil Davis
			$olddnsgwname = $config['system'][$dnsgwname];
250 df4471e2 Phil Davis
251 2ee8dea1 Phil Davis
			if ($ignore_posted_dnsgw[$dnsgwname]) {
252 df4471e2 Phil Davis
				$thisdnsgwname = "none";
253 2ee8dea1 Phil Davis
			} else {
254 df4471e2 Phil Davis
				$thisdnsgwname = $pconfig[$dnsgwname];
255 2ee8dea1 Phil Davis
			}
256 df4471e2 Phil Davis
257
			// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
258
			$config['system'][$dnsgwname] = "none";
259
			$pconfig[$dnsgwname] = "none";
260
			$pconfig[$dnsname] = "";
261
262
			if ($_POST[$dnsname]) {
263
				// Only the non-blank DNS servers were put into the config above.
264
				// So we similarly only add the corresponding gateways sequentially to the config (and to pconfig), as we find non-blank DNS servers.
265
				// This keeps the DNS server IP and corresponding gateway "lined up" when the user blanks out a DNS server IP in the middle of the list.
266
				$outdnscounter++;
267
				$outdnsname="dns{$outdnscounter}";
268
				$outdnsgwname="dns{$outdnscounter}gw";
269
				$pconfig[$outdnsname] = $_POST[$dnsname];
270 2ee8dea1 Phil Davis
				if ($_POST[$dnsgwname]) {
271 df4471e2 Phil Davis
					$config['system'][$outdnsgwname] = $thisdnsgwname;
272
					$pconfig[$outdnsgwname] = $thisdnsgwname;
273
				} else {
274
					// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
275
					unset($config['system'][$outdnsgwname]);
276
					$pconfig[$outdnsgwname] = "";
277
				}
278 d623f2da Seth Mos
			}
279 df4471e2 Phil Davis
			if (($olddnsgwname != "") && ($olddnsgwname != "none") && (($olddnsgwname != $thisdnsgwname) || ($olddnsservers[$dnscounter-1] != $_POST[$dnsname]))) {
280 52acb1ff Phil Davis
				// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
281
				// Remove the route. Later calls will add the correct new route if needed.
282 2ee8dea1 Phil Davis
				if (is_ipaddrv4($olddnsservers[$dnscounter-1])) {
283 52acb1ff Phil Davis
					mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter-1]));
284 2ee8dea1 Phil Davis
				} else {
285
					if (is_ipaddrv6($olddnsservers[$dnscounter-1])) {
286 52acb1ff Phil Davis
						mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter-1]));
287 2ee8dea1 Phil Davis
					}
288
				}
289 52acb1ff Phil Davis
			}
290 d623f2da Seth Mos
		}
291 04ad7c7c Scott Ullrich
292 2ee8dea1 Phil Davis
		if ($changecount > 0) {
293 62d01225 Bill Marquette
			write_config($changedesc);
294 2ee8dea1 Phil Davis
		}
295 04ad7c7c Scott Ullrich
296 5b237745 Scott Ullrich
		$retval = 0;
297 3cfdba5f Scott Ullrich
		$retval = system_hostname_configure();
298
		$retval |= system_hosts_generate();
299
		$retval |= system_resolvconf_generate();
300 2ee8dea1 Phil Davis
		if (isset($config['dnsmasq']['enable'])) {
301 1e2c8821 Warren Baker
			$retval |= services_dnsmasq_configure();
302 2ee8dea1 Phil Davis
		} elseif (isset($config['unbound']['enable'])) {
303 1e2c8821 Warren Baker
			$retval |= services_unbound_configure();
304 2ee8dea1 Phil Davis
		}
305 3cfdba5f Scott Ullrich
		$retval |= system_timezone_configure();
306
		$retval |= system_ntp_configure();
307
308 2ee8dea1 Phil Davis
		if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
309 b8292903 Ermal
			$retval |= send_event("service reload dns");
310 2ee8dea1 Phil Davis
		}
311 3cfdba5f Scott Ullrich
312 e7d967d8 Scott Ullrich
		// Reload the filter - plugins might need to be run.
313 0027de0a Ermal Lu?i
		$retval |= filter_configure();
314 1180e4f0 Sjon Hortensius
315 5b237745 Scott Ullrich
		$savemsg = get_std_save_message($retval);
316
	}
317 df4471e2 Phil Davis
318
	unset($ignore_posted_dnsgw);
319 5b237745 Scott Ullrich
}
320 4df96eff Scott Ullrich
321 2ee8dea1 Phil Davis
$pgtitle = array(gettext("System"), gettext("General Setup"));
322 4df96eff Scott Ullrich
include("head.inc");
323
324 41ea4cf3 Sjon Hortensius
if ($input_errors)
325
	print_input_errors($input_errors);
326
if ($savemsg)
327
	print_info_box($savemsg);
328 5b237745 Scott Ullrich
?>
329 41ea4cf3 Sjon Hortensius
<div id="container">
330 b40bcb23 Sjon Hortensius
<?php
331 1180e4f0 Sjon Hortensius
332 ad2879b8 PiBa-NL
require_once('classes/Form.class.php');
333 b40bcb23 Sjon Hortensius
$form = new Form;
334 a32c0623 Sjon Hortensius
$section = new Form_Section('System');
335
$section->addInput(new Form_Input(
336 a97531c5 Sjon Hortensius
	'hostname',
337 a32c0623 Sjon Hortensius
	'Hostname',
338
	'text',
339
	$pconfig['hostname'],
340
	['placeholder' => 'pfSense']
341
))->setHelp('Name of the firewall host, without domain part');
342
$section->addInput(new Form_Input(
343 a97531c5 Sjon Hortensius
	'domain',
344 a32c0623 Sjon Hortensius
	'Domain',
345
	'text',
346
	$pconfig['domain'],
347
	['placeholder' => 'mycorp.com, home, office, private, etc.']
348
))->setHelp('Do not use \'local\' as a domain name. It will cause local '.
349
	'hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve '.
350
	'local hosts not running mDNS.');
351 b40bcb23 Sjon Hortensius
$form->add($section);
352
353 a005a836 Sjon Hortensius
$section = new Form_Section('DNS server settings');
354 b40bcb23 Sjon Hortensius
355
for ($i=1; $i<5; $i++)
356
{
357 54c605d4 Stephen Beaver
//	if (!isset($pconfig['dns'.$i]))
358
//		continue;
359
360
	$group = new Form_Group('DNS Server ' . $i);
361
362
	$group->add(new Form_Input(
363 c52e1c1f Stephen Beaver
		'dns' . $i,
364 54c605d4 Stephen Beaver
		'DNS Server',
365
		'text',
366 c52e1c1f Stephen Beaver
		$pconfig['dns'. $i]
367 54c605d4 Stephen Beaver
	))->setHelp(($i == 4) ? 'Address':null);
368 b40bcb23 Sjon Hortensius
369
	$help = "Enter IP addresses to be used by the system for DNS resolution. " .
370
		"These are also used for the DHCP service, DNS forwarder and for PPTP VPN clients.";
371
372 54c605d4 Stephen Beaver
	if ($multiwan)	{
373 b40bcb23 Sjon Hortensius
		$options = array('none' => 'none');
374
375 54c605d4 Stephen Beaver
		foreach($arr_gateways as $gwname => $gwitem) {
376 b40bcb23 Sjon Hortensius
			if((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
377
				continue;
378
			}
379 54c605d4 Stephen Beaver
380 b40bcb23 Sjon Hortensius
			if((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
381
				continue;
382
			}
383 1180e4f0 Sjon Hortensius
384 b40bcb23 Sjon Hortensius
			$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
385
		}
386 1180e4f0 Sjon Hortensius
387 a97531c5 Sjon Hortensius
		$group->add(new Form_Select(
388 c52e1c1f Stephen Beaver
			'dns' . $i . 'gw',
389 a97531c5 Sjon Hortensius
			'Gateway',
390 c52e1c1f Stephen Beaver
			$pconfig['dns' . $i . 'gw'],
391 a97531c5 Sjon Hortensius
			$options
392 54c605d4 Stephen Beaver
		))->setHelp(($i == 4) ? 'Gateway':null);;
393 1180e4f0 Sjon Hortensius
394 b40bcb23 Sjon Hortensius
		$help .= '<br/>'. "In addition, optionally select the gateway for each DNS server. " .
395
			"When using multiple WAN connections there should be at least one unique DNS server per gateway.";
396
	}
397 1180e4f0 Sjon Hortensius
398 54c605d4 Stephen Beaver
	if($i == 4)
399
		$group->setHelp($help);
400
401 b40bcb23 Sjon Hortensius
	$section->add($group);
402
}
403 1180e4f0 Sjon Hortensius
404 a005a836 Sjon Hortensius
$section->addInput(new Form_Checkbox(
405 a97531c5 Sjon Hortensius
	'dnsallowoverride',
406 b40bcb23 Sjon Hortensius
	'DNS server override',
407
	'Allow DNS server list to be overridden by DHCP/PPP on WAN',
408
	$pconfig['dnsallowoverride']
409 a32c0623 Sjon Hortensius
))->setHelp(sprintf(gettext('If this option is set, %s will use DNS servers'.
410
	'assigned by a DHCP/PPP server on WAN for its own purposes (including '.
411
	'the DNS forwarder). However, they will not be assigned to DHCP and PPTP '.
412
	'VPN clients.'), $g['product_name']));
413 b40bcb23 Sjon Hortensius
414 a005a836 Sjon Hortensius
$section->addInput(new Form_Checkbox(
415 a97531c5 Sjon Hortensius
	'dnslocalhost',
416 b40bcb23 Sjon Hortensius
	'Disable DNS forwarder',
417
	'Do not use the DNS Forwarder as a DNS server for the firewall',
418
	$pconfig['dnslocalhost']
419 a32c0623 Sjon Hortensius
))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS'.
420
	'server where the DNS Forwarder or DNS Resolver is enabled and set to '.
421
	'listen on Localhost, so system can use the local DNS service to perform'.
422
	'lookups. Checking this box omits localhost from the list of DNS servers.');
423 b40bcb23 Sjon Hortensius
424
$form->add($section);
425
426 a005a836 Sjon Hortensius
$section = new Form_Section('Localization');
427
$section->addInput(new Form_Select(
428 a97531c5 Sjon Hortensius
	'timezone',
429 a32c0623 Sjon Hortensius
	'Timezone',
430
	$pconfig['timezone'],
431 64c3b4cd sbeaver
	array_combine($timezonelist, $timezonelist)
432 a32c0623 Sjon Hortensius
))->setHelp('Select the location closest to you');
433 a005a836 Sjon Hortensius
$section->addInput(new Form_Input(
434 a97531c5 Sjon Hortensius
	'timeservers',
435 a32c0623 Sjon Hortensius
	'Timeservers',
436
	'text',
437
	$pconfig['timeservers']
438
))->setHelp('Use a space to separate multiple hosts (only one required). '.
439
	'Remember to set up at least one DNS server if you enter a host name here!');
440 a005a836 Sjon Hortensius
$section->addInput(new Form_Select(
441 a97531c5 Sjon Hortensius
	'language',
442 a32c0623 Sjon Hortensius
	'Language',
443
	$pconfig['language'],
444
	get_locale_list()
445
))->setHelp('Choose a language for the webConfigurator');
446 b40bcb23 Sjon Hortensius
447
$form->add($section);
448
449
print $form;
450 69f9ff40 Sjon Hortensius
451 60ff91f1 Renato Botelho
include("foot.inc");