Project

General

Profile

Download (27.3 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * head.inc
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions are met:
11
 *
12
 * 1. Redistributions of source code must retain the above copyright notice,
13
 *    this list of conditions and the following disclaimer.
14
 *
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in
17
 *    the documentation and/or other materials provided with the
18
 *    distribution.
19
 *
20
 * 3. All advertising materials mentioning features or use of this software
21
 *    must display the following acknowledgment:
22
 *    "This product includes software developed by the pfSense Project
23
 *    for use in the pfSense® software distribution. (http://www.pfsense.org/).
24
 *
25
 * 4. The names "pfSense" and "pfSense Project" must not be used to
26
 *    endorse or promote products derived from this software without
27
 *    prior written permission. For written permission, please contact
28
 *    coreteam@pfsense.org.
29
 *
30
 * 5. Products derived from this software may not be called "pfSense"
31
 *    nor may "pfSense" appear in their names without prior written
32
 *    permission of the Electric Sheep Fencing, LLC.
33
 *
34
 * 6. Redistributions of any form whatsoever must retain the following
35
 *    acknowledgment:
36
 *
37
 * "This product includes software developed by the pfSense Project
38
 * for use in the pfSense software distribution (http://www.pfsense.org/).
39
 *
40
 * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 * OF THE POSSIBILITY OF SUCH DAMAGE.
52
 */
53

    
54
require_once("globals.inc");
55
require_once("functions.inc");
56
require_once("shortcuts.inc");
57
require_once("service-utils.inc");
58
require_once('notices.inc');
59

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

    
62
$pagetitle = gentitle($pgtitle);
63

    
64
if ($user_settings['webgui']['pagenamefirst']) {
65
	$tabtitle = $pagetitle . " - " . htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
66
} else {
67
	$tabtitle = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']) . " - " . $pagetitle;
68
}
69

    
70
$cssfile = "/css/pfSense.css";
71

    
72
if (isset($user_settings['webgui']['webguicss'])) {
73
	if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) {
74
		$cssfile = "/css/" . $user_settings['webgui']['webguicss'];
75
	}
76
}
77

    
78
// set default columns to two if unset
79
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
80
	$config['system']['webgui']['dashboardcolumns'] = 2;
81
}
82

    
83
?>
84
<!DOCTYPE html>
85
<html lang="en">
86
<head>
87
	<meta name="viewport" content="width=device-width, initial-scale=1">
88
	<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
89
	<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css">
90
	<link rel="stylesheet" href="<?=$cssfile?>" />
91
	<title><?=$tabtitle?></title>
92
	<script type="text/javascript">
93
	//<![CDATA[
94
	var events = events || [];
95
	//]]>
96
	</script>
97
</head>
98

    
99
<?php
100

    
101
/* Determine automated help URL. Should output the page name and parameters
102
   separately */
103
$uri_split = "";
104
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
105

    
106
/* If there was no match, there were no parameters, just grab the filename
107
   Otherwise, use the matched filename from above. */
108
if (empty($uri_split[0])) {
109
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
110
} else {
111
	$pagename = $uri_split[1];
112
}
113

    
114
/* If the page name is still empty, the user must have requested / (index.php) */
115
if (empty($pagename)) {
116
	$pagename = "index.php";
117
}
118

    
119
/* If the filename is pkg_edit.php or wizard.php, reparse looking
120
	for the .xml filename */
121
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
122
	$param_split = explode('&', $uri_split[2]);
123
	foreach ($param_split as $param) {
124
		if (substr($param, 0, 4) == "xml=") {
125
			$xmlfile = explode('=', $param);
126
			$pagename = $xmlfile[1];
127
		}
128
	}
129
} else if ($pagename == "status_logs.php") {
130
	$param_split = explode('&', $uri_split[2]);
131
	foreach ($param_split as $param) {
132
		if (substr($param, 0, 8) == "logfile=") {
133
			$logtype = explode('=', $param);
134
			$pagename .= '-' . $logtype[1];
135
		}
136
	}
137
}
138

    
139
// Build the full help URL.
140
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
141

    
142
/*
143
 * Read files from $g['ext_menu_path']/*.xml and fill an array with menu info
144
 */
