Project

General

Profile

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

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

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

    
61
$pagetitle = gentitle($pgtitle);
62

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

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

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

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

    
82
?>
83
<!DOCTYPE html>
84
<html lang="en">
85
<head>
86
	<meta name="viewport" content="width=device-width, initial-scale=1">
87
	<link rel="stylesheet" href="<?=$cssfile?>" />
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
	<title><?=$tabtitle?></title>
91
	<script type="text/javascript">
92
	//<![CDATA[
93
	var events = events || [];
94
	//]]>
95
	</script>
96
</head>
97

    
98
<?php
99

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

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

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

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

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

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

    
147
	$result = array();
148

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

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

    
163
	return $result;
164
}
165

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

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

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

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

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

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

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

    
213
	return $extarray;
214
}
215

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

    
237
$ext_menu_path_data = read_ext_menu_path_data();
238

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

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

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

    
264
// Interfaces
265
$interfaces_menu = array();
266
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
267
	$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
268
}
269
$opts = get_configured_interface_with_descr(false, true);
270
foreach ($opts as $oif => $odescr) {
271
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
272
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
273
	}
274
}
275
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
276

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
420
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
421
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
422
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
423
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
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
		print(genhtmltitle($pgtitle));
520
	}
521
?>
522
		<ul class="context-links">
523

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

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

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

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

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

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

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

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

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

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

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

    
629
	print_info_box($warning_text);
630
}
631

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

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

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

    
655
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
656
			</div>
657

    
658
			<div class="modal-body">
659
<?php
660
	$noticeCategories = array();
661

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

    
668
			$notice['time'] = $time;
669
			array_push($noticeCategories[ $notice['category'] ], $notice);
670
		}
671
	}
672

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

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

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

    
721
<?php endif;
722

    
723
// Get the flash Messages
724
get_flash_message();
(65-65/226)