1
|
<?php
|
2
|
/*
|
3
|
pfSense_MODULE: head.inc
|
4
|
*/
|
5
|
/* ====================================================================
|
6
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7
|
* Copyright (c) 2004, 2005 Scott Ullrich
|
8
|
*
|
9
|
* Redistribution and use in source and binary forms, with or without modification,
|
10
|
* are permitted provided that the following conditions are met:
|
11
|
*
|
12
|
* 1. Redistributions of source code must retain the above copyright notice,
|
13
|
* this list of conditions and the following disclaimer.
|
14
|
*
|
15
|
* 2. Redistributions in binary form must reproduce the above copyright
|
16
|
* notice, this list of conditions and the following disclaimer in
|
17
|
* the documentation and/or other materials provided with the
|
18
|
* distribution.
|
19
|
*
|
20
|
* 3. All advertising materials mentioning features or use of this software
|
21
|
* must display the following acknowledgment:
|
22
|
* "This product includes software developed by the pfSense Project
|
23
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
24
|
*
|
25
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
26
|
* endorse or promote products derived from this software without
|
27
|
* prior written permission. For written permission, please contact
|
28
|
* coreteam@pfsense.org.
|
29
|
*
|
30
|
* 5. Products derived from this software may not be called "pfSense"
|
31
|
* nor may "pfSense" appear in their names without prior written
|
32
|
* permission of the Electric Sheep Fencing, LLC.
|
33
|
*
|
34
|
* 6. Redistributions of any form whatsoever must retain the following
|
35
|
* acknowledgment:
|
36
|
*
|
37
|
* "This product includes software developed by the pfSense Project
|
38
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
39
|
*
|
40
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
41
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
43
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
44
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
45
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
46
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
47
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
48
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
49
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
50
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
51
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
52
|
*
|
53
|
* ====================================================================
|
54
|
*
|
55
|
*/
|
56
|
|
57
|
require_once("globals.inc");
|
58
|
require_once("functions.inc");
|
59
|
require_once("shortcuts.inc");
|
60
|
require_once("service-utils.inc");
|
61
|
|
62
|
/* $Id$ */
|
63
|
|
64
|
header('Content-Type: text/html; charset=utf-8');
|
65
|
|
66
|
$pagetitle = gentitle($pgtitle);
|
67
|
|
68
|
if (isset($config['system']['webgui']['pagenamefirst'])) {
|
69
|
$tabtitle = $pagetitle . " - " . $config['system']['hostname'] . "." . $config['system']['domain'];
|
70
|
} else {
|
71
|
$tabtitle = $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle;
|
72
|
}
|
73
|
?>
|
74
|
<!DOCTYPE html>
|
75
|
<html lang="en">
|
76
|
<head>
|
77
|
<link rel="stylesheet" href="/bootstrap/css/pfSense.css" />
|
78
|
<title><?=$tabtitle?></title>
|
79
|
<script>var events = events || [];</script>
|
80
|
</head>
|
81
|
<body id="<?=basename($_SERVER['SCRIPT_NAME'], '.php')?>">
|
82
|
<?php
|
83
|
|
84
|
/* Determine automated help URL. Should output the page name and parameters
|
85
|
separately */
|
86
|
$uri_split = "";
|
87
|
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);
|
88
|
|
89
|
/* If there was no match, there were no parameters, just grab the filename
|
90
|
Otherwise, use the matched filename from above. */
|
91
|
if (empty($uri_split[0])) {
|
92
|
$pagename = ltrim($_SERVER["REQUEST_URI"], '/');
|
93
|
} else {
|
94
|
$pagename = $uri_split[1];
|
95
|
}
|
96
|
|
97
|
/* If the page name is still empty, the user must have requested / (index.php) */
|
98
|
if (empty($pagename)) {
|
99
|
$pagename = "index.php";
|
100
|
}
|
101
|
|
102
|
/* If the filename is pkg_edit.php or wizard.php, reparse looking
|
103
|
for the .xml filename */
|
104
|
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
|
105
|
$param_split = explode('&', $uri_split[2]);
|
106
|
foreach ($param_split as $param) {
|
107
|
if (substr($param, 0, 4) == "xml=") {
|
108
|
$xmlfile = explode('=', $param);
|
109
|
$pagename = $xmlfile[1];
|
110
|
}
|
111
|
}
|
112
|
}
|
113
|
|
114
|
// Build the full help URL.
|
115
|
$helpurl .= "{$g['help_base_url']}?page={$pagename}";
|
116
|
|
117
|
// Create a menu entry of any installed packages in the specified category
|
118
|
// (Now reads the menu information from $config['installedpackages']['menu'] only)
|
119
|
function return_ext_menu($section) {
|
120
|
global $config;
|
121
|
|
122
|
$htmltext = "";
|
123
|
$extarray = array();
|
124
|
|
125
|
if ( (!empty($config['installedpackages']['package'])) && (!empty($config['installedpackages']['menu']))) {
|
126
|
foreach ($config['installedpackages']['menu'] as $menu) {
|
127
|
// print('Name: ' . $menu['name'] . ', Pkg category: ' . $menu['category'] . ', Section: ' . $section . '<br />');
|
128
|
if ($menu['section'] != $section) {
|
129
|
continue;
|
130
|
}
|
131
|
|
132
|
if ($menu['url'] != "") {
|
133
|
$test_url = $menu['url'];
|
134
|
$addresswithport = getenv("HTTP_HOST");
|
135
|
$colonpos = strpos($addresswithport, ":");
|
136
|
|
137
|
if ($colonpos !== false) {
|
138
|
//my url is actually just the IP address of the pfsense box
|
139
|
$myurl = substr($addresswithport, 0, $colonpos);
|
140
|
} else {
|
141
|
$myurl = $addresswithport;
|
142
|
}
|
143
|
$description = str_replace('$myurl', $myurl, $menu['url']);
|
144
|
} else {
|
145
|
$description = '/pkg.php?xml=' . $menu['configfile'];
|
146
|
$test_url=$description;
|
147
|
}
|
148
|
|
149
|
if (isAllowedPage($test_url)) {
|
150
|
$extarray[] = array($menu['name'], $description);
|
151
|
}
|
152
|
}
|
153
|
}
|
154
|
|
155
|
return $extarray;
|
156
|
}
|
157
|
|
158
|
function output_menu($arrayitem, $target = null) {
|
159
|
foreach ($arrayitem as $item) {
|
160
|
if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout") {
|
161
|
$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
|
162
|
if ($target) {
|
163
|
$attr .= sprintf(" target=\"%s\"", htmlentities($target));
|
164
|
}
|
165
|
$class = "navlnk";
|
166
|
if ($item['class']) {
|
167
|
$class .= " {$item['class']}";
|
168
|
}
|
169
|
$attr .= sprintf(" class=\"%s\"", htmlentities($class));
|
170
|
if ($item['style']) {
|
171
|
$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
|
172
|
}
|
173
|
echo "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]). "</li>\n";
|
174
|
}
|
175
|
}
|
176
|
}
|
177
|
|
178
|
// System
|
179
|
$system_menu = array();
|
180
|
$system_menu[] = array(gettext("Logout"), "/index.php?logout");
|
181
|
$system_menu[] = array(gettext("Advanced"), "/system_advanced_admin.php");
|
182
|
$system_menu[] = array(gettext("Firmware"), "/system_firmware.php");
|
183
|
$system_menu[] = array(gettext("General Setup"), "/system.php");
|
184
|
$system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php");
|
185
|
if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") {
|
186
|
$system_menu[] = array(gettext("Packages"), "/pkg_mgr_installed.php");
|
187
|
}
|
188
|
$system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml");
|
189
|
$system_menu[] = array(gettext("Routing"), "/system_gateways.php");
|
190
|
$system_menu[] = array(gettext("Cert Manager"), "/system_camanager.php");
|
191
|
if (!isAllowedPage("system_usermanager.php*")) {
|
192
|
$system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php");
|
193
|
} else {
|
194
|
$system_menu[] = array(gettext("User Manager"), "/system_usermanager.php");
|
195
|
}
|
196
|
|
197
|
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
|
198
|
|
199
|
// Interfaces
|
200
|
$interfaces_menu = array();
|
201
|
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
|
202
|
$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
|
203
|
}
|
204
|
$opts = get_configured_interface_with_descr(false, true);
|
205
|
foreach ($opts as $oif => $odescr) {
|
206
|
if (!isset($config['interfaces'][$oif]['ovpn'])) {
|
207
|
$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
|
208
|
}
|
209
|
}
|
210
|
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
|
211
|
|
212
|
// Firewall
|
213
|
$firewall_menu = array();
|
214
|
$firewall_menu[] = array(gettext("Aliases"), "/firewall_aliases.php");
|
215
|
$firewall_menu[] = array(gettext("NAT"), "/firewall_nat.php");
|
216
|
$firewall_menu[] = array(gettext("Rules"), "/firewall_rules.php");
|
217
|
$firewall_menu[] = array(gettext("Schedules"), "/firewall_schedule.php");
|
218
|
$firewall_menu[] = array(gettext("Traffic Shaper"), "/firewall_shaper.php");
|
219
|
$firewall_menu[] = array(gettext("Virtual IPs"), "/firewall_virtual_ip.php");
|
220
|
$firewall_menu = msort(array_merge($firewall_menu, return_ext_menu("Firewall")), 0);
|
221
|
|
222
|
// Services
|
223
|
$services_menu = array();
|
224
|
$services_menu[] = array(gettext("Captive Portal"), "/services_captiveportal.php");
|
225
|
$services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php");
|
226
|
$services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php");
|
227
|
$services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php");
|
228
|
$services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php");
|
229
|
|
230
|
if ($g['services_dhcp_server_enable']) {
|
231
|
$services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php");
|
232
|
$services_menu[] = array(gettext("DHCPv6 Server/RA"), "/services_dhcpv6.php");
|
233
|
}
|
234
|
|
235
|
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
|
236
|
$services_menu[] = array(gettext("IGMP proxy"), "/services_igmpproxy.php");
|
237
|
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
|
238
|
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
|
239
|
$services_menu[] = array(gettext("PPPoE Server"), "/vpn_pppoe.php");
|
240
|
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
|
241
|
|
242
|
if (count($config['interfaces']) > 1) {
|
243
|
/* no use for UPnP in single-interface deployments
|
244
|
remove to reduce user confusion
|
245
|
*/
|
246
|
$services_menu[] = array(gettext("UPnP & NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml");
|
247
|
}
|
248
|
|
249
|
$services_menu[] = array(gettext("Wake on LAN"), "/services_wol.php");
|
250
|
$services_menu = msort(array_merge($services_menu, return_ext_menu("Services")), 0);
|
251
|
|
252
|
// VPN
|
253
|
$vpn_menu = array();
|
254
|
$vpn_menu[] = array(gettext("IPsec"), "/vpn_ipsec.php");
|
255
|
$vpn_menu[] = array(gettext("OpenVPN"), "/vpn_openvpn_server.php");
|
256
|
//$vpn_menu[] = array(gettext("PPTP"), "/vpn_pptp.php");
|
257
|
$vpn_menu[] = array(gettext("L2TP"), "/vpn_l2tp.php");
|
258
|
$vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
|
259
|
|
260
|
// Status
|
261
|
$status_menu = array();
|
262
|
if (count($config['captiveportal']) > 0) {
|
263
|
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
|
264
|
}
|
265
|
|
266
|
$status_menu[] = array(gettext("CARP (failover)"), "/carp_status.php");
|
267
|
$status_menu[] = array(gettext("Dashboard"), "/index.php");
|
268
|
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
|
269
|
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
|
270
|
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
|
271
|
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
|
272
|
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
|
273
|
$status_menu[] = array(gettext("IPsec"), "/diag_ipsec.php");
|
274
|
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
|
275
|
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
|
276
|
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
|
277
|
|
278
|
if ($g['platform'] == "pfSense") {
|
279
|
$status_menu[] = array(gettext("Package Logs"), "/diag_pkglogs.php");
|
280
|
}
|
281
|
|
282
|
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
|
283
|
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
|
284
|
$status_menu[] = array(gettext("Services"), "/status_services.php");
|
285
|
$status_menu[] = array(gettext("System Logs"), "/diag_logs.php");
|
286
|
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
|
287
|
|
288
|
if (count($config['interfaces']) > 1) {
|
289
|
$status_menu[] = array(gettext("UPnP & NAT-PMP"), "/status_upnp.php");
|
290
|
}
|
291
|
|
292
|
$ifentries = get_configured_interface_with_descr();
|
293
|
foreach ($ifentries as $ent => $entdesc) {
|
294
|
if (is_array($config['interfaces'][$ent]['wireless']) &&
|
295
|
preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) {
|
296
|
$wifdescrs[$ent] = $entdesc;
|
297
|
}
|
298
|
}
|
299
|
|
300
|
if (count($wifdescrs) > 0) {
|
301
|
$status_menu[] = array(gettext("Wireless"), "/status_wireless.php");
|
302
|
}
|
303
|
|
304
|
$status_menu = msort(array_merge($status_menu, return_ext_menu("Status")), 0);
|
305
|
|
306
|
// Diagnostics
|
307
|
$diagnostics_menu = array();
|
308
|
$diagnostics_menu[] = array(gettext("ARP Table"), "/diag_arp.php");
|
309
|
$diagnostics_menu[] = array(gettext("Authentication"), "/diag_authentication.php");
|
310
|
$diagnostics_menu[] = array(gettext("Backup/Restore"), "/diag_backup.php");
|
311
|
$diagnostics_menu[] = array(gettext("Command Prompt"), "/exec.php");
|
312
|
$diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php");
|
313
|
$diagnostics_menu[] = array(gettext("Edit File"), "/edit.php");
|
314
|
$diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php");
|
315
|
|
316
|
if (file_exists("/var/run/gmirror_active")) {
|
317
|
$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
|
318
|
}
|
319
|
|
320
|
$diagnostics_menu[] = array(gettext("Halt System"), "/halt.php");
|
321
|
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
|
322
|
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
|
323
|
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
|
324
|
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
|
325
|
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
|
326
|
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
|
327
|
$diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php");
|
328
|
$diagnostics_menu[] = array(gettext("Reboot"), "/reboot.php");
|
329
|
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
|
330
|
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
|
331
|
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
|
332
|
$diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php");
|
333
|
$diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php");
|
334
|
$diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");
|
335
|
$diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php");
|
336
|
$diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php");
|
337
|
|
338
|
if ($g['platform'] == "nanobsd") {
|
339
|
$diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php");
|
340
|
}
|
341
|
|
342
|
if (isset($config['system']['developer'])) {
|
343
|
$diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;");
|
344
|
}
|
345
|
|
346
|
$diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")), 0);
|
347
|
|
348
|
$gold_menu = array();
|
349
|
$gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold");
|
350
|
$gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")), 0);
|
351
|
|
352
|
if (!$g['disablehelpmenu']) {
|
353
|
$help_menu = array();
|
354
|
$help_menu[] = array(gettext("About this Page"), $helpurl);
|
355
|
if ($g['product_name'] == "pfSense") {
|
356
|
$help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine");
|
357
|
}
|
358
|
|
359
|
$help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum");
|
360
|
$help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc");
|
361
|
$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
|
362
|
$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
|
363
|
$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
|
364
|
$help_menu[] = array(gettext("Search portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
|
365
|
$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
|
366
|
$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
|
367
|
}
|
368
|
|
369
|
?>
|
370
|
<nav class="navbar navbar-static-top navbar-inverse">
|
371
|
<div class="container">
|
372
|
<div class="navbar-header">
|
373
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#pf-navbar">
|
374
|
<span class="sr-only">Toggle navigation</span>
|
375
|
<span class="icon-bar"></span>
|
376
|
<span class="icon-bar"></span>
|
377
|
<span class="icon-bar"></span>
|
378
|
</button>
|
379
|
<a class="navbar-brand" href="/"><img src="/logo.png" alt="pfSense" /></a>
|
380
|
</div>
|
381
|
<div class="collapse navbar-collapse" id="pf-navbar">
|
382
|
<ul class="nav navbar-nav">
|
383
|
<?php foreach ([
|
384
|
['name' => 'System', 'menu' => $system_menu, 'href' => null],
|
385
|
['name' => 'Interfaces', 'menu' => $interfaces_menu, 'href' => null],
|
386
|
['name' => 'Firewall', 'menu' => $firewall_menu, 'href' => null],
|
387
|
['name' => 'Services', 'menu' => $services_menu, 'href' => null],
|
388
|
['name' => 'VPN', 'menu' => $vpn_menu, 'href' => null],
|
389
|
['name' => 'Status', 'menu' => $status_menu, 'href' => null],
|
390
|
['name' => 'Diagnostics', 'menu' => $diagnostics_menu, 'href' => null],
|
391
|
['name' => 'Gold', 'menu' => $gold_menu, 'href' => '_blank'],
|
392
|
['name' => 'Help', 'menu' => $help_menu, 'href' => '_blank']
|
393
|
] as $item):
|
394
|
if ($item['name'] == 'Help' && $g['disablehelpmenu']) {
|
395
|
continue;
|
396
|
} ?>
|
397
|
<li class="dropdown">
|
398
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
399
|
<?=gettext($item['name'])?>
|
400
|
<span class="caret"></span>
|
401
|
</a>
|
402
|
<ul class="dropdown-menu" role="menu"><?=output_menu($item['menu'], $item['href'])?></ul>
|
403
|
</li>
|
404
|
<?php endforeach?>
|
405
|
<?php if (are_notices_pending()):?>
|
406
|
<?php $notices = get_notices()?>
|
407
|
<li class="dropdown">
|
408
|
<a href="#" data-toggle="modal" data-target="#notices" role="button" aria-expanded="false"><?=gettext("Notices")?>
|
409
|
<span class="badge"><?=count($notices)?></span>
|
410
|
</a>
|
411
|
</li>
|
412
|
<?php
|
413
|
endif;
|
414
|
?>
|
415
|
</ul>
|
416
|
</div>
|
417
|
</div>
|
418
|
</nav>
|
419
|
|
420
|
<div class="container">
|
421
|
<header class="header">
|
422
|
|
423
|
<?php
|
424
|
// If you set $notitle = true BEFORE including head.inc, the page title will be supressed
|
425
|
if(isset($notitle)) {
|
426
|
print('<br />');
|
427
|
unset($notitle);
|
428
|
} else {
|
429
|
|
430
|
print(genhtmltitle($pgtitle));
|
431
|
}
|
432
|
?>
|
433
|
<ul class="context-links">
|
434
|
<?php
|
435
|
|
436
|
if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) {
|
437
|
$ssvc = array();
|
438
|
switch ($shortcut_section) {
|
439
|
case "openvpn":
|
440
|
$ssvc = find_service_by_openvpn_vpnid($vpnid);
|
441
|
break;
|
442
|
case "captiveportal":
|
443
|
$ssvc = find_service_by_cp_zone($cpzone);
|
444
|
break;
|
445
|
default:
|
446
|
$ssvc = find_service_by_name($shortcuts[$shortcut_section]['service']);
|
447
|
}
|
448
|
if (!empty($ssvc)) {
|
449
|
// echo '<li>'. get_service_status_icon($ssvc, false). '</li>'; TODO: Add missing function
|
450
|
echo '<li>'. get_service_control_links($ssvc, false). '</li>';
|
451
|
}
|
452
|
}
|
453
|
|
454
|
echo '<li>'. get_shortcut_main_link($shortcut_section, false). '</li>';
|
455
|
echo '<li>'. get_shortcut_status_link($shortcut_section, false). '</li>';
|
456
|
echo '<li>'. get_shortcut_log_link($shortcut_section, false). '</li>';
|
457
|
|
458
|
?>
|
459
|
<?php if (!$g['disablehelpicon']): ?>
|
460
|
<li>
|
461
|
<a href="<?=$helpurl?>" title="<?=gettext("Help for items on this page")?>" class="help-icon">
|
462
|
<i class="icon-large icon-question-sign"></i>
|
463
|
</a>
|
464
|
</li>
|
465
|
<?php endif?>
|
466
|
</ul>
|
467
|
</header>
|
468
|
<?php
|
469
|
/* if upgrade in progress, alert user */
|
470
|
if (is_subsystem_dirty('packagelock') || file_exists('/conf/needs_package_sync' && platform_booting())) {
|
471
|
if (file_exists('/conf/needs_package_sync') && platform_booting()) {
|
472
|
$info_text = sprintf(gettext("%s is booting then packages will be reinstalled in the background.<p>Do not make changes in the GUI until this is complete."), $g['product_name']);
|
473
|
} else {
|
474
|
$pgtitle = array(gettext("System"), gettext("Package Manager"));
|
475
|
$info_text = gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.");
|
476
|
}
|
477
|
print_info_box("{$info_text}<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif' alt='firmware update' />");
|
478
|
}
|
479
|
|
480
|
$pgtitle_output = true;
|
481
|
|
482
|
/* If this page is being remotely managed then do not allow the loading of the contents. */
|
483
|
if ($config['remote_managed_pages']['item']) {
|
484
|
foreach ($config['remote_managed_pages']['item'] as $rmp) {
|
485
|
if ($rmp == $_SERVER['SCRIPT_NAME']) {
|
486
|
print_info_box_np("This page is currently being managed by a remote machine.");
|
487
|
include("foot.inc");
|
488
|
exit;
|
489
|
}
|
490
|
}
|
491
|
}
|
492
|
|
493
|
// Modal notices window
|
494
|
// The notices modal needs to be outside of the page display div or things get messy
|
495
|
if (are_notices_pending()):?>
|
496
|
|
497
|
<div id="notices" class="modal fade" role="dialog">
|
498
|
<div class="mopdal-dialog">
|
499
|
<div class="modal-content">
|
500
|
<div class="modal-header">
|
501
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
502
|
<span aria-hidden="true">×</span>
|
503
|
</button>
|
504
|
|
505
|
<h3 class="modal-title" id="myModalLabel">Notices</h3>
|
506
|
</div>
|
507
|
|
508
|
<div class="modal-body">
|
509
|
<?php
|
510
|
$noticeCategories = array();
|
511
|
|
512
|
if(is_array($notices)) {
|
513
|
foreach ($notices as $time => $notice)
|
514
|
{
|
515
|
if (!isset($noticeCategories[ $notice['category'] ]))
|
516
|
$noticeCategories[ $notice['category'] ] = array();
|
517
|
|
518
|
$notice['time'] = $time;
|
519
|
array_push($noticeCategories[ $notice['category'] ], $notice);
|
520
|
}
|
521
|
}
|
522
|
|
523
|
foreach ($noticeCategories as $category => $catNotices):?>
|
524
|
<h4><?=$category?></h4>
|
525
|
<ul>
|
526
|
<?php
|
527
|
foreach ($catNotices as $notice):
|
528
|
?>
|
529
|
<li>
|
530
|
<b>
|
531
|
<?php if (!empty($notice['url'])):?>
|
532
|
<a href="<?=$notice['url']?>"><?=$notice['id']?></a> -
|
533
|
<?php endif;?>
|
534
|
</b>
|
535
|
<?=$notice['notice']?>
|
536
|
<i>@ <?=date('Y-m-d H:i:s', $notice['time'])?></i>
|
537
|
</li>
|
538
|
<?php endforeach;?>
|
539
|
</ul>
|
540
|
<?php endforeach;?>
|
541
|
</div>
|
542
|
|
543
|
<div class="modal-footer">
|
544
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
545
|
<a type="button" class="btn btn-primary" href="javascript:clear_notices();">Mark all as read</a>
|
546
|
</div>
|
547
|
</div>
|
548
|
</div>
|
549
|
</div>
|
550
|
|
551
|
<script>
|
552
|
// Do some Ajax to make index.php clear the notices
|
553
|
function clear_notices() {
|
554
|
xmlhttp=new XMLHttpRequest();
|
555
|
xmlhttp.open("GET","index.php?closenotice=all",true);
|
556
|
xmlhttp.send();
|
557
|
location.reload(); // reload the page to clear the notices indicator and dismiss the modal dialog all in one
|
558
|
}
|
559
|
</script>
|
560
|
|
561
|
<?php endif;
|