Project

General

Profile

Download (24.8 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 (isset($config['system']['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 = "/bootstrap/css/pfSense.css";
70

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

    
77
// set default colmns 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="/font-awesome/css/font-awesome.min.css">
89
	<link rel="stylesheet" href="/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
// Create a menu entry of any installed packages in the specified category
142
// (Now reads the menu information from $config['installedpackages']['menu'] only)
143
function return_ext_menu($section) {
144
	global $config;
145

    
146
	$htmltext = "";
147
	$extarray = array();
148

    
149
	if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
150
		foreach ($config['installedpackages']['menu'] as $menu) {
151
//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
152
			if ($menu['section'] != $section) {
153
				continue;
154
			}
155

    
156
			if ($menu['url'] != "") {
157
				$test_url = $menu['url'];
158
				$addresswithport = getenv("HTTP_HOST");
159
				$colonpos = strpos($addresswithport, ":");
160

    
161
				if ($colonpos !== false) {
162
					//my url is actually just the IP address of the pfsense box
163
					$myurl = substr($addresswithport, 0, $colonpos);
164
				} else {
165
					$myurl = $addresswithport;
166
				}
167
				$description = str_replace('$myurl', $myurl, $menu['url']);
168
			} else {
169
				$description = '/pkg.php?xml=' . $menu['configfile'];
170
				$test_url=$description;
171
			}
172

    
173
			if (isAllowedPage($test_url)) {
174
				$extarray[] = array($menu['name'], $description);
175
			}
176
		}
177
	}
178

    
179
	return $extarray;
180
}
181

    
182
function output_menu($arrayitem, $target = null, $section = "") {
183
	foreach ($arrayitem as $item) {
184
		/* If the user has access to help pages, also show the full help menu. See #5909 */
185
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" || (($section == "Help") && isAllowedPage("help.php"))) {
186
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
187
			if ($target) {
188
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
189
			}
190
			$class = "navlnk";
191
			if ($item['class']) {
192
				$class .= " {$item['class']}";
193
			}
194
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
195
			if ($item['style']) {
196
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
197
			}
198
			echo "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]). "</li>\n";
199
		}
200
	}
201
}
202

    
203
// System
204
$system_menu = array();
205
$system_menu[] = array(gettext("Logout"), "/index.php?logout");
206
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
207
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
208
$system_menu[] = array(gettext("General Setup"), "/system.php");
209
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
210
if ($g['platform'] == $g['product_name'] or $g['platform'] == "nanobsd") {
211
	$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
212
}
213
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
214
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
215
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php");
216
if (!isAllowedPage("system_usermanager.php*")) {
217
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
218
} else {
219
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
220
}
221

    
222
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
223

    
224
// Interfaces
225
$interfaces_menu = array();
226
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
227
	$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
228
}
229
$opts = get_configured_interface_with_descr(false, true);
230
foreach ($opts as $oif => $odescr) {
231
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
232
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
233
	}
234
}
235
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
236

    
237
// Firewall
238
$firewall_menu = array();
239
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
240
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
241
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
242
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
243
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
244
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
245
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
246

    
247
// Services
248
$services_menu = array();
249
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
250
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
251
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
252
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
253
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
254

    
255
if ($g['services_dhcp_server_enable']) {
256
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
257
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
258
}
259

    
260
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
261
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
262
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
263
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
264
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
265
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
266

    
267
if (count($config['interfaces']) > 1) {
268
	/* no use for UPnP in single-interface deployments
269
	remove to reduce user confusion
270
	*/
271
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
272
}
273

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

    
277
// VPN
278
$vpn_menu = array();
279
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
280
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
281
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
282
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
283
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
284

    
285
// Status
286
$status_menu = array();
287
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
288
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
289
$status_menu[] = array(gettext("Dashboard"), "/index.php");
290
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
291
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
292
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
293
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
294
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
295
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
296
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
297
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
298
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
299

    
300
if ($g['platform'] == $g['product_name']) {
301
	$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
302
}
303

    
304
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
305
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
306
$status_menu[] = array(gettext("Services"), "/status_services.php");
307
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
308
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
309

    
310
if (count($config['interfaces']) > 1) {
311
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
312
}
313

    
314
$ifentries = get_configured_interface_with_descr();
315
foreach ($ifentries as $ent => $entdesc) {
316
	if (is_array($config['interfaces'][$ent]['wireless']) &&
317
	    preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
318
		$wifdescrs[$ent] = $entdesc;
319
	}
320
}
321

    
322
if (count($wifdescrs) > 0) {
323
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
324
}
325

    
326
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
327

    
328
// Diagnostics
329
$diagnostics_menu = array();
330
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
331
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
332
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
333
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
334
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
335
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
336
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
337

    
338
if (file_exists("/var/run/gmirror_active")) {
339
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
340
}
341

    
342
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
343
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
344
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
345
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
346
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
347
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
348
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
349
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
350
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
351
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
352
$diagnostics_menu[] = array(gettext("S.M.A.R.T. Status"), "/diag_smart.php");
353
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
354
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
355
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
356
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
357
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
358
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
359

    
360
if ($g['platform'] == "nanobsd") {
361
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
362
}
363

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

    
368
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
369

    
370
$gold_menu = array();
371
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
372
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
373

    
374
if (!$g['disablehelpmenu']) {
375
	$help_menu = array();
376
	$help_menu[] = array(gettext("About this Page"), $helpurl);
377
	if ($g['product_name'] == "pfSense") {
378
		$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
379
	}
380

    
381
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
382
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
383
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
384
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
385
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
386
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
387
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
388
}
389

    
390
$menuclass = "static";
391

    
392
if (isset($config['system']['webgui']['webguifixedmenu'])) {
393
	$menuclass = "fixed";
394
}
395

    
396
$numColumns = $config['system']['webgui']['dashboardcolumns'];
397

    
398
if (($pagename === "index.php") && ($numColumns > 2)) {
399
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
400
}
401
?>
402
<body id="<?=$numColumns?>">
403
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
404
	<div class="container">
