Project

General

Profile

Download (27.5 KB) Statistics
| Branch: | Tag: | Revision:
1 04ad7c7c Scott Ullrich
<?php
2 5b237745 Scott Ullrich
/*
3 c5d81585 Renato Botelho
 * system.php
4 191cb31d Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8 a68f7a3d Luiz Otavio O Souza
 * Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
9 c5d81585 Renato Botelho
 * All rights reserved.
10 54c605d4 Stephen Beaver
 *
11 c5d81585 Renato Botelho
 * originally based on m0n0wall (http://m0n0.ch/wall)
12
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
 * All rights reserved.
14 54c605d4 Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
16
 * you may not use this file except in compliance with the License.
17
 * You may obtain a copy of the License at
18 54c605d4 Stephen Beaver
 *
19 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
20 54c605d4 Stephen Beaver
 *
21 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
22
 * distributed under the License is distributed on an "AS IS" BASIS,
23
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
 * See the License for the specific language governing permissions and
25
 * limitations under the License.
26 54c605d4 Stephen Beaver
 */
27 5b237745 Scott Ullrich
28 6b07c15a Matthew Grooms
##|+PRIV
29
##|*IDENT=page-system-generalsetup
30 5230f468 jim-p
##|*NAME=System: General Setup
31 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'System: General Setup' page.
32
##|*MATCH=system.php*
33
##|-PRIV
34
35 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
36 7a927e67 Scott Ullrich
require_once("functions.inc");
37
require_once("filter.inc");
38
require_once("shaper.inc");
39 60ff91f1 Renato Botelho
require_once("system.inc");
40 5b237745 Scott Ullrich
41 63d6bb4f Marcos Mendoza
$pconfig['hostname'] = config_get_path('system/hostname');
42
$pconfig['domain'] = config_get_path('system/domain');
43
$pconfig['dnsserver'] = config_get_path('system/dnsserver');
44 0d8a219e Scott Ullrich
45 4bbbcc36 Marcos Mendoza
$arr_gateways = get_gateways();
46 d623f2da Seth Mos
47 e6367325 Phil Davis
// set default columns to two if unset
48 5ffc4380 Marcos Mendoza
if (!is_numericint(config_get_path('system/webgui/dashboardcolumns'))) {
49 721fafba Christian McDonald
	config_set_path('system/webgui/dashboardcolumns', 2);
50 477db933 Jared Dillard
}
51
52 27db3c75 Phil Davis
// set default language if unset
53 63d6bb4f Marcos Mendoza
if (!config_path_enabled('system', 'language')) {
54 2568e151 Christian McDonald
	config_set_path('system/language', g_get('language'));
55 27db3c75 Phil Davis
}
56
57 7e8bfed2 jim-p
$dnshost_counter = 1;
58
59 63d6bb4f Marcos Mendoza
while (config_path_enabled("system", "dns{$dnshost_counter}host")) {
60 7e8bfed2 jim-p
	$pconfig_dnshost_counter = $dnshost_counter - 1;
61 63d6bb4f Marcos Mendoza
	$pconfig["dnshost{$pconfig_dnshost_counter}"] = config_get_path("system/dns{$dnshost_counter}host");
62 7e8bfed2 jim-p
	$dnshost_counter++;
63
}
64
65 a2d23e88 Phil Davis
$dnsgw_counter = 1;
66
67 63d6bb4f Marcos Mendoza
while (config_get_path("system/dns{$dnsgw_counter}gw") !== null) {
68 a2d23e88 Phil Davis
	$pconfig_dnsgw_counter = $dnsgw_counter - 1;
69 dc459dc9 Marcos Mendoza
	$pconfig["dnsgw{$pconfig_dnsgw_counter}"] = config_get_path("system/dns{$dnsgw_counter}gw");
70 a2d23e88 Phil Davis
	$dnsgw_counter++;
71
}
72 e180a6e3 Scott Ullrich
73 63d6bb4f Marcos Mendoza
$pconfig['dnsallowoverride'] = config_path_enabled('system', 'dnsallowoverride');
74
$pconfig['timezone'] = config_get_path('system/timezone');
75
$pconfig['timeservers'] = config_get_path('system/timeservers');
76
$pconfig['language'] = config_get_path('system/language');
77
$pconfig['webguicss'] = config_get_path('system/webgui/webguicss');
78
$pconfig['logincss'] = config_get_path('system/webgui/logincss');
79
$pconfig['webguifixedmenu'] = config_get_path('system/webgui/webguifixedmenu');
80
$pconfig['dashboardcolumns'] = config_get_path('system/webgui/dashboardcolumns');
81
$pconfig['interfacessort'] = config_path_enabled('system/webgui', 'interfacessort');
82
$pconfig['webguileftcolumnhyper'] = config_path_enabled('system/webgui', 'webguileftcolumnhyper');
83
$pconfig['disablealiaspopupdetail'] = config_path_enabled('system/webgui', 'disablealiaspopupdetail');
84
$pconfig['dashboardavailablewidgetspanel'] = config_path_enabled('system/webgui', 'dashboardavailablewidgetspanel');
85
$pconfig['systemlogsfilterpanel'] = config_path_enabled('system/webgui', 'systemlogsfilterpanel');
86
$pconfig['systemlogsmanagelogpanel'] = config_path_enabled('system/webgui', 'systemlogsmanagelogpanel');
87
$pconfig['statusmonitoringsettingspanel'] = config_path_enabled('system/webgui', 'statusmonitoringsettingspanel');
88
$pconfig['webguihostnamemenu'] = config_get_path('system/webgui/webguihostnamemenu');
89
$pconfig['dnslocalhost'] = config_get_path('system/dnslocalhost');
90 6c1f2a1c Steve Beaver
//$pconfig['dashboardperiod'] = isset($config['widgets']['period']) ? $config['widgets']['period']:"10";
91 63d6bb4f Marcos Mendoza
$pconfig['roworderdragging'] = config_path_enabled('system/webgui', 'roworderdragging');
92
$pconfig['loginshowhost'] = config_path_enabled('system/webgui', 'loginshowhost');
93
$pconfig['requirestatefilter'] = config_path_enabled('system/webgui', 'requirestatefilter');
94
$pconfig['requirefirewallinterface'] = config_path_enabled('system/webgui', 'requirefirewallinterface');
95 8ca95ed8 jim-p
96 2ee8dea1 Phil Davis
if (!$pconfig['timezone']) {
97 2568e151 Christian McDonald
	if (isset($g['default_timezone']) && !empty(g_get('default_timezone'))) {
98
		$pconfig['timezone'] = g_get('default_timezone');
99 ecaca752 Renato Botelho
	} else {
100
		$pconfig['timezone'] = "Etc/UTC";
101
	}
102 2ee8dea1 Phil Davis
}
103 ecaca752 Renato Botelho
104 2ee8dea1 Phil Davis
if (!$pconfig['timeservers']) {
105 5b237745 Scott Ullrich
	$pconfig['timeservers'] = "pool.ntp.org";
106 2ee8dea1 Phil Davis
}
107 04ad7c7c Scott Ullrich
108 79eaddf4 Renato Botelho
$changedesc = gettext("System") . ": ";
109 62d01225 Bill Marquette
$changecount = 0;
110 417c6042 Bill Marquette
111 5b237745 Scott Ullrich
function is_timezone($elt) {
112
	return !preg_match("/\/$/", $elt);
113
}
114
115 2ee8dea1 Phil Davis
if ($pconfig['timezone'] <> $_POST['timezone']) {
116 c6188970 Reid Linnemann
	filter_pflog_start();
117 aa1ab1da Scott Ullrich
}
118
119 60ff91f1 Renato Botelho
$timezonelist = system_get_timezone_list();
120 e5f4c829 Renato Botelho
$timezonedesc = $timezonelist;
121
122
/*
123
 * Etc/GMT entries work the opposite way to what people expect.
124
 * Ref: https://github.com/eggert/tz/blob/master/etcetera and Redmine issue 7089
125
 * Add explanatory text to entries like:
126
 * Etc/GMT+1 and Etc/GMT-1
127
 * but not:
128
 * Etc/GMT or Etc/GMT+0
129
 */
