Project

General

Profile

Download (26 KB) Statistics
| Branch: | Tag: | Revision:
1 56c100ab Erik Fonnesbeck
<?php
2 d7218f77 Stephen Beaver
/* ====================================================================
3 888c3c1b Stephen Beaver
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
4 d7218f77 Stephen Beaver
 *
5 888c3c1b Stephen Beaver
 *	Redistribution and use in source and binary forms, with or without modification,
6
 *	are permitted provided that the following conditions are met:
7 d7218f77 Stephen Beaver
 *
8 888c3c1b Stephen Beaver
 *	1. Redistributions of source code must retain the above copyright notice,
9
 *		this list of conditions and the following disclaimer.
10 d7218f77 Stephen Beaver
 *
11 888c3c1b Stephen Beaver
 *	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 d7218f77 Stephen Beaver
 *
16 888c3c1b Stephen Beaver
 *	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 d7218f77 Stephen Beaver
 *
21 888c3c1b Stephen Beaver
 *	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 d7218f77 Stephen Beaver
 *
26 888c3c1b Stephen Beaver
 *	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 d7218f77 Stephen Beaver
 *
30 888c3c1b Stephen Beaver
 *	6. Redistributions of any form whatsoever must retain the following
31
 *		acknowledgment:
32 d7218f77 Stephen Beaver
 *
33 888c3c1b Stephen Beaver
 *	"This product includes software developed by the pfSense Project
34
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
35 d7218f77 Stephen Beaver
 *
36 888c3c1b Stephen Beaver
 *	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 d7218f77 Stephen Beaver
 *
49 888c3c1b Stephen Beaver
 *	====================================================================
50 d7218f77 Stephen Beaver
 *
51
 */
52 888c3c1b Stephen Beaver
53 31f03b6c Sjon Hortensius
require_once("globals.inc");
54
require_once("functions.inc");
55
require_once("shortcuts.inc");
56
require_once("service-utils.inc");
57 8d3f3e34 Stephen Beaver
require_once('notices.inc');
58 31f03b6c Sjon Hortensius
59 9801e938 Sjon Hortensius
header('Content-Type: text/html; charset=utf-8');
60
61 ecffb0bb Phil Davis
$pagetitle = gentitle($pgtitle);
62 56c100ab Erik Fonnesbeck
63 e259607f Thane Gill
if (isset($config['system']['webgui']['pagenamefirst'])) {
64 8ae9a909 jim-p
	$tabtitle = $pagetitle . " - " . htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
65 e259607f Thane Gill
} else {
66 8ae9a909 jim-p
	$tabtitle = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']) . " - " . $pagetitle;
67 e259607f Thane Gill
}
68 60571782 Stephen Beaver
69 9d1be24e Jared Dillard
$cssfile = "/css/pfSense.css";
70 60571782 Stephen Beaver
71
if (isset($config['system']['webgui']['webguicss'])) {
72 9d1be24e Jared Dillard
	if (file_exists("/usr/local/www/css/" . $config['system']['webgui']['webguicss'])) {
73
		$cssfile = "/css/" . $config['system']['webgui']['webguicss'];
74 60571782 Stephen Beaver
	}
75
}
76
77 477db933 Jared Dillard
// set default colmns to two if unset
78 aa82505e Phil Davis
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
79 477db933 Jared Dillard
	$config['system']['webgui']['dashboardcolumns'] = 2;
80
}
81
82 56c100ab Erik Fonnesbeck
?>
83 1180e4f0 Sjon Hortensius
<!DOCTYPE html>
84
<html lang="en">
85 56c100ab Erik Fonnesbeck
<head>
86 d41aeafc Stephen Beaver
	<meta name="viewport" content="width=device-width, initial-scale=1">
87 60571782 Stephen Beaver
	<link rel="stylesheet" href="<?=$cssfile?>" />
88 9d1be24e Jared Dillard
	<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
89
	<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css">
90 e259607f Thane Gill
	<title><?=$tabtitle?></title>
91 8fd9052f Colin Fleming
	<script type="text/javascript">
92
	//<![CDATA[
93
	var events = events || [];
94
	//]]>
95
	</script>
96 1180e4f0 Sjon Hortensius
</head>
97 8d3f3e34 Stephen Beaver
98 31f03b6c Sjon Hortensius
<?php
99
100 e259607f Thane Gill
/* Determine automated help URL. Should output the page name and parameters
101
   separately */
