mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-24 08:52:45 +00:00
Support newlines and filter out HTML in ban reasons
This commit is contained in:
parent
40001ad0be
commit
ce63a99279
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user