Project

General

Profile

Download (23.1 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
// set default language if unset
51
if (!isset($config['system']['language'])) {
52
	$config['system']['language'] = $g['language'];
53
}
54

    
55
$dnsgw_counter = 1;
56

    
57
while (isset($config["system"]["dns{$dnsgw_counter}gw"])) {
58
	$pconfig_dnsgw_counter = $dnsgw_counter - 1;
59
	$pconfig["dnsgw{$pconfig_dnsgw_counter}"] = $config["system"]["dns{$dnsgw_counter}gw"];
60
	$dnsgw_counter++;
61
}
62

    
63
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']);
64
$pconfig['timezone'] = $config['system']['timezone'];
65
$pconfig['timeservers'] = $config['system']['timeservers'];
66
$pconfig['language'] = $config['system']['language'];
67
$pconfig['webguicss'] = $config['system']['webgui']['webguicss'];
68
$pconfig['logincss'] = $config['system']['webgui']['logincss'];
69
$pconfig['webguifixedmenu'] = $config['system']['webgui']['webguifixedmenu'];
70
$pconfig['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns'];
71
$pconfig['interfacessort'] = isset($config['system']['webgui']['interfacessort']);
72
$pconfig['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']);
73
$pconfig['disablealiaspopupdetail'] = isset($config['system']['webgui']['disablealiaspopupdetail']);
74
$pconfig['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']);
75
$pconfig['systemlogsfilterpanel'] = isset($config['system']['webgui']['systemlogsfilterpanel']);
76
$pconfig['systemlogsmanagelogpanel'] = isset($config['system']['webgui']['systemlogsmanagelogpanel']);
77
$pconfig['statusmonitoringsettingspanel'] = isset($config['system']['webgui']['statusmonitoringsettingspanel']);
78
$pconfig['webguihostnamemenu'] = $config['system']['webgui']['webguihostnamemenu'];
79
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
80
$pconfig['dashboardperiod'] = isset($config['widgets']['period']) ? $config['widgets']['period']:"10";
81
$pconfig['loginshowhost'] = isset($config['system']['webgui']['loginshowhost']);
82
$pconfig['requirestatefilter'] = isset($config['system']['webgui']['requirestatefilter']);
83

    
84
if (!$pconfig['timezone']) {
85
	if (isset($g['default_timezone']) && !empty($g['default_timezone'])) {
86
		$pconfig['timezone'] = $g['default_timezone'];
87
	} else {
88
		$pconfig['timezone'] = "Etc/UTC";
89
	}
90
}
91

    
92
if (!$pconfig['timeservers']) {
93
	$pconfig['timeservers'] = "pool.ntp.org";
94
}
95

    
96
$changedesc = gettext("System") . ": ";
97
$changecount = 0;
98

    
99
function is_timezone($elt) {
100
	return !preg_match("/\/$/", $elt);
101
}
102

    
103
if ($pconfig['timezone'] <> $_POST['timezone']) {
104
	filter_pflog_start(true);
105
}
106

    
107
$timezonelist = system_get_timezone_list();
108
$timezonedesc = $timezonelist;
109

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

    
123
	$direction = substr($desc, 7, 1);
124

    
125
	switch ($direction) {
126
	case '-':
127
		$direction_str = gettext('AHEAD of');
128
		break;
129
	case '+':
130
		$direction_str = gettext('BEHIND');
131
		break;
132
	default:
133
		continue;
134
	}
135

    
136
	$hr_offset = substr($desc, 8);
137
	$timezonedesc[$idx] = $desc . " " .
138
	    sprintf(ngettext('(%1$s hour %2$s GMT)', '(%1$s hours %2$s GMT)', $hr_offset), $hr_offset, $direction_str);
