From 8b22652aa08e4c13c8ada8c651e804d5c7fe0509 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 4 Aug 2013 18:19:23 +0100 Subject: [PATCH] resolve negative aliases --- core/imageboard.pack.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 2a4b6a23..71427512 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -1011,15 +1011,20 @@ class Tag { public static function resolve_alias($tag) { assert(is_string($tag)); + $negative = false; + if(!empty($tag) && ($tag[0] == '-')) { + $negative = true; + $tag = substr($tag, 1); + } + global $database; $newtag = $database->get_one( $database->scoreql_to_sql("SELECT newtag FROM aliases WHERE SCORE_STRNORM(oldtag)=SCORE_STRNORM(:tag)"), array("tag"=>$tag)); - if(!empty($newtag)) { - return $newtag; - } else { - return $tag; + if(empty($newtag)) { + $newtag = $tag; } + return $negative ? "-$newtag" : $newtag; } public static function resolve_wildcard($tag) {