Project

General

Profile

Download (21.7 KB) Statistics
| Branch: | Tag: | Revision:
1 56c100ab Erik Fonnesbeck
<?php
2
/*
3 d7218f77 Stephen Beaver
	pfSense_MODULE: head.inc
4 56c100ab Erik Fonnesbeck
*/
5 d7218f77 Stephen Beaver
/* ====================================================================
6 888c3c1b Stephen Beaver
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7
 *	Copyright (c)  2004, 2005 Scott Ullrich
8 d7218f77 Stephen Beaver
 *
9 888c3c1b Stephen Beaver
 *	Redistribution and use in source and binary forms, with or without modification,
10
 *	are permitted provided that the following conditions are met:
11 d7218f77 Stephen Beaver
 *
12 888c3c1b Stephen Beaver
 *	1. Redistributions of source code must retain the above copyright notice,
13
 *		this list of conditions and the following disclaimer.
14 d7218f77 Stephen Beaver
 *
15 888c3c1b Stephen Beaver
 *	2. Redistributions in binary form must reproduce the above copyright
16
 *		notice, this list of conditions and the following disclaimer in
17
 *		the documentation and/or other materials provided with the
18
 *		distribution.
19 d7218f77 Stephen Beaver
 *
20 888c3c1b Stephen Beaver
 *	3. All advertising materials mentioning features or use of this software
21
 *		must display the following acknowledgment:
22
 *		"This product includes software developed by the pfSense Project
23
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
24 d7218f77 Stephen Beaver
 *
25 888c3c1b Stephen Beaver
 *	4. The names "pfSense" and "pfSense Project" must not be used to
26
 *		 endorse or promote products derived from this software without
27
 *		 prior written permission. For written permission, please contact
28
 *		 coreteam@pfsense.org.
29 d7218f77 Stephen Beaver
 *
30 888c3c1b Stephen Beaver
 *	5. Products derived from this software may not be called "pfSense"
31
 *		nor may "pfSense" appear in their names without prior written
32
 *		permission of the Electric Sheep Fencing, LLC.
33 d7218f77 Stephen Beaver
 *
34 888c3c1b Stephen Beaver
 *	6. Redistributions of any form whatsoever must retain the following
35
 *		acknowledgment:
36 d7218f77 Stephen Beaver
 *
37 888c3c1b Stephen Beaver
 *	"This product includes software developed by the pfSense Project
38
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
39 d7218f77 Stephen Beaver
 *
40 888c3c1b Stephen Beaver
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
52 d7218f77 Stephen Beaver
 *
53 888c3c1b Stephen Beaver
 *	====================================================================
54 d7218f77 Stephen Beaver
 *
55
 */
56 888c3c1b Stephen Beaver
57 31f03b6c Sjon Hortensius
require_once("globals.inc");
58
require_once("functions.inc");
59
require_once("shortcuts.inc");
60
require_once("service-utils.inc");
61
62
/* $Id$ */
63
64 9801e938 Sjon Hortensius
header('Content-Type: text/html; charset=utf-8');
65
66 ecffb0bb Phil Davis
$pagetitle = gentitle($pgtitle);
67 56c100ab Erik Fonnesbeck
68 e259607f Thane Gill
if (isset($config['system']['webgui']['pagenamefirst'])) {
69 8ce58e05 Phil Davis
	$tabtitle = $pagetitle . " - " . $config['system']['hostname'] . "." . $config['system']['domain'];
70 e259607f Thane Gill
} else {
71 8ce58e05 Phil Davis
	$tabtitle = $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle;
72 e259607f Thane Gill
}
73 56c100ab Erik Fonnesbeck
?>
74 1180e4f0 Sjon Hortensius
<!DOCTYPE html>
75
<html lang="en">
76 56c100ab Erik Fonnesbeck
<head>
77 d41aeafc Stephen Beaver
	<meta name="viewport" content="width=device-width, initial-scale=1">
78 1180e4f0 Sjon Hortensius
	<link rel="stylesheet" href="/bootstrap/css/pfSense.css" />
79 0253c191 Stephen Beaver
	<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
80 e259607f Thane Gill
	<title><?=$tabtitle?></title>
81 dc58b7b3 Sjon Hortensius
	<script>var events = events || [];</script>