139
}
140

    
141
$multiwan = false;
142
$interfaces = get_configured_interface_list();
143
foreach ($interfaces as $interface) {
144
	if (interface_has_gateway($interface)) {
145
		$multiwan = true;
146
	}
147
}
148

    
149
if ($_POST) {
150

    
151
	$changecount++;
152

    
153
	unset($input_errors);
154
	$pconfig = $_POST;
155

    
156
	/* input validation */
157
	$reqdfields = explode(" ", "hostname domain");
158
	$reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
159

    
160
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
161

    
162
	if ($_POST['dashboardperiod']) {
163
		$config['widgets']['period'] = $_POST['dashboardperiod'];
164
	}
165

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

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

    
178
	$config['system']['webgui']['loginshowhost'] = $_POST['loginshowhost'] ? true:false;
179

    
180
	if ($_POST['webguifixedmenu']) {
181
		$config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu'];
182
	} else {
183
		unset($config['system']['webgui']['webguifixedmenu']);
184
	}
185

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

    
192
	if ($_POST['dashboardcolumns']) {
193
		$config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns'];
194
	} else {
195
		unset($config['system']['webgui']['dashboardcolumns']);
196
	}
197

    
198
	$config['system']['webgui']['requirestatefilter'] = $_POST['requirestatefilter'] ? true : false;
199

    
200
	if ($_POST['hostname']) {
201
		if (!is_hostname($_POST['hostname'])) {
202
			$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
203
		} else {
204
			if (!is_unqualified_hostname($_POST['hostname'])) {
205
				$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
206
			}
207
		}
208
	}
209
	if ($_POST['domain'] && !is_domain($_POST['domain'])) {
210
		$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
211
	}
212

    
213
	$dnslist = $ignore_posted_dnsgw = array();
214

    
215
	$dnscounter = 0;
216
	$dnsname = "dns{$dnscounter}";
217

    
218
	while (isset($_POST[$dnsname])) {
219
		$dnsgwname = "dnsgw{$dnscounter}";
220
		$dnslist[] = $_POST[$dnsname];
221

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

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

    
248
	$dnscounter = 0;
249
	$dnsname = "dns{$dnscounter}";
250

    
251
	$direct_networks_list = explode(" ", filter_get_direct_networks_list());
252
	while (isset($_POST[$dnsname])) {
253
		$dnsgwname = "dnsgw{$dnscounter}";
254
		if ($_POST[$dnsgwname] && ($_POST[$dnsgwname] <> "none")) {
255
			foreach ($direct_networks_list as $direct_network) {
256
				if (ip_in_subnet($_POST[$dnsname], $direct_network)) {
257
					$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsname]);
258
				}
259
			}
260
		}
261
		$dnscounter++;
262
		$dnsname = "dns{$dnscounter}";
263
	}
