Project

General

Profile

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