82 1180e4f0 Sjon Hortensius
</head>
83 31f03b6c Sjon Hortensius
<body id="<?=basename($_SERVER['SCRIPT_NAME'], '.php')?>">
84
<?php
85
86 e259607f Thane Gill
/* Determine automated help URL. Should output the page name and parameters
87
   separately */
88 31f03b6c Sjon Hortensius
$uri_split = "";
89
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
90
91
/* If there was no match, there were no parameters, just grab the filename
92
   Otherwise, use the matched filename from above. */
93
if (empty($uri_split[0])) {
94
	$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
95
} else {
96
	$pagename = $uri_split[1];
97
}
98 239b5161 Stephen Beaver
99 31f03b6c Sjon Hortensius
/* If the page name is still empty, the user must have requested / (index.php) */
100
if (empty($pagename)) {
101
	$pagename = "index.php";
102
}
103
104
/* If the filename is pkg_edit.php or wizard.php, reparse looking
105
	for the .xml filename */
106
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
107
	$param_split = explode('&', $uri_split[2]);
108
	foreach ($param_split as $param) {
109
		if (substr($param, 0, 4) == "xml=") {
110
			$xmlfile = explode('=', $param);
111
			$pagename = $xmlfile[1];
112
		}
113
	}
114
}
115
116 567d7fd6 Stephen Beaver
// Build the full help URL.
117 31f03b6c Sjon Hortensius
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
118
119 567d7fd6 Stephen Beaver
// Create a menu entry of any installed packages in the specified category
120
// (Now reads the menu information from $config['installedpackages']['menu'] only)
121 31f03b6c Sjon Hortensius
function return_ext_menu($section) {
122
	global $config;
123 da4a4b9f Stephen Beaver
124 31f03b6c Sjon Hortensius
	$htmltext = "";
125
	$extarray = array();
126 da4a4b9f Stephen Beaver
127 205c51a2 Stephen Beaver
	if ( (!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
128 567d7fd6 Stephen Beaver
		foreach ($config['installedpackages']['menu'] as $menu) {
129
//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
130
			if ($menu['section'] != $section) {
131 e259607f Thane Gill
				continue;
132
			}
133 da4a4b9f Stephen Beaver
134 567d7fd6 Stephen Beaver
			if ($menu['url'] != "") {
135
				$test_url = $menu['url'];
136 e259607f Thane Gill
				$addresswithport = getenv("HTTP_HOST");
137 31f03b6c Sjon Hortensius
				$colonpos = strpos($addresswithport, ":");
138 567d7fd6 Stephen Beaver
139
				if ($colonpos !== false) {
140 31f03b6c Sjon Hortensius
					//my url is actually just the IP address of the pfsense box
141
					$myurl = substr($addresswithport, 0, $colonpos);
142
				} else {
143
					$myurl = $addresswithport;
144
				}
145 567d7fd6 Stephen Beaver
				$description = str_replace('$myurl', $myurl, $menu['url']);
146 31f03b6c Sjon Hortensius
			} else {
147 567d7fd6 Stephen Beaver
				$description = '/pkg.php?xml=' . $menu['configfile'];
148 31f03b6c Sjon Hortensius
				$test_url=$description;
149
			}
150 da4a4b9f Stephen Beaver
151 e259607f Thane Gill
			if (isAllowedPage($test_url)) {
152 567d7fd6 Stephen Beaver
				$extarray[] = array($menu['name'], $description);
153 e259607f Thane Gill
			}
154 31f03b6c Sjon Hortensius
		}
155
	}
156 567d7fd6 Stephen Beaver
157 31f03b6c Sjon Hortensius
	return $extarray;
158
}
159
160
function output_menu($arrayitem, $target = null) {
161
	foreach ($arrayitem as $item) {
162 ecffb0bb Phil Davis
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout") {
163 31f03b6c Sjon Hortensius
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
164
			if ($target) {
165
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
166
			}
167
			$class = "navlnk";
168
			if ($item['class']) {
169
				$class .= " {$item['class']}";
170
			}
171
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
172
			if ($item['style']) {
173
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
174
			}
175
			echo "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]). "</li>\n";
176
		}
177
	}
178
}
179
180
// System
181
$system_menu = array();
182
$system_menu[] = array(gettext("Logout"), "/index.php?logout");
183
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
184
$system_menu[] = array(gettext("Firmware"), "/system_firmware.php");
185
$system_menu[] = array(gettext("General Setup"), "/system.php");
186
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
187 2344bed4 Renato Botelho
if ($g['platform'] == $g['product_name'] or $g['platform'] == "nanobsd") {
188 31f03b6c Sjon Hortensius
	$system_menu[] = array(gettext("Packages"), "/pkg_mgr_installed.php");
189 e259607f Thane Gill
}
190 31f03b6c Sjon Hortensius
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
191
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
192
$system_menu[] = array(gettext("Cert Manager"), "/system_camanager.php");
193 e259607f Thane Gill
if (!isAllowedPage("system_usermanager.php*")) {
194 31f03b6c Sjon Hortensius
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
195 e259607f Thane Gill
} else {
196 31f03b6c Sjon Hortensius
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
197 e259607f Thane Gill
}
198 da4a4b9f Stephen Beaver
199 ecffb0bb Phil Davis
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
200 31f03b6c Sjon Hortensius
201
// Interfaces
202
$interfaces_menu = array();
203 e259607f Thane Gill
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
204 31f03b6c Sjon Hortensius
	$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