102 31f03b6c Sjon Hortensius
$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 239b5161 Stephen Beaver
113 31f03b6c Sjon Hortensius
/* 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 f11871ca Phil Davis
} else if ($pagename == "status_logs.php") {
129
	$param_split = explode('&', $uri_split[2]);
130
	foreach ($param_split as $param) {
131
		if (substr($param, 0, 8) == "logfile=") {
132
			$logtype = explode('=', $param);
133
			$pagename .= '-' . $logtype[1];
134
		}
135
	}
136 31f03b6c Sjon Hortensius
}
137
138 567d7fd6 Stephen Beaver
// Build the full help URL.
139 31f03b6c Sjon Hortensius
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
140
141 909a1954 Renato Botelho
/*
142
 * Read files from $g['ext_menu_path']/*.xml and fill an array with menu info
143
 */
144
function read_ext_menu_path_data() {
145
	global $g;
146
147
	$result = array();
148
149
	if (!is_dir($g['ext_menu_path'])) {
150
		return $result;
151
	}
152
153
	foreach (glob("{$g['ext_menu_path']}/*.xml") as $menu_xml) {
154
		$xml_data = parse_xml_config_pkg($menu_xml, "packagegui");
155
		if (empty($xml_data['menu'])) {
156
			continue;
157
		}
158
		foreach ($xml_data['menu'] as $menu) {
159
			$result[] = $menu;
160
		}
161
	}
162
163
	return $result;
164
}
165
166 567d7fd6 Stephen Beaver
// Create a menu entry of any installed packages in the specified category
167
// (Now reads the menu information from $config['installedpackages']['menu'] only)
168 31f03b6c Sjon Hortensius
function return_ext_menu($section) {
169 909a1954 Renato Botelho
	global $config, $ext_menu_path_data;
170 da4a4b9f Stephen Beaver
171 31f03b6c Sjon Hortensius
	$htmltext = "";
172
	$extarray = array();
173 909a1954 Renato Botelho
	$ext_menu_entries = array();
174 da4a4b9f Stephen Beaver
175 aa82505e Phil Davis
	if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
176 567d7fd6 Stephen Beaver
		foreach ($config['installedpackages']['menu'] as $menu) {
177
//			print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
178 909a1954 Renato Botelho
			if ($menu['section'] == $section) {
179
				$ext_menu_entries[] = $menu;
180 e259607f Thane Gill
			}
181 909a1954 Renato Botelho
		}
182
	}
183
184
	foreach ($ext_menu_path_data as $menu) {
185
		if ($menu['section'] == $section) {
186
			$ext_menu_entries[] = $menu;
187
		}
188
	}
189
190
	foreach ($ext_menu_entries as $menu) {
191
		if ($menu['url'] != "") {
192
			$test_url = $menu['url'];
193
			$addresswithport = getenv("HTTP_HOST");
194
			$colonpos = strpos($addresswithport, ":");
195 da4a4b9f Stephen Beaver
196 909a1954 Renato Botelho
			if ($colonpos !== false) {
197
				//my url is actually just the IP address of the pfsense box
198
				$myurl = substr($addresswithport, 0, $colonpos);
199 31f03b6c Sjon Hortensius
			} else {
200 909a1954 Renato Botelho
				$myurl = $addresswithport;
201 31f03b6c Sjon Hortensius
			}
202 909a1954 Renato Botelho
			$description = str_replace('$myurl', $myurl, $menu['url']);
203
		} else {
204
			$description = '/pkg.php?xml=' . $menu['configfile'];
205
			$test_url=$description;
206
		}
207 da4a4b9f Stephen Beaver
208 909a1954 Renato Botelho
		if (isAllowedPage($test_url)) {
209
			$extarray[] = array($menu['name'], $description);
210 31f03b6c Sjon Hortensius
		}
211
	}
212 567d7fd6 Stephen Beaver
213 31f03b6c Sjon Hortensius
	return $extarray;
214
}
215
216 8559c9d9 jim-p
function output_menu($arrayitem, $target = null, $section = "") {
217 31f03b6c Sjon Hortensius
	foreach ($arrayitem as $item) {
218 8559c9d9 jim-p
		/* If the user has access to help pages, also show the full help menu. See #5909 */
219 44c30eb3 jim-p
		if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" || (($section == "Help") && isAllowedPage("help.php"))) {
220 31f03b6c Sjon Hortensius
			$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
221
			if ($target) {
222
				$attr .= sprintf(" target=\"%s\"", htmlentities($target));
223
			}
224
			$class = "navlnk";
225
			if ($item['class']) {
226
				$class .= " {$item['class']}";
227
			}
228
			$attr .= sprintf(" class=\"%s\"", htmlentities($class));
229
			if ($item['style']) {
230
				$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
231
			}
232
			echo "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]). "</li>\n";
233
		}
234
	}
