Project

General

Profile

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