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(
|
2018-07-02 00:24:53 +02:00
|
|
|
'enable'=>false,
|
2015-08-07 23:33:43 +02:00
|
|
|
'message'=>'Temporarily down for maintenance.'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function form()
|
|
|
|
{
|
2018-08-05 17:54:20 +02:00
|
|
|
global $L;
|
2015-08-07 23:33:43 +02:00
|
|
|
|
2018-07-02 00:24:53 +02:00
|
|
|
$html = '<div class="alert alert-primary" role="alert">';
|
|
|
|
$html .= $this->description();
|
|
|
|
$html .= '</div>';
|
|
|
|
|
|
|
|
$html .= '<div>';
|
2018-08-05 17:54:20 +02:00
|
|
|
$html .= '<label>'.$L->get('Enable maintenance mode').'</label>';
|
2017-08-05 13:50:06 +02:00
|
|
|
$html .= '<select name="enable">';
|
|
|
|
$html .= '<option value="true" '.($this->getValue('enable')===true?'selected':'').'>Enabled</option>';
|
|
|
|
$html .= '<option value="false" '.($this->getValue('enable')===false?'selected':'').'>Disabled</option>';
|
|
|
|
$html .= '</select>';
|
2015-08-07 23:33:43 +02:00
|
|
|
$html .= '</div>';
|
|
|
|
|
|
|
|
$html .= '<div>';
|
2018-08-05 17:54:20 +02:00
|
|
|
$html .= '<label>'.$L->get('Message').'</label>';
|
2018-08-02 22:33:53 +02:00
|
|
|
$html .= '<input name="message" id="jsmessage" type="text" value="'.$this->getValue('message').'">';
|
2015-08-07 23:33:43 +02:00
|
|
|
$html .= '</div>';
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
2017-08-05 13:50:06 +02:00
|
|
|
public function beforeAll()
|
2015-08-07 23:33:43 +02:00
|
|
|
{
|
2018-08-02 22:33:53 +02:00
|
|
|
if ($this->getValue('enable')) {
|
|
|
|
exit( $this->getValue('message') );
|
2015-08-07 23:33:43 +02:00
|
|
|
}
|
|
|
|
}
|
2016-02-26 16:32:18 +01:00
|
|
|
}
|