Project

General

Profile

Download (26.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * head.inc
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-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
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
277

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

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

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

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

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

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

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

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

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

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

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

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

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

    
366
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
367

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

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

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

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

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

    
408
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
409

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

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

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

    
429
$menuclass = "static";
430

    
431
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
432
	$menuclass = "fixed";
433
}
434

    
435
$numColumns = $user_settings['webgui']['dashboardcolumns'];
436

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

    
510
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
511
	<header class="header">
512

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

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

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

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

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

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

    
573
	<?php if ($status_monitoring): ?>
574
		<li>
575
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
576
				<i class="fa fa-repeat icon-pointer"></i>
577
			</a>
578
		</li>
579
		<li>
580
			<a class="export-graph" id="export-graph" title="<?=gettext("Export Graph")?>">
581
				<i class="fa fa-download icon-pointer"></i>
582
			</a>
583
		</li>
584
	<?php endif?>
585

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

    
605
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
606
	echo '<li>' . $link . '</li>';
607
}
608

    
609
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
610
	echo '<li>' . $link . '</li>';
611
}
612

    
613
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
614
	echo '<li>' . $link . '</li>';
615
}
616

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

    
638
	print_info_box($warning_text);
639
}
640

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

    
652
// Modal notices window
653
// The notices modal needs to be outside of the page display div or things get messy
654
if (are_notices_pending()):?>
655

    
656
<div id="notices" class="modal fade" role="dialog">
657
	<div class="modal-dialog">
658
		<div class="modal-content">
659
			<div class="modal-header">
660
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
661
					<span aria-hidden="true">&times;</span>
662
				</button>
663

    
664
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
665
			</div>
666

    
667
			<div class="modal-body">
668
<?php
669
	$noticeCategories = array();
670

    
671
	if (is_array($notices)) {
672
		foreach ($notices as $time => $notice) {
673
			if (!isset($noticeCategories[ $notice['category'] ])) {
674
				$noticeCategories[ $notice['category'] ] = array();
675
			}
676

    
677
			$notice['time'] = $time;
678
			array_push($noticeCategories[ $notice['category'] ], $notice);
679
		}
680
	}
681

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

    
702
			<div class="modal-footer">
703
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
704
<?php if (isAllowedPage("/index.php")):?>
705
				<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>
706
<?php endif;?>
707
			</div>
708
		</div>
709
	</div>
710
</div>
711

    
712
<script type="text/javascript">
713
//<![CDATA[
714
	events.push(function() {
715
	    $('#clearallnotices').click(function() {
716
			ajaxRequest = $.ajax({
717
				url: "/index.php",
718
				type: "post",
719
				data: { closenotice: "all"},
720
				success: function() {
721
					window.location = window.location.href;
722
				},
723
				failure: function() {
724
					alert("Error clearing notices!");
725
				}
726
			});
727
		});
728
	});
729
//]]>
730
</script>
731

    
732
<?php endif;
733

    
734
// Get the flash Messages
735
get_flash_message();
(62-62/225)