145
function read_ext_menu_path_data() {
146
	global $g;
147

    
148
	$result = array();
149

    
150
	if (!is_dir($g['ext_menu_path'])) {
151
		return $result;
152
	}
153

    
154
	foreach (glob("{$g['ext_menu_path']}/*.xml") as $menu_xml) {
155
		$xml_data = parse_xml_config_pkg($menu_xml, "packagegui");
156
		if (empty($xml_data['menu'])) {
157
			continue;
158
		}
159
		foreach ($xml_data['menu'] as $menu) {
160
			$result[] = $menu;
161
		}
162
	}
163

    
164
	return $result;
165
}
166

    
167
// Create a menu entry of any installed packages in the specified category
168
// (Now reads the menu information from $config['installedpackages']['menu'] only)
169
function return_ext_menu($section) {
170
	global $config, $ext_menu_path_data;
171

    
172
	$htmltext = "";
173
	$extarray = array();
174
	$ext_menu_entries = array();
175

    
176
	if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
177
		foreach ($config['installedpackages']['menu'] as $menu) {
178
//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
179
			if ($menu['section'] == $section) {
180
				$ext_menu_entries[] = $menu;
181
			}
182
		}
183
	}
184

    
185
	foreach ($ext_menu_path_data as $menu) {
186
		if ($menu['section'] == $section) {
187
			$ext_menu_entries[] = $menu;
188
		}
189
	}
190

    
191
	foreach ($ext_menu_entries as $menu) {
192
		if ($menu['url'] != "") {
193
			$test_url = $menu['url'];
194
			$addresswithport = getenv("HTTP_HOST");
195
			$colonpos = strpos($addresswithport, ":");
196

    
197
			if ($colonpos !== false) {
198
				//my url is actually just the IP address of the pfsense box
199
				$myurl = substr($addresswithport, 0, $colonpos);
200
			} else {
201
				$myurl = $addresswithport;
202
			}
203
			$description = str_replace('$myurl', $myurl, $menu['url']);
204
		} else {
205
			$description = '/pkg.php?xml=' . $menu['configfile'];
206
			$test_url=$description;
207
		}
208

    
209
		if (isAllowedPage($test_url)) {
210
			$extarray[] = array($menu['name'], $description);
211
		}
212
	}
213

    
214
	return $extarray;
215
}
216

    
217
function output_menu($arrayitem, $target = null, $section = "") {
218
	foreach ($arrayitem as $item) {
219
		/* If the user has access to help pages, also show the full help menu. See #5909 */
220
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" || (($section == "Help") && isAllowedPage("help.php"))) {
221
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
222
			if ($target) {
223
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
224
			}
225
			$class = "navlnk";
226
			if ($item['class']) {
227
				$class .= " {$item['class']}";
228
			}
229
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
230
			if ($item['style']) {
231
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
232
			}
233
			echo "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]). "</li>\n";
234
		}
235
	}
236
}
237

    
238
$ext_menu_path_data = read_ext_menu_path_data();
239

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

    
259
if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php*")) {
260
	$system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
261
}
262

    
263
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
264

    
265
// Interfaces
266
// NOTE:
267
// Special items at the top should not be sorted. Only the variable list of interfaces may be sorted.
268
$interfaces_menu = array();
269
$interfaces_top = array();
270
$interfaces_bottom = array();
271

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

    
276
$opts = get_configured_interface_with_descr(false, true);
277

    
278
foreach ($opts as $oif => $odescr) {
279
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
280
		$interfaces_bottom[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
281
	}
282
}
283

    
284
$interfaces_bottom = array_merge($interfaces_bottom, return_ext_menu("Interfaces"));
285

    
286
if ($user_settings['webgui']['interfacessort']) {
287
	$interfaces_bottom = msort($interfaces_bottom, 0);
288
}
289

    
290
// Combine the top bottom section of this menu
291
$interfaces_menu = array_merge($interfaces_top, $interfaces_bottom);
292

    
293
// Firewall
294
$firewall_menu = array();
295
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
296
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
297
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
298
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
299
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
300
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
301
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
302

    
303
// Services
304
$services_menu = array();
305
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
306
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
307
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
308
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
309
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
310

    
311
if ($g['services_dhcp_server_enable']) {
312
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
313
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
314
}
315

    
316
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
317
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
318
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
319
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
320
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
321
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
322

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

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

    
333
// VPN
334
$vpn_menu = array();
335
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
336
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
337
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
338
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
339
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
340

    
341
// Status
342
$status_menu = array();
343
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
344
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
345
$status_menu[] = array(gettext("Dashboard"), "/index.php");
346
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
347
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
348
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
349
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php?user=true");
350
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
351
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
352
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
353
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
354
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
355

    
356
if ($g['platform'] == $g['product_name']) {
357
	$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
358
}
359

    
360
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
361
$status_menu[] = array(gettext("Services"), "/status_services.php");
362
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
363
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
364

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

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

    
377
if (count($wifdescrs) > 0) {
378
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
379
}
380

    
381
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
382

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

    
393
if (file_exists("/var/run/gmirror_active")) {
394
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
395
}
396

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

    
415
if ($g['platform'] == "nanobsd") {
416
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
417
}
418

    
419
if (isset($config['system']['developer'])) {
420
	$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
421
}
422

    
423
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
424

    
425
$gold_menu = array();
426
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
427
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
428

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

    
436
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
437
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
438
	$help_menu[] = array(gettext("Paid Support"), "https://www.netgate.com/support");
