1
|
<?php
|
2
|
/*
|
3
|
* head.inc
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2013 BSD Perimeter
|
7
|
* Copyright (c) 2013-2016 Electric Sheep Fencing
|
8
|
* Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
|
9
|
* All rights reserved.
|
10
|
*
|
11
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
* you may not use this file except in compliance with the License.
|
13
|
* You may obtain a copy of the License at
|
14
|
*
|
15
|
* http://www.apache.org/licenses/LICENSE-2.0
|
16
|
*
|
17
|
* Unless required by applicable law or agreed to in writing, software
|
18
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
* See the License for the specific language governing permissions and
|
21
|
* limitations under the License.
|
22
|
*/
|
23
|
|
24
|
require_once("globals.inc");
|
25
|
require_once("functions.inc");
|
26
|
require_once("shortcuts.inc");
|
27
|
require_once("service-utils.inc");
|
28
|
require_once('notices.inc');
|
29
|
|
30
|
header('Content-Type: text/html; charset=utf-8');
|
31
|
|
32
|
$pagetitle = gentitle($pgtitle);
|
33
|
$system_url = $config['system']['hostname'] . "." . $config['system']['domain'];
|
34
|
|
35
|
if ($user_settings['webgui']['pagenamefirst']) {
|
36
|
$tabtitle = $pagetitle . " - " . htmlspecialchars($system_url);
|
37
|
} else {
|
38
|
$tabtitle = htmlspecialchars($system_url) . " - " . $pagetitle;
|
39
|
}
|
40
|
|
41
|
$cssfile = "/css/pfSense.css";
|
42
|
|
43
|
if (isset($user_settings['webgui']['webguicss'])) {
|
44
|
if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) {
|
45
|
$cssfile = "/css/" . $user_settings['webgui']['webguicss'];
|
46
|
}
|
47
|
}
|
48
|
|
49
|
// set default columns to two if unset
|
50
|
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
|
51
|
$config['system']['webgui']['dashboardcolumns'] = 2;
|
52
|
}
|
53
|
|
54
|
?>
|
55
|
<!DOCTYPE html>
|
56
|
<html lang="en">
|
57
|
<head>
|
58
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
59
|
|
60
|
<link rel="apple-touch-icon-precomposed" href="/apple-touch/apple-touch-icon-iphone-60x60-precomposed.png">
|
61
|
<link rel="apple-touch-icon-precomposed" sizes="60x60" href="/apple-touch/apple-touch-icon-ipad-76x76-precomposed.png">
|
62
|
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch/apple-touch-icon-iphone-retina-120x120-precomposed.png">
|
63
|
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch/apple-touch-icon-ipad-retina-152x152-precomposed.png">
|
64
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
65
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
66
|
<link rel="manifest" href="/manifest.json">
|
67
|
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
|
68
|
<meta name="theme-color" content="#ffffff">
|
69
|
|
70
|
<link rel="stylesheet" href="/vendor/font-awesome/css/all.min.css?v=<?=filemtime('/usr/local/www/vendor/font-awesome/css/all.min.css')?>">
|
71
|
<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css?v=<?=filemtime('/usr/local/www/vendor/sortable/sortable-theme-bootstrap.css')?>">
|
72
|
<link rel="stylesheet" href="/vendor/jquery-treegrid/css/jquery.treegrid.css?v=<?=filemtime('/usr/local/www/vendor/jquery-treegrid/css/jquery.treegrid.css')?>">
|
73
|
<link rel="stylesheet" href="<?=$cssfile?>?v=<?=filemtime('/usr/local/www/' . $cssfile)?>" />
|
74
|
|
75
|
<title><?=$tabtitle?></title>
|
76
|
<script type="text/javascript">
|
77
|
//<![CDATA[
|
78
|
var events = events || [];
|
79
|
//]]>
|
80
|
</script>
|
81
|
</head>
|
82
|
|
83
|
<?php
|
84
|
|
85
|
/* Determine automated help URL. Should output the page name and parameters
|
86
|
separately */
|
87
|
$uri_split = "";
|
88
|
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
|
89
|
|
90
|
/* If there was no match, there were no parameters, just grab the filename
|
91
|
Otherwise, use the matched filename from above. */
|
92
|
if (empty($uri_split[0])) {
|
93
|
$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
|
94
|
} else {
|
95
|
$pagename = $uri_split[1];
|
96
|
}
|
97
|
|
98
|
/* If the page name is still empty, the user must have requested / (index.php) */
|
99
|
if (empty($pagename)) {
|
100
|
$pagename = "index.php";
|
101
|
}
|
102
|
|
103
|
/* If the filename is pkg_edit.php or wizard.php, reparse looking
|
104
|
for the .xml filename */
|
105
|
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
|
106
|
$param_split = explode('&', $uri_split[2]);
|
107
|
foreach ($param_split as $param) {
|
108
|
if (substr($param, 0, 4) == "xml=") {
|
109
|
$xmlfile = explode('=', $param);
|
110
|
$pagename = $xmlfile[1];
|
111
|
}
|
112
|
}
|
113
|
} else if ($pagename == "status_logs.php") {
|
114
|
$param_split = explode('&', $uri_split[2]);
|
115
|
foreach ($param_split as $param) {
|
116
|
if (substr($param, 0, 8) == "logfile=") {
|
117
|
$logtype = explode('=', $param);
|
118
|
$pagename .= '-' . $logtype[1];
|
119
|
}
|
120
|
}
|
121
|
}
|
122
|
|
123
|
// Build the full help URL.
|
124
|
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
|
125
|
|
126
|
/*
|
127
|
* Read files from $g['ext_menu_path']/*.xml and fill an array with menu info
|
128
|
*/
|
129
|
function read_ext_menu_path_data() {
|
130
|
global $g;
|
131
|
|
132
|
$result = array();
|
133
|
|
134
|
if (!is_dir(g_get('ext_menu_path'))) {
|
135
|
return $result;
|
136
|
}
|
137
|
|
138
|
foreach (glob("{$g['ext_menu_path']}/*.xml") as $menu_xml) {
|
139
|
$xml_data = parse_xml_config_pkg($menu_xml, "packagegui");
|
140
|
if (empty($xml_data['menu'])) {
|
141
|
continue;
|
142
|
}
|
143
|
foreach ($xml_data['menu'] as $menu) {
|
144
|
$result[] = $menu;
|
145
|
}
|
146
|
}
|
147
|
|
148
|
return $result;
|
149
|
}
|
150
|
|
151
|
// Create a menu entry of any installed packages in the specified category
|
152
|
// (Now reads the menu information from $config['installedpackages']['menu'] only)
|
153
|
function return_ext_menu($section) {
|
154
|
global $config, $ext_menu_path_data;
|
155
|
|
156
|
$htmltext = "";
|
157
|
$extarray = array();
|
158
|
$ext_menu_entries = array();
|
159
|
|
160
|
if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
|
161
|
foreach (config_get_path('installedpackages/menu', []) as $menu) {
|
162
|
if (isset($menu['name']) && ($menu['name'] != "AutoConfigBackup")) { // AutoConfigBackup was moved to a built-in function
|
163
|
// print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
|
164
|
if (isset($menu['section']) && ($menu['section'] == $section)) {
|
165
|
$ext_menu_entries[] = $menu;
|
166
|
}
|
167
|
}
|
168
|
}
|
169
|
}
|
170
|
|
171
|
foreach ($ext_menu_path_data as $menu) {
|
172
|
if ($menu['section'] == $section) {
|
173
|
$ext_menu_entries[] = $menu;
|
174
|
}
|
175
|
}
|
176
|
|
177
|
foreach ($ext_menu_entries as $menu) {
|
178
|
if ($menu['url'] != "") {
|
179
|
$test_url = $menu['url'];
|
180
|
$addresswithport = getenv("HTTP_HOST");
|
181
|
$colonpos = strpos($addresswithport, ":");
|
182
|
|
183
|
if ($colonpos !== false) {
|
184
|
//my url is actually just the IP address of the pfsense box
|
185
|
$myurl = substr($addresswithport, 0, $colonpos);
|
186
|
} else {
|
187
|
$myurl = $addresswithport;
|
188
|
}
|
189
|
$description = str_replace('$myurl', $myurl, $menu['url']);
|
190
|
} else {
|
191
|
$description = '/pkg.php?xml=' . $menu['configfile'];
|
192
|
$test_url=$description;
|
193
|
}
|
194
|
|
195
|
if (isAllowedPage($test_url)) {
|
196
|
$extarray[] = array($menu['name'], $description);
|
197
|
}
|
198
|
}
|
199
|
|
200
|
return $extarray;
|
201
|
}
|
202
|
|
203
|
function output_menu($arrayitem, $target = null, $section = "") {
|
204
|
$output = "";
|
205
|
|
206
|
foreach ($arrayitem as $item) {
|
207
|
|
208
|
/* If the user has access to help pages, also show the full help menu. See #5909 */
|
209
|
if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" ||
|
210
|
(($section == "Help") && isAllowedPage("help.php")) ||
|
211
|
(substr($item[1], 0, 8) == "https://")) {
|
212
|
$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
|
213
|
|
214
|
if ($target) {
|
215
|
$attr .= sprintf(" target=\"%s\"", htmlentities($target));
|
216
|
}
|
217
|
|
218
|
$class = "navlnk";
|
219
|
|
220
|
if ($item['class']) {
|
221
|
$class .= " {$item['class']}";
|
222
|
}
|
223
|
|
224
|
$attr .= sprintf(" class=\"%s\"", htmlentities($class));
|
225
|
|
226
|
if ($item['style']) {
|
227
|
$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
|
228
|
}
|
229
|
|
230
|
|
231
|
if ($item[0] == '-DIVIDER-') {
|
232
|
$output .= ' <li class="divider"></li>';
|
233
|
} else {
|
234
|
$output .= "<li>". sprintf("<a %s %s>%s</a>", $attr, ($item[1] == "/index.php?logout") ? "usepost":"",$item[0]) . "</li>\n";
|
235
|
}
|
236
|
}
|
237
|
}
|
238
|
|
239
|
return $output;
|
240
|
}
|
241
|
|
242
|
$ext_menu_path_data = read_ext_menu_path_data();
|
243
|
|
244
|
// System
|
245
|
$system_menu = array();
|
246
|
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
|
247
|
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
|
248
|
$system_menu[] = array(gettext("General Setup"), "/system.php");
|
249
|
$system_menu[] = array(gettext("High Availability"), "/system_hasync.php");
|
250
|
$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
|
251
|
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
|
252
|
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
|
253
|
|
254
|
if (isAllowedPage("system_camanager.php")) {
|
255
|
$system_menu[] = array(gettext("Certificates"), "/system_camanager.php");
|
256
|
} elseif (isAllowedPage("system_certmanager.php")) {
|
257
|
$system_menu[] = array(gettext("Certificates"), "/system_certmanager.php");
|
258
|
} elseif (isAllowedPage("system_crlmanager.php")) {
|
259
|
$system_menu[] = array(gettext("Certificates"), "/system_crlmanager.php");
|
260
|
}
|
261
|
|
262
|
$system_menu[] = array(gettext("Register"), "/system_register.php");
|
263
|
|
264
|
if (isAllowedPage("system_usermanager.php")) {
|
265
|
$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
|
266
|
}
|
267
|
|
268
|
if (isAllowedPage("system_usermanager_passwordmg.php")) {
|
269
|
$system_menu[] = array(gettext("User Password Manager"), "/system_usermanager_passwordmg.php");
|
270
|
}
|
271
|
|
272
|
if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php")) {
|
273
|
$system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
|
274
|
}
|
275
|
|
276
|
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
|
277
|
|
278
|
/* ensure Logout is the last item in the menu */
|
279
|
$system_menu[] = array(gettext("Logout") . " (" . $_SESSION['Username'] . ")", "/index.php?logout");
|
280
|
|
281
|
// Interfaces
|
282
|
// NOTE:
|
283
|
// Now that menus are sorted, adding a DIVIDER must be done after the sorting so an array is formed of the
|
284
|
// items above the divider and another for below it. These are then sorted and combined with the divider
|
285
|
$interfaces_menu = array();
|
286
|
$interfaces_top = array();
|
287
|
$interfaces_bottom = array();
|
288
|
|
289
|
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
|
290
|
$interfaces_top[] = array(gettext("Assignments"), "/interfaces_assign.php");
|
291
|
$div = true;
|
292
|
}
|
293
|
|
294
|
$platform = system_identify_specific_platform();
|
295
|
|
296
|
if ($platform['name'] == "uFW") {
|
297
|
$interfaces_top[] = array(gettext("Switches"), "/switch_system.php");
|
298
|
}
|
299
|
|
300
|
$opts = get_configured_interface_with_descr(true);
|
301
|
|
302
|
foreach ($opts as $oif => $odescr) {
|
303
|
if (!isset($config['interfaces'][$oif]['ovpn'])) {
|
304
|
$interfaces_bottom[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
|
305
|
}
|
306
|
}
|
307
|
|
308
|
$interfaces_bottom = array_merge($interfaces_bottom, return_ext_menu("Interfaces"));
|
309
|
|
310
|
if ($user_settings['webgui']['interfacessort']) {
|
311
|
$interfaces_bottom = msort($interfaces_bottom, 0);
|
312
|
}
|
313
|
|
314
|
// Combine the top section, the divider and the bottom section of this menu
|
315
|
$interfaces_menu = array_merge($interfaces_top, [array(0 => "-DIVIDER-")], $interfaces_bottom);
|
316
|
|
317
|
// Firewall
|
318
|
$firewall_menu = array();
|
319
|
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
|
320
|
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
|
321
|
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
|
322
|
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
|
323
|
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
|
324
|
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
|
325
|
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
|
326
|
|
327
|
// Services
|
328
|
$services_menu = array();
|
329
|
$services_menu[] = array(gettext("Auto Config Backup"), "/services_acb_settings.php");
|
330
|
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
|
331
|
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
|
332
|
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
|
333
|
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
|
334
|
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
|
335
|
|
336
|
if (g_get('services_dhcp_server_enable')) {
|
337
|
$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
|
338
|
$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server")), "/services_dhcpv6.php");
|
339
|
}
|
340
|
|
341
|
$services_menu[] = [gettext('Router Advertisement'), '/services_radvd.php'];
|
342
|
|
343
|
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
|
344
|
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
|
345
|
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
|
346
|
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
|
347
|
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
|
348
|
|
349
|
if (count($config['interfaces']) > 1) {
|
350
|
/* no use for UPnP in single-interface deployments
|
351
|
remove to reduce user confusion
|
352
|
*/
|
353
|
$services_menu[] = array(gettext("UPnP & NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
|
354
|
}
|
355
|
|
356
|
$services_menu[] = array(gettext("Wake-on-LAN"), "/services_wol.php");
|
357
|
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
|
358
|
|
359
|
// VPN
|
360
|
$vpn_menu = array();
|
361
|
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
|
362
|
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
|
363
|
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
|
364
|
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
|
365
|
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
|
366
|
|
367
|
// Status
|
368
|
$status_menu = array();
|
369
|
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
|
370
|
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
|
371
|
$status_menu[] = array(gettext("Dashboard"), "/index.php");
|
372
|
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
|
373
|
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
|
374
|
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
|
375
|
$status_menu[] = array(gettext("DNS Resolver"), "/status_unbound.php");
|
376
|
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php?user=true");
|
377
|
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
|
378
|
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
|
379
|
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
|
380
|
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
|
381
|
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
|
382
|
$status_menu[] = array(gettext("Services"), "/status_services.php");
|
383
|
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
|
384
|
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php");
|
385
|
|
386
|
if (count($config['interfaces']) > 1) {
|
387
|
$status_menu[] = array(gettext("UPnP & NAT-PMP"), "/status_upnp.php");
|
388
|
}
|
389
|
|
390
|
$wifdescrs = array();
|
391
|
$ifentries = get_configured_interface_with_descr();
|
392
|
foreach ($ifentries as $ent => $entdesc) {
|
393
|
if (is_array($config['interfaces'][$ent]['wireless']) &&
|
394
|
preg_match(g_get('wireless_regex'), $config['interfaces'][$ent]['if'])) {
|
395
|
$wifdescrs[$ent] = $entdesc;
|
396
|
}
|
397
|
}
|
398
|
|
399
|
if (count($wifdescrs) > 0) {
|
400
|
$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
|
401
|
}
|
402
|
|
403
|
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
|
404
|
|
405
|
// Diagnostics
|
406
|
$diagnostics_menu = array();
|
407
|
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
|
408
|
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
|
409
|
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
|
410
|
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
|
411
|
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
|
412
|
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
|
413
|
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
|
414
|
|
415
|
if (file_exists("/var/run/gmirror_active")) {
|
416
|
$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
|
417
|
}
|
418
|
|
419
|
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
|
420
|
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
|
421
|
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
|
422
|
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
|
423
|
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
|
424
|
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
|
425
|
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
|
426
|
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
|
427
|
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
|
428
|
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
|
429
|
$diagnostics_menu[] = array(gettext("S.M.A.R.T. Status"), "/diag_smart.php");
|
430
|
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
|
431
|
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
|
432
|
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
|
433
|
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
|
434
|
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
|
435
|
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
|
436
|
|
437
|
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
|
438
|
|
439
|
if (!g_get('disablehelpmenu')) {
|
440
|
$help_menu = array();
|
441
|
$help_menu[] = array(gettext("About this Page"), $helpurl);
|
442
|
if (g_get('product_name') == "pfSense") {
|
443
|
$help_menu[] = array(gettext("Bug Database"), "https://redirects.netgate.com/issues");
|
444
|
}
|
445
|
|
446
|
$help_menu[] = array(gettext("User Forum"), "https://redirects.netgate.com/forum");
|
447
|
$help_menu[] = array(gettext("Documentation"), "https://redirects.netgate.com/docs");
|
448
|
$help_menu[] = array(gettext("Paid Support"), "https://redirects.netgate.com/support");
|
449
|
$help_menu[] = array(gettext("pfSense Book"), "https://redirects.netgate.com/book");
|
450
|
$help_menu[] = array(gettext("FreeBSD Handbook"), "https://redirects.netgate.com/fbsdhandbook");
|
451
|
$help_menu[] = array(gettext("User survey"), "https://redirects.netgate.com/survey_1");
|
452
|
if (strpos(g_get('product_label'), 'Plus') === false) {
|
453
|
$help_menu[] = array(gettext("Upgrade to pfSense Plus"), "https://redirects.netgate.com/upgrade");
|
454
|
}
|
455
|
$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
|
456
|
}
|
457
|
|
458
|
$menuclass = "static";
|
459
|
$menuclass_dropdown = '';
|
460
|
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
|
461
|
$menuclass = "fixed";
|
462
|
$menuclass_dropdown = ' dropdown-menu-fixed';
|
463
|
}
|
464
|
|
465
|
$numColumns = (int) $user_settings['webgui']['dashboardcolumns'];
|
466
|
|
467
|
if (($pagename === "index.php") && ($numColumns > 2)) {
|
468
|
$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
|
469
|
}
|
470
|
|
471
|
$display_notices = false;
|
472
|
$allow_clear_notices = false;
|
473
|
|
474
|
if (are_notices_pending()) {
|
475
|
// Evaluate user privs to determine if notices should be displayed, and if the user can clear them.
|
476
|
$user_entry = getUserEntry($_SESSION['Username']);
|
477
|
if (isAdminUID($_SESSION['Username']) || userHasPrivilege($user_entry, "user-view-clear-notices") || userHasPrivilege($user_entry, "page-all")) {
|
478
|
$display_notices = true;
|
479
|
$allow_clear_notices = true;
|
480
|
} elseif (userHasPrivilege($user_entry, "user-view-notices")) {
|
481
|
$display_notices = true;
|
482
|
}
|
483
|
}
|
484
|
?>
|
485
|
<body id="<?=$numColumns?>">
|
486
|
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
|
487
|
<div class="container">
|
488
|
<div class="navbar-header">
|
489
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
|
490
|
<span class="sr-only">Toggle navigation</span>
|
491
|
<span class="icon-bar"></span>
|
492
|
<span class="icon-bar"></span>
|
493
|
<span class="icon-bar"></span>
|
494
|
</button>
|
495
|
<a class="navbar-brand" href="/">
|
496
|
<?php include("/usr/local/www/logo.svg"); ?>
|
497
|
<span style="color:white;font-size:.5em;text-transform:uppercase;letter-spacing:1px;">Community Edition</span>
|
498
|
</a>
|
499
|
</div>
|
500
|
<div class="collapse navbar-collapse" id="pf-navbar">
|
501
|
<ul class="nav navbar-nav">
|
502
|
<?php
|
503
|
if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
|
504
|
$help_menu_title = htmlspecialchars($config['system']['hostname']);
|
505
|
}
|
506
|
elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
|
507
|
$help_menu_title = htmlspecialchars($system_url);
|
508
|
}
|
509
|
else {
|
510
|
$help_menu_title = 'Help';
|
511
|
}
|
512
|
foreach ([
|
513
|
['name' => 'System', 'menu' => $system_menu, 'href' => null],
|
514
|
['name' => 'Interfaces', 'menu' => $interfaces_menu, 'href' => null],
|
515
|
['name' => 'Firewall', 'menu' => $firewall_menu, 'href' => null],
|
516
|
['name' => 'Services', 'menu' => $services_menu, 'href' => null],
|
517
|
['name' => 'VPN', 'menu' => $vpn_menu, 'href' => null],
|
518
|
['name' => 'Status', 'menu' => $status_menu, 'href' => null],
|
519
|
['name' => 'Diagnostics', 'menu' => $diagnostics_menu, 'href' => null],
|
520
|
['name' => $help_menu_title, 'menu' => $help_menu, 'href' => '_blank']
|
521
|
] as $item):
|
522
|
if ($item['name'] == 'Help' && g_get('disablehelpmenu')) {
|
523
|
continue;
|
524
|
}
|
525
|
|
526
|
$menu_output = output_menu($item['menu'], $item['href'], $item['name']);
|
527
|
|
528
|
if (strlen($menu_output) > 0):
|
529
|
?>
|
530
|
<li class="dropdown">
|
531
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
532
|
<?=gettext($item['name'])?>
|
533
|
<span class="caret"></span>
|
534
|
</a>
|
535
|
<ul class="dropdown-menu<?=$menuclass_dropdown?>" role="menu"><?=$menu_output?></ul>
|
536
|
</li>
|
537
|
|
538
|
<?php
|
539
|
endif;
|
540
|
endforeach?>
|
541
|
</ul>
|
542
|
<ul class="nav navbar-nav navbar-right">
|
543
|
<?php if ($display_notices):?>
|
544
|
<?php $notices = get_notices()?>
|
545
|
<li class="dropdown">
|
546
|
<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
|
547
|
<i class="fa-solid fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
|
548
|
<span class="badge bg-danger"><?=count($notices)?></span>
|
549
|
</a>
|
550
|
</li>
|
551
|
<?php
|
552
|
endif;
|
553
|
?>
|
554
|
<li class="dropdown">
|
555
|
<a href="/index.php?logout" usepost>
|
556
|
<i class="fa-solid fa-right-from-bracket" title="<?=gettext("Logout") . " (" . $_SESSION['Username'] . "@" . htmlspecialchars($system_url) . ")"?>"></i>
|
557
|
</a>
|
558
|
</li>
|
559
|
</ul>
|
560
|
</div>
|
561
|
</div>
|
562
|
</nav>
|
563
|
|
564
|
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
|
565
|
|
566
|
<?php
|
567
|
/* Password Security warnings */
|
568
|
|
569
|
/* Setup user index to determine index IDs for user manager links. */
|
570
|
$userindex = index_users();
|
571
|
|
572
|
/* Gather info about the current user */
|
573
|
$cu = getUserEntry($_SESSION['Username']);
|
574
|
|
575
|
/* When logging in as non-admin user, warn about admin account password
|
576
|
* if the user has sufficient access to do correct the problem.
|
577
|
* Do not test the account if it is in a disabled state. */
|
578
|
if (($_SESSION['Username'] != 'admin') &&
|
579
|
!is_account_disabled('admin')) {
|
580
|
/* Check the admin password */
|
581
|
$error = check_current_password('admin');
|
582
|
|
583
|
/* Only print a warning if the user has sufficient access to
|
584
|
* address the problem. */
|
585
|
if ($error &&
|
586
|
isAllowedPage('system_usermanager.php')) {
|
587
|
print('<div class="alert alert-danger">' .
|
588
|
sprintf(gettext('%sWARNING:%s%s The \'admin\' account password is insecure. %s%s' .
|
589
|
' %sChange the password in the User Manager as soon as possible.%s'),
|
590
|
'<strong>', '</strong>', '<br/>',
|
591
|
$error, '<br/>',
|
592
|
'<a href="/system_usermanager.php?act=edit&userid=' . $userindex['admin'] . '">', '</a>') .
|
593
|
'</div>');
|
594
|
}
|
595
|
}
|
596
|
|
597
|
/* When logging in as any user, check the password for their account. */
|
598
|
$error = check_current_password($_SESSION['Username']);
|
599
|
|
600
|
/* Determine where to send the user to change their password
|
601
|
* based on their account privileges. */
|
602
|
$target_page = "";
|
603
|
if (isAllowedPage('system_usermanager_passwordmg.php')) {
|
604
|
/* User has access to the self-service password manager, which
|
605
|
* is the ideal destination. */
|
606
|
$target_page = 'system_usermanager_passwordmg.php';
|
607
|
} elseif (isAllowedPage('system_usermanager.php')) {
|
608
|
/* User does not have access to the self-service page but has
|
609
|
* access to the main user manager page, so use that instead. */
|
610
|
$target_page = 'system_usermanager.php?act=edit&userid=' . $userindex[$_SESSION['Username']];
|
611
|
}
|
612
|
|
613
|
/* Print a warning only if the user has sufficient access to change
|
614
|
* their own password (non-empty target page). */
|
615
|
if ($error &&
|
616
|
!empty($target_page)) {
|
617
|
print('<div class="alert alert-danger">' .
|
618
|
sprintf(gettext('%sWARNING:%s%s The password for this account is insecure. %s%s' .
|
619
|
' %sChange the password as soon as possible.%s'),
|
620
|
'<strong>', '</strong>', '<br/>',
|
621
|
$error, '<br/>',
|
622
|
'<a href="/' . $target_page . '">', '</a>') .
|
623
|
'</div>');
|
624
|
}
|
625
|
|
626
|
/* End Password Security Warnings */
|
627
|
?>
|
628
|
|
629
|
<header class="header">
|
630
|
|
631
|
<?php
|
632
|
// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
|
633
|
if (isset($notitle)) {
|
634
|
print('<br />');
|
635
|
unset($notitle);
|
636
|
} else {
|
637
|
if (isset($pglinks)) {
|
638
|
print(genhtmltitle($pgtitle, $pglinks));
|
639
|
} else {
|
640
|
print(genhtmltitle($pgtitle));
|
641
|
}
|
642
|
}
|
643
|
?>
|
644
|
<ul class="context-links">
|
645
|
|
646
|
<?php if (isset($widgets)): ?>
|
647
|
<li>
|
648
|
<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
|
649
|
<i class="fa-solid fa-save icon-pointer"></i>
|
650
|
</a>
|
651
|
</li>
|
652
|
<?php endif?>
|
653
|
|
654
|
<?php if ($dashboard_available_widgets_hidden): ?>
|
655
|
<li>
|
656
|
<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
|
657
|
<i class="fa-solid fa-plus icon-pointer"></i>
|
658
|
</a>
|
659
|
</li>
|
660
|
<?php endif?>
|
661
|
|
662
|
<?php if ($system_logs_filter_form_hidden): ?>
|
663
|
<li>
|
664
|
<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
|
665
|
<i class="fa-solid fa-filter icon-pointer"></i>
|
666
|
</a>
|
667
|
</li>
|
668
|
<?php endif ?>
|
669
|
|
670
|
<?php if ($system_logs_manage_log_form_hidden):
|
671
|
/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
|
672
|
if (isAllowedPage("status_logs_settings.php")) {
|
673
|
?>
|
674
|
<li>
|
675
|
<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
|
676
|
<i class="fa-solid fa-wrench icon-pointer"></i>
|
677
|
</a>
|
678
|
</li>
|
679
|
<?php }
|
680
|
endif
|
681
|
?>
|
682
|
|
683
|
<?php if ($monitoring_settings_form_hidden): ?>
|
684
|
<li>
|
685
|
<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
|
686
|
<i class="fa-solid fa-wrench icon-pointer"></i>
|
687
|
</a>
|
688
|
</li>
|
689
|
<?php endif?>
|
690
|
|
691
|
<?php if ($status_monitoring): ?>
|
692
|
<li>
|
693
|
<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
|
694
|
<i class="fa-solid fa-arrow-rotate-right icon-pointer"></i>
|
695
|
</a>
|
696
|
</li>
|
697
|
<li>
|
698
|
<a class="export-graph" id="export-graph" title="<?=gettext("Export Graph")?>">
|
699
|
<i class="fa-solid fa-download icon-pointer"></i>
|
700
|
</a>
|
701
|
</li>
|
702
|
<?php endif?>
|
703
|
|
704
|
<?php
|
705
|
/* Determine shortcut section for XML-based packages */
|
706
|
if (empty($shortcut_section) && !empty($xmlfile)) {
|
707
|
$shortcut_section = basename($pagename, '.xml');
|
708
|
}
|
709
|
|
710
|
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
|
711
|
$ssvc = array();
|
712
|
switch ($shortcut_section) {
|
713
|
case "openvpn":
|
714
|
$ssvc = find_service_by_openvpn_vpnid($vpnid);
|
715
|
break;
|
716
|
case "captiveportal":
|
717
|
$ssvc = find_service_by_cp_zone($cpzone);
|
718
|
break;
|
719
|
default:
|
720
|
$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
|
721
|
}
|
722
|
if (!empty($ssvc)) {
|
723
|
// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
|
724
|
echo '<li>'. get_service_control_links($ssvc, false). '</li>';
|
725
|
}
|
726
|
}
|
727
|
|
728
|
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
|
729
|
echo '<li>' . $link . '</li>';
|
730
|
}
|
731
|
|
732
|
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
|
733
|
echo '<li>' . $link . '</li>';
|
734
|
}
|
735
|
|
736
|
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
|
737
|
echo '<li>' . $link . '</li>';
|
738
|
}
|
739
|
|
740
|
?>
|
741
|
<?php if (!g_get('disablehelpicon') && isAllowedPage("help.php")): ?>
|
742
|
<li>
|
743
|
<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
|
744
|
<i class="fa-solid fa-question-circle"></i>
|
745
|
</a>
|
746
|
</li>
|
747
|
<?php endif?>
|
748
|
</ul>
|
749
|
</header>
|
750
|
<?php
|
751
|
/* if upgrade in progress, alert user */
|
752
|
$warning_text = "";
|
753
|
if (file_exists('/conf/needs_package_sync') && platform_booting()) {
|
754
|
$warning_text = sprintf(gettext(
|
755
|
'%1$s%3$s is booting, then packages will be reinstalled in the ' .
|
756
|
'background.%2$s%1$sDo not make changes in the GUI until this is ' .
|
757
|
'complete.%2$s'), '<p>', '</p>', g_get('product_label'));
|
758
|
} elseif (is_subsystem_dirty('packagelock')) {
|
759
|
$pgtitle = array(gettext("System"), gettext("Package Manager"));
|
760
|
$warning_text = sprintf(gettext('%1$sPackages are currently being ' .
|
761
|
'reinstalled in the background.%2$s%1$sDo not make changes in ' .
|
762
|
'the GUI until this is complete.%2$s'), '<p>', '</p>');
|
763
|
$warning_text .= sprintf(gettext('%1$sIf the above message is still ' .
|
764
|
'displayed after a couple of hours, use the \'Clear Package ' .
|
765
|
'Lock\' button on the %3$s page and reinstall packages manually.' .
|
766
|
'%2$s'), '<p>', '</p>', sprintf('<a href="diag_backup.php" ' .
|
767
|
'title="%1$s > %2$s">%1$s > %2$s</a>', gettext('Diagnostics'),
|
768
|
htmlspecialchars(gettext('Backup & Restore'))));
|
769
|
}
|
770
|
|
771
|
if (!empty($warning_text)) {
|
772
|
print_info_box($warning_text);
|
773
|
}
|
774
|
|
775
|
/* If this page is being remotely managed then do not allow the loading of the contents. */
|
776
|
if ($config['remote_managed_pages']['item']) {
|
777
|
foreach (config_get_path('remote_managed_pages/item', []) as $rmp) {
|
778
|
if ($rmp == $_SERVER['SCRIPT_NAME']) {
|
779
|
print_info_box(gettext("This page is currently being managed by a remote machine."));
|
780
|
include("foot.inc");
|
781
|
exit;
|
782
|
}
|
783
|
}
|
784
|
}
|
785
|
|
786
|
// Modal notices window
|
787
|
// The notices modal needs to be outside of the page display div or things get messy
|
788
|
if ($display_notices):
|
789
|
?>
|
790
|
|
791
|
<div id="notices" class="modal fade" role="dialog">
|
792
|
<div class="modal-dialog">
|
793
|
<div class="modal-content">
|
794
|
<div class="modal-header">
|
795
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
796
|
<span aria-hidden="true">×</span>
|
797
|
</button>
|
798
|
|
799
|
<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
|
800
|
</div>
|
801
|
|
802
|
<div class="modal-body">
|
803
|
<?php
|
804
|
$noticeCategories = array();
|
805
|
|
806
|
if (is_array($notices)) {
|
807
|
foreach ($notices as $time => $notice) {
|
808
|
if (!isset($noticeCategories[ $notice['category'] ])) {
|
809
|
$noticeCategories[ $notice['category'] ] = array();
|
810
|
}
|
811
|
|
812
|
$notice['time'] = $time;
|
813
|
array_push($noticeCategories[ $notice['category'] ], $notice);
|
814
|
}
|
815
|
}
|
816
|
|
817
|
foreach ($noticeCategories as $category => $catNotices):?>
|
818
|
<h4><?=$category?></h4>
|
819
|
<ul>
|
820
|
<?php
|
821
|
foreach ($catNotices as $notice):
|
822
|
?>
|
823
|
<li>
|
824
|
<b>
|
825
|
<?php if (!empty($notice['url'])):?>
|
826
|
<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
|
827
|
<?php endif;?>
|
828
|
</b>
|
829
|
<?=str_replace("\n", "<br/>", htmlspecialchars(htmlspecialchars_decode(htmlspecialchars_decode($notice['notice']))))?>
|
830
|
<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
|
831
|
</li>
|
832
|
<?php endforeach;?>
|
833
|
</ul>
|
834
|
<?php endforeach;?>
|
835
|
</div>
|
836
|
|
837
|
<div class="modal-footer">
|
838
|
<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa-solid fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
|
839
|
<?php if ($allow_clear_notices && isAllowedPage("/index.php")):?>
|
840
|
<button type="button" id="clearallnotices" class="btn btn-primary"><i class="fa-regular fa-trash-can icon-embed-btn"></i><?=gettext("Mark All as Read")?></button>
|
841
|
<?php endif;?>
|
842
|
</div>
|
843
|
</div>
|
844
|
</div>
|
845
|
</div>
|
846
|
|
847
|
<script type="text/javascript">
|
848
|
//<![CDATA[
|
849
|
events.push(function() {
|
850
|
$('#clearallnotices').click(function() {
|
851
|
ajaxRequest = $.ajax({
|
852
|
url: "/index.php",
|
853
|
type: "post",
|
854
|
data: { closenotice: "all"},
|
855
|
success: function() {
|
856
|
window.location = window.location.href;
|
857
|
},
|
858
|
failure: function() {
|
859
|
alert("Error clearing notices!");
|
860
|
}
|
861
|
});
|
862
|
});
|
863
|
});
|
864
|
//]]>
|
865
|
</script>
|
866
|
|
867
|
<?php
|
868
|
endif; // ($display_notices)
|
869
|
|
870
|
// Get the flash Messages
|
871
|
get_flash_message();
|