Project

General

Profile

Download (28.9 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-2022 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/font-awesome/css/v4-shims.css?v=<?=filemtime('/usr/local/www/vendor/font-awesome/css/v4-shims.css')?>">
72
	<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css?v=<?=filemtime('/usr/local/www/vendor/sortable/sortable-theme-bootstrap.css')?>">
73
	<link rel="stylesheet" href="/vendor/jquery-treegrid/css/jquery.treegrid.css?v=<?=filemtime('/usr/local/www/vendor/jquery-treegrid/css/jquery.treegrid.css')?>">
74
	<link rel="stylesheet" href="<?=$cssfile?>?v=<?=filemtime('/usr/local/www/' . $cssfile)?>" />
75

    
76
	<title><?=$tabtitle?></title>
77
	<script type="text/javascript">
78
	//<![CDATA[
79
	var events = events || [];
80
	var newSeperator = false;
81
	//]]>
82
	</script>
83
</head>
84

    
85
<?php
86

    
87
/* Determine automated help URL. Should output the page name and parameters
88
   separately */
89
$uri_split = "";
90
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
91

    
92
/* If there was no match, there were no parameters, just grab the filename
93
   Otherwise, use the matched filename from above. */
94
if (empty($uri_split[0])) {
95
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
96
} else {
97
	$pagename = $uri_split[1];
98
}
99

    
100
/* If the page name is still empty, the user must have requested / (index.php) */
101
if (empty($pagename)) {
102
	$pagename = "index.php";
103
}
104

    
105
/* If the filename is pkg_edit.php or wizard.php, reparse looking
106
	for the .xml filename */
107
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
108
	$param_split = explode('&', $uri_split[2]);
109
	foreach ($param_split as $param) {
110
		if (substr($param, 0, 4) == "xml=") {
111
			$xmlfile = explode('=', $param);
112
			$pagename = $xmlfile[1];
113
		}
114
	}
115
} else if ($pagename == "status_logs.php") {
116
	$param_split = explode('&', $uri_split[2]);
117
	foreach ($param_split as $param) {
118
		if (substr($param, 0, 8) == "logfile=") {
119
			$logtype = explode('=', $param);
120
			$pagename .= '-' . $logtype[1];
121
		}
122
	}
123
}
124

    
125
// Build the full help URL.
126
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
127

    
128
/*
129
 * Read files from $g['ext_menu_path']/*.xml and fill an array with menu info
130
 */
131
function read_ext_menu_path_data() {
132
	global $g;
133

    
134
	$result = array();
135

    
136
	if (!is_dir($g['ext_menu_path'])) {
137
		return $result;
138
	}
139

    
140
	foreach (glob("{$g['ext_menu_path']}/*.xml") as $menu_xml) {
141
		$xml_data = parse_xml_config_pkg($menu_xml, "packagegui");
142
		if (empty($xml_data['menu'])) {
143
			continue;
144
		}
145
		foreach ($xml_data['menu'] as $menu) {
146
			$result[] = $menu;
147
		}
148
	}
149

    
150
	return $result;
151
}
152

    
153
// Create a menu entry of any installed packages in the specified category
154
// (Now reads the menu information from $config['installedpackages']['menu'] only)
155
function return_ext_menu($section) {
156
	global $config, $ext_menu_path_data;
157

    
158
	$htmltext = "";
159
	$extarray = array();
160
	$ext_menu_entries = array();
161

    
162
	if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
163
		foreach ($config['installedpackages']['menu'] as $menu) {
164
			if (isset($menu['name']) && ($menu['name'] != "AutoConfigBackup")) { // AutoConfigBackup was moved to a built-in function
165
	//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
166
				if (isset($menu['section']) && ($menu['section'] == $section)) {
167
					$ext_menu_entries[] = $menu;
168
				}
169
			}
170
		}
171
	}
172

    
173
	foreach ($ext_menu_path_data as $menu) {
174
		if ($menu['section'] == $section) {
175
			$ext_menu_entries[] = $menu;
176
		}
177
	}