439
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
440
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
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 = $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
<body id="<?=$numColumns?>">
457
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
458
	<div class="container">
459
		<div class="navbar-header">
460
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
461
				<span class="sr-only">Toggle navigation</span>
462
				<span class="icon-bar"></span>
463
				<span class="icon-bar"></span>
464
				<span class="icon-bar"></span>
465
			</button>
466
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" title="<?=$config['system']['hostname'] . '.' . $config['system']['domain']?>"/></a>
467
		</div>
468
		<div class="collapse navbar-collapse" id="pf-navbar">
469
			<ul class="nav navbar-nav">
470
			<?php
471
                if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
472
                    $help_menu_title = htmlspecialchars($config['system']['hostname']);
473
                }
474
                elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
475
                    $help_menu_title = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
476
                }
477
                else {
478
                    $help_menu_title = 'Help';
479
                }
480
                foreach ([
481
					['name' => 'System',	     'menu' => $system_menu,	  'href' => null],
482
					['name' => 'Interfaces',     'menu' => $interfaces_menu,  'href' => null],
483
					['name' => 'Firewall',	     'menu' => $firewall_menu,	  'href' => null],
484
					['name' => 'Services',	     'menu' => $services_menu,	  'href' => null],
485
					['name' => 'VPN',		     'menu' => $vpn_menu,		  'href' => null],
486
					['name' => 'Status',	     'menu' => $status_menu,	  'href' => null],
487
					['name' => 'Diagnostics',    'menu' => $diagnostics_menu, 'href' => null],
488
					['name' => 'Gold',		     'menu' => $gold_menu,		  'href' => '_blank'],
489
                    ['name' => $help_menu_title, 'menu' => $help_menu,		  'href' => '_blank']
490
				] as $item):
491
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
492
						continue;
493
					} ?>
494
				<li class="dropdown">
495
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
496
						<?=gettext($item['name'])?>
497
						<span class="caret"></span>
498
					</a>
499
					<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'], $item['name'])?></ul>
500
				</li>
501
			<?php endforeach?>
502
			</ul>
503
			<ul class="nav navbar-nav navbar-right">
504
				<?php if (are_notices_pending()):?>
505
					<?php $notices = get_notices()?>
506
					<li class="dropdown">
507
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
508
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
509
							<span class="badge bg-danger"><?=count($notices)?></span>
510
						</a>
511
					</li>
512
				<?php
513
					endif;
514
				?>
515
					<li class="dropdown">
516
						<a href="/index.php?logout">
517
							<i class="fa fa-sign-out" title="<?=gettext("Log out")?>"></i>
518
						</a>
519
					</li>
520
			</ul>
521
		</div>
522
	</div>
523
</nav>
524

    
525
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
526
	<header class="header">
527

    
528
<?php
529
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
530
	if (isset($notitle)) {
531
		print('<br />');
532
		unset($notitle);
533
	} else {
534
		if (isset($pglinks)) {
535
			print(genhtmltitle($pgtitle, $pglinks));
536
		} else {
537
			print(genhtmltitle($pgtitle));
538
		}
539
	}
540
?>
541
		<ul class="context-links">
542

    
543
	<?php if (isset($widgets)): ?>
544
		<li>
545
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
546
				<i class="fa fa-save icon-pointer"></i>
547
			</a>
548
		</li>
549
	<?php endif?>
550

    
551
	<?php if ($dashboard_available_widgets_hidden): ?>
552
		<li>
553
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
554
				<i class="fa fa-plus icon-pointer"></i>
555
			</a>
556
		</li>
557
	<?php endif?>
558

    
559
	<?php if ($system_logs_filter_form_hidden): ?>
560
		<li>
561
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
562
				<i class="fa fa-filter icon-pointer"></i>
563
			</a>
564
		</li>
565
	<?php endif ?>
566

    
567
	<?php if ($system_logs_manage_log_form_hidden):
568
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
569
			if (isAllowedPage("status_logs_settings.php")) {
570
	?>
571
		<li>
572
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
573
				<i class="fa fa-wrench icon-pointer"></i>
574
			</a>
575
		</li>
576
	<?php	}
577
		endif
578
	?>
579

    
580
	<?php if ($monitoring_settings_form_hidden): ?>
581
		<li>
582
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
583
				<i class="fa fa-wrench icon-pointer"></i>
584
			</a>
585
		</li>
586
	<?php endif?>
587

    
588
	<?php if ($status_monitoring): ?>
589
		<li>
590
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
591
				<i class="fa fa-repeat icon-pointer"></i>
