Project

General

Profile

Download (28.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-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * Licensed under the Apache License, Version 2.0 (the "License");
12
 * you may not use this file except in compliance with the License.
13
 * You may obtain a copy of the License at
14
 *
15
 * http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * Unless required by applicable law or agreed to in writing, software
18
 * distributed under the License is distributed on an "AS IS" BASIS,
19
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
 * See the License for the specific language governing permissions and
21
 * limitations under the License.
22
 */
23

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

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

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

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

    
41
$cssfile = "/css/pfSense.css";
42

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

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

    
54
?>
55
<!DOCTYPE html>
56
<html lang="en">
57
<head>
58
	<meta name="viewport" content="width=device-width, initial-scale=1">
59

    
60
	<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
61
	<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
62
	<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
63
	<link rel="manifest" href="/manifest.json">
64
	<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
65
	<meta name="theme-color" content="#ffffff">
66

    
67
	<link rel="stylesheet" href="/vendor/font-awesome/css/all.min.css?v=<?=filemtime('/usr/local/www/vendor/font-awesome/css/all.min.css')?>">
68
	<link rel="stylesheet" href="/vendor/font-awesome/css/v4-shims.css?v=<?=filemtime('/usr/local/www/vendor/font-awesome/css/v4-shims.css')?>">
69
	<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css?v=<?=filemtime('/usr/local/www/vendor/sortable/sortable-theme-bootstrap.css')?>">
70
	<link rel="stylesheet" href="<?=$cssfile?>?v=<?=filemtime('/usr/local/www/' . $cssfile)?>" />
71

    
72
	<title><?=$tabtitle?></title>
73
	<script type="text/javascript">
74
	//<![CDATA[
75
	var events = events || [];
76
	var newSeperator = false;
77
	//]]>
78
	</script>
79
</head>
80

    
81
<?php
82

    
83
/* Determine automated help URL. Should output the page name and parameters
84
   separately */
85
$uri_split = "";
86
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
87

    
88
/* If there was no match, there were no parameters, just grab the filename
89
   Otherwise, use the matched filename from above. */
90
if (empty($uri_split[0])) {
91
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
92
} else {
93
	$pagename = $uri_split[1];
94
}
95

    
96
/* If the page name is still empty, the user must have requested / (index.php) */
97
if (empty($pagename)) {
98
	$pagename = "index.php";
99
}
100

    
101
/* If the filename is pkg_edit.php or wizard.php, reparse looking
102
	for the .xml filename */
103
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
104
	$param_split = explode('&', $uri_split[2]);
105
	foreach ($param_split as $param) {
106
		if (substr($param, 0, 4) == "xml=") {
107
			$xmlfile = explode('=', $param);
108
			$pagename = $xmlfile[1];
109
		}
110
	}
111
} else if ($pagename == "status_logs.php") {
112
	$param_split = explode('&', $uri_split[2]);
113
	foreach ($param_split as $param) {
114
		if (substr($param, 0, 8) == "logfile=") {
115
			$logtype = explode('=', $param);
116
			$pagename .= '-' . $logtype[1];
117
		}
118
	}
119
}
120

    
121
// Build the full help URL.
122
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
123

    
124
/*
125
 * Read files from $g['ext_menu_path']/*.xml and fill an array with menu info
126
 */
127
function read_ext_menu_path_data() {
128
	global $g;
129

    
130
	$result = array();
131

    
132
	if (!is_dir($g['ext_menu_path'])) {
133
		return $result;
134
	}
135

    
136
	foreach (glob("{$g['ext_menu_path']}/*.xml") as $menu_xml) {
137
		$xml_data = parse_xml_config_pkg($menu_xml, "packagegui");
138
		if (empty($xml_data['menu'])) {
139
			continue;
140
		}
141
		foreach ($xml_data['menu'] as $menu) {
142
			$result[] = $menu;
143
		}
144
	}
145

    
146
	return $result;
147
}
148

    
149
// Create a menu entry of any installed packages in the specified category
150
// (Now reads the menu information from $config['installedpackages']['menu'] only)
151
function return_ext_menu($section) {
152
	global $config, $ext_menu_path_data;
153

    
154
	$htmltext = "";
155
	$extarray = array();
156
	$ext_menu_entries = array();
157

    
158
	if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
159
		foreach ($config['installedpackages']['menu'] as $menu) {
160
			if (isset($menu['name']) && ($menu['name'] != "AutoConfigBackup")) { // AutoConfigBackup was moved to a built-in function
161
	//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
162
				if (isset($menu['section']) && ($menu['section'] == $section)) {
163
					$ext_menu_entries[] = $menu;
164
				}
165
			}
166
		}
167
	}
