summaryrefslogtreecommitdiffstats
path: root/inc/message.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2025-05-22 16:07:03 +0200
committerSimon Rettberg2025-05-22 16:07:03 +0200
commit19160ec62cec3b6e436590b16ebb2b329ef5d55b (patch)
treebdfc8a89829fde79133b839d4cb52a27c7b3e520 /inc/message.inc.php
parent[locationinfo] URLpanel: Browser accept-language and screen rotation (diff)
downloadslx-admin-19160ec62cec3b6e436590b16ebb2b329ef5d55b.tar.gz
slx-admin-19160ec62cec3b6e436590b16ebb2b329ef5d55b.tar.xz
slx-admin-19160ec62cec3b6e436590b16ebb2b329ef5d55b.zip
Add audit logging of POST actions
Diffstat (limited to 'inc/message.inc.php')
-rw-r--r--inc/message.inc.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/inc/message.inc.php b/inc/message.inc.php
index 2f565b9a..2db5bda9 100644
--- a/inc/message.inc.php
+++ b/inc/message.inc.php
@@ -39,7 +39,7 @@ class Message
*/
private static function add(string $type, string $id, array $params): void
{
- if (strstr($id, '.') === false) {
+ if (strpos($id, '.') === false) {
$id = Page::getModule()->getIdentifier() . '.' . $id;
}
if (!empty($params) && $params[0] === true) {
@@ -190,5 +190,19 @@ class Message
return implode('&', $parts);
}
+ /**
+ * Check if any of the given error messages exist in the error list.
+ * @param string[] $message The error messages to check for.
+ * @return bool True if the specified error message of type 'danger' exists in the error list, false otherwise.
+ */
+ public static function hasError(string ...$message): bool
+ {
+ foreach (self::$list as $item) {
+ if (in_array($item['id'], $message, true) && $item['type'] === 'danger')
+ return true;
+ }
+ return false;
+ }
+
}