Project

General

Profile

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