264

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

    
274
	if ($input_errors) {
275
		// Put the user-entered list back into place so it will be redisplayed for correction.
276
		$pconfig['dnsserver'] = $dnslist;
277
	} else {
278
		update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
279
		update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
280
		update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
281
		update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
282

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

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

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

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

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

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

    
303
		unset($config['system']['webgui']['systemlogsmanagelogpanel']);
304
		$config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false;
305

    
306
		unset($config['system']['webgui']['statusmonitoringsettingspanel']);
307
		$config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false;
308

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

    
313
		$dnscounter = 0;
314
		$dnsname = "dns{$dnscounter}";
315

    
316
		while (isset($_POST[$dnsname])) {
317
			if ($_POST[$dnsname]) {
318
				$config['system']['dnsserver'][] = $_POST[$dnsname];
319
			}
320
			$dnscounter++;
321
			$dnsname = "dns{$dnscounter}";
322
		}
323

    
324
		// Remember the new list for display also.
325
		$pconfig['dnsserver'] = $config['system']['dnsserver'];
326

    
327
		$olddnsallowoverride = $config['system']['dnsallowoverride'];
328

    
329
		unset($config['system']['dnsallowoverride']);
330
		$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
331

    
332
		if ($_POST['dnslocalhost'] == "yes") {
333
			$config['system']['dnslocalhost'] = true;
334
		} else {
335
			unset($config['system']['dnslocalhost']);
336
		}
337

    
338
		/* which interface should the dns servers resolve through? */
339
		$dnscounter = 0;
340
		// The $_POST array key of the DNS IP (starts from 0)
341
		$dnsname = "dns{$dnscounter}";
342
		$outdnscounter = 0;
343
		while (isset($_POST[$dnsname])) {
344
			// The $_POST array key of the corresponding gateway (starts from 0)
345
			$dnsgwname = "dnsgw{$dnscounter}";
346
			// The numbering of DNS GW entries in the config starts from 1
347
			$dnsgwconfigcounter = $dnscounter + 1;
348
			// So this is the array key of the DNS GW entry in $config['system']
349
			$dnsgwconfigname = "dns{$dnsgwconfigcounter}gw";
350

    
351
			$olddnsgwname = $config['system'][$dnsgwconfigname];
352

    
353
			if ($ignore_posted_dnsgw[$dnsgwname]) {
354
				$thisdnsgwname = "none";
355
			} else {
356
				$thisdnsgwname = $pconfig[$dnsgwname];
357
			}
358

    
359
			// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
360
			$config['system'][$dnsgwconfigname] = "none";
361
			$pconfig[$dnsgwname] = "none";
362
			$pconfig[$dnsname] = "";
363

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

    
369
				// The $pconfig array key of the DNS IP (starts from 0)
370
				$outdnsname = "dns{$outdnscounter}";
371
				// The $pconfig array key of the corresponding gateway (starts from 0)
372
				$outdnsgwname = "dnsgw{$outdnscounter}";
373
				// The numbering of DNS GW entries in the config starts from 1
374
				$outdnsgwconfigcounter = $outdnscounter + 1;
375
				// So this is the array key of the output DNS GW entry in $config['system']
376
				$outdnsgwconfigname = "dns{$outdnsgwconfigcounter}gw";
377

    
378
				$pconfig[$outdnsname] = $_POST[$dnsname];
379
				if ($_POST[$dnsgwname]) {
380
					$config['system'][$outdnsgwconfigname] = $thisdnsgwname;
381
					$pconfig[$outdnsgwname] = $thisdnsgwname;
382
				} else {
383
					// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
384
					unset($config['system'][$outdnsgwconfigname]);
385
					$pconfig[$outdnsgwname] = "";
386
				}
387
				$outdnscounter++;
388
			}
389
			if (($olddnsgwname != "") && ($olddnsgwname != "none") && (($olddnsgwname != $thisdnsgwname) || ($olddnsservers[$dnscounter] != $_POST[$dnsname]))) {
390
				// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
391
				// Remove the route. Later calls will add the correct new route if needed.
392
				if (is_ipaddrv4($olddnsservers[$dnscounter])) {
393
					mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter-1]));
394
				} else if (is_ipaddrv6($olddnsservers[$dnscounter])) {
395
					mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter-1]));
396
				}
397
			}
398

    
399
			$dnscounter++;
400
			// The $_POST array key of the DNS IP (starts from 0)
401
			$dnsname = "dns{$dnscounter}";
402
		}
403

    
404
		if ($changecount > 0) {
405
			write_config($changedesc);
406
		}
407

    
408
		$changes_applied = true;
409
		$retval = 0;
410
		$retval |= system_hostname_configure();
411
		$retval |= system_hosts_generate();
412
		$retval |= system_resolvconf_generate();
413
		if (isset($config['dnsmasq']['enable'])) {
414
			$retval |= services_dnsmasq_configure();
415
		} elseif (isset($config['unbound']['enable'])) {
416
			$retval |= services_unbound_configure();
417
		}
418
		$retval |= system_timezone_configure();
419
		$retval |= system_ntp_configure();
420

    
421
		if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
422
			$retval |= send_event("service reload dns");
423
		}
424

    
425
		// Reload the filter - plugins might need to be run.
