Project

General

Profile

Download (22.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* ====================================================================
3
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
4
 *
5
 *	Redistribution and use in source and binary forms, with or without modification,
6
 *	are permitted provided that the following conditions are met:
7
 *
8
 *	1. Redistributions of source code must retain the above copyright notice,
9
 *		this list of conditions and the following disclaimer.
10
 *
11
 *	2. Redistributions in binary form must reproduce the above copyright
12
 *		notice, this list of conditions and the following disclaimer in
13
 *		the documentation and/or other materials provided with the
14
 *		distribution.
15
 *
16
 *	3. All advertising materials mentioning features or use of this software
17
 *		must display the following acknowledgment:
18
 *		"This product includes software developed by the pfSense Project
19
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
20
 *
21
 *	4. The names "pfSense" and "pfSense Project" must not be used to
22
 *		 endorse or promote products derived from this software without
23
 *		 prior written permission. For written permission, please contact
24
 *		 coreteam@pfsense.org.
25
 *
26
 *	5. Products derived from this software may not be called "pfSense"
27
 *		nor may "pfSense" appear in their names without prior written
28
 *		permission of the Electric Sheep Fencing, LLC.
29
 *
30
 *	6. Redistributions of any form whatsoever must retain the following
31
 *		acknowledgment:
32
 *
33
 *	"This product includes software developed by the pfSense Project
34
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
35
 *
36
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
37
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
40
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
48
 *
49
 *	====================================================================
50
 *
51
 */
52

    
53
require_once("globals.inc");
54
require_once("functions.inc");
55
require_once("shortcuts.inc");
56
require_once("service-utils.inc");
57
require_once('notices.inc');
58

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

    
61
$pagetitle = gentitle($pgtitle);
62

    
63
if (isset($config['system']['webgui']['pagenamefirst'])) {
64
	$tabtitle = $pagetitle . " - " . htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
65
} else {
66
	$tabtitle = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']) . " - " . $pagetitle;
67
}
68

    
69
$cssfile = "/bootstrap/css/pfSense.css";
70

    
71
if (isset($config['system']['webgui']['webguicss'])) {
72
	if (file_exists("/usr/local/www/bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
73
		$cssfile = "/bootstrap/css/" . $config['system']['webgui']['webguicss'];
74
	}
75
}
76

    
77
// set default colmns to two if unset
78
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
79
	$config['system']['webgui']['dashboardcolumns'] = 2;
80
}
81

    
82
?>
83
<!DOCTYPE html>
84
<html lang="en">
85
<head>
86
	<meta name="viewport" content="width=device-width, initial-scale=1">
87
	<link rel="stylesheet" href="<?=$cssfile?>" />
88
	<link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
89
	<link rel="stylesheet" href="/sortable/sortable-theme-bootstrap.css">
90
	<title><?=$tabtitle?></title>
91
	<script type="text/javascript">
92
	//<![CDATA[
93
	var events = events || [];
94
	//]]>
95
	</script>
96
</head>
97

    
98
<?php
99

    
100
/* Determine automated help URL. Should output the page name and parameters
101
   separately */
102
$uri_split = "";
103
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
104

    
105
/* If there was no match, there were no parameters, just grab the filename
106
   Otherwise, use the matched filename from above. */
107
if (empty($uri_split[0])) {
108
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
109
} else {
110
	$pagename = $uri_split[1];
111
}
112

    
113
/* If the page name is still empty, the user must have requested / (index.php) */
114
if (empty($pagename)) {
115
	$pagename = "index.php";
116
}
117

    
118
/* If the filename is pkg_edit.php or wizard.php, reparse looking
119
	for the .xml filename */
120
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
121
	$param_split = explode('&', $uri_split[2]);
122
	foreach ($param_split as $param) {
123
		if (substr($param, 0, 4) == "xml=") {
124
			$xmlfile = explode('=', $param);
125
			$pagename = $xmlfile[1];
126
		}
127
	}
128
}
129

    
130
// Build the full help URL.
131
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
132

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

    
138
	$htmltext = "";
139
	$extarray = array();
140

    
141
	if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
