Project

General

Profile

Download (21.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
 * Licensed under the Apache License, Version 2.0 (the "License");
14
 * you may not use this file except in compliance with the License.
15
 * You may obtain a copy of the License at
16
 *
17
 * http://www.apache.org/licenses/LICENSE-2.0
18
 *
19
 * Unless required by applicable law or agreed to in writing, software
20
 * distributed under the License is distributed on an "AS IS" BASIS,
21
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
 * See the License for the specific language governing permissions and
23
 * limitations under the License.
24
 */
25

    
26
##|+PRIV
27
##|*IDENT=page-system-generalsetup
28
##|*NAME=System: General Setup
29
##|*DESCR=Allow access to the 'System: General Setup' page.
30
##|*MATCH=system.php*
31
##|-PRIV
32

    
33
require_once("guiconfig.inc");
34
require_once("functions.inc");
35
require_once("filter.inc");
36
require_once("shaper.inc");
37
require_once("system.inc");
38

    
39
$pconfig['hostname'] = $config['system']['hostname'];
40
$pconfig['domain'] = $config['system']['domain'];
41
$pconfig['dnsserver'] = $config['system']['dnsserver'];
42

    
43
$arr_gateways = return_gateways_array();
44

    
45
// set default columns to two if unset
46
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
47
	$config['system']['webgui']['dashboardcolumns'] = 2;
48
}
49

    
50
$dnsgw_counter = 1;
51

    
52
while (isset($config["system"]["dns{$dnsgw_counter}gw"])) {
53
	$pconfig_dnsgw_counter = $dnsgw_counter - 1;
54
	$pconfig["dnsgw{$pconfig_dnsgw_counter}"] = $config["system"]["dns{$dnsgw_counter}gw"];
55
	$dnsgw_counter++;
56
}
57

    
58
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']);
59
$pconfig['timezone'] = $config['system']['timezone'];
60
$pconfig['timeservers'] = $config['system']['timeservers'];
61
$pconfig['language'] = $config['system']['language'];
62
$pconfig['webguicss'] = $config['system']['webgui']['webguicss'];
63
$pconfig['webguifixedmenu'] = $config['system']['webgui']['webguifixedmenu'];
64
$pconfig['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns'];
65
$pconfig['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']);
66
$pconfig['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']);
67
$pconfig['systemlogsfilterpanel'] = isset($config['system']['webgui']['systemlogsfilterpanel']);
68
$pconfig['systemlogsmanagelogpanel'] = isset($config['system']['webgui']['systemlogsmanagelogpanel']);
69
$pconfig['statusmonitoringsettingspanel'] = isset($config['system']['webgui']['statusmonitoringsettingspanel']);
70
$pconfig['webguihostnamemenu'] = $config['system']['webgui']['webguihostnamemenu'];
71
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
72
$pconfig['dashboardperiod'] = isset($config['widgets']['period']) ? $config['widgets']['period']:"10";
73
$pconfig['loginshowhost'] = isset($config['system']['webgui']['loginshowhost']);
74
$pconfig['requirestatefilter'] = isset($config['system']['webgui']['requirestatefilter']);
75

    
76
if (!$pconfig['timezone']) {
77
	if (isset($g['default_timezone']) && !empty($g['default_timezone'])) {
78
		$pconfig['timezone'] = $g['default_timezone'];
79
	} else {
80
		$pconfig['timezone'] = "Etc/UTC";
81
	}
82
}
83

    
84
if (!$pconfig['timeservers']) {
85
	$pconfig['timeservers'] = "pool.ntp.org";
86
}
87

    
88
$changedesc = gettext("System") . ": ";
89
$changecount = 0;
90

    
91
function is_timezone($elt) {
92
	return !preg_match("/\/$/", $elt);
93
}
94

    
95
if ($pconfig['timezone'] <> $_POST['timezone']) {
96
	filter_pflog_start(true);
97
}
98

    
99
$timezonelist = system_get_timezone_list();
100
$timezonedesc = $timezonelist;
101

    
102
/*
103
 * Etc/GMT entries work the opposite way to what people expect.
104
 * Ref: https://github.com/eggert/tz/blob/master/etcetera and Redmine issue 7089
105
 * Add explanatory text to entries like:
106
 * Etc/GMT+1 and Etc/GMT-1
107
 * but not:
108
 * Etc/GMT or Etc/GMT+0
109
 */
