mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-11 23:01:41 +09:00
issue 2119. supporting php 5.4. admin module.
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12711 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
fa75bf0981
commit
3df6b3ecd7
4 changed files with 543 additions and 374 deletions
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* adminAdminController class
|
||||
* admin controller class of admin module
|
||||
|
|
@ -8,6 +9,7 @@
|
|||
*/
|
||||
class adminAdminController extends admin
|
||||
{
|
||||
|
||||
/**
|
||||
* initialization
|
||||
* @return void
|
||||
|
|
@ -15,9 +17,12 @@ class adminAdminController extends admin
|
|||
function init()
|
||||
{
|
||||
// forbit access if the user is not an administrator
|
||||
$oMemberModel = &getModel('member');
|
||||
$oMemberModel = getModel('member');
|
||||
$logged_info = $oMemberModel->getLoggedInfo();
|
||||
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
return $this->stop("msg_is_not_administrator");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -27,11 +32,17 @@ class adminAdminController extends admin
|
|||
function procAdminMenuReset()
|
||||
{
|
||||
$menuSrl = Context::get('menu_srl');
|
||||
if (!$menuSrl) return $this->stop('msg_invalid_request');
|
||||
if(!$menuSrl)
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$oMenuAdminController = getAdminController('menu');
|
||||
$output = $oMenuAdminController->deleteMenu($menuSrl);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
FileHandler::removeDir('./files/cache/menu/admin_lang/');
|
||||
|
||||
|
|
@ -45,30 +56,33 @@ class adminAdminController extends admin
|
|||
function procAdminRecompileCacheFile()
|
||||
{
|
||||
// rename cache dir
|
||||
$temp_cache_dir = './files/cache_'. time();
|
||||
$temp_cache_dir = './files/cache_' . time();
|
||||
FileHandler::rename('./files/cache', $temp_cache_dir);
|
||||
FileHandler::makeDir('./files/cache');
|
||||
|
||||
// remove debug files
|
||||
FileHandler::removeFile(_XE_PATH_.'files/_debug_message.php');
|
||||
FileHandler::removeFile(_XE_PATH_.'files/_debug_db_query.php');
|
||||
FileHandler::removeFile(_XE_PATH_.'files/_db_slow_query.php');
|
||||
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
|
||||
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
|
||||
FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$module_list = $oModuleModel->getModuleList();
|
||||
|
||||
// call recompileCache for each module
|
||||
foreach($module_list as $module)
|
||||
{
|
||||
$oModule = null;
|
||||
$oModule = &getClass($module->module);
|
||||
if(method_exists($oModule, 'recompileCache')) $oModule->recompileCache();
|
||||
$oModule = NULL;
|
||||
$oModule = getClass($module->module);
|
||||
if(method_exists($oModule, 'recompileCache'))
|
||||
{
|
||||
$oModule->recompileCache();
|
||||
}
|
||||
}
|
||||
|
||||
// remove cache
|
||||
$truncated = array();
|
||||
$oObjectCacheHandler = &CacheHandler::getInstance('object');
|
||||
$oTemplateCacheHandler = &CacheHandler::getInstance('template');
|
||||
$oObjectCacheHandler = CacheHandler::getInstance('object');
|
||||
$oTemplateCacheHandler = CacheHandler::getInstance('template');
|
||||
|
||||
if($oObjectCacheHandler->isSupport())
|
||||
{
|
||||
|
|
@ -80,26 +94,29 @@ class adminAdminController extends admin
|
|||
$truncated[] = $oTemplateCacheHandler->truncate();
|
||||
}
|
||||
|
||||
if(count($truncated) && in_array(false,$truncated))
|
||||
if(count($truncated) && in_array(FALSE, $truncated))
|
||||
{
|
||||
return new Object(-1,'msg_self_restart_cache_engine');
|
||||
return new Object(-1, 'msg_self_restart_cache_engine');
|
||||
}
|
||||
|
||||
// remove cache dir
|
||||
$tmp_cache_list = FileHandler::readDir('./files','/(^cache_[0-9]+)/');
|
||||
$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
|
||||
if($tmp_cache_list)
|
||||
{
|
||||
foreach($tmp_cache_list as $tmp_dir)
|
||||
{
|
||||
if($tmp_dir) FileHandler::removeDir('./files/'.$tmp_dir);
|
||||
if($tmp_dir)
|
||||
{
|
||||
FileHandler::removeDir('./files/' . $tmp_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove duplicate indexes (only for CUBRID)
|
||||
$db_type = &Context::getDBType();
|
||||
$db_type = Context::getDBType();
|
||||
if($db_type == 'cubrid')
|
||||
{
|
||||
$db = &DB::getInstance();
|
||||
$db = DB::getInstance();
|
||||
$db->deleteDuplicateIndexes();
|
||||
}
|
||||
$this->setMessage('success_updated');
|
||||
|
|
@ -111,13 +128,12 @@ class adminAdminController extends admin
|
|||
*/
|
||||
function procAdminLogout()
|
||||
{
|
||||
$oMemberController = &getController('member');
|
||||
$oMemberController = getController('member');
|
||||
$oMemberController->procMemberLogout();
|
||||
|
||||
header('Location: '.getNotEncodedUrl('', 'module','admin'));
|
||||
header('Location: ' . getNotEncodedUrl('', 'module', 'admin'));
|
||||
}
|
||||
|
||||
|
||||
public function procAdminInsertDefaultDesignInfo()
|
||||
{
|
||||
$vars = Context::getRequestVars();
|
||||
|
|
@ -133,7 +149,7 @@ class adminAdminController extends admin
|
|||
|
||||
public function updateDefaultDesignInfo($vars)
|
||||
{
|
||||
$siteDesignPath = _XE_PATH_.'files/site_design/';
|
||||
$siteDesignPath = _XE_PATH_ . 'files/site_design/';
|
||||
|
||||
$vars->module_skin = json_decode($vars->module_skin);
|
||||
|
||||
|
|
@ -142,7 +158,7 @@ class adminAdminController extends admin
|
|||
FileHandler::makeDir($siteDesignPath);
|
||||
}
|
||||
|
||||
$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$vars->site_srl.'.php';
|
||||
$siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $vars->site_srl . '.php';
|
||||
|
||||
$layoutTarget = 'layout_srl';
|
||||
$skinTarget = 'skin';
|
||||
|
|
@ -182,28 +198,28 @@ class adminAdminController extends admin
|
|||
{
|
||||
if($designInfo->layout_srl)
|
||||
{
|
||||
$buff .= sprintf('$designInfo->layout_srl = %s; ', $designInfo->layout_srl)."\n";
|
||||
$buff .= sprintf('$designInfo->layout_srl = %s; ', $designInfo->layout_srl) . "\n";
|
||||
}
|
||||
|
||||
if($designInfo->mlayout_srl)
|
||||
{
|
||||
$buff .= sprintf('$designInfo->mlayout_srl = %s;', $designInfo->mlayout_srl)."\n";
|
||||
$buff .= sprintf('$designInfo->mlayout_srl = %s;', $designInfo->mlayout_srl) . "\n";
|
||||
}
|
||||
|
||||
$buff .= '$designInfo->module = new stdClass();'."\n";
|
||||
$buff .= '$designInfo->module = new stdClass();' . "\n";
|
||||
|
||||
foreach($designInfo->module as $moduleName => $skinInfo)
|
||||
{
|
||||
$buff .= sprintf('$designInfo->module->%s = new stdClass();', $moduleName)."\n";
|
||||
$buff .= sprintf('$designInfo->module->%s = new stdClass();', $moduleName) . "\n";
|
||||
foreach($skinInfo as $target => $skinName)
|
||||
{
|
||||
$buff .= sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName)."\n";
|
||||
$buff .= sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit();' . "\n" . 'if(!defined("__XE__")) exit();' ."\n" . '$designInfo = new stdClass();' . "\n" . '%s ?>', $buff);
|
||||
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit();' . "\n" . 'if(!defined("__XE__")) exit();' . "\n" . '$designInfo = new stdClass();' . "\n" . '%s ?>', $buff);
|
||||
|
||||
$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$site_srl.'.php';
|
||||
$siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $site_srl . '.php';
|
||||
FileHandler::writeFile($siteDesignFile, $buff);
|
||||
}
|
||||
|
||||
|
|
@ -217,9 +233,12 @@ class adminAdminController extends admin
|
|||
$moduleName = Context::get('module_name');
|
||||
|
||||
// check favorite exists
|
||||
$oModel = &getAdminModel('admin');
|
||||
$oModel = getAdminModel('admin');
|
||||
$output = $oModel->isExistsFavorite($siteSrl, $moduleName);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
// if exists, delete favorite
|
||||
if($output->get('result'))
|
||||
|
|
@ -235,7 +254,10 @@ class adminAdminController extends admin
|
|||
$result = 'on';
|
||||
}
|
||||
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->add('result', $result);
|
||||
|
||||
|
|
@ -280,6 +302,7 @@ class adminAdminController extends admin
|
|||
return new Object();
|
||||
}
|
||||
|
||||
$args = new stdClass();
|
||||
$args->admin_favorite_srls = $deleteTargets;
|
||||
$output = executeQuery('admin.deleteFavorites', $args);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -297,10 +320,16 @@ class adminAdminController extends admin
|
|||
function procAdminEnviromentGatheringAgreement()
|
||||
{
|
||||
$isAgree = Context::get('is_agree');
|
||||
if($isAgree == 'true') $_SESSION['enviroment_gather'] = 'Y';
|
||||
else $_SESSION['enviroment_gather'] = 'N';
|
||||
if($isAgree == 'true')
|
||||
{
|
||||
$_SESSION['enviroment_gather'] = 'Y';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SESSION['enviroment_gather'] = 'N';
|
||||
}
|
||||
|
||||
$redirectUrl = getUrl('', 'module', 'admin');
|
||||
$redirectUrl = getNotEncodedUrl('', 'module', 'admin');
|
||||
$this->setRedirectUrl($redirectUrl);
|
||||
}
|
||||
|
||||
|
|
@ -313,9 +342,14 @@ class adminAdminController extends admin
|
|||
$adminTitle = Context::get('adminTitle');
|
||||
$file = $_FILES['adminLogo'];
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$oAdminConfig = $oModuleModel->getModuleConfig('admin');
|
||||
|
||||
if(!is_object($oAdminConfig))
|
||||
{
|
||||
$oAdminConfig = new stdClass();
|
||||
}
|
||||
|
||||
if($file['tmp_name'])
|
||||
{
|
||||
$target_path = 'files/attach/images/admin/';
|
||||
|
|
@ -323,21 +357,36 @@ class adminAdminController extends admin
|
|||
|
||||
// Get file information
|
||||
list($width, $height, $type, $attrs) = @getimagesize($file['tmp_name']);
|
||||
if($type == 3) $ext = 'png';
|
||||
elseif($type == 2) $ext = 'jpg';
|
||||
else $ext = 'gif';
|
||||
if($type == 3)
|
||||
{
|
||||
$ext = 'png';
|
||||
}
|
||||
elseif($type == 2)
|
||||
{
|
||||
$ext = 'jpg';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ext = 'gif';
|
||||
}
|
||||
|
||||
$target_filename = sprintf('%s%s.%s.%s', $target_path, 'adminLogo', date('YmdHis'), $ext);
|
||||
@move_uploaded_file($file['tmp_name'], $target_filename);
|
||||
|
||||
$oAdminConfig->adminLogo = $target_filename;
|
||||
}
|
||||
if($adminTitle) $oAdminConfig->adminTitle = strip_tags($adminTitle);
|
||||
else unset($oAdminConfig->adminTitle);
|
||||
if($adminTitle)
|
||||
{
|
||||
$oAdminConfig->adminTitle = strip_tags($adminTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($oAdminConfig->adminTitle);
|
||||
}
|
||||
|
||||
if($oAdminConfig)
|
||||
{
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController = getController('module');
|
||||
$oModuleController->insertModuleConfig('admin', $oAdminConfig);
|
||||
}
|
||||
|
||||
|
|
@ -353,13 +402,13 @@ class adminAdminController extends admin
|
|||
*/
|
||||
function procAdminDeleteLogo()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$oAdminConfig = $oModuleModel->getModuleConfig('admin');
|
||||
|
||||
FileHandler::removeFile(_XE_PATH_.$oAdminConfig->adminLogo);
|
||||
FileHandler::removeFile(_XE_PATH_ . $oAdminConfig->adminLogo);
|
||||
unset($oAdminConfig->adminLogo);
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController = getController('module');
|
||||
$oModuleController->insertModuleConfig('admin', $oAdminConfig);
|
||||
|
||||
$this->setMessage('success_deleted', 'info');
|
||||
|
|
@ -401,7 +450,7 @@ class adminAdminController extends admin
|
|||
*/
|
||||
function _deleteAllFavorite()
|
||||
{
|
||||
$args = null;
|
||||
$args = NULL;
|
||||
$output = executeQuery('admin.deleteAllFavorite', $args);
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -410,19 +459,21 @@ class adminAdminController extends admin
|
|||
* Remove admin icon
|
||||
* @return object|void
|
||||
*/
|
||||
function procAdminRemoveIcons(){
|
||||
function procAdminRemoveIcons()
|
||||
{
|
||||
$iconname = Context::get('iconname');
|
||||
$file_exist = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$iconname);
|
||||
$file_exist = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $iconname);
|
||||
if($file_exist)
|
||||
{
|
||||
@FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$iconname);
|
||||
@FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $iconname);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Object(-1,'fail_to_delete');
|
||||
return new Object(-1, 'fail_to_delete');
|
||||
}
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file admin.admin.controller.php */
|
||||
/* Location: ./modules/admin/admin.admin.controller.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue