1
|
<?php
|
2
|
/*
|
3
|
system.php
|
4
|
*/
|
5
|
/* ====================================================================
|
6
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7
|
*
|
8
|
* Some or all of this file is based on the m0n0wall project which is
|
9
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
10
|
*
|
11
|
* Redistribution and use in source and binary forms, with or without modification,
|
12
|
* are permitted provided that the following conditions are met:
|
13
|
*
|
14
|
* 1. Redistributions of source code must retain the above copyright notice,
|
15
|
* this list of conditions and the following disclaimer.
|
16
|
*
|
17
|
* 2. Redistributions in binary form must reproduce the above copyright
|
18
|
* notice, this list of conditions and the following disclaimer in
|
19
|
* the documentation and/or other materials provided with the
|
20
|
* distribution.
|
21
|
*
|
22
|
* 3. All advertising materials mentioning features or use of this software
|
23
|
* must display the following acknowledgment:
|
24
|
* "This product includes software developed by the pfSense Project
|
25
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
26
|
*
|
27
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
28
|
* endorse or promote products derived from this software without
|
29
|
* prior written permission. For written permission, please contact
|
30
|
* coreteam@pfsense.org.
|
31
|
*
|
32
|
* 5. Products derived from this software may not be called "pfSense"
|
33
|
* nor may "pfSense" appear in their names without prior written
|
34
|
* permission of the Electric Sheep Fencing, LLC.
|
35
|
*
|
36
|
* 6. Redistributions of any form whatsoever must retain the following
|
37
|
* acknowledgment:
|
38
|
*
|
39
|
* "This product includes software developed by the pfSense Project
|
40
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
41
|
*
|
42
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
43
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
44
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
45
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
46
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
47
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
48
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
49
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
50
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
51
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
52
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
53
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
54
|
*
|
55
|
* ====================================================================
|
56
|
*
|
57
|
*/
|
58
|
|
59
|
##|+PRIV
|
60
|
##|*IDENT=page-system-generalsetup
|
61
|
##|*NAME=System: General Setup
|
62
|
##|*DESCR=Allow access to the 'System: General Setup' page.
|
63
|
##|*MATCH=system.php*
|
64
|
##|-PRIV
|
65
|
|
66
|
require_once("guiconfig.inc");
|
67
|
require_once("functions.inc");
|
68
|
require_once("filter.inc");
|
69
|
require_once("shaper.inc");
|
70
|
require_once("system.inc");
|
71
|
|
72
|
$pconfig['hostname'] = $config['system']['hostname'];
|
73
|
$pconfig['domain'] = $config['system']['domain'];
|
74
|
list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $config['system']['dnsserver'];
|
75
|
|
76
|
$arr_gateways = return_gateways_array();
|
77
|
|
78
|
// set default columns to two if unset
|
79
|
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
|
80
|
$config['system']['webgui']['dashboardcolumns'] = 2;
|
81
|
}
|
82
|
|
83
|
$pconfig['dns1gw'] = $config['system']['dns1gw'];
|
84
|
$pconfig['dns2gw'] = $config['system']['dns2gw'];
|
85
|
$pconfig['dns3gw'] = $config['system']['dns3gw'];
|
86
|
$pconfig['dns4gw'] = $config['system']['dns4gw'];
|
87
|
|
88
|
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']);
|
89
|
$pconfig['timezone'] = $config['system']['timezone'];
|
90
|
$pconfig['timeservers'] = $config['system']['timeservers'];
|
91
|
$pconfig['language'] = $config['system']['language'];
|
92
|
$pconfig['webguicss'] = $config['system']['webgui']['webguicss'];
|
93
|
$pconfig['webguifixedmenu'] = $config['system']['webgui']['webguifixedmenu'];
|
94
|
$pconfig['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns'];
|
95
|
$pconfig['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']);
|
96
|
$pconfig['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']);
|
97
|
$pconfig['systemlogsfilterpanel'] = isset($config['system']['webgui']['systemlogsfilterpanel']);
|
98
|
$pconfig['systemlogsmanagelogpanel'] = isset($config['system']['webgui']['systemlogsmanagelogpanel']);
|
99
|
$pconfig['statusmonitoringsettingspanel'] = isset($config['system']['webgui']['statusmonitoringsettingspanel']);
|
100
|
$pconfig['webguihostnamemenu'] = $config['system']['webgui']['webguihostnamemenu'];
|
101
|
$pconfig['dnslocalhost'] = isset($config['system']['dnslocalhost']);
|
102
|
|
103
|
if (!$pconfig['timezone']) {
|
104
|
if (isset($g['default_timezone']) && !empty($g['default_timezone'])) {
|
105
|
$pconfig['timezone'] = $g['default_timezone'];
|
106
|
} else {
|
107
|
$pconfig['timezone'] = "Etc/UTC";
|
108
|
}
|
109
|
}
|
110
|
|
111
|
if (!$pconfig['timeservers']) {
|
112
|
$pconfig['timeservers'] = "pool.ntp.org";
|
113
|
}
|
114
|
|
115
|
$changedesc = gettext("System") . ": ";
|
116
|
$changecount = 0;
|
117
|
|
118
|
function is_timezone($elt) {
|
119
|
return !preg_match("/\/$/", $elt);
|
120
|
}
|
121
|
|
122
|
if ($pconfig['timezone'] <> $_POST['timezone']) {
|
123
|
filter_pflog_start(true);
|
124
|
}
|
125
|
|
126
|
$timezonelist = system_get_timezone_list();
|
127
|
|
128
|
$multiwan = false;
|
129
|
$interfaces = get_configured_interface_list();
|
130
|
foreach ($interfaces as $interface) {
|
131
|
if (interface_has_gateway($interface)) {
|
132
|
$multiwan = true;
|
133
|
}
|
134
|
}
|
135
|
|
136
|
if ($_POST) {
|
137
|
|
138
|
$changecount++;
|
139
|
|
140
|
unset($input_errors);
|
141
|
$pconfig = $_POST;
|
142
|
|
143
|
/* input validation */
|
144
|
$reqdfields = explode(" ", "hostname domain");
|
145
|
$reqdfieldsn = array(gettext("Hostname"), gettext("Domain"));
|
146
|
|
147
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
148
|
|
149
|
if ($_POST['webguicss']) {
|
150
|
$config['system']['webgui']['webguicss'] = $_POST['webguicss'];
|
151
|
} else {
|
152
|
unset($config['system']['webgui']['webguicss']);
|
153
|
}
|
154
|
|
155
|
if ($_POST['webguifixedmenu']) {
|
156
|
$config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu'];
|
157
|
} else {
|
158
|
unset($config['system']['webgui']['webguifixedmenu']);
|
159
|
}
|
160
|
|
161
|
if ($_POST['webguihostnamemenu']) {
|
162
|
$config['system']['webgui']['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
|
163
|
} else {
|
164
|
unset($config['system']['webgui']['webguihostnamemenu']);
|
165
|
}
|
166
|
|
167
|
if ($_POST['dashboardcolumns']) {
|
168
|
$config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns'];
|
169
|
} else {
|
170
|
unset($config['system']['webgui']['dashboardcolumns']);
|
171
|
}
|
172
|
|
173
|
if ($_POST['hostname']) {
|
174
|
if (!is_hostname($_POST['hostname'])) {
|
175
|
$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
|
176
|
} else {
|
177
|
if (!is_unqualified_hostname($_POST['hostname'])) {
|
178
|
$input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
|
179
|
}
|
180
|
}
|
181
|
}
|
182
|
if ($_POST['domain'] && !is_domain($_POST['domain'])) {
|
183
|
$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
|
184
|
}
|
185
|
|
186
|
$dnslist = $ignore_posted_dnsgw = array();
|
187
|
|
188
|
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
|
189
|
$dnsname="dns{$dnscounter}";
|
190
|
$dnsgwname="dns{$dnscounter}gw";
|
191
|
$dnslist[] = $_POST[$dnsname];
|
192
|
|
193
|
if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) {
|
194
|
$input_errors[] = sprintf(gettext("A valid IP address must be specified for DNS server %s."), $dnscounter);
|
195
|
} else {
|
196
|
if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) {
|
197
|
// A real gateway has been selected.
|
198
|
if (is_ipaddr($_POST[$dnsname])) {
|
199
|
if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
|
200
|
$input_errors[] = sprintf(gettext('The IPv6 gateway "%1$s" can not be specified for IPv4 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
|
201
|
}
|
202
|
if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) {
|
203
|
$input_errors[] = sprintf(gettext('The IPv4 gateway "%1$s" can not be specified for IPv6 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]);
|
204
|
}
|
205
|
} else {
|
206
|
// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
|
207
|
$ignore_posted_dnsgw[$dnsgwname] = true;
|
208
|
}
|
209
|
}
|
210
|
}
|
211
|
}
|
212
|
|
213
|
if (count(array_filter($dnslist)) != count(array_unique(array_filter($dnslist)))) {
|
214
|
$input_errors[] = gettext('Each configured DNS server must have a unique IP address. Remove the duplicated IP.');
|
215
|
}
|
216
|
|
217
|
$direct_networks_list = explode(" ", filter_get_direct_networks_list());
|
218
|
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
|
219
|
$dnsitem = "dns{$dnscounter}";
|
220
|
$dnsgwitem = "dns{$dnscounter}gw";
|
221
|
if ($_POST[$dnsgwitem]) {
|
222
|
if (interface_has_gateway($_POST[$dnsgwitem])) {
|
223
|
foreach ($direct_networks_list as $direct_network) {
|
224
|
if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
|
225
|
$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
|
226
|
}
|
227
|
}
|
228
|
}
|
229
|
}
|
230
|
}
|
231
|
|
232
|
# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
|
233
|
$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
|
234
|
$_POST['timeservers'] = trim($_POST['timeservers']);
|
235
|
foreach (explode(' ', $_POST['timeservers']) as $ts) {
|
236
|
if (!is_domain($ts)) {
|
237
|
$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
|
238
|
}
|
239
|
}
|
240
|
|
241
|
if (!$input_errors) {
|
242
|
update_if_changed("hostname", $config['system']['hostname'], $_POST['hostname']);
|
243
|
update_if_changed("domain", $config['system']['domain'], $_POST['domain']);
|
244
|
update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']);
|
245
|
update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers']));
|
246
|
|
247
|
if ($_POST['language'] && $_POST['language'] != $config['system']['language']) {
|
248
|
$config['system']['language'] = $_POST['language'];
|
249
|
set_language();
|
250
|
}
|
251
|
|
252
|
unset($config['system']['webgui']['webguileftcolumnhyper']);
|
253
|
$config['system']['webgui']['webguileftcolumnhyper'] = $_POST['webguileftcolumnhyper'] ? true : false;
|
254
|
|
255
|
unset($config['system']['webgui']['dashboardavailablewidgetspanel']);
|
256
|
$config['system']['webgui']['dashboardavailablewidgetspanel'] = $_POST['dashboardavailablewidgetspanel'] ? true : false;
|
257
|
|
258
|
unset($config['system']['webgui']['systemlogsfilterpanel']);
|
259
|
$config['system']['webgui']['systemlogsfilterpanel'] = $_POST['systemlogsfilterpanel'] ? true : false;
|
260
|
|
261
|
unset($config['system']['webgui']['systemlogsmanagelogpanel']);
|
262
|
$config['system']['webgui']['systemlogsmanagelogpanel'] = $_POST['systemlogsmanagelogpanel'] ? true : false;
|
263
|
|
264
|
unset($config['system']['webgui']['statusmonitoringsettingspanel']);
|
265
|
$config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false;
|
266
|
|
267
|
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
|
268
|
$olddnsservers = $config['system']['dnsserver'];
|
269
|
unset($config['system']['dnsserver']);
|
270
|
if ($_POST['dns1']) {
|
271
|
$config['system']['dnsserver'][] = $_POST['dns1'];
|
272
|
}
|
273
|
if ($_POST['dns2']) {
|
274
|
$config['system']['dnsserver'][] = $_POST['dns2'];
|
275
|
}
|
276
|
if ($_POST['dns3']) {
|
277
|
$config['system']['dnsserver'][] = $_POST['dns3'];
|
278
|
}
|
279
|
if ($_POST['dns4']) {
|
280
|
$config['system']['dnsserver'][] = $_POST['dns4'];
|
281
|
}
|
282
|
|
283
|
$olddnsallowoverride = $config['system']['dnsallowoverride'];
|
284
|
|
285
|
unset($config['system']['dnsallowoverride']);
|
286
|
$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
|
287
|
|
288
|
if ($_POST['dnslocalhost'] == "yes") {
|
289
|
$config['system']['dnslocalhost'] = true;
|
290
|
} else {
|
291
|
unset($config['system']['dnslocalhost']);
|
292
|
}
|
293
|
|
294
|
/* which interface should the dns servers resolve through? */
|
295
|
$outdnscounter = 0;
|
296
|
for ($dnscounter=1; $dnscounter<5; $dnscounter++) {
|
297
|
$dnsname="dns{$dnscounter}";
|
298
|
$dnsgwname="dns{$dnscounter}gw";
|
299
|
$olddnsgwname = $config['system'][$dnsgwname];
|
300
|
|
301
|
if ($ignore_posted_dnsgw[$dnsgwname]) {
|
302
|
$thisdnsgwname = "none";
|
303
|
} else {
|
304
|
$thisdnsgwname = $pconfig[$dnsgwname];
|
305
|
}
|
306
|
|
307
|
// "Blank" out the settings for this index, then we set them below using the "outdnscounter" index.
|
308
|
$config['system'][$dnsgwname] = "none";
|
309
|
$pconfig[$dnsgwname] = "none";
|
310
|
$pconfig[$dnsname] = "";
|
311
|
|
312
|
if ($_POST[$dnsname]) {
|
313
|
// Only the non-blank DNS servers were put into the config above.
|
314
|
// So we similarly only add the corresponding gateways sequentially to the config (and to pconfig), as we find non-blank DNS servers.
|
315
|
// 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.
|
316
|
$outdnscounter++;
|
317
|
$outdnsname="dns{$outdnscounter}";
|
318
|
$outdnsgwname="dns{$outdnscounter}gw";
|
319
|
$pconfig[$outdnsname] = $_POST[$dnsname];
|
320
|
if ($_POST[$dnsgwname]) {
|
321
|
$config['system'][$outdnsgwname] = $thisdnsgwname;
|
322
|
$pconfig[$outdnsgwname] = $thisdnsgwname;
|
323
|
} else {
|
324
|
// Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
|
325
|
unset($config['system'][$outdnsgwname]);
|
326
|
$pconfig[$outdnsgwname] = "";
|
327
|
}
|
328
|
}
|
329
|
if (($olddnsgwname != "") && ($olddnsgwname != "none") && (($olddnsgwname != $thisdnsgwname) || ($olddnsservers[$dnscounter-1] != $_POST[$dnsname]))) {
|
330
|
// A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
|
331
|
// Remove the route. Later calls will add the correct new route if needed.
|
332
|
if (is_ipaddrv4($olddnsservers[$dnscounter-1])) {
|
333
|
mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter-1]));
|
334
|
} else if (is_ipaddrv6($olddnsservers[$dnscounter-1])) {
|
335
|
mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter-1]));
|
336
|
}
|
337
|
}
|
338
|
}
|
339
|
|
340
|
if ($changecount > 0) {
|
341
|
write_config($changedesc);
|
342
|
}
|
343
|
|
344
|
$retval = 0;
|
345
|
$retval = system_hostname_configure();
|
346
|
$retval |= system_hosts_generate();
|
347
|
$retval |= system_resolvconf_generate();
|
348
|
if (isset($config['dnsmasq']['enable'])) {
|
349
|
$retval |= services_dnsmasq_configure();
|
350
|
} elseif (isset($config['unbound']['enable'])) {
|
351
|
$retval |= services_unbound_configure();
|
352
|
}
|
353
|
$retval |= system_timezone_configure();
|
354
|
$retval |= system_ntp_configure();
|
355
|
|
356
|
if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
|
357
|
$retval |= send_event("service reload dns");
|
358
|
}
|
359
|
|
360
|
// Reload the filter - plugins might need to be run.
|
361
|
$retval |= filter_configure();
|
362
|
|
363
|
$savemsg = get_std_save_message($retval);
|
364
|
}
|
365
|
|
366
|
unset($ignore_posted_dnsgw);
|
367
|
}
|
368
|
|
369
|
$pgtitle = array(gettext("System"), gettext("General Setup"));
|
370
|
include("head.inc");
|
371
|
|
372
|
if ($input_errors) {
|
373
|
print_input_errors($input_errors);
|
374
|
}
|
375
|
|
376
|
if ($savemsg) {
|
377
|
print_info_box($savemsg, 'success');
|
378
|
}
|
379
|
?>
|
380
|
<div id="container">
|
381
|
<?php
|
382
|
|
383
|
$form = new Form;
|
384
|
$section = new Form_Section('System');
|
385
|
$section->addInput(new Form_Input(
|
386
|
'hostname',
|
387
|
'Hostname',
|
388
|
'text',
|
389
|
$pconfig['hostname'],
|
390
|
['placeholder' => 'pfSense']
|
391
|
))->setHelp('Name of the firewall host, without domain part');
|
392
|
$section->addInput(new Form_Input(
|
393
|
'domain',
|
394
|
'Domain',
|
395
|
'text',
|
396
|
$pconfig['domain'],
|
397
|
['placeholder' => 'mycorp.com, home, office, private, etc.']
|
398
|
))->setHelp('Do not use \'local\' as a domain name. It will cause local '.
|
399
|
'hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve '.
|
400
|
'local hosts not running mDNS.');
|
401
|
$form->add($section);
|
402
|
|
403
|
$section = new Form_Section('DNS Server Settings');
|
404
|
|
405
|
for ($i=1; $i<5; $i++) {
|
406
|
// if (!isset($pconfig['dns'.$i]))
|
407
|
// continue;
|
408
|
|
409
|
$group = new Form_Group('DNS Server ' . $i);
|
410
|
|
411
|
$group->add(new Form_Input(
|
412
|
'dns' . $i,
|
413
|
'DNS Server',
|
414
|
'text',
|
415
|
$pconfig['dns'. $i]
|
416
|
))->setHelp(($i == 4) ? 'Address':null);
|
417
|
|
418
|
$help = "Enter IP addresses to be used by the system for DNS resolution. " .
|
419
|
"These are also used for the DHCP service, DNS forwarder and for PPTP VPN clients.";
|
420
|
|
421
|
if ($multiwan) {
|
422
|
$options = array('none' => 'none');
|
423
|
|
424
|
foreach ($arr_gateways as $gwname => $gwitem) {
|
425
|
if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) {
|
426
|
continue;
|
427
|
}
|
428
|
|
429
|
if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) {
|
430
|
continue;
|
431
|
}
|
432
|
|
433
|
$options[$gwname] = $gwname.' - '.$gwitem['friendlyiface'].' - '.$gwitem['gateway'];
|
434
|
}
|
435
|
|
436
|
$group->add(new Form_Select(
|
437
|
'dns' . $i . 'gw',
|
438
|
'Gateway',
|
439
|
$pconfig['dns' . $i . 'gw'],
|
440
|
$options
|
441
|
))->setHelp(($i == 4) ? 'Gateway':null);;
|
442
|
|
443
|
$help .= '<br/>'. "In addition, optionally select the gateway for each DNS server. " .
|
444
|
"When using multiple WAN connections there should be at least one unique DNS server per gateway.";
|
445
|
}
|
446
|
|
447
|
if ($i == 4) {
|
448
|
$group->setHelp($help);
|
449
|
}
|
450
|
|
451
|
$section->add($group);
|
452
|
}
|
453
|
|
454
|
$section->addInput(new Form_Checkbox(
|
455
|
'dnsallowoverride',
|
456
|
'DNS Server Override',
|
457
|
'Allow DNS server list to be overridden by DHCP/PPP on WAN',
|
458
|
$pconfig['dnsallowoverride']
|
459
|
))->setHelp(sprintf(gettext('If this option is set, %s will use DNS servers '.
|
460
|
'assigned by a DHCP/PPP server on WAN for its own purposes (including '.
|
461
|
'the DNS forwarder). However, they will not be assigned to DHCP and PPTP '.
|
462
|
'VPN clients.'), $g['product_name']));
|
463
|
|
464
|
$section->addInput(new Form_Checkbox(
|
465
|
'dnslocalhost',
|
466
|
'Disable DNS Forwarder',
|
467
|
'Do not use the DNS Forwarder as a DNS server for the firewall',
|
468
|
$pconfig['dnslocalhost']
|
469
|
))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS '.
|
470
|
'server where the DNS Forwarder or DNS Resolver is enabled and set to '.
|
471
|
'listen on Localhost, so system can use the local DNS service to perform '.
|
472
|
'lookups. Checking this box omits localhost from the list of DNS servers.');
|
473
|
|
474
|
$form->add($section);
|
475
|
|
476
|
$section = new Form_Section('Localization');
|
477
|
$section->addInput(new Form_Select(
|
478
|
'timezone',
|
479
|
'Timezone',
|
480
|
$pconfig['timezone'],
|
481
|
array_combine($timezonelist, $timezonelist)
|
482
|
))->setHelp('Select the timezone or location within the timezone to be used by this system.');
|
483
|
$section->addInput(new Form_Input(
|
484
|
'timeservers',
|
485
|
'Timeservers',
|
486
|
'text',
|
487
|
$pconfig['timeservers']
|
488
|
))->setHelp('Use a space to separate multiple hosts (only one required). '.
|
489
|
'Remember to set up at least one DNS server if a host name is entered here!');
|
490
|
$section->addInput(new Form_Select(
|
491
|
'language',
|
492
|
'Language',
|
493
|
$pconfig['language'],
|
494
|
get_locale_list()
|
495
|
))->setHelp('Choose a language for the webConfigurator');
|
496
|
|
497
|
$form->add($section);
|
498
|
|
499
|
$csslist = array();
|
500
|
|
501
|
// List pfSense files, then any BETA files followed by any user-contributed files
|
502
|
$cssfiles = glob("/usr/local/www/css/*.css");
|
503
|
|
504
|
if(is_array($cssfiles)) {
|
505
|
arsort($cssfiles);
|
506
|
$usrcss = $pfscss = $betacss = array();
|
507
|
|
508
|
foreach ($cssfiles as $css) {
|
509
|
if (strpos($css, "BETA") != 0) {
|
510
|
array_push($betacss, $css);
|
511
|
} else if (strpos($css, "pfSense") != 0) {
|
512
|
array_push($pfscss, $css);
|
513
|
} else {
|
514
|
array_push($usrcss, $css);
|
515
|
}
|
516
|
}
|
517
|
|
518
|
$css = array_merge($pfscss, $betacss, $usrcss);
|
519
|
|
520
|
foreach ($css as $file) {
|
521
|
$file = basename($file);
|
522
|
$csslist[$file] = pathinfo($file, PATHINFO_FILENAME);
|
523
|
}
|
524
|
}
|
525
|
|
526
|
if (!isset($pconfig['webguicss']) || !isset($csslist[$pconfig['webguicss']])) {
|
527
|
$pconfig['webguicss'] = "pfSense.css";
|
528
|
}
|
529
|
|
530
|
$section = new Form_Section('webConfigurator');
|
531
|
|
532
|
$section->addInput(new Form_Select(
|
533
|
'webguicss',
|
534
|
'Theme',
|
535
|
$pconfig['webguicss'],
|
536
|
$csslist
|
537
|
))->setHelp(sprintf(gettext('Choose an alternative css file (if installed) to change the appearance of the webConfigurator. css files are located in /usr/local/www/css/%s'), '<span id="csstxt"></span>'));
|
538
|
|
539
|
$section->addInput(new Form_Select(
|
540
|
'webguifixedmenu',
|
541
|
'Top Navigation',
|
542
|
$pconfig['webguifixedmenu'],
|
543
|
["" => gettext("Scrolls with page"), "fixed" => gettext("Fixed (Remains visible at top of page)")]
|
544
|
))->setHelp("The fixed option is intended for large screens only.");
|
545
|
|
546
|
$section->addInput(new Form_Select(
|
547
|
'webguihostnamemenu',
|
548
|
'Hostname in Menu',
|
549
|
$pconfig['webguihostnamemenu'],
|
550
|
["" => gettext("Default (No hostname)"), "hostonly" => gettext("Hostname only"), "fqdn" => gettext("Fully Qualified Domain Name")]
|
551
|
))->setHelp("Replaces the Help menu title in the Navbar with the system hostname or FQDN.");
|
552
|
|
553
|
$section->addInput(new Form_Input(
|
554
|
'dashboardcolumns',
|
555
|
'Dashboard Columns',
|
556
|
'number',
|
557
|
$pconfig['dashboardcolumns'],
|
558
|
[min => 1, max => 4]
|
559
|
));
|
560
|
|
561
|
$group = new Form_Group('Associated Panels Show/Hide');
|
562
|
|
563
|
$group->add(new Form_Checkbox(
|
564
|
'dashboardavailablewidgetspanel',
|
565
|
null,
|
566
|
'Available Widgets',
|
567
|
$pconfig['dashboardavailablewidgetspanel']
|
568
|
))->setHelp('Show the Available Widgets panel on the Dashboard.');
|
569
|
|
570
|
$group->add(new Form_Checkbox(
|
571
|
'systemlogsfilterpanel',
|
572
|
null,
|
573
|
'Log Filter',
|
574
|
$pconfig['systemlogsfilterpanel']
|
575
|
))->setHelp('Show the Log Filter panel in System Logs.');
|
576
|
|
577
|
$group->add(new Form_Checkbox(
|
578
|
'systemlogsmanagelogpanel',
|
579
|
null,
|
580
|
'Manage Log',
|
581
|
$pconfig['systemlogsmanagelogpanel']
|
582
|
))->setHelp('Show the Manage Log panel in System Logs.');
|
583
|
|
584
|
$group->add(new Form_Checkbox(
|
585
|
'statusmonitoringsettingspanel',
|
586
|
null,
|
587
|
'Monitoring Settings',
|
588
|
$pconfig['statusmonitoringsettingspanel']
|
589
|
))->setHelp('Show the Settings panel in Status Monitoring.');
|
590
|
|
591
|
$group->setHelp('These options allow certain panels to be automatically hidden on page load. A control is provided in the title bar to un-hide the panel.');
|
592
|
|
593
|
$section->add($group);
|
594
|
|
595
|
$section->addInput(new Form_Checkbox(
|
596
|
'webguileftcolumnhyper',
|
597
|
'Left Column Labels',
|
598
|
'Active',
|
599
|
$pconfig['webguileftcolumnhyper']
|
600
|
))->setHelp('If selected, clicking a label in the left column will select/toggle the first item of the group.');
|
601
|
|
602
|
$form->add($section);
|
603
|
|
604
|
print $form;
|
605
|
|
606
|
$csswarning = sprintf(gettext("%sUser-created themes are unsupported, use at your own risk."), "<br />");
|
607
|
|
608
|
?>
|
609
|
</div>
|
610
|
|
611
|
<script>
|
612
|
//<![CDATA[
|
613
|
events.push(function() {
|
614
|
|
615
|
function setThemeWarning() {
|
616
|
if ($('#webguicss').val().startsWith("pfSense")) {
|
617
|
$('#csstxt').html("").addClass("text-default");
|
618
|
} else {
|
619
|
$('#csstxt').html("<?=$csswarning?>").addClass("text-danger");
|
620
|
}
|
621
|
}
|
622
|
|
623
|
$('#webguicss').change(function() {
|
624
|
setThemeWarning();
|
625
|
});
|
626
|
|
627
|
setThemeWarning();
|
628
|
});
|
629
|
//]]>
|
630
|
</script>
|
631
|
|
632
|
<?php
|
633
|
include("foot.inc");
|
634
|
?>
|