168

    
169
	foreach ($ext_menu_path_data as $menu) {
170
		if ($menu['section'] == $section) {
171
			$ext_menu_entries[] = $menu;
172
		}
173
	}
174

    
175
	foreach ($ext_menu_entries as $menu) {
176
		if ($menu['url'] != "") {
177
			$test_url = $menu['url'];
178
			$addresswithport = getenv("HTTP_HOST");
179
			$colonpos = strpos($addresswithport, ":");
180

    
181
			if ($colonpos !== false) {
182
				//my url is actually just the IP address of the pfsense box
183
				$myurl = substr($addresswithport, 0, $colonpos);
184
			} else {
185
				$myurl = $addresswithport;
186
			}
187
			$description = str_replace('$myurl', $myurl, $menu['url']);
188
		} else {
189
			$description = '/pkg.php?xml=' . $menu['configfile'];
190
			$test_url=$description;
191
		}
192

    
193
		if (isAllowedPage($test_url)) {
194
			$extarray[] = array($menu['name'], $description);
195
		}
196
	}
197

    
198
	return $extarray;
199
}
200

    
201
function output_menu($arrayitem, $target = null, $section = "") {
202
	$output = "";
203

    
204
	foreach ($arrayitem as $item) {
205

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

    
212
			if ($target) {
213
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
214
			}
215

    
216
			$class = "navlnk";
217

    
218
			if ($item['class']) {
219
				$class .= " {$item['class']}";
220
			}
221

    
222
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
223

    
224
			if ($item['style']) {
225
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
226
			}
227

    
228

    
229
			if ($item[0] == '-DIVIDER-') {
230
				$output .= ' <li class="divider"></li>';
231
			} else {
232
				$output .= "<li>". sprintf("<a %s %s>%s</a>", $attr, ($item[1] == "/index.php?logout") ? "usepost":"",$item[0]) . "</li>\n";
233
			}
234
		}
235
	}
236

    
237
	return $output;
238
}
239

    
240
$ext_menu_path_data = read_ext_menu_path_data();
241

    
242
// System
243
$system_menu = array();
244
$system_menu[] = array(gettext("Logout") . " (" . $_SESSION['Username'] . ")", "/index.php?logout");
245
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
246
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
247
$system_menu[] = array(gettext("General Setup"), "/system.php");
248
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
249
$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
250
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
251
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
252
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php");
253
if (!isAllowedPage("system_usermanager.php")) {
254
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
255
} else {
256
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
257
}
258

    
259
if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php")) {
260
	$system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
261
}
262

    
263
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
264

    
265
// Interfaces
266
// NOTE:
267
// Now that menus are sorted, adding a DIVIDER must be done after the sorting so an array is formed of the
268
// items above the divider and another for below it. These are then sorted and combined with the divider
269
$interfaces_menu = array();
270
$interfaces_top = array();
271
$interfaces_bottom = array();
272

    
273
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
274
	$interfaces_top[] = array(gettext("Assignments"), "/interfaces_assign.php");
275
	$div = true;