130
foreach ($timezonedesc as $idx => $desc) {
131
	if (substr($desc, 0, 7) != "Etc/GMT" || substr($desc, 8, 1) == "0") {
132
		continue;
133
	}
134
135
	$direction = substr($desc, 7, 1);
136
137
	switch ($direction) {
138
	case '-':
139 88de4ab0 Phil Davis
		$direction_str = gettext('AHEAD of');
140 e5f4c829 Renato Botelho
		break;
141
	case '+':
142
		$direction_str = gettext('BEHIND');
143
		break;
144
	default:
145 86ec819a jim-p
		continue 2;
146 e5f4c829 Renato Botelho
	}
147
148
	$hr_offset = substr($desc, 8);
149 88de4ab0 Phil Davis
	$timezonedesc[$idx] = $desc . " " .
150 d93d8c9c Steve Beaver
	    sprintf(ngettext('(%1$s hour %2$s GMT)', '(%1$s hours %2$s GMT)', intval($hr_offset)), $hr_offset, $direction_str);
151 e5f4c829 Renato Botelho
}
152 5b237745 Scott Ullrich
153 f211d7c0 luckman212
$multiwan = 0;
154 47e079f6 Viktor G
$multiwan6 = 0;
155
foreach ($arr_gateways as $gw) {
156
	if ($gw['ipprotocol'] == 'inet') {
157 f211d7c0 luckman212
		$multiwan++;
158 6038cba7 luckman212
		if ($multiwan > 1) {
159
			break;
160
		}
161 47e079f6 Viktor G
	} else {
162
		$multiwan6++;
163
		if ($multiwan6 > 1) {
164
			break;
165
		}
166 7922db8a Seth Mos
	}
167
}
168 77446beb Matthew Grooms
169 5b237745 Scott Ullrich
if ($_POST) {
170
171 c668c964 Scott Ullrich
	$changecount++;
172 1180e4f0 Sjon Hortensius
173 5b237745 Scott Ullrich
	unset($input_errors);
174
	$pconfig = $_POST;
175
176
	/* input validation */
177 cfbfd941 smos
	$reqdfields = explode(" ", "hostname domain");
178 2ee8dea1 Phil Davis
	$reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
179 04ad7c7c Scott Ullrich
180 1e9b4611 Renato Botelho
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
181 04ad7c7c Scott Ullrich
182 2d86ee95 Phil Davis
	if ($_POST['hostname']) {
183
		if (!is_hostname($_POST['hostname'])) {
184
			$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
185
		} else {
186
			if (!is_unqualified_hostname($_POST['hostname'])) {
187
				$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
188
			}
189
		}
190 5b237745 Scott Ullrich
	}
191 8ee5aa03 Viktor Gurov
	if ($_POST['domain'] && (!is_domain($_POST['domain'], false, false))) {
192 41e0d95f jim-p
		$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.', and it cannot start with '.' or '-'.");
193 5b237745 Scott Ullrich
	}
194 9ceace25 jim-p
	validate_webguicss_field($input_errors, $_POST['webguicss']);
195
	validate_webguifixedmenu_field($input_errors, $_POST['webguifixedmenu']);
196
	validate_webguihostnamemenu_field($input_errors, $_POST['webguihostnamemenu']);
197
	validate_dashboardcolumns_field($input_errors, $_POST['dashboardcolumns']);
198 d623f2da Seth Mos
199 58b07c57 NewEraCracker
	$dnslist = $ignore_posted_dnsgw = array();
200 df4471e2 Phil Davis
201 a2d23e88 Phil Davis
	$dnscounter = 0;
202
	$dnsname = "dns{$dnscounter}";
203
204
	while (isset($_POST[$dnsname])) {
205
		$dnsgwname = "dnsgw{$dnscounter}";
206 7e8bfed2 jim-p
		$dnshostname = "dnshost{$dnscounter}";
207 a936104b Stephen Beaver
		$dnslist[] = $_POST[$dnsname];
208
209 d623f2da Seth Mos
		if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
210 a2d23e88 Phil Davis
			$input_errors[] = sprintf(gettext("A valid IP address must be specified for DNS server %s."), $dnscounter+1);
211 52acb1ff Phil Davis
		} else {
212 7e8bfed2 jim-p
			if (!empty($_POST[$dnshostname]) && !is_hostname($_POST[$dnshostname])) {
213
				$input_errors[] = sprintf(gettext('The hostname provided for DNS server "%1$s" is not valid.'), $_POST[$dnsname]);
214
			}
215 2ee8dea1 Phil Davis
			if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
216 52acb1ff Phil Davis
				// A real gateway has been selected.
217
				if (is_ipaddr($_POST[$dnsname])) {
218 2ee8dea1 Phil Davis
					if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
219 1bab4a10 NOYB
						$input_errors[] = sprintf(gettext('The IPv6 gateway "%1$s" can not be specified for IPv4 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
220 52acb1ff Phil Davis
					}
221 2ee8dea1 Phil Davis
					if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
222 1bab4a10 NOYB
						$input_errors[] = sprintf(gettext('The IPv4 gateway "%1$s" can not be specified for IPv6 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
223 52acb1ff Phil Davis
					}
224
				} else {
225 df4471e2 Phil Davis
					// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
226
					$ignore_posted_dnsgw[$dnsgwname] = true;
227 52acb1ff Phil Davis
				}
228 13ea7caa smos
			}
229 d623f2da Seth Mos
		}
230 a2d23e88 Phil Davis
		$dnscounter++;
231
		$dnsname = "dns{$dnscounter}";
232 5b237745 Scott Ullrich
	}
233 d623f2da Seth Mos
234 c25e42c8 Mark Furneaux
	if (count(array_filter($dnslist)) != count(array_unique(array_filter($dnslist)))) {
235 f700dc99 Chris Buechler
		$input_errors[] = gettext('Each configured DNS server must have a unique IP address. Remove the duplicated IP.');
236
	}
237
238 a2d23e88 Phil Davis
	$dnscounter = 0;
239
	$dnsname = "dns{$dnscounter}";
240
241 985fc0fb Ermal Lu?i
	$direct_networks_list = explode(" ", filter_get_direct_networks_list());
242 a2d23e88 Phil Davis
	while (isset($_POST[$dnsname])) {
243
		$dnsgwname = "dnsgw{$dnscounter}";
244
		if ($_POST[$dnsgwname] && ($_POST[$dnsgwname] <> "none")) {
245 d8587952 Phil Davis
			foreach ($direct_networks_list as $direct_network) {
246 a2d23e88 Phil Davis
				if (ip_in_subnet($_POST[$dnsname], $direct_network)) {
247 86212d70 luckman212
					$input_errors[] = sprintf(gettext("A gateway cannot be specified for %s because that IP address is part of a directly connected subnet %s. To use that nameserver, change its Gateway to `none`."), $_POST[$dnsname], $direct_network);
248 c98d28e1 Seth Mos
				}
249
			}
250
		}
251 a2d23e88 Phil Davis
		$dnscounter++;
252
		$dnsname = "dns{$dnscounter}";
253 c98d28e1 Seth Mos
	}
254
255 8adb814b David P Hilton
	# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
256
	$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
257
	$_POST['timeservers'] = trim($_POST['timeservers']);
258 5b237745 Scott Ullrich
	foreach (explode(' ', $_POST['timeservers']) as $ts) {
259 518fa664 kiokoman
		if (!is_domain($ts) && (!is_ipaddr($ts))) {
260
			$input_errors[] = gettext("NTP Time Server names must be valid domain names, IPv4 addresses, or IPv6 addresses");
261 5b237745 Scott Ullrich
		}
262
	}
263
264 a2d23e88 Phil Davis
	if ($input_errors) {
265
		// Put the user-entered list back into place so it will be redisplayed for correction.
266
		$pconfig['dnsserver'] = $dnslist;
267
	} else {
268 f211d7c0 luckman212
		// input validation passed, so we can proceed with removing static routes for dead DNS gateways
269 63d6bb4f Marcos Mendoza
		if (is_array(config_get_path('system/dnsserver'))) {
270
		  	$dns_servers_arr = config_get_path('system/dnsserver');
271 f211d7c0 luckman212
	 		foreach ($dns_servers_arr as $arr_index => $this_dnsserver) {
272 829322b3 Christian McDonald
				$i = (int)$arr_index + 1;
273
				$this_dnsgw = config_get_path("system/dns{$i}gw");
274 f211d7c0 luckman212
				unset($gatewayip);
275
				unset($inet6);
276
				if ((!empty($this_dnsgw)) && ($this_dnsgw != 'none') && (!empty($this_dnsserver))) {
277
					$gatewayip = lookup_gateway_ip_by_name($this_dnsgw);
278
					$inet6 = is_ipaddrv6($gatewayip) ? '-inet6 ' : '';
279 ded361f5 Viktor G
					mwexec("/sbin/route -q delete -host {$inet6}{$this_dnsserver} " . escapeshellarg($gatewayip));
280 f211d7c0 luckman212
				}
281
			}
282
		}
283
284 63d6bb4f Marcos Mendoza
		$system_config = config_get_path('system');
285
		update_if_changed("hostname", $system_config['hostname'], $_POST['hostname']);
286
		update_if_changed("domain", $system_config['domain'], $_POST['domain']);
287
		update_if_changed("timezone", $system_config['timezone'], $_POST['timezone']);
288
		update_if_changed("NTP servers", $system_config['timeservers'], strtolower($_POST['timeservers']));
289
		config_set_path('system', $system_config);
290 04ad7c7c Scott Ullrich
291 63d6bb4f Marcos Mendoza
		if ($_POST['language'] && $_POST['language'] != config_get_path('system/language')) {
292 721fafba Christian McDonald
			config_set_path('system/language', $_POST['language']);
293 ceecd29b Renato Botelho
			set_language();
294 3e139f90 Vinicius Coque
		}
295
296 6e081414 Christian McDonald
		config_del_path('system/webgui/interfacessort');
297 721fafba Christian McDonald
		config_set_path('system/webgui/interfacessort', $_POST['interfacessort'] ? true : false);
298 1d3510cf Phil Davis
299 6e081414 Christian McDonald
		config_del_path('system/webgui/webguileftcolumnhyper');
300 721fafba Christian McDonald
		config_set_path('system/webgui/webguileftcolumnhyper', $_POST['webguileftcolumnhyper'] ? true : false);
301 24f15b3a NOYB
302 6e081414 Christian McDonald
		config_del_path('system/webgui/disablealiaspopupdetail');
303 721fafba Christian McDonald
		config_set_path('system/webgui/disablealiaspopupdetail', $_POST['disablealiaspopupdetail'] ? true : false);
304 d9058974 Phil Davis
305 6e081414 Christian McDonald
		config_del_path('system/webgui/dashboardavailablewidgetspanel');
306 721fafba Christian McDonald
		config_set_path('system/webgui/dashboardavailablewidgetspanel', $_POST['dashboardavailablewidgetspanel'] ? true : false);
307 c05363c8 NOYB
308 6e081414 Christian McDonald
		config_del_path('system/webgui/systemlogsfilterpanel');
309 721fafba Christian McDonald
		config_set_path('system/webgui/systemlogsfilterpanel', $_POST['systemlogsfilterpanel'] ? true : false);
310 c05363c8 NOYB
311 6e081414 Christian McDonald
		config_del_path('system/webgui/systemlogsmanagelogpanel');
312 721fafba Christian McDonald
		config_set_path('system/webgui/systemlogsmanagelogpanel', $_POST['systemlogsmanagelogpanel'] ? true : false);
313 c05363c8 NOYB
314 6e081414 Christian McDonald
		config_del_path('system/webgui/statusmonitoringsettingspanel');
315 721fafba Christian McDonald
		config_set_path('system/webgui/statusmonitoringsettingspanel', $_POST['statusmonitoringsettingspanel'] ? true : false);
316 b1b8784a NOYB
317 9ceace25 jim-p
//		if ($_POST['dashboardperiod']) {
318
//			$config['widgets']['period'] = $_POST['dashboardperiod'];
319
//		}
320
321
		if ($_POST['webguicss']) {
322 721fafba Christian McDonald
			config_set_path('system/webgui/webguicss', $_POST['webguicss']);
323 9ceace25 jim-p
		} else {
324 6e081414 Christian McDonald
			config_del_path('system/webgui/webguicss');
325 9ceace25 jim-p
		}
326
327 721fafba Christian McDonald
		config_set_path('system/webgui/roworderdragging', $_POST['roworderdragging'] ? true:false);
328 9ceace25 jim-p
329
		if ($_POST['logincss']) {
330 721fafba Christian McDonald
			config_set_path('system/webgui/logincss', $_POST['logincss']);
331 9ceace25 jim-p
		} else {
332 6e081414 Christian McDonald
			config_del_path('system/webgui/logincss');
333 9ceace25 jim-p
		}
334
335 721fafba Christian McDonald
		config_set_path('system/webgui/loginshowhost', $_POST['loginshowhost'] ? true:false);
336 9ceace25 jim-p
337
		if ($_POST['webguifixedmenu']) {
338 721fafba Christian McDonald
			config_set_path('system/webgui/webguifixedmenu', $_POST['webguifixedmenu']);
339 9ceace25 jim-p
		} else {
340 6e081414 Christian McDonald
			config_del_path('system/webgui/webguifixedmenu');
341 9ceace25 jim-p
		}
342
343
		if ($_POST['webguihostnamemenu']) {
344 721fafba Christian McDonald
			config_set_path('system/webgui/webguihostnamemenu', $_POST['webguihostnamemenu']);
345 9ceace25 jim-p
		} else {
346 6e081414 Christian McDonald
			config_del_path('system/webgui/webguihostnamemenu');
347 9ceace25 jim-p
		}
348
349
		if ($_POST['dashboardcolumns']) {
350 721fafba Christian McDonald
			config_set_path('system/webgui/dashboardcolumns', $_POST['dashboardcolumns']);
351 9ceace25 jim-p
		} else {
352 6e081414 Christian McDonald
			config_del_path('system/webgui/dashboardcolumns');
353 9ceace25 jim-p
		}
354
355 721fafba Christian McDonald
		config_set_path('system/webgui/requirestatefilter', $_POST['requirestatefilter'] ? true : false);
356 c4518538 jim-p
		config_set_path('system/webgui/requirefirewallinterface', $_POST['requirefirewallinterface'] ? true : false);
357 9ceace25 jim-p
358 4fbf63aa Bill Marquette
		/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
359 63d6bb4f Marcos Mendoza
		$olddnsservers = config_get_path('system/dnsserver');
360 6e081414 Christian McDonald
		config_del_path('system/dnsserver');
361 a2d23e88 Phil Davis
362
		$dnscounter = 0;
363
		$dnsname = "dns{$dnscounter}";
364
365
		while (isset($_POST[$dnsname])) {
366
			if ($_POST[$dnsname]) {
367 63d6bb4f Marcos Mendoza
				config_set_path('system/dnsserver/', $_POST[$dnsname]);
368 a2d23e88 Phil Davis
			}
369
			$dnscounter++;
370
			$dnsname = "dns{$dnscounter}";
371 2ee8dea1 Phil Davis
		}
372 04ad7c7c Scott Ullrich
373 a2d23e88 Phil Davis
		// Remember the new list for display also.
374 63d6bb4f Marcos Mendoza
		$pconfig['dnsserver'] = config_get_path('system/dnsserver');
375 a2d23e88 Phil Davis
376 63d6bb4f Marcos Mendoza
		$olddnsallowoverride = config_get_path('system/dnsallowoverride');
377 20b90e0a Scott Ullrich
378 6e081414 Christian McDonald
		config_del_path('system/dnsallowoverride');
379 721fafba Christian McDonald
		config_set_path('system/dnsallowoverride', $_POST['dnsallowoverride'] ? true : false);
380 e180a6e3 Scott Ullrich
381 f0c51530 jim-p
		if ($_POST['dnslocalhost']) {
382 721fafba Christian McDonald
			config_set_path('system/dnslocalhost', $_POST['dnslocalhost']);
383 2ee8dea1 Phil Davis
		} else {
384 6e081414 Christian McDonald
			config_del_path('system/dnslocalhost');
385 2ee8dea1 Phil Davis
		}
386 8ca95ed8 jim-p
387 e180a6e3 Scott Ullrich
		/* which interface should the dns servers resolve through? */
388 a2d23e88 Phil Davis
		$dnscounter = 0;
389
		// The $_POST array key of the DNS IP (starts from 0)
390
		$dnsname = "dns{$dnscounter}";
391 df4471e2 Phil Davis
		$outdnscounter = 0;
392 a2d23e88 Phil Davis
		while (isset($_POST[$dnsname])) {
393
			// The $_POST array key of the corresponding gateway (starts from 0)
394
			$dnsgwname = "dnsgw{$dnscounter}";
395 7e8bfed2 jim-p
			$dnshostname = "dnshost{$dnscounter}";
396
			// The numbering of DNS GW/host entries in the config starts from 1
397 a2d23e88 Phil Davis
			$dnsgwconfigcounter = $dnscounter + 1;
398 7e8bfed2 jim-p
			$dnshostconfigcounter = $dnscounter + 1;
399 a2d23e88 Phil Davis
			// So this is the array key of the DNS GW entry in $config['system']
400
			$dnsgwconfigname = "dns{$dnsgwconfigcounter}gw";
401 7e8bfed2 jim-p
			$dnshostconfigname = "dns{$dnshostconfigcounter}host";
402 a2d23e88 Phil Davis
403 829322b3 Christian McDonald
			$olddnsgwname = config_get_path("system/{$dnsgwconfigname}");
404
			$olddnshostname = config_get_path("system/{$dnshostconfigname}");
405 df4471e2 Phil Davis
406 2ee8dea1 Phil Davis
			if ($ignore_posted_dnsgw[$dnsgwname]) {
407 df4471e2 Phil Davis
				$thisdnsgwname = "none";
408 2ee8dea1 Phil Davis
			} else {
409 df4471e2 Phil Davis
				$thisdnsgwname = $pconfig[$dnsgwname];
410 2ee8dea1 Phil Davis
			}
411 7e8bfed2 jim-p
			$thisdnshostname = $pconfig[$dnshostname];
412 df4471e2 Phil Davis
413
			// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
414 63d6bb4f Marcos Mendoza
			config_set_path("system/{$dnsgwconfigname}", 'none');
415 df4471e2 Phil Davis
			$pconfig[$dnsgwname] = "none";
416 63d6bb4f Marcos Mendoza
			config_set_path("system/{$dnshostconfigname}", '');
417 7e8bfed2 jim-p
			$pconfig[$dnshostname] = "";
418 df4471e2 Phil Davis
			$pconfig[$dnsname] = "";
419
420
			if ($_POST[$dnsname]) {
421
				// Only the non-blank DNS servers were put into the config above.
422
				// So we similarly only add the corresponding gateways sequentially to the config (and to pconfig), as we find non-blank DNS servers.
423
				// 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.
424 a2d23e88 Phil Davis
425
				// The $pconfig array key of the DNS IP (starts from 0)
426
				$outdnsname = "dns{$outdnscounter}";
427
				// The $pconfig array key of the corresponding gateway (starts from 0)
428
				$outdnsgwname = "dnsgw{$outdnscounter}";
429 7e8bfed2 jim-p
				// The $pconfig array key of the corresponding hostname (starts from 0)
430
				$outdnshostname = "dnshost{$outdnscounter}";
431
432
				// The numbering of DNS GW/host entries in the config starts from 1
433 a2d23e88 Phil Davis
				$outdnsgwconfigcounter = $outdnscounter + 1;
434 7e8bfed2 jim-p
				$outdnshostconfigcounter = $outdnscounter + 1;
435 a2d23e88 Phil Davis
				// So this is the array key of the output DNS GW entry in $config['system']
436
				$outdnsgwconfigname = "dns{$outdnsgwconfigcounter}gw";
437 7e8bfed2 jim-p
				$outdnshostconfigname = "dns{$outdnshostconfigcounter}host";
438 a2d23e88 Phil Davis
439 df4471e2 Phil Davis
				$pconfig[$outdnsname] = $_POST[$dnsname];
440 2ee8dea1 Phil Davis
				if ($_POST[$dnsgwname]) {
441 63d6bb4f Marcos Mendoza
					config_set_path("system/{$outdnsgwconfigname}", $thisdnsgwname);
442 df4471e2 Phil Davis
					$pconfig[$outdnsgwname] = $thisdnsgwname;
443
				} else {
444
					// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
445 7e3ea4a8 Christian McDonald
					config_del_path("system/{$outdnsgwconfigname}");
446 df4471e2 Phil Davis
					$pconfig[$outdnsgwname] = "";
447 0d192133 jim-p
				}
448
				if ($_POST[$dnshostname]) {
449 63d6bb4f Marcos Mendoza
					config_set_path("system/{$outdnshostconfigname}", $thisdnshostname);
450 0d192133 jim-p
					$pconfig[$outdnshostname] = $thisdnshostname;
451
				} else {
452
					// Note: when no DNS hostname is chosen, unset the value.
453 7e3ea4a8 Christian McDonald
					config_del_path("system/{$outdnshostconfigname}");
454 7e8bfed2 jim-p
					$pconfig[$outdnshostname] = "";
455 df4471e2 Phil Davis
				}
456 a2d23e88 Phil Davis
				$outdnscounter++;
457 d623f2da Seth Mos
			}
458 a2d23e88 Phil Davis
459
			$dnscounter++;
460
			// The $_POST array key of the DNS IP (starts from 0)
461
			$dnsname = "dns{$dnscounter}";
462 d623f2da Seth Mos
		}
463 04ad7c7c Scott Ullrich
464 f211d7c0 luckman212
		// clean up dnsgw orphans
465
		$oldgwcounter = 1;
466
		$olddnsgwconfigname = "dns{$oldgwcounter}gw";
467 63d6bb4f Marcos Mendoza
		while (config_get_path("system/{$olddnsgwconfigname}") !== null) {
468
			if (empty(config_get_path('system/dnsserver/' . ($oldgwcounter - 1)))) {
469 7e3ea4a8 Christian McDonald
				config_del_path("system/{$olddnsgwconfigname}");
470 f211d7c0 luckman212
			}
471
			$oldgwcounter++;
472
			$olddnsgwconfigname = "dns{$oldgwcounter}gw";
473
		}
474
		unset($oldgwcounter);
475
		unset($olddnsgwconfigname);
476
477 2ee8dea1 Phil Davis
		if ($changecount > 0) {
478 62d01225 Bill Marquette
			write_config($changedesc);
479 2ee8dea1 Phil Davis
		}
480 04ad7c7c Scott Ullrich
481 44c42356 Phil Davis
		$changes_applied = true;
482 5b237745 Scott Ullrich
		$retval = 0;
483 44c42356 Phil Davis
		$retval |= system_hostname_configure();
484 3cfdba5f Scott Ullrich
		$retval |= system_hosts_generate();
485
		$retval |= system_resolvconf_generate();
486 63d6bb4f Marcos Mendoza
		if (config_path_enabled('dnsmasq')) {
487 1e2c8821 Warren Baker
			$retval |= services_dnsmasq_configure();
488 63d6bb4f Marcos Mendoza
		} elseif (config_path_enabled('unbound')) {
489 1e2c8821 Warren Baker
			$retval |= services_unbound_configure();
490 2ee8dea1 Phil Davis
		}
491 3cfdba5f Scott Ullrich
		$retval |= system_timezone_configure();
492
		$retval |= system_ntp_configure();
493
494 63d6bb4f Marcos Mendoza
		if ($olddnsallowoverride != config_get_path('system/dnsallowoverride')) {
495 b8292903 Ermal
			$retval |= send_event("service reload dns");
496 2ee8dea1 Phil Davis
		}
497 3cfdba5f Scott Ullrich
498 e7d967d8 Scott Ullrich
		// Reload the filter - plugins might need to be run.
499 0027de0a Ermal Lu?i
		$retval |= filter_configure();
500 5b237745 Scott Ullrich
	}
501 df4471e2 Phil Davis
502
	unset($ignore_posted_dnsgw);
503 5b237745 Scott Ullrich
}
504 4df96eff Scott Ullrich
505 2ee8dea1 Phil Davis
$pgtitle = array(gettext("System"), gettext("General Setup"));
506 4df96eff Scott Ullrich
include("head.inc");
507
508 8f65151c Phil Davis
if ($input_errors) {
509 41ea4cf3 Sjon Hortensius
	print_input_errors($input_errors);
510 8f65151c Phil Davis
}
511 ddb84143 Stephen Beaver
512 44c42356 Phil Davis
if ($changes_applied) {
513
	print_apply_result_box($retval);
514 8f65151c Phil Davis
}
515 5b237745 Scott Ullrich
?>
516 41ea4cf3 Sjon Hortensius
<div id="container">
517 b40bcb23 Sjon Hortensius
<?php
518 1180e4f0 Sjon Hortensius
519 b40bcb23 Sjon Hortensius
$form = new Form;
520 a32c0623 Sjon Hortensius
$section = new Form_Section('System');
521
$section->addInput(new Form_Input(
522 a97531c5 Sjon Hortensius
	'hostname',
523 153c3aa6 Phil Davis
	'*Hostname',
524 a32c0623 Sjon Hortensius
	'text',
525
	$pconfig['hostname'],
526
	['placeholder' => 'pfSense']
527 4b34ebd2 jim-p
))->setHelp('Name of the firewall host, without domain part.');
528 512f2c10 Stephen Beaver
529 a32c0623 Sjon Hortensius
$section->addInput(new Form_Input(
530 a97531c5 Sjon Hortensius
	'domain',
531 153c3aa6 Phil Davis
	'*Domain',
532 a32c0623 Sjon Hortensius
	'text',
533
	$pconfig['domain'],
534 4b34ebd2 jim-p
	['placeholder' => 'home.arpa, example.com, home, office, private, etc.']
535
))->setHelp('Domain name for the firewall.%1$s%1$s' .
536
	'Do not end the domain name with \'.local\' as the final part (Top Level Domain, TLD). ' .
537
	'The \'local\' TLD is %2$swidely used%3$s by mDNS (e.g. Avahi, Bonjour, Rendezvous, Airprint, Airplay) ' .
538 41e0d95f jim-p
	'and some Windows systems and networked devices. ' .
539
	'These will not network correctly if the router uses \'local\' as its TLD. ' .
540 4b34ebd2 jim-p
	'Alternatives such as \'home.arpa\', \'local.lan\', or \'mylocal\' are safe.',
541
	'<br/>',
542 41e0d95f jim-p
	'<a target="_blank" href="https://www.unbound.net/pipermail/unbound-users/2011-March/001735.html">',
543
	'</a>'
544 ef77e40e stilez
);
545 512f2c10 Stephen Beaver
546 b40bcb23 Sjon Hortensius
$form->add($section);
547
548 70dc5cd6 Phil Davis
$section = new Form_Section('DNS Server Settings');
549 b40bcb23 Sjon Hortensius
550 a2d23e88 Phil Davis
if (!is_array($pconfig['dnsserver'])) {
551
	$pconfig['dnsserver'] = array();
552
}
553
554
$dnsserver_count = count($pconfig['dnsserver']);
555
$dnsserver_num = 0;
556
$dnsserver_help = gettext("Address") . '<br/>' . gettext("Enter IP addresses to be used by the system for DNS resolution.") . " " .
557
	gettext("These are also used for the DHCP service, DNS Forwarder and DNS Resolver when it has DNS Query Forwarding enabled.");