178

    
179
	foreach ($ext_menu_entries as $menu) {
180
		if ($menu['url'] != "") {
181
			$test_url = $menu['url'];
182
			$addresswithport = getenv("HTTP_HOST");
183
			$colonpos = strpos($addresswithport, ":");
184

    
185
			if ($colonpos !== false) {
186
				//my url is actually just the IP address of the pfsense box
187
				$myurl = substr($addresswithport, 0, $colonpos);
188
			} else {
189
				$myurl = $addresswithport;
190
			}
191
			$description = str_replace('$myurl', $myurl, $menu['url']);
192
		} else {
193
			$description = '/pkg.php?xml=' . $menu['configfile'];
194
			$test_url=$description;
195
		}
196

    
197
		if (isAllowedPage($test_url)) {
198
			$extarray[] = array($menu['name'], $description);
199
		}
200
	}
201

    
202
	return $extarray;
203
}
204

    
205
function output_menu($arrayitem, $target = null, $section = "") {
206
	$output = "";
207

    
208
	foreach ($arrayitem as $item) {
209

    
210
		/* If the user has access to help pages, also show the full help menu. See #5909 */
211
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" ||
212
		    (($section == "Help") && isAllowedPage("help.php")) ||
213
		    (substr($item[1], 0, 8) == "https://")) {
214
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
215

    
216
			if ($target) {
217
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
218
			}
219

    
220
			$class = "navlnk";
221

    
222
			if ($item['class']) {
223
				$class .= " {$item['class']}";
224
			}
225

    
226
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
227

    
228
			if ($item['style']) {
229
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
230
			}
231

    
232

    
233
			if ($item[0] == '-DIVIDER-') {
234
				$output .= ' <li class="divider"></li>';
235
			} else {
236
				$output .= "<li>". sprintf("<a %s %s>%s</a>", $attr, ($item[1] == "/index.php?logout") ? "usepost":"",$item[0]) . "</li>\n";
237
			}
238
		}
239
	}
240

    
241
	return $output;
242
}
243

    
244
$ext_menu_path_data = read_ext_menu_path_data();
245

    
246
// System
247
$system_menu = array();
248
$system_menu[] = array(gettext("Logout") . " (" . $_SESSION['Username'] . ")", "/index.php?logout");
249
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
250
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
251
$system_menu[] = array(gettext("General Setup"), "/system.php");
252
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
253
$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
254
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
255
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
256
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php");
257
$system_menu[] = array(gettext("Register"), "/system_register.php");
258

    
259
if (!isAllowedPage("system_usermanager.php")) {
260
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
261
} else {
262
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
263
}
264

    
265
if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php")) {
266
	$system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
267
}
268

    
269
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
270

    
271
// Interfaces
272
// NOTE:
273
// Now that menus are sorted, adding a DIVIDER must be done after the sorting so an array is formed of the
274
// items above the divider and another for below it. These are then sorted and combined with the divider
275
$interfaces_menu = array();
276
$interfaces_top = array();
277
$interfaces_bottom = array();
278

    
279
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
280
	$interfaces_top[] = array(gettext("Assignments"), "/interfaces_assign.php");
281
	$div = true;
