Project

General

Profile

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

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

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

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

    
75
$arr_gateways = return_gateways_array();
76

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

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

    
87
$dnsgw_counter = 1;
88

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

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

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

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

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

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

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

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

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

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

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

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

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

    
179
if ($_POST) {
180

    
181
	$changecount++;
182

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

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

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

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

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

    
202

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

    
209
	$config['system']['webgui']['loginshowhost'] = $_POST['loginshowhost'] ? true:false;
210

    
211
	if ($_POST['webguifixedmenu']) {
212
		$config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu'];
213
	} else {
214
		unset($config['system']['webgui']['webguifixedmenu']);
215
	}
216

    
217
	if ($_POST['webguihostnamemenu']) {
218
		$config['system']['webgui']['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
219
	} else {
220
		unset($config['system']['webgui']['webguihostnamemenu']);
221
	}
222

    
223
	if ($_POST['dashboardcolumns']) {
224
		$config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns'];
225
	} else {
226
		unset($config['system']['webgui']['dashboardcolumns']);
227
	}
228

    
229
	$config['system']['webgui']['requirestatefilter'] = $_POST['requirestatefilter'] ? true : false;
230

    
231
	if ($_POST['hostname']) {
232
		if (!is_hostname($_POST['hostname'])) {
233
			$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
234
		} else {
235
			if (!is_unqualified_hostname($_POST['hostname'])) {
236
				$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
237
			}
238
		}
239
	}
240
	if ($_POST['domain'] && !is_domain($_POST['domain'])) {
241
		$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
242
	}
243

    
244
	$dnslist = $ignore_posted_dnsgw = array();
245

    
246
	$dnscounter = 0;
247
	$dnsname = "dns{$dnscounter}";
248

    
249
	while (isset($_POST[$dnsname])) {
250
		$dnsgwname = "dnsgw{$dnscounter}";
251
		$dnslist[] = $_POST[$dnsname];
252

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

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

    
279
	$dnscounter = 0;
280
	$dnsname = "dns{$dnscounter}";
281

    
282
	$direct_networks_list = explode(" ", filter_get_direct_networks_list());
283
	while (isset($_POST[$dnsname])) {
284
		$dnsgwname = "dnsgw{$dnscounter}";
285
		if ($_POST[$dnsgwname] && ($_POST[$dnsgwname] <> "none")) {
286
			foreach ($direct_networks_list as $direct_network) {
287
				if (ip_in_subnet($_POST[$dnsname], $direct_network)) {
288
					$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsname]);
289
				}
290
			}
291
		}
292
		$dnscounter++;
293
		$dnsname = "dns{$dnscounter}";
294
	}
295

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

    
305
	if ($input_errors) {
306
		// Put the user-entered list back into place so it will be redisplayed for correction.
307
		$pconfig['dnsserver'] = $dnslist;
308
	} else {
309
		update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
310
		update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
311
		update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
312
		update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
313

    
314
		if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
315
			$config['system']['language'] = $_POST['language'];
316
			set_language();
317
		}
318

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

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

    
325
		unset($config['system']['webgui']['systemlogsfilterpanel']);
326
		$config['system']['webgui']['systemlogsfilterpanel'] = $_POST['systemlogsfilterpanel'] ? true : false;
327

    
328
		unset($config['system']['webgui']['systemlogsmanagelogpanel']);
329
		$config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false;
330

    
331
		unset($config['system']['webgui']['statusmonitoringsettingspanel']);
332
		$config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false;
333

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

    
338
		$dnscounter = 0;
339
		$dnsname = "dns{$dnscounter}";
340

    
341
		while (isset($_POST[$dnsname])) {
342
			if ($_POST[$dnsname]) {
343
				$config['system']['dnsserver'][] = $_POST[$dnsname];
344
			}
345
			$dnscounter++;
346
			$dnsname = "dns{$dnscounter}";
347
		}
348

    
349
		// Remember the new list for display also.
350
		$pconfig['dnsserver'] = $config['system']['dnsserver'];
351

    
352
		$olddnsallowoverride = $config['system']['dnsallowoverride'];
353

    
354
		unset($config['system']['dnsallowoverride']);
355
		$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
356

    
357
		if ($_POST['dnslocalhost'] == "yes") {
358
			$config['system']['dnslocalhost'] = true;
359
		} else {
360
			unset($config['system']['dnslocalhost']);
361
		}
362

    
363
		/* which interface should the dns servers resolve through? */
364
		$dnscounter = 0;
365
		// The $_POST array key of the DNS IP (starts from 0)
366
		$dnsname = "dns{$dnscounter}";
367
		$outdnscounter = 0;
368
		while (isset($_POST[$dnsname])) {
369
			// The $_POST array key of the corresponding gateway (starts from 0)
370
			$dnsgwname = "dnsgw{$dnscounter}";
371
			// The numbering of DNS GW entries in the config starts from 1
372
			$dnsgwconfigcounter = $dnscounter + 1;
373
			// So this is the array key of the DNS GW entry in $config['system']
374
			$dnsgwconfigname = "dns{$dnsgwconfigcounter}gw";
375

    
376
			$olddnsgwname = $config['system'][$dnsgwconfigname];
377

    
378
			if ($ignore_posted_dnsgw[$dnsgwname]) {
379
				$thisdnsgwname = "none";
380
			} else {
381
				$thisdnsgwname = $pconfig[$dnsgwname];
382
			}
383

    
384
			// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
385
			$config['system'][$dnsgwconfigname] = "none";
386
			$pconfig[$dnsgwname] = "none";
387
			$pconfig[$dnsname] = "";
388

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

    
394
				// The $pconfig array key of the DNS IP (starts from 0)
395
				$outdnsname = "dns{$outdnscounter}";
396
				// The $pconfig array key of the corresponding gateway (starts from 0)
397
				$outdnsgwname = "dnsgw{$outdnscounter}";
398
				// The numbering of DNS GW entries in the config starts from 1
399
				$outdnsgwconfigcounter = $outdnscounter + 1;
400
				// So this is the array key of the output DNS GW entry in $config['system']
401
				$outdnsgwconfigname = "dns{$outdnsgwconfigcounter}gw";
402

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

    
424
			$dnscounter++;
425
			// The $_POST array key of the DNS IP (starts from 0)
426
			$dnsname = "dns{$dnscounter}";
427
		}
428

    
429
		if ($changecount > 0) {
430
			write_config($changedesc);
431
		}
432

    
433
		$retval = 0;
434
		$retval = system_hostname_configure();
435
		$retval |= system_hosts_generate();
436
		$retval |= system_resolvconf_generate();
437
		if (isset($config['dnsmasq']['enable'])) {
438
			$retval |= services_dnsmasq_configure();
439
		} elseif (isset($config['unbound']['enable'])) {
440
			$retval |= services_unbound_configure();
441
		}
442
		$retval |= system_timezone_configure();
443
		$retval |= system_ntp_configure();
444

    
445
		if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
446
			$retval |= send_event("service reload dns");
447
		}
