From 737d2f4268cd6caebe25bad2487a673768c3b068 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 4 Jan 2009 08:30:46 -0800 Subject: [PATCH] scorify the downtime extension --- contrib/downtime/main.php | 11 +++++------ contrib/downtime/theme.php | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/contrib/downtime/main.php b/contrib/downtime/main.php index 5cdfa5ab..99dcb9d8 100644 --- a/contrib/downtime/main.php +++ b/contrib/downtime/main.php @@ -20,17 +20,16 @@ class Downtime implements Extension { } if($event instanceof PageRequestEvent) { - global $config; - if($config->get_bool("downtime")) { + if($event->context->config->get_bool("downtime")) { $this->check_downtime($event); $this->theme->display_notification($event->page); } } } - private function check_downtime($event) { - global $user; - global $config; + private function check_downtime(PageRequestEvent $event) { + $user = $event->context->user; + $config = $event->context->config; if($config->get_bool("downtime") && !$user->is_admin() && ($event instanceof PageRequestEvent) && !$this->is_safe_page($event)) { @@ -39,7 +38,7 @@ class Downtime implements Extension { } } - private function is_safe_page($event) { + private function is_safe_page(PageRequestEvent $event) { if($event->page_matches("user_admin/login")) return true; else return false; } diff --git a/contrib/downtime/theme.php b/contrib/downtime/theme.php index 6d81f67e..65511fa2 100644 --- a/contrib/downtime/theme.php +++ b/contrib/downtime/theme.php @@ -4,7 +4,7 @@ class DowntimeTheme Extends Themelet { /* * Show the admin that downtime mode is enabled */ - public function display_notification($page) { + public function display_notification(Page $page) { $page->add_block(new Block("Downtime", "DOWNTIME MODE IS ON!", "left", 0)); }