282
}
283

    
284
$platform = system_identify_specific_platform();
285

    
286
if ($platform['name'] == "uFW") {
287
	$interfaces_top[] = array(gettext("Switches"), "/switch_system.php");
288
}
289

    
290
$opts = get_configured_interface_with_descr(true);
291

    
292
foreach ($opts as $oif => $odescr) {
293
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
294
		$interfaces_bottom[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
295
	}
296
}
297

    
298
$interfaces_bottom = array_merge($interfaces_bottom, return_ext_menu("Interfaces"));
299

    
300
if ($user_settings['webgui']['interfacessort']) {
301
	$interfaces_bottom = msort($interfaces_bottom, 0);
302
}
303

    
304
// Combine the top section, the divider and the bottom section of this menu
305
$interfaces_menu = array_merge($interfaces_top, [array(0 => "-DIVIDER-")], $interfaces_bottom);
306

    
307
// Firewall
308
$firewall_menu = array();
309
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
310
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
311
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
312
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
313
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
314
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
315
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
316

    
317
// Services
318
$services_menu = array();
319
$services_menu[] = array(gettext("Auto Config Backup"), "/services_acb.php");
320
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
321
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
322
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
323
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
324
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
325

    
326
if ($g['services_dhcp_server_enable']) {
327
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
328
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
329
}
330

    
331
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
332
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
333
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
334
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
335
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
336

    
337
if (count($config['interfaces']) > 1) {
338
	/* no use for UPnP in single-interface deployments
339
	remove to reduce user confusion
340
	*/
341
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
342
}
343

    
344
$services_menu[] = array(gettext("Wake-on-LAN"), "/services_wol.php");
345
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
346

    
347
// VPN
348
$vpn_menu = array();
349
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
350
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
351
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
352
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
353
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
354

    
355
// Status
356
$status_menu = array();
357
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
358
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
359
$status_menu[] = array(gettext("Dashboard"), "/index.php");
360
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
361
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
362
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
363
$status_menu[] = array(gettext("DNS Resolver"), "/status_unbound.php");
364
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php?user=true");
365
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
366
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
367
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
368
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
369
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
370
$status_menu[] = array(gettext("Services"), "/status_services.php");
371
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
372
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php");
373

    
374
if (count($config['interfaces']) > 1) {
375
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
376
}
377

    
378
$wifdescrs = array();
379
$ifentries = get_configured_interface_with_descr();
380
foreach ($ifentries as $ent => $entdesc) {
381
	if (is_array($config['interfaces'][$ent]['wireless']) &&
382
	    preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
383
		$wifdescrs[$ent] = $entdesc;
384
	}
385
}
386

    
387
if (count($wifdescrs) > 0) {
388
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
389
}
390

    
391
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
392

    
393
// Diagnostics
394
$diagnostics_menu = array();
395
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
396
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
397
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
398
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
399
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
400
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
401
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
402

    
403
if (file_exists("/var/run/gmirror_active")) {
404
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
405
}
406

    
407
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
408
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
409
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
410
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
411
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
412
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
413
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
414
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
415
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
416
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
417
$diagnostics_menu[] = array(gettext("S.M.A.R.T. Status"), "/diag_smart.php");
418
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
419
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
420
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
421
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
422
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
423
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
424

    
425
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
426

    
427
if (!$g['disablehelpmenu']) {
428
	$help_menu = array();
429
	$help_menu[] = array(gettext("About this Page"), $helpurl);
430
	if ($g['product_name'] == "pfSense") {
431
		$help_menu[] = array(gettext("Bug Database"), "https://redirects.netgate.com/issues");
432
	}
433

    
434
	$help_menu[] = array(gettext("User Forum"), "https://redirects.netgate.com/forum");
435
	$help_menu[] = array(gettext("Documentation"), "https://redirects.netgate.com/docs");
436
	$help_menu[] = array(gettext("Paid Support"), "https://redirects.netgate.com/support");
437
	$help_menu[] = array(gettext("pfSense Book"), "https://redirects.netgate.com/book");
438
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://redirects.netgate.com/fbsdhandbook");
439
	$help_menu[] = array(gettext("User survey"), "https://redirects.netgate.com/survey_1");
440
	$help_menu[] = array(gettext("Upgrade to pfSense Plus"), "https://redirects.netgate.com/upgrade");
441
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
442
}
443

    
444
$menuclass = "static";
445

    
446
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
447
	$menuclass = "fixed";
