New Maintenance mode with IP whitelist
This commit is contained in:
parent
770184675e
commit
7e346f2011
6 changed files with 1110 additions and 1011 deletions
|
@ -95,8 +95,11 @@ if($_REQUEST['action'] == 'common')
|
|||
|
||||
if($_POST['language'] != $bm_prefs['language'])
|
||||
setcookie('bm_language', $_POST['language'], time()+TIME_ONE_YEAR);
|
||||
|
||||
// maintenance whitelist
|
||||
$dbwhitelist = explode(',', $_POST['wartung_whitelist']);
|
||||
|
||||
$db->Query('UPDATE {pre}prefs SET titel=?, b1gmta_host=?, selffolder=?, selfurl=?, mobile_url=?, search_engine=?, datafolder=?, language=?, std_land=?, datumsformat=?, ordner_proseite=?, gut_regged=?, autocancel=?, wartung=?, structstorage=?, cron_interval=?, logouturl=?, contact_history=?, ip_lock=?, cookie_lock=?, domain_combobox=?, ssl_url=?, ssl_login_option=?, ssl_login_enable=?, ssl_signup_enable=?, auto_tz=?, compress_pages=?, redirect_mobile=?, calendar_defaultviewmode=?, '
|
||||
$db->Query('UPDATE {pre}prefs SET titel=?, b1gmta_host=?, selffolder=?, selfurl=?, mobile_url=?, search_engine=?, datafolder=?, language=?, std_land=?, datumsformat=?, ordner_proseite=?, gut_regged=?, autocancel=?, wartung=?, wartung_whitelist_ips=?, structstorage=?, cron_interval=?, logouturl=?, contact_history=?, ip_lock=?, cookie_lock=?, domain_combobox=?, ssl_url=?, ssl_login_option=?, ssl_login_enable=?, ssl_signup_enable=?, auto_tz=?, compress_pages=?, redirect_mobile=?, calendar_defaultviewmode=?, '
|
||||
. 'logs_autodelete=?, logs_autodelete_days=?, logs_autodelete_archive=?, hotkeys_default=?, contactform=?, contactform_to=?, contactform_name=?, notify_interval=?, notify_lifetime=?, mail_groupmode=?',
|
||||
$_POST['titel'],
|
||||
$_POST['b1gmta_host'],
|
||||
|
@ -112,6 +115,7 @@ if($_REQUEST['action'] == 'common')
|
|||
isset($_POST['gut_regged']) ? 'yes' : 'no',
|
||||
isset($_POST['autocancel']) ? 'yes' : 'no',
|
||||
isset($_POST['wartung']) ? 'yes' : 'no',
|
||||
serialize($dbwhitelist),
|
||||
isset($_POST['structstorage']) ? 'yes' : 'no',
|
||||
$_POST['cron_interval'],
|
||||
$_POST['logouturl'],
|
||||
|
@ -145,8 +149,16 @@ if($_REQUEST['action'] == 'common')
|
|||
// get available languages
|
||||
$languages = GetAvailableLanguages();
|
||||
$countries = CountryList();
|
||||
|
||||
// maintenance whitelist
|
||||
$whitelist = NULL;
|
||||
foreach (unserialize($bm_prefs['wartung_whitelist_ips']) as $whiteip) {
|
||||
$whitelist .= $whiteip .', ';
|
||||
}
|
||||
$whitelist = rtrim($whitelist, ', ');
|
||||
|
||||
// assign
|
||||
$tpl->assign('wartungwhitelist', $whitelist);
|
||||
$tpl->assign('safemode', ini_get('safe_mode'));
|
||||
$tpl->assign('languages', $languages);
|
||||
$tpl->assign('countries', CountryList());
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="40" valign="top" rowspan="14"><img src="{$tpldir}images/ico_prefs_common.png" border="0" alt="" width="32" height="32" /></td>
|
||||
<td width="40" valign="top" rowspan="13"><img src="{$tpldir}images/ico_prefs_common.png" border="0" alt="" width="32" height="32" /></td>
|
||||
<td class="td1" width="220">{lng p="projecttitle"}:</td>
|
||||
<td class="td2"><input type="text" name="titel" value="{text allowEmpty=true value=$bm_prefs.titel}" size="36" /></td>
|
||||
</tr>
|
||||
|
@ -48,10 +48,22 @@
|
|||
<td class="td1" width="220">{lng p="compresspages"}?</td>
|
||||
<td class="td2"><input name="compress_pages"{if $bm_prefs.compress_pages=='yes'} checked="checked"{/if} type="checkbox" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{lng p="maintmode"}</legend>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="40" valign="top" rowspan="2"><img src="{$tpldir}images/ico_prefs_cmd.png" border="0" alt="" width="32" height="32" /></td>
|
||||
<td class="td1" width="220">{lng p="maintmode"}?</td>
|
||||
<td class="td2"><input name="wartung"{if $bm_prefs.wartung=='yes'} checked="checked"{/if} type="checkbox" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td1" width="220">{lng p="whitelist"}:</td>
|
||||
<td class="td2"><input type="text" name="wartung_whitelist" value="{text allowEmpty=true value=$wartungwhitelist}" size="36" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -1795,6 +1795,7 @@ $lang_admin['allow_newsletter_optout'] = 'Newsletter-Abmeldung erlauben';
|
|||
$lang_admin['gutregged'] = 'Gutscheine für reg. Benutzer';
|
||||
$lang_admin['autocancel'] = 'Mitgliedschaft selbst beendbar';
|
||||
$lang_admin['maintmode'] = 'Wartungsmodus';
|
||||
$lang_admin['whitelist'] = 'Zugangsliste';
|
||||
$lang_admin['maintmodenote'] = 'Der Wartungsmodus ist aktiv. Die b1gMail-Installation ist für Benutzer nicht erreichbar.';
|
||||
$lang_admin['dldate'] = 'Paket-Datum';
|
||||
$lang_admin['invalidserial'] = 'Die angegebene Seriennummer ist ungültig. Bitte versuchen Sie es erneut.';
|
||||
|
|
|
@ -1850,6 +1850,7 @@ $lang_admin['allow_newsletter_optout'] = 'Allow newsletter opt-out';
|
|||
$lang_admin['gutregged'] = 'Vouchers for registered users';
|
||||
$lang_admin['autocancel'] = 'Account deletable by user';
|
||||
$lang_admin['maintmode'] = 'Maintenance mode';
|
||||
$lang_admin['whitelist'] = 'Access list';
|
||||
$lang_admin['maintmodenote'] = 'Maintenance mode is enabled. The b1gMail installation is not accessible for users.';
|
||||
$lang_admin['dldate'] = 'Package date';
|
||||
$lang_admin['invalidserial'] = 'The serial number you have entered is invalid. Please try again.';
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -434,17 +434,21 @@ if (!file_exists($templateFolder)) {
|
|||
}
|
||||
$tpl = _new('Template');
|
||||
|
||||
/*
|
||||
/**
|
||||
* maintenance mode => error
|
||||
*/
|
||||
if (MAINTENANCE_MODE && INTERFACE_MODE) {
|
||||
echo 'System down for maintenance. Please try again later.';
|
||||
exit(1);
|
||||
} elseif (MAINTENANCE_MODE) {
|
||||
$tpl->assign('text', $lang_custom['maintenance']);
|
||||
$tpl->display('nli/maintenance.tpl');
|
||||
exit();
|
||||
if(MAINTENANCE_MODE && INTERFACE_MODE)
|
||||
{
|
||||
echo('System down for maintenance. Please try again later.');
|
||||
exit(1);
|
||||
}
|
||||
else if(MAINTENANCE_MODE && !in_array($_SERVER['REMOTE_ADDR'], unserialize($bm_prefs['wartung_whitelist_ips'])))
|
||||
{
|
||||
$tpl->assign('text', $lang_custom['maintenance']);
|
||||
$tpl->display('nli/maintenance.tpl');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* mobile redirect override
|
||||
|
|
Loading…
Add table
Reference in a new issue