235
}
236
237 909a1954 Renato Botelho
$ext_menu_path_data = read_ext_menu_path_data();
238
239 31f03b6c Sjon Hortensius
// System
240
$system_menu = array();
241
$system_menu[] = array(gettext("Logout"), "/index.php?logout");
242
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
243 440a30cf Stephen Beaver
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
244 31f03b6c Sjon Hortensius
$system_menu[] = array(gettext("General Setup"), "/system.php");
245
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
246 2344bed4 Renato Botelho
if ($g['platform'] == $g['product_name'] or $g['platform'] == "nanobsd") {
247 ab61de4d k-paulius
	$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
248 e259607f Thane Gill
}
249 31f03b6c Sjon Hortensius
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
250 d036bc07 Stephen Beaver
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
251 d4a744b2 k-paulius
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php");
252 e259607f Thane Gill
if (!isAllowedPage("system_usermanager.php*")) {
253 31f03b6c Sjon Hortensius
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
254 e259607f Thane Gill
} else {
255 31f03b6c Sjon Hortensius
	$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
256 e259607f Thane Gill
}
257 da4a4b9f Stephen Beaver
258 ecffb0bb Phil Davis
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
259 31f03b6c Sjon Hortensius
260
// Interfaces
261
$interfaces_menu = array();
262 e259607f Thane Gill
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
263 31f03b6c Sjon Hortensius
	$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
264 e259607f Thane Gill
}
265 31f03b6c Sjon Hortensius
$opts = get_configured_interface_with_descr(false, true);
266 e259607f Thane Gill
foreach ($opts as $oif => $odescr) {
267
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
268 31f03b6c Sjon Hortensius
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
269 e259607f Thane Gill
	}
