scorify the downtime extension

This commit is contained in:
Shish 2009-01-04 08:30:46 -08:00
parent 0c628f2c10
commit 737d2f4268
2 changed files with 6 additions and 7 deletions

View File

@ -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;
}

View File

@ -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",
"<span style='font-size: 1.5em'><b>DOWNTIME MODE IS ON!</b></span>", "left", 0));
}