From e013d86b56891319346472b5ef5d9469b208469b Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 3 Mar 2013 18:32:56 +0000 Subject: [PATCH] disallow aliases to other aliases --- ext/alias_editor/main.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index 7ba38656..4034fda8 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -108,6 +108,9 @@ class AliasEditor extends Extension { if($database->get_row("SELECT * FROM aliases WHERE oldtag=:oldtag AND lower(newtag)=lower(:newtag)", $pair)) { throw new AddAliasException("That alias already exists"); } + else if($database->get_row("SELECT * FROM aliases WHERE oldtag=:newtag", $pair)) { + throw new AddAliasException("{$event->newtag} is itself an alias"); + } else { $database->execute("INSERT INTO aliases(oldtag, newtag) VALUES(:oldtag, :newtag)", $pair); log_info("alias_editor", "Added alias for {$event->oldtag} -> {$event->newtag}", true);