Project

General

Profile

Download (26.7 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 c72c71f9 Phil Davis
// set default columns 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 54147cc6 Joe
$services_menu[] = array(gettext("DNS Resolver Overrides"), "/services_unbound_overrides.php");
289 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
290
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
291 239b5161 Stephen Beaver
292 ecffb0bb Phil Davis
if ($g['services_dhcp_server_enable']) {
293 31f03b6c Sjon Hortensius
	$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
294 46b7214c k-paulius
	$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
295 31f03b6c Sjon Hortensius
}
296 567d7fd6 Stephen Beaver
297 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
298 35e05b7f Phil Davis
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
299 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
300
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
301 1af5edbf Stephen Beaver
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
302 31f03b6c Sjon Hortensius
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
303 239b5161 Stephen Beaver
304 ecffb0bb Phil Davis
if (count($config['interfaces']) > 1) {
305 31f03b6c Sjon Hortensius
	/* no use for UPnP in single-interface deployments
306
	remove to reduce user confusion
307
	*/
308
	$services_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
309
}
310 239b5161 Stephen Beaver
311 7ca42d47 k-paulius
$services_menu[] = array(gettext("Wake-on-LAN"), "/services_wol.php");
312 ecffb0bb Phil Davis
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
313 31f03b6c Sjon Hortensius
314
// VPN
315
$vpn_menu = array();
316
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
317
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
318 a4af095c Renato Botelho
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
319 31f03b6c Sjon Hortensius
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
320 ecffb0bb Phil Davis
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
321 31f03b6c Sjon Hortensius
322
// Status
323
$status_menu = array();
324 925817a7 Phil Davis
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
325 1af5edbf Stephen Beaver
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
326 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Dashboard"), "/index.php");
327
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
328
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
329
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
330
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
331
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
332 1af5edbf Stephen Beaver
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
333 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
334
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
335
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
336 239b5161 Stephen Beaver
337 2344bed4 Renato Botelho
if ($g['platform'] == $g['product_name']) {
338 1af5edbf Stephen Beaver
	$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
339 e259607f Thane Gill
}
340 239b5161 Stephen Beaver
341 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
342
$status_menu[] = array(gettext("Services"), "/status_services.php");
343 1af5edbf Stephen Beaver
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
344 31f03b6c Sjon Hortensius
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
345 239b5161 Stephen Beaver
346 ecffb0bb Phil Davis
if (count($config['interfaces']) > 1) {
347 31f03b6c Sjon Hortensius
	$status_menu[] = array(gettext("UPnP &amp; NAT-PMP"), "/status_upnp.php");
348 e259607f Thane Gill
}
349 239b5161 Stephen Beaver
350 31f03b6c Sjon Hortensius
$ifentries = get_configured_interface_with_descr();
351
foreach ($ifentries as $ent => $entdesc) {
352
	if (is_array($config['interfaces'][$ent]['wireless']) &&
353 aa82505e Phil Davis
	    preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
354 31f03b6c Sjon Hortensius
		$wifdescrs[$ent] = $entdesc;
355 e259607f Thane Gill
	}
356 31f03b6c Sjon Hortensius
}
357 239b5161 Stephen Beaver
358 e259607f Thane Gill
if (count($wifdescrs) > 0) {
359 31f03b6c Sjon Hortensius
	$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
360 e259607f Thane Gill
}
361 239b5161 Stephen Beaver
362 ecffb0bb Phil Davis
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
363 31f03b6c Sjon Hortensius
364
// Diagnostics
365
$diagnostics_menu = array();
366
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
367
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
368 0f298138 k-paulius
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
369 c7903f8e Stephen Beaver
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
370 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
371 36a844df Stephen Beaver
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
372 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
373 239b5161 Stephen Beaver
374 ecffb0bb Phil Davis
if (file_exists("/var/run/gmirror_active")) {
375
	$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
376 e259607f Thane Gill
}
377 239b5161 Stephen Beaver
378 1af5edbf Stephen Beaver
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
379 ecffb0bb Phil Davis
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
380
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
381 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
382
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
383
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
384
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
385 1af5edbf Stephen Beaver
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
386
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
387 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
388 9718847b k-paulius
$diagnostics_menu[] = array(gettext("S.M.A.R.T. Status"), "/diag_smart.php");
389 ecffb0bb Phil Davis
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
390 31f03b6c Sjon Hortensius
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
391
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
392
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
393
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
394
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
395 239b5161 Stephen Beaver
396 ecffb0bb Phil Davis
if ($g['platform'] == "nanobsd") {
397 31f03b6c Sjon Hortensius
	$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
398 e259607f Thane Gill
}
399 239b5161 Stephen Beaver
400 31f03b6c Sjon Hortensius
if (isset($config['system']['developer'])) {
401
	$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
402
}
403 239b5161 Stephen Beaver
404 ecffb0bb Phil Davis
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
405 31f03b6c Sjon Hortensius
406
$gold_menu = array();
407
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
408 ecffb0bb Phil Davis
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
409 31f03b6c Sjon Hortensius
410 ecffb0bb Phil Davis
if (!$g['disablehelpmenu']) {
411 31f03b6c Sjon Hortensius
	$help_menu = array();
412
	$help_menu[] = array(gettext("About this Page"), $helpurl);
413 ecffb0bb Phil Davis
	if ($g['product_name'] == "pfSense") {
414 31f03b6c Sjon Hortensius
		$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
415 e259607f Thane Gill
	}
416 d7218f77 Stephen Beaver
417 31f03b6c Sjon Hortensius
	$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
418
	$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
419
	$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
420
	$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
421
	$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
422
	$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
423 ecffb0bb Phil Davis
	$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
424 31f03b6c Sjon Hortensius
}
425 3d29d2eb Jared Dillard
426
$menuclass = "static";
427 ddb84143 Stephen Beaver
428
if (isset($config['system']['webgui']['webguifixedmenu'])) {
429 3d29d2eb Jared Dillard
	$menuclass = "fixed";
430
}
431 477db933 Jared Dillard
432
$numColumns = $config['system']['webgui']['dashboardcolumns'];
433
434
if (($pagename === "index.php") && ($numColumns > 2)) {
435 d349843c Jared Dillard
	$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
436 477db933 Jared Dillard
}
437 31f03b6c Sjon Hortensius
?>
438 477db933 Jared Dillard
<body id="<?=$numColumns?>">
439 3d29d2eb Jared Dillard
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
440 31f03b6c Sjon Hortensius
	<div class="container">
441
		<div class="navbar-header">
442 2d26ee5e Sjon Hortensius
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
443 31f03b6c Sjon Hortensius
				<span class="sr-only">Toggle navigation</span>
444
				<span class="icon-bar"></span>
445
				<span class="icon-bar"></span>
446
				<span class="icon-bar"></span>
447
			</button>
448 0cd22307 Stephen Beaver
			<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" title="<?=$config['system']['hostname'] . '.' . $config['system']['domain']?>"/></a>
449 31f03b6c Sjon Hortensius
		</div>
450 2d26ee5e Sjon Hortensius
		<div class="collapse navbar-collapse" id="pf-navbar">
451 31f03b6c Sjon Hortensius
			<ul class="nav navbar-nav">
452 cb0222b0 Christopher Fazendin
			<?php
453
                if ($config['system']['webgui']['webguihostnamemenu'] == 'hostonly') {
454
                    $help_menu_title = htmlspecialchars($config['system']['hostname']);
455
                }
456
                elseif ($config['system']['webgui']['webguihostnamemenu'] == 'fqdn') {
457
                    $help_menu_title = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
458
                }
459
                else {
460
                    $help_menu_title = 'Help';
461
                }
462
                foreach ([
463
					['name' => 'System',	     'menu' => $system_menu,	  'href' => null],
464
					['name' => 'Interfaces',     'menu' => $interfaces_menu,  'href' => null],
465
					['name' => 'Firewall',	     'menu' => $firewall_menu,	  'href' => null],
466
					['name' => 'Services',	     'menu' => $services_menu,	  'href' => null],
467
					['name' => 'VPN',		     'menu' => $vpn_menu,		  'href' => null],
468
					['name' => 'Status',	     'menu' => $status_menu,	  'href' => null],
469
					['name' => 'Diagnostics',    'menu' => $diagnostics_menu, 'href' => null],
470
					['name' => 'Gold',		     'menu' => $gold_menu,		  'href' => '_blank'],
471
                    ['name' => $help_menu_title, 'menu' => $help_menu,		  'href' => '_blank']
472 69a17c90 Thane Gill
				] as $item):
473
					if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
474
						continue;
475
					} ?>