142
		foreach ($config['installedpackages']['menu'] as $menu) {
143
//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
144
			if ($menu['section'] != $section) {
145
				continue;
146
			}
147

    
148
			if ($menu['url'] != "") {
149
				$test_url = $menu['url'];
150
				$addresswithport = getenv("HTTP_HOST");
151
				$colonpos = strpos($addresswithport, ":");
152

    
153
				if ($colonpos !== false) {
154
					//my url is actually just the IP address of the pfsense box
155
					$myurl = substr($addresswithport, 0, $colonpos);
156
				} else {
157
					$myurl = $addresswithport;
158
				}
159
				$description = str_replace('$myurl', $myurl, $menu['url']);
160
			} else {
161
				$description = '/pkg.php?xml=' . $menu['configfile'];
162
				$test_url=$description;
163
			}
164

    
165
			if (isAllowedPage($test_url)) {
166
				$extarray[] = array($menu['name'], $description);
167
			}
168
		}
169
	}
170

    
171
	return $extarray;
172
}
173

    
174
function output_menu($arrayitem, $target = null) {
175
	foreach ($arrayitem as $item) {
176
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout") {
177
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
178
			if ($target) {
179
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
180
			}
181
			$class = "navlnk";
182
			if ($item['class']) {
183
				$class .= " {$item['class']}";
184
			}
185
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
186
			if ($item['style']) {
187
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
188
			}
189
			echo "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]). "</li>\n";
190
		}
191
	}
192
}
193

    
194
// System
195
$system_menu = array();
196
$system_menu[] = array(gettext("Logout"), "/index.php?logout");
197
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
198
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
199
$system_menu[] = array(gettext("General Setup"), "/system.php");
200
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
201
if ($g['platform'] == $g['product_name'] or $g['platform'] == "nanobsd") {
202
	$system_menu[] = array(gettext("Packages"), "/pkg_mgr_installed.php");
203
}
204
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
205
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
206
$system_menu[] = array(gettext("Cert Manager"), "/system_camanager.php");
207
if (!isAllowedPage("system_usermanager.php*")) {
208
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
209
} else {
210
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
211
}
212

    
213
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
214

    
215
// Interfaces
216
$interfaces_menu = array();
217
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
218
	$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
219
}
220
$opts = get_configured_interface_with_descr(false, true);
221
foreach ($opts as $oif => $odescr) {
222
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
223
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
224
	}