426
		$retval |= filter_configure();
427
	}
428

    
429
	unset($ignore_posted_dnsgw);
430
}
431

    
432
$pgtitle = array(gettext("System"), gettext("General Setup"));
433
include("head.inc");
434

    
435
if ($input_errors) {
436
	print_input_errors($input_errors);
437
}
438

    
439
if ($changes_applied) {
440
	print_apply_result_box($retval);
441
}
442
?>
443
<div id="container">
444
<?php
445

    
446
$form = new Form;
447
$section = new Form_Section('System');
448
$section->addInput(new Form_Input(
449
	'hostname',
450
	'*Hostname',
451
	'text',
452
	$pconfig['hostname'],
453
	['placeholder' => 'pfSense']
454
))->setHelp('Name of the firewall host, without domain part');
455

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

    
467
$form->add($section);
468

    
469
$section = new Form_Section('DNS Server Settings');
470

    
471
if (!is_array($pconfig['dnsserver'])) {
472
	$pconfig['dnsserver'] = array();
473
}
474

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

    
482
// If there are no DNS servers, make an empty entry for initial display.
483
if ($dnsserver_count == 0) {
484
	$pconfig['dnsserver'][] = '';
485
}
486

    
487
foreach ($pconfig['dnsserver'] as $dnsserver) {
488

    
489
	$is_last_dnsserver = ($dnsserver_num == $dnsserver_count - 1);
490
	$group = new Form_Group($dnsserver_num == 0 ? 'DNS Servers':'');
491
	$group->addClass('repeatable');
492

    
493
	$group->add(new Form_Input(
494
		'dns' . $dnsserver_num,
495
		'DNS Server',
496
		'text',
497
		$dnsserver
498
	))->setHelp(($is_last_dnsserver) ? $dnsserver_help:null);
499

    
500
	if ($multiwan)	{
501
		$options = array('none' => 'none');
502

    
503
		foreach ($arr_gateways as $gwname => $gwitem) {
504
			if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
505
				continue;
506
			}
507

    
508
			if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
509
				continue;
510
			}
511

    
512
			$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
513
		}
514

    
515
		$group->add(new Form_Select(
516
			'dnsgw' . $dnsserver_num,
517
			'Gateway',
518
			$pconfig['dnsgw' . $dnsserver_num],
519
			$options
520
		))->setHelp(($is_last_dnsserver) ? $dnsgw_help:null);;
521
	}
522

    
523
	$group->add(new Form_Button(
524
		'deleterow' . $dnsserver_num,
525
		'Delete',
526
		null,
527
		'fa-trash'
528
	))->addClass('btn-warning');
529

    
530
	$section->add($group);
531
	$dnsserver_num++;
532
}
533

    
534
$section->addInput(new Form_Button(
535
	'addrow',
536
	'Add DNS Server',
537
	null,
538
	'fa-plus'
539
))->addClass('btn-success addbtn');
540

    
541
$section->addInput(new Form_Checkbox(
542
	'dnsallowoverride',
543
	'DNS Server Override',
544
	'Allow DNS server list to be overridden by DHCP/PPP on WAN',
545
	$pconfig['dnsallowoverride']
546
))->setHelp('If this option is set, %s will use DNS servers '.
547
	'assigned by a DHCP/PPP server on WAN for its own purposes (including '.
548
	'the DNS Forwarder/DNS Resolver). However, they will not be assigned to DHCP '.
549
	'clients.', $g['product_name']);
550

    
551
$section->addInput(new Form_Checkbox(
552
	'dnslocalhost',
553
	'Disable DNS Forwarder',
554
	'Do not use the DNS Forwarder/DNS Resolver as a DNS server for the firewall',
555
	$pconfig['dnslocalhost']
556
))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS '.
557
	'server where the DNS Forwarder or DNS Resolver is enabled and set to '.
558
	'listen on localhost, so system can use the local DNS service to perform '.
