|
@@ -1,5 +1,4 @@
|
1
|
1
|
<?php
|
2
|
|
-
|
3
|
2
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
3
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
4
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
@@ -14,7 +13,7 @@ if ($_SESSION['loggedin'] != true) {
|
14
|
13
|
require_once __DIR__ . "/pages.php";
|
15
|
14
|
|
16
|
15
|
$pageid = "home";
|
17
|
|
-if (isset($_GET['page']) && !is_empty($_GET['page'])) {
|
|
16
|
+if (!empty($_GET['page'])) {
|
18
|
17
|
$pg = strtolower($_GET['page']);
|
19
|
18
|
$pg = preg_replace('/[^0-9a-z_]/', "", $pg);
|
20
|
19
|
if (array_key_exists($pg, PAGES) && file_exists(__DIR__ . "/pages/" . $pg . ".php")) {
|
|
@@ -66,28 +65,35 @@ header("Link: <static/js/bootstrap.bundle.min.js>; rel=preload; as=script", fals
|
66
|
65
|
|
67
|
66
|
<?php
|
68
|
67
|
// Alert messages
|
69
|
|
- if (isset($_GET['msg']) && !is_empty($_GET['msg']) && array_key_exists($_GET['msg'], MESSAGES)) {
|
70
|
|
- // optional string generation argument
|
71
|
|
- if (!isset($_GET['arg']) || is_empty($_GET['arg'])) {
|
72
|
|
- $alertmsg = $Strings->get(MESSAGES[$_GET['msg']]['string'], false);
|
|
68
|
+ if (!empty($_GET['msg'])) {
|
|
69
|
+ if (array_key_exists($_GET['msg'], MESSAGES)) {
|
|
70
|
+ // optional string generation argument
|
|
71
|
+ if (empty($_GET['arg'])) {
|
|
72
|
+ $alertmsg = $Strings->get(MESSAGES[$_GET['msg']]['string'], false);
|
|
73
|
+ } else {
|
|
74
|
+ $alertmsg = $Strings->build(MESSAGES[$_GET['msg']]['string'], ["arg" => strip_tags($_GET['arg'])], false);
|
|
75
|
+ }
|
|
76
|
+ $alerttype = MESSAGES[$_GET['msg']]['type'];
|
|
77
|
+ $alerticon = "square-o";
|
|
78
|
+ switch (MESSAGES[$_GET['msg']]['type']) {
|
|
79
|
+ case "danger":
|
|
80
|
+ $alerticon = "times";
|
|
81
|
+ break;
|
|
82
|
+ case "warning":
|
|
83
|
+ $alerticon = "exclamation-triangle";
|
|
84
|
+ break;
|
|
85
|
+ case "info":
|
|
86
|
+ $alerticon = "info-circle";
|
|
87
|
+ break;
|
|
88
|
+ case "success":
|
|
89
|
+ $alerticon = "check";
|
|
90
|
+ break;
|
|
91
|
+ }
|
73
|
92
|
} else {
|
74
|
|
- $alertmsg = $Strings->build(MESSAGES[$_GET['msg']]['string'], ["arg" => strip_tags($_GET['arg'])], false);
|
75
|
|
- }
|
76
|
|
- $alerttype = MESSAGES[$_GET['msg']]['type'];
|
77
|
|
- $alerticon = "square-o";
|
78
|
|
- switch (MESSAGES[$_GET['msg']]['type']) {
|
79
|
|
- case "danger":
|
80
|
|
- $alerticon = "times";
|
81
|
|
- break;
|
82
|
|
- case "warning":
|
83
|
|
- $alerticon = "exclamation-triangle";
|
84
|
|
- break;
|
85
|
|
- case "info":
|
86
|
|
- $alerticon = "info-circle";
|
87
|
|
- break;
|
88
|
|
- case "success":
|
89
|
|
- $alerticon = "check";
|
90
|
|
- break;
|
|
93
|
+ // We don't have a message for this, so just assume an error and escape stuff.
|
|
94
|
+ $alertmsg = htmlentities($Strings->get($_GET['msg'], false));
|
|
95
|
+ $alerticon = "times";
|
|
96
|
+ $alerttype = "danger";
|
91
|
97
|
}
|
92
|
98
|
echo <<<END
|
93
|
99
|
<div class="row justify-content-center" id="msg-alert-box">
|