Project

General

Profile

Download (23.5 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * system.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * originally based on m0n0wall (http://m0n0.ch/wall)
10
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
 * All rights reserved.
12
 *
13
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions are met:
15
 *
16
 * 1. Redistributions of source code must retain the above copyright notice,
17
 *    this list of conditions and the following disclaimer.
18
 *
19
 * 2. Redistributions in binary form must reproduce the above copyright
20
 *    notice, this list of conditions and the following disclaimer in
21
 *    the documentation and/or other materials provided with the
22
 *    distribution.
23
 *
24
 * 3. All advertising materials mentioning features or use of this software
25
 *    must display the following acknowledgment:
26
 *    "This product includes software developed by the pfSense Project
27
 *    for use in the pfSense® software distribution. (http://www.pfsense.org/).
28
 *
29
 * 4. The names "pfSense" and "pfSense Project" must not be used to
30
 *    endorse or promote products derived from this software without
31
 *    prior written permission. For written permission, please contact
32
 *    coreteam@pfsense.org.
33
 *
34
 * 5. Products derived from this software may not be called "pfSense"
35
 *    nor may "pfSense" appear in their names without prior written
36
 *    permission of the Electric Sheep Fencing, LLC.
37
 *
38
 * 6. Redistributions of any form whatsoever must retain the following
39
 *    acknowledgment:
40
 *
41
 * "This product includes software developed by the pfSense Project
42
 * for use in the pfSense software distribution (http://www.pfsense.org/).
43
 *
44
 * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
45
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
48
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
55
 * OF THE POSSIBILITY OF SUCH DAMAGE.
56
 */
57

    
58
##|+PRIV
59
##|*IDENT=page-system-generalsetup
60
##|*NAME=System: General Setup
61
##|*DESCR=Allow access to the 'System: General Setup' page.
62
##|*MATCH=system.php*
63
##|-PRIV
64

    
65
require_once("guiconfig.inc");
66
require_once("functions.inc");
67
require_once("filter.inc");
68
require_once("shaper.inc");
69
require_once("system.inc");
70

    
71
$pconfig['hostname'] = $config['system']['hostname'];
72
$pconfig['domain'] = $config['system']['domain'];
73
$pconfig['dnsserver'] = $config['system']['dnsserver'];
74

    
75
$arr_gateways = return_gateways_array();
76

    
77
// set default columns to two if unset
78
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
79
	$config['system']['webgui']['dashboardcolumns'] = 2;
80
}
81

    
82
// set default language if unset
83
if (!isset($config['system']['language'])) {
84
	$config['system']['language'] = $g['language'];
85
}
86

    
87
$dnsgw_counter = 1;
88

    
89
while (isset($config["system"]["dns{$dnsgw_counter}gw"])) {
90
	$pconfig_dnsgw_counter = $dnsgw_counter - 1;
91
	$pconfig["dnsgw{$pconfig_dnsgw_counter}"] = $config["system"]["dns{$dnsgw_counter}gw"];
92
	$dnsgw_counter++;
93
}
94

    
95
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']);
96
$pconfig['timezone'] = $config['system']['timezone'];
97
$pconfig['timeservers'] = $config['system']['timeservers'];
98
$pconfig['language'] = $config['system']['language'];
99
$pconfig['webguicss'] = $config['system']['webgui']['webguicss'];
100
$pconfig['webguifixedmenu'] = $config['system']['webgui']['webguifixedmenu'];
101
$pconfig['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns'];
102
$pconfig['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']);
103
$pconfig['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']);
104
$pconfig['systemlogsfilterpanel'] = isset($config['system']['webgui']['systemlogsfilterpanel']);
105
$pconfig['systemlogsmanagelogpanel'] = isset($config['system']['webgui']['systemlogsmanagelogpanel']);
106
$pconfig['statusmonitoringsettingspanel'] = isset($config['system']['webgui']['statusmonitoringsettingspanel']);
107
$pconfig['webguihostnamemenu'] = $config['system']['webgui']['webguihostnamemenu'];
108
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
109
$pconfig['dashboardperiod'] = isset($config['widgets']['period']) ? $config['widgets']['period']:"10";
110
$pconfig['loginshowhost'] = isset($config['system']['webgui']['loginshowhost']);
111
$pconfig['requirestatefilter'] = isset($config['system']['webgui']['requirestatefilter']);
112

    
113
if (!$pconfig['timezone']) {
114
	if (isset($g['default_timezone']) && !empty($g['default_timezone'])) {
115
		$pconfig['timezone'] = $g['default_timezone'];
116
	} else {
117
		$pconfig['timezone'] = "Etc/UTC";
118
	}
119
}
120

    
121
if (!$pconfig['timeservers']) {
122
	$pconfig['timeservers'] = "pool.ntp.org";
123
}
124

    
125
$changedesc = gettext("System") . ": ";
126
$changecount = 0;
127

    
128
function is_timezone($elt) {
129
	return !preg_match("/\/$/", $elt);
130
}
131

    
132
if ($pconfig['timezone'] <> $_POST['timezone']) {
133
	filter_pflog_start(true);
134
}
135

    
136
$timezonelist = system_get_timezone_list();
137
$timezonedesc = $timezonelist;
138

    
139
/*
140
 * Etc/GMT entries work the opposite way to what people expect.
141
 * Ref: https://github.com/eggert/tz/blob/master/etcetera and Redmine issue 7089
142
 * Add explanatory text to entries like:
143
 * Etc/GMT+1 and Etc/GMT-1
144
 * but not:
145
 * Etc/GMT or Etc/GMT+0
146
 */
147
foreach ($timezonedesc as $idx => $desc) {
148
	if (substr($desc, 0, 7) != "Etc/GMT" || substr($desc, 8, 1) == "0") {
149
		continue;
150
	}
151

    
152
	$direction = substr($desc, 7, 1);
153

    
154
	switch ($direction) {
155
	case '-':
156
		$direction_str = gettext('AHEAD of');
157
		break;
158
	case '+':
159
		$direction_str = gettext('BEHIND');
160
		break;
161
	default:
162
		continue;
163
	}
164

    
165
	$hr_offset = substr($desc, 8);
166
	$timezonedesc[$idx] = $desc . " " .
167
	    sprintf(ngettext('(%1$s hour %2$s GMT)', '(%1$s hours %2$s GMT)', $hr_offset), $hr_offset, $direction_str);
168
}
169

    
170
$multiwan = false;
171
$interfaces = get_configured_interface_list();
172
foreach ($interfaces as $interface) {
173
	if (interface_has_gateway($interface)) {
174
		$multiwan = true;
175
	}
176
}
177

    
178
if ($_POST) {
179

    
180
	$changecount++;
181

    
182
	unset($input_errors);
183
	$pconfig = $_POST;
184

    
185
	/* input validation */
186
	$reqdfields = explode(" ", "hostname domain");
187
	$reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
188

    
189
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
190

    
191
	if ($_POST['dashboardperiod']) {
192
		$config['widgets']['period'] = $_POST['dashboardperiod'];
193
	}
194

    
195
	if ($_POST['webguicss']) {
196
		$config['system']['webgui']['webguicss'] = $_POST['webguicss'];
197
	} else {
198
		unset($config['system']['webgui']['webguicss']);
199
	}
200

    
201
	$config['system']['webgui']['loginshowhost'] = $_POST['loginshowhost'] ? true:false;
202

    
203
	if ($_POST['webguifixedmenu']) {
204
		$config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu'];
205
	} else {
206
		unset($config['system']['webgui']['webguifixedmenu']);
207
	}
208

    
209
	if ($_POST['webguihostnamemenu']) {
210
		$config['system']['webgui']['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
211
	} else {
212
		unset($config['system']['webgui']['webguihostnamemenu']);
213
	}
214

    
215
	if ($_POST['dashboardcolumns']) {
216
		$config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns'];
217
	} else {
218
		unset($config['system']['webgui']['dashboardcolumns']);
219
	}
220

    
221
	$config['system']['webgui']['requirestatefilter'] = $_POST['requirestatefilter'] ? true : false;
222

    
223
	if ($_POST['hostname']) {
224
		if (!is_hostname($_POST['hostname'])) {
225
			$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
226
		} else {
227
			if (!is_unqualified_hostname($_POST['hostname'])) {
228
				$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
229
			}
230
		}
231
	}
232
	if ($_POST['domain'] && !is_domain($_POST['domain'])) {
233
		$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
234
	}
235

    
236
	$dnslist = $ignore_posted_dnsgw = array();
237

    
238
	$dnscounter = 0;
239
	$dnsname = "dns{$dnscounter}";
240

    
241
	while (isset($_POST[$dnsname])) {
242
		$dnsgwname = "dnsgw{$dnscounter}";
243
		$dnslist[] = $_POST[$dnsname];
244

    
245
		if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
246
			$input_errors[] = sprintf(gettext("A valid IP address must be specified for DNS server %s."), $dnscounter+1);
247
		} else {
248
			if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
249
				// A real gateway has been selected.
250
				if (is_ipaddr($_POST[$dnsname])) {
251
					if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
252
						$input_errors[] = sprintf(gettext('The IPv6 gateway "%1$s" can not be specified for IPv4 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
253
					}
254
					if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
255
						$input_errors[] = sprintf(gettext('The IPv4 gateway "%1$s" can not be specified for IPv6 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
256
					}
257
				} else {
258
					// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
259
					$ignore_posted_dnsgw[$dnsgwname] = true;
260
				}
261
			}
262
		}
263
		$dnscounter++;
264
		$dnsname = "dns{$dnscounter}";
265
	}
266

    
267
	if (count(array_filter($dnslist)) != count(array_unique(array_filter($dnslist)))) {
268
		$input_errors[] = gettext('Each configured DNS server must have a unique IP address. Remove the duplicated IP.');
269
	}
270

    
271
	$dnscounter = 0;
272
	$dnsname = "dns{$dnscounter}";
273

    
274
	$direct_networks_list = explode(" ", filter_get_direct_networks_list());
275
	while (isset($_POST[$dnsname])) {
276
		$dnsgwname = "dnsgw{$dnscounter}";
277
		if ($_POST[$dnsgwname] && ($_POST[$dnsgwname] <> "none")) {
278
			foreach ($direct_networks_list as $direct_network) {
279
				if (ip_in_subnet($_POST[$dnsname], $direct_network)) {
280
					$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsname]);
281
				}
282
			}
283
		}
284
		$dnscounter++;
285
		$dnsname = "dns{$dnscounter}";
286
	}
287

    
288
	# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
289
	$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
290
	$_POST['timeservers'] = trim($_POST['timeservers']);
291
	foreach (explode(' ', $_POST['timeservers']) as $ts) {
292
		if (!is_domain($ts)) {
293
			$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
294
		}
295
	}
296

    
297
	if ($input_errors) {
298
		// Put the user-entered list back into place so it will be redisplayed for correction.
299
		$pconfig['dnsserver'] = $dnslist;
300
	} else {
301
		update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
302
		update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
303
		update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
304
		update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
305

    
306
		if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
307
			$config['system']['language'] = $_POST['language'];
308
			set_language();
309
		}
310

    
311
		unset($config['system']['webgui']['webguileftcolumnhyper']);
312
		$config['system']['webgui']['webguileftcolumnhyper'] = $_POST['webguileftcolumnhyper'] ? true : false;
313

    
314
		unset($config['system']['webgui']['dashboardavailablewidgetspanel']);
315
		$config['system']['webgui']['dashboardavailablewidgetspanel'] = $_POST['dashboardavailablewidgetspanel'] ? true : false;
316

    
317
		unset($config['system']['webgui']['systemlogsfilterpanel']);
318
		$config['system']['webgui']['systemlogsfilterpanel'] = $_POST['systemlogsfilterpanel'] ? true : false;
319

    
320
		unset($config['system']['webgui']['systemlogsmanagelogpanel']);
321
		$config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false;
322

    
323
		unset($config['system']['webgui']['statusmonitoringsettingspanel']);
324
		$config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false;
325

    
326
		/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
327
		$olddnsservers = $config['system']['dnsserver'];
328
		unset($config['system']['dnsserver']);
329

    
330
		$dnscounter = 0;
331
		$dnsname = "dns{$dnscounter}";
332

    
333
		while (isset($_POST[$dnsname])) {
334
			if ($_POST[$dnsname]) {
335
				$config['system']['dnsserver'][] = $_POST[$dnsname];
336
			}
337
			$dnscounter++;
338
			$dnsname = "dns{$dnscounter}";
339
		}
340

    
341
		// Remember the new list for display also.
342
		$pconfig['dnsserver'] = $config['system']['dnsserver'];
343

    
344
		$olddnsallowoverride = $config['system']['dnsallowoverride'];
345

    
346
		unset($config['system']['dnsallowoverride']);
347
		$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
348

    
349
		if ($_POST['dnslocalhost'] == "yes") {
350
			$config['system']['dnslocalhost'] = true;
351
		} else {
352
			unset($config['system']['dnslocalhost']);
353
		}
354

    
355
		/* which interface should the dns servers resolve through? */
356
		$dnscounter = 0;
357
		// The $_POST array key of the DNS IP (starts from 0)
358
		$dnsname = "dns{$dnscounter}";
359
		$outdnscounter = 0;
360
		while (isset($_POST[$dnsname])) {
361
			// The $_POST array key of the corresponding gateway (starts from 0)
362
			$dnsgwname = "dnsgw{$dnscounter}";
363
			// The numbering of DNS GW entries in the config starts from 1
364
			$dnsgwconfigcounter = $dnscounter + 1;
365
			// So this is the array key of the DNS GW entry in $config['system']
366
			$dnsgwconfigname = "dns{$dnsgwconfigcounter}gw";
367

    
368
			$olddnsgwname = $config['system'][$dnsgwconfigname];
369

    
370
			if ($ignore_posted_dnsgw[$dnsgwname]) {
371
				$thisdnsgwname = "none";
372
			} else {
373
				$thisdnsgwname = $pconfig[$dnsgwname];
374
			}
375

    
376
			// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
377
			$config['system'][$dnsgwconfigname] = "none";
378
			$pconfig[$dnsgwname] = "none";
379
			$pconfig[$dnsname] = "";
380

    
381
			if ($_POST[$dnsname]) {
382
				// Only the non-blank DNS servers were put into the config above.
383
				// So we similarly only add the corresponding gateways sequentially to the config (and to pconfig), as we find non-blank DNS servers.
384
				// 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.
385

    
386
				// The $pconfig array key of the DNS IP (starts from 0)
387
				$outdnsname = "dns{$outdnscounter}";
388
				// The $pconfig array key of the corresponding gateway (starts from 0)
389
				$outdnsgwname = "dnsgw{$outdnscounter}";
390
				// The numbering of DNS GW entries in the config starts from 1
391
				$outdnsgwconfigcounter = $outdnscounter + 1;
392
				// So this is the array key of the output DNS GW entry in $config['system']
393
				$outdnsgwconfigname = "dns{$outdnsgwconfigcounter}gw";
394

    
395
				$pconfig[$outdnsname] = $_POST[$dnsname];
396
				if ($_POST[$dnsgwname]) {
397
					$config['system'][$outdnsgwconfigname] = $thisdnsgwname;
398
					$pconfig[$outdnsgwname] = $thisdnsgwname;
399
				} else {
400
					// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
401
					unset($config['system'][$outdnsgwconfigname]);
402
					$pconfig[$outdnsgwname] = "";
403
				}
404
				$outdnscounter++;
405
			}
406
			if (($olddnsgwname != "") && ($olddnsgwname != "none") && (($olddnsgwname != $thisdnsgwname) || ($olddnsservers[$dnscounter] != $_POST[$dnsname]))) {
407
				// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
408
				// Remove the route. Later calls will add the correct new route if needed.
409
				if (is_ipaddrv4($olddnsservers[$dnscounter])) {
410
					mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter-1]));
411
				} else if (is_ipaddrv6($olddnsservers[$dnscounter])) {
412
					mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter-1]));