405
		<div class="navbar-header">
406
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
407
				<span class="sr-only">Toggle navigation</span>
408
				<span class="icon-bar"></span>
409
				<span class="icon-bar"></span>
410
				<span class="icon-bar"></span>
411
			</button>
412
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" /></a>
413
		</div>
414
		<div class="collapse navbar-collapse" id="pf-navbar">
415
			<ul class="nav navbar-nav">
416
			<?php foreach ([
417
					['name' => 'System',	  'menu' => $system_menu,	   'href' => null],
418
					['name' => 'Interfaces',  'menu' => $interfaces_menu,  'href' => null],
419
					['name' => 'Firewall',	  'menu' => $firewall_menu,	   'href' => null],
420
					['name' => 'Services',	  'menu' => $services_menu,	   'href' => null],
421
					['name' => 'VPN',		  'menu' => $vpn_menu,		   'href' => null],
422
					['name' => 'Status',	  'menu' => $status_menu,	   'href' => null],
423
					['name' => 'Diagnostics', 'menu' => $diagnostics_menu, 'href' => null],
424
					['name' => 'Gold',		  'menu' => $gold_menu,		   'href' => '_blank'],
425
					['name' => 'Help',		  'menu' => $help_menu,		   'href' => '_blank']
426
				] as $item):
427
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
428
						continue;
429
					} ?>
430
				<li class="dropdown">
431
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
432
						<?=gettext($item['name'])?>
433
						<span class="caret"></span>
434
					</a>
435
					<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'], $item['name'])?></ul>
436
				</li>
437
			<?php endforeach?>
438
			</ul>
439
			<ul class="nav navbar-nav navbar-right">
440
				<?php if (are_notices_pending()):?>
441
					<?php $notices = get_notices()?>
442
					<li class="dropdown">
443
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
444
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
445
							<span class="badge bg-danger"><?=count($notices)?></span>
446
						</a>
447
					</li>
448
				<?php
449
					endif;
450
				?>
451
					<li class="dropdown">
452
						<a href="/index.php?logout">
453
							<i class="fa fa-sign-out" title="<?=gettext("Log out")?>"></i>
454
						</a>
455
					</li>
456
			</ul>
457
		</div>
458
	</div>
459
</nav>
460

    
461
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
462
	<header class="header">
463

    
464
<?php
465
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
466
	if (isset($notitle)) {
467
		print('<br />');
468
		unset($notitle);
469
	} else {
470
		print(genhtmltitle($pgtitle));
471
	}
472
?>
473
		<ul class="context-links">
474

    
475
	<?php if ($dashboard_available_widgets_hidden): ?>
476
		<li>
477
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
478
				<i class="fa fa-plus icon-pointer"></i>
479
			</a>
480
		</li>
481
	<?php endif?>
482

    
483
	<?php if (isset($widgets)): ?>
484
		<li>
485
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore">
486
				<i class="fa fa-save icon-pointer"></i>
487
			</a>
488
		</li>
489
	<?php endif?>
490

    
491
	<?php if ($system_logs_filter_form_hidden): ?>