205 e259607f Thane Gill
}
206 31f03b6c Sjon Hortensius
$opts = get_configured_interface_with_descr(false, true);
207 e259607f Thane Gill
foreach ($opts as $oif => $odescr) {
208
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
209 31f03b6c Sjon Hortensius
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
210 e259607f Thane Gill
	}
211
}
212 ecffb0bb Phil Davis
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
213 31f03b6c Sjon Hortensius
214
// Firewall
215
$firewall_menu = array();
216
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
217
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
218
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
219
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
220
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
221
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
222 ecffb0bb Phil Davis
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
223 31f03b6c Sjon Hortensius
224
// Services
225
$services_menu = array();
226
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
227
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
228
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
229
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
230
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
231 239b5161 Stephen Beaver
232 ecffb0bb Phil Davis
if ($g['services_dhcp_server_enable']) {
233 31f03b6c Sjon Hortensius
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
234
	$services_menu[] = array(gettext("DHCPv6 Server/RA"), "/services_dhcpv6.php");
235
}
236 567d7fd6 Stephen Beaver
237 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
238
$services_menu[] = array(gettext("IGMP proxy"), "/services_igmpproxy.php");
239
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
240
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
241
$services_menu[] = array(gettext("PPPoE Server"), "/vpn_pppoe.php");
242
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
243 239b5161 Stephen Beaver
244 ecffb0bb Phil Davis
if (count($config['interfaces']) > 1) {
245 31f03b6c Sjon Hortensius
	/* no use for UPnP in single-interface deployments
246
	remove to reduce user confusion
247
	*/
248
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
249
}
250 239b5161 Stephen Beaver
251 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("Wake on LAN"), "/services_wol.php");
252 ecffb0bb Phil Davis
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
253 31f03b6c Sjon Hortensius
254
// VPN
255
$vpn_menu = array();
256
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
257
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
258 a4af095c Renato Botelho
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
259 31f03b6c Sjon Hortensius
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
260 ecffb0bb Phil Davis
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
261 31f03b6c Sjon Hortensius
262
// Status
263
$status_menu = array();
264 e259607f Thane Gill
if (count($config['captiveportal']) > 0) {
265 31f03b6c Sjon Hortensius
	$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
266 e259607f Thane Gill
}
267 239b5161 Stephen Beaver
268 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("CARP (failover)"), "/carp_status.php");
269
$status_menu[] = array(gettext("Dashboard"), "/index.php");
270
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
271
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
272
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
273
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
274
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
275
$status_menu[] = array(gettext("IPsec"), "/diag_ipsec.php");
276
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
277
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
278
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
279 239b5161 Stephen Beaver
280 2344bed4 Renato Botelho
if ($g['platform'] == $g['product_name']) {
281 31f03b6c Sjon Hortensius
	$status_menu[] = array(gettext("Package Logs"), "/diag_pkglogs.php");
282 e259607f Thane Gill
}
283 239b5161 Stephen Beaver
284 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
285
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
286
$status_menu[] = array(gettext("Services"), "/status_services.php");
287
$status_menu[] = array(gettext("System Logs"), "/diag_logs.php");
288
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
289 239b5161 Stephen Beaver
290 ecffb0bb Phil Davis
if (count($config['interfaces']) > 1) {
291 31f03b6c Sjon Hortensius
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
292 e259607f Thane Gill
}
293 239b5161 Stephen Beaver
294 31f03b6c Sjon Hortensius
$ifentries = get_configured_interface_with_descr();
295
foreach ($ifentries as $ent => $entdesc) {
296
	if (is_array($config['interfaces'][$ent]['wireless']) &&
297 d7218f77 Stephen Beaver
		preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
298 31f03b6c Sjon Hortensius
		$wifdescrs[$ent] = $entdesc;
299 e259607f Thane Gill
	}
300 31f03b6c Sjon Hortensius
}
301 239b5161 Stephen Beaver
302 e259607f Thane Gill
if (count($wifdescrs) > 0) {
303 31f03b6c Sjon Hortensius
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
304 e259607f Thane Gill
}
305 239b5161 Stephen Beaver
306 ecffb0bb Phil Davis
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
307 31f03b6c Sjon Hortensius
308
// Diagnostics
309
$diagnostics_menu = array();
310
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
311
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
312
$diagnostics_menu[] = array(gettext("Backup/Restore"), "/diag_backup.php");
313
$diagnostics_menu[] = array(gettext("Command Prompt"), "/exec.php");
314
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
315
$diagnostics_menu[] = array(gettext("Edit File"), "/edit.php");
316
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
317 239b5161 Stephen Beaver
318 ecffb0bb Phil Davis
if (file_exists("/var/run/gmirror_active")) {
319
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
320 e259607f Thane Gill
}
321 239b5161 Stephen Beaver
322 ecffb0bb Phil Davis
$diagnostics_menu[] = array(gettext("Halt System"), "/halt.php");
323
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
324
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
325 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
326
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
327
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
328
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
329
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php");
330
$diagnostics_menu[] = array(gettext("Reboot"), "/reboot.php");
331
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
332
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
333 ecffb0bb Phil Davis
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
334 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
335
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
336
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
337
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
338
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
339 239b5161 Stephen Beaver
340 ecffb0bb Phil Davis
if ($g['platform'] == "nanobsd") {
341 31f03b6c Sjon Hortensius
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
342 e259607f Thane Gill
}
343 239b5161 Stephen Beaver
344 31f03b6c Sjon Hortensius
if (isset($config['system']['developer'])) {
345
	$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
346
}
347 239b5161 Stephen Beaver
348 ecffb0bb Phil Davis
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
349 31f03b6c Sjon Hortensius
350
$gold_menu = array();
351
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
352 ecffb0bb Phil Davis
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
353 31f03b6c Sjon Hortensius
354 ecffb0bb Phil Davis
if (!$g['disablehelpmenu']) {
355 31f03b6c Sjon Hortensius
	$help_menu = array();
356
	$help_menu[] = array(gettext("About this Page"), $helpurl);
357 ecffb0bb Phil Davis
	if ($g['product_name'] == "pfSense") {
358 31f03b6c Sjon Hortensius
		$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
359 e259607f Thane Gill
	}
360 d7218f77 Stephen Beaver
361 31f03b6c Sjon Hortensius
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
362
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
363
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
364
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
365
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
366
	$help_menu[] = array(gettext("Search portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
367
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
368 ecffb0bb Phil Davis
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
369 31f03b6c Sjon Hortensius
}
370
371
?>
372 5a637574 Stephen Beaver
<nav class="navbar navbar-static-top navbar-inverse">
373 31f03b6c Sjon Hortensius
	<div class="container">
374
		<div class="navbar-header">
375 2d26ee5e Sjon Hortensius
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
376 31f03b6c Sjon Hortensius
				<span class="sr-only">Toggle navigation</span>
377
				<span class="icon-bar"></span>
378
				<span class="icon-bar"></span>
379
				<span class="icon-bar"></span>
380
			</button>
381
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" /></a>
382
		</div>
383 2d26ee5e Sjon Hortensius
		<div class="collapse navbar-collapse" id="pf-navbar">
384 31f03b6c Sjon Hortensius
			<ul class="nav navbar-nav">
385 69a17c90 Thane Gill
			<?php foreach ([
386 d7218f77 Stephen Beaver
					['name' => 'System',	  'menu' => $system_menu,	   'href' => null],
387 69a17c90 Thane Gill
					['name' => 'Interfaces',  'menu' => $interfaces_menu,  'href' => null],
388 d7218f77 Stephen Beaver
					['name' => 'Firewall',	  'menu' => $firewall_menu,	   'href' => null],
389
					['name' => 'Services',	  'menu' => $services_menu,	   'href' => null],
390
					['name' => 'VPN',		  'menu' => $vpn_menu,		   'href' => null],
391
					['name' => 'Status',	  'menu' => $status_menu,	   'href' => null],
392 69a17c90 Thane Gill
					['name' => 'Diagnostics', 'menu' => $diagnostics_menu, 'href' => null],
393 d7218f77 Stephen Beaver
					['name' => 'Gold',		  'menu' => $gold_menu,		   'href' => '_blank'],
394
					['name' => 'Help',		  'menu' => $help_menu,		   'href' => '_blank']
395 69a17c90 Thane Gill
				] as $item):
396
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
397
						continue;
398
					} ?>
399 31f03b6c Sjon Hortensius
				<li class="dropdown">
400 e97e9aca Thane Gill
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
401
						<?=gettext($item['name'])?>
402 31f03b6c Sjon Hortensius
						<span class="caret"></span>
403
					</a>
404 e97e9aca Thane Gill
					<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'])?></ul>
405 31f03b6c Sjon Hortensius
				</li>
406 69a17c90 Thane Gill
			<?php endforeach?>
407 d7218f77 Stephen Beaver
				<?php if (are_notices_pending()):?>
408 e97e9aca Thane Gill
					<?php $notices = get_notices()?>
409 31f03b6c Sjon Hortensius
					<li class="dropdown">
410 e97e9aca Thane Gill
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false"><?=gettext("Notices")?>
411 31f03b6c Sjon Hortensius
							<span class="badge"><?=count($notices)?></span>
412
						</a>
413
					</li>
414 6eeca0ef Sjon Hortensius
<?php
415 d7218f77 Stephen Beaver
				endif;
416 6eeca0ef Sjon Hortensius
?>
417 d7218f77 Stephen Beaver
			</ul>
418 6eeca0ef Sjon Hortensius
		</div>
419
	</div>
420 31f03b6c Sjon Hortensius
</nav>
421 d7218f77 Stephen Beaver
422 31f03b6c Sjon Hortensius
<div class="container">
423 45eebe10 Sander van Leeuwen
	<header class="header">
424 89dcfa01 Stephen Beaver
425
<?php
426
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
427
	if(isset($notitle)) {
428
		print('<br />');
429
		unset($notitle);
430
	} else {
431
432
	print(genhtmltitle($pgtitle));
433
	}
434
?>
435 0bf1e5fe Sjon Hortensius
		<ul class="context-links">
436 649cde0b Sander van Leeuwen
<?php
437 89dcfa01 Stephen Beaver
438 649cde0b Sander van Leeuwen
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) {
439
	$ssvc = array();
440
	switch ($shortcut_section) {
441
		case "openvpn":
442
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
443
			break;
444
		case "captiveportal":
445
			$ssvc = find_service_by_cp_zone($cpzone);
446
			break;
447
		default:
448
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
449 31f03b6c Sjon Hortensius
	}
450 649cde0b Sander van Leeuwen
	if (!empty($ssvc)) {
451 ee678e75 Sander van Leeuwen
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
452 d8ed9328 Stephen Beaver
		echo '<li>'. get_service_control_GET_links($ssvc, false). '</li>';
453 649cde0b Sander van Leeuwen
	}
454
}
455 31f03b6c Sjon Hortensius
456 0bf1e5fe Sjon Hortensius
echo '<li>'. get_shortcut_main_link($shortcut_section, false). '</li>';
457
echo '<li>'. get_shortcut_status_link($shortcut_section, false). '</li>';
458
echo '<li>'. get_shortcut_log_link($shortcut_section, false). '</li>';
459 45eebe10 Sander van Leeuwen
460 0bf1e5fe Sjon Hortensius
?>
461 ecffb0bb Phil Davis
	<?php if (!$g['disablehelpicon']): ?>
