Project

General

Profile

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

    
56
require_once("globals.inc");
57
require_once("functions.inc");
58
require_once("shortcuts.inc");
59
require_once("service-utils.inc");
60
require_once('notices.inc');
61

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

    
64
$pagetitle = gentitle($pgtitle);
65

    
66
if (isset($config['system']['webgui']['pagenamefirst'])) {
67
	$tabtitle = $pagetitle . " - " . $config['system']['hostname'] . "." . $config['system']['domain'];
68
} else {
69
	$tabtitle = $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle;
70
}
71

    
72
$cssfile = "/bootstrap/css/pfSense.css";
73

    
74
if (isset($config['system']['webgui']['webguicss'])) {
75
	if(file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
76
		$cssfile = "/bootstrap/css/" . $config['system']['webgui']['webguicss'];
77
	}
78
}
79

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

    
92
<?php
93

    
94
/* Determine automated help URL. Should output the page name and parameters
95
   separately */
96
$uri_split = "";
97
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
98

    
99
/* If there was no match, there were no parameters, just grab the filename
100
   Otherwise, use the matched filename from above. */
101
if (empty($uri_split[0])) {
102
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
103
} else {
104
	$pagename = $uri_split[1];
105
}
106

    
107
/* If the page name is still empty, the user must have requested / (index.php) */
108
if (empty($pagename)) {
109
	$pagename = "index.php";
110
}
111

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

    
124
// Build the full help URL.
125
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
126

    
127
// Create a menu entry of any installed packages in the specified category
128
// (Now reads the menu information from $config['installedpackages']['menu'] only)
129
function return_ext_menu($section) {
130
	global $config;
131

    
132
	$htmltext = "";
133
	$extarray = array();
134

    
135
	if ( (!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
136
		foreach ($config['installedpackages']['menu'] as $menu) {
137
//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
138
			if ($menu['section'] != $section) {
139
				continue;
140
			}
141

    
142
			if ($menu['url'] != "") {
143
				$test_url = $menu['url'];
144
				$addresswithport = getenv("HTTP_HOST");
145
				$colonpos = strpos($addresswithport, ":");
146

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

    
159
			if (isAllowedPage($test_url)) {
160
				$extarray[] = array($menu['name'], $description);
161
			}
162
		}
163
	}
164

    
165
	return $extarray;
166
}
167

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

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

    
207
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
208

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

    
222
// Firewall
223
$firewall_menu = array();
224
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
225
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
226
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
227
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
228
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
229
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
230
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
231

    
232
// Services
233
$services_menu = array();
234
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
235
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
236
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
237
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
238
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
239

    
240
if ($g['services_dhcp_server_enable']) {
241
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
242
	$services_menu[] = array(gettext("DHCPv6 Server/RA"), "/services_dhcpv6.php");
243
}
244

    
245
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
246
$services_menu[] = array(gettext("IGMP proxy"), "/services_igmpproxy.php");
247
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
248
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
249
$services_menu[] = array(gettext("PPPoE Server"), "/vpn_pppoe.php");
250
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
251

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

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

    
262
// VPN
263
$vpn_menu = array();
264
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
265
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
266
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
267
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
268
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
269

    
270
// Status
271
$status_menu = array();
272
if (count($config['captiveportal']) > 0) {
273
	$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
274
}
275

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

    
288
if ($g['platform'] == $g['product_name']) {
289
	$status_menu[] = array(gettext("Package Logs"), "/diag_pkglogs.php");
290
}
291

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

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

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

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

    
314
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
315

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

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

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

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

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

    
356
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
357

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

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

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

    
379
?>
380
<nav class="navbar navbar-static-top navbar-inverse">
381
	<div class="container">
382
		<div class="navbar-header">
383
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
384
				<span class="sr-only">Toggle navigation</span>
385
				<span class="icon-bar"></span>
386
				<span class="icon-bar"></span>
387
				<span class="icon-bar"></span>
388
			</button>
389
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" /></a>
390
		</div>
391
		<div class="collapse navbar-collapse" id="pf-navbar">
392
			<ul class="nav navbar-nav">
393
			<?php foreach ([
394
					['name' => 'System',	  'menu' => $system_menu,	   'href' => null],
395
					['name' => 'Interfaces',  'menu' => $interfaces_menu,  'href' => null],
396
					['name' => 'Firewall',	  'menu' => $firewall_menu,	   'href' => null],
397
					['name' => 'Services',	  'menu' => $services_menu,	   'href' => null],
398
					['name' => 'VPN',		  'menu' => $vpn_menu,		   'href' => null],
399
					['name' => 'Status',	  'menu' => $status_menu,	   'href' => null],
400
					['name' => 'Diagnostics', 'menu' => $diagnostics_menu, 'href' => null],
401
					['name' => 'Gold',		  'menu' => $gold_menu,		   'href' => '_blank'],
402
					['name' => 'Help',		  'menu' => $help_menu,		   'href' => '_blank']
403
				] as $item):
404
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
405
						continue;
406
					} ?>
407
				<li class="dropdown">
408
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
409
						<?=gettext($item['name'])?>
410
						<span class="caret"></span>
411
					</a>
412
					<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'])?></ul>
413
				</li>
414
			<?php endforeach?>
415
				<?php if (are_notices_pending()):?>
416
					<?php $notices = get_notices()?>
417
					<li class="dropdown">
418
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false"><?=gettext("Notices")?>
419
							<span class="badge"><?=count($notices)?></span>
420
						</a>
421
					</li>
422
<?php
423
				endif;
424
?>
425
			</ul>
426
		</div>
427
	</div>
428
</nav>
429

    
430
<div class="container">
431
	<header class="header">
432

    
433
<?php
434
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
435
	if(isset($notitle)) {
436
		print('<br />');
437
		unset($notitle);
438
	} else {
439

    
440
	print(genhtmltitle($pgtitle));
441
	}
442
?>
443
		<ul class="context-links">
444
<?php
445

    
446
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) {
447
	$ssvc = array();
448
	switch ($shortcut_section) {
449
		case "openvpn":
450
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
451
			break;
452
		case "captiveportal":
453
			$ssvc = find_service_by_cp_zone($cpzone);
454
			break;
455
		default:
456
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
457
	}
458
	if (!empty($ssvc)) {
459
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
460
		echo '<li>'. get_service_control_GET_links($ssvc, false). '</li>';
461
	}
462
}
463

    
464
echo '<li>'. get_shortcut_main_link($shortcut_section, false). '</li>';
465
echo '<li>'. get_shortcut_status_link($shortcut_section, false). '</li>';
466
echo '<li>'. get_shortcut_log_link($shortcut_section, false). '</li>';
467

    
468
?>
469
	<?php if (!$g['disablehelpicon']): ?>