476 31f03b6c Sjon Hortensius
				<li class="dropdown">
477 e97e9aca Thane Gill
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
478
						<?=gettext($item['name'])?>
479 31f03b6c Sjon Hortensius
						<span class="caret"></span>
480
					</a>
481 8559c9d9 jim-p
					<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'], $item['name'])?></ul>
482 31f03b6c Sjon Hortensius
				</li>
483 69a17c90 Thane Gill
			<?php endforeach?>
484 fc2ba7e2 k-paulius
			</ul>
485
			<ul class="nav navbar-nav navbar-right">
486 d7218f77 Stephen Beaver
				<?php if (are_notices_pending()):?>
487 e97e9aca Thane Gill
					<?php $notices = get_notices()?>
488 31f03b6c Sjon Hortensius
					<li class="dropdown">
489 2617a1bc Jared Dillard
						<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
490 aa82505e Phil Davis
							<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
491 2617a1bc Jared Dillard
							<span class="badge bg-danger"><?=count($notices)?></span>
492 31f03b6c Sjon Hortensius
						</a>
493
					</li>
494 2617a1bc Jared Dillard
				<?php
495
					endif;
496
				?>
497 07edce6d Stephen Beaver
					<li class="dropdown">
498
						<a href="/index.php?logout">
499
							<i class="fa fa-sign-out" title="<?=gettext("Log out")?>"></i>
