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

147 lines
3.9 KiB
PHP
Raw Normal View History

2006-12-02 04:36:16 +00:00
<?php
/*
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Cache Administration Area
*
* $URL$
* $Id$
*
2006-12-02 04:36:16 +00:00
*/
require_once("../class2.php");
if (!getperms("C"))
2008-11-02 11:04:34 +00:00
{
2006-12-02 04:36:16 +00:00
header("location:".e_BASE."index.php");
exit;
}
2009-08-28 16:11:02 +00:00
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
2006-12-02 04:36:16 +00:00
$e_sub_cat = 'cache';
2006-12-02 04:36:16 +00:00
require_once("auth.php");
require_once(e_HANDLER."cache_handler.php");
require_once(e_HANDLER."form_handler.php");
require_once(e_HANDLER."message_handler.php");
2006-12-02 04:36:16 +00:00
$ec = new ecache;
$frm = new e_form();
2010-03-09 13:33:51 +00:00
$emessage = eMessage::getInstance();
if ($pref['cachestatus'] == '2')
2008-11-02 11:04:34 +00:00
{
2006-12-02 04:36:16 +00:00
$pref['cachestatus'] = '1';
save_prefs();
2006-12-02 04:36:16 +00:00
}
2010-03-09 13:33:51 +00:00
if(!is_writable(e_CACHE_CONTENT))
{
$ns->tablerender(CACLAN_3, CACLAN_10."<br />(".$CACHE_DIRECTORY.")");
require_once("footer.php");
exit;
}
if (isset($_POST['submit_cache']))
{
if ($pref['cachestatus'] != $_POST['cachestatus'] || $pref['syscachestatus'] != $_POST['syscachestatus'])
{
$pref['cachestatus'] = $_POST['cachestatus'] ? '1' : '0';
$pref['syscachestatus'] = $_POST['syscachestatus'] ? '1' : '0';
2006-12-02 04:36:16 +00:00
save_prefs();
$admin_log->log_event('CACHE_01', $pref['syscachestatus'].', '.$pref['cachestatus'], E_LOG_INFORMATIVE,'');
2006-12-02 04:36:16 +00:00
$ec->clear();
$ec->clear_sys();
$emessage->add(CACLAN_4, E_MESSAGE_SUCCESS);
}
else
{
$emessage->add(LAN_NO_CHANGE, E_MESSAGE_INFO);
2006-12-02 04:36:16 +00:00
}
}
if (isset($_POST['empty_syscache']))
2008-11-02 11:04:34 +00:00
{
$ec->clear_sys();
$admin_log->log_event('CACHE_02', $pref['syscachestatus'].', '.$pref['cachestatus'], E_LOG_INFORMATIVE, '');
$emessage->add(CACLAN_15, E_MESSAGE_SUCCESS);
}
if (isset($_POST['empty_cache']))
2008-11-02 11:04:34 +00:00
{
2006-12-02 04:36:16 +00:00
$ec->clear();
$admin_log->log_event('CACHE_03', $pref['syscachestatus'].', '.$pref['cachestatus'], E_LOG_INFORMATIVE, '');
$emessage->add(CACLAN_6, E_MESSAGE_SUCCESS);
2006-12-02 04:36:16 +00:00
}
2008-11-02 11:04:34 +00:00
2010-03-09 13:33:51 +00:00
$syscache_files = glob(e_CACHE_CONTENT."S_*.*");
$cache_files = glob(e_CACHE_CONTENT."C_*.*");
$syscache_files_num = count($syscache_files);
$cache_files_num = count($cache_files);
$sys_count = CACLAN_17." ".$syscache_files_num." ".($syscache_files_num != 1 ? CACLAN_19 : CACLAN_18);
$nonsys_count = CACLAN_17." ".$cache_files_num." ".($cache_files_num != 1 ? CACLAN_19 : CACLAN_18);
$text = "
2006-12-02 04:36:16 +00:00
<form method='post' action='".e_SELF."'>
<fieldset id='core-cache-settings'>
<legend class='e-hideme'>".CACLAN_3."</legend>
<table cellpadding='0' cellspacing='0' class='adminlist'>
<colgroup span='2'>
<col style='width:80%' />
<col style='width:20%' />
</colgroup>
<thead>
<tr>
<th><!-- --></th>
<th class='center last'>".CACLAN_1."</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>".CACLAN_11."</strong>: {$nonsys_count}
2009-07-21 07:13:42 +00:00
<div class='field-help'>".CACLAN_13."</div>
</td>
<td class='center middle'>
".$frm->radio('cachestatus', 1, ($pref['cachestatus']))."
".$frm->label(LAN_ENABLED, 'cachestatus', 1)."&nbsp;&nbsp;
".$frm->radio('cachestatus', 0, (!$pref['cachestatus']))."
".$frm->label(LAN_DISABLED, 'cachestatus', 0)."
</td>
</tr>
<tr>
<td>
<strong>".CACLAN_12."</strong>: {$sys_count}
2009-07-21 07:13:42 +00:00
<div class='field-help'>".CACLAN_14."</div>
</td>
<td class='center middle'>
".$frm->radio('syscachestatus', 1, ($pref['syscachestatus']))."
".$frm->label(LAN_ENABLED, 'syscachestatus', 1)."&nbsp;&nbsp;
".$frm->radio('syscachestatus', 0, (!$pref['syscachestatus']))."
".$frm->label(LAN_DISABLED, 'syscachestatus', 0)."
</td>
</tr>
</tbody>
</table>
<div class='buttons-bar left'>
".$frm->admin_button('submit_cache', CACLAN_2, 'update f-right')."
".$frm->admin_button('empty_cache', CACLAN_5, 'delete')."
".$frm->admin_button('empty_syscache', CACLAN_16, 'delete')."
</div>
</fieldset>
</form>";
$ns->tablerender(CACLAN_3, $emessage->render().$text);
2006-12-02 04:36:16 +00:00
require_once("footer.php");
?>