2015-08-07 23:33:43 +02:00
|
|
|
<?php
|
|
|
|
|
2016-02-20 17:16:31 +01:00
|
|
|
class pluginMaintenanceMode extends Plugin {
|
2015-08-07 23:33:43 +02:00
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->dbFields = array(
|
2016-06-05 03:31:07 +02:00
|
|
|
'enable'=>0,
|
2015-08-07 23:33:43 +02:00
|
|
|
'message'=>'Temporarily down for maintenance.'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function form()
|
|
|
|
{
|
|
|
|
$html = '<div>';
|
2016-06-05 03:31:07 +02:00
|
|
|
$html .= '<input type="hidden" name="enable" value="0">';
|
|
|
|
$html .= '<input name="enable" id="jsenable" type="checkbox" value="1" '.($this->getDbField('enable')?'checked':'').'>';
|
2016-11-07 20:58:47 +01:00
|
|
|
$html .= '<label class="forCheckbox" for="jsenable">'.$this->L('Enable maintenance mode').'</label>';
|
2015-08-07 23:33:43 +02:00
|
|
|
$html .= '</div>';
|
|
|
|
|
|
|
|
$html .= '<div>';
|
2016-11-07 20:58:47 +01:00
|
|
|
$html .= '<label>'.$this->L('Message').'</label>';
|
2015-08-07 23:33:43 +02:00
|
|
|
$html .= '<input name="message" id="jsmessage" type="text" value="'.$this->getDbField('message').'">';
|
|
|
|
$html .= '</div>';
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function beforeSiteLoad()
|
|
|
|
{
|
|
|
|
if($this->getDbField('enable')) {
|
|
|
|
exit( $this->getDbField('message') );
|
|
|
|
}
|
|
|
|
}
|
2016-02-26 16:32:18 +01:00
|
|
|
}
|