From ce63a992799895169891ac95a0c78e9ee28fcc67 Mon Sep 17 00:00:00 2001 From: Ruan Date: Mon, 8 Jun 2015 15:02:38 +0200 Subject: [PATCH] Support newlines and filter out HTML in ban reasons --- includes/page.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/page.php b/includes/page.php index c69fde0..f0086ad 100644 --- a/includes/page.php +++ b/includes/page.php @@ -42,9 +42,13 @@ function millis_to_date($millis) { * @param $text */ function clean($text) { + $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); if (strstr($text, "\xa7") || strstr($text, "&")) { $regex = "/(?i)(\xa7|&)[0-9A-FK-OR]/"; - return preg_replace($regex, "", $text); + $text = preg_replace($regex, "", $text); + } + if (strstr($text, "\n")) { + $text = preg_replace("/\n/", "
", $text); } return $text; }