500
						</a>
501
					</li>
502 d7218f77 Stephen Beaver
			</ul>
503 6eeca0ef Sjon Hortensius
		</div>
504
	</div>
505 31f03b6c Sjon Hortensius
</nav>
506 d7218f77 Stephen Beaver
507 477db933 Jared Dillard
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
508 45eebe10 Sander van Leeuwen
	<header class="header">
509 89dcfa01 Stephen Beaver
510
<?php
511
	// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
512 aa82505e Phil Davis
	if (isset($notitle)) {
513 89dcfa01 Stephen Beaver
		print('<br />');
514
		unset($notitle);
515
	} else {
516 aa82505e Phil Davis
		print(genhtmltitle($pgtitle));
517 89dcfa01 Stephen Beaver
	}
518
?>
519 0bf1e5fe Sjon Hortensius
		<ul class="context-links">
520 89dcfa01 Stephen Beaver
521 91d59881 NOYB
	<?php if (isset($widgets)): ?>
522 c05363c8 NOYB
		<li>
523 cee365e6 Stephen Beaver
			<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
524 91d59881 NOYB
				<i class="fa fa-save icon-pointer"></i>
525 c05363c8 NOYB
			</a>
526
		</li>
527
	<?php endif?>
528
529 91d59881 NOYB
	<?php if ($dashboard_available_widgets_hidden): ?>
530 35d8d613 NOYB
		<li>
531 91d59881 NOYB
			<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
532
				<i class="fa fa-plus icon-pointer"></i>
533 35d8d613 NOYB
			</a>
534
		</li>
535
	<?php endif?>
536 36a844df Stephen Beaver
537 c05363c8 NOYB
	<?php if ($system_logs_filter_form_hidden): ?>
538
		<li>
539 29c39b7c k-paulius
			<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
540 7bd42c09 NOYB
				<i class="fa fa-filter icon-pointer"></i>
