Project

General

Profile

Download (21 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
list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $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
$pconfig['dns1gw'] = $config['system']['dns1gw'];
83
$pconfig['dns2gw'] = $config['system']['dns2gw'];
84
$pconfig['dns3gw'] = $config['system']['dns3gw'];
85
$pconfig['dns4gw'] = $config['system']['dns4gw'];
86

    
87
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']);
88
$pconfig['timezone'] = $config['system']['timezone'];
89
$pconfig['timeservers'] = $config['system']['timeservers'];
90
$pconfig['language'] = $config['system']['language'];
91
$pconfig['webguicss'] = $config['system']['webgui']['webguicss'];
92
$pconfig['webguifixedmenu'] = $config['system']['webgui']['webguifixedmenu'];
93
$pconfig['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns'];
94
$pconfig['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']);
95
$pconfig['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']);
96
$pconfig['systemlogsfilterpanel'] = isset($config['system']['webgui']['systemlogsfilterpanel']);
97
$pconfig['systemlogsmanagelogpanel'] = isset($config['system']['webgui']['systemlogsmanagelogpanel']);
98
$pconfig['statusmonitoringsettingspanel'] = isset($config['system']['webgui']['statusmonitoringsettingspanel']);
99
$pconfig['webguihostnamemenu'] = $config['system']['webgui']['webguihostnamemenu'];
100
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
101
$pconfig['dashboardperiod'] = isset($config['widgets']['period']) ? $config['widgets']['period']:"10";
102
$pconfig['loginshowhost'] = isset($config['system']['webgui']['loginshowhost']);
103

    
104
if (!$pconfig['timezone']) {
105
	if (isset($g['default_timezone']) && !empty($g['default_timezone'])) {
106
		$pconfig['timezone'] = $g['default_timezone'];
107
	} else {
108
		$pconfig['timezone'] = "Etc/UTC";
109
	}
110
}
111

    
112
if (!$pconfig['timeservers']) {
113
	$pconfig['timeservers'] = "pool.ntp.org";
114
}
115

    
116
$changedesc = gettext("System") . ": ";
117
$changecount = 0;
118

    
119
function is_timezone($elt) {
120
	return !preg_match("/\/$/", $elt);
121
}
122

    
123
if ($pconfig['timezone'] <> $_POST['timezone']) {
124
	filter_pflog_start(true);
125
}
126

    
127
$timezonelist = system_get_timezone_list();
128
$timezonedesc = $timezonelist;
129

    
130
/*
131
 * Etc/GMT entries work the opposite way to what people expect.
132
 * Ref: https://github.com/eggert/tz/blob/master/etcetera and Redmine issue 7089
133
 * Add explanatory text to entries like:
134
 * Etc/GMT+1 and Etc/GMT-1
135
 * but not:
136
 * Etc/GMT or Etc/GMT+0
137
 */
