1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00
php-e107/e107_admin/ugflag.php

158 lines
3.3 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) 2008-2024 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
*
2009-10-28 16:57:51 +00:00
*/
require_once (__DIR__.'/../class2.php');
if(!getperms('9'))
2008-11-01 23:01:11 +00:00
{
e107::redirect('admin');
2009-10-28 16:57:51 +00:00
exit();
2006-12-02 04:36:16 +00:00
}
$e_sub_cat = 'maintain';
e107::coreLan('ugflag', true);
2009-08-28 16:11:02 +00:00
$mes = e107::getMessage();
$frm = e107::getForm();
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
{
2014-10-23 11:12:13 -07:00
e107::getLog()->add(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, '');
2008-11-01 23:01:11 +00:00
save_prefs();
// $mes->addSuccess(UGFLAN_1);
2008-11-01 23:01:11 +00:00
}
2009-10-28 16:57:51 +00:00
else
{
$mes->addInfo(LAN_NO_CHANGE);
}
$pref = e107::getConfig('core', true, true)->getPref();
2009-10-28 16:57:51 +00:00
2020-12-18 19:55:12 -08:00
2006-12-02 04:36:16 +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>
2012-11-26 14:41:32 -08:00
<table class='table adminform'>
2012-05-13 05:50:32 +00:00
<colgroup>
<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_MEMBER => ADLAN_110,
e_UC_ADMIN => UGFLAN_8,
e_UC_MAINADMIN => UGFLAN_9
);
2009-10-28 16:57:51 +00:00
$text .= "
<tr>
2012-11-26 14:41:32 -08:00
<td>".UGFLAN_2.": </td>
<td>".$frm->radio('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>".UGFLAN_5."</td>
<td>".$frm->bbarea('maintainance_text', vartrue($pref['maintainance_text']), 'maintenance', '_common', 'small')."<div class='smalltext clear'>".UGFLAN_6."</div></td>
</tr>
</tbody>
</table>
<div class='buttons-bar center'>
".$frm->admin_button('updatesettings', LAN_UPDATE, '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)
{
$ns->tablerender(UGFLAN_4, $mes->render().$text, 'core-ugflag');
exit;
2006-12-02 04:36:16 +00:00
}
echo "<div id='ajax-container'>\n";
$ns->tablerender(UGFLAN_4, $mes->render().$text, 'core-ugflag');
echo "\n</div>";
require_once (e_ADMIN."footer.php");
2006-12-02 04:36:16 +00:00
/**
* Handle page DOM within the page header
*
* @return string JS source
*/
2016-03-14 19:28:13 -07:00
/*
function headerjs()
{
$ret = "
<script>
//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 src='".e_JS."core/admin.js'></script>
";
2009-10-28 16:57:51 +00:00
return $ret;
}
2016-03-14 19:28:13 -07:00
*/