541 c05363c8 NOYB
			</a>
542
		</li>
543
	<?php endif ?>
544
545 7076def1 Stephen Beaver
	<?php if ($system_logs_manage_log_form_hidden):
546 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. */
547
			if (isAllowedPage("status_logs_settings.php")) {
548
	?>
549 c05363c8 NOYB
		<li>
550 29c39b7c k-paulius
			<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
551 7bd42c09 NOYB
				<i class="fa fa-wrench icon-pointer"></i>
552 c05363c8 NOYB
			</a>
553
		</li>
554 820780b5 NOYB
	<?php	}
555
		endif
556
	?>
557 c05363c8 NOYB
558 b1b8784a NOYB
	<?php if ($monitoring_settings_form_hidden): ?>
559
		<li>
560
			<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
561
				<i class="fa fa-wrench icon-pointer"></i>
562
			</a>
563
		</li>
564
	<?php endif?>
565
566
	<?php if ($status_monitoring): ?>
567
		<li>
568 10485d3c Jared Dillard
			<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
569 b1b8784a NOYB
				<i class="fa fa-repeat icon-pointer"></i>
570
			</a>
571
		</li>
572
	<?php endif?>
573
574 c05363c8 NOYB
<?php
575 38386fb4 NOYB
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
576 649cde0b Sander van Leeuwen
	$ssvc = array();
577
	switch ($shortcut_section) {
578
		case "openvpn":
579
			$ssvc = find_service_by_openvpn_vpnid($vpnid);
580
			break;
581
		case "captiveportal":
582
			$ssvc = find_service_by_cp_zone($cpzone);
583
			break;
584
		default:
585
			$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
586 31f03b6c Sjon Hortensius
	}
587 649cde0b Sander van Leeuwen
	if (!empty($ssvc)) {
588 ee678e75 Sander van Leeuwen
		// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
589 dca4eadf Stephen Beaver
		echo '<li>'. get_service_control_links($ssvc, false). '</li>';
590 649cde0b Sander van Leeuwen
	}
591
}
592 31f03b6c Sjon Hortensius
593 38386fb4 NOYB
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
594 9014e27c k-paulius
	echo '<li>' . $link . '</li>';
595
}
596
597 38386fb4 NOYB
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
598 9014e27c k-paulius
	echo '<li>' . $link . '</li>';
599
}
600
601 38386fb4 NOYB
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
602 9014e27c k-paulius
	echo '<li>' . $link . '</li>';
603
}
604 45eebe10 Sander van Leeuwen
605 0bf1e5fe Sjon Hortensius
?>
606 ecffb0bb Phil Davis
	<?php if (!$g['disablehelpicon']): ?>
607 0bf1e5fe Sjon Hortensius
		<li>
608 20e108e0 NOYB
			<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
609 7ea65674 Jared Dillard
				<i class="fa fa-question-circle"></i>
610 0bf1e5fe Sjon Hortensius
			</a>
611
		</li>
612 e259607f Thane Gill
	<?php endif?>
613 0bf1e5fe Sjon Hortensius
		</ul>
614 45eebe10 Sander van Leeuwen
	</header>
615 56c100ab Erik Fonnesbeck
<?php
616 31f03b6c Sjon Hortensius
/* if upgrade in progress, alert user */
617 c33a3c20 k-paulius
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
618 31f03b6c Sjon Hortensius
	if (file_exists('/conf/needs_package_sync') && platform_booting()) {
619 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']);
620 31f03b6c Sjon Hortensius
	} else {
621 ecffb0bb Phil Davis
		$pgtitle = array(gettext("System"), gettext("Package Manager"));
622 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>");
623 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')));
624 31f03b6c Sjon Hortensius
	}
625 180508d1 Stephen Beaver
626 f78bbe16 Phil Davis
	print_info_box($warning_text);