138
foreach ($timezonedesc as $idx => $desc) {
139
	if (substr($desc, 0, 7) != "Etc/GMT" || substr($desc, 8, 1) == "0") {
140
		continue;
141
	}
142

    
143
	$direction = substr($desc, 7, 1);
144

    
145
	switch ($direction) {
146
	case '-':
147
		$direction_str = gettext('AHEAD of');
148
		break;
149
	case '+':
150
		$direction_str = gettext('BEHIND');
151
		break;
152
	default:
153
		continue;
154
	}
155

    
156
	$hr_offset = substr($desc, 8);
157
	$timezonedesc[$idx] = $desc . " " .
158
	    sprintf(ngettext('(%1$s hour %2$s GMT)', '(%1$s hours %2$s GMT)', $hr_offset), $hr_offset, $direction_str);
159
}
160

    
161
$multiwan = false;
162
$interfaces = get_configured_interface_list();
163
foreach ($interfaces as $interface) {
164
	if (interface_has_gateway($interface)) {
165
		$multiwan = true;
166
	}
167
}
168

    
169
if ($_POST) {
170

    
171
	$changecount++;
172

    
173
	unset($input_errors);
174
	$pconfig = $_POST;
175

    
176
	/* input validation */
177
	$reqdfields = explode(" ", "hostname domain");
178
	$reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
179

    
180
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
181

    
182
	if ($_POST['dashboardperiod']) {
183
		$config['widgets']['period'] = $_POST['dashboardperiod'];
184
	}
185

    
186
	if ($_POST['webguicss']) {
187
		$config['system']['webgui']['webguicss'] = $_POST['webguicss'];
188
	} else {
189
		unset($config['system']['webgui']['webguicss']);
190
	}
191

    
192
	$config['system']['webgui']['loginshowhost'] = $_POST['loginshowhost'] ? true:false;
193

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

    
200
	if ($_POST['webguihostnamemenu']) {
201
		$config['system']['webgui']['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
202
	} else {
203
		unset($config['system']['webgui']['webguihostnamemenu']);
204
	}
205

    
206
	if ($_POST['dashboardcolumns']) {
207
		$config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns'];
208
	} else {
209
		unset($config['system']['webgui']['dashboardcolumns']);
210
	}
211

    
212
	if ($_POST['hostname']) {
213
		if (!is_hostname($_POST['hostname'])) {
214
			$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
215
		} else {
216
			if (!is_unqualified_hostname($_POST['hostname'])) {
217
				$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
218
			}
219
		}
220
	}
221
	if ($_POST['domain'] && !is_domain($_POST['domain'])) {
222
		$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
223
	}
224

    
225
	$dnslist = $ignore_posted_dnsgw = array();
226

    
227
	for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
228
		$dnsname="dns{$dnscounter}";
229
		$dnsgwname="dns{$dnscounter}gw";
230
		$dnslist[] = $_POST[$dnsname];
231

    
232
		if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
233
			$input_errors[] = sprintf(gettext("A valid IP address must be specified for DNS server %s."), $dnscounter);
234
		} else {
235
			if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
236
				// A real gateway has been selected.
237
				if (is_ipaddr($_POST[$dnsname])) {
238
					if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
239
						$input_errors[] = sprintf(gettext('The IPv6 gateway "%1$s" can not be specified for IPv4 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
240
					}
241
					if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
242
						$input_errors[] = sprintf(gettext('The IPv4 gateway "%1$s" can not be specified for IPv6 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
243
					}
244
				} else {
245
					// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
246
					$ignore_posted_dnsgw[$dnsgwname] = true;
247
				}
248
			}
249
		}
250
	}
251

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

    
256
	$direct_networks_list = explode(" ", filter_get_direct_networks_list());
257
	for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
258
		$dnsitem = "dns{$dnscounter}";
259
		$dnsgwitem = "dns{$dnscounter}gw";
260
		if ($_POST[$dnsgwitem] && ($_POST[$dnsgwitem] <> "none")) {
261
			foreach ($direct_networks_list as $direct_network) {
262
				if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
263
					$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
264
				}
265
			}
266
		}
267
	}
268

    
269
	# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
270
	$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
271
	$_POST['timeservers'] = trim($_POST['timeservers']);
272
	foreach (explode(' ', $_POST['timeservers']) as $ts) {
273
		if (!is_domain($ts)) {
274
			$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
275
		}
276
	}
277

    
278
	if (!$input_errors) {
279
		update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
280
		update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
281
		update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
282
		update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
283

    
284
		if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
285
			$config['system']['language'] = $_POST['language'];
286
			set_language();
287
		}
288

    
289
		unset($config['system']['webgui']['webguileftcolumnhyper']);
290
		$config['system']['webgui']['webguileftcolumnhyper'] = $_POST['webguileftcolumnhyper'] ? true : false;
291

    
292
		unset($config['system']['webgui']['dashboardavailablewidgetspanel']);
293
		$config['system']['webgui']['dashboardavailablewidgetspanel'] = $_POST['dashboardavailablewidgetspanel'] ? true : false;
294

    
295
		unset($config['system']['webgui']['systemlogsfilterpanel']);
296
		$config['system']['webgui']['systemlogsfilterpanel'] = $_POST['systemlogsfilterpanel'] ? true : false;
297

    
298
		unset($config['system']['webgui']['systemlogsmanagelogpanel']);
299
		$config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false;
300

    
301
		unset($config['system']['webgui']['statusmonitoringsettingspanel']);
302
		$config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false;
303

    
304
		/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
305
		$olddnsservers = $config['system']['dnsserver'];
306
		unset($config['system']['dnsserver']);
307
		if ($_POST['dns1']) {
308
			$config['system']['dnsserver'][] = $_POST['dns1'];
309
		}
310
		if ($_POST['dns2']) {
311
			$config['system']['dnsserver'][] = $_POST['dns2'];
312
		}
313
		if ($_POST['dns3']) {
314
			$config['system']['dnsserver'][] = $_POST['dns3'];
315
		}
316
		if ($_POST['dns4']) {
317
			$config['system']['dnsserver'][] = $_POST['dns4'];
318
		}
319

    
320
		$olddnsallowoverride = $config['system']['dnsallowoverride'];
321

    
322
		unset($config['system']['dnsallowoverride']);
323
		$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
324

    
325
		if ($_POST['dnslocalhost'] == "yes") {
326
			$config['system']['dnslocalhost'] = true;
327
		} else {
328
			unset($config['system']['dnslocalhost']);
329
		}
330

    
331
		/* which interface should the dns servers resolve through? */