276
}
277

    
278
$platform = system_identify_specific_platform();
279

    
280
if ($platform['name'] == "uFW") {
281
	$interfaces_top[] = array(gettext("Switches"), "/switch_system.php");
282
}
283

    
284
$opts = get_configured_interface_with_descr(true);
285

    
286
foreach ($opts as $oif => $odescr) {
287
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
288
		$interfaces_bottom[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
289
	}
290
}
291

    
292
$interfaces_bottom = array_merge($interfaces_bottom, return_ext_menu("Interfaces"));
293

    
294
if ($user_settings['webgui']['interfacessort']) {
295
	$interfaces_bottom = msort($interfaces_bottom, 0);
296
}
297

    
298
// Combine the top section, the divider and the bottom section of this menu
299
$interfaces_menu = array_merge($interfaces_top, [array(0 => "-DIVIDER-")], $interfaces_bottom);
300

    
301
// Firewall
302
$firewall_menu = array();
303
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
304
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
305
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
306
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
307
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
308
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
309
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
310

    
311
// Services
312
$services_menu = array();
313
$services_menu[] = array(gettext("Auto Config Backup"), "/services_acb.php");
314
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
315
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
316
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
317
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
318
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
319

    
320
if ($g['services_dhcp_server_enable']) {
321
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
322
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
323
}
324

    
325
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
326
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
327
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
328
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
329
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
330

    
331
if (count($config['interfaces']) > 1) {
332
	/* no use for UPnP in single-interface deployments
333
	remove to reduce user confusion
334
	*/
335
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
336
}
337

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

    
341
// VPN
342
$vpn_menu = array();
343
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
344
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
345
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
346
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
347
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
348

    
349
// Status
350
$status_menu = array();
351
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
352
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
353
$status_menu[] = array(gettext("Dashboard"), "/index.php");
354
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
355
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
356
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
357
$status_menu[] = array(gettext("DNS Resolver"), "/status_unbound.php");
358
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php?user=true");
359
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
360
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
361
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
362
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
363
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
364
$status_menu[] = array(gettext("Services"), "/status_services.php");
365
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
366
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php");
367

    
368
if (count($config['interfaces']) > 1) {
369
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
370
}
371

    
372
$wifdescrs = array();
373
$ifentries = get_configured_interface_with_descr();
374
foreach ($ifentries as $ent => $entdesc) {
375
	if (is_array($config['interfaces'][$ent]['wireless']) &&
376
	    preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
377
		$wifdescrs[$ent] = $entdesc;
378
	}
379
}
380

    
381
if (count($wifdescrs) > 0) {
382
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
383
}
384

    
385
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
386

    
387
// Diagnostics
388
$diagnostics_menu = array();
389
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
390
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
391
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
392
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
393
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
394
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
395
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
396

    
397
if (file_exists("/var/run/gmirror_active")) {
398
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
399
}
400

    
401
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
402
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
403
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
404
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
405
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
406
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
407
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
408
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
409
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
410
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
411
$diagnostics_menu[] = array(gettext("S.M.A.R.T. Status"), "/diag_smart.php");
412
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
413
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
414
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
415
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
416
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
417
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
418

    
419
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
420

    
421
if (!$g['disablehelpmenu']) {
422
	$help_menu = array();
423
	$help_menu[] = array(gettext("About this Page"), $helpurl);
424
	if ($g['product_name'] == "pfSense") {
425
		$help_menu[] = array(gettext("Bug Database"), "https://redirects.netgate.com/issues");
426
	}
427

    
428
	$help_menu[] = array(gettext("User Forum"), "https://redirects.netgate.com/forum");
429
	$help_menu[] = array(gettext("Documentation"), "https://redirects.netgate.com/docs");
430
	$help_menu[] = array(gettext("Paid Support"), "https://redirects.netgate.com/support");
431
	$help_menu[] = array(gettext("pfSense Book"), "https://redirects.netgate.com/book");
432
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://redirects.netgate.com/fbsdhandbook");
433
	$help_menu[] = array(gettext("User survey"), "https://redirects.netgate.com/survey_1");
434
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
435
}
436

    
437
$menuclass = "static";
438

    
439
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
440
	$menuclass = "fixed";