448
}
449

    
450
$numColumns = (int) $user_settings['webgui']['dashboardcolumns'];
451

    
452
if (($pagename === "index.php") && ($numColumns > 2)) {
453
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
454
}
455

    
456
$display_notices = false;
457
$allow_clear_notices = false;
458

    
459
if (are_notices_pending()) {
460
	// Evaluate user privs to determine if notices should be displayed, and if the user can clear them.
461
	$user_entry = getUserEntry($_SESSION['Username']);
462
	if (isAdminUID($_SESSION['Username']) || userHasPrivilege($user_entry, "user-view-clear-notices") || userHasPrivilege($user_entry, "page-all")) {
463
		$display_notices = true;
464
		$allow_clear_notices = true;
465
	} elseif (userHasPrivilege($user_entry, "user-view-notices")) {
466
		$display_notices = true;
467
	}
468
}
469
?>
470
<body id="<?=$numColumns?>">
471
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
472
	<div class="container">
473
		<div class="navbar-header">
474
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
475
				<span class="sr-only">Toggle navigation</span>
476
				<span class="icon-bar"></span>
477
				<span class="icon-bar"></span>
478
				<span class="icon-bar"></span>
479
			</button>
480
			<a class="navbar-brand" href="/">
481
				<?php include("/usr/local/www/logo.svg"); ?>
482
				<span style="color:white;font-size:.5em;text-transform:uppercase;letter-spacing:1px;">Community Edition</span>
483
			</a>
484
		</div>
485
		<div class="collapse navbar-collapse" id="pf-navbar">
486
			<ul class="nav navbar-nav">
487
			<?php
488
                if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
489
                    $help_menu_title = htmlspecialchars($config['system']['hostname']);
490
                }
491
                elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
492
                    $help_menu_title = htmlspecialchars($system_url);
493
                }
494
                else {
495
                    $help_menu_title = 'Help';
496
                }
497
                foreach ([
498
					['name' => 'System',	     'menu' => $system_menu,	  'href' => null],
499
					['name' => 'Interfaces',     'menu' => $interfaces_menu,  'href' => null],
500
					['name' => 'Firewall',	     'menu' => $firewall_menu,	  'href' => null],
501
					['name' => 'Services',	     'menu' => $services_menu,	  'href' => null],
502
					['name' => 'VPN',		     'menu' => $vpn_menu,		  'href' => null],
503
					['name' => 'Status',	     'menu' => $status_menu,	  'href' => null],
504
					['name' => 'Diagnostics',    'menu' => $diagnostics_menu, 'href' => null],
505
                    ['name' => $help_menu_title, 'menu' => $help_menu,		  'href' => '_blank']
506
				] as $item):
507
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
508
						continue;
509
					}
510

    
511
					$menu_output = output_menu($item['menu'], $item['href'], $item['name']);
512

    
513
					if (strlen($menu_output) > 0):
514
?>
515
				<li class="dropdown">
516
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
517
						<?=gettext($item['name'])?>
518
						<span class="caret"></span>
519
					</a>
520
					<ul class="dropdown-menu" role="menu"><?=$menu_output?></ul>
521
				</li>
522

    
523
<?php
524
					endif;
525
			 	endforeach?>
526
			</ul>
527
			<ul class="nav navbar-nav navbar-right">
528
				<?php if ($display_notices):?>
529
					<?php $notices = get_notices()?>
530
					<li class="dropdown">
531
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
532
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
533
							<span class="badge bg-danger"><?=count($notices)?></span>
534
						</a>
535
					</li>
536
				<?php
537
					endif;
538
				?>
539
					<li class="dropdown">
540
						<a href="/index.php?logout" usepost>
541
							<i class="fa fa-sign-out" title="<?=gettext("Logout") . " (" . $_SESSION['Username'] . "@" . htmlspecialchars($system_url) . ")"?>"></i>
542
						</a>
543
					</li>
544
			</ul>
545
		</div>
546
	</div>
547
</nav>
548

    
549
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
550

    
551
<?php
552
	// Print a warning if current user = admin and the password hash is still set to the default value
553
	if ($_SESSION['Username'] == "admin") {
554
		$cu = getUserEntry("admin");
555

    
556
		if (local_backed("admin", $g['factory_shipped_password'])) {
557
			print('<div class="alert alert-danger">' .
558
				sprintf(gettext('%sWARNING:%s The \'admin\' account password is set to the default value. ' .
559
				' %s Change the password in the User Manager.%s'),
560
				'<strong>', '</strong>', '<a href="/system_usermanager.php?act=edit&userid=' . $cu['uid'] . '">', '</a>') .
561
				'</div>');
562
		}
563
	}
564
?>
565

    
566
	<header class="header">
567

    
568
<?php
569
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
570
	if (isset($notitle)) {
571
		print('<br />');
572
		unset($notitle);
573
	} else {
574
		if (isset($pglinks)) {
575
			print(genhtmltitle($pgtitle, $pglinks));
576
		} else {
577
			print(genhtmltitle($pgtitle));
578
		}
579
	}
580
?>
581
		<ul class="context-links">
582

    
583
	<?php if (isset($widgets)): ?>
584
		<li>
585
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
586
				<i class="fa fa-save icon-pointer"></i>
587
			</a>
588
		</li>
589
	<?php endif?>
590

    
591
	<?php if ($dashboard_available_widgets_hidden): ?>
592
		<li>
593
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
594
				<i class="fa fa-plus icon-pointer"></i>
595
			</a>
596
		</li>
597
	<?php endif?>
598

    
599
	<?php if ($system_logs_filter_form_hidden): ?>
600
		<li>
601
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
602
				<i class="fa fa-filter icon-pointer"></i>
603
			</a>
604
		</li>
605
	<?php endif ?>
606

    
607
	<?php if ($system_logs_manage_log_form_hidden):
608
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
609
			if (isAllowedPage("status_logs_settings.php")) {
610
	?>
611
		<li>
612
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
613
				<i class="fa fa-wrench icon-pointer"></i>
614
			</a>
615
		</li>
616
	<?php	}
617
		endif
618
	?>
619

    
620
	<?php if ($monitoring_settings_form_hidden): ?>
621
		<li>
622
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
623
				<i class="fa fa-wrench icon-pointer"></i>
624
			</a>
625
		</li>
626
	<?php endif?>
627

    
628
	<?php if ($status_monitoring): ?>
629
		<li>
630
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
631
				<i class="fa fa-repeat icon-pointer"></i>
632
			</a>
633
		</li>
634
		<li>
635
			<a class="export-graph" id="export-graph" title="<?=gettext("Export Graph")?>">
636
				<i class="fa fa-download icon-pointer"></i>
637
			</a>
638
		</li>
639
	<?php endif?>
640

    
641
<?php
642
/* Determine shortcut section for XML-based packages */
643
if (empty($shortcut_section) && !empty($xmlfile)) {
644
	$shortcut_section = basename($pagename, '.xml');
645
}
646

    
647
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
648
	$ssvc = array();
649
	switch ($shortcut_section) {
650
		case "openvpn":
651
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
652
			break;
653
		case "captiveportal":
654
			$ssvc = find_service_by_cp_zone($cpzone);
655
			break;
656
		default:
657
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
658
	}
659
	if (!empty($ssvc)) {
660
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
661
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
662
	}
663
}
664

    
665
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
666
	echo '<li>' . $link . '</li>';
667
}
668

    
669
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
670
	echo '<li>' . $link . '</li>';
671
}
672

    
673
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
674
	echo '<li>' . $link . '</li>';
675
}
676

    
677
?>
678
	<?php if (!$g['disablehelpicon'] && isAllowedPage("help.php")): ?>
679
		<li>
680
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
681
				<i class="fa fa-question-circle"></i>
682
			</a>
683
		</li>
684
	<?php endif?>
685
		</ul>
686
	</header>