592
			</a>
593
		</li>
594
		<li>
595
			<a class="export-graph" id="export-graph" title="<?=gettext("Export Graph")?>">
596
				<i class="fa fa-download icon-pointer"></i>
597
			</a>
598
		</li>
599
	<?php endif?>
600

    
601
<?php
602
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
603
	$ssvc = array();
604
	switch ($shortcut_section) {
605
		case "openvpn":
606
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
607
			break;
608
		case "captiveportal":
609
			$ssvc = find_service_by_cp_zone($cpzone);
610
			break;
611
		default:
612
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
613
	}
614
	if (!empty($ssvc)) {
615
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
616
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
617
	}
618
}
619

    
620
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
621
	echo '<li>' . $link . '</li>';
622
}
623

    
624
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
625
	echo '<li>' . $link . '</li>';
626
}
627

    
628
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
629
	echo '<li>' . $link . '</li>';
630
}
631

    
632
?>
633
	<?php if (!$g['disablehelpicon']): ?>
634
		<li>
635
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
636
				<i class="fa fa-question-circle"></i>
637
			</a>
638
		</li>
639
	<?php endif?>
640
		</ul>
641
	</header>
642
<?php
643
/* if upgrade in progress, alert user */
644
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
645
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
646
		$warning_text = sprintf(gettext("<p>%s is booting, then packages will be reinstalled in the background.</p><p>Do not make changes in the GUI until this is complete.</p>"), $g['product_name']);
647
	} else {
648
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
649
		$warning_text = gettext("<p>Packages are currently being reinstalled in the background.</p><p>Do not make changes in the GUI until this is complete.</p>");
650
		$warning_text .= sprintf(gettext('<p>If the above message is still displayed after a couple of hours, use the \'Clear Package Lock\' button on the <a href="diag_backup.php" title="%1$s &gt; %2$s">%1$s &gt; %2$s</a> page and reinstall packages manually.</p>'), gettext('Diagnostics'), htmlspecialchars(gettext('Backup & Restore')));
651
	}
652

    
653
	print_info_box($warning_text);
654
}
655

    
656
/*	If this page is being remotely managed then do not allow the loading of the contents. */
657
if ($config['remote_managed_pages']['item']) {
658
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
659
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
660
			print_info_box(gettext("This page is currently being managed by a remote machine."));
661
			include("foot.inc");
662
			exit;
663
		}
664
	}
665
}
666

    
667
// Modal notices window
668
// The notices modal needs to be outside of the page display div or things get messy
669
if (are_notices_pending()):?>
670

    
671
<div id="notices" class="modal fade" role="dialog">
672
	<div class="modal-dialog">
673
		<div class="modal-content">
674
			<div class="modal-header">
675
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
676
					<span aria-hidden="true">&times;</span>
677
				</button>
678

    
679
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
680
			</div>
681

    
682
			<div class="modal-body">
683
<?php
684
	$noticeCategories = array();
685

    
686
	if (is_array($notices)) {
687
		foreach ($notices as $time => $notice) {
688
			if (!isset($noticeCategories[ $notice['category'] ])) {
689
				$noticeCategories[ $notice['category'] ] = array();
690
			}
691

    
692
			$notice['time'] = $time;
693
			array_push($noticeCategories[ $notice['category'] ], $notice);
694
		}
695
	}
696

    
697
	foreach ($noticeCategories as $category => $catNotices):?>
698
				<h4><?=$category?></h4>
699
				<ul>
700
<?php
701
	foreach ($catNotices as $notice):
702
?>
703
					<li>
704
						<b>
705
<?php if (!empty($notice['url'])):?>
706
							<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
707
<?php endif;?>
708
						</b>
709
						<?=str_replace("\n", "<br/>", htmlspecialchars($notice['notice']))?>
710
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
711
					</li>
712
<?php	endforeach;?>
713
				</ul>
714
<?php endforeach;?>
715
			</div>
716

    
717
			<div class="modal-footer">
718
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
719
<?php if (isAllowedPage("/index.php")):?>
720
				<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>
721
<?php endif;?>
722
			</div>
723
		</div>
724
	</div>
725
</div>
726

    
727
<script type="text/javascript">
728
//<![CDATA[
729
	events.push(function() {
730
	    $('#clearallnotices').click(function() {
731
			ajaxRequest = $.ajax({
732
				url: "/index.php",
733
				type: "post",
734
				data: { closenotice: "all"},
735
				success: function() {
736
					window.location = window.location.href;
737
				},
738
				failure: function() {
739
					alert("Error clearing notices!");
740
				}
741
			});
742
		});
743
	});
744
//]]>
745
</script>
746

    
747
<?php endif;
748

    
749
// Get the flash Messages
750
get_flash_message();
(62-62/225)