441
}
442

    
443
$numColumns = (int) $user_settings['webgui']['dashboardcolumns'];
444

    
445
if (($pagename === "index.php") && ($numColumns > 2)) {
446
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
447
}
448

    
449
$display_notices = false;
450
$allow_clear_notices = false;
451

    
452
if (are_notices_pending()) {
453
	// Evaluate user privs to determine if notices should be displayed, and if the user can clear them.
454
	$user_entry = getUserEntry($_SESSION['Username']);
455
	if (isAdminUID($_SESSION['Username']) || userHasPrivilege($user_entry, "user-view-clear-notices") || userHasPrivilege($user_entry, "page-all")) {
456
		$display_notices = true;
457
		$allow_clear_notices = true;
458
	} elseif (userHasPrivilege($user_entry, "user-view-notices")) {
459
		$display_notices = true;
460
	}
461
}
462
?>
463
<body id="<?=$numColumns?>">
464
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
465
	<div class="container">
466
		<div class="navbar-header">
467
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
468
				<span class="sr-only">Toggle navigation</span>
469
				<span class="icon-bar"></span>
470
				<span class="icon-bar"></span>
471
				<span class="icon-bar"></span>
472
			</button>
473
			<a class="navbar-brand" href="/">
474
				<?php include("/usr/local/www/logo.svg"); ?>
475
				<span style="color:white;font-size:.5em;text-transform:uppercase;letter-spacing:1px;">Community Edition</span>
476
			</a>
477
		</div>
478
		<div class="collapse navbar-collapse" id="pf-navbar">
479
			<ul class="nav navbar-nav">
480
			<?php
481
                if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
482
                    $help_menu_title = htmlspecialchars($config['system']['hostname']);
483
                }
484
                elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
485
                    $help_menu_title = htmlspecialchars($system_url);
486
                }
487
                else {
488
                    $help_menu_title = 'Help';
489
                }
490
                foreach ([
491
					['name' => 'System',	     'menu' => $system_menu,	  'href' => null],
492
					['name' => 'Interfaces',     'menu' => $interfaces_menu,  'href' => null],
493
					['name' => 'Firewall',	     'menu' => $firewall_menu,	  'href' => null],
494
					['name' => 'Services',	     'menu' => $services_menu,	  'href' => null],
495
					['name' => 'VPN',		     'menu' => $vpn_menu,		  'href' => null],
496
					['name' => 'Status',	     'menu' => $status_menu,	  'href' => null],
497
					['name' => 'Diagnostics',    'menu' => $diagnostics_menu, 'href' => null],
498
                    ['name' => $help_menu_title, 'menu' => $help_menu,		  'href' => '_blank']
499
				] as $item):
500
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
501
						continue;
502
					}
503

    
504
					$menu_output = output_menu($item['menu'], $item['href'], $item['name']);
505

    
506
					if (strlen($menu_output) > 0):
507
?>
508
				<li class="dropdown">
509
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
510
						<?=gettext($item['name'])?>
511
						<span class="caret"></span>
512
					</a>
513
					<ul class="dropdown-menu" role="menu"><?=$menu_output?></ul>
514
				</li>
515

    
516
<?php
517
					endif;
518
			 	endforeach?>
519
			</ul>
520
			<ul class="nav navbar-nav navbar-right">
521
				<?php if ($display_notices):?>
522
					<?php $notices = get_notices()?>
523
					<li class="dropdown">
524
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
525
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
526
							<span class="badge bg-danger"><?=count($notices)?></span>
527
						</a>
528
					</li>
529
				<?php
530
					endif;
531
				?>
532
					<li class="dropdown">
533
						<a href="/index.php?logout" usepost>
534
							<i class="fa fa-sign-out" title="<?=gettext("Logout") . " (" . $_SESSION['Username'] . "@" . htmlspecialchars($system_url) . ")"?>"></i>
535
						</a>
536
					</li>
537
			</ul>
538
		</div>
539
	</div>
540
</nav>
541

    
542
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
543

    
544
<?php
545
	// Print a warning if current user = admin and the password hash is still set to the default value
