forked from Cavemanon/cavepaintings
consistency
git-svn-id: file:///home/shish/svn/shimmie2/trunk@312 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
@@ -16,12 +16,16 @@ class AliasEditor extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("alias_editor", "AliasEditorTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page == "alias")) {
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "alias")) {
|
||||
global $user;
|
||||
if($event->get_arg(0) == "add") {
|
||||
if($user->is_admin()) {
|
||||
if(isset($_POST['oldtag']) && isset($_POST['newtag'])) {
|
||||
send_event(new AddAliasEvent($_POST['oldtag'], $_POST['newtag']));
|
||||
|
||||
global $page;
|
||||
$event->page->set_mode("redirect");
|
||||
$event->page->set_redirect(make_link("alias/list"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,32 +35,25 @@ class AliasEditor extends Extension {
|
||||
global $database;
|
||||
$database->Execute("DELETE FROM aliases WHERE oldtag=?", array($_POST['oldtag']));
|
||||
|
||||
global $page;
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("alias/list"));
|
||||
$event->page->set_mode("redirect");
|
||||
$event->page->set_redirect(make_link("alias/list"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($event->get_arg(0) == "list") {
|
||||
global $page;
|
||||
global $database;
|
||||
$this->theme->display_aliases($page, $database->db->GetAssoc("SELECT oldtag, newtag FROM aliases"), $user->is_admin());
|
||||
$this->theme->display_aliases($event->page, $database->db->GetAssoc("SELECT oldtag, newtag FROM aliases"), $user->is_admin());
|
||||
}
|
||||
else if($event->get_arg(0) == "export") {
|
||||
global $page;
|
||||
$page->set_mode("data");
|
||||
$page->set_type("text/plain");
|
||||
$page->set_data($this->get_alias_csv());
|
||||
$event->page->set_mode("data");
|
||||
$event->page->set_type("text/plain");
|
||||
$event->page->set_data($this->get_alias_csv());
|
||||
}
|
||||
}
|
||||
|
||||
if(is_a($event, 'AddAliasEvent')) {
|
||||
global $database;
|
||||
$database->Execute("INSERT INTO aliases(oldtag, newtag) VALUES(?, ?)", array($event->oldtag, $event->newtag));
|
||||
|
||||
global $page;
|
||||
$page->set_mode("redirect");
|
||||
$page->set_redirect(make_link("alias/list"));
|
||||
}
|
||||
|
||||
if(is_a($event, 'UserBlockBuildingEvent')) {
|
||||
|
Reference in New Issue
Block a user