Support newlines and filter out HTML in ban reasons

This commit is contained in:
Ruan 2015-06-08 15:02:38 +02:00
parent 40001ad0be
commit ce63a99279

View File

@ -42,9 +42,13 @@ function millis_to_date($millis) {
* @param $text * @param $text
*/ */
function clean($text) { function clean($text) {
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
if (strstr($text, "\xa7") || strstr($text, "&")) { if (strstr($text, "\xa7") || strstr($text, "&")) {
$regex = "/(?i)(\xa7|&)[0-9A-FK-OR]/"; $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/", "<br>", $text);
} }
return $text; return $text;
} }