Project

General

Profile

Download (28.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-2020 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 */
21

    
22
require_once("globals.inc");
23
require_once("functions.inc");
24
require_once("shortcuts.inc");
25
require_once("service-utils.inc");
26
require_once('notices.inc');
27

    
28
header('Content-Type: text/html; charset=utf-8');
29

    
30
$pagetitle = gentitle($pgtitle);
31
$system_url = $config['system']['hostname'] . "." . $config['system']['domain'];
32

    
33
if ($user_settings['webgui']['pagenamefirst']) {
34
	$tabtitle = $pagetitle . " - " . htmlspecialchars($system_url);
35
} else {
36
	$tabtitle = htmlspecialchars($system_url) . " - " . $pagetitle;
37
}
38

    
39
$cssfile = "/css/pfSense.css";
40

    
41
if (isset($user_settings['webgui']['webguicss'])) {
42
	if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) {
43
		$cssfile = "/css/" . $user_settings['webgui']['webguicss'];
44
	}
45
}
46

    
47
// set default columns to two if unset
48
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
49
	$config['system']['webgui']['dashboardcolumns'] = 2;
50
}
51

    
52
?>
53
<!DOCTYPE html>
54
<html lang="en">
55
<head>
56
	<meta name="viewport" content="width=device-width, initial-scale=1">
57

    
58
	<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
59
	<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
60
	<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
61
	<link rel="manifest" href="/manifest.json">
62
	<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
63
	<meta name="theme-color" content="#ffffff">
64

    
65
	<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css?v=<?=filemtime('/usr/local/www/vendor/font-awesome/css/font-awesome.min.css')?>">
66
	<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css?v=<?=filemtime('/usr/local/www/vendor/sortable/sortable-theme-bootstrap.css')?>">
67
	<link rel="stylesheet" href="<?=$cssfile?>?v=<?=filemtime('/usr/local/www/' . $cssfile)?>" />
68

    
69
	<title><?=$tabtitle?></title>
70
	<script type="text/javascript">
71
	//<![CDATA[
72
	var events = events || [];
73
	var newSeperator = false;
74
	//]]>
75
	</script>
76
</head>
77

    
78
<?php
79

    
80
/* Determine automated help URL. Should output the page name and parameters
81
   separately */
82
$uri_split = "";
83
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
84

    
85
/* If there was no match, there were no parameters, just grab the filename
86
   Otherwise, use the matched filename from above. */
87
if (empty($uri_split[0])) {
88
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
89
} else {
90
	$pagename = $uri_split[1];
91
}
92

    
93
/* If the page name is still empty, the user must have requested / (index.php) */
94
if (empty($pagename)) {
95
	$pagename = "index.php";
96
}
97

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

    
118
// Build the full help URL.
119
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
120

    
121
/*
122
 * Read files from $g['ext_menu_path']/*.xml and fill an array with menu info
123
 */
124
function read_ext_menu_path_data() {
125
	global $g;
126

    
127
	$result = array();
128

    
129
	if (!is_dir($g['ext_menu_path'])) {
130
		return $result;
131
	}
132

    
133
	foreach (glob("{$g['ext_menu_path']}/*.xml") as $menu_xml) {
134
		$xml_data = parse_xml_config_pkg($menu_xml, "packagegui");
135
		if (empty($xml_data['menu'])) {
136
			continue;
137
		}
138
		foreach ($xml_data['menu'] as $menu) {
139
			$result[] = $menu;
140
		}
141
	}
142

    
143
	return $result;
144
}
145

    
146
// Create a menu entry of any installed packages in the specified category
147
// (Now reads the menu information from $config['installedpackages']['menu'] only)
148
function return_ext_menu($section) {
149
	global $config, $ext_menu_path_data;
150

    
151
	$htmltext = "";
152
	$extarray = array();
153
	$ext_menu_entries = array();
154

    
155
	if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
156
		foreach ($config['installedpackages']['menu'] as $menu) {
157
			if ($menu['name'] != "AutoConfigBackup") { // AutoConfigBackup was moved to a built-in function
158
	//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
159
				if ($menu['section'] == $section) {
160
					$ext_menu_entries[] = $menu;
161
				}
162
			}
163
		}
164
	}
165

    
166
	foreach ($ext_menu_path_data as $menu) {
167
		if ($menu['section'] == $section) {
168
			$ext_menu_entries[] = $menu;
169
		}
170
	}
171

    
172
	foreach ($ext_menu_entries as $menu) {
173
		if ($menu['url'] != "") {
174
			$test_url = $menu['url'];
175
			$addresswithport = getenv("HTTP_HOST");
176
			$colonpos = strpos($addresswithport, ":");
177

    
178
			if ($colonpos !== false) {
179
				//my url is actually just the IP address of the pfsense box
180
				$myurl = substr($addresswithport, 0, $colonpos);
181
			} else {
182
				$myurl = $addresswithport;
183
			}
184
			$description = str_replace('$myurl', $myurl, $menu['url']);
185
		} else {
186
			$description = '/pkg.php?xml=' . $menu['configfile'];
187
			$test_url=$description;
188
		}
189

    
190
		if (isAllowedPage($test_url)) {
191
			$extarray[] = array($menu['name'], $description);
192
		}
193
	}
194

    
195
	return $extarray;
196
}
197

    
198
function output_menu($arrayitem, $target = null, $section = "") {
199
	$output = "";
200

    
201
	foreach ($arrayitem as $item) {
202

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

    
209
			if ($target) {
210
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
211
			}
212

    
213
			$class = "navlnk";
214

    
215
			if ($item['class']) {
216
				$class .= " {$item['class']}";
217
			}
218

    
219
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
220

    
221
			if ($item['style']) {
222
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
223
			}
224

    
225

    
226
			if ($item[0] == '-DIVIDER-') {
227
				$output .= ' <li class="divider"></li>';
228
			} else {
229
				$output .= "<li>". sprintf("<a %s %s>%s</a>", $attr, ($item[1] == "/index.php?logout") ? "usepost":"",$item[0]) . "</li>\n";
230
			}
231
		}
232
	}
