Project

General

Profile

Download (26.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * head.inc
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 */
21

    
22
require_once("globals.inc");
23
require_once("functions.inc");
24
require_once("shortcuts.inc");
25
require_once("service-utils.inc");
26
require_once('notices.inc');
27

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

    
30
$pagetitle = gentitle($pgtitle);
31
$system_url = $config['system']['hostname'] . "." . $config['system']['domain'];
32

    
33
if ($user_settings['webgui']['pagenamefirst']) {
34
	$tabtitle = $pagetitle . " - " . htmlspecialchars($system_url);
35
} else {
36
	$tabtitle = htmlspecialchars($system_url) . " - " . $pagetitle;
37
}
38

    
39
$cssfile = "/css/pfSense.css";
40

    
41
if (isset($user_settings['webgui']['webguicss'])) {
42
	if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) {
43
		$cssfile = "/css/" . $user_settings['webgui']['webguicss'];
44
	}
45
}
46

    
47
// set default columns to two if unset
48
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
49
	$config['system']['webgui']['dashboardcolumns'] = 2;
50
}
51

    
52
?>
53
<!DOCTYPE html>
54
<html lang="en">
55
<head>
56
	<meta name="viewport" content="width=device-width, initial-scale=1">
57
	<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css?v=<?=filemtime('/usr/local/www/vendor/font-awesome/css/font-awesome.min.css')?>">
58
	<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css?v=<?=filemtime('/usr/local/www/vendor/sortable/sortable-theme-bootstrap.css')?>">
59
	<link rel="stylesheet" href="<?=$cssfile?>?v=<?=filemtime('/usr/local/www/' . $cssfile)?>" />
60

    
61
	<title><?=$tabtitle?></title>
62
	<script type="text/javascript">
63
	//<![CDATA[
64
	var events = events || [];
65
	//]]>
66
	</script>
67
</head>
68

    
69
<?php
70

    
71
/* Determine automated help URL. Should output the page name and parameters
72
   separately */
73
$uri_split = "";
74
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
75

    
76
/* If there was no match, there were no parameters, just grab the filename
77
   Otherwise, use the matched filename from above. */
78
if (empty($uri_split[0])) {
79
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
80
} else {
81
	$pagename = $uri_split[1];
82
}
83

    
84
/* If the page name is still empty, the user must have requested / (index.php) */
85
if (empty($pagename)) {
86
	$pagename = "index.php";
87
}
88

    
89
/* If the filename is pkg_edit.php or wizard.php, reparse looking
90
	for the .xml filename */
91
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
92
	$param_split = explode('&', $uri_split[2]);
93
	foreach ($param_split as $param) {
94
		if (substr($param, 0, 4) == "xml=") {
95
			$xmlfile = explode('=', $param);
96
			$pagename = $xmlfile[1];
97
		}
98
	}
99
} else if ($pagename == "status_logs.php") {
100
	$param_split = explode('&', $uri_split[2]);
101
	foreach ($param_split as $param) {
102
		if (substr($param, 0, 8) == "logfile=") {
103
			$logtype = explode('=', $param);
104
			$pagename .= '-' . $logtype[1];
105
		}
106
	}
107
}
108

    
109
// Build the full help URL.
110
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
111

    
112
/*
113
 * Read files from $g['ext_menu_path']/*.xml and fill an array with menu info
114
 */
