Project

General

Profile

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