Archived
init maintenance mode (#467)
This commit is contained in:
@@ -8,6 +8,18 @@ include S9Y_INCLUDE_PATH . 'include/admin/import.inc.php';
|
||||
$data['importMenu'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if ($_POST['adminAction'] == "maintenanceMode") {
|
||||
if (serendipity_db_bool(serendipity_get_config_var("maintenanceMode", false)) === true) {
|
||||
serendipity_set_config_var("maintenanceMode", false);
|
||||
} else {
|
||||
serendipity_set_config_var("maintenanceMode", true);
|
||||
# after the specified time, given in hours from now, we want the maintenance mode to not be active anymore.
|
||||
# This prevents users from logging themselves out.
|
||||
$activeTill = time() + ($_POST['hours'] * 3600);
|
||||
serendipity_set_config_var("maintenanceModeEnd", $activeTill);
|
||||
}
|
||||
}
|
||||
|
||||
switch($serendipity['GET']['adminAction']) {
|
||||
case 'integrity':
|
||||
$data['action'] = "integrity";
|
||||
@@ -32,6 +44,9 @@ switch($serendipity['GET']['adminAction']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$data['maintenance_mode'] = serendipity_db_bool(serendipity_get_config_var("maintenanceMode", false));
|
||||
$data['maintenance_mode_end'] = strftime('%d.%m.%y %T', serendipity_get_config_var("maintenanceModeEnd"));
|
||||
$data['maintenance_mode_active'] = $data['maintenance_mode'] && time() < serendipity_get_config_var("maintenanceModeEnd", 0);
|
||||
echo serendipity_smarty_show('admin/maintenance.inc.tpl', $data);
|
||||
|
||||
/* vim: set sts=4 ts=4 expandtab : */
|
||||
|
||||
Reference in New Issue
Block a user