448

    
449
		// Reload the filter - plugins might need to be run.
450
		$retval |= filter_configure();
451

    
452
		$savemsg = get_std_save_message($retval);
453
	}
454

    
455
	unset($ignore_posted_dnsgw);
456
}
457

    
458
$pgtitle = array(gettext("System"), gettext("General Setup"));
459
include("head.inc");
460

    
461
if ($input_errors) {
462
	print_input_errors($input_errors);
463
}
464

    
465
if ($savemsg) {
466
	print_info_box($savemsg, 'success');
467
}
468
?>
469
<div id="container">
470
<?php
471

    
472
$form = new Form;
473
$section = new Form_Section('System');
474
$section->addInput(new Form_Input(
475
	'hostname',
476
	'*Hostname',
477
	'text',
478
	$pconfig['hostname'],
479
	['placeholder' => 'pfSense']
480
))->setHelp('Name of the firewall host, without domain part');
481

    
482
$section->addInput(new Form_Input(
483
	'domain',
484
	'*Domain',
485
	'text',
486
	$pconfig['domain'],
487
	['placeholder' => 'mycorp.com, home, office, private, etc.']
488
))->setHelp('Do not use \'local\' as a domain name. It will cause local '.
489
	'hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve '.
490
	'local hosts not running mDNS.');
491

    
492
$form->add($section);
493

    
494
$section = new Form_Section('DNS Server Settings');
495

    
496
if (!is_array($pconfig['dnsserver'])) {
497
	$pconfig['dnsserver'] = array();
498
}
499

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

    
507
// If there are no DNS servers, make an empty entry for initial display.
508
if ($dnsserver_count == 0) {
509
	$pconfig['dnsserver'][] = '';
510
}
511

    
512
foreach ($pconfig['dnsserver'] as $dnsserver) {
513

    
514
	$is_last_dnsserver = ($dnsserver_num == $dnsserver_count - 1);
515
	$group = new Form_Group($dnsserver_num == 0 ? 'DNS Servers':'');
516
	$group->addClass('repeatable');
517

    
518
	$group->add(new Form_Input(
519
		'dns' . $dnsserver_num,
520
		'DNS Server',
521
		'text',
522
		$dnsserver
523
	))->setHelp(($is_last_dnsserver) ? $dnsserver_help:null);
524

    
525
	if ($multiwan)	{
526
		$options = array('none' => 'none');
527

    
528
		foreach ($arr_gateways as $gwname => $gwitem) {
529
			if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
530
				continue;
531
			}
532

    
533
			if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
534
				continue;
535
			}
536

    
537
			$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
538
		}
