1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Maintenance flag - LAN and code cleanup (#6, #125)

This commit is contained in:
Moc
2013-03-10 15:21:32 +01:00
parent 7ecf2ddbef
commit 94a4c1e1d2
2 changed files with 24 additions and 47 deletions

View File

@@ -2,17 +2,12 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2009 e107 Inc (e107.org) * Copyright (C) 2008-2024 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/ugflag.php,v $
* $Revision$
* $Date$
* $Author$
*
*/ */
require_once ('../class2.php'); require_once ('../class2.php');
if(!getperms('9')) if(!getperms('9'))
@@ -25,12 +20,8 @@ $e_sub_cat = 'maintain';
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
require_once (e_HANDLER.'form_handler.php'); $mes = e107::getMessage();
require_once (e_HANDLER.'message_handler.php'); $frm = e107::getForm();
$emessage = eMessage::getInstance();
$emessage_method = e_AJAX_REQUEST ? 'add' : 'addSession';
$frm = new e_form(true);
if(isset($_POST['updatesettings'])) if(isset($_POST['updatesettings']))
{ {
@@ -59,10 +50,13 @@ if(isset($_POST['updatesettings']))
{ {
$admin_log->log_event(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, ''); $admin_log->log_event(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, '');
save_prefs(); save_prefs();
$emessage->$emessage_method(UGFLAN_1, E_MESSAGE_SUCCESS); $mes->addSuccess(UGFLAN_1);
} }
else else
$emessage->$emessage_method(UGFLAN_7); {
$mes->addInfo(LAN_NO_CHANGE);
}
if(!e_AJAX_REQUEST) if(!e_AJAX_REQUEST)
{ {
@@ -71,7 +65,7 @@ if(isset($_POST['updatesettings']))
} }
} }
require_once ("auth.php"); require_once("auth.php");
$text = " $text = "
<form method='post' action='".e_SELF."' id='core-ugflag-form'> <form method='post' action='".e_SELF."' id='core-ugflag-form'>
@@ -91,26 +85,19 @@ $elements = array(e_UC_PUBLIC=>LAN_DISABLED,
$text .= " $text .= "
<tr> <tr>
<td>".UGFLAN_2.": </td> <td>".UGFLAN_2.": </td>
<td> <td>".$frm->radio_multi('maintainance_flag', $elements, $pref['maintainance_flag'], TRUE)."</td>
".$frm->radio_multi('maintainance_flag', $elements, $pref['maintainance_flag'], TRUE)."
</td>
</tr>"; </tr>";
//TODO multilanguage pref //TODO multilanguage pref
$text .= " $text .= "
<tr> <tr>
<td>".UGFLAN_5." <td>".UGFLAN_5."</td>
<td>".$frm->bbarea('maintainance_text', vartrue($pref['maintainance_text']), 'maintenance', 'small')."<div class='smalltext clear'>".UGFLAN_6."</div></td>
</td>
<td>
".$frm->bbarea('maintainance_text', vartrue($pref['maintainance_text']), 'maintenance', 'small')."
<div class='smalltext clear'>".UGFLAN_6."</div>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class='buttons-bar center'> <div class='buttons-bar center'>
".$frm->admin_button('updatesettings', UGFLAN_3, 'update')." ".$frm->admin_button('updatesettings', LAN_UPDATE, 'update')."
</div> </div>
</fieldset> </fieldset>
</form> </form>
@@ -121,13 +108,13 @@ $text .= "
if(!e_AJAX_REQUEST) if(!e_AJAX_REQUEST)
{ {
echo "<div id='ajax-container'>\n"; echo "<div id='ajax-container'>\n";
$e107->ns->tablerender(UGFLAN_4, $emessage->render().$text, 'core-ugflag'); $ns->tablerender(UGFLAN_4, $mes->render().$text, 'core-ugflag');
echo "\n</div>"; echo "\n</div>";
require_once (e_ADMIN."footer.php"); require_once (e_ADMIN."footer.php");
exit(); exit();
} }
$e107->ns->tablerender(UGFLAN_4, $emessage->render().$text, 'core-ugflag'); $ns->tablerender(UGFLAN_4, $mes->render().$text, 'core-ugflag');
/** /**
* Handle page DOM within the page header * Handle page DOM within the page header
@@ -163,4 +150,4 @@ function headerjs()
return $ret; return $ret;
} }
?> ?>

View File

@@ -1,28 +1,18 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
| e107 website system *
| * Maintenance flag - language file
| Copyright (C) 2008-2009 e107 Inc *
| http://e107.org
|
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_ugflag.php,v $
| $Revision$
| $Date$
| $Author$
+----------------------------------------------------------------------------+
*/ */
define('UGFLAN_1', 'Maintenance settings updated');
//define('UGFLAN_1', 'Maintenance settings updated');
define('UGFLAN_2', 'Activate maintenance flag'); define('UGFLAN_2', 'Activate maintenance flag');
define('UGFLAN_3', 'Update Maintenance Setting'); //define('UGFLAN_3', 'Update Maintenance Setting');
define('UGFLAN_4', 'Maintenance Setting'); define('UGFLAN_4', 'Maintenance Setting');
define('UGFLAN_5', 'Text to display when site down'); define('UGFLAN_5', 'Text to display when site down');
define('UGFLAN_6', 'Leave blank to display default message'); define('UGFLAN_6', 'Leave blank to display default message');
define('UGFLAN_7', 'Update unsuccessful as no changes were made.'); //define('UGFLAN_7', 'Update unsuccessful as no changes were made.');
define('UGFLAN_8', 'Limit access to Admins only'); define('UGFLAN_8', 'Limit access to Admins only');
define('UGFLAN_9', 'Limit access to Main-Admins only'); define('UGFLAN_9', 'Limit access to Main-Admins only');