558 7e8bfed2 jim-p
$dnshost_help = gettext("Hostname") . '<br/>' . gettext("Enter the DNS Server Hostname for TLS Verification in the DNS Resolver (optional).");
559 a2d23e88 Phil Davis
$dnsgw_help = gettext("Gateway") . '<br/>'. gettext("Optionally select the gateway for each DNS server.") . " " .
560
	gettext("When using multiple WAN connections there should be at least one unique DNS server per gateway.");
561
562
// If there are no DNS servers, make an empty entry for initial display.
563
if ($dnsserver_count == 0) {
564
	$pconfig['dnsserver'][] = '';
565
}
566
567
foreach ($pconfig['dnsserver'] as $dnsserver) {
568 54c605d4 Stephen Beaver
569 05025e63 Steve Beaver
	$is_last_dnsserver = (($dnsserver_num == $dnsserver_count - 1) || $dnsserver_count == 0);
570 a2d23e88 Phil Davis
	$group = new Form_Group($dnsserver_num == 0 ? 'DNS Servers':'');
571
	$group->addClass('repeatable');
572 54c605d4 Stephen Beaver
573
	$group->add(new Form_Input(
574 a2d23e88 Phil Davis
		'dns' . $dnsserver_num,
575 54c605d4 Stephen Beaver
		'DNS Server',
576
		'text',
577 a2d23e88 Phil Davis
		$dnsserver
578
	))->setHelp(($is_last_dnsserver) ? $dnsserver_help:null);
579 b40bcb23 Sjon Hortensius
580 7e8bfed2 jim-p
	$group->add(new Form_Input(
581
		'dnshost' . $dnsserver_num,
582
		'DNS Hostname',
583
		'text',
584
		$pconfig['dnshost' . $dnsserver_num]
585
	))->setHelp(($is_last_dnsserver) ? $dnshost_help:null);
586
587 47e079f6 Viktor G
	if (($multiwan > 1) || ($multiwan6 > 1)) {
588 b40bcb23 Sjon Hortensius
		$options = array('none' => 'none');
589
590 8f65151c Phil Davis
		foreach ($arr_gateways as $gwname => $gwitem) {
591
			if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
592 b40bcb23 Sjon Hortensius
				continue;
593
			}
594 54c605d4 Stephen Beaver
595 8f65151c Phil Davis
			if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
596 b40bcb23 Sjon Hortensius
				continue;
597
			}
598 1180e4f0 Sjon Hortensius
599 b40bcb23 Sjon Hortensius
			$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
600
		}