270
}
271 ecffb0bb Phil Davis
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
272 31f03b6c Sjon Hortensius
273
// Firewall
274
$firewall_menu = array();
275
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
276
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
277
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
278
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
279
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
280
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
281 ecffb0bb Phil Davis
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
282 31f03b6c Sjon Hortensius
283
// Services
284
$services_menu = array();
285
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
286
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
287
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
288
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
289
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
290 239b5161 Stephen Beaver
291 ecffb0bb Phil Davis
if ($g['services_dhcp_server_enable']) {
292 31f03b6c Sjon Hortensius
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
293 46b7214c k-paulius
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
294 31f03b6c Sjon Hortensius
}
295 567d7fd6 Stephen Beaver
296 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
297 35e05b7f Phil Davis
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
298 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
299
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
300 1af5edbf Stephen Beaver
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
301 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
302 239b5161 Stephen Beaver
303 ecffb0bb Phil Davis
if (count($config['interfaces']) > 1) {
304 31f03b6c Sjon Hortensius
	/* no use for UPnP in single-interface deployments
305
	remove to reduce user confusion
306
	*/
307
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
308
}
309 239b5161 Stephen Beaver
310 7ca42d47 k-paulius
$services_menu[] = array(gettext("Wake-on-LAN"), "/services_wol.php");
311 ecffb0bb Phil Davis
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
312 31f03b6c Sjon Hortensius
313
// VPN
314
$vpn_menu = array();
315
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
316
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
317 a4af095c Renato Botelho
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
318 31f03b6c Sjon Hortensius
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
319 ecffb0bb Phil Davis
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
320 31f03b6c Sjon Hortensius
321
// Status
322
$status_menu = array();
323 925817a7 Phil Davis
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
324 1af5edbf Stephen Beaver
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
325 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Dashboard"), "/index.php");
326
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
327
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
328
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
329
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
330
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
331 1af5edbf Stephen Beaver
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
332 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
333
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
334
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
335 239b5161 Stephen Beaver
336 2344bed4 Renato Botelho
if ($g['platform'] == $g['product_name']) {
337 1af5edbf Stephen Beaver
	$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
338 e259607f Thane Gill
}
339 239b5161 Stephen Beaver
340 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
341
$status_menu[] = array(gettext("Services"), "/status_services.php");
342 1af5edbf Stephen Beaver
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
343 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
344 239b5161 Stephen Beaver
345 ecffb0bb Phil Davis
if (count($config['interfaces']) > 1) {
346 31f03b6c Sjon Hortensius
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
347 e259607f Thane Gill
}
348 239b5161 Stephen Beaver
349 31f03b6c Sjon Hortensius
$ifentries = get_configured_interface_with_descr();
350
foreach ($ifentries as $ent => $entdesc) {
351
	if (is_array($config['interfaces'][$ent]['wireless']) &&
352 aa82505e Phil Davis
	    preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
353 31f03b6c Sjon Hortensius
		$wifdescrs[$ent] = $entdesc;
354 e259607f Thane Gill
	}
355 31f03b6c Sjon Hortensius
}
356 239b5161 Stephen Beaver
357 e259607f Thane Gill
if (count($wifdescrs) > 0) {
358 31f03b6c Sjon Hortensius
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
359 e259607f Thane Gill
}
360 239b5161 Stephen Beaver
361 ecffb0bb Phil Davis
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
362 31f03b6c Sjon Hortensius
363
// Diagnostics
364
$diagnostics_menu = array();
365
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
366
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
367 0f298138 k-paulius
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
368 c7903f8e Stephen Beaver
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
369 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
370 36a844df Stephen Beaver
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
371 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
372 239b5161 Stephen Beaver
373 ecffb0bb Phil Davis
if (file_exists("/var/run/gmirror_active")) {
374
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
375 e259607f Thane Gill
}
376 239b5161 Stephen Beaver
377 1af5edbf Stephen Beaver
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
378 ecffb0bb Phil Davis
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
379
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
380 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
381
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
382
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
383
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
384 1af5edbf Stephen Beaver
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
385
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
386 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
387 9718847b k-paulius
$diagnostics_menu[] = array(gettext("S.M.A.R.T. Status"), "/diag_smart.php");
388 ecffb0bb Phil Davis
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
389 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
390
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
391
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
392
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
393
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
394 239b5161 Stephen Beaver
395 ecffb0bb Phil Davis
if ($g['platform'] == "nanobsd") {
396 31f03b6c Sjon Hortensius
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
397 e259607f Thane Gill
}
398 239b5161 Stephen Beaver
399 31f03b6c Sjon Hortensius
if (isset($config['system']['developer'])) {
400
	$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
401
}
402 239b5161 Stephen Beaver
403 ecffb0bb Phil Davis
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
404 31f03b6c Sjon Hortensius
405
$gold_menu = array();
406
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
407 ecffb0bb Phil Davis
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
408 31f03b6c Sjon Hortensius
409 ecffb0bb Phil Davis
if (!$g['disablehelpmenu']) {
410 31f03b6c Sjon Hortensius
	$help_menu = array();
411
	$help_menu[] = array(gettext("About this Page"), $helpurl);
412 ecffb0bb Phil Davis
	if ($g['product_name'] == "pfSense") {
413 31f03b6c Sjon Hortensius
		$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
414 e259607f Thane Gill
	}
415 d7218f77 Stephen Beaver
416 31f03b6c Sjon Hortensius
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
417
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
418
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
419
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
420
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
421
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
422 ecffb0bb Phil Davis
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
423 31f03b6c Sjon Hortensius
}
424 3d29d2eb Jared Dillard
425
$menuclass = "static";
426 ddb84143 Stephen Beaver
427
if (isset($config['system']['webgui']['webguifixedmenu'])) {
428 3d29d2eb Jared Dillard
	$menuclass = "fixed";
429
}
430 477db933 Jared Dillard
431
$numColumns = $config['system']['webgui']['dashboardcolumns'];
432
433
if (($pagename === "index.php") && ($numColumns > 2)) {
434 d349843c Jared Dillard
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
435 477db933 Jared Dillard
}
436 31f03b6c Sjon Hortensius
?>
437 477db933 Jared Dillard
<body id="<?=$numColumns?>">
438 3d29d2eb Jared Dillard
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
439 31f03b6c Sjon Hortensius
	<div class="container">
440
		<div class="navbar-header">
441 2d26ee5e Sjon Hortensius
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
442 31f03b6c Sjon Hortensius
				<span class="sr-only">Toggle navigation</span>
443
				<span class="icon-bar"></span>
444
				<span class="icon-bar"></span>
