Project

General

Profile

Download (23.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * system.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2018 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['roworderdragging'] = isset($config['system']['webgui']['roworderdragging']);
82
$pconfig['loginshowhost'] = isset($config['system']['webgui']['loginshowhost']);
83
$pconfig['requirestatefilter'] = isset($config['system']['webgui']['requirestatefilter']);
84

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

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

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

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

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

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

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

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

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

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

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

    
150
if ($_POST) {
151

    
152
	$changecount++;
153

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

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

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

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

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

    
173
	$config['system']['webgui']['roworderdragging'] = $_POST['roworderdragging'] ? true:false;
174

    
175
	if ($_POST['logincss']) {
176
		$config['system']['webgui']['logincss'] = $_POST['logincss'];
177
	} else {
178
		unset($config['system']['webgui']['logincss']);
179
	}
180

    
181
	$config['system']['webgui']['loginshowhost'] = $_POST['loginshowhost'] ? true:false;
182

    
183
	if ($_POST['webguifixedmenu']) {
184
		$config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu'];
185
	} else {
186
		unset($config['system']['webgui']['webguifixedmenu']);
187
	}
188

    
189
	if ($_POST['webguihostnamemenu']) {
190
		$config['system']['webgui']['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
191
	} else {
192
		unset($config['system']['webgui']['webguihostnamemenu']);
193
	}
194

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

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

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

    
216
	$dnslist = $ignore_posted_dnsgw = array();
217

    
218
	$dnscounter = 0;
219
	$dnsname = "dns{$dnscounter}";
220

    
221
	while (isset($_POST[$dnsname])) {
222
		$dnsgwname = "dnsgw{$dnscounter}";
223
		$dnslist[] = $_POST[$dnsname];
224

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

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

    
251
	$dnscounter = 0;
252
	$dnsname = "dns{$dnscounter}";
253

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

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

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

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

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

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

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

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

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

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

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

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

    
316
		$dnscounter = 0;
317
		$dnsname = "dns{$dnscounter}";
318

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

    
327
		// Remember the new list for display also.
328
		$pconfig['dnsserver'] = $config['system']['dnsserver'];
329

    
330
		$olddnsallowoverride = $config['system']['dnsallowoverride'];
331

    
332
		unset($config['system']['dnsallowoverride']);
333
		$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
334

    
335
		if ($_POST['dnslocalhost'] == "yes") {
336
			$config['system']['dnslocalhost'] = true;
337
		} else {
338
			unset($config['system']['dnslocalhost']);
339
		}
340

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

    
354
			$olddnsgwname = $config['system'][$dnsgwconfigname];
355

    
356
			if ($ignore_posted_dnsgw[$dnsgwname]) {
357
				$thisdnsgwname = "none";
358
			} else {
359
				$thisdnsgwname = $pconfig[$dnsgwname];
360
			}
361

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

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

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

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

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

    
407
		if ($changecount > 0) {
408
			write_config($changedesc);
409
		}
410

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

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

    
428
		// Reload the filter - plugins might need to be run.
429
		$retval |= filter_configure();
430
	}
431

    
432
	unset($ignore_posted_dnsgw);
433
}
434

    
435
$pgtitle = array(gettext("System"), gettext("General Setup"));
436
include("head.inc");
437

    
438
if ($input_errors) {
439
	print_input_errors($input_errors);
440
}
441

    
442
if ($changes_applied) {
443
	print_apply_result_box($retval);
444
}
445
?>
446
<div id="container">
447
<?php
448

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

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

    
472
$form->add($section);
473

    
474
$section = new Form_Section('DNS Server Settings');
475

    
476
if (!is_array($pconfig['dnsserver'])) {
477
	$pconfig['dnsserver'] = array();
478
}
479

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

    
487
// If there are no DNS servers, make an empty entry for initial display.
488
if ($dnsserver_count == 0) {
489
	$pconfig['dnsserver'][] = '';
490
}
491

    
492
foreach ($pconfig['dnsserver'] as $dnsserver) {
493

    
494
	$is_last_dnsserver = ($dnsserver_num == $dnsserver_count - 1);
495
	$group = new Form_Group($dnsserver_num == 0 ? 'DNS Servers':'');
496
	$group->addClass('repeatable');
497

    
498
	$group->add(new Form_Input(
499
		'dns' . $dnsserver_num,
500
		'DNS Server',
501
		'text',
502
		$dnsserver
503
	))->setHelp(($is_last_dnsserver) ? $dnsserver_help:null);
504

    
505
	if ($multiwan)	{
506
		$options = array('none' => 'none');
507

    
508
		foreach ($arr_gateways as $gwname => $gwitem) {
509
			if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
510
				continue;
511
			}
512

    
513
			if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
514
				continue;
515
			}
516

    
517
			$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
518
		}
519

    
520
		$group->add(new Form_Select(
521
			'dnsgw' . $dnsserver_num,
522
			'Gateway',
523
			$pconfig['dnsgw' . $dnsserver_num],
524
			$options
525
		))->setHelp(($is_last_dnsserver) ? $dnsgw_help:null);;
526
	}
527

    
528
	$group->add(new Form_Button(
529
		'deleterow' . $dnsserver_num,
530
		'Delete',
531
		null,
532
		'fa-trash'
533
	))->addClass('btn-warning');
534

    
535
	$section->add($group);
536
	$dnsserver_num++;
537
}
538

    
539
$section->addInput(new Form_Button(
540
	'addrow',
541
	'Add DNS Server',
542
	null,
543
	'fa-plus'
544
))->addClass('btn-success addbtn');
545

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

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

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

    
568
$section = new Form_Section('Localization');
569

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

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

    
586
$section->addInput(new Form_Select(
587
	'language',
588
	'*Language',
589
	$pconfig['language'],
590
	get_locale_list()
591
))->setHelp('Choose a language for the webConfigurator');
592

    
593
$form->add($section);
594

    
595
$section = new Form_Section('webConfigurator');
596

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

    
612
$section->addInput(new Form_Checkbox(
613
	'roworderdragging',
614
	'Disable dragging',
615
	'Disable dragging of firewall/nat rules.',
616
	$pconfig['roworderdragging']
617
))->setHelp('Disables dragging rows to allow selecting and copying row contents and avoid accidental changes.');
618

    
619
$section->addInput(new Form_Select(
620
	'logincss',
621
	'Login page color',
622
	$pconfig['logincss'],
623
	["1e3f75;" => gettext("Blue"), "003300" => gettext("Green"), "770101" => gettext("Red"),
624
	 "4b1263" => gettext("Purple"), "424142" => gettext("Gray"), "333333" => gettext("Dark gray"),
625
	 "633215" => gettext("Brown" ), "bf7703" => gettext("Orange")]
626
))->setHelp('Choose a color for the login page');
627

    
628
$section->addInput(new Form_Checkbox(
629
	'loginshowhost',
630
	'Login hostname',
631
	'Show hostname on login banner',
632
	$pconfig['loginshowhost']
633
));
634
/*
635
$section->addInput(new Form_Input(
636
	'dashboardperiod',
637
	'Dashboard update period',
638
	'number',
639
	$pconfig['dashboardperiod'],
640
	['min' => '5', 'max' => '600']
641
))->setHelp('Time in seconds between dashboard widget updates. Small values cause ' .
642
			'more frequent updates but increase the load on the web server. ' .
643
			'Minimum is 5 seconds, maximum 600 seconds');
644
*/
645
$form->add($section);
646

    
647
print $form;
648

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

    
651
?>
652
</div>
653

    
654
<script type="text/javascript">
655
//<![CDATA[
656
events.push(function() {
657

    
658
	function setThemeWarning() {
659
		if ($('#webguicss').val().startsWith("pfSense")) {
660
			$('#csstxt').html("").addClass("text-default");
661
		} else {
662
			$('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
663
		}
664
	}
665

    
666
	$('#webguicss').change(function() {
667
		setThemeWarning();
668
	});
669

    
670
	setThemeWarning();
671

    
672
	// Suppress "Delete row" button if there are fewer than two rows
673
	checkLastRow();
674
});
675
//]]>
676
</script>
677

    
678
<?php
679
include("foot.inc");
680
?>
(190-190/232)