Project

General

Profile

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