413
				}
414
			}
415

    
416
			$dnscounter++;
417
			// The $_POST array key of the DNS IP (starts from 0)
418
			$dnsname = "dns{$dnscounter}";
419
		}
420

    
421
		if ($changecount > 0) {
422
			write_config($changedesc);
423
		}
424

    
425
		$retval = 0;
426
		$retval = system_hostname_configure();
427
		$retval |= system_hosts_generate();
428
		$retval |= system_resolvconf_generate();
429
		if (isset($config['dnsmasq']['enable'])) {
430
			$retval |= services_dnsmasq_configure();
431
		} elseif (isset($config['unbound']['enable'])) {
432
			$retval |= services_unbound_configure();
433
		}
434
		$retval |= system_timezone_configure();
435
		$retval |= system_ntp_configure();
436

    
437
		if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
438
			$retval |= send_event("service reload dns");
439
		}
440

    
441
		// Reload the filter - plugins might need to be run.
442
		$retval |= filter_configure();
443

    
444
		$savemsg = get_std_save_message($retval);
445
	}
446

    
447
	unset($ignore_posted_dnsgw);
448
}
449

    
450
$pgtitle = array(gettext("System"), gettext("General Setup"));
451
include("head.inc");
452

    
453
if ($input_errors) {
454
	print_input_errors($input_errors);
455
}
456

    
457
if ($savemsg) {
458
	print_info_box($savemsg, 'success');
459
}
460
?>
461
<div id="container">
462
<?php
463

    
464
$form = new Form;
465
$section = new Form_Section('System');
466
$section->addInput(new Form_Input(
467
	'hostname',
468
	'*Hostname',
469
	'text',
470
	$pconfig['hostname'],
471
	['placeholder' => 'pfSense']
472
))->setHelp('Name of the firewall host, without domain part');
473

    
474
$section->addInput(new Form_Input(
475
	'domain',
476
	'*Domain',
477
	'text',
478
	$pconfig['domain'],
479
	['placeholder' => 'mycorp.com, home, office, private, etc.']
480
))->setHelp('Do not use \'.local\' as the final part of the domain (TLD), The \'.local\' domain is <a target="_blank" ' .
481
	'href="https://www.unbound.net/pipermail/unbound-users/2011-March/001735.html")widely used</a> by mDNS (including Avahi), ' .
482
	'Apple OS X (Bonjour/Rendezvous/Airprint/Airplay), and some Windows systems and network devices. These will not network ' .
483
	'correctly if the router uses \'.local\'. Alternatives such as \'.local.lan\' or \'.mylocal\' are safe.');