332
		$outdnscounter = 0;
333
		for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
334
			$dnsname="dns{$dnscounter}";
335
			$dnsgwname="dns{$dnscounter}gw";
336
			$olddnsgwname = $config['system'][$dnsgwname];
337

    
338
			if ($ignore_posted_dnsgw[$dnsgwname]) {
339
				$thisdnsgwname = "none";
340
			} else {
341
				$thisdnsgwname = $pconfig[$dnsgwname];
342
			}
343

    
344
			// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
345
			$config['system'][$dnsgwname] = "none";
346
			$pconfig[$dnsgwname] = "none";
347
			$pconfig[$dnsname] = "";
348

    
349
			if ($_POST[$dnsname]) {
350
				// Only the non-blank DNS servers were put into the config above.
351
				// So we similarly only add the corresponding gateways sequentially to the config (and to pconfig), as we find non-blank DNS servers.
352
				// 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.
353
				$outdnscounter++;
354
				$outdnsname="dns{$outdnscounter}";
355
				$outdnsgwname="dns{$outdnscounter}gw";
356
				$pconfig[$outdnsname] = $_POST[$dnsname];
357
				if ($_POST[$dnsgwname]) {
358
					$config['system'][$outdnsgwname] = $thisdnsgwname;
359
					$pconfig[$outdnsgwname] = $thisdnsgwname;
360
				} else {
361
					// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
362
					unset($config['system'][$outdnsgwname]);
363
					$pconfig[$outdnsgwname] = "";
364
				}
365
			}
366
			if (($olddnsgwname != "") && ($olddnsgwname != "none") && (($olddnsgwname != $thisdnsgwname) || ($olddnsservers[$dnscounter-1] != $_POST[$dnsname]))) {
367
				// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
368
				// Remove the route. Later calls will add the correct new route if needed.
369
				if (is_ipaddrv4($olddnsservers[$dnscounter-1])) {
370
					mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter-1]));
371
				} else if (is_ipaddrv6($olddnsservers[$dnscounter-1])) {
372
					mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter-1]));
373
				}
374
			}
375
		}
376

    
377
		if ($changecount > 0) {
378
			write_config($changedesc);
379
		}
380

    
381
		$retval = 0;
382
		$retval = system_hostname_configure();
383
		$retval |= system_hosts_generate();
384
		$retval |= system_resolvconf_generate();
385
		if (isset($config['dnsmasq']['enable'])) {
386
			$retval |= services_dnsmasq_configure();
387
		} elseif (isset($config['unbound']['enable'])) {
388
			$retval |= services_unbound_configure();
389
		}
390
		$retval |= system_timezone_configure();
391
		$retval |= system_ntp_configure();
392

    
393
		if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
394
			$retval |= send_event("service reload dns");
395
		}
396

    
397
		// Reload the filter - plugins might need to be run.
398
		$retval |= filter_configure();
399

    
400
		$savemsg = get_std_save_message($retval);
401
	}
402

    
403
	unset($ignore_posted_dnsgw);
404
}
405

    
406
$pgtitle = array(gettext("System"), gettext("General Setup"));
407
include("head.inc");
408

    
409
if ($input_errors) {
410
	print_input_errors($input_errors);
411
}
412

    
413
if ($savemsg) {
414
	print_info_box($savemsg, 'success');
415
}
416
?>
417
<div id="container">
418
<?php
419

    
420
$form = new Form;
421
$section = new Form_Section('System');
422
$section->addInput(new Form_Input(
423
	'hostname',
424
	'Hostname',
425
	'text',
426
	$pconfig['hostname'],
427
	['placeholder' => 'pfSense']
428
))->setHelp('Name of the firewall host, without domain part');
429

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

    
440
$form->add($section);
441

    
442
$section = new Form_Section('DNS Server Settings');
443

    
444
for ($i=1; $i<5; $i++) {
445
//	if (!isset($pconfig['dns'.$i]))
446
//		continue;
447

    
448
	$group = new Form_Group('DNS Server ' . $i);
449

    
450
	$group->add(new Form_Input(
451
		'dns' . $i,
452
		'DNS Server',
453
		'text',
454
		$pconfig['dns'. $i]
455
	))->setHelp(($i == 4) ? 'Address':null);
456

    
457
	$help = "Enter IP addresses to be used by the system for DNS resolution. " .
458
		"These are also used for the DHCP service, DNS Forwarder and DNS Resolver " .
459
		"when it has DNS Query Forwarding enabled.";
460

    
461
	if ($multiwan)	{
462
		$options = array('none' => 'none');
463

    
464
		foreach ($arr_gateways as $gwname => $gwitem) {
465
			if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
466
				continue;
467
			}
468

    
469
			if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
470
				continue;
471
			}
472

    
473
			$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
474
		}