115
function read_ext_menu_path_data() {
116
	global $g;
117

    
118
	$result = array();
119

    
120
	if (!is_dir($g['ext_menu_path'])) {
121
		return $result;
122
	}
123

    
124
	foreach (glob("{$g['ext_menu_path']}/*.xml") as $menu_xml) {
125
		$xml_data = parse_xml_config_pkg($menu_xml, "packagegui");
126
		if (empty($xml_data['menu'])) {
127
			continue;
128
		}
129
		foreach ($xml_data['menu'] as $menu) {
130
			$result[] = $menu;
131
		}
132
	}
133

    
134
	return $result;
135
}
136

    
137
// Create a menu entry of any installed packages in the specified category
138
// (Now reads the menu information from $config['installedpackages']['menu'] only)
139
function return_ext_menu($section) {
140
	global $config, $ext_menu_path_data;
141

    
142
	$htmltext = "";
143
	$extarray = array();
144
	$ext_menu_entries = array();
145

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

    
155
	foreach ($ext_menu_path_data as $menu) {
156
		if ($menu['section'] == $section) {
157
			$ext_menu_entries[] = $menu;
158
		}
159
	}
160

    
161
	foreach ($ext_menu_entries as $menu) {
162
		if ($menu['url'] != "") {
163
			$test_url = $menu['url'];
164
			$addresswithport = getenv("HTTP_HOST");
165
			$colonpos = strpos($addresswithport, ":");
166

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

    
179
		if (isAllowedPage($test_url)) {
180
			$extarray[] = array($menu['name'], $description);
181
		}
182
	}
183

    
184
	return $extarray;
185
}
186

    
187
function output_menu($arrayitem, $target = null, $section = "") {
188
	$output = "";
189

    
190
	foreach ($arrayitem as $item) {
191

    
192
		/* If the user has access to help pages, also show the full help menu. See #5909 */
193
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" ||
194
		    (($section == "Help") && isAllowedPage("help.php")) ||
195
		    (substr($item[1], 0, 8) == "https://")) {
196
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
197

    
198
			if ($target) {
199
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
200
			}
201

    
202
			$class = "navlnk";
203

    
204
			if ($item['class']) {
205
				$class .= " {$item['class']}";
206
			}
207

    
208
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
209

    
210
			if ($item['style']) {
211
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
212
			}
213

    
214

    
215
			if ($item[0] == '-DIVIDER-') {
216
				$output .= ' <li class="divider"></li>';
217
			} else {
218
				$output .= "<li>". sprintf("<a %s %s>%s</a>", $attr, ($item[1] == "/index.php?logout") ? "usepost":"",$item[0]) . "</li>\n";
219
			}
220
		}
221
	}
222

    
223
	return $output;
224
}
225

    
226
$ext_menu_path_data = read_ext_menu_path_data();
227

    
228
// System
229
$system_menu = array();
230
$system_menu[] = array(gettext("Logout") . " (" . $_SESSION['Username'] . ")", "/index.php?logout");
231
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
232
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
233
$system_menu[] = array(gettext("General Setup"), "/system.php");
234
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
235
$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
236
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
237
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
238
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php");
239
if (!isAllowedPage("system_usermanager.php*")) {
240
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
241
} else {
242
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
243
}
244

    
245
if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php*")) {
246
	$system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
247
}
248

    
249
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
250

    
251
// Interfaces
252
// NOTE:
253
// Now that menus are sorted, adding a DIVIDER must be done after the sorting so an array is formed of the
254
// items above the divider and another for below it. These are then sorted and combined with the divider
255
$interfaces_menu = array();
256
$interfaces_top = array();
257
$interfaces_bottom = array();
258

    
259
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
260
	$interfaces_top[] = array(gettext("Assignments"), "/interfaces_assign.php");
261
	$div = true;
262
}
263

    
264
$platform = system_identify_specific_platform();
265

    
266
if ($platform['name'] == "uFW") {
267
	$interfaces_top[] = array(gettext("Switches"), "/switch_system.php");
268
}
269

    
270
$opts = get_configured_interface_with_descr(false, true);
271

    
272
foreach ($opts as $oif => $odescr) {
273
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
274
		$interfaces_bottom[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
275
	}
276
}
277

    
278
// Combine the top section, the divider and the bottom section of this menu
279
$interfaces_menu = array_merge($interfaces_top, [array(0 => "-DIVIDER-")], msort(array_merge($interfaces_bottom, return_ext_menu("Interfaces")), 0));
280

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

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

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

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

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

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

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

    
329
// Status
330
$status_menu = array();
331
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
332
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
333
$status_menu[] = array(gettext("Dashboard"), "/index.php");
334
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
335
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
336
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
337
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php?user=true");
338
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
339
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
340
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
341
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
342
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
343
$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
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
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
400

    
401
$gold_menu = array();
402
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
403
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
404

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

    
412
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
413
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
414
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
415
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
416
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
417
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
418
}
419

    
420
$menuclass = "static";
421

    
422
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
423
	$menuclass = "fixed";
424
}
425

    
426
$numColumns = $user_settings['webgui']['dashboardcolumns'];
427

    
428
if (($pagename === "index.php") && ($numColumns > 2)) {
429
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
430
}
431

    
432
$display_notices = false;
433
$allow_clear_notices = false;
434

    
435
if (are_notices_pending()) {
436
	// Evaluate user privs to determine if notices should be displayed, and if the user can clear them.
437
	$user_entry = getUserEntry($_SESSION['Username']);
438
	if (isAdminUID($_SESSION['Username']) || userHasPrivilege($user_entry, "user-view-clear-notices") || userHasPrivilege($user_entry, "page-all")) {
439
		$display_notices = true;
440
		$allow_clear_notices = true;
441
	} elseif (userHasPrivilege($user_entry, "user-view-notices")) {
442
		$display_notices = true;
443
	}
444
}
445
?>
446
<body id="<?=$numColumns?>">
447
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
448
	<div class="container">
449
		<div class="navbar-header">
450
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
451
				<span class="sr-only">Toggle navigation</span>
452
				<span class="icon-bar"></span>
453
				<span class="icon-bar"></span>
