1
0
mirror of https://github.com/e107inc/e107.git synced 2025-02-06 23:39:11 +01:00
php-e107/e107_admin/ugflag.php

165 lines
3.8 KiB
PHP
Raw Normal View History

2009-10-28 16:57:51 +00:00
<?php
2006-12-02 04:36:16 +00:00
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_admin/ugflag.php,v $
2009-10-28 20:26:04 +00:00
* $Revision: 1.7 $
* $Date: 2009-10-28 20:26:04 $
2009-10-28 16:57:51 +00:00
* $Author: marj_nl_fr $
*
2009-10-28 16:57:51 +00:00
*/
require_once ("../class2.php");
if(!getperms("9"))
2008-11-01 23:01:11 +00:00
{
2006-12-02 04:36:16 +00:00
header("location:".e_BASE."index.php");
2009-10-28 16:57:51 +00:00
exit();
2006-12-02 04:36:16 +00:00
}
2009-08-28 16:11:02 +00:00
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
2009-10-28 16:57:51 +00:00
require_once (e_HANDLER."form_handler.php");
require_once (e_HANDLER."message_handler.php");
$emessage = eMessage::getInstance();
$emessage_method = e_AJAX_REQUEST ? 'add' : 'addSession';
2006-12-02 04:36:16 +00:00
$frm = new e_form(true);
2009-10-28 16:57:51 +00:00
if(isset($_POST['updatesettings']))
2008-11-01 23:01:11 +00:00
{
$changed = FALSE;
$temp = intval($_POST['maintainance_flag']);
2009-10-28 16:57:51 +00:00
if($pref['maintainance_flag'] != $temp)
2008-11-01 23:01:11 +00:00
{
$pref['maintainance_flag'] = $temp;
$changed = TRUE;
}
$temp = $tp->toDB($_POST['maintainance_text']);
2009-10-28 16:57:51 +00:00
if($pref['maintainance_text'] != $temp)
2008-11-01 23:01:11 +00:00
{
$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;
2009-10-28 16:57:51 +00:00
$changed = TRUE;
}
2009-10-28 16:57:51 +00:00
if($changed)
2008-11-01 23:01:11 +00:00
{
2009-10-28 16:57:51 +00:00
$admin_log->log_event(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, '');
2008-11-01 23:01:11 +00:00
save_prefs();
$emessage->$emessage_method(UGFLAN_1, E_MESSAGE_SUCCESS);
2008-11-01 23:01:11 +00:00
}
2009-10-28 16:57:51 +00:00
else
$emessage->$emessage_method(UGFLAN_7);
if(!e_AJAX_REQUEST)
{
header("location:".e_SELF);
2009-10-28 16:57:51 +00:00
exit();
}
2006-12-02 04:36:16 +00:00
}
2009-10-28 16:57:51 +00:00
require_once ("auth.php");
2006-12-02 04:36:16 +00:00
$text = "
<form method='post' action='".e_SELF."' id='core-ugflag-form'>
<fieldset id='core-ugflag'>
<legend class='e-hideme'>".UGFLAN_4."</legend>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
2009-10-28 16:57:51 +00:00
<tbody>";
$elements = array(e_UC_PUBLIC=>LAN_DISABLED,
e_UC_ADMIN=>UGFLAN_8,
e_UC_MAINADMIN=>UGFLAN_9);
$text .= "
<tr>
<td class='label'>".UGFLAN_2.": </td>
<td class='control'>
2009-10-28 16:57:51 +00:00
".$frm->radio_multi('maintainance_flag', $elements, $pref['maintainance_flag'], TRUE)."
</td>
</tr>";
2009-10-28 16:57:51 +00:00
2009-10-28 20:26:04 +00:00
//TODO multilanguage pref
2009-10-28 16:57:51 +00:00
$text .= "
<tr>
<td class='label'>".UGFLAN_5."
</td>
<td class='control'>
".$frm->bbarea('maintainance_text', $pref['maintainance_text'], 'maintenance', 'maintenance_bbhelp')."
<div class='field-help'>".UGFLAN_6."</div>
</td>
</tr>
</tbody>
</table>
<div class='buttons-bar center'>
".$frm->admin_button('updatesettings', UGFLAN_3, 'update')."
</div>
</fieldset>
</form>
2006-12-02 04:36:16 +00:00
";
2006-12-02 04:36:16 +00:00
//Ajax Support
if(!e_AJAX_REQUEST)
{
echo "<div id='ajax-container'>\n";
$e107->ns->tablerender(UGFLAN_4, $emessage->render().$text, 'core-ugflag');
echo "\n</div>";
2009-10-28 16:57:51 +00:00
require_once (e_ADMIN."footer.php");
exit();
2006-12-02 04:36:16 +00:00
}
$e107->ns->tablerender(UGFLAN_4, $emessage->render().$text, 'core-ugflag');
2006-12-02 04:36:16 +00:00
/**
* Handle page DOM within the page header
*
* @return string JS source
*/
function headerjs()
{
$ret = "
<script type='text/javascript'>
//Ajax Support
var CoreUgflagAjaxPage = function(e_event) {
\$('updatesettings').observe('click', function(event) {
var form = \$('core-ugflag-form');
if(form) {
event.stop();
form.submitForm('ajax-container', { overlayPage: 'core-ugflag', parameters: { updatesettings: 1 } });
}
});
}
e107.runOnLoad(CoreUgflagAjaxPage, 'ajax-container', true);
2006-12-02 04:36:16 +00:00
//Admin JS Init Rules
var e107Admin = {}
e107Admin.initRules = {
'Helper': true,
'AdminMenu': false
}
2006-12-02 04:36:16 +00:00
</script>
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
";
2009-10-28 16:57:51 +00:00
return $ret;
}
2009-10-28 16:57:51 +00:00
?>