Project

General

Profile

Download (26.8 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
$interfaces_menu = array();
267
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
268
	$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
269
}
270
$opts = get_configured_interface_with_descr(false, true);
271
foreach ($opts as $oif => $odescr) {
272
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
273
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
274
	}
275
}
276

    
277
// Interface list no longer sorted per Redmine #6753
278
// $interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
279
$interfaces_menu = array_merge($interfaces_menu, return_ext_menu("Interfaces"));
280

    
281
// Firewall
282
$firewall_menu = array();
283
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
284
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
285
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
286
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
287
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
288
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
289
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
290

    
291
// Services
292
$services_menu = array();
293
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
294
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
295
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
296
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
297
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
298

    
299
if ($g['services_dhcp_server_enable']) {
300
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
301
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
302
}
303

    
304
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
305
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
306
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
307
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
308
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
309
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
310

    
311
if (count($config['interfaces']) > 1) {
312
	/* no use for UPnP in single-interface deployments
313
	remove to reduce user confusion
314
	*/
315
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
316
}
317

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

    
321
// VPN
322
$vpn_menu = array();
323
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
324
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
325
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
326
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
327
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
328

    
329
// Status
330
$status_menu = array();
331
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
332
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
333
$status_menu[] = array(gettext("Dashboard"), "/index.php");
334
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
335
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
336
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
337
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
338
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
339
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
340
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
341
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
342
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
343

    
344
if ($g['platform'] == $g['product_name']) {
345
	$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
346
}
347

    
348
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
349
$status_menu[] = array(gettext("Services"), "/status_services.php");
350
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
351
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
352

    
353
if (count($config['interfaces']) > 1) {
354
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
355
}
356

    
357
$ifentries = get_configured_interface_with_descr();
358
foreach ($ifentries as $ent => $entdesc) {
359
	if (is_array($config['interfaces'][$ent]['wireless']) &&
360
	    preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
361
		$wifdescrs[$ent] = $entdesc;
362
	}
363
}
364

    
365
if (count($wifdescrs) > 0) {
366
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
367
}
368

    
369
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
370

    
371
// Diagnostics
372
$diagnostics_menu = array();
373
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
374
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
375
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
376
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
377
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
378
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
379
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
380

    
381
if (file_exists("/var/run/gmirror_active")) {
382
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
383
}
384

    
385
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
386
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
387
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
388
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
389
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
390
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
391
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
392
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
393
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
394
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
395
$diagnostics_menu[] = array(gettext("S.M.A.R.T. Status"), "/diag_smart.php");
396
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
397
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
398
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
399
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
400
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
401
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
402

    
403
if ($g['platform'] == "nanobsd") {
404
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
405
}
406

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

    
411
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
412

    
413
$gold_menu = array();
414
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
415
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
416

    
417
if (!$g['disablehelpmenu']) {
418
	$help_menu = array();
419
	$help_menu[] = array(gettext("About this Page"), $helpurl);
420
	if ($g['product_name'] == "pfSense") {
421
		$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
422
	}
423

    
424
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
425
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
426
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
427
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
428
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
429
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
430
}
431

    
432
$menuclass = "static";
433

    
434
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
435
	$menuclass = "fixed";
436
}
437

    
438
$numColumns = $user_settings['webgui']['dashboardcolumns'];
439

    
440
if (($pagename === "index.php") && ($numColumns > 2)) {
441
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
442
}
443
?>
444
<body id="<?=$numColumns?>">
445
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
446
	<div class="container">
447
		<div class="navbar-header">
448
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
449
				<span class="sr-only">Toggle navigation</span>
450
				<span class="icon-bar"></span>
451
				<span class="icon-bar"></span>
452
				<span class="icon-bar"></span>
453
			</button>
454
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" title="<?=$config['system']['hostname'] . '.' . $config['system']['domain']?>"/></a>
455
		</div>
456
		<div class="collapse navbar-collapse" id="pf-navbar">
457
			<ul class="nav navbar-nav">
458
			<?php
459
                if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
460
                    $help_menu_title = htmlspecialchars($config['system']['hostname']);
461
                }
462
                elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
463
                    $help_menu_title = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
464
                }
465
                else {
466
                    $help_menu_title = 'Help';
467
                }
468
                foreach ([
469
					['name' => 'System',	     'menu' => $system_menu,	  'href' => null],
470
					['name' => 'Interfaces',     'menu' => $interfaces_menu,  'href' => null],
471
					['name' => 'Firewall',	     'menu' => $firewall_menu,	  'href' => null],
472
					['name' => 'Services',	     'menu' => $services_menu,	  'href' => null],
473
					['name' => 'VPN',		     'menu' => $vpn_menu,		  'href' => null],
474
					['name' => 'Status',	     'menu' => $status_menu,	  'href' => null],
475
					['name' => 'Diagnostics',    'menu' => $diagnostics_menu, 'href' => null],
476
					['name' => 'Gold',		     'menu' => $gold_menu,		  'href' => '_blank'],
477
                    ['name' => $help_menu_title, 'menu' => $help_menu,		  'href' => '_blank']
478
				] as $item):
479
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
480
						continue;
481
					} ?>
482
				<li class="dropdown">
483
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
484
						<?=gettext($item['name'])?>
485
						<span class="caret"></span>
486
					</a>
487
					<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'], $item['name'])?></ul>
488
				</li>
489
			<?php endforeach?>
490
			</ul>
491
			<ul class="nav navbar-nav navbar-right">
492
				<?php if (are_notices_pending()):?>
493
					<?php $notices = get_notices()?>
494
					<li class="dropdown">
495
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
496
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
497
							<span class="badge bg-danger"><?=count($notices)?></span>
498
						</a>
499
					</li>
500
				<?php
501
					endif;
502
				?>