475

    
476
		$group->add(new Form_Select(
477
			'dns' . $i . 'gw',
478
			'Gateway',
479
			$pconfig['dns' . $i . 'gw'],
480
			$options
481
		))->setHelp(($i == 4) ? 'Gateway':null);;
482

    
483
		$help .= '<br/>'. "In addition, optionally select the gateway for each DNS server. " .
484
			"When using multiple WAN connections there should be at least one unique DNS server per gateway.";
485
	}
486

    
487
	if ($i == 4) {
488
		$group->setHelp($help);
489
	}
490

    
491
	$section->add($group);
492
}
493

    
494
$section->addInput(new Form_Checkbox(
495
	'dnsallowoverride',
496
	'DNS Server Override',
497
	'Allow DNS server list to be overridden by DHCP/PPP on WAN',
498
	$pconfig['dnsallowoverride']
499
))->setHelp(sprintf(gettext('If this option is set, %s will use DNS servers '.
500
	'assigned by a DHCP/PPP server on WAN for its own purposes (including '.
501
	'the DNS Forwarder/DNS Resolver). However, they will not be assigned to DHCP '.
502
	'clients.'), $g['product_name']));
503

    
504
$section->addInput(new Form_Checkbox(
505
	'dnslocalhost',
506
	'Disable DNS Forwarder',
507
	'Do not use the DNS Forwarder/DNS Resolver as a DNS server for the firewall',
508
	$pconfig['dnslocalhost']
509
))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS '.
510
	'server where the DNS Forwarder or DNS Resolver is enabled and set to '.
511
	'listen on localhost, so system can use the local DNS service to perform '.
512
	'lookups. Checking this box omits localhost from the list of DNS servers in resolv.conf.');
513

    
514
$form->add($section);
515

    
516
$section = new Form_Section('Localization');
517

    
518
$section->addInput(new Form_Select(
519
	'timezone',
520
	'Timezone',
521
	$pconfig['timezone'],
522
	array_combine($timezonelist, $timezonedesc)
523
))->setHelp('Select the timezone or location within the timezone to be used by this system. '.
524
	'Usually choose a "Continent/City". Only choose a special or "Etc" entry if you understand why you need to use it.');
525

    
526
$section->addInput(new Form_Input(
527
	'timeservers',
528
	'Timeservers',
529
	'text',
530
	$pconfig['timeservers']
531
))->setHelp('Use a space to separate multiple hosts (only one required). '.
532
	'Remember to set up at least one DNS server if a host name is entered here!');
533

    
534
$section->addInput(new Form_Select(
535
	'language',
536
	'Language',
537
	$pconfig['language'],
538
	get_locale_list()
539
))->setHelp('Choose a language for the webConfigurator');
540

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

    
543
$section = new Form_Section('webConfigurator');
544

    
545
gen_webguicss_field($section, $pconfig['webguicss']);
546
gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
547
gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
548
gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
549
gen_associatedpanels_fields(
550
	$section,
551
	$pconfig['dashboardavailablewidgetspanel'],
552
	$pconfig['systemlogsfilterpanel'],
553
	$pconfig['systemlogsmanagelogpanel'],
554
	$pconfig['statusmonitoringsettingspanel']);
555
gen_webguileftcolumnhyper_field($section, $pconfig['webguileftcolumnhyper']);
556

    
557
$section->addInput(new Form_Checkbox(
558
	'loginshowhost',
559
	'Login hostname',
560
	'Show hostname on login banner',
561
	$pconfig['loginshowhost']
562
));
563

    
564
$section->addInput(new Form_Input(
565
	'dashboardperiod',
566
	'Dashboard update period',
567
	'number',
568
	$pconfig['dashboardperiod'],
569
	['min' => '5', 'max' => '600']
570
))->setHelp('Time in seconds between dashboard widget updates. Small values cause ' .
571
			'more frequent updates but increase the load on the web server. ' .
572
			'Minimum is 5 seconds, maximum 600 seconds');
573

    
574
$form->add($section);
575

    
576
print $form;
577

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

    
580
?>
581
</div>
582

    
583
<script>
584
//<![CDATA[
585
events.push(function() {
586

    
587
	function setThemeWarning() {
588
		if ($('#webguicss').val().startsWith("pfSense")) {
589
			$('#csstxt').html("").addClass("text-default");
590
		} else {
591
			$('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
592
		}
593
	}
594

    
595
	$('#webguicss').change(function() {
596
		setThemeWarning();
597
	});
598

    
599
	setThemeWarning();
600
});
601
//]]>
602
</script>
603

    
604
<?php
605
include("foot.inc");
606
?>
(186-186/227)