diff --git a/contrib/admin_utils/main.php b/contrib/admin_utils/main.php new file mode 100644 index 00000000..259e1e80 --- /dev/null +++ b/contrib/admin_utils/main.php @@ -0,0 +1,55 @@ + + * Link: http://trac.shishnet.org/shimmie2/ + * License: GPLv2 + * Description: Various non-essential utilities + */ + +class AdminUtils extends Extension { +// event handler {{{ + public function receive_event($event) { + if(is_a($event, 'PageRequestEvent') && ($event->page == "admin_utils")) { + global $user; + if($user->is_admin()) { + set_time_limit(0); + + switch($_POST['action']) { + case 'lowercase all tags': + $this->lowercase_all_tags(); + break; + } + + global $page; + $page->set_mode("redirect"); + $page->set_redirect(make_link("admin")); + } + } + + if(is_a($event, 'AdminBuildingEvent')) { + global $page; + $page->add_main_block(new Block("Misc Admin Tools", $this->build_form())); + } + } +// }}} +// do things {{{ + private function lowercase_all_tags() { + global $database; + $database->execute("UPDATE tags SET tag=lower(tag)"); + } +// }}} +// admin page HTML {{{ + private function build_form() { + $html = " +
+ "; + return $html; + } +// }}} +} +add_event_listener(new AdminUtils()); +?>