445
				<span class="icon-bar"></span>
446
			</button>
447 0cd22307 Stephen Beaver
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" title="<?=$config['system']['hostname'] . '.' . $config['system']['domain']?>"/></a>
448 31f03b6c Sjon Hortensius
		</div>
449 2d26ee5e Sjon Hortensius
		<div class="collapse navbar-collapse" id="pf-navbar">
450 31f03b6c Sjon Hortensius
			<ul class="nav navbar-nav">
451 69a17c90 Thane Gill
			<?php foreach ([
452 d7218f77 Stephen Beaver
					['name' => 'System',	  'menu' => $system_menu,	   'href' => null],
453 69a17c90 Thane Gill
					['name' => 'Interfaces',  'menu' => $interfaces_menu,  'href' => null],
454 d7218f77 Stephen Beaver
					['name' => 'Firewall',	  'menu' => $firewall_menu,	   'href' => null],
455
					['name' => 'Services',	  'menu' => $services_menu,	   'href' => null],
456
					['name' => 'VPN',		  'menu' => $vpn_menu,		   'href' => null],
457
					['name' => 'Status',	  'menu' => $status_menu,	   'href' => null],
458 69a17c90 Thane Gill
					['name' => 'Diagnostics', 'menu' => $diagnostics_menu, 'href' => null],
459 d7218f77 Stephen Beaver
					['name' => 'Gold',		  'menu' => $gold_menu,		   'href' => '_blank'],
460
					['name' => 'Help',		  'menu' => $help_menu,		   'href' => '_blank']
461 69a17c90 Thane Gill
				] as $item):
462
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
463
						continue;
464
					} ?>
465 31f03b6c Sjon Hortensius
				<li class="dropdown">
466 e97e9aca Thane Gill
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
467
						<?=gettext($item['name'])?>
468 31f03b6c Sjon Hortensius
						<span class="caret"></span>
469
					</a>
470 8559c9d9 jim-p
					<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'], $item['name'])?></ul>
471 31f03b6c Sjon Hortensius
				</li>
472 69a17c90 Thane Gill
			<?php endforeach?>
473 fc2ba7e2 k-paulius
			</ul>
474
			<ul class="nav navbar-nav navbar-right">
475 d7218f77 Stephen Beaver
				<?php if (are_notices_pending()):?>
476 e97e9aca Thane Gill
					<?php $notices = get_notices()?>
477 31f03b6c Sjon Hortensius
					<li class="dropdown">
478 2617a1bc Jared Dillard
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
479 aa82505e Phil Davis
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
480 2617a1bc Jared Dillard
							<span class="badge bg-danger"><?=count($notices)?></span>
481 31f03b6c Sjon Hortensius
						</a>
482
					</li>
483 2617a1bc Jared Dillard
				<?php
484
					endif;
485
				?>
486 07edce6d Stephen Beaver
					<li class="dropdown">
487
						<a href="/index.php?logout">
488
							<i class="fa fa-sign-out" title="<?=gettext("Log out")?>"></i>
489
						</a>
490
					</li>
491 d7218f77 Stephen Beaver
			</ul>
492 6eeca0ef Sjon Hortensius
		</div>
493
	</div>
494 31f03b6c Sjon Hortensius
</nav>
495 d7218f77 Stephen Beaver
496 477db933 Jared Dillard
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
497 45eebe10 Sander van Leeuwen
	<header class="header">
498 89dcfa01 Stephen Beaver
499
<?php
500
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
501 aa82505e Phil Davis
	if (isset($notitle)) {
502 89dcfa01 Stephen Beaver
		print('<br />');
503
		unset($notitle);
504
	} else {
505 aa82505e Phil Davis
		print(genhtmltitle($pgtitle));
506 89dcfa01 Stephen Beaver
	}
507
?>
508 0bf1e5fe Sjon Hortensius
		<ul class="context-links">
509 89dcfa01 Stephen Beaver
510 91d59881 NOYB
	<?php if (isset($widgets)): ?>
511 c05363c8 NOYB
		<li>
512 cee365e6 Stephen Beaver
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
513 91d59881 NOYB
				<i class="fa fa-save icon-pointer"></i>
514 c05363c8 NOYB
			</a>
515
		</li>
516
	<?php endif?>
517
518 91d59881 NOYB
	<?php if ($dashboard_available_widgets_hidden): ?>
519 35d8d613 NOYB
		<li>