627 31f03b6c Sjon Hortensius
}
628
629 d7218f77 Stephen Beaver
/*	If this page is being remotely managed then do not allow the loading of the contents. */
630 1180e4f0 Sjon Hortensius
if ($config['remote_managed_pages']['item']) {
631 ecffb0bb Phil Davis
	foreach ($config['remote_managed_pages']['item'] as $rmp) {
632 1180e4f0 Sjon Hortensius
		if ($rmp == $_SERVER['SCRIPT_NAME']) {
633 3b3a95e5 Phil Davis
			print_info_box(gettext("This page is currently being managed by a remote machine."));
634 31f03b6c Sjon Hortensius
			include("foot.inc");
635 56c100ab Erik Fonnesbeck
			exit;
636
		}
637 1180e4f0 Sjon Hortensius
	}
638 e259607f Thane Gill
}
639 d7218f77 Stephen Beaver
640
// Modal notices window
641 a46c437d Stephen Beaver
// The notices modal needs to be outside of the page display div or things get messy
642 d7218f77 Stephen Beaver
if (are_notices_pending()):?>
643
644
<div id="notices" class="modal fade" role="dialog">
645 362642c1 Jared Dillard
	<div class="modal-dialog">
646 d7218f77 Stephen Beaver
		<div class="modal-content">
647
			<div class="modal-header">
648
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
649
					<span aria-hidden="true">&times;</span>
650
				</button>
651
652 f49cd725 Phil Davis
				<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
653 d7218f77 Stephen Beaver
			</div>
654
655
			<div class="modal-body">
656
<?php
657
	$noticeCategories = array();
658
659 aa82505e Phil Davis
	if (is_array($notices)) {
660
		foreach ($notices as $time => $notice) {
661
			if (!isset($noticeCategories[ $notice['category'] ])) {
662 d7218f77 Stephen Beaver
				$noticeCategories[ $notice['category'] ] = array();
663 aa82505e Phil Davis
			}
664 d7218f77 Stephen Beaver
665
			$notice['time'] = $time;
666
			array_push($noticeCategories[ $notice['category'] ], $notice);
667
		}
668
	}
669
670
	foreach ($noticeCategories as $category => $catNotices):?>
671
				<h4><?=$category?></h4>
672
				<ul>
673
<?php
674
	foreach ($catNotices as $notice):
675
?>
676
					<li>
677
						<b>
678
<?php if (!empty($notice['url'])):?>
679 0f1304ee Chris Buechler
							<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
680 d7218f77 Stephen Beaver
<?php endif;?>
681
						</b>
682 0f1304ee Chris Buechler
						<?=htmlspecialchars($notice['notice'])?>
683 d7218f77 Stephen Beaver
						<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
684
					</li>
685
<?php	endforeach;?>
686
				</ul>
687
<?php endforeach;?>
688
			</div>
689
690
			<div class="modal-footer">
691 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>
692 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>
693 d7218f77 Stephen Beaver
			</div>
694
		</div>
695
	</div>
696
</div>
697
698 8fd9052f Colin Fleming
<script type="text/javascript">
699 8d3f3e34 Stephen Beaver
//<![CDATA[
700 aa82505e Phil Davis
	events.push(function() {
701 8d3f3e34 Stephen Beaver
	    $('#clearallnotices').click(function() {
702 329a1cd5 Stephen Beaver
			ajaxRequest = $.ajax({
703
				url: "/index.php",
704
				type: "post",
705 0206483d Stephen Beaver
				data: { closenotice: "all"},
706 aa82505e Phil Davis
				success: function() {
707 0206483d Stephen Beaver
					window.location = window.location.href;
708
				},
709 aa82505e Phil Davis
				failure: function() {
710 1860c406 Phil Davis
					alert("Error clearing notices!");
711 0206483d Stephen Beaver
				}
712 329a1cd5 Stephen Beaver
			});
713 8d3f3e34 Stephen Beaver
		});
714
	});
715
//]]>
716 888c3c1b Stephen Beaver
</script>
717
718 2344bed4 Renato Botelho
<?php endif;
719 0b87fcf5 bruno
720
// Get the flash Messages
721
get_flash_message();