687
<?php
688
/* if upgrade in progress, alert user */
689
$warning_text = "";
690
if (file_exists('/conf/needs_package_sync') && platform_booting()) {
691
	$warning_text = sprintf(gettext(
692
	    '%1$s%3$s is booting, then packages will be reinstalled in the ' .
693
	    'background.%2$s%1$sDo not make changes in the GUI until this is ' .
694
	    'complete.%2$s'), '<p>', '</p>', $g['product_label']);
695
} elseif (is_subsystem_dirty('packagelock')) {
696
	$pgtitle = array(gettext("System"), gettext("Package Manager"));
697
	$warning_text = sprintf(gettext('%1$sPackages are currently being ' .
698
	    'reinstalled in the background.%2$s%1$sDo not make changes in ' .
699
	    'the GUI until this is complete.%2$s'), '<p>', '</p>');
700
	$warning_text .= sprintf(gettext('%1$sIf the above message is still ' .
701
	    'displayed after a couple of hours, use the \'Clear Package ' .
702
	    'Lock\' button on the %3$s page and reinstall packages manually.' .
703
	    '%2$s'), '<p>', '</p>', sprintf('<a href="diag_backup.php" ' .
704
	    'title="%1$s &gt; %2$s">%1$s &gt; %2$s</a>', gettext('Diagnostics'),
705
	    htmlspecialchars(gettext('Backup & Restore'))));
706
}
707

    
708
if (!empty($warning_text)) {
709
	print_info_box($warning_text);
710
}
711

    
712
/*	If this page is being remotely managed then do not allow the loading of the contents. */
713
if ($config['remote_managed_pages']['item']) {
714
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
715
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
716
			print_info_box(gettext("This page is currently being managed by a remote machine."));
717
			include("foot.inc");
718
			exit;
719
		}
720
	}
721
}
722

    
723
// Modal notices window
724
// The notices modal needs to be outside of the page display div or things get messy
725
if ($display_notices):
726
?>
727

    
728
<div id="notices" class="modal fade" role="dialog">
729
	<div class="modal-dialog">
730
		<div class="modal-content">
731
			<div class="modal-header">
732
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
733
					<span aria-hidden="true">&times;</span>
734
				</button>
735

    
736
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
737
			</div>
738

    
739
			<div class="modal-body">
740
<?php
741
	$noticeCategories = array();
742

    
743
	if (is_array($notices)) {
744
		foreach ($notices as $time => $notice) {
745
			if (!isset($noticeCategories[ $notice['category'] ])) {
746
				$noticeCategories[ $notice['category'] ] = array();
747
			}
748

    
749
			$notice['time'] = $time;
750
			array_push($noticeCategories[ $notice['category'] ], $notice);
751
		}
752
	}
753

    
754
	foreach ($noticeCategories as $category => $catNotices):?>
755
				<h4><?=$category?></h4>
756
				<ul>
757
<?php
758
	foreach ($catNotices as $notice):
759
?>
760
					<li>
761
						<b>
762
<?php if (!empty($notice['url'])):?>
763
							<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
764
<?php endif;?>
765
						</b>
766
						<?=str_replace("\n", "<br/>", htmlspecialchars(htmlspecialchars_decode(htmlspecialchars_decode($notice['notice']))))?>
767
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
768
					</li>
769
<?php	endforeach;?>
770
				</ul>
771
<?php endforeach;?>
772
			</div>
773

    
774
			<div class="modal-footer">
775
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
776
<?php if ($allow_clear_notices && isAllowedPage("/index.php")):?>
777
				<button type="button" id="clearallnotices" class="btn btn-primary"><i class="fa fa-trash-o icon-embed-btn"></i><?=gettext("Mark All as Read")?></button>
778
<?php endif;?>
779
			</div>
780
		</div>
781
	</div>
782
</div>
783

    
784
<script type="text/javascript">
785
//<![CDATA[
786
	events.push(function() {
787
	    $('#clearallnotices').click(function() {
788
			ajaxRequest = $.ajax({
789
				url: "/index.php",
790
				type: "post",
791
				data: { closenotice: "all"},
792
				success: function() {
793
					window.location = window.location.href;
794
				},
795
				failure: function() {
796
					alert("Error clearing notices!");
797
				}
798
			});
799
		});
800
	});
801
//]]>
802
</script>
803

    
804
<?php
805
endif; // ($display_notices)
806

    
807
// Get the flash Messages
808
get_flash_message();
(67-67/228)