546
	if ($_SESSION['Username'] == "admin") {
547
		$cu = getUserEntry("admin");
548

    
549
		$hash = (empty($cu['bcrypt-hash']) ? $cu['password'] : $cu['bcrypt-hash']);
550

    
551
		if (password_verify($g['factory_shipped_password'], $hash)) {
552
			print('<div class="alert alert-danger">' .
553
				sprintf(gettext('%sWARNING:%s The \'admin\' account password is set to the default value. ' .
554
				' %s Change the password in the User Manager.%s'),
555
				'<strong>', '</strong>', '<a href="/system_usermanager.php?act=edit&userid=' . $cu['uid'] . '">', '</a>') .
556
				'</div>');
557
		}
558
	}
559
?>
560

    
561
	<header class="header">
562

    
563
<?php
564
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
565
	if (isset($notitle)) {
566
		print('<br />');
567
		unset($notitle);
568
	} else {
569
		if (isset($pglinks)) {
570
			print(genhtmltitle($pgtitle, $pglinks));
571
		} else {
572
			print(genhtmltitle($pgtitle));
573
		}
574
	}
575
?>
576
		<ul class="context-links">
577

    
578
	<?php if (isset($widgets)): ?>
579
		<li>
580
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
581
				<i class="fa fa-save icon-pointer"></i>
582
			</a>
583
		</li>
584
	<?php endif?>
585

    
586
	<?php if ($dashboard_available_widgets_hidden): ?>
587
		<li>
588
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
589
				<i class="fa fa-plus icon-pointer"></i>
590
			</a>
591
		</li>
592
	<?php endif?>
593

    
594
	<?php if ($system_logs_filter_form_hidden): ?>
595
		<li>
596
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
597
				<i class="fa fa-filter icon-pointer"></i>
598
			</a>
599
		</li>
600
	<?php endif ?>
601

    
602
	<?php if ($system_logs_manage_log_form_hidden):
603
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
604
			if (isAllowedPage("status_logs_settings.php")) {
605
	?>
606
		<li>
607
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
608
				<i class="fa fa-wrench icon-pointer"></i>
609
			</a>
610
		</li>
611
	<?php	}
612
		endif
613
	?>
614

    
615
	<?php if ($monitoring_settings_form_hidden): ?>
616
		<li>
617
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
618
				<i class="fa fa-wrench icon-pointer"></i>
619
			</a>
620
		</li>
621
	<?php endif?>
622

    
623
	<?php if ($status_monitoring): ?>
624
		<li>
625
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
626
				<i class="fa fa-repeat icon-pointer"></i>
627
			</a>
628
		</li>
629
		<li>
630
			<a class="export-graph" id="export-graph" title="<?=gettext("Export Graph")?>">
631
				<i class="fa fa-download icon-pointer"></i>
632
			</a>
633
		</li>
634
	<?php endif?>
635

    
636
<?php
637
/* Determine shortcut section for XML-based packages */
638
if (empty($shortcut_section) && !empty($xmlfile)) {
639
	$shortcut_section = basename($pagename, '.xml');
640
}
641

    
642
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
643
	$ssvc = array();
644
	switch ($shortcut_section) {
645
		case "openvpn":
646
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
647
			break;
648
		case "captiveportal":
649
			$ssvc = find_service_by_cp_zone($cpzone);
650
			break;
651
		default:
652
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
653
	}
654
	if (!empty($ssvc)) {
655
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
656
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
657
	}
658
}
659

    
660
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
661
	echo '<li>' . $link . '</li>';
662
}
663

    
664
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
665
	echo '<li>' . $link . '</li>';
666
}
667

    
668
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
669
	echo '<li>' . $link . '</li>';
670
}
671

    
672
?>
673
	<?php if (!$g['disablehelpicon'] && isAllowedPage("help.php")): ?>
674
		<li>
675
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
676
				<i class="fa fa-question-circle"></i>
677
			</a>
678
		</li>
679
	<?php endif?>
680
		</ul>
681
	</header>