484

    
485
$form->add($section);
486

    
487
$section = new Form_Section('DNS Server Settings');
488

    
489
if (!is_array($pconfig['dnsserver'])) {
490
	$pconfig['dnsserver'] = array();
491
}
492

    
493
$dnsserver_count = count($pconfig['dnsserver']);
494
$dnsserver_num = 0;
495
$dnsserver_help = gettext("Address") . '<br/>' . gettext("Enter IP addresses to be used by the system for DNS resolution.") . " " .
496
	gettext("These are also used for the DHCP service, DNS Forwarder and DNS Resolver when it has DNS Query Forwarding enabled.");
497
$dnsgw_help = gettext("Gateway") . '<br/>'. gettext("Optionally select the gateway for each DNS server.") . " " .
498
	gettext("When using multiple WAN connections there should be at least one unique DNS server per gateway.");
499

    
500
// If there are no DNS servers, make an empty entry for initial display.
501
if ($dnsserver_count == 0) {
502
	$pconfig['dnsserver'][] = '';
503
}
504

    
505
foreach ($pconfig['dnsserver'] as $dnsserver) {
506

    
507
	$is_last_dnsserver = ($dnsserver_num == $dnsserver_count - 1);
508
	$group = new Form_Group($dnsserver_num == 0 ? 'DNS Servers':'');
509
	$group->addClass('repeatable');
510

    
511
	$group->add(new Form_Input(
512
		'dns' . $dnsserver_num,
513
		'DNS Server',
514
		'text',
515
		$dnsserver
516
	))->setHelp(($is_last_dnsserver) ? $dnsserver_help:null);
517

    
518
	if ($multiwan)	{
519
		$options = array('none' => 'none');
520

    
521
		foreach ($arr_gateways as $gwname => $gwitem) {
522
			if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
523
				continue;
524
			}
525

    
526
			if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
527
				continue;
528
			}
529

    
530
			$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
531
		}