601 1180e4f0 Sjon Hortensius
602 a97531c5 Sjon Hortensius
		$group->add(new Form_Select(
603 a2d23e88 Phil Davis
			'dnsgw' . $dnsserver_num,
604 e4dd8be4 NOYB
			'Gateway',
605 a2d23e88 Phil Davis
			$pconfig['dnsgw' . $dnsserver_num],
606 a97531c5 Sjon Hortensius
			$options
607 f211d7c0 luckman212
		))->setWidth(4)->setHelp(($is_last_dnsserver) ? $dnsgw_help:null);
608 b40bcb23 Sjon Hortensius
	}
609 1180e4f0 Sjon Hortensius
610 a2d23e88 Phil Davis
	$group->add(new Form_Button(
611
		'deleterow' . $dnsserver_num,
612
		'Delete',
613
		null,
614 e6f78714 Marcos Mendoza
		'fa-solid fa-trash-can'
615 f211d7c0 luckman212
	))->setWidth(2)->addClass('btn-warning');
616 54c605d4 Stephen Beaver
617 b40bcb23 Sjon Hortensius
	$section->add($group);
618 a2d23e88 Phil Davis
	$dnsserver_num++;
619 b40bcb23 Sjon Hortensius
}
620 1180e4f0 Sjon Hortensius
621 a2d23e88 Phil Davis
$section->addInput(new Form_Button(
622
	'addrow',
623
	'Add DNS Server',
624
	null,
625 e6f78714 Marcos Mendoza
	'fa-solid fa-plus'
626 a2d23e88 Phil Davis
))->addClass('btn-success addbtn');
627
628 a005a836 Sjon Hortensius
$section->addInput(new Form_Checkbox(
629 a97531c5 Sjon Hortensius
	'dnsallowoverride',
630 70dc5cd6 Phil Davis
	'DNS Server Override',
631 349e7c67 Viktor G
	'Allow DNS server list to be overridden by DHCP/PPP on WAN or remote OpenVPN server',
632 b40bcb23 Sjon Hortensius
	$pconfig['dnsallowoverride']
633 314a088a Phil Davis
))->setHelp('If this option is set, %s will use DNS servers '.
634 349e7c67 Viktor G
	'assigned by a DHCP/PPP server on WAN or a remote OpenVPN server (if Pull DNS ' .
635
	'option is enabled) for its own purposes (including the DNS Forwarder/DNS Resolver). '.
636 2568e151 Christian McDonald
        'However, they will not be assigned to DHCP clients.', g_get('product_label'));