225
}
226
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
227

    
228
// Firewall
229
$firewall_menu = array();
230
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
231
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
232
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
233
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
234
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
235
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
236
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
237

    
238
// Services
239
$services_menu = array();
240
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
241
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
242
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
243
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
244
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
245

    
246
if ($g['services_dhcp_server_enable']) {
247
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
248
	$services_menu[] = array(gettext("DHCPv6 Server/RA"), "/services_dhcpv6.php");
249
}
250

    
251
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
252
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
253
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
254
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
255
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
256
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
257

    
258
if (count($config['interfaces']) > 1) {
259
	/* no use for UPnP in single-interface deployments
260
	remove to reduce user confusion
261
	*/
262
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
263
}
264

    
265
$services_menu[] = array(gettext("Wake on LAN"), "/services_wol.php");
266
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
267

    
268
// VPN
269
$vpn_menu = array();
270
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
271
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
272
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
273
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
274
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
275

    
276
// Status
277
$status_menu = array();
278
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
279
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
280
$status_menu[] = array(gettext("Dashboard"), "/index.php");
281
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
282
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
283
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
284
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
285
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
286
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
287
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
288
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
289
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
290

    
291
if ($g['platform'] == $g['product_name']) {
292
	$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
293
}
294

    
295
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
296
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
297
$status_menu[] = array(gettext("Services"), "/status_services.php");
298
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
299
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
300

    
301
if (count($config['interfaces']) > 1) {
302
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
303
}
304

    
305
$ifentries = get_configured_interface_with_descr();
306
foreach ($ifentries as $ent => $entdesc) {
307
	if (is_array($config['interfaces'][$ent]['wireless']) &&
308
	    preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
309
		$wifdescrs[$ent] = $entdesc;
310
	}
311
}
312

    
313
if (count($wifdescrs) > 0) {
314
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
315
}
316

    
317
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
318

    
319
// Diagnostics
320
$diagnostics_menu = array();
321
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
322
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
323
$diagnostics_menu[] = array(gettext("Backup/Restore"), "/diag_backup.php");
324
$diagnostics_menu[] = array(gettext("Command Prompt"), "/exec.php");
325
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
326
$diagnostics_menu[] = array(gettext("Edit File"), "/edit.php");
327
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
328

    
329
if (file_exists("/var/run/gmirror_active")) {
330
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
331
}
332

    
333
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
334
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
335
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
336
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
337
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
338
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
339
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
340
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
341
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
342
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
343
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
344
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
345
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
346
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
347
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
348
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
349
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
350

    
351
if ($g['platform'] == "nanobsd") {
352
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
353
}
354

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

    
359
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
360

    
361
$gold_menu = array();
362
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
363
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
364

    
365
if (!$g['disablehelpmenu']) {
366
	$help_menu = array();
367
	$help_menu[] = array(gettext("About this Page"), $helpurl);
368
	if ($g['product_name'] == "pfSense") {
369
		$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
370
	}
371

    
372
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
373
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
374
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
375
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
376
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
377
	$help_menu[] = array(gettext("Search Portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
378
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
379
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
380
}
381

    
382
$menuclass = "static";
383

    
384
if (isset($config['system']['webgui']['webguifixedmenu'])) {
385
	$menuclass = "fixed";
386
}
387

    
388
$numColumns = $config['system']['webgui']['dashboardcolumns'];
389

    
390
if (($pagename === "index.php") && ($numColumns > 2)) {
391
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
392
}
393
?>
394
<body id="<?=$numColumns?>">
395
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
396
	<div class="container">
397
		<div class="navbar-header">
398
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
399
				<span class="sr-only">Toggle navigation</span>
400
				<span class="icon-bar"></span>
401
				<span class="icon-bar"></span>
402
				<span class="icon-bar"></span>
403
			</button>
404
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" /></a>
405
		</div>
406
		<div class="collapse navbar-collapse" id="pf-navbar">
407
			<ul class="nav navbar-nav">
408
			<?php foreach ([
409
					['name' => 'System',	  'menu' => $system_menu,	   'href' => null],
410
					['name' => 'Interfaces',  'menu' => $interfaces_menu,  'href' => null],
411
					['name' => 'Firewall',	  'menu' => $firewall_menu,	   'href' => null],
412
					['name' => 'Services',	  'menu' => $services_menu,	   'href' => null],
413
					['name' => 'VPN',		  'menu' => $vpn_menu,		   'href' => null],
414
					['name' => 'Status',	  'menu' => $status_menu,	   'href' => null],
415
					['name' => 'Diagnostics', 'menu' => $diagnostics_menu, 'href' => null],
416
					['name' => 'Gold',		  'menu' => $gold_menu,		   'href' => '_blank'],
417
					['name' => 'Help',		  'menu' => $help_menu,		   'href' => '_blank']
418
				] as $item):
419
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
420
						continue;
421
					} ?>
422
				<li class="dropdown">
423
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
424
						<?=gettext($item['name'])?>
425
						<span class="caret"></span>
426
					</a>
427
					<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'])?></ul>
428
				</li>
429
			<?php endforeach?>
430
				<?php if (are_notices_pending()):?>
431
					<?php $notices = get_notices()?>
432
					<li class="dropdown">
433
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
434
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
435
							<span class="badge bg-danger"><?=count($notices)?></span>
436
						</a>
437
					</li>
438
				<?php
439
					endif;
440
				?>
441
					<li class="dropdown">
442
						<a href="/index.php?logout">
443
							<i class="fa fa-sign-out" title="<?=gettext("Log out")?>"></i>
444
						</a>
445
					</li>
446
			</ul>
447
		</div>
448
	</div>
449
</nav>
450

    
451
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
452
	<header class="header">
453

    
454
<?php
455
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
456
	if (isset($notitle)) {
457
		print('<br />');
458
		unset($notitle);
459
	} else {
460
		print(genhtmltitle($pgtitle));
461
	}
462
?>
463
		<ul class="context-links">
464
<?php
465

    
466
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) {
467
	$ssvc = array();
468
	switch ($shortcut_section) {
469
		case "openvpn":
470
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
471
			break;
472
		case "captiveportal":
473
			$ssvc = find_service_by_cp_zone($cpzone);
474
			break;
475
		default:
476
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
477
	}
478
	if (!empty($ssvc)) {
479
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
480
		echo '<li>'. get_service_control_GET_links($ssvc, false). '</li>';
481
	}
482
}
483

    
484
echo '<li>'. get_shortcut_main_link($shortcut_section, false). '</li>';
485
echo '<li>'. get_shortcut_status_link($shortcut_section, false). '</li>';
486
echo '<li>'. get_shortcut_log_link($shortcut_section, false). '</li>';
487

    
488
?>
489
	<?php if (!$g['disablehelpicon']): ?>