110
foreach ($timezonedesc as $idx => $desc) {
111
	if (substr($desc, 0, 7) != "Etc/GMT" || substr($desc, 8, 1) == "0") {
112
		continue;
113
	}
114

    
115
	$direction = substr($desc, 7, 1);
116

    
117
	switch ($direction) {
118
	case '-':
119
		$direction_str = gettext('AHEAD of');
120
		break;
121
	case '+':
122
		$direction_str = gettext('BEHIND');
123
		break;
124
	default:
125
		continue;
126
	}
127

    
128
	$hr_offset = substr($desc, 8);
129
	$timezonedesc[$idx] = $desc . " " .
130
	    sprintf(ngettext('(%1$s hour %2$s GMT)', '(%1$s hours %2$s GMT)', $hr_offset), $hr_offset, $direction_str);
131
}
132

    
133
$multiwan = false;
134
$interfaces = get_configured_interface_list();
135
foreach ($interfaces as $interface) {
136
	if (interface_has_gateway($interface)) {
137
		$multiwan = true;
138
	}
139
}
140

    
141
if ($_POST) {
142

    
143
	$changecount++;
144

    
145
	unset($input_errors);
146
	$pconfig = $_POST;
147

    
148
	/* input validation */
149
	$reqdfields = explode(" ", "hostname domain");
150
	$reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
151

    
152
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
153

    
154
	if ($_POST['dashboardperiod']) {
155
		$config['widgets']['period'] = $_POST['dashboardperiod'];
156
	}
157

    
158
	if ($_POST['webguicss']) {
159
		$config['system']['webgui']['webguicss'] = $_POST['webguicss'];
160
	} else {
161
		unset($config['system']['webgui']['webguicss']);
162
	}
163

    
164
	$config['system']['webgui']['loginshowhost'] = $_POST['loginshowhost'] ? true:false;
165

    
166
	if ($_POST['webguifixedmenu']) {
167
		$config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu'];
168
	} else {
169
		unset($config['system']['webgui']['webguifixedmenu']);
170
	}
171

    
172
	if ($_POST['webguihostnamemenu']) {
173
		$config['system']['webgui']['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
174
	} else {
175
		unset($config['system']['webgui']['webguihostnamemenu']);
176
	}
177

    
178
	if ($_POST['dashboardcolumns']) {
179
		$config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns'];
180
	} else {
181
		unset($config['system']['webgui']['dashboardcolumns']);
182
	}
183

    
184
	$config['system']['webgui']['requirestatefilter'] = $_POST['requirestatefilter'] ? true : false;
185

    
186
	if ($_POST['hostname']) {
187
		if (!is_hostname($_POST['hostname'])) {
188
			$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
189
		} else {
190
			if (!is_unqualified_hostname($_POST['hostname'])) {
191
				$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
192
			}
193
		}
194
	}
195
	if ($_POST['domain'] && !is_domain($_POST['domain'])) {
196
		$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
197
	}
198

    
199
	$dnslist = $ignore_posted_dnsgw = array();
200

    
201
	$dnscounter = 0;
202
	$dnsname = "dns{$dnscounter}";
203

    
204
	while (isset($_POST[$dnsname])) {
205
		$dnsgwname = "dnsgw{$dnscounter}";
206
		$dnslist[] = $_POST[$dnsname];
207

    
208
		if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
209
			$input_errors[] = sprintf(gettext("A valid IP address must be specified for DNS server %s."), $dnscounter+1);
210
		} else {
211
			if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
212
				// A real gateway has been selected.
213
				if (is_ipaddr($_POST[$dnsname])) {
214
					if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
215
						$input_errors[] = sprintf(gettext('The IPv6 gateway "%1$s" can not be specified for IPv4 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
216
					}
217
					if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
218
						$input_errors[] = sprintf(gettext('The IPv4 gateway "%1$s" can not be specified for IPv6 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
219
					}
220
				} else {
221
					// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
222
					$ignore_posted_dnsgw[$dnsgwname] = true;
223
				}
224
			}
225
		}
226
		$dnscounter++;
227
		$dnsname = "dns{$dnscounter}";
228
	}
229

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

    
234
	$dnscounter = 0;
235
	$dnsname = "dns{$dnscounter}";
236

    
237
	$direct_networks_list = explode(" ", filter_get_direct_networks_list());
238
	while (isset($_POST[$dnsname])) {
239
		$dnsgwname = "dnsgw{$dnscounter}";
240
		if ($_POST[$dnsgwname] && ($_POST[$dnsgwname] <> "none")) {
241
			foreach ($direct_networks_list as $direct_network) {
242
				if (ip_in_subnet($_POST[$dnsname], $direct_network)) {
243
					$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsname]);
244
				}
245
			}
246
		}
247
		$dnscounter++;
248
		$dnsname = "dns{$dnscounter}";
249
	}
