1
|
<?php
|
2
|
/*
|
3
|
* head.inc
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
|
7
|
* All rights reserved.
|
8
|
*
|
9
|
* 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
|
*
|
13
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
*
|
15
|
* 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
|
*/
|
21
|
|
22
|
require_once("globals.inc");
|
23
|
require_once("functions.inc");
|
24
|
require_once("shortcuts.inc");
|
25
|
require_once("service-utils.inc");
|
26
|
require_once('notices.inc');
|
27
|
|
28
|
header('Content-Type: text/html; charset=utf-8');
|
29
|
|
30
|
$pagetitle = gentitle($pgtitle);
|
31
|
|
32
|
if ($user_settings['webgui']['pagenamefirst']) {
|
33
|
$tabtitle = $pagetitle . " - " . htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
|
34
|
} else {
|
35
|
$tabtitle = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']) . " - " . $pagetitle;
|
36
|
}
|
37
|
|
38
|
$cssfile = "/css/pfSense.css";
|
39
|
|
40
|
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
|
}
|
44
|
}
|
45
|
|
46
|
// set default columns to two if unset
|
47
|
if (!isset($config['system']['webgui']['dashboardcolumns'])) {
|
48
|
$config['system']['webgui']['dashboardcolumns'] = 2;
|
49
|
}
|
50
|
|
51
|
?>
|
52
|
<!DOCTYPE html>
|
53
|
<html lang="en">
|
54
|
<head>
|
55
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
56
|
<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
|
57
|
<link rel="stylesheet" href="/vendor/sortable/sortable-theme-bootstrap.css">
|
58
|
<link rel="stylesheet" href="<?=$cssfile?>" />
|
59
|
<title><?=$tabtitle?></title>
|
60
|
<script type="text/javascript">
|
61
|
//<![CDATA[
|
62
|
var events = events || [];
|
63
|
//]]>
|
64
|
</script>
|
65
|
</head>
|
66
|
|
67
|
<?php
|
68
|
|
69
|
/* Determine automated help URL. Should output the page name and parameters
|
70
|
separately */
|
71
|
$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
|
|
82
|
/* 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
|
} 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
|
}
|
106
|
|
107
|
// Build the full help URL.
|
108
|
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
|
109
|
|
110
|
/*
|
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
|
// Create a menu entry of any installed packages in the specified category
|
136
|
// (Now reads the menu information from $config['installedpackages']['menu'] only)
|
137
|
function return_ext_menu($section) {
|
138
|
global $config, $ext_menu_path_data;
|
139
|
|
140
|
$htmltext = "";
|
141
|
$extarray = array();
|
142
|
$ext_menu_entries = array();
|
143
|
|
144
|
if ((!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
|
145
|
foreach ($config['installedpackages']['menu'] as $menu) {
|
146
|
// print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
|
147
|
if ($menu['section'] == $section) {
|
148
|
$ext_menu_entries[] = $menu;
|
149
|
}
|
150
|
}
|
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
|
|
165
|
if ($colonpos !== false) {
|
166
|
//my url is actually just the IP address of the pfsense box
|
167
|
$myurl = substr($addresswithport, 0, $colonpos);
|
168
|
} else {
|
169
|
$myurl = $addresswithport;
|
170
|
}
|
171
|
$description = str_replace('$myurl', $myurl, $menu['url']);
|
172
|
} else {
|
173
|
$description = '/pkg.php?xml=' . $menu['configfile'];
|
174
|
$test_url=$description;
|
175
|
}
|
176
|
|
177
|
if (isAllowedPage($test_url)) {
|
178
|
$extarray[] = array($menu['name'], $description);
|
179
|
}
|
180
|
}
|
181
|
|
182
|
return $extarray;
|
183
|
}
|
184
|
|
185
|
function output_menu($arrayitem, $target = null, $section = "") {
|
186
|
foreach ($arrayitem as $item) {
|
187
|
/* If the user has access to help pages, also show the full help menu. See #5909 */
|
188
|
if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" || (($section == "Help") && isAllowedPage("help.php"))) {
|
189
|
$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
|
$ext_menu_path_data = read_ext_menu_path_data();
|
207
|
|
208
|
// 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
|
$system_menu[] = array(gettext("Update"), "/pkg_mgr_install.php?id=firmware");
|
213
|
$system_menu[] = array(gettext("General Setup"), "/system.php");
|
214
|
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
|
215
|
if ($g['platform'] == $g['product_name'] or $g['platform'] == "nanobsd") {
|
216
|
$system_menu[] = array(gettext("Package Manager"), "/pkg_mgr_installed.php");
|
217
|
}
|
218
|
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
|
219
|
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
|
220
|
$system_menu[] = array(gettext("Cert. Manager"), "/system_camanager.php");
|
221
|
if (!isAllowedPage("system_usermanager.php*")) {
|
222
|
$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
|
223
|
} else {
|
224
|
$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
|
225
|
}
|
226
|
|
227
|
if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php*")) {
|
228
|
$system_menu[] = array(gettext("User Settings"), "/system_user_settings.php");
|
229
|
}
|
230
|
|
231
|
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
|
232
|
|
233
|
// Interfaces
|
234
|
$interfaces_menu = array();
|
235
|
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
|
236
|
$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
|
237
|
}
|
238
|
$opts = get_configured_interface_with_descr(false, true);
|
239
|
foreach ($opts as $oif => $odescr) {
|
240
|
if (!isset($config['interfaces'][$oif]['ovpn'])) {
|
241
|
$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
|
242
|
}
|
243
|
}
|
244
|
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
|
245
|
|
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
|
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
|
255
|
|
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
|
|
264
|
if ($g['services_dhcp_server_enable']) {
|
265
|
$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
|
266
|
$services_menu[] = array(htmlspecialchars(gettext("DHCPv6 Server & RA")), "/services_dhcpv6.php");
|
267
|
}
|
268
|
|
269
|
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
|
270
|
$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
|
271
|
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
|
272
|
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
|
273
|
$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
|
274
|
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
|
275
|
|
276
|
if (count($config['interfaces']) > 1) {
|
277
|
/* no use for UPnP in single-interface deployments
|
278
|
remove to reduce user confusion
|
279
|
*/
|
280
|
$services_menu[] = array(gettext("UPnP & NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
|
281
|
}
|
282
|
|
283
|
$services_menu[] = array(gettext("Wake-on-LAN"), "/services_wol.php");
|
284
|
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
|
285
|
|
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
|
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
|
291
|
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
|
292
|
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
|
293
|
|
294
|
// Status
|
295
|
$status_menu = array();
|
296
|
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
|
297
|
$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
|
298
|
$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
|
$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
|
305
|
$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
|
|
309
|
if ($g['platform'] == $g['product_name']) {
|
310
|
$status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
|
311
|
}
|
312
|
|
313
|
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
|
314
|
$status_menu[] = array(gettext("Services"), "/status_services.php");
|
315
|
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
|
316
|
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
|
317
|
|
318
|
if (count($config['interfaces']) > 1) {
|
319
|
$status_menu[] = array(gettext("UPnP & NAT-PMP"), "/status_upnp.php");
|
320
|
}
|
321
|
|
322
|
$ifentries = get_configured_interface_with_descr();
|
323
|
foreach ($ifentries as $ent => $entdesc) {
|
324
|
if (is_array($config['interfaces'][$ent]['wireless']) &&
|
325
|
preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
|
326
|
$wifdescrs[$ent] = $entdesc;
|
327
|
}
|
328
|
}
|
329
|
|
330
|
if (count($wifdescrs) > 0) {
|
331
|
$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
|
332
|
}
|
333
|
|
334
|
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
|
335
|
|
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
|
$diagnostics_menu[] = array(htmlspecialchars(gettext("Backup & Restore")), "/diag_backup.php");
|
341
|
$diagnostics_menu[] = array(gettext("Command Prompt"), "/diag_command.php");
|
342
|
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
|
343
|
$diagnostics_menu[] = array(gettext("Edit File"), "/diag_edit.php");
|
344
|
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
|
345
|
|
346
|
if (file_exists("/var/run/gmirror_active")) {
|
347
|
$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
|
348
|
}
|
349
|
|
350
|
$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
|
351
|
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
|
352
|
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
|
353
|
$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
|
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
|
358
|
$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
|
359
|
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
|
360
|
$diagnostics_menu[] = array(gettext("S.M.A.R.T. Status"), "/diag_smart.php");
|
361
|
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
|
362
|
$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
|
|
368
|
if ($g['platform'] == "nanobsd") {
|
369
|
$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
|
370
|
}
|
371
|
|
372
|
if (isset($config['system']['developer'])) {
|
373
|
$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
|
374
|
}
|
375
|
|
376
|
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
|
377
|
|
378
|
$gold_menu = array();
|
379
|
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
|
380
|
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
|
381
|
|
382
|
if (!$g['disablehelpmenu']) {
|
383
|
$help_menu = array();
|
384
|
$help_menu[] = array(gettext("About this Page"), $helpurl);
|
385
|
if ($g['product_name'] == "pfSense") {
|
386
|
$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
|
387
|
}
|
388
|
|
389
|
$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
|
390
|
$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
|
391
|
$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
|
392
|
$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
|
393
|
$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
|
394
|
$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
|
395
|
}
|
396
|
|
397
|
$menuclass = "static";
|
398
|
|
399
|
if ($user_settings['webgui']['webguifixedmenu'] == "fixed") {
|
400
|
$menuclass = "fixed";
|
401
|
}
|
402
|
|
403
|
$numColumns = $user_settings['webgui']['dashboardcolumns'];
|
404
|
|
405
|
if (($pagename === "index.php") && ($numColumns > 2)) {
|
406
|
$columnsContainer = 'style="max-width: ' . 585*$numColumns . 'px;width: 100%"';
|
407
|
}
|
408
|
?>
|
409
|
<body id="<?=$numColumns?>">
|
410
|
<nav id="topmenu" class="navbar navbar-<?=$menuclass?>-top navbar-inverse">
|
411
|
<div class="container">
|
412
|
<div class="navbar-header">
|
413
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
|
414
|
<span class="sr-only">Toggle navigation</span>
|
415
|
<span class="icon-bar"></span>
|
416
|
<span class="icon-bar"></span>
|
417
|
<span class="icon-bar"></span>
|
418
|
</button>
|
419
|
<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" title="<?=$config['system']['hostname'] . '.' . $config['system']['domain']?>"/></a>
|
420
|
</div>
|
421
|
<div class="collapse navbar-collapse" id="pf-navbar">
|
422
|
<ul class="nav navbar-nav">
|
423
|
<?php
|
424
|
if ($user_settings['webgui']['webguihostnamemenu'] == 'hostonly') {
|
425
|
$help_menu_title = htmlspecialchars($config['system']['hostname']);
|
426
|
}
|
427
|
elseif ($user_settings['webgui']['webguihostnamemenu'] == 'fqdn') {
|
428
|
$help_menu_title = htmlspecialchars($config['system']['hostname'] . "." . $config['system']['domain']);
|
429
|
}
|
430
|
else {
|
431
|
$help_menu_title = 'Help';
|
432
|
}
|
433
|
foreach ([
|
434
|
['name' => 'System', 'menu' => $system_menu, 'href' => null],
|
435
|
['name' => 'Interfaces', 'menu' => $interfaces_menu, 'href' => null],
|
436
|
['name' => 'Firewall', 'menu' => $firewall_menu, 'href' => null],
|
437
|
['name' => 'Services', 'menu' => $services_menu, 'href' => null],
|
438
|
['name' => 'VPN', 'menu' => $vpn_menu, 'href' => null],
|
439
|
['name' => 'Status', 'menu' => $status_menu, 'href' => null],
|
440
|
['name' => 'Diagnostics', 'menu' => $diagnostics_menu, 'href' => null],
|
441
|
['name' => 'Gold', 'menu' => $gold_menu, 'href' => '_blank'],
|
442
|
['name' => $help_menu_title, 'menu' => $help_menu, 'href' => '_blank']
|
443
|
] as $item):
|
444
|
if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
|
445
|
continue;
|
446
|
} ?>
|
447
|
<li class="dropdown">
|
448
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
449
|
<?=gettext($item['name'])?>
|
450
|
<span class="caret"></span>
|
451
|
</a>
|
452
|
<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'], $item['name'])?></ul>
|
453
|
</li>
|
454
|
<?php endforeach?>
|
455
|
</ul>
|
456
|
<ul class="nav navbar-nav navbar-right">
|
457
|
<?php if (are_notices_pending()):?>
|
458
|
<?php $notices = get_notices()?>
|
459
|
<li class="dropdown">
|
460
|
<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false">
|
461
|
<i class="fa fa-bell text-danger" title="<?=gettext("Notices")?>"></i>
|
462
|
<span class="badge bg-danger"><?=count($notices)?></span>
|
463
|
</a>
|
464
|
</li>
|
465
|
<?php
|
466
|
endif;
|
467
|
?>
|
468
|
<li class="dropdown">
|
469
|
<a href="/index.php?logout">
|
470
|
<i class="fa fa-sign-out" title="<?=gettext("Log out")?>"></i>
|
471
|
</a>
|
472
|
</li>
|
473
|
</ul>
|
474
|
</div>
|
475
|
</div>
|
476
|
</nav>
|
477
|
|
478
|
<div class="container <?=$menuclass?>" <?=$columnsContainer?>>
|
479
|
<header class="header">
|
480
|
|
481
|
<?php
|
482
|
// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
|
483
|
if (isset($notitle)) {
|
484
|
print('<br />');
|
485
|
unset($notitle);
|
486
|
} else {
|
487
|
print(genhtmltitle($pgtitle));
|
488
|
}
|
489
|
?>
|
490
|
<ul class="context-links">
|
491
|
|
492
|
<?php if (isset($widgets)): ?>
|
493
|
<li>
|
494
|
<a href="#" title="<?=gettext("Save dashboard layout")?>" id="btnstore" class="invisible">
|
495
|
<i class="fa fa-save icon-pointer"></i>
|
496
|
</a>
|
497
|
</li>
|
498
|
<?php endif?>
|
499
|
|
500
|
<?php if ($dashboard_available_widgets_hidden): ?>
|
501
|
<li>
|
502
|
<a onclick="$('#widget-available').toggle(360);" title="<?=gettext("Available widgets")?>">
|
503
|
<i class="fa fa-plus icon-pointer"></i>
|
504
|
</a>
|
505
|
</li>
|
506
|
<?php endif?>
|
507
|
|
508
|
<?php if ($system_logs_filter_form_hidden): ?>
|
509
|
<li>
|
510
|
<a onclick="$('#filter-form').toggle(360)" title="<?=gettext("Log filter")?>">
|
511
|
<i class="fa fa-filter icon-pointer"></i>
|
512
|
</a>
|
513
|
</li>
|
514
|
<?php endif ?>
|
515
|
|
516
|
<?php if ($system_logs_manage_log_form_hidden):
|
517
|
/* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */
|
518
|
if (isAllowedPage("status_logs_settings.php")) {
|
519
|
?>
|
520
|
<li>
|
521
|
<a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>">
|
522
|
<i class="fa fa-wrench icon-pointer"></i>
|
523
|
</a>
|
524
|
</li>
|
525
|
<?php }
|
526
|
endif
|
527
|
?>
|
528
|
|
529
|
<?php if ($monitoring_settings_form_hidden): ?>
|
530
|
<li>
|
531
|
<a onclick="$('#monitoring-settings-form').toggle(360);" title="<?=gettext("Settings")?>">
|
532
|
<i class="fa fa-wrench icon-pointer"></i>
|
533
|
</a>
|
534
|
</li>
|
535
|
<?php endif?>
|
536
|
|
537
|
<?php if ($status_monitoring): ?>
|
538
|
<li>
|
539
|
<a class="update-graph" title="<?=gettext("Refresh Graph")?>">
|
540
|
<i class="fa fa-repeat icon-pointer"></i>
|
541
|
</a>
|
542
|
</li>
|
543
|
<?php endif?>
|
544
|
|
545
|
<?php
|
546
|
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) {
|
547
|
$ssvc = array();
|
548
|
switch ($shortcut_section) {
|
549
|
case "openvpn":
|
550
|
$ssvc = find_service_by_openvpn_vpnid($vpnid);
|
551
|
break;
|
552
|
case "captiveportal":
|
553
|
$ssvc = find_service_by_cp_zone($cpzone);
|
554
|
break;
|
555
|
default:
|
556
|
$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
|
557
|
}
|
558
|
if (!empty($ssvc)) {
|
559
|
// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
|
560
|
echo '<li>'. get_service_control_links($ssvc, false). '</li>';
|
561
|
}
|
562
|
}
|
563
|
|
564
|
if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) {
|
565
|
echo '<li>' . $link . '</li>';
|
566
|
}
|
567
|
|
568
|
if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) {
|
569
|
echo '<li>' . $link . '</li>';
|
570
|
}
|
571
|
|
572
|
if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) {
|
573
|
echo '<li>' . $link . '</li>';
|
574
|
}
|
575
|
|
576
|
?>
|
577
|
<?php if (!$g['disablehelpicon']): ?>
|
578
|
<li>
|
579
|
<a href="<?=$helpurl?>" target="_blank" title="<?=gettext("Help for items on this page")?>">
|
580
|
<i class="fa fa-question-circle"></i>
|
581
|
</a>
|
582
|
</li>
|
583
|
<?php endif?>
|
584
|
</ul>
|
585
|
</header>
|
586
|
<?php
|
587
|
/* if upgrade in progress, alert user */
|
588
|
if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync') && platform_booting())) {
|
589
|
if (file_exists('/conf/needs_package_sync') && platform_booting()) {
|
590
|
$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']);
|
591
|
} else {
|
592
|
$pgtitle = array(gettext("System"), gettext("Package Manager"));
|
593
|
$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>");
|
594
|
$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 > %2$s">%1$s > %2$s</a> page and reinstall packages manually.</p>'), gettext('Diagnostics'), htmlspecialchars(gettext('Backup & Restore')));
|
595
|
}
|
596
|
|
597
|
print_info_box($warning_text);
|
598
|
}
|
599
|
|
600
|
/* If this page is being remotely managed then do not allow the loading of the contents. */
|
601
|
if ($config['remote_managed_pages']['item']) {
|
602
|
foreach ($config['remote_managed_pages']['item'] as $rmp) {
|
603
|
if ($rmp == $_SERVER['SCRIPT_NAME']) {
|
604
|
print_info_box(gettext("This page is currently being managed by a remote machine."));
|
605
|
include("foot.inc");
|
606
|
exit;
|
607
|
}
|
608
|
}
|
609
|
}
|
610
|
|
611
|
// Modal notices window
|
612
|
// The notices modal needs to be outside of the page display div or things get messy
|
613
|
if (are_notices_pending()):?>
|
614
|
|
615
|
<div id="notices" class="modal fade" role="dialog">
|
616
|
<div class="modal-dialog">
|
617
|
<div class="modal-content">
|
618
|
<div class="modal-header">
|
619
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
620
|
<span aria-hidden="true">×</span>
|
621
|
</button>
|
622
|
|
623
|
<h3 class="modal-title" id="myModalLabel"><?=gettext("Notices")?></h3>
|
624
|
</div>
|
625
|
|
626
|
<div class="modal-body">
|
627
|
<?php
|
628
|
$noticeCategories = array();
|
629
|
|
630
|
if (is_array($notices)) {
|
631
|
foreach ($notices as $time => $notice) {
|
632
|
if (!isset($noticeCategories[ $notice['category'] ])) {
|
633
|
$noticeCategories[ $notice['category'] ] = array();
|
634
|
}
|
635
|
|
636
|
$notice['time'] = $time;
|
637
|
array_push($noticeCategories[ $notice['category'] ], $notice);
|
638
|
}
|
639
|
}
|
640
|
|
641
|
foreach ($noticeCategories as $category => $catNotices):?>
|
642
|
<h4><?=$category?></h4>
|
643
|
<ul>
|
644
|
<?php
|
645
|
foreach ($catNotices as $notice):
|
646
|
?>
|
647
|
<li>
|
648
|
<b>
|
649
|
<?php if (!empty($notice['url'])):?>
|
650
|
<a href="<?=htmlspecialchars($notice['url'])?>"><?=htmlspecialchars($notice['id'])?></a> -
|
651
|
<?php endif;?>
|
652
|
</b>
|
653
|
<?=htmlspecialchars($notice['notice'])?>
|
654
|
<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
|
655
|
</li>
|
656
|
<?php endforeach;?>
|
657
|
</ul>
|
658
|
<?php endforeach;?>
|
659
|
</div>
|
660
|
|
661
|
<div class="modal-footer">
|
662
|
<button type="button" class="btn btn-info" data-dismiss="modal"><i class="fa fa-times icon-embed-btn"></i><?=gettext("Close")?></button>
|
663
|
<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>
|
664
|
</div>
|
665
|
</div>
|
666
|
</div>
|
667
|
</div>
|
668
|
|
669
|
<script type="text/javascript">
|
670
|
//<![CDATA[
|
671
|
events.push(function() {
|
672
|
$('#clearallnotices').click(function() {
|
673
|
ajaxRequest = $.ajax({
|
674
|
url: "/index.php",
|
675
|
type: "post",
|
676
|
data: { closenotice: "all"},
|
677
|
success: function() {
|
678
|
window.location = window.location.href;
|
679
|
},
|
680
|
failure: function() {
|
681
|
alert("Error clearing notices!");
|
682
|
}
|
683
|
});
|
684
|
});
|
685
|
});
|
686
|
//]]>
|
687
|
</script>
|
688
|
|
689
|
<?php endif;
|
690
|
|
691
|
// Get the flash Messages
|
692
|
get_flash_message();
|