Project

General

Profile

Download (26 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 = "/css/pfSense.css";
70

    
71
if (isset($config['system']['webgui']['webguicss'])) {
72
	if (file_exists("/usr/local/www/css/" . $config['system']['webgui']['webguicss'])) {
73
		$cssfile = "/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="/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
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
259

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

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

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

    
291
if ($g['services_dhcp_server_enable']) {
292
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
293
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
294
}
295

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

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

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

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

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

    
336
if ($g['platform'] == $g['product_name']) {
337
	$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
338
}
339

    
340
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
341
$status_menu[] = array(gettext("Services"), "/status_services.php");
342
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
343
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
344

    
345
if (count($config['interfaces']) > 1) {
346
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
347
}
348

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

    
357
if (count($wifdescrs) > 0) {
358
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
359
}
360

    
361
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
362

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

    
373
if (file_exists("/var/run/gmirror_active")) {
374
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
375
}
376

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

    
395
if ($g['platform'] == "nanobsd") {
396
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
397
}
398

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

    
403
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
404

    
405
$gold_menu = array();
406
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
407
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
408

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

    
416
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
417
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
418
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
419
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
420
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
421
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
422
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
423
}
424

    
425
$menuclass = "static";
426

    
427
if (isset($config['system']['webgui']['webguifixedmenu'])) {
428
	$menuclass = "fixed";
429
}
430

    
431
$numColumns = $config['system']['webgui']['dashboardcolumns'];
432

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

    
496
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
497
	<header class="header">
498

    
499
<?php
500
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
501
	if (isset($notitle)) {
502
		print('<br />');
503
		unset($notitle);
504
	} else {
505
		print(genhtmltitle($pgtitle));
506
	}
507
?>
508
		<ul class="context-links">
509

    
510
	<?php if (isset($widgets)): ?>
511
		<li>
512
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
513
				<i class="fa fa-save icon-pointer"></i>
514
			</a>
515
		</li>
516
	<?php endif?>
517

    
518
	<?php if ($dashboard_available_widgets_hidden): ?>
519
		<li>
520
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
521
				<i class="fa fa-plus icon-pointer"></i>
522
			</a>
523
		</li>
524
	<?php endif?>
525

    
526
	<?php if ($system_logs_filter_form_hidden): ?>
527
		<li>
528
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
529
				<i class="fa fa-filter icon-pointer"></i>
530
			</a>
531
		</li>
532
	<?php endif ?>
533

    
534
	<?php if ($system_logs_manage_log_form_hidden):
535
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
536
			if (isAllowedPage("status_logs_settings.php")) {
537
	?>
538
		<li>
539
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
540
				<i class="fa fa-wrench icon-pointer"></i>
541
			</a>
542
		</li>
543
	<?php	}
544
		endif
545
	?>
546

    
547
	<?php if ($monitoring_settings_form_hidden): ?>
548
		<li>
549
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
550
				<i class="fa fa-wrench icon-pointer"></i>
551
			</a>
552
		</li>
553
	<?php endif?>
554

    
555
	<?php if ($status_monitoring): ?>
556
		<li>
557
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
558
				<i class="fa fa-repeat icon-pointer"></i>
559
			</a>
560
		</li>
561
	<?php endif?>
562

    
563
<?php
564
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
565
	$ssvc = array();
566
	switch ($shortcut_section) {
567
		case "openvpn":
568
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
569
			break;
570
		case "captiveportal":
571
			$ssvc = find_service_by_cp_zone($cpzone);
572
			break;
573
		default:
574
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
575
	}
576
	if (!empty($ssvc)) {
577
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
578
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
579
	}
580
}
581

    
582
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
583
	echo '<li>' . $link . '</li>';
584
}
585

    
586
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
587
	echo '<li>' . $link . '</li>';
588
}
589

    
590
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
591
	echo '<li>' . $link . '</li>';
592
}
593

    
594
?>
595
	<?php if (!$g['disablehelpicon']): ?>
596
		<li>
597
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
598
				<i class="fa fa-question-circle"></i>
599
			</a>
600
		</li>
601
	<?php endif?>
602
		</ul>
603
	</header>
604
<?php
605
/* if upgrade in progress, alert user */
606
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
607
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
608
		$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']);
609
	} else {
610
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
611
		$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>");
612
		$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')));
613
	}
614

    
615
	print_info_box($warning_text);
616
}
617

    
618
/*	If this page is being remotely managed then do not allow the loading of the contents. */
619
if ($config['remote_managed_pages']['item']) {
620
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
621
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
622
			print_info_box(gettext("This page is currently being managed by a remote machine."));
623
			include("foot.inc");
624
			exit;
625
		}
626
	}
627
}
628

    
629
// Modal notices window
630
// The notices modal needs to be outside of the page display div or things get messy
631
if (are_notices_pending()):?>
632

    
633
<div id="notices" class="modal fade" role="dialog">
634
	<div class="modal-dialog">
635
		<div class="modal-content">
636
			<div class="modal-header">
637
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
638
					<span aria-hidden="true">&times;</span>
639
				</button>
640

    
641
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
642
			</div>
643

    
644
			<div class="modal-body">
645
<?php
646
	$noticeCategories = array();
647

    
648
	if (is_array($notices)) {
649
		foreach ($notices as $time => $notice) {
650
			if (!isset($noticeCategories[ $notice['category'] ])) {
651
				$noticeCategories[ $notice['category'] ] = array();
652
			}
653

    
654
			$notice['time'] = $time;
655
			array_push($noticeCategories[ $notice['category'] ], $notice);
656
		}
657
	}
658

    
659
	foreach ($noticeCategories as $category => $catNotices):?>
660
				<h4><?=$category?></h4>
661
				<ul>
662
<?php
663
	foreach ($catNotices as $notice):
664
?>
665
					<li>
666
						<b>
667
<?php if (!empty($notice['url'])):?>
668
							<a href="<?=$notice['url']?>"><?=$notice['id']?></a> -
669
<?php endif;?>
670
						</b>
671
						<?=$notice['notice']?>
672
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
673
					</li>
674
<?php	endforeach;?>
675
				</ul>
676
<?php endforeach;?>
677
			</div>
678

    
679
			<div class="modal-footer">
680
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
681
				<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>
682
			</div>
683
		</div>
684
	</div>
685
</div>
686

    
687
<script type="text/javascript">
688
//<![CDATA[
689
	events.push(function() {
690
	    $('#clearallnotices').click(function() {
691
			ajaxRequest = $.ajax({
692
				url: "/index.php",
693
				type: "post",
694
				data: { closenotice: "all"},
695
				success: function() {
696
					window.location = window.location.href;
697
				},
698
				failure: function() {
699
					alert("Error clearing notices!");
700
				}
701
			});
702
		});
703
	});
704
//]]>
705
</script>
706

    
707
<?php endif;
708

    
709
// Get the flash Messages
710
get_flash_message();
(65-65/225)