250

    
251
	# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
252
	$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
253
	$_POST['timeservers'] = trim($_POST['timeservers']);
254
	foreach (explode(' ', $_POST['timeservers']) as $ts) {
255
		if (!is_domain($ts)) {
256
			$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
257
		}
258
	}
259

    
260
	if ($input_errors) {
261
		// Put the user-entered list back into place so it will be redisplayed for correction.
262
		$pconfig['dnsserver'] = $dnslist;
263
	} else {
264
		update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
265
		update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
266
		update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
267
		update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
268

    
269
		if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
270
			$config['system']['language'] = $_POST['language'];
271
			set_language();
272
		}
273

    
274
		unset($config['system']['webgui']['webguileftcolumnhyper']);
275
		$config['system']['webgui']['webguileftcolumnhyper'] = $_POST['webguileftcolumnhyper'] ? true : false;
276

    
277
		unset($config['system']['webgui']['dashboardavailablewidgetspanel']);
278
		$config['system']['webgui']['dashboardavailablewidgetspanel'] = $_POST['dashboardavailablewidgetspanel'] ? true : false;
279

    
280
		unset($config['system']['webgui']['systemlogsfilterpanel']);
281
		$config['system']['webgui']['systemlogsfilterpanel'] = $_POST['systemlogsfilterpanel'] ? true : false;
282

    
283
		unset($config['system']['webgui']['systemlogsmanagelogpanel']);
284
		$config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false;
285

    
286
		unset($config['system']['webgui']['statusmonitoringsettingspanel']);
287
		$config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false;
288

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

    
293
		$dnscounter = 0;
294
		$dnsname = "dns{$dnscounter}";
295

    
296
		while (isset($_POST[$dnsname])) {
297
			if ($_POST[$dnsname]) {
298
				$config['system']['dnsserver'][] = $_POST[$dnsname];
299
			}
300
			$dnscounter++;
301
			$dnsname = "dns{$dnscounter}";
302
		}
303

    
304
		// Remember the new list for display also.
305
		$pconfig['dnsserver'] = $config['system']['dnsserver'];
306

    
307
		$olddnsallowoverride = $config['system']['dnsallowoverride'];
308

    
309
		unset($config['system']['dnsallowoverride']);
310
		$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
311

    
312
		if ($_POST['dnslocalhost'] == "yes") {
313
			$config['system']['dnslocalhost'] = true;
314
		} else {
315
			unset($config['system']['dnslocalhost']);
316
		}
317

    
318
		/* which interface should the dns servers resolve through? */
319
		$dnscounter = 0;
320
		// The $_POST array key of the DNS IP (starts from 0)
321
		$dnsname = "dns{$dnscounter}";
322
		$outdnscounter = 0;
323
		while (isset($_POST[$dnsname])) {
324
			// The $_POST array key of the corresponding gateway (starts from 0)
325
			$dnsgwname = "dnsgw{$dnscounter}";
326
			// The numbering of DNS GW entries in the config starts from 1
327
			$dnsgwconfigcounter = $dnscounter + 1;
328
			// So this is the array key of the DNS GW entry in $config['system']
329
			$dnsgwconfigname = "dns{$dnsgwconfigcounter}gw";
330

    
331
			$olddnsgwname = $config['system'][$dnsgwconfigname];
332

    
333
			if ($ignore_posted_dnsgw[$dnsgwname]) {
334
				$thisdnsgwname = "none";
335
			} else {
336
				$thisdnsgwname = $pconfig[$dnsgwname];
337
			}
338

    
339
			// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
340
			$config['system'][$dnsgwconfigname] = "none";
341
			$pconfig[$dnsgwname] = "none";
342
			$pconfig[$dnsname] = "";
343

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

    
349
				// The $pconfig array key of the DNS IP (starts from 0)
350
				$outdnsname = "dns{$outdnscounter}";
351
				// The $pconfig array key of the corresponding gateway (starts from 0)
352
				$outdnsgwname = "dnsgw{$outdnscounter}";
353
				// The numbering of DNS GW entries in the config starts from 1
354
				$outdnsgwconfigcounter = $outdnscounter + 1;
355
				// So this is the array key of the output DNS GW entry in $config['system']
356
				$outdnsgwconfigname = "dns{$outdnsgwconfigcounter}gw";
357

    
358
				$pconfig[$outdnsname] = $_POST[$dnsname];
359
				if ($_POST[$dnsgwname]) {
360
					$config['system'][$outdnsgwconfigname] = $thisdnsgwname;
361
					$pconfig[$outdnsgwname] = $thisdnsgwname;
362
				} else {
363
					// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
364
					unset($config['system'][$outdnsgwconfigname]);
365
					$pconfig[$outdnsgwname] = "";
366
				}
367
				$outdnscounter++;
368
			}