462 0bf1e5fe Sjon Hortensius
		<li>
463
			<a href="<?=$helpurl?>" title="<?=gettext("Help for items on this page")?>" class="help-icon">
464
				<i class="icon-large icon-question-sign"></i>
465
			</a>
466
		</li>
467 e259607f Thane Gill
	<?php endif?>
468 0bf1e5fe Sjon Hortensius
		</ul>
469 45eebe10 Sander van Leeuwen
	</header>
470 56c100ab Erik Fonnesbeck
<?php
471 31f03b6c Sjon Hortensius
/* if upgrade in progress, alert user */
472 e259607f Thane Gill
if (is_subsystem_dirty('packagelock') || file_exists('/conf/needs_package_sync' && platform_booting())) {
473 31f03b6c Sjon Hortensius
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
474
		$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']);
475
	} else {
476 ecffb0bb Phil Davis
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
477 31f03b6c Sjon Hortensius
		$info_text = gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.");
478 3eaddb65 doktornotor
		$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.");
479 31f03b6c Sjon Hortensius
	}
480 180508d1 Stephen Beaver
481
	print_info_box($info_text);
482 31f03b6c Sjon Hortensius
}
483
484
$pgtitle_output = true;
485
486 d7218f77 Stephen Beaver
/*	If this page is being remotely managed then do not allow the loading of the contents. */
487 1180e4f0 Sjon Hortensius
if ($config['remote_managed_pages']['item']) {
488 ecffb0bb Phil Davis
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
489 1180e4f0 Sjon Hortensius
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
490 56c100ab Erik Fonnesbeck
			print_info_box_np("This page is currently being managed by a remote machine.");
491 31f03b6c Sjon Hortensius
			include("foot.inc");
492 56c100ab Erik Fonnesbeck
			exit;
493
		}
