From 8004989501c2332cae7467bf0f0bc791e26afbb9 Mon Sep 17 00:00:00 2001 From: ruan <2369127-ruany@users.noreply.gitlab.com> Date: Tue, 18 Jul 2023 16:01:20 +0200 Subject: [PATCH] Support cleaning hex colours from punishment reasons --- inc/page.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/page.php b/inc/page.php index 1bd5728..6fca245 100644 --- a/inc/page.php +++ b/inc/page.php @@ -319,9 +319,12 @@ class Page { */ function clean($text) { if ($text === null) return null; - if (strstr($text, "\xa7") || strstr($text, "&")) { + if (strstr($text, "\xa7") || strstr($text, "&")) { // Regular chat colours $text = preg_replace("/(?i)(\x{00a7}|&)[0-9A-FK-OR]/u", "", $text); } + if (strstr($text, "#")) { // Hex colours + $text = preg_replace("/(?i)#[0-9A-F]{6}/u", "", $text); + } $text = htmlspecialchars($text, ENT_QUOTES); if (strstr($text, "\\n")) { $text = preg_replace("/\\\\n/", "
", $text);