539

    
540
		$group->add(new Form_Select(
541
			'dnsgw' . $dnsserver_num,
542
			'Gateway',
543
			$pconfig['dnsgw' . $dnsserver_num],
544
			$options
545
		))->setHelp(($is_last_dnsserver) ? $dnsgw_help:null);;
546
	}
547

    
548
	$group->add(new Form_Button(
549
		'deleterow' . $dnsserver_num,
550
		'Delete',
551
		null,
552
		'fa-trash'
553
	))->addClass('btn-warning');
554

    
555
	$section->add($group);
556
	$dnsserver_num++;
557
}
558

    
559
$section->addInput(new Form_Button(
560
	'addrow',
561
	'Add DNS Server',
562
	null,
563
	'fa-plus'
564
))->addClass('btn-success addbtn');
565

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

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

    
586
$form->add($section);
587

    
588
$section = new Form_Section('Localization');
589

    
590
$section->addInput(new Form_Select(
591
	'timezone',
592
	'*Timezone',
593
	$pconfig['timezone'],
594
	array_combine($timezonelist, $timezonedesc)
595
))->setHelp('Select the timezone or location within the timezone to be used by this system. '.
596
	'Usually choose a "Continent/City". Only choose a special or "Etc" entry if you understand why you need to use it.');
597

    
598
$section->addInput(new Form_Input(
599
	'timeservers',
600
	'Timeservers',
601
	'text',
602
	$pconfig['timeservers']
603
))->setHelp('Use a space to separate multiple hosts (only one required). '.
604
	'Remember to set up at least one DNS server if a host name is entered here!');
605

    
606
$section->addInput(new Form_Select(
607
	'language',
608
	'*Language',
609
	$pconfig['language'],
610
	get_locale_list()
611
))->setHelp('Choose a language for the webConfigurator');
612

    
613
$form->add($section);
614

    
615
$section = new Form_Section('webConfigurator');
616

    
617
gen_webguicss_field($section, $pconfig['webguicss']);
618
gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
619
gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
620
gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
621
gen_associatedpanels_fields(
622
	$section,
623
	$pconfig['dashboardavailablewidgetspanel'],
624
	$pconfig['systemlogsfilterpanel'],
625
	$pconfig['systemlogsmanagelogpanel'],
626
	$pconfig['statusmonitoringsettingspanel']);
627
gen_requirestatefilter_field($section, $pconfig['requirestatefilter']);
628
gen_webguileftcolumnhyper_field($section, $pconfig['webguileftcolumnhyper']);
629

    
630
$section->addInput(new Form_Select(
631
	'logincss',
632
	'Login page color',
633
	$pconfig['logincss'],
634
	["1e3f75;" => gettext("Blue"), "003300" => gettext("Green"), "770101" => gettext("Red"),
635
	 "4b1263" => gettext("Purple"), "424142" => gettext("Gray"), "333333" => gettext("Dark gray"),
636
	 "633215" => gettext("Brown" ), "bf7703" => gettext("Orange")]
637
))->setHelp('Choose a color for the login page');
638

    
639
$section->addInput(new Form_Checkbox(
640
	'loginshowhost',
641
	'Login hostname',
642
	'Show hostname on login banner',
643
	$pconfig['loginshowhost']
644
));
645
/*
646
$section->addInput(new Form_Input(
647
	'dashboardperiod',
648
	'Dashboard update period',
649
	'number',
650
	$pconfig['dashboardperiod'],
651
	['min' => '5', 'max' => '600']
652
))->setHelp('Time in seconds between dashboard widget updates. Small values cause ' .
653
			'more frequent updates but increase the load on the web server. ' .
654
			'Minimum is 5 seconds, maximum 600 seconds');
655
*/
656
$form->add($section);
657

    
658
print $form;
659

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

    
662
?>
663
</div>
664

    
665
<script type="text/javascript">
666
//<![CDATA[
667
events.push(function() {
668

    
669
	function setThemeWarning() {
670
		if ($('#webguicss').val().startsWith("pfSense")) {
671
			$('#csstxt').html("").addClass("text-default");
672
		} else {
673
			$('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
674
		}
675
	}
676

    
677
	$('#webguicss').change(function() {
678
		setThemeWarning();
679
	});
680

    
681
	setThemeWarning();
682

    
683
	// Suppress "Delete row" button if there are fewer than two rows
684
	checkLastRow();
685
});
686
//]]>
687
</script>
688

    
689
<?php
690
include("foot.inc");
691
?>
(192-192/233)