454
				<span class="icon-bar"></span>
455
			</button>
456
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" title="<?=$system_url?>"/></a>
457
		</div>
458
		<div class="collapse navbar-collapse" id="pf-navbar">
459
			<ul class="nav navbar-nav">
460
			<?php
461
                if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
462
                    $help_menu_title = htmlspecialchars($config['system']['hostname']);
463
                }
464
                elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
465
                    $help_menu_title = htmlspecialchars($system_url);
466
                }
467
                else {
468
                    $help_menu_title = 'Help';
469
                }
470
                foreach ([
471
					['name' => 'System',	     'menu' => $system_menu,	  'href' => null],
472
					['name' => 'Interfaces',     'menu' => $interfaces_menu,  'href' => null],
473
					['name' => 'Firewall',	     'menu' => $firewall_menu,	  'href' => null],
474
					['name' => 'Services',	     'menu' => $services_menu,	  'href' => null],
475
					['name' => 'VPN',		     'menu' => $vpn_menu,		  'href' => null],
476
					['name' => 'Status',	     'menu' => $status_menu,	  'href' => null],
477
					['name' => 'Diagnostics',    'menu' => $diagnostics_menu, 'href' => null],
478
					['name' => 'Gold',		     'menu' => $gold_menu,		  'href' => '_blank'],
479
                    ['name' => $help_menu_title, 'menu' => $help_menu,		  'href' => '_blank']
480
				] as $item):
481
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
482
						continue;
483
					}
484

    
485
					$menu_output = output_menu($item['menu'], $item['href'], $item['name']);
486

    
487
					if (strlen($menu_output) > 0):
488
?>
489
				<li class="dropdown">
490
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
491
						<?=gettext($item['name'])?>
492
						<span class="caret"></span>
493
					</a>
494
					<ul class="dropdown-menu" role="menu"><?=$menu_output?></ul>
495
				</li>
496

    
497
<?php
498
					endif;
499
			 	endforeach?>
500
			</ul>
501
			<ul class="nav navbar-nav navbar-right">
502
				<?php if ($display_notices):?>
503
					<?php $notices = get_notices()?>
504
					<li class="dropdown">
505
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
506
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
507
							<span class="badge bg-danger"><?=count($notices)?></span>
508
						</a>
509
					</li>
510
				<?php
511
					endif;
512
				?>
513
					<li class="dropdown">
514
						<a href="/index.php?logout" usepost>
515
							<i class="fa fa-sign-out" title="<?=gettext("Logout") . " (" . $_SESSION['Username'] . "@" . htmlspecialchars($system_url) . ")"?>"></i>
516
						</a>
517
					</li>
518
			</ul>
519
		</div>
520
	</div>
521
</nav>
522

    
523
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
524
	<header class="header">
525

    
526
<?php
527
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
528
	if (isset($notitle)) {
529
		print('<br />');
530
		unset($notitle);
531
	} else {
532
		if (isset($pglinks)) {
533
			print(genhtmltitle($pgtitle, $pglinks));
534
		} else {
535
			print(genhtmltitle($pgtitle));
536
		}
537
	}
538
?>
539
		<ul class="context-links">
540

    
541
	<?php if (isset($widgets)): ?>
542
		<li>
543
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
544
				<i class="fa fa-save icon-pointer"></i>
545
			</a>
546
		</li>
547
	<?php endif?>
548

    
549
	<?php if ($dashboard_available_widgets_hidden): ?>
550
		<li>
551
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
552
				<i class="fa fa-plus icon-pointer"></i>
553
			</a>
554
		</li>
555
	<?php endif?>
556

    
557
	<?php if ($system_logs_filter_form_hidden): ?>
558
		<li>
559
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
560
				<i class="fa fa-filter icon-pointer"></i>
561
			</a>
562
		</li>
563
	<?php endif ?>
564

    
565
	<?php if ($system_logs_manage_log_form_hidden):
566
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
567
			if (isAllowedPage("status_logs_settings.php")) {
568
	?>
569
		<li>
570
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
571
				<i class="fa fa-wrench icon-pointer"></i>
572
			</a>
573
		</li>
574
	<?php	}
575
		endif
576
	?>
577

    
578
	<?php if ($monitoring_settings_form_hidden): ?>
579
		<li>
580
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
581
				<i class="fa fa-wrench icon-pointer"></i>
582
			</a>
583
		</li>
584
	<?php endif?>
585

    
586
	<?php if ($status_monitoring): ?>
587
		<li>
588
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
589
				<i class="fa fa-repeat icon-pointer"></i>
590
			</a>
591
		</li>
592
		<li>
593
			<a class="export-graph" id="export-graph" title="<?=gettext("Export Graph")?>">
594
				<i class="fa fa-download icon-pointer"></i>
595
			</a>