490
		<li>
491
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>" class="help-icon">
492
				<i class="fa fa-question-circle"></i>
493
			</a>
494
		</li>
495
	<?php endif?>
496
		</ul>
497
	</header>
498
<?php
499
/* if upgrade in progress, alert user */
500
if (is_subsystem_dirty('packagelock') || file_exists('/conf/needs_package_sync' && platform_booting())) {
501
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
502
		$warning_text = sprintf(gettext("%s is booting then packages will be reinstalled in the background.<p>Do not make changes in the GUI until this is complete."), $g['product_name']);
503
	} else {
504
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
505
		$warning_text = gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.");
506
		$warning_text .= gettext("<p>If the above message is still displayed after a couple of hours, use the 'Clear Package Lock' button on the <a href='diag_backup.php' title='Backup/Restore'>Backup/Restore page</a> and reinstall packages manually.");
507
	}
508

    
509
	print_info_box($warning_text);
510
}
511

    
512
$pgtitle_output = true;
513

    
514
/*	If this page is being remotely managed then do not allow the loading of the contents. */
515
if ($config['remote_managed_pages']['item']) {
516
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
517
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
518
			print_info_box_np("This page is currently being managed by a remote machine.");
519
			include("foot.inc");
520
			exit;
521
		}
522
	}
523
}
524

    
525
// Modal notices window
526
// The notices modal needs to be outside of the page display div or things get messy
527
if (are_notices_pending()):?>
528

    
529
<div id="notices" class="modal fade" role="dialog">
530
	<div class="modal-dialog">
531
		<div class="modal-content">
532
			<div class="modal-header">
533
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
534
					<span aria-hidden="true">&times;</span>
535
				</button>
536

    
537
				<h3 class="modal-title" id="myModalLabel">Notices</h3>
538
			</div>
539

    
540
			<div class="modal-body">
541
<?php
542
	$noticeCategories = array();
543

    
544
	if (is_array($notices)) {
545
		foreach ($notices as $time => $notice) {
546
			if (!isset($noticeCategories[ $notice['category'] ])) {
547
				$noticeCategories[ $notice['category'] ] = array();
548
			}
549

    
550
			$notice['time'] = $time;
551
			array_push($noticeCategories[ $notice['category'] ], $notice);
552
		}
553
	}
554

    
555
	foreach ($noticeCategories as $category => $catNotices):?>
556
				<h4><?=$category?></h4>
557
				<ul>
558
<?php
559
	foreach ($catNotices as $notice):
560
?>
561
					<li>
562
						<b>
563
<?php if (!empty($notice['url'])):?>
564
							<a href="<?=$notice['url']?>"><?=$notice['id']?></a> -
565
<?php endif;?>
566
						</b>
567
						<?=$notice['notice']?>
568
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
569
					</li>
570
<?php	endforeach;?>
571
				</ul>
572
<?php endforeach;?>
573
			</div>
574

    
575
			<div class="modal-footer">
576
				<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
577
				<button type="button" id="clearallnotices" class="btn btn-primary"><?=gettext("Mark all as read")?></button>
578
			</div>
579
		</div>
580
	</div>
581
</div>
582

    
583
<script type="text/javascript">
584
//<![CDATA[
585
	events.push(function() {
586
	    $('#clearallnotices').click(function() {
587
			ajaxRequest = $.ajax({
588
				url: "/index.php",
589
				type: "post",
590
				data: { closenotice: "all"},
591
				success: function() {
592
					window.location = window.location.href;
593
				},
594
				failure: function() {
595
					alert("Error clearing notices!");
596
				}
597
			});
598
		});
599
	});
600
//]]>
601
</script>
602

    
603
<?php endif;
604

    
605
// Get the flash Messages
606
get_flash_message();
(65-65/229)