downtime -> simpleext
This commit is contained in:
parent
7af442855d
commit
39e8e8b733
@ -11,31 +11,26 @@
|
|||||||
* message specified in the box.
|
* message specified in the box.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Downtime implements Extension {
|
class Downtime extends SimpleExtension {
|
||||||
var $theme;
|
|
||||||
|
|
||||||
public function get_priority() {return 10;}
|
public function get_priority() {return 10;}
|
||||||
|
|
||||||
public function receive_event(Event $event) {
|
public function onSetupBuilding($event) {
|
||||||
global $config, $database, $page, $user;
|
$sb = new SetupBlock("Downtime");
|
||||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
$sb->add_bool_option("downtime", "Disable non-admin access: ");
|
||||||
|
$sb->add_longtext_option("downtime_message", "<br>");
|
||||||
|
$event->panel->add_block($sb);
|
||||||
|
}
|
||||||
|
|
||||||
if($event instanceof SetupBuildingEvent) {
|
public function onPageRequest($event) {
|
||||||
$sb = new SetupBlock("Downtime");
|
global $config, $page, $user;
|
||||||
$sb->add_bool_option("downtime", "Disable non-admin access: ");
|
|
||||||
$sb->add_longtext_option("downtime_message", "<br>");
|
|
||||||
$event->panel->add_block($sb);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($event instanceof PageRequestEvent) {
|
if($config->get_bool("downtime")) {
|
||||||
if($config->get_bool("downtime")) {
|
if(!$user->is_admin() && !$this->is_safe_page($event)) {
|
||||||
if(!$user->is_admin() && !$this->is_safe_page($event)) {
|
$msg = $config->get_string("downtime_message");
|
||||||
$msg = $config->get_string("downtime_message");
|
$this->theme->display_message($msg);
|
||||||
$this->theme->display_message($msg);
|
exit;
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$this->theme->display_notification($page);
|
|
||||||
}
|
}
|
||||||
|
$this->theme->display_notification($page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user