532

    
533
		$group->add(new Form_Select(
534
			'dnsgw' . $dnsserver_num,
535
			'Gateway',
536
			$pconfig['dnsgw' . $dnsserver_num],
537
			$options
538
		))->setHelp(($is_last_dnsserver) ? $dnsgw_help:null);;
539
	}
540

    
541
	$group->add(new Form_Button(
542
		'deleterow' . $dnsserver_num,
543
		'Delete',
544
		null,
545
		'fa-trash'
546
	))->addClass('btn-warning');
547

    
548
	$section->add($group);
549
	$dnsserver_num++;
550
}
551

    
552
$section->addInput(new Form_Button(
553
	'addrow',
554
	'Add DNS Server',
555
	null,
556
	'fa-plus'
557
))->addClass('btn-success addbtn');
558

    
559
$section->addInput(new Form_Checkbox(
560
	'dnsallowoverride',
561
	'DNS Server Override',
562
	'Allow DNS server list to be overridden by DHCP/PPP on WAN',
563
	$pconfig['dnsallowoverride']
564
))->setHelp(sprintf(gettext('If this option is set, %s will use DNS servers '.
565
	'assigned by a DHCP/PPP server on WAN for its own purposes (including '.
566
	'the DNS Forwarder/DNS Resolver). However, they will not be assigned to DHCP '.
567
	'clients.'), $g['product_name']));