503
					<li class="dropdown">
504
						<a href="/index.php?logout">
505
							<i class="fa fa-sign-out" title="<?=gettext("Log out")?>"></i>
506
						</a>
507
					</li>
508
			</ul>
509
		</div>
510
	</div>
511
</nav>
512

    
513
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
514
	<header class="header">
515

    
516
<?php
517
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
518
	if (isset($notitle)) {
519
		print('<br />');
520
		unset($notitle);
521
	} else {
522
		print(genhtmltitle($pgtitle));
523
	}
524
?>
525
		<ul class="context-links">
526

    
527
	<?php if (isset($widgets)): ?>
528
		<li>
529
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
530
				<i class="fa fa-save icon-pointer"></i>
531
			</a>
532
		</li>
533
	<?php endif?>
534

    
535
	<?php if ($dashboard_available_widgets_hidden): ?>
536
		<li>
537
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
538
				<i class="fa fa-plus icon-pointer"></i>
539
			</a>
540
		</li>
541
	<?php endif?>
542

    
543
	<?php if ($system_logs_filter_form_hidden): ?>
544
		<li>
545
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
546
				<i class="fa fa-filter icon-pointer"></i>
547
			</a>
548
		</li>
549
	<?php endif ?>
550

    
551
	<?php if ($system_logs_manage_log_form_hidden):
552
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
553
			if (isAllowedPage("status_logs_settings.php")) {
554
	?>
555
		<li>
556
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
557
				<i class="fa fa-wrench icon-pointer"></i>
558
			</a>
559
		</li>
560
	<?php	}
561
		endif
562
	?>
563

    
564
	<?php if ($monitoring_settings_form_hidden): ?>
565
		<li>
566
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
567
				<i class="fa fa-wrench icon-pointer"></i>
568
			</a>
569
		</li>
570
	<?php endif?>
571

    
572
	<?php if ($status_monitoring): ?>
573
		<li>
574
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
575
				<i class="fa fa-repeat icon-pointer"></i>
576
			</a>
577
		</li>
578
	<?php endif?>
579

    
580
<?php
581
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
582
	$ssvc = array();
583
	switch ($shortcut_section) {
584
		case "openvpn":
585
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
586
			break;
587
		case "captiveportal":
588
			$ssvc = find_service_by_cp_zone($cpzone);
589
			break;
590
		default:
591
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
592
	}
593
	if (!empty($ssvc)) {
594
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
595
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
596
	}
597
}
598

    
599
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
600
	echo '<li>' . $link . '</li>';
601
}
602

    
603
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
604
	echo '<li>' . $link . '</li>';
605
}
606

    
607
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
608
	echo '<li>' . $link . '</li>';
609
}
610

    
611
?>
612
	<?php if (!$g['disablehelpicon']): ?>
613
		<li>
614
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
615
				<i class="fa fa-question-circle"></i>
616
			</a>
617
		</li>
618
	<?php endif?>
619
		</ul>
620
	</header>
621
<?php
622
/* if upgrade in progress, alert user */
623
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
624
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
625
		$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']);
626
	} else {
627
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
628
		$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>");
629
		$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')));
630
	}
631

    
632
	print_info_box($warning_text);
633
}
634

    
635
/*	If this page is being remotely managed then do not allow the loading of the contents. */
636
if ($config['remote_managed_pages']['item']) {
637
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
638
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
639
			print_info_box(gettext("This page is currently being managed by a remote machine."));
640
			include("foot.inc");
641
			exit;
642
		}
643
	}
644
}
645

    
646
// Modal notices window
647
// The notices modal needs to be outside of the page display div or things get messy
648
if (are_notices_pending()):?>
649

    
650
<div id="notices" class="modal fade" role="dialog">
651
	<div class="modal-dialog">
652
		<div class="modal-content">
653
			<div class="modal-header">
654
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
655
					<span aria-hidden="true">&times;</span>
656
				</button>
657

    
658
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
659
			</div>
660

    
661
			<div class="modal-body">
662
<?php
663
	$noticeCategories = array();
664

    
665
	if (is_array($notices)) {
666
		foreach ($notices as $time => $notice) {
667
			if (!isset($noticeCategories[ $notice['category'] ])) {
668
				$noticeCategories[ $notice['category'] ] = array();
669
			}
670

    
671
			$notice['time'] = $time;
672
			array_push($noticeCategories[ $notice['category'] ], $notice);
673
		}
674
	}
675

    
676
	foreach ($noticeCategories as $category => $catNotices):?>
677
				<h4><?=$category?></h4>
678
				<ul>
679
<?php
680
	foreach ($catNotices as $notice):
681
?>
682
					<li>
683
						<b>
684
<?php if (!empty($notice['url'])):?>
685
							<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
686
<?php endif;?>
687
						</b>
688
						<?=str_replace("\n", "<br/>", htmlspecialchars($notice['notice']))?>
689
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
690
					</li>
691
<?php	endforeach;?>
692
				</ul>
693
<?php endforeach;?>
694
			</div>
695

    
696
			<div class="modal-footer">
697
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
698
				<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>
699
			</div>
700
		</div>
701
	</div>
702
</div>
703

    
704
<script type="text/javascript">
705
//<![CDATA[
706
	events.push(function() {
707
	    $('#clearallnotices').click(function() {
708
			ajaxRequest = $.ajax({
709
				url: "/index.php",
710
				type: "post",
711
				data: { closenotice: "all"},
712
				success: function() {
713
					window.location = window.location.href;
714
				},
715
				failure: function() {
716
					alert("Error clearing notices!");
717
				}
718
			});
719
		});
720
	});
721
//]]>
722
</script>
723

    
724
<?php endif;
725

    
726
// Get the flash Messages
727
get_flash_message();
(64-64/227)