637 b40bcb23 Sjon Hortensius
638 f0c51530 jim-p
$section->addInput(new Form_Select(
639 a97531c5 Sjon Hortensius
	'dnslocalhost',
640 f0c51530 jim-p
	'DNS Resolution Behavior',
641
	$pconfig['dnslocalhost'],
642
	array(
643
		''       => 'Use local DNS (127.0.0.1), fall back to remote DNS Servers (Default)',
644
		'local'  => 'Use local DNS (127.0.0.1), ignore remote DNS Servers',
645
		'remote' => 'Use remote DNS Servers, ignore local DNS',
646
	)
647
))->setHelp('By default the firewall will use local DNS service (127.0.0.1, DNS '.
648
	'Resolver or Forwarder) as the first DNS server when possible, and it '.
649
	'will fall back to remote DNS servers otherwise. Use this option to '.
650
	'choose alternate behaviors.');
651 b40bcb23 Sjon Hortensius
652
$form->add($section);
653
654 a005a836 Sjon Hortensius
$section = new Form_Section('Localization');
655 512f2c10 Stephen Beaver
656 a005a836 Sjon Hortensius
$section->addInput(new Form_Select(
657 a97531c5 Sjon Hortensius
	'timezone',
658 153c3aa6 Phil Davis
	'*Timezone',
659 a32c0623 Sjon Hortensius
	$pconfig['timezone'],
660 e5f4c829 Renato Botelho
	array_combine($timezonelist, $timezonedesc)
661 781d9ce4 Phil Davis
))->setHelp('Select a geographic region name (Continent/Location) to determine the timezone for the firewall. %1$s' .
662
	'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/>');
