Project

General

Profile

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