559
	'lookups. Checking this box omits localhost from the list of DNS servers in resolv.conf.');
560

    
561
$form->add($section);
562

    
563
$section = new Form_Section('Localization');
564

    
565
$section->addInput(new Form_Select(
566
	'timezone',
567
	'*Timezone',
568
	$pconfig['timezone'],
569
	array_combine($timezonelist, $timezonedesc)
570
))->setHelp('Select a geographic region name (Continent/Location) to determine the timezone for the firewall. %1$s' .
571
	'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/>');
572

    
573
$section->addInput(new Form_Input(
574
	'timeservers',
575
	'Timeservers',
576
	'text',
577
	$pconfig['timeservers']
578
))->setHelp('Use a space to separate multiple hosts (only one required). '.
579
	'Remember to set up at least one DNS server if a host name is entered here!');
580

    
581
$section->addInput(new Form_Select(
582
	'language',
583
	'*Language',
584
	$pconfig['language'],
585
	get_locale_list()
586
))->setHelp('Choose a language for the webConfigurator');
587

    
588
$form->add($section);
589

    
590
$section = new Form_Section('webConfigurator');
591

    
592
gen_webguicss_field($section, $pconfig['webguicss']);
593
gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
594
gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
595
gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
596
gen_interfacessort_field($section, $pconfig['interfacessort']);
597
gen_associatedpanels_fields(
598
	$section,
599
	$pconfig['dashboardavailablewidgetspanel'],
600
	$pconfig['systemlogsfilterpanel'],
601
	$pconfig['systemlogsmanagelogpanel'],
602
	$pconfig['statusmonitoringsettingspanel']);
603
gen_requirestatefilter_field($section, $pconfig['requirestatefilter']);
604
gen_webguileftcolumnhyper_field($section, $pconfig['webguileftcolumnhyper']);
605
gen_disablealiaspopupdetail_field($section, $pconfig['disablealiaspopupdetail']);
606

    
607
$section->addInput(new Form_Select(
608
	'logincss',
609
	'Login page color',
610
	$pconfig['logincss'],
611
	["1e3f75;" => gettext("Blue"), "003300" => gettext("Green"), "770101" => gettext("Red"),
612
	 "4b1263" => gettext("Purple"), "424142" => gettext("Gray"), "333333" => gettext("Dark gray"),
613
	 "633215" => gettext("Brown" ), "bf7703" => gettext("Orange")]
614
))->setHelp('Choose a color for the login page');
615

    
616
$section->addInput(new Form_Checkbox(
617
	'loginshowhost',
618
	'Login hostname',
619
	'Show hostname on login banner',
620
	$pconfig['loginshowhost']
621
));
622

    
623
$section->addInput(new Form_Input(
624
	'dashboardperiod',
625
	'Dashboard update period',
626
	'number',
627
	$pconfig['dashboardperiod'],
628
	['min' => '5', 'max' => '600']
629
))->setHelp('Time in seconds between dashboard widget updates. Small values cause ' .
630
			'more frequent updates but increase the load on the web server. ' .
631
			'Minimum is 5 seconds, maximum 600 seconds');
632

    
633
$form->add($section);
634

    
635
print $form;
636

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

    
639
?>
640
</div>
641

    
642
<script type="text/javascript">
643
//<![CDATA[
644
events.push(function() {
645

    
646
	function setThemeWarning() {
647
		if ($('#webguicss').val().startsWith("pfSense")) {
648
			$('#csstxt').html("").addClass("text-default");
649
		} else {
650
			$('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
651
		}
652
	}
653

    
654
	$('#webguicss').change(function() {
655
		setThemeWarning();
656
	});
657

    
658
	setThemeWarning();
659

    
660
	// Suppress "Delete row" button if there are fewer than two rows
661
	checkLastRow();
662
});
663
//]]>
664
</script>
665

    
666
<?php
667
include("foot.inc");
668
?>
(183-183/224)