596
		</li>
597
	<?php endif?>
598

    
599
<?php
600
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
601
	$ssvc = array();
602
	switch ($shortcut_section) {
603
		case "openvpn":
604
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
605
			break;
606
		case "captiveportal":
607
			$ssvc = find_service_by_cp_zone($cpzone);
608
			break;
609
		default:
610
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
611
	}
612
	if (!empty($ssvc)) {
613
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
614
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
615
	}
616
}
617

    
618
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
619
	echo '<li>' . $link . '</li>';
620
}
621

    
622
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
623
	echo '<li>' . $link . '</li>';
624
}
625

    
626
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
627
	echo '<li>' . $link . '</li>';
628
}
629

    
630
?>
631
	<?php if (!$g['disablehelpicon'] && isAllowedPage("help.php")): ?>
632
		<li>
633
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
634
				<i class="fa fa-question-circle"></i>
635
			</a>
636
		</li>
637
	<?php endif?>
638
		</ul>
639
	</header>
640
<?php
641
/* if upgrade in progress, alert user */
642
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
643
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
644
		$warning_text = sprintf(gettext('%1$s%3$s is booting, then packages will be reinstalled in the background.%2$s%1$sDo not make changes in the GUI until this is complete.%2$s'), '<p>', '</p>', $g['product_name']);
645
	} else {
646
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
647
		$warning_text = sprintf(gettext('%1$sPackages are currently being reinstalled in the background.%2$s%1$sDo not make changes in the GUI until this is complete.%2$s'), '<p>', '</p>');
648
		$warning_text .= sprintf(gettext('%1$sIf the above message is still displayed after a couple of hours, use the \'Clear Package Lock\' button on the %3$s page and reinstall packages manually.%2$s'), '<p>', '</p>', sprintf('<a href="diag_backup.php" title="%1$s &gt; %2$s">%1$s &gt; %2$s</a>', gettext('Diagnostics'), htmlspecialchars(gettext('Backup & Restore'))));
649
	}
650

    
651
	print_info_box($warning_text);
652
}
653

    
654
/*	If this page is being remotely managed then do not allow the loading of the contents. */
655
if ($config['remote_managed_pages']['item']) {
656
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
657
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
658
			print_info_box(gettext("This page is currently being managed by a remote machine."));
659
			include("foot.inc");
660
			exit;
661
		}
662
	}
663
}
664

    
665
// Modal notices window
666
// The notices modal needs to be outside of the page display div or things get messy
667
if ($display_notices):
668
?>
669

    
670
<div id="notices" class="modal fade" role="dialog">
671
	<div class="modal-dialog">
672
		<div class="modal-content">
673
			<div class="modal-header">
674
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
675
					<span aria-hidden="true">&times;</span>
676
				</button>
677

    
678
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
679
			</div>
680

    
681
			<div class="modal-body">
682
<?php
683
	$noticeCategories = array();
684

    
685
	if (is_array($notices)) {
686
		foreach ($notices as $time => $notice) {
687
			if (!isset($noticeCategories[ $notice['category'] ])) {
688
				$noticeCategories[ $notice['category'] ] = array();
689
			}
690

    
691
			$notice['time'] = $time;
692
			array_push($noticeCategories[ $notice['category'] ], $notice);
693
		}
694
	}
695

    
696
	foreach ($noticeCategories as $category => $catNotices):?>
697
				<h4><?=$category?></h4>
698
				<ul>
699
<?php
700
	foreach ($catNotices as $notice):
701
?>
702
					<li>
703
						<b>
704
<?php if (!empty($notice['url'])):?>
705
							<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
706
<?php endif;?>
707
						</b>
708
						<?=str_replace("\n", "<br/>", htmlspecialchars($notice['notice']))?>
709
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
710
					</li>
711
<?php	endforeach;?>
712
				</ul>
713
<?php endforeach;?>
714
			</div>
715

    
716
			<div class="modal-footer">
717
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
718
<?php if ($allow_clear_notices && isAllowedPage("/index.php")):?>
719
				<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>
720
<?php endif;?>
721
			</div>
722
		</div>
723
	</div>
724
</div>
725

    
726
<script type="text/javascript">
727
//<![CDATA[
728
	events.push(function() {
729
	    $('#clearallnotices').click(function() {
730
			ajaxRequest = $.ajax({
731
				url: "/index.php",
732
				type: "post",
733
				data: { closenotice: "all"},
734
				success: function() {
735
					window.location = window.location.href;
736
				},
737
				failure: function() {
738
					alert("Error clearing notices!");
739
				}
740
			});
741
		});
742
	});
743
//]]>
744
</script>
745

    
746
<?php
747
endif; // ($display_notices)
748

    
749
// Get the flash Messages
750
get_flash_message();
(61-61/223)