if alias is negative and has multiple tags, make sure each tag becomes negative

This commit is contained in:
Daku 2015-08-12 06:11:21 +01:00
parent ebfcf9389e
commit ef6a7289bb

View File

@ -1168,6 +1168,7 @@ class Tag {
*/
public static function resolve_alias($tag) {
assert('is_string($tag)');
global $database;
$negative = false;
if(!empty($tag) && ($tag[0] == '-')) {
@ -1175,14 +1176,18 @@ class Tag {
$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));
array("tag"=>$tag)
);
if(empty($newtag)) {
//tag has no alias, use old tag
$newtag = $tag;
}
return $negative ? "-$newtag" : $newtag;
return !$negative ? $newtag : preg_replace("/(\S+)/", "-$1", $newtag);
}
/**