369
			if (($olddnsgwname != "") && ($olddnsgwname != "none") && (($olddnsgwname != $thisdnsgwname) || ($olddnsservers[$dnscounter] != $_POST[$dnsname]))) {
370
				// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
371
				// Remove the route. Later calls will add the correct new route if needed.
372
				if (is_ipaddrv4($olddnsservers[$dnscounter])) {
373
					mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter-1]));
374
				} else if (is_ipaddrv6($olddnsservers[$dnscounter])) {
375
					mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter-1]));
376
				}
377
			}
378

    
379
			$dnscounter++;
380
			// The $_POST array key of the DNS IP (starts from 0)
381
			$dnsname = "dns{$dnscounter}";
382
		}
383

    
384
		if ($changecount > 0) {
385
			write_config($changedesc);
386
		}
387

    
388
		$changes_applied = true;
389
		$retval = 0;
390
		$retval |= system_hostname_configure();
391
		$retval |= system_hosts_generate();
392
		$retval |= system_resolvconf_generate();
393
		if (isset($config['dnsmasq']['enable'])) {
394
			$retval |= services_dnsmasq_configure();
395
		} elseif (isset($config['unbound']['enable'])) {
396
			$retval |= services_unbound_configure();
397
		}
398
		$retval |= system_timezone_configure();
399
		$retval |= system_ntp_configure();
400

    
401
		if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
402
			$retval |= send_event("service reload dns");
403
		}
404

    
405
		// Reload the filter - plugins might need to be run.
406
		$retval |= filter_configure();
407
	}
408

    
409
	unset($ignore_posted_dnsgw);
410
}
411

    
412
$pgtitle = array(gettext("System"), gettext("General Setup"));
413
include("head.inc");
414

    
415
if ($input_errors) {
416
	print_input_errors($input_errors);
417
}
418

    
419
if ($changes_applied) {
420
	print_apply_result_box($retval);
421
}
422
?>
423
<div id="container">
424
<?php
425

    
426
$form = new Form;
427
$section = new Form_Section('System');
428
$section->addInput(new Form_Input(
429
	'hostname',
430
	'*Hostname',
431
	'text',
432
	$pconfig['hostname'],
433
	['placeholder' => 'pfSense']
434
))->setHelp('Name of the firewall host, without domain part');
435

    
436
$section->addInput(new Form_Input(
437
	'domain',
438
	'*Domain',
439
	'text',
440
	$pconfig['domain'],
441
	['placeholder' => 'mycorp.com, home, office, private, etc.']
442
))->setHelp('Do not use \'local\' as a domain name. It will cause local '.
443
	'hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve '.
444
	'local hosts not running mDNS.');
445

    
446
$form->add($section);
447

    
448
$section = new Form_Section('DNS Server Settings');
449

    
450
if (!is_array($pconfig['dnsserver'])) {
451
	$pconfig['dnsserver'] = array();
452
}
453

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

    
461
// If there are no DNS servers, make an empty entry for initial display.
462
if ($dnsserver_count == 0) {
463
	$pconfig['dnsserver'][] = '';
464
}
465

    
466
foreach ($pconfig['dnsserver'] as $dnsserver) {
467

    
468
	$is_last_dnsserver = ($dnsserver_num == $dnsserver_count - 1);
469
	$group = new Form_Group($dnsserver_num == 0 ? 'DNS Servers':'');
470
	$group->addClass('repeatable');
471

    
472
	$group->add(new Form_Input(
473
		'dns' . $dnsserver_num,
474
		'DNS Server',
475
		'text',
476
		$dnsserver
477
	))->setHelp(($is_last_dnsserver) ? $dnsserver_help:null);
478

    
479
	if ($multiwan)	{
480
		$options = array('none' => 'none');
481

    
482
		foreach ($arr_gateways as $gwname => $gwitem) {
483
			if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
484
				continue;
485
			}
486

    
487
			if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
488
				continue;
489
			}
490

    
491
			$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
492
		}
493

    
494
		$group->add(new Form_Select(
495
			'dnsgw' . $dnsserver_num,
496
			'Gateway',
497
			$pconfig['dnsgw' . $dnsserver_num],
498
			$options
499
		))->setHelp(($is_last_dnsserver) ? $dnsgw_help:null);;
500
	}
501

    
502
	$group->add(new Form_Button(
503
		'deleterow' . $dnsserver_num,
504
		'Delete',
505
		null,
506
		'fa-trash'
507
	))->addClass('btn-warning');