470
		<li>
471
			<a href="<?=$helpurl?>" title="<?=gettext("Help for items on this page")?>" class="help-icon">
472
				<i class="fa fa-question-circle"></i>
473
			</a>
474
		</li>
475
	<?php endif?>
476
		</ul>
477
	</header>
478
<?php
479
/* if upgrade in progress, alert user */
480
if (is_subsystem_dirty('packagelock') || file_exists('/conf/needs_package_sync' && platform_booting())) {
481
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
482
		$info_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']);
483
	} else {
484
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
485
		$info_text = gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.");
486
		$info_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.");
487
	}
488

    
489
	print_info_box($info_text);
490
}
491

    
492
$pgtitle_output = true;
493

    
494
/*	If this page is being remotely managed then do not allow the loading of the contents. */
495
if ($config['remote_managed_pages']['item']) {
496
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
497
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
498
			print_info_box_np("This page is currently being managed by a remote machine.");
499
			include("foot.inc");
500
			exit;
501
		}
502
	}
503
}
504

    
505
// Modal notices window
506
// The notices modal needs to be outside of the page display div or things get messy
507
if (are_notices_pending()):?>
508

    
509
<div id="notices" class="modal fade" role="dialog">
510
	<div class="mopdal-dialog">
511
		<div class="modal-content">
512
			<div class="modal-header">
513
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
514
					<span aria-hidden="true">&times;</span>
515
				</button>
516

    
517
				<h3 class="modal-title" id="myModalLabel">Notices</h3>
518
			</div>
519

    
520
			<div class="modal-body">
521
<?php
522
	$noticeCategories = array();
523

    
524
	if(is_array($notices)) {
525
		foreach ($notices as $time => $notice)
526
		{
527
			if (!isset($noticeCategories[ $notice['category'] ]))
528
				$noticeCategories[ $notice['category'] ] = array();
529

    
530
			$notice['time'] = $time;
531
			array_push($noticeCategories[ $notice['category'] ], $notice);
532
		}
533
	}
534

    
535
	foreach ($noticeCategories as $category => $catNotices):?>
536
				<h4><?=$category?></h4>
537
				<ul>
538
<?php
539
	foreach ($catNotices as $notice):
540
?>
541
					<li>
542
						<b>
543
<?php if (!empty($notice['url'])):?>
544
							<a href="<?=$notice['url']?>"><?=$notice['id']?></a> -
545
<?php endif;?>
546
						</b>
547
						<?=$notice['notice']?>
548
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
549
					</li>
550
<?php	endforeach;?>
551
				</ul>
552
<?php endforeach;?>
553
			</div>
554

    
555
			<div class="modal-footer">
556
				<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
557
				<button type="button" id="clearallnotices" class="btn btn-primary"><?=gettext("Mark all as read")?></button>
558
			</div>
559
		</div>
560
	</div>
561
</div>
562

    
563
<script>
564
//<![CDATA[
565
	events.push(function(){
566
	    $('#clearallnotices').click(function() {
567
			ajaxRequest = $.ajax({
568
				url: "/index.php",
569
				type: "post",
570
				data: { closenotice: "all"},
571
				success: function(){
572
					window.location = window.location.href;
573
				},
574
				failure: function () {
575
					alert("Error clearing notices!");
576
				}
577
			});
578
		});
579
	});
580
//]]>
581
</script>
582

    
583
<?php endif;
584

    
585
// Get the flash Messages
586
get_flash_message();
(78-78/230)