494 1180e4f0 Sjon Hortensius
	}
495 e259607f Thane Gill
}
496 d7218f77 Stephen Beaver
497
// Modal notices window
498 a46c437d Stephen Beaver
// The notices modal needs to be outside of the page display div or things get messy
499 d7218f77 Stephen Beaver
if (are_notices_pending()):?>
500
501
<div id="notices" class="modal fade" role="dialog">
502
	<div class="mopdal-dialog">
503
		<div class="modal-content">
504
			<div class="modal-header">
505
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
506
					<span aria-hidden="true">&times;</span>
507
				</button>
508
509
				<h3 class="modal-title" id="myModalLabel">Notices</h3>
510
			</div>
511
512
			<div class="modal-body">
513
<?php
514
	$noticeCategories = array();
515
516
	if(is_array($notices)) {
517
		foreach ($notices as $time => $notice)
518
		{
519
			if (!isset($noticeCategories[ $notice['category'] ]))
520
				$noticeCategories[ $notice['category'] ] = array();
521
522
			$notice['time'] = $time;
523
			array_push($noticeCategories[ $notice['category'] ], $notice);
524
		}
525
	}
526
527
	foreach ($noticeCategories as $category => $catNotices):?>
528
				<h4><?=$category?></h4>
529
				<ul>
530
<?php
531
	foreach ($catNotices as $notice):
532
?>
533
					<li>
534
						<b>
535
<?php if (!empty($notice['url'])):?>
536
							<a href="<?=$notice['url']?>"><?=$notice['id']?></a> -
537
<?php endif;?>
538
						</b>
539
						<?=$notice['notice']?>
540
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
541
					</li>
542
<?php	endforeach;?>
543
				</ul>
544
<?php endforeach;?>
545
			</div>
546
547
			<div class="modal-footer">
548
				<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
549 888c3c1b Stephen Beaver
				<a type="button" class="btn btn-primary" href="javascript:clear_notices();">Mark all as read</a>
550 d7218f77 Stephen Beaver
			</div>
551
		</div>
552
	</div>
553
</div>
554
555 888c3c1b Stephen Beaver
<script>
556
	// Do some Ajax to make index.php clear the notices
557
	function clear_notices() {
558
		xmlhttp=new XMLHttpRequest();
559
		xmlhttp.open("GET","index.php?closenotice=all",true);
560
		xmlhttp.send();
561
		location.reload(); // reload the page to clear the notices indicator and dismiss the modal dialog all in one
562
	}
563
</script>
564
565 2344bed4 Renato Botelho
<?php endif;