508

    
509
	$section->add($group);
510
	$dnsserver_num++;
511
}
512

    
513
$section->addInput(new Form_Button(
514
	'addrow',
515
	'Add DNS Server',
516
	null,
517
	'fa-plus'
518
))->addClass('btn-success addbtn');
519

    
520
$section->addInput(new Form_Checkbox(
521
	'dnsallowoverride',
522
	'DNS Server Override',
523
	'Allow DNS server list to be overridden by DHCP/PPP on WAN',
524
	$pconfig['dnsallowoverride']
525
))->setHelp('If this option is set, %s will use DNS servers '.
526
	'assigned by a DHCP/PPP server on WAN for its own purposes (including '.
527
	'the DNS Forwarder/DNS Resolver). However, they will not be assigned to DHCP '.
528
	'clients.', $g['product_name']);
529

    
530
$section->addInput(new Form_Checkbox(
531
	'dnslocalhost',
532
	'Disable DNS Forwarder',
533
	'Do not use the DNS Forwarder/DNS Resolver as a DNS server for the firewall',
534
	$pconfig['dnslocalhost']
535
))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS '.
536
	'server where the DNS Forwarder or DNS Resolver is enabled and set to '.
537
	'listen on localhost, so system can use the local DNS service to perform '.
538
	'lookups. Checking this box omits localhost from the list of DNS servers in resolv.conf.');
539

    
540
$form->add($section);
541

    
542
$section = new Form_Section('Localization');
543

    
544
$section->addInput(new Form_Select(
545
	'timezone',
546
	'*Timezone',
547
	$pconfig['timezone'],
548
	array_combine($timezonelist, $timezonedesc)
549
))->setHelp('Select a geographic region name (Continent/Location) to determine the timezone for the firewall. %1$s' .
550
	'Choose a special or "Etc" zone only in cases where the geographic zones do not properly handle the clock offset required for this firewall.', '<br/>');
551

    
552
$section->addInput(new Form_Input(
553
	'timeservers',
554
	'Timeservers',
555
	'text',
556
	$pconfig['timeservers']
557
))->setHelp('Use a space to separate multiple hosts (only one required). '.
558
	'Remember to set up at least one DNS server if a host name is entered here!');
559

    
560
$section->addInput(new Form_Select(
561
	'language',
562
	'*Language',
563
	$pconfig['language'],
564
	get_locale_list()
565
))->setHelp('Choose a language for the webConfigurator');
566

    
567
$form->add($section);
568

    
569
$section = new Form_Section('webConfigurator');
570

    
571
gen_webguicss_field($section, $pconfig['webguicss']);
572
gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
573
gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
574
gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
575
gen_associatedpanels_fields(
576
	$section,
577
	$pconfig['dashboardavailablewidgetspanel'],
578
	$pconfig['systemlogsfilterpanel'],
579
	$pconfig['systemlogsmanagelogpanel'],
580
	$pconfig['statusmonitoringsettingspanel']);
581
gen_requirestatefilter_field($section, $pconfig['requirestatefilter']);
582
gen_webguileftcolumnhyper_field($section, $pconfig['webguileftcolumnhyper']);
583

    
584
$section->addInput(new Form_Checkbox(
585
	'loginshowhost',
586
	'Login hostname',
587
	'Show hostname on login banner',
588
	$pconfig['loginshowhost']
589
));
590

    
591
$section->addInput(new Form_Input(
592
	'dashboardperiod',
593
	'Dashboard update period',
594
	'number',
595
	$pconfig['dashboardperiod'],
596
	['min' => '5', 'max' => '600']
597
))->setHelp('Time in seconds between dashboard widget updates. Small values cause ' .
598
			'more frequent updates but increase the load on the web server. ' .
599
			'Minimum is 5 seconds, maximum 600 seconds');
600

    
601
$form->add($section);
602

    
603
print $form;
604

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

    
607
?>
608
</div>
609

    
610
<script type="text/javascript">
611
//<![CDATA[
612
events.push(function() {
613

    
614
	function setThemeWarning() {
615
		if ($('#webguicss').val().startsWith("pfSense")) {
616
			$('#csstxt').html("").addClass("text-default");
617
		} else {
618
			$('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
619
		}
620
	}
621

    
622
	$('#webguicss').change(function() {
623
		setThemeWarning();
624
	});
625

    
626
	setThemeWarning();
627

    
628
	// Suppress "Delete row" button if there are fewer than two rows
629
	checkLastRow();
630
});
631
//]]>
632
</script>
633

    
634
<?php
635
include("foot.inc");
636
?>
(182-182/223)