Project

General

Profile

Download (31.4 KB) Statistics
| Branch: | Tag: | Revision:
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-2025 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_get_path('system/hostname') . "." . config_get_path('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 (config_get_path('system/webgui/dashboardcolumns') === null) {
51
	config_set_path('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 installedpackages/menu only)
153
function return_ext_menu($section) {
154
	global $ext_menu_path_data;
155

    
156
	$htmltext = "";
157
	$extarray = array();
158
	$ext_menu_entries = array();
159

    
160
	if ((!empty(config_get_path('installedpackages/package'))) && (!empty(config_get_path('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 (!config_path_enabled('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 (config_get_path("interfaces/{$oif}/ovpn") === null) {
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_settings.php");
338
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server")), "/services_dhcpv6_settings.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_get_path('interfaces', [])) > 1) {
350
	/* no use for UPnP in single-interface deployments
351
	remove to reduce user confusion
352
	*/
353
	$services_menu[] = array(gettext("UPnP IGD &amp; PCP"), "/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_get_path('interfaces', [])) > 1) {
387
	$status_menu[] = array(gettext("UPnP IGD &amp; PCP"), "/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_get_path("interfaces/{$ent}/wireless")) &&
394
	    preg_match(g_get('wireless_regex'), config_get_path("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
	$user_entry = $user_entry['item'];
478
	if (isAdminUID($_SESSION['Username']) || userHasPrivilege($user_entry, "user-view-clear-notices") || userHasPrivilege($user_entry, "page-all")) {
479
		$display_notices = true;
480
		$allow_clear_notices = true;
481
	} elseif (userHasPrivilege($user_entry, "user-view-notices")) {
482
		$display_notices = true;
483
	}
484
}
485
?>
486
<body id="<?=$numColumns?>">
487
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
488
	<div class="container">
489
		<div class="navbar-header">
490
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
491
				<span class="sr-only">Toggle navigation</span>
492
				<span class="icon-bar"></span>
493
				<span class="icon-bar"></span>
494
				<span class="icon-bar"></span>
495
			</button>
496
			<a class="navbar-brand" href="/">
497
				<?php include("/usr/local/www/logo.svg"); ?>
498
				<span style="color:white;font-size:.5em;text-transform:uppercase;letter-spacing:1px;">Community Edition</span>
499
			</a>
500
		</div>
501
		<div class="collapse navbar-collapse" id="pf-navbar">
502
			<ul class="nav navbar-nav">
503
			<?php
504
                if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
505
                    $help_menu_title = htmlspecialchars(config_get_path('system/hostname'));
506
                }
507
                elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
508
                    $help_menu_title = htmlspecialchars($system_url);
509
                }
510
                else {
511
                    $help_menu_title = 'Help';
512
                }
513
                foreach ([
514
					['name' => 'System',	     'menu' => $system_menu,	  'href' => null],
515
					['name' => 'Interfaces',     'menu' => $interfaces_menu,  'href' => null],
516
					['name' => 'Firewall',	     'menu' => $firewall_menu,	  'href' => null],
517
					['name' => 'Services',	     'menu' => $services_menu,	  'href' => null],
518
					['name' => 'VPN',		     'menu' => $vpn_menu,		  'href' => null],
519
					['name' => 'Status',	     'menu' => $status_menu,	  'href' => null],
520
					['name' => 'Diagnostics',    'menu' => $diagnostics_menu, 'href' => null],
521
                    ['name' => $help_menu_title, 'menu' => $help_menu,		  'href' => '_blank']
522
				] as $item):
523
					if ($item['name'] == 'Help' && g_get('disablehelpmenu')) {
524
						continue;
525
					}
526

    
527
					$menu_output = output_menu($item['menu'], $item['href'], $item['name']);
528

    
529
					if (strlen($menu_output) > 0):
530
?>
531
				<li class="dropdown">
532
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
533
						<?=gettext($item['name'])?>
534
						<span class="caret"></span>
535
					</a>
536
					<ul class="dropdown-menu<?=$menuclass_dropdown?>" role="menu"><?=$menu_output?></ul>
537
				</li>
538

    
539
<?php
540
					endif;
541
			 	endforeach?>
542
			</ul>
543
			<ul class="nav navbar-nav navbar-right">
544
				<?php if ($display_notices):?>
545
					<?php $notices = get_notices()?>
546
					<li class="dropdown">
547
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
548
							<i class="fa-solid fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
549
							<span class="badge bg-danger"><?=count($notices)?></span>
550
						</a>
551
					</li>
552
				<?php
553
					endif;
554
				?>
555
					<li class="dropdown">
556
						<a href="/index.php?logout" usepost>
557
							<i class="fa-solid fa-right-from-bracket" title="<?=gettext("Logout") . " (" . $_SESSION['Username'] . "@" . htmlspecialchars($system_url) . ")"?>"></i>
558
						</a>
559
					</li>
560
			</ul>
561
		</div>
562
	</div>
563
</nav>
564

    
565
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
566

    
567
<?php
568
/* Password Security warnings */
569

    
570
	/* Setup user index to determine index IDs for user manager links. */
571
	$userindex = index_users();
572

    
573
	/* Gather info about the current user */
574
	$cu = getUserEntry($_SESSION['Username']);
575

    
576
	/* When logging in as non-admin user, warn about admin account password
577
	 * if the user has sufficient access to do correct the problem.
578
	 * Do not test the account if it is in a disabled state. */
579
	if (($_SESSION['Username'] != 'admin') &&
580
	    !is_account_disabled('admin')) {
581
		/* Check the admin password */
582
		$error = check_current_password('admin');
583

    
584
		/* Only print a warning if the user has sufficient access to
585
		 * address the problem. */
586
		if ($error &&
587
		    isAllowedPage('system_usermanager.php')) {
588
			print('<div class="alert alert-danger">' .
589
				sprintf(gettext('%sWARNING:%s%s The \'admin\' account password is insecure. %s%s' .
590
				' %sChange the password in the User Manager as soon as possible.%s'),
591
				'<strong>', '</strong>', '<br/>',
592
				$error, '<br/>',
593
				'<a href="/system_usermanager.php?act=edit&userid=' . $userindex['admin'] . '">', '</a>') .
594
				'</div>');
595
		}
596
	}
597

    
598
	/* When logging in as any user, check the password for their account. */
599
	$error = check_current_password($_SESSION['Username']);
600

    
601
	/* Determine where to send the user to change their password
602
	 * based on their account privileges. */
603
	$target_page = "";
604
	if (isAllowedPage('system_usermanager_passwordmg.php')) {
605
		/* User has access to the self-service password manager, which
606
		 * is the ideal destination. */
607
		$target_page = 'system_usermanager_passwordmg.php';
608
	} elseif (isAllowedPage('system_usermanager.php')) {
609
		/* User does not have access to the self-service page but has
610
		 * access to the main user manager page, so use that instead. */
611
		$target_page = 'system_usermanager.php?act=edit&userid=' . $userindex[$_SESSION['Username']];
612
	}
613

    
614
	/* Print a warning only if the user has sufficient access to change
615
	 * their own password (non-empty target page). */
616
	if ($error &&
617
	    !empty($target_page)) {
618
		print('<div class="alert alert-danger">' .
619
			sprintf(gettext('%sWARNING:%s%s The password for this account is insecure. %s%s' .
620
			' %sChange the password as soon as possible.%s'),
621
			'<strong>', '</strong>', '<br/>',
622
			$error, '<br/>',
623
			'<a href="/' . $target_page . '">', '</a>') .
624
			'</div>');
625
	}
626

    
627
/* End Password Security Warnings */
628
?>
629

    
630
	<header class="header">
631

    
632
<?php
633
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
634
	if (isset($notitle)) {
635
		print('<br />');
636
		unset($notitle);
637
	} else {
638
		if (isset($pglinks)) {
639
			print(genhtmltitle($pgtitle, $pglinks));
640
		} else {
641
			print(genhtmltitle($pgtitle));
642
		}
643
	}
644
?>
645
		<ul class="context-links">
646

    
647
	<?php if (isset($widgets)): ?>
648
		<li>
649
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
650
				<i class="fa-solid fa-save icon-pointer"></i>
651
			</a>
652
		</li>
653
	<?php endif?>
654

    
655
	<?php if ($dashboard_available_widgets_hidden): ?>
656
		<li>
657
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
658
				<i class="fa-solid fa-plus icon-pointer"></i>
659
			</a>
660
		</li>
661
	<?php endif?>
662

    
663
	<?php if ($system_logs_filter_form_hidden): ?>
664
		<li>
665
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
666
				<i class="fa-solid fa-filter icon-pointer"></i>
667
			</a>
668
		</li>
669
	<?php endif ?>
670

    
671
	<?php if ($system_logs_manage_log_form_hidden):
672
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
673
			if (isAllowedPage("status_logs_settings.php")) {
674
	?>
675
		<li>
676
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
677
				<i class="fa-solid fa-wrench icon-pointer"></i>
678
			</a>
679
		</li>
680
	<?php	}
681
		endif
682
	?>
683

    
684
	<?php if ($monitoring_settings_form_hidden): ?>
685
		<li>
686
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
687
				<i class="fa-solid fa-wrench icon-pointer"></i>
688
			</a>
689
		</li>
690
	<?php endif?>
691

    
692
	<?php if ($status_monitoring): ?>
693
		<li>
694
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
695
				<i class="fa-solid fa-arrow-rotate-right icon-pointer"></i>
696
			</a>
697
		</li>
698
		<li>
699
			<a class="export-graph" id="export-graph" title="<?=gettext("Export Graph")?>">
700
				<i class="fa-solid fa-download icon-pointer"></i>
701
			</a>
702
		</li>
703
	<?php endif?>
704

    
705
<?php
706
/* Determine shortcut section for XML-based packages */
707
if (empty($shortcut_section) && !empty($xmlfile)) {
708
	$shortcut_section = basename($pagename, '.xml');
709
}
710

    
711
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
712
	$ssvc = array();
713
	switch ($shortcut_section) {
714
		case "openvpn":
715
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
716
			break;
717
		case "captiveportal":
718
			$ssvc = find_service_by_cp_zone($cpzone);
719
			break;
720
		default:
721
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
722
	}
723
	if (!empty($ssvc)) {
724
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
725
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
726
	}
727
}
728

    
729
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
730
	echo '<li>' . $link . '</li>';
731
}
732

    
733
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
734
	echo '<li>' . $link . '</li>';
735
}
736

    
737
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
738
	echo '<li>' . $link . '</li>';
739
}
740

    
741
?>
742
	<?php if (!g_get('disablehelpicon') && isAllowedPage("help.php")): ?>
743
		<li>
744
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
745
				<i class="fa-solid fa-question-circle"></i>
746
			</a>
747
		</li>
748
	<?php endif?>
749
		</ul>
750
	</header>
751
<?php
752
/* if upgrade in progress, alert user */
753
$warning_text = "";
754
if (file_exists('/conf/needs_package_sync') && is_platform_booting()) {
755
	$warning_text = sprintf(gettext(
756
	    '%1$s%3$s is booting, then packages will be reinstalled in the ' .
757
	    'background.%2$s%1$sDo not make changes in the GUI until this is ' .
758
	    'complete.%2$s'), '<p>', '</p>', g_get('product_label'));
759
} elseif (is_subsystem_dirty('packagelock')) {
760
	$pgtitle = array(gettext("System"), gettext("Package Manager"));
761
	$warning_text = sprintf(gettext('%1$sPackages are currently being ' .
762
	    'reinstalled in the background.%2$s%1$sDo not make changes in ' .
763
	    'the GUI until this is complete.%2$s'), '<p>', '</p>');
764
	$warning_text .= sprintf(gettext('%1$sIf the above message is still ' .
765
	    'displayed after a couple of hours, use the \'Clear Package ' .
766
	    'Lock\' button on the %3$s page and reinstall packages manually.' .
767
	    '%2$s'), '<p>', '</p>', sprintf('<a href="diag_backup.php" ' .
768
	    'title="%1$s &gt; %2$s">%1$s &gt; %2$s</a>', gettext('Diagnostics'),
769
	    htmlspecialchars(gettext('Backup & Restore'))));
770
}
771

    
772
if (!empty($warning_text)) {
773
	print_info_box($warning_text);
774
}
775

    
776
/*	If this page is being remotely managed then do not allow the loading of the contents. */
777
if (config_get_path('remote_managed_pages/item')) {
778
	foreach (config_get_path('remote_managed_pages/item', []) as $rmp) {
779
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
780
			print_info_box(gettext("This page is currently being managed by a remote machine."));
781
			include("foot.inc");
782
			exit;
783
		}
784
	}
785
}
786

    
787
// Modal notices window
788
// The notices modal needs to be outside of the page display div or things get messy
789
if ($display_notices):
790
?>
791

    
792
<div id="notices" class="modal fade" role="dialog">
793
	<div class="modal-dialog">
794
		<div class="modal-content">
795
			<div class="modal-header">
796
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
797
					<span aria-hidden="true">&times;</span>
798
				</button>
799

    
800
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
801
			</div>
802

    
803
			<div class="modal-body">
804
<?php
805
	$noticeCategories = array();
806

    
807
	if (is_array($notices)) {
808
		foreach ($notices as $time => $notice) {
809
			if (!isset($noticeCategories[ $notice['category'] ])) {
810
				$noticeCategories[ $notice['category'] ] = array();
811
			}
812

    
813
			$notice['time'] = $time;
814
			array_push($noticeCategories[ $notice['category'] ], $notice);
815
		}
816
	}
817

    
818
	foreach ($noticeCategories as $category => $catNotices):?>
819
				<h4><?=$category?></h4>
820
				<ul>
821
<?php
822
	foreach ($catNotices as $notice):
823
?>
824
					<li>
825
						<b>
826
<?php if (!empty($notice['url'])):?>
827
							<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
828
<?php endif;?>
829
						</b>
830
						<?=str_replace("\n", "<br/>", htmlspecialchars(htmlspecialchars_decode(htmlspecialchars_decode($notice['notice']))))?>
831
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
832
					</li>
833
<?php	endforeach;?>
834
				</ul>
835
<?php endforeach;?>
836
			</div>
837

    
838
			<div class="modal-footer">
839
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa-solid fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
840
<?php if ($allow_clear_notices && isAllowedPage("/index.php")):?>
841
				<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>
842
<?php endif;?>
843
			</div>
844
		</div>
845
	</div>
846
</div>
847

    
848
<script type="text/javascript">
849
//<![CDATA[
850
	events.push(function() {
851
	    $('#clearallnotices').click(function() {
852
			ajaxRequest = $.ajax({
853
				url: "/index.php",
854
				type: "post",
855
				data: { closenotice: "all"},
856
				success: function() {
857
					window.location = window.location.href;
858
				},
859
				failure: function() {
860
					alert("Error clearing notices!");
861
				}
862
			});
863
		});
864
	});
865
//]]>
866
</script>
867

    
868
<?php
869
endif; // ($display_notices)
870

    
871
// Get the flash Messages
872
get_flash_message();
(69-69/233)