682
<?php
683
/* if upgrade in progress, alert user */
684
$warning_text = "";
685
if (file_exists('/conf/needs_package_sync') && platform_booting()) {
686
	$warning_text = sprintf(gettext(
687
	    '%1$s%3$s is booting, then packages will be reinstalled in the ' .
688
	    'background.%2$s%1$sDo not make changes in the GUI until this is ' .
689
	    'complete.%2$s'), '<p>', '</p>', $g['product_name']);
690
} elseif (is_subsystem_dirty('packagelock')) {
691
	$pgtitle = array(gettext("System"), gettext("Package Manager"));
692
	$warning_text = sprintf(gettext('%1$sPackages are currently being ' .
693
	    'reinstalled in the background.%2$s%1$sDo not make changes in ' .
694
	    'the GUI until this is complete.%2$s'), '<p>', '</p>');
695
	$warning_text .= sprintf(gettext('%1$sIf the above message is still ' .
696
	    'displayed after a couple of hours, use the \'Clear Package ' .
697
	    'Lock\' button on the %3$s page and reinstall packages manually.' .
698
	    '%2$s'), '<p>', '</p>', sprintf('<a href="diag_backup.php" ' .
699
	    'title="%1$s &gt; %2$s">%1$s &gt; %2$s</a>', gettext('Diagnostics'),
700
	    htmlspecialchars(gettext('Backup & Restore'))));
701
}
702

    
703
if (!empty($warning_text)) {
704
	print_info_box($warning_text);
705
}
706

    
707
/*	If this page is being remotely managed then do not allow the loading of the contents. */
708
if ($config['remote_managed_pages']['item']) {
709
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
710
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
711
			print_info_box(gettext("This page is currently being managed by a remote machine."));
712
			include("foot.inc");
713
			exit;
714
		}
715
	}
716
}
717

    
718
// Modal notices window
719
// The notices modal needs to be outside of the page display div or things get messy
720
if ($display_notices):
721
?>
722

    
723
<div id="notices" class="modal fade" role="dialog">
724
	<div class="modal-dialog">
725
		<div class="modal-content">
726
			<div class="modal-header">
727
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
728
					<span aria-hidden="true">&times;</span>
729
				</button>
730

    
731
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
732
			</div>
733

    
734
			<div class="modal-body">
735
<?php
736
	$noticeCategories = array();
737

    
738
	if (is_array($notices)) {
739
		foreach ($notices as $time => $notice) {
740
			if (!isset($noticeCategories[ $notice['category'] ])) {
741
				$noticeCategories[ $notice['category'] ] = array();
742
			}
743

    
744
			$notice['time'] = $time;
745
			array_push($noticeCategories[ $notice['category'] ], $notice);
746
		}
747
	}
748

    
749
	foreach ($noticeCategories as $category => $catNotices):?>
750
				<h4><?=$category?></h4>
751
				<ul>
752
<?php
753
	foreach ($catNotices as $notice):
754
?>
755
					<li>
756
						<b>
757
<?php if (!empty($notice['url'])):?>
758
							<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
759
<?php endif;?>
760
						</b>
761
						<?=str_replace("\n", "<br/>", htmlspecialchars($notice['notice']))?>
762
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
763
					</li>
764
<?php	endforeach;?>
765
				</ul>
766
<?php endforeach;?>
767
			</div>
768

    
769
			<div class="modal-footer">
770
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
771
<?php if ($allow_clear_notices && isAllowedPage("/index.php")):?>
772
				<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>
773
<?php endif;?>
774
			</div>
775
		</div>
776
	</div>
777
</div>
778

    
779
<script type="text/javascript">
780
//<![CDATA[
781
	events.push(function() {
782
	    $('#clearallnotices').click(function() {
783
			ajaxRequest = $.ajax({
784
				url: "/index.php",
785
				type: "post",
786
				data: { closenotice: "all"},
787
				success: function() {
788
					window.location = window.location.href;
789
				},
790
				failure: function() {
791
					alert("Error clearing notices!");
792
				}
793
			});
794
		});
795
	});
796
//]]>
797
</script>
798

    
799
<?php
800
endif; // ($display_notices)
801

    
802
// Get the flash Messages
803
get_flash_message();
(68-68/230)