Project

General

Profile

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