From fe9dd98387fc440ed42a0d002073e3745a9c590c Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 11 Aug 2009 15:12:48 +0100 Subject: [PATCH] slightly less strict filename sanitising, for the unicode users --- core/imageboard.pack.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index d8b8089e..74eb66f4 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -439,11 +439,11 @@ class Image { global $config; // don't bother hitting the database if it won't be used... - $safe_tags = ""; + $tags = ""; if(strpos($tmpl, '$tags') !== false) { // * stabs dynamically typed languages with a rusty spoon * - $safe_tags = preg_replace( - "/[^a-zA-Z0-9_\- ]/", - "", $this->get_tag_list()); + $tags = $this->get_tag_list(); + $tags = str_replace("/", "", $tags); + $tags = preg_replace("/^\.+/", "", $tags); } $base_href = $config->get_string('base_href'); @@ -452,7 +452,7 @@ class Image { $tmpl = str_replace('$id', $this->id, $tmpl); $tmpl = str_replace('$hash', $this->hash, $tmpl); - $tmpl = str_replace('$tags', $_escape($safe_tags), $tmpl); + $tmpl = str_replace('$tags', $_escape($tags), $tmpl); $tmpl = str_replace('$base', $base_href, $tmpl); $tmpl = str_replace('$ext', $this->ext, $tmpl); $tmpl = str_replace('$size', "{$this->width}x{$this->height}", $tmpl);