From 1779f97cac3937f0f0b70386fae856ea667fb84e Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 26 Apr 2015 13:02:17 +0100 Subject: [PATCH] strip RTL from tags --- core/imageboard.pack.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 517b5a5c..d56d561c 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -1055,9 +1055,10 @@ class Tag { */ public static function sanitise($tag) { assert(is_string($tag)); - $tag = preg_replace("/[\s?*]/", "", $tag); - $tag = preg_replace("/\.+/", ".", $tag); - $tag = preg_replace("/^(\.+[\/\\\\])+/", "", $tag); + $tag = preg_replace("/[\s?*]/", "", $tag); # whitespace + $tag = preg_replace('/\x20(\x0e|\x0f)/', '', $tag); # unicode RTL + $tag = preg_replace("/\.+/", ".", $tag); # strings of dots? + $tag = preg_replace("/^(\.+[\/\\\\])+/", "", $tag); # trailing slashes? return $tag; }