Project

General

Profile

Download (23.9 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) {
183
	foreach ($arrayitem as $item) {
184
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout") {
185
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
186
			if ($target) {
187
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
188
			}
189
			$class = "navlnk";
190
			if ($item['class']) {
191
				$class .= " {$item['class']}";
192
			}
193
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
194
			if ($item['style']) {
195
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
196
			}
197
			echo "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]). "</li>\n";
198
		}
199
	}
200
}
201

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
380
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
381
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
382
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
383
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
384
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
385
	$help_menu[] = array(gettext("Search Portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
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'])?></ul>
436
				</li>
437
			<?php endforeach?>
438
				<?php if (are_notices_pending()):?>
439
					<?php $notices = get_notices()?>
440
					<li class="dropdown">
441
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
442
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
443
							<span class="badge bg-danger"><?=count($notices)?></span>
444
						</a>
445
					</li>
446
				<?php
447
					endif;
448
				?>
449
					<li class="dropdown">
450
						<a href="/index.php?logout">
451
							<i class="fa fa-sign-out" title="<?=gettext("Log out")?>"></i>
452
						</a>
453
					</li>
454
			</ul>
455
		</div>
456
	</div>
457
</nav>
458

    
459
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
460
	<header class="header">
461

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

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

    
481
	<?php if ($system_logs_filter_form_hidden): ?>
482
		<li>
483
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log Filter")?>">
484
				<i style="cursor:pointer" class="fa fa-filter"></i>
485
			</a>
486
		</li>
487
	<?php endif ?>
488

    
489
	<?php if ($system_logs_manage_log_form_hidden): ?>
490
		<li>
491
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage Log")?>">
492
				<i style="cursor:pointer" class="fa fa-wrench"></i>
493
			</a>
494
		</li>
495
	<?php endif ?>
496

    
497
<?php
498
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) {
499
	$ssvc = array();
500
	switch ($shortcut_section) {
501
		case "openvpn":
502
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
503
			break;
504
		case "captiveportal":
505
			$ssvc = find_service_by_cp_zone($cpzone);
506
			break;
507
		default:
508
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
509
	}
510
	if (!empty($ssvc)) {
511
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
512
		echo '<li>'. get_service_control_GET_links($ssvc, false). '</li>';
513
	}
514
}
515

    
516
echo '<li>'. get_shortcut_main_link($shortcut_section, false). '</li>';
517
echo '<li>'. get_shortcut_status_link($shortcut_section, false). '</li>';
518
echo '<li>'. get_shortcut_log_link($shortcut_section, false). '</li>';
519

    
520
?>
521
	<?php if (!$g['disablehelpicon']): ?>
522
		<li>
523
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
524
				<i class="fa fa-question-circle"></i>
525
			</a>
526
		</li>
527
	<?php endif?>
528
		</ul>
529
	</header>
530
<?php
531
/* if upgrade in progress, alert user */
532
if (is_subsystem_dirty('packagelock') || file_exists('/conf/needs_package_sync' && platform_booting())) {
533
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
534
		$warning_text = sprintf(gettext("%s is booting then packages will be reinstalled in the background.<p>Do not make changes in the GUI until this is complete."), $g['product_name']);
535
	} else {
536
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
537
		$warning_text = gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.");
538
		$warning_text .= 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='Backup/Restore'>Backup/Restore page</a> and reinstall packages manually.");
539
	}
540

    
541
	print_info_box($warning_text);
542
}
543

    
544
$pgtitle_output = true;
545

    
546
/*	If this page is being remotely managed then do not allow the loading of the contents. */
547
if ($config['remote_managed_pages']['item']) {
548
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
549
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
550
			print_info_box(gettext("This page is currently being managed by a remote machine."));
551
			include("foot.inc");
552
			exit;
553
		}
554
	}
555
}
556

    
557
// Modal notices window
558
// The notices modal needs to be outside of the page display div or things get messy
559
if (are_notices_pending()):?>
560

    
561
<div id="notices" class="modal fade" role="dialog">
562
	<div class="modal-dialog">
563
		<div class="modal-content">
564
			<div class="modal-header">
565
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
566
					<span aria-hidden="true">&times;</span>
567
				</button>
568

    
569
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
570
			</div>
571

    
572
			<div class="modal-body">
573
<?php
574
	$noticeCategories = array();
575

    
576
	if (is_array($notices)) {
577
		foreach ($notices as $time => $notice) {
578
			if (!isset($noticeCategories[ $notice['category'] ])) {
579
				$noticeCategories[ $notice['category'] ] = array();
580
			}
581

    
582
			$notice['time'] = $time;
583
			array_push($noticeCategories[ $notice['category'] ], $notice);
584
		}
585
	}
586

    
587
	foreach ($noticeCategories as $category => $catNotices):?>
588
				<h4><?=$category?></h4>
589
				<ul>
590
<?php
591
	foreach ($catNotices as $notice):
592
?>
593
					<li>
594
						<b>
595
<?php if (!empty($notice['url'])):?>
596
							<a href="<?=$notice['url']?>"><?=$notice['id']?></a> -
597
<?php endif;?>
598
						</b>
599
						<?=$notice['notice']?>
600
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
601
					</li>
602
<?php	endforeach;?>
603
				</ul>
604
<?php endforeach;?>
605
			</div>
606

    
607
			<div class="modal-footer">
608
				<button type="button" class="btn btn-default" data-dismiss="modal"><?=gettext("Close")?></button>
609
				<button type="button" id="clearallnotices" class="btn btn-primary"><?=gettext("Mark all as read")?></button>
610
			</div>
611
		</div>
612
	</div>
613
</div>
614

    
615
<script type="text/javascript">
616
//<![CDATA[
617
	events.push(function() {
618
	    $('#clearallnotices').click(function() {
619
			ajaxRequest = $.ajax({
620
				url: "/index.php",
621
				type: "post",
622
				data: { closenotice: "all"},
623
				success: function() {
624
					window.location = window.location.href;
625
				},
626
				failure: function() {
627
					alert("Error clearing notices!");
628
				}
629
			});
630
		});
631
	});
632
//]]>
633
</script>
634

    
635
<?php endif;
636

    
637
// Get the flash Messages
638
get_flash_message();
(65-65/229)