520 91d59881 NOYB
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
521
				<i class="fa fa-plus icon-pointer"></i>
522 35d8d613 NOYB
			</a>
523
		</li>
524
	<?php endif?>
525 36a844df Stephen Beaver
526 c05363c8 NOYB
	<?php if ($system_logs_filter_form_hidden): ?>
527
		<li>
528 29c39b7c k-paulius
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
529 7bd42c09 NOYB
				<i class="fa fa-filter icon-pointer"></i>
530 c05363c8 NOYB
			</a>
531
		</li>
532
	<?php endif ?>
533
534 7076def1 Stephen Beaver
	<?php if ($system_logs_manage_log_form_hidden):
535 820780b5 NOYB
			/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
536
			if (isAllowedPage("status_logs_settings.php")) {
537
	?>
538 c05363c8 NOYB
		<li>
539 29c39b7c k-paulius
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
540 7bd42c09 NOYB
				<i class="fa fa-wrench icon-pointer"></i>
541 c05363c8 NOYB
			</a>
542
		</li>
543 820780b5 NOYB
	<?php	}
544
		endif
545
	?>
546 c05363c8 NOYB
547 b1b8784a NOYB
	<?php if ($monitoring_settings_form_hidden): ?>
548
		<li>
549
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
550
				<i class="fa fa-wrench icon-pointer"></i>
551
			</a>
552
		</li>
553
	<?php endif?>
554
555
	<?php if ($status_monitoring): ?>
556
		<li>
557 10485d3c Jared Dillard
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
558 b1b8784a NOYB
				<i class="fa fa-repeat icon-pointer"></i>
559
			</a>
560
		</li>
561
	<?php endif?>
562
563 c05363c8 NOYB
<?php
564 38386fb4 NOYB
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
565 649cde0b Sander van Leeuwen
	$ssvc = array();
566
	switch ($shortcut_section) {
567
		case "openvpn":
568
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
569
			break;
570
		case "captiveportal":
571
			$ssvc = find_service_by_cp_zone($cpzone);
572
			break;
573
		default:
574
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
575 31f03b6c Sjon Hortensius
	}
576 649cde0b Sander van Leeuwen
	if (!empty($ssvc)) {
577 ee678e75 Sander van Leeuwen
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
578 dca4eadf Stephen Beaver
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
579 649cde0b Sander van Leeuwen
	}
580
}
581 31f03b6c Sjon Hortensius
582 38386fb4 NOYB
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
583 9014e27c k-paulius
	echo '<li>' . $link . '</li>';
584
}
585
586 38386fb4 NOYB
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
587 9014e27c k-paulius
	echo '<li>' . $link . '</li>';
588
}
589
590 38386fb4 NOYB
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
591 9014e27c k-paulius
	echo '<li>' . $link . '</li>';
592
}
593 45eebe10 Sander van Leeuwen
594 0bf1e5fe Sjon Hortensius
?>
595 ecffb0bb Phil Davis
	<?php if (!$g['disablehelpicon']): ?>
596 0bf1e5fe Sjon Hortensius
		<li>
597 20e108e0 NOYB
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
598 7ea65674 Jared Dillard
				<i class="fa fa-question-circle"></i>
599 0bf1e5fe Sjon Hortensius
			</a>
600
		</li>
601 e259607f Thane Gill
	<?php endif?>
602 0bf1e5fe Sjon Hortensius
		</ul>
603 45eebe10 Sander van Leeuwen
	</header>
604 56c100ab Erik Fonnesbeck
<?php
605 31f03b6c Sjon Hortensius
/* if upgrade in progress, alert user */
606 c33a3c20 k-paulius
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
607 31f03b6c Sjon Hortensius
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
608 1ba98d4f k-paulius
		$warning_text = sprintf(gettext("<p>%s is booting, then packages will be reinstalled in the background.</p><p>Do not make changes in the GUI until this is complete.</p>"), $g['product_name']);
