From 749ed3b58739d62a792a98d2ce123424bb924b64 Mon Sep 17 00:00:00 2001 From: shish Date: Thu, 18 Oct 2007 02:35:49 +0000 Subject: [PATCH] alias csv export fixed git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.1@531 7f39781d-f577-437e-ae19-be835c7a54ca --- ext/alias_editor/main.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index fb30513a..f5128d56 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -45,9 +45,10 @@ class AliasEditor extends Extension { $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 $database; $event->page->set_mode("data"); $event->page->set_type("text/plain"); - $event->page->set_data($this->get_alias_csv()); + $event->page->set_data($this->get_alias_csv($database)); } } @@ -62,6 +63,15 @@ class AliasEditor extends Extension { } } } + + private function get_alias_csv($database) { + $csv = ""; + $aliases = $database->db->GetAssoc("SELECT oldtag, newtag FROM aliases"); + foreach($aliases as $old => $new) { + $csv .= "$old,$new\n"; + } + return $csv; + } } add_event_listener(new AliasEditor()); ?>