233

    
234
	return $output;
235
}
236

    
237
$ext_menu_path_data = read_ext_menu_path_data();
238

    
239
// System
240
$system_menu = array();
241
$system_menu[] = array(gettext("Logout") . " (" . $_SESSION['Username'] . ")", "/index.php?logout");
242
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
243
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
244
$system_menu[] = array(gettext("General Setup"), "/system.php");
245
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
246
$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
247
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
248
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
249
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php");
250
if (!isAllowedPage("system_usermanager.php")) {
251
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
252
} else {
253
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
254
}
255

    
256
if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php")) {
257
	$system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
258
}
259

    
260
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
261

    
262
// Interfaces
263
// NOTE:
264
// Now that menus are sorted, adding a DIVIDER must be done after the sorting so an array is formed of the
265
// items above the divider and another for below it. These are then sorted and combined with the divider
266
$interfaces_menu = array();
267
$interfaces_top = array();
268
$interfaces_bottom = array();
269

    
270
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
271
	$interfaces_top[] = array(gettext("Assignments"), "/interfaces_assign.php");
272
	$div = true;
273
}
274

    
275
$platform = system_identify_specific_platform();
276

    
277
if ($platform['name'] == "uFW") {
278
	$interfaces_top[] = array(gettext("Switches"), "/switch_system.php");
279
}
280

    
281
$opts = get_configured_interface_with_descr(true);
282

    
283
foreach ($opts as $oif => $odescr) {
284
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
285
		$interfaces_bottom[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
286
	}
287
}
288

    
289
$interfaces_bottom = array_merge($interfaces_bottom, return_ext_menu("Interfaces"));
290

    
291
if ($user_settings['webgui']['interfacessort']) {
292
	$interfaces_bottom = msort($interfaces_bottom, 0);
293
}
294

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

    
298
// Firewall
299
$firewall_menu = array();
300
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
301
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
302
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
303
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
304
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
305
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
306
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
307

    
308
// Services
309
$services_menu = array();
310
$services_menu[] = array(gettext("Auto Config Backup"), "/services_acb.php");
311
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
312
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
313
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
314
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
315
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
316

    
317
if ($g['services_dhcp_server_enable']) {
318
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
319
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
320
}
321

    
322
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
323
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
324
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
325
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
326
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
327
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
328

    
329
if (count($config['interfaces']) > 1) {
330
	/* no use for UPnP in single-interface deployments
331
	remove to reduce user confusion
332
	*/
333
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
334
}
335

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

    
339
// VPN
340
$vpn_menu = array();
341
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
342
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
343
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
344
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
345
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
346

    
347
// Status
348
$status_menu = array();
349
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
350
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
351
$status_menu[] = array(gettext("Dashboard"), "/index.php");
352
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
353
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
354
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
355
$status_menu[] = array(gettext("DNS Resolver"), "/status_unbound.php");
356
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php?user=true");
357
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
358
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
359
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
360
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
361
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
362
$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
363
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
364
$status_menu[] = array(gettext("Services"), "/status_services.php");
365
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
366
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php");
367

    
368
if (count($config['interfaces']) > 1) {
369
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
370
}
371

    
372
$wifdescrs = array();
373
$ifentries = get_configured_interface_with_descr();
374
foreach ($ifentries as $ent => $entdesc) {
375
	if (is_array($config['interfaces'][$ent]['wireless']) &&
376
	    preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
377
		$wifdescrs[$ent] = $entdesc;
378
	}
379
}
380

    
381
if (count($wifdescrs) > 0) {
382
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
383
}
384

    
385
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
386

    
387
// Diagnostics
388
$diagnostics_menu = array();
389
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
390
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
391
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
392
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
393
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
394
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
395
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
396

    
397
if (file_exists("/var/run/gmirror_active")) {
398
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
399
}
400

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

    
419
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
420

    
421
$gold_menu = array();
422
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
423
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
424

    
425
if (!$g['disablehelpmenu']) {
426
	$help_menu = array();
427
	$help_menu[] = array(gettext("About this Page"), $helpurl);
428
	if ($g['product_name'] == "pfSense") {
429
		$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
430
	}
431

    
432
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
433
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
434
	$help_menu[] = array(gettext("Paid Support"), "https://www.netgate.com/support");
435
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
436
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
437
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
438
}
439

    
440
$menuclass = "static";
441

    
442
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
443
	$menuclass = "fixed";
444
}
445

    
446
$numColumns = (int) $user_settings['webgui']['dashboardcolumns'];
447

    
448
if (($pagename === "index.php") && ($numColumns > 2)) {
449
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
450
}
451

    
452
$display_notices = false;
453
$allow_clear_notices = false;
454

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

    
508
					$menu_output = output_menu($item['menu'], $item['href'], $item['name']);
509

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

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

    
546
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
547

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

    
553
		$hash = (empty($cu['bcrypt-hash']) ? $cu['password'] : $cu['bcrypt-hash']);
554

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

    
565
	<header class="header">
566

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
773
			<div class="modal-footer">
774
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
775
<?php if ($allow_clear_notices && isAllowedPage("/index.php")):?>
776
				<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>
777
<?php endif;?>
778
			</div>
779
		</div>
780
	</div>
781
</div>
782

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

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

    
806
// Get the flash Messages
807
get_flash_message();
(68-68/235)