if alias is negative and has multiple tags, make sure each tag becomes negative
This commit is contained in:
parent
ebfcf9389e
commit
ef6a7289bb
@ -1168,6 +1168,7 @@ class Tag {
|
|||||||
*/
|
*/
|
||||||
public static function resolve_alias($tag) {
|
public static function resolve_alias($tag) {
|
||||||
assert('is_string($tag)');
|
assert('is_string($tag)');
|
||||||
|
global $database;
|
||||||
|
|
||||||
$negative = false;
|
$negative = false;
|
||||||
if(!empty($tag) && ($tag[0] == '-')) {
|
if(!empty($tag) && ($tag[0] == '-')) {
|
||||||
@ -1175,14 +1176,18 @@ class Tag {
|
|||||||
$tag = substr($tag, 1);
|
$tag = substr($tag, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
global $database;
|
|
||||||
$newtag = $database->get_one(
|
$newtag = $database->get_one(
|
||||||
$database->scoreql_to_sql("SELECT newtag FROM aliases WHERE SCORE_STRNORM(oldtag)=SCORE_STRNORM(:tag)"),
|
$database->scoreql_to_sql("SELECT newtag FROM aliases WHERE SCORE_STRNORM(oldtag)=SCORE_STRNORM(:tag)"),
|
||||||
array("tag"=>$tag));
|
array("tag"=>$tag)
|
||||||
|
);
|
||||||
|
|
||||||
if(empty($newtag)) {
|
if(empty($newtag)) {
|
||||||
|
//tag has no alias, use old tag
|
||||||
$newtag = $tag;
|
$newtag = $tag;
|
||||||
}
|
}
|
||||||
return $negative ? "-$newtag" : $newtag;
|
|
||||||
|
return !$negative ? $newtag : preg_replace("/(\S+)/", "-$1", $newtag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user