568

    
569
$section->addInput(new Form_Checkbox(
570
	'dnslocalhost',
571
	'Disable DNS Forwarder',
572
	'Do not use the DNS Forwarder/DNS Resolver as a DNS server for the firewall',
573
	$pconfig['dnslocalhost']
574
))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS '.
575
	'server where the DNS Forwarder or DNS Resolver is enabled and set to '.
576
	'listen on localhost, so system can use the local DNS service to perform '.
577
	'lookups. Checking this box omits localhost from the list of DNS servers in resolv.conf.');
578

    
579
$form->add($section);
580

    
581
$section = new Form_Section('Localization');
582

    
583
$section->addInput(new Form_Select(
584
	'timezone',
585
	'*Timezone',
586
	$pconfig['timezone'],
587
	array_combine($timezonelist, $timezonedesc)
588
))->setHelp('Select the timezone or location within the timezone to be used by this system. '.
589
	'Usually choose a "Continent/City". Only choose a special or "Etc" entry if you understand why you need to use it.');
590

    
591
$section->addInput(new Form_Input(
592
	'timeservers',
593
	'Timeservers',
594
	'text',
595
	$pconfig['timeservers']
596
))->setHelp('Use a space to separate multiple hosts (only one required). '.
597
	'Remember to set up at least one DNS server if a host name is entered here!');