492
		<li>
493
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
494
				<i class="fa fa-filter icon-pointer"></i>
495
			</a>
496
		</li>
497
	<?php endif ?>
498

    
499
	<?php if ($system_logs_manage_log_form_hidden): 
500
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
501
			if (isAllowedPage("status_logs_settings.php")) {
502
	?>
503
		<li>
504
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
505
				<i class="fa fa-wrench icon-pointer"></i>
506
			</a>
507
		</li>
508
	<?php	}
509
		endif
510
	?>
511

    
512
<?php
513
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
514
	$ssvc = array();
515
	switch ($shortcut_section) {
516
		case "openvpn":
517
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
518
			break;
519
		case "captiveportal":
520
			$ssvc = find_service_by_cp_zone($cpzone);
521
			break;
522
		default:
523
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
524
	}
525
	if (!empty($ssvc)) {
526
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
527
		echo '<li>'. get_service_control_GET_links($ssvc, false). '</li>';
528
	}
529
}
530

    
531
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
532
	echo '<li>' . $link . '</li>';
533
}
534

    
535
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
536
	echo '<li>' . $link . '</li>';
537
}
538

    
539
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
540
	echo '<li>' . $link . '</li>';
541
}
542

    
543
?>
544
	<?php if (!$g['disablehelpicon']): ?>
545
		<li>
546
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
547
				<i class="fa fa-question-circle"></i>
548
			</a>
549
		</li>
550
	<?php endif?>
551
		</ul>
552
	</header>
553
<?php
554
/* if upgrade in progress, alert user */
555
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
556
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
557
		$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']);
558
	} else {
559
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
560
		$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>");
561
		$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')));
562
	}
563

    
564
	print_info_box($warning_text);
565
}
566

    
567
/*	If this page is being remotely managed then do not allow the loading of the contents. */
568
if ($config['remote_managed_pages']['item']) {
569
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
570
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
571
			print_info_box(gettext("This page is currently being managed by a remote machine."));
572
			include("foot.inc");
573
			exit;
574
		}
575
	}
576
}
577

    
578
// Modal notices window
579
// The notices modal needs to be outside of the page display div or things get messy
580
if (are_notices_pending()):?>
581

    
582
<div id="notices" class="modal fade" role="dialog">
583
	<div class="modal-dialog">
584
		<div class="modal-content">
585
			<div class="modal-header">
586
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
587
					<span aria-hidden="true">&times;</span>
588
				</button>
589

    
590
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
591
			</div>
592

    
593
			<div class="modal-body">
594
<?php
595
	$noticeCategories = array();
596

    
597
	if (is_array($notices)) {
598
		foreach ($notices as $time => $notice) {
599
			if (!isset($noticeCategories[ $notice['category'] ])) {
600
				$noticeCategories[ $notice['category'] ] = array();
601
			}
602

    
603
			$notice['time'] = $time;
604
			array_push($noticeCategories[ $notice['category'] ], $notice);
605
		}
606
	}
607

    
608
	foreach ($noticeCategories as $category => $catNotices):?>
609
				<h4><?=$category?></h4>
610
				<ul>
611
<?php
612
	foreach ($catNotices as $notice):
613
?>
614
					<li>
615
						<b>
616
<?php if (!empty($notice['url'])):?>
617
							<a href="<?=$notice['url']?>"><?=$notice['id']?></a> -
618
<?php endif;?>
619
						</b>
620
						<?=$notice['notice']?>
621
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
622
					</li>
623
<?php	endforeach;?>
624
				</ul>
625
<?php endforeach;?>
626
			</div>
627

    
628
			<div class="modal-footer">
629
				<button type="button" class="btn btn-default" data-dismiss="modal"><?=gettext("Close")?></button>
630
				<button type="button" id="clearallnotices" class="btn btn-primary"><?=gettext("Mark All as Read")?></button>
631
			</div>
632
		</div>
633
	</div>
634
</div>
635

    
636
<script type="text/javascript">
637
//<![CDATA[
638
	events.push(function() {
639
	    $('#clearallnotices').click(function() {
640
			ajaxRequest = $.ajax({
641
				url: "/index.php",
642
				type: "post",
643
				data: { closenotice: "all"},
644
				success: function() {
645
					window.location = window.location.href;
646
				},
647
				failure: function() {
648
					alert("Error clearing notices!");
649
				}
650
			});
651
		});
652
	});
653
//]]>
654
</script>
655

    
656
<?php endif;
657

    
658
// Get the flash Messages
659
get_flash_message();
(65-65/229)