Project

General

Profile

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