Project

General

Profile

Download (26.2 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">
58
	<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css">
59
	<link rel="stylesheet" href="<?=$cssfile?>" />
60
	<title><?=$tabtitle?></title>
61
	<script type="text/javascript">
62
	//<![CDATA[
63
	var events = events || [];
64
	//]]>
65
	</script>
66
</head>
67

    
68
<?php
69

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

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

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

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

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

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

    
117
	$result = array();
118

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

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

    
133
	return $result;
134
}
135

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

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

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

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

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

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

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

    
183
	return $extarray;
184
}
185

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

    
189
	foreach ($arrayitem as $item) {
190
		/* If the user has access to help pages, also show the full help menu. See #5909 */
191
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" ||
192
		    (($section == "Help") && isAllowedPage("help.php")) ||
193
		    (substr($item[1], 0, 8) == "https://")) {
194
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
195
			if ($target) {
196
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
197
			}
198
			$class = "navlnk";
199
			if ($item['class']) {
200
				$class .= " {$item['class']}";
201
			}
202
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
203
			if ($item['style']) {
204
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
205
			}
206

    
207
			if ($item[0] == '-DIVIDER-') {
208
				$output .= ' <li class="divider"></li>';
209
			} else {
210
				$output .= "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]) . "</li>\n";
211
			}
212
		}
213
	}
214

    
215
	return $output;
216
}
217

    
218
$ext_menu_path_data = read_ext_menu_path_data();
219

    
220

    
221
// NOTE:
222
// $your_menu[] = array("-DIVIDER-", ""); adds a horizontal divider to the menu. See $interfaces_menu[] for example
223

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

    
241
if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php*")) {
242
	$system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
243
}
244

    
245
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
246

    
247
$div = false;
248

    
249
// Interfaces
250
$interfaces_menu = array();
251
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
252
	$interfaces_menu[] = array(gettext("Assignments"), "/interfaces_assign.php");
253
	$div = true;
254
}
255

    
256
$platform = system_identify_specific_platform();
257

    
258
if ($platform['name'] == "uFW") {
259
	$interfaces_menu[] = array(gettext("Switches"), "/switch_system.php");
260
	$div = true;
261
}
262

    
263
if ($div) {
264
	$interfaces_menu[] = array("-DIVIDER-", "");
265
}
266

    
267
$opts = get_configured_interface_with_descr(false, true);
268
foreach ($opts as $oif => $odescr) {
269
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
270
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
271
	}
272
}
273

    
274
// Interface list no longer sorted per Redmine #6753
275
// $interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
276
$interfaces_menu = array_merge($interfaces_menu, return_ext_menu("Interfaces"));
277

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

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

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

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

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

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

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

    
326
// Status
327
$status_menu = array();
328
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
329
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
330
$status_menu[] = array(gettext("Dashboard"), "/index.php");
331
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
332
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
333
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
334
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php?user=true");
335
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
336
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
337
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
338
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
339
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
340
$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
341
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
342
$status_menu[] = array(gettext("Services"), "/status_services.php");
343
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
344
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
345

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

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

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

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

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

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

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

    
396
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
397

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

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

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

    
417
$menuclass = "static";
418

    
419
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
420
	$menuclass = "fixed";
421
}
422

    
423
$numColumns = $user_settings['webgui']['dashboardcolumns'];
424

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

    
429
$display_notices = false;
430
$allow_clear_notices = false;
431

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

    
482
					$menu_output = output_menu($item['menu'], $item['href'], $item['name']);
483

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

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

    
520
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
521
	<header class="header">
522

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

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

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

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

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

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

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

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

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

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

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

    
627
?>
628
	<?php if (!$g['disablehelpicon'] && isAllowedPage("help.php")): ?>
629
		<li>
630
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
631
				<i class="fa fa-question-circle"></i>
632
			</a>
633
		</li>
634
	<?php endif?>
635
		</ul>
636
	</header>
637
<?php
638
/* if upgrade in progress, alert user */
639
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
640
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
641
		$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']);
642
	} else {
643
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
644
		$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>");
645
		$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')));
646
	}
647

    
648
	print_info_box($warning_text);
649
}
650

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

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

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

    
675
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
676
			</div>
677

    
678
			<div class="modal-body">
679
<?php
680
	$noticeCategories = array();
681

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

    
688
			$notice['time'] = $time;
689
			array_push($noticeCategories[ $notice['category'] ], $notice);
690
		}
691
	}
692

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

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

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

    
743
<?php
744
endif; // ($display_notices)
745

    
746
// Get the flash Messages
747
get_flash_message();
(63-63/225)