609 31f03b6c Sjon Hortensius
	} else {
610 ecffb0bb Phil Davis
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
611 27f37ca4 k-paulius
		$warning_text = gettext("<p>Packages are currently being reinstalled in the background.</p><p>Do not make changes in the GUI until this is complete.</p>");
612 1ba98d4f k-paulius
		$warning_text .= sprintf(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="%1$s &gt; %2$s">%1$s &gt; %2$s</a> page and reinstall packages manually.</p>'), gettext('Diagnostics'), htmlspecialchars(gettext('Backup & Restore')));
613 31f03b6c Sjon Hortensius
	}
614 180508d1 Stephen Beaver
615 f78bbe16 Phil Davis
	print_info_box($warning_text);
616 31f03b6c Sjon Hortensius
}
617
618 d7218f77 Stephen Beaver
/*	If this page is being remotely managed then do not allow the loading of the contents. */
619 1180e4f0 Sjon Hortensius
if ($config['remote_managed_pages']['item']) {
620 ecffb0bb Phil Davis
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
621 1180e4f0 Sjon Hortensius
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
622 3b3a95e5 Phil Davis
			print_info_box(gettext("This page is currently being managed by a remote machine."));
623 31f03b6c Sjon Hortensius
			include("foot.inc");
624 56c100ab Erik Fonnesbeck
			exit;
625
		}
626 1180e4f0 Sjon Hortensius
	}
627 e259607f Thane Gill
}
628 d7218f77 Stephen Beaver
629
// Modal notices window
630 a46c437d Stephen Beaver
// The notices modal needs to be outside of the page display div or things get messy
631 d7218f77 Stephen Beaver
if (are_notices_pending()):?>
632
633
<div id="notices" class="modal fade" role="dialog">
634 362642c1 Jared Dillard
	<div class="modal-dialog">
635 d7218f77 Stephen Beaver
		<div class="modal-content">
636
			<div class="modal-header">
637
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
638
					<span aria-hidden="true">&times;</span>
639
				</button>
640
641 f49cd725 Phil Davis
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
642 d7218f77 Stephen Beaver
			</div>
643
644
			<div class="modal-body">
645
<?php
646
	$noticeCategories = array();
647
648 aa82505e Phil Davis
	if (is_array($notices)) {
649
		foreach ($notices as $time => $notice) {
650
			if (!isset($noticeCategories[ $notice['category'] ])) {
651 d7218f77 Stephen Beaver
				$noticeCategories[ $notice['category'] ] = array();
652 aa82505e Phil Davis
			}
653 d7218f77 Stephen Beaver
654
			$notice['time'] = $time;
655
			array_push($noticeCategories[ $notice['category'] ], $notice);
656
		}
657
	}
658
659
	foreach ($noticeCategories as $category => $catNotices):?>
660
				<h4><?=$category?></h4>
661
				<ul>
662
<?php
663
	foreach ($catNotices as $notice):
664
?>
665
					<li>
666
						<b>
667
<?php if (!empty($notice['url'])):?>
668
							<a href="<?=$notice['url']?>"><?=$notice['id']?></a> -
669
<?php endif;?>
670
						</b>
671
						<?=$notice['notice']?>
672
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
673
					</li>
674
<?php	endforeach;?>
675
				</ul>
676
<?php endforeach;?>
677
			</div>
678
679
			<div class="modal-footer">
680 a77c2a23 Jared Dillard
				<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
681 ed66d182 Stephen Beaver
				<button type="button" id="clearallnotices" class="btn btn-primary"><i class="fa fa-trash-o icon-embed-btn"></i><?=gettext("Mark All as Read")?></button>
682 d7218f77 Stephen Beaver
			</div>
683
		</div>
684
	</div>
685
</div>
686
687 8fd9052f Colin Fleming
<script type="text/javascript">
688 8d3f3e34 Stephen Beaver
//<![CDATA[
689 aa82505e Phil Davis
	events.push(function() {
690 8d3f3e34 Stephen Beaver
	    $('#clearallnotices').click(function() {
691 329a1cd5 Stephen Beaver
			ajaxRequest = $.ajax({
692
				url: "/index.php",
693
				type: "post",
694 0206483d Stephen Beaver
				data: { closenotice: "all"},
695 aa82505e Phil Davis
				success: function() {
696 0206483d Stephen Beaver
					window.location = window.location.href;
697
				},
698 aa82505e Phil Davis
				failure: function() {
699 1860c406 Phil Davis
					alert("Error clearing notices!");
700 0206483d Stephen Beaver
				}
701 329a1cd5 Stephen Beaver
			});
702 8d3f3e34 Stephen Beaver
		});
703
	});
704
//]]>
705 888c3c1b Stephen Beaver
</script>
706
707 2344bed4 Renato Botelho
<?php endif;
708 0b87fcf5 bruno
709
// Get the flash Messages
710
get_flash_message();