663 512f2c10 Stephen Beaver
664 a005a836 Sjon Hortensius
$section->addInput(new Form_Input(
665 a97531c5 Sjon Hortensius
	'timeservers',
666 a32c0623 Sjon Hortensius
	'Timeservers',
667
	'text',
668
	$pconfig['timeservers']
669
))->setHelp('Use a space to separate multiple hosts (only one required). '.
670 1bab4a10 NOYB
	'Remember to set up at least one DNS server if a host name is entered here!');
671 512f2c10 Stephen Beaver
672 a005a836 Sjon Hortensius
$section->addInput(new Form_Select(
673 a97531c5 Sjon Hortensius
	'language',
674 153c3aa6 Phil Davis
	'*Language',
675 a32c0623 Sjon Hortensius
	$pconfig['language'],
676
	get_locale_list()
677
))->setHelp('Choose a language for the webConfigurator');
678 b40bcb23 Sjon Hortensius
679
$form->add($section);
680
681 1176360c k-paulius
$section = new Form_Section('webConfigurator');
682 a5995a8e Stephen Beaver
683 8bab524e Phil Davis
gen_webguicss_field($section, $pconfig['webguicss']);
684
gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
685
gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
686
gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
687 1d3510cf Phil Davis
gen_interfacessort_field($section, $pconfig['interfacessort']);
688 8bab524e Phil Davis
gen_associatedpanels_fields(
689
	$section,
690
	$pconfig['dashboardavailablewidgetspanel'],
691
	$pconfig['systemlogsfilterpanel'],
692
	$pconfig['systemlogsmanagelogpanel'],
693
	$pconfig['statusmonitoringsettingspanel']);