598

    
599
$section->addInput(new Form_Select(
600
	'language',
601
	'*Language',
602
	$pconfig['language'],
603
	get_locale_list()
604
))->setHelp('Choose a language for the webConfigurator');
605

    
606
$form->add($section);
607

    
608
$section = new Form_Section('webConfigurator');
609

    
610
gen_webguicss_field($section, $pconfig['webguicss']);
611
gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
612
gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
613
gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
614
gen_associatedpanels_fields(
615
	$section,
616
	$pconfig['dashboardavailablewidgetspanel'],
617
	$pconfig['systemlogsfilterpanel'],
618
	$pconfig['systemlogsmanagelogpanel'],
619
	$pconfig['statusmonitoringsettingspanel']);
620
gen_requirestatefilter_field($section, $pconfig['requirestatefilter']);
621
gen_webguileftcolumnhyper_field($section, $pconfig['webguileftcolumnhyper']);
622

    
623
$section->addInput(new Form_Checkbox(
624
	'loginshowhost',
625
	'Login hostname',
626
	'Show hostname on login banner',
627
	$pconfig['loginshowhost']
628
));
629

    
630
$section->addInput(new Form_Input(
631
	'dashboardperiod',
632
	'Dashboard update period',
633
	'number',
634
	$pconfig['dashboardperiod'],
635
	['min' => '5', 'max' => '600']
636
))->setHelp('Time in seconds between dashboard widget updates. Small values cause ' .
637
			'more frequent updates but increase the load on the web server. ' .
638
			'Minimum is 5 seconds, maximum 600 seconds');
639

    
640
$form->add($section);
641

    
642
print $form;
643

    
644
$csswarning = sprintf(gettext("%sUser-created themes are unsupported, use at your own risk."), "<br />");
645

    
646
?>
647
</div>
648

    
649
<script type="text/javascript">
650
//<![CDATA[
651
events.push(function() {
652

    
653
	function setThemeWarning() {
654
		if ($('#webguicss').val().startsWith("pfSense")) {
655
			$('#csstxt').html("").addClass("text-default");
656
		} else {
657
			$('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
658
		}
659
	}
660

    
661
	$('#webguicss').change(function() {
662
		setThemeWarning();
663
	});
664

    
665
	setThemeWarning();
666

    
667
	// Suppress "Delete row" button if there are fewer than two rows
668
	checkLastRow();
669
});
670
//]]>
671
</script>
672

    
673
<?php
674
include("foot.inc");
675
?>
(184-184/225)