1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

New feature: Option to allow main admins to lock-out regular admins during maintenance mode.

This commit is contained in:
CaMer0n 2009-09-27 21:18:42 +00:00
parent 76cb45c0ff
commit 75dd9c7f9b
3 changed files with 66 additions and 18 deletions

View File

@ -9,9 +9,9 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_admin/ugflag.php,v $
* $Revision: 1.4 $
* $Date: 2009-08-28 16:11:00 $
* $Author: marj_nl_fr $
* $Revision: 1.5 $
* $Date: 2009-09-27 21:18:37 $
* $Author: e107coders $
*
*/
require_once("../class2.php");
@ -25,7 +25,7 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
require_once(e_HANDLER."form_handler.php");
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$emessage = eMessage::getInstance();
$emessage_method = e_AJAX_REQUEST ? 'add' : 'addSession';
$frm = new e_form(true);
@ -45,6 +45,14 @@ if (isset($_POST['updatesettings']))
$pref['maintainance_text'] = $temp;
$changed = TRUE;
}
$temp = intval($_POST['main_admin_only']);
if(getperms('0') && $pref['main_admin_only'] != $temp)
{
$pref['main_admin_only'] = $temp;
$changed = TRUE;
}
if ($changed)
{
$admin_log->log_event(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01',$pref['maintainance_text'],E_LOG_INFORMATIVE,'');
@ -79,13 +87,31 @@ $text = "
".$frm->checkbox('maintainance_flag', '1', $pref['maintainance_flag'])."
</div>
</td>
</tr>
</tr>";
if(getperms('0'))
{
$text .= "<tr>
<td class='label'>".UGFLAN_8.":
</td>
<td class='control'>
<div class='auto-toggle-area autocheck'>
".$frm->checkbox('main_admin_only', '1', $pref['main_admin_only'])."
</div>
<div class='field-help'>".UGFLAN_9."</div>
</td>
</tr>";
}
$text .= "
<tr>
<td class='label'>".UGFLAN_5."
<div class='field-help'>".UGFLAN_6."</div>
</td>
<td class='control'>
".$frm->bbarea('maintainance_text', $pref['maintainance_text'], 'maintenance', 'maintenance_bbhelp')."
<div class='field-help'>".UGFLAN_6."</div>
</td>
</tr>
</tbody>

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/redirection_class.php,v $
| $Revision: 1.1 $
| $Date: 2009-08-20 13:54:42 $
| $Revision: 1.2 $
| $Date: 2009-09-27 21:18:37 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@ -33,19 +33,39 @@ class redirection
$this->page_exceptions = array('e_ajax.php', 'e_js.php', 'e_jslib.php', 'sitedown.php');
}
/**
* Perform re-direction when Maintenance Mode is active.
* @return
*/
public function checkMaintenance()
{
if(ADMIN == TRUE)
{
if(strpos(e_SELF, 'sitedown.php') !== FALSE) // prevent looping.
{
return;
}
if (!e107::getPref('maintainance_flag') || (strpos(e_SELF, 'admin.php') !== FALSE) || (strpos(e_SELF, 'sitedown.php') !== FALSE))
{
if(e107::getPref('maintainance_flag'))
{
if(e107::getPref('main_admin_only')==1 && ADMIN==TRUE && !getperms('0'))
{
$this->redirect(SITEURL.'sitedown.php?logout');
}
if((strpos(e_SELF, 'admin.php') !== FALSE) || (ADMIN == TRUE))
{
return;
}
$this->redirect(SITEURL.'sitedown.php');
}
$this->redirect(SITEURL.'sitedown.php');
}
else
{
return;
}
}
/** check if user is logged in.
*
*/

View File

@ -4,9 +4,9 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_ugflag.php,v $
| $Revision: 1.2 $
| $Date: 2009-01-07 15:40:06 $
| $Author: secretr $
| $Revision: 1.3 $
| $Date: 2009-09-27 21:18:42 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
define("UGFLAN_1", "Maintenance settings updated");
@ -17,4 +17,6 @@ define("UGFLAN_4", "Maintenance Setting");
define("UGFLAN_5", "Text to display when site down");
define("UGFLAN_6", "Leave blank to display default message");
define("UGFLAN_7","Update unsuccessful as no changes were made.");
define("UGFLAN_8","Limit access to Main-Admins only");
define("UGFLAN_9","Only Main-Admins will be able to login while the maintenance mode is active.");
?>