694 88081ea2 derelict-pf
gen_requirestatefilter_field($section, $pconfig['requirestatefilter']);
695 c4518538 jim-p
gen_requirefirewallinterface_field($section, $pconfig['requirefirewallinterface']);
696 8bab524e Phil Davis
gen_webguileftcolumnhyper_field($section, $pconfig['webguileftcolumnhyper']);
697 d9058974 Phil Davis
gen_disablealiaspopupdetail_field($section, $pconfig['disablealiaspopupdetail']);
698 24f15b3a NOYB
699 52e91f70 PiBa-NL
$section->addInput(new Form_Checkbox(
700
	'roworderdragging',
701
	'Disable dragging',
702 86212d70 luckman212
	'Disable dragging of firewall/NAT rules',
703 52e91f70 PiBa-NL
	$pconfig['roworderdragging']
704
))->setHelp('Disables dragging rows to allow selecting and copying row contents and avoid accidental changes.');
705
706 e79ff1ee Steve Beaver
$section->addInput(new Form_Select(
707
	'logincss',
708 d58a7378 Steve Beaver
	'Login page color',
709 e79ff1ee Steve Beaver
	$pconfig['logincss'],
710 1fe82d1d Administrator
	["1e3f75;" => gettext("Dark Blue"), "003300" => gettext("Dark green"), "770101" => gettext("Crimson red"),
711 626aefbe Steve Beaver
	 "4b1263" => gettext("Purple"), "424142" => gettext("Gray"), "333333" => gettext("Dark gray"),
712 1fe82d1d Administrator
	 "000000" => gettext("Black"), "633215" => gettext("Dark brown"), "bf7703" => gettext("Brown"), 
713
	 "008000" => gettext("Green"), "007faa" => gettext("Light Blue"), "dc2a2a" => gettext("Red"),
714
	 "9b59b6" => gettext("Violet")]
715 d58a7378 Steve Beaver
))->setHelp('Choose a color for the login page');
716 e79ff1ee Steve Beaver
717 a22947a4 Steve Beaver
$section->addInput(new Form_Checkbox(
718
	'loginshowhost',
719
	'Login hostname',
720
	'Show hostname on login banner',
721
	$pconfig['loginshowhost']
722
));
723 6c1f2a1c Steve Beaver
/*
724 512f2c10 Stephen Beaver
$section->addInput(new Form_Input(
725
	'dashboardperiod',
726
	'Dashboard update period',
727
	'number',
728
	$pconfig['dashboardperiod'],
729 134ee13d Stephen Beaver
	['min' => '5', 'max' => '600']
730 512f2c10 Stephen Beaver
))->setHelp('Time in seconds between dashboard widget updates. Small values cause ' .
731
			'more frequent updates but increase the load on the web server. ' .
732
			'Minimum is 5 seconds, maximum 600 seconds');
733 6c1f2a1c Steve Beaver
*/
734 a5995a8e Stephen Beaver
$form->add($section);
735
736 b40bcb23 Sjon Hortensius
print $form;
737 7bb301eb Stephen Beaver
738
$csswarning = sprintf(gettext("%sUser-created themes are unsupported, use at your own risk."), "<br />");
739
740 8c4ef875 NOYB
?>
741
</div>
742 7bb301eb Stephen Beaver
743 46345696 Colin Fleming
<script type="text/javascript">
744 7bb301eb Stephen Beaver
//<![CDATA[
745
events.push(function() {
746
747
	function setThemeWarning() {
748
		if ($('#webguicss').val().startsWith("pfSense")) {
749
			$('#csstxt').html("").addClass("text-default");
750
		} else {
751
			$('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
752
		}
753
	}
754
755
	$('#webguicss').change(function() {
756
		setThemeWarning();
757
	});
758
759
	setThemeWarning();
760 a2d23e88 Phil Davis
761
	// Suppress "Delete row" button if there are fewer than two rows
762
	checkLastRow();
763 7bb301eb Stephen Beaver
});
764
//]]>
765
</script>
766
767 8c4ef875 NOYB
<?php
768 60ff91f1 Renato Botelho
include("foot.inc");
769 8c4ef875 NOYB
?>