mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
issue 2662 coding convention in modules/admin
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12235 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
376dc12c9c
commit
db5e4b2ff0
4 changed files with 1873 additions and 1808 deletions
|
|
@ -1,413 +1,425 @@
|
|||
<?php
|
||||
/**
|
||||
* adminAdminController class
|
||||
* admin controller class of admin module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/admin
|
||||
* @version 0.1
|
||||
*/
|
||||
class adminAdminController extends admin
|
||||
{
|
||||
/**
|
||||
* adminAdminController class
|
||||
* admin controller class of admin module
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/admin
|
||||
* @version 0.1
|
||||
* initialization
|
||||
* @return void
|
||||
*/
|
||||
class adminAdminController extends admin {
|
||||
/**
|
||||
* initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
// forbit access if the user is not an administrator
|
||||
$oMemberModel = &getModel('member');
|
||||
$logged_info = $oMemberModel->getLoggedInfo();
|
||||
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
|
||||
}
|
||||
function init()
|
||||
{
|
||||
// forbit access if the user is not an administrator
|
||||
$oMemberModel = &getModel('member');
|
||||
$logged_info = $oMemberModel->getLoggedInfo();
|
||||
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin menu reset
|
||||
* @return void
|
||||
*/
|
||||
function procAdminMenuReset(){
|
||||
$menuSrl = Context::get('menu_srl');
|
||||
if (!$menuSrl) return $this->stop('msg_invalid_request');
|
||||
/**
|
||||
* Admin menu reset
|
||||
* @return void
|
||||
*/
|
||||
function procAdminMenuReset()
|
||||
{
|
||||
$menuSrl = Context::get('menu_srl');
|
||||
if (!$menuSrl) return $this->stop('msg_invalid_request');
|
||||
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$output = $oMenuAdminController->deleteMenu($menuSrl);
|
||||
if (!$output->toBool()) return $output;
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$output = $oMenuAdminController->deleteMenu($menuSrl);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
FileHandler::removeDir('./files/cache/menu/admin_lang/');
|
||||
FileHandler::removeDir('./files/cache/menu/admin_lang/');
|
||||
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate all cache files
|
||||
* @return void
|
||||
*/
|
||||
function procAdminRecompileCacheFile()
|
||||
{
|
||||
// rename cache dir
|
||||
$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');
|
||||
|
||||
$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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate all cache files
|
||||
* @return void
|
||||
*/
|
||||
function procAdminRecompileCacheFile() {
|
||||
// rename cache dir
|
||||
$temp_cache_dir = './files/cache_'. time();
|
||||
FileHandler::rename('./files/cache', $temp_cache_dir);
|
||||
FileHandler::makeDir('./files/cache');
|
||||
// remove cache
|
||||
$truncated = array();
|
||||
$oObjectCacheHandler = &CacheHandler::getInstance('object');
|
||||
$oTemplateCacheHandler = &CacheHandler::getInstance('template');
|
||||
|
||||
// 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');
|
||||
|
||||
$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();
|
||||
}
|
||||
|
||||
// remove cache
|
||||
$truncated = array();
|
||||
$oObjectCacheHandler = &CacheHandler::getInstance('object');
|
||||
$oTemplateCacheHandler = &CacheHandler::getInstance('template');
|
||||
|
||||
if($oObjectCacheHandler->isSupport()){
|
||||
$truncated[] = $oObjectCacheHandler->truncate();
|
||||
}
|
||||
|
||||
if($oTemplateCacheHandler->isSupport()){
|
||||
$truncated[] = $oTemplateCacheHandler->truncate();
|
||||
}
|
||||
|
||||
if(count($truncated) && in_array(false,$truncated)){
|
||||
return new Object(-1,'msg_self_restart_cache_engine');
|
||||
}
|
||||
|
||||
|
||||
// remove cache dir
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
// remove duplicate indexes (only for CUBRID)
|
||||
$db_type = &Context::getDBType();
|
||||
if($db_type == 'cubrid')
|
||||
{
|
||||
$db = &DB::getInstance();
|
||||
$db->deleteDuplicateIndexes();
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout
|
||||
* @return void
|
||||
*/
|
||||
function procAdminLogout() {
|
||||
$oMemberController = &getController('member');
|
||||
$oMemberController->procMemberLogout();
|
||||
|
||||
header('Location: '.getNotEncodedUrl('', 'module','admin'));
|
||||
}
|
||||
|
||||
|
||||
public function procAdminInsertDefaultDesignInfo()
|
||||
if($oObjectCacheHandler->isSupport())
|
||||
{
|
||||
$vars = Context::getRequestVars();
|
||||
if(!$vars->site_srl)
|
||||
{
|
||||
$vars->site_srl = 0;
|
||||
}
|
||||
|
||||
// create a DesignInfo file
|
||||
$output = $this->updateDefaultDesignInfo($vars);
|
||||
return $this->setRedirectUrl(Context::get('error_return_url'), $output);
|
||||
$truncated[] = $oObjectCacheHandler->truncate();
|
||||
}
|
||||
|
||||
public function updateDefaultDesignInfo($vars)
|
||||
if($oTemplateCacheHandler->isSupport())
|
||||
{
|
||||
$siteDesignPath = _XE_PATH_.'files/site_design/';
|
||||
$truncated[] = $oTemplateCacheHandler->truncate();
|
||||
}
|
||||
|
||||
$vars->module_skin = json_decode($vars->module_skin);
|
||||
|
||||
if(!is_dir($siteDesignPath))
|
||||
if(count($truncated) && in_array(false,$truncated))
|
||||
{
|
||||
return new Object(-1,'msg_self_restart_cache_engine');
|
||||
}
|
||||
|
||||
// remove cache dir
|
||||
$tmp_cache_list = FileHandler::readDir('./files','/(^cache_[0-9]+)/');
|
||||
if($tmp_cache_list)
|
||||
{
|
||||
foreach($tmp_cache_list as $tmp_dir)
|
||||
{
|
||||
FileHandler::makeDir($siteDesignPath);
|
||||
if($tmp_dir) FileHandler::removeDir('./files/'.$tmp_dir);
|
||||
}
|
||||
}
|
||||
|
||||
$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$vars->site_srl.'.php';
|
||||
// remove duplicate indexes (only for CUBRID)
|
||||
$db_type = &Context::getDBType();
|
||||
if($db_type == 'cubrid')
|
||||
{
|
||||
$db = &DB::getInstance();
|
||||
$db->deleteDuplicateIndexes();
|
||||
}
|
||||
$this->setMessage('success_updated');
|
||||
}
|
||||
|
||||
$layoutTarget = 'layout_srl';
|
||||
$skinTarget = 'skin';
|
||||
/**
|
||||
* Logout
|
||||
* @return void
|
||||
*/
|
||||
function procAdminLogout()
|
||||
{
|
||||
$oMemberController = &getController('member');
|
||||
$oMemberController->procMemberLogout();
|
||||
|
||||
if ($vars->target_type == 'M')
|
||||
header('Location: '.getNotEncodedUrl('', 'module','admin'));
|
||||
}
|
||||
|
||||
|
||||
public function procAdminInsertDefaultDesignInfo()
|
||||
{
|
||||
$vars = Context::getRequestVars();
|
||||
if(!$vars->site_srl)
|
||||
{
|
||||
$vars->site_srl = 0;
|
||||
}
|
||||
|
||||
// create a DesignInfo file
|
||||
$output = $this->updateDefaultDesignInfo($vars);
|
||||
return $this->setRedirectUrl(Context::get('error_return_url'), $output);
|
||||
}
|
||||
|
||||
public function updateDefaultDesignInfo($vars)
|
||||
{
|
||||
$siteDesignPath = _XE_PATH_.'files/site_design/';
|
||||
|
||||
$vars->module_skin = json_decode($vars->module_skin);
|
||||
|
||||
if(!is_dir($siteDesignPath))
|
||||
{
|
||||
FileHandler::makeDir($siteDesignPath);
|
||||
}
|
||||
|
||||
$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$vars->site_srl.'.php';
|
||||
|
||||
$layoutTarget = 'layout_srl';
|
||||
$skinTarget = 'skin';
|
||||
|
||||
if($vars->target_type == 'M')
|
||||
{
|
||||
$layoutTarget = 'mlayout_srl';
|
||||
$skinTarget = 'mskin';
|
||||
}
|
||||
|
||||
$buff = '';
|
||||
if(is_readable($siteDesignFile))
|
||||
{
|
||||
@include($siteDesignFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
$designInfo = new stdClass();
|
||||
}
|
||||
|
||||
$layoutSrl = (!$vars->layout_srl) ? 0 : $vars->layout_srl;
|
||||
|
||||
$designInfo->{$layoutTarget} = $layoutSrl;
|
||||
|
||||
foreach($vars->module_skin as $moduleName => $skinName)
|
||||
{
|
||||
$designInfo->module->{$moduleName}->{$skinTarget} = $skinName;
|
||||
}
|
||||
|
||||
$this->makeDefaultDesignFile($designInfo, $vars->site_srl);
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function makeDefaultDesignFile($designInfo, $site_srl = 0)
|
||||
{
|
||||
if($designInfo->layout_srl)
|
||||
{
|
||||
$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 .= '$designInfo->module = new stdClass();'."\n";
|
||||
|
||||
foreach($designInfo->module as $moduleName => $skinInfo)
|
||||
{
|
||||
$buff .= sprintf('$designInfo->module->%s = new stdClass();', $moduleName)."\n";
|
||||
foreach($skinInfo as $target => $skinName)
|
||||
{
|
||||
$layoutTarget = 'mlayout_srl';
|
||||
$skinTarget = 'mskin';
|
||||
$buff .= sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName)."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$buff = '';
|
||||
if(is_readable($siteDesignFile))
|
||||
{
|
||||
@include($siteDesignFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
$designInfo = new stdClass();
|
||||
}
|
||||
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit();' . "\n" . 'if(!defined("__XE__")) exit();' ."\n" . '$designInfo = new stdClass();' . "\n" . '%s ?>', $buff);
|
||||
|
||||
$layoutSrl = (!$vars->layout_srl) ? 0 : $vars->layout_srl;
|
||||
$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$site_srl.'.php';
|
||||
FileHandler::writeFile($siteDesignFile, $buff);
|
||||
}
|
||||
|
||||
$designInfo->{$layoutTarget} = $layoutSrl;
|
||||
/**
|
||||
* Toggle favorite
|
||||
* @return void
|
||||
*/
|
||||
function procAdminToggleFavorite()
|
||||
{
|
||||
$siteSrl = Context::get('site_srl');
|
||||
$moduleName = Context::get('module_name');
|
||||
|
||||
foreach($vars->module_skin as $moduleName => $skinName)
|
||||
{
|
||||
$designInfo->module->{$moduleName}->{$skinTarget} = $skinName;
|
||||
}
|
||||
// check favorite exists
|
||||
$oModel = &getAdminModel('admin');
|
||||
$output = $oModel->isExistsFavorite($siteSrl, $moduleName);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$this->makeDefaultDesignFile($designInfo, $vars->site_srl);
|
||||
// if exists, delete favorite
|
||||
if($output->get('result'))
|
||||
{
|
||||
$favoriteSrl = $output->get('favoriteSrl');
|
||||
$output = $this->_deleteFavorite($favoriteSrl);
|
||||
$result = 'off';
|
||||
}
|
||||
// if not exists, insert favorite
|
||||
else
|
||||
{
|
||||
$output = $this->_insertFavorite($siteSrl, $moduleName);
|
||||
$result = 'on';
|
||||
}
|
||||
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$this->add('result', $result);
|
||||
|
||||
return $this->setRedirectUrl(Context::get('error_return_url'), $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanning favorite
|
||||
* @return Object
|
||||
*/
|
||||
function cleanFavorite()
|
||||
{
|
||||
$oModel = getAdminModel('admin');
|
||||
$output = $oModel->getFavoriteList();
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$favoriteList = $output->get('favoriteList');
|
||||
if(!$favoriteList)
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
function makeDefaultDesignFile($designInfo, $site_srl = 0)
|
||||
$deleteTargets = array();
|
||||
foreach($favoriteList as $favorite)
|
||||
{
|
||||
if($designInfo->layout_srl)
|
||||
if($favorite->type == 'module')
|
||||
{
|
||||
$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 .= '$designInfo->module = new stdClass();'."\n";
|
||||
|
||||
foreach($designInfo->module as $moduleName => $skinInfo)
|
||||
{
|
||||
$buff .= sprintf('$designInfo->module->%s = new stdClass();', $moduleName)."\n";
|
||||
foreach($skinInfo as $target => $skinName)
|
||||
$modulePath = './modules/' . $favorite->module;
|
||||
$modulePath = FileHandler::getRealPath($modulePath);
|
||||
if(!is_dir($modulePath))
|
||||
{
|
||||
$buff .= sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName)."\n";
|
||||
$deleteTargets[] = $favorite->admin_favorite_srl;
|
||||
}
|
||||
}
|
||||
|
||||
$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';
|
||||
FileHandler::writeFile($siteDesignFile, $buff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle favorite
|
||||
* @return void
|
||||
*/
|
||||
function procAdminToggleFavorite()
|
||||
if(!count($deleteTargets))
|
||||
{
|
||||
$siteSrl = Context::get('site_srl');
|
||||
$moduleName = Context::get('module_name');
|
||||
|
||||
// check favorite exists
|
||||
$oModel = &getAdminModel('admin');
|
||||
$output = $oModel->isExistsFavorite($siteSrl, $moduleName);
|
||||
if (!$output->toBool()) return $output;
|
||||
|
||||
// if exists, delete favorite
|
||||
if ($output->get('result'))
|
||||
{
|
||||
$favoriteSrl = $output->get('favoriteSrl');
|
||||
$output = $this->_deleteFavorite($favoriteSrl);
|
||||
$result = 'off';
|
||||
}
|
||||
|
||||
// if not exists, insert favorite
|
||||
else
|
||||
{
|
||||
$output = $this->_insertFavorite($siteSrl, $moduleName);
|
||||
$result = 'on';
|
||||
}
|
||||
|
||||
if (!$output->toBool()) return $output;
|
||||
|
||||
$this->add('result', $result);
|
||||
|
||||
return $this->setRedirectUrl(Context::get('error_return_url'), $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanning favorite
|
||||
* @return Object
|
||||
*/
|
||||
function cleanFavorite()
|
||||
{
|
||||
$oModel = getAdminModel('admin');
|
||||
$output = $oModel->getFavoriteList();
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$favoriteList = $output->get('favoriteList');
|
||||
if(!$favoriteList)
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$deleteTargets = array();
|
||||
foreach($favoriteList as $favorite)
|
||||
{
|
||||
if($favorite->type == 'module')
|
||||
{
|
||||
$modulePath = './modules/' . $favorite->module;
|
||||
$modulePath = FileHandler::getRealPath($modulePath);
|
||||
if(!is_dir($modulePath))
|
||||
{
|
||||
$deleteTargets[] = $favorite->admin_favorite_srl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!count($deleteTargets))
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$args->admin_favorite_srls = $deleteTargets;
|
||||
$output = executeQuery('admin.deleteFavorites', $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enviroment gathering agreement
|
||||
* @return void
|
||||
*/
|
||||
function procAdminEnviromentGatheringAgreement()
|
||||
$args->admin_favorite_srls = $deleteTargets;
|
||||
$output = executeQuery('admin.deleteFavorites', $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$isAgree = Context::get('is_agree');
|
||||
if($isAgree == 'true') $_SESSION['enviroment_gather'] = 'Y';
|
||||
else $_SESSION['enviroment_gather'] = 'N';
|
||||
|
||||
$redirectUrl = getUrl('', 'module', 'admin');
|
||||
$this->setRedirectUrl($redirectUrl);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin config update
|
||||
* @return void
|
||||
*/
|
||||
function procAdminUpdateConfig()
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enviroment gathering agreement
|
||||
* @return void
|
||||
*/
|
||||
function procAdminEnviromentGatheringAgreement()
|
||||
{
|
||||
$isAgree = Context::get('is_agree');
|
||||
if($isAgree == 'true') $_SESSION['enviroment_gather'] = 'Y';
|
||||
else $_SESSION['enviroment_gather'] = 'N';
|
||||
|
||||
$redirectUrl = getUrl('', 'module', 'admin');
|
||||
$this->setRedirectUrl($redirectUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin config update
|
||||
* @return void
|
||||
*/
|
||||
function procAdminUpdateConfig()
|
||||
{
|
||||
$adminTitle = Context::get('adminTitle');
|
||||
$file = $_FILES['adminLogo'];
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oAdminConfig = $oModuleModel->getModuleConfig('admin');
|
||||
|
||||
if($file['tmp_name'])
|
||||
{
|
||||
$adminTitle = Context::get('adminTitle');
|
||||
$file = $_FILES['adminLogo'];
|
||||
$target_path = 'files/attach/images/admin/';
|
||||
FileHandler::makeDir($target_path);
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oAdminConfig = $oModuleModel->getModuleConfig('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($file['tmp_name'])
|
||||
{
|
||||
$target_path = 'files/attach/images/admin/';
|
||||
FileHandler::makeDir($target_path);
|
||||
$target_filename = sprintf('%s%s.%s.%s', $target_path, 'adminLogo', date('YmdHis'), $ext);
|
||||
@move_uploaded_file($file['tmp_name'], $target_filename);
|
||||
|
||||
// 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';
|
||||
|
||||
$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($oAdminConfig)
|
||||
{
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertModuleConfig('admin', $oAdminConfig);
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated', 'info');
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminSetup');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
$oAdminConfig->adminLogo = $target_filename;
|
||||
}
|
||||
if($adminTitle) $oAdminConfig->adminTitle = strip_tags($adminTitle);
|
||||
else unset($oAdminConfig->adminTitle);
|
||||
|
||||
/**
|
||||
* Admin logo delete
|
||||
* @return void
|
||||
*/
|
||||
function procAdminDeleteLogo()
|
||||
if($oAdminConfig)
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oAdminConfig = $oModuleModel->getModuleConfig('admin');
|
||||
|
||||
FileHandler::removeFile(_XE_PATH_.$oAdminConfig->adminLogo);
|
||||
unset($oAdminConfig->adminLogo);
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertModuleConfig('admin', $oAdminConfig);
|
||||
|
||||
$this->setMessage('success_deleted', 'info');
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminSetup');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert favorite
|
||||
* @return object query result
|
||||
*/
|
||||
function _insertFavorite($siteSrl, $module, $type = 'module')
|
||||
$this->setMessage('success_updated', 'info');
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminSetup');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin logo delete
|
||||
* @return void
|
||||
*/
|
||||
function procAdminDeleteLogo()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oAdminConfig = $oModuleModel->getModuleConfig('admin');
|
||||
|
||||
FileHandler::removeFile(_XE_PATH_.$oAdminConfig->adminLogo);
|
||||
unset($oAdminConfig->adminLogo);
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertModuleConfig('admin', $oAdminConfig);
|
||||
|
||||
$this->setMessage('success_deleted', 'info');
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminSetup');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert favorite
|
||||
* @return object query result
|
||||
*/
|
||||
function _insertFavorite($siteSrl, $module, $type = 'module')
|
||||
{
|
||||
$args->adminFavoriteSrl = getNextSequence();
|
||||
$args->site_srl = $siteSrl;
|
||||
$args->module = $module;
|
||||
$args->type = $type;
|
||||
$output = executeQuery('admin.insertFavorite', $args);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete favorite
|
||||
* @return object query result
|
||||
*/
|
||||
function _deleteFavorite($favoriteSrl)
|
||||
{
|
||||
$args->admin_favorite_srl = $favoriteSrl;
|
||||
$output = executeQuery('admin.deleteFavorite', $args);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all favorite
|
||||
* @return object query result
|
||||
*/
|
||||
function _deleteAllFavorite()
|
||||
{
|
||||
$args = null;
|
||||
$output = executeQuery('admin.deleteAllFavorite', $args);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove admin icon
|
||||
* @return object|void
|
||||
*/
|
||||
function procAdminRemoveIcons(){
|
||||
$iconname = Context::get('iconname');
|
||||
$file_exist = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$iconname);
|
||||
if($file_exist)
|
||||
{
|
||||
$args->adminFavoriteSrl = getNextSequence();
|
||||
$args->site_srl = $siteSrl;
|
||||
$args->module = $module;
|
||||
$args->type = $type;
|
||||
$output = executeQuery('admin.insertFavorite', $args);
|
||||
return $output;
|
||||
@FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$iconname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete favorite
|
||||
* @return object query result
|
||||
*/
|
||||
function _deleteFavorite($favoriteSrl)
|
||||
else
|
||||
{
|
||||
$args->admin_favorite_srl = $favoriteSrl;
|
||||
$output = executeQuery('admin.deleteFavorite', $args);
|
||||
return $output;
|
||||
return new Object(-1,'fail_to_delete');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all favorite
|
||||
* @return object query result
|
||||
*/
|
||||
function _deleteAllFavorite()
|
||||
{
|
||||
$args = null;
|
||||
$output = executeQuery('admin.deleteAllFavorite', $args);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove admin icon
|
||||
* @return object|void
|
||||
*/
|
||||
function procAdminRemoveIcons(){
|
||||
$iconname = Context::get('iconname');
|
||||
$file_exist = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$iconname);
|
||||
if($file_exist) {
|
||||
@FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$iconname);
|
||||
} else {
|
||||
return new Object(-1,'fail_to_delete');
|
||||
}
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
}
|
||||
?>
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
}
|
||||
/* End of file admin.admin.controller.php */
|
||||
/* Location: ./modules/admin/admin.admin.controller.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,441 +1,451 @@
|
|||
<?php
|
||||
/**
|
||||
* adminAdminView class
|
||||
* Admin view class of admin module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/admin
|
||||
* @version 0.1
|
||||
*/
|
||||
class adminAdminView extends admin
|
||||
{
|
||||
/**
|
||||
* adminAdminView class
|
||||
* Admin view class of admin module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/admin
|
||||
* @version 0.1
|
||||
* layout list
|
||||
* @var array
|
||||
*/
|
||||
class adminAdminView extends admin {
|
||||
/**
|
||||
* layout list
|
||||
* @var array
|
||||
*/
|
||||
var $layout_list;
|
||||
/**
|
||||
* easy install check file
|
||||
* @var array
|
||||
*/
|
||||
var $easyinstallCheckFile = './files/env/easyinstall_last';
|
||||
var $layout_list;
|
||||
/**
|
||||
* easy install check file
|
||||
* @var array
|
||||
*/
|
||||
var $easyinstallCheckFile = './files/env/easyinstall_last';
|
||||
|
||||
/**
|
||||
* Initilization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
// forbit access if the user is not an administrator
|
||||
$oMemberModel = &getModel('member');
|
||||
$logged_info = $oMemberModel->getLoggedInfo();
|
||||
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
|
||||
/**
|
||||
* Initilization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
// forbit access if the user is not an administrator
|
||||
$oMemberModel = &getModel('member');
|
||||
$logged_info = $oMemberModel->getLoggedInfo();
|
||||
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
|
||||
|
||||
// change into administration layout
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setLayoutPath($this->getTemplatePath());
|
||||
$this->setLayoutFile('layout.html');
|
||||
// change into administration layout
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setLayoutPath($this->getTemplatePath());
|
||||
$this->setLayoutFile('layout.html');
|
||||
|
||||
$this->makeGnbUrl();
|
||||
$this->makeGnbUrl();
|
||||
|
||||
// Retrieve the list of installed modules
|
||||
// Retrieve the list of installed modules
|
||||
|
||||
$db_info = Context::getDBInfo();
|
||||
$db_info = Context::getDBInfo();
|
||||
|
||||
Context::set('time_zone_list', $GLOBALS['time_zone']);
|
||||
Context::set('time_zone', $GLOBALS['_time_zone']);
|
||||
Context::set('use_rewrite', $db_info->use_rewrite=='Y'?'Y':'N');
|
||||
Context::set('use_sso', $db_info->use_sso=='Y'?'Y':'N');
|
||||
Context::set('use_html5', $db_info->use_html5=='Y'?'Y':'N');
|
||||
Context::set('use_spaceremover', $db_info->use_spaceremover?$db_info->use_spaceremover:'Y');//not use
|
||||
Context::set('qmail_compatibility', $db_info->qmail_compatibility=='Y'?'Y':'N');
|
||||
Context::set('use_db_session', $db_info->use_db_session=='N'?'N':'Y');
|
||||
Context::set('use_mobile_view', $db_info->use_mobile_view =='Y'?'Y':'N');
|
||||
Context::set('use_ssl', $db_info->use_ssl?$db_info->use_ssl:"none");
|
||||
Context::set('use_cdn', $db_info->use_cdn?$db_info->use_cdn:"none");
|
||||
if($db_info->http_port) Context::set('http_port', $db_info->http_port);
|
||||
if($db_info->https_port) Context::set('https_port', $db_info->https_port);
|
||||
Context::set('time_zone_list', $GLOBALS['time_zone']);
|
||||
Context::set('time_zone', $GLOBALS['_time_zone']);
|
||||
Context::set('use_rewrite', $db_info->use_rewrite=='Y'?'Y':'N');
|
||||
Context::set('use_sso', $db_info->use_sso=='Y'?'Y':'N');
|
||||
Context::set('use_html5', $db_info->use_html5=='Y'?'Y':'N');
|
||||
Context::set('use_spaceremover', $db_info->use_spaceremover?$db_info->use_spaceremover:'Y');//not use
|
||||
Context::set('qmail_compatibility', $db_info->qmail_compatibility=='Y'?'Y':'N');
|
||||
Context::set('use_db_session', $db_info->use_db_session=='N'?'N':'Y');
|
||||
Context::set('use_mobile_view', $db_info->use_mobile_view =='Y'?'Y':'N');
|
||||
Context::set('use_ssl', $db_info->use_ssl?$db_info->use_ssl:"none");
|
||||
Context::set('use_cdn', $db_info->use_cdn?$db_info->use_cdn:"none");
|
||||
if($db_info->http_port) Context::set('http_port', $db_info->http_port);
|
||||
if($db_info->https_port) Context::set('https_port', $db_info->https_port);
|
||||
|
||||
$this->showSendEnv();
|
||||
$this->checkEasyinstall();
|
||||
}
|
||||
$this->showSendEnv();
|
||||
$this->checkEasyinstall();
|
||||
}
|
||||
|
||||
/**
|
||||
* check easy install
|
||||
* @return void
|
||||
*/
|
||||
function checkEasyinstall()
|
||||
/**
|
||||
* check easy install
|
||||
* @return void
|
||||
*/
|
||||
function checkEasyinstall()
|
||||
{
|
||||
$lastTime = (int)FileHandler::readFile($this->easyinstallCheckFile);
|
||||
if ($lastTime > time() - 60*60*24*30) return;
|
||||
|
||||
$oAutoinstallModel = &getModel('autoinstall');
|
||||
$params = array();
|
||||
$params["act"] = "getResourceapiLastupdate";
|
||||
$body = XmlGenerater::generate($params);
|
||||
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
|
||||
$xml_lUpdate = new XmlParser();
|
||||
$lUpdateDoc = $xml_lUpdate->parse($buff);
|
||||
$updateDate = $lUpdateDoc->response->updatedate->body;
|
||||
|
||||
if (!$updateDate)
|
||||
{
|
||||
$lastTime = (int)FileHandler::readFile($this->easyinstallCheckFile);
|
||||
if ($lastTime > time() - 60*60*24*30) return;
|
||||
|
||||
$oAutoinstallModel = &getModel('autoinstall');
|
||||
$params = array();
|
||||
$params["act"] = "getResourceapiLastupdate";
|
||||
$body = XmlGenerater::generate($params);
|
||||
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
|
||||
$xml_lUpdate = new XmlParser();
|
||||
$lUpdateDoc = $xml_lUpdate->parse($buff);
|
||||
$updateDate = $lUpdateDoc->response->updatedate->body;
|
||||
|
||||
if (!$updateDate)
|
||||
{
|
||||
$this->_markingCheckEasyinstall();
|
||||
return;
|
||||
}
|
||||
|
||||
$item = $oAutoinstallModel->getLatestPackage();
|
||||
if(!$item || $item->updatedate < $updateDate)
|
||||
{
|
||||
$oController = &getAdminController('autoinstall');
|
||||
$oController->_updateinfo();
|
||||
}
|
||||
$this->_markingCheckEasyinstall();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* update easy install file content
|
||||
* @return void
|
||||
*/
|
||||
function _markingCheckEasyinstall()
|
||||
$item = $oAutoinstallModel->getLatestPackage();
|
||||
if(!$item || $item->updatedate < $updateDate)
|
||||
{
|
||||
$currentTime = time();
|
||||
FileHandler::writeFile($this->easyinstallCheckFile, $currentTime);
|
||||
$oController = &getAdminController('autoinstall');
|
||||
$oController->_updateinfo();
|
||||
}
|
||||
$this->_markingCheckEasyinstall();
|
||||
}
|
||||
|
||||
/**
|
||||
* Include admin menu php file and make menu url
|
||||
* Setting admin logo, newest news setting
|
||||
* @return void
|
||||
*/
|
||||
function makeGnbUrl($module = 'admin')
|
||||
/**
|
||||
* update easy install file content
|
||||
* @return void
|
||||
*/
|
||||
function _markingCheckEasyinstall()
|
||||
{
|
||||
$currentTime = time();
|
||||
FileHandler::writeFile($this->easyinstallCheckFile, $currentTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Include admin menu php file and make menu url
|
||||
* Setting admin logo, newest news setting
|
||||
* @return void
|
||||
*/
|
||||
function makeGnbUrl($module = 'admin')
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$lang->menu_gnb_sub = $oAdminAdminModel->getAdminMenuLang();
|
||||
|
||||
$menuPhpFile = $oAdminAdminModel->checkAdminMenu();
|
||||
if(!$menuPhpFile)
|
||||
{
|
||||
global $lang;
|
||||
return $this->setRedirectUrl(getUrl('', 'module', 'admin'));
|
||||
}
|
||||
include $menuPhpFile;
|
||||
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$lang->menu_gnb_sub = $oAdminAdminModel->getAdminMenuLang();
|
||||
$oModuleModel = &getModel('module');
|
||||
$moduleActionInfo = $oModuleModel->getModuleActionXml($module);
|
||||
|
||||
$menuPhpFile = $oAdminAdminModel->checkAdminMenu();
|
||||
if(!$menuPhpFile)
|
||||
$currentAct = Context::get('act');
|
||||
$subMenuTitle = '';
|
||||
foreach((array)$moduleActionInfo->menu as $key=>$value)
|
||||
{
|
||||
if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts))
|
||||
{
|
||||
return $this->setRedirectUrl(getUrl('', 'module', 'admin'));
|
||||
$subMenuTitle = $value->title;
|
||||
break;
|
||||
}
|
||||
include $menuPhpFile;
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$moduleActionInfo = $oModuleModel->getModuleActionXml($module);
|
||||
|
||||
$currentAct = Context::get('act');
|
||||
$subMenuTitle = '';
|
||||
foreach((array)$moduleActionInfo->menu as $key=>$value)
|
||||
$parentSrl = 0;
|
||||
foreach((array)$menu->list as $parentKey=>$parentMenu)
|
||||
{
|
||||
if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) continue;
|
||||
if($parentMenu['href'] == '#' && count($parentMenu['list']))
|
||||
{
|
||||
if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts))
|
||||
$firstChild = current($parentMenu['list']);
|
||||
$menu->list[$parentKey]['href'] = $firstChild['href'];
|
||||
}
|
||||
|
||||
foreach($parentMenu['list'] as $childKey=>$childMenu)
|
||||
{
|
||||
if($subMenuTitle == $childMenu['text'])
|
||||
{
|
||||
$subMenuTitle = $value->title;
|
||||
$parentSrl = $childMenu['parent_srl'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$parentSrl = 0;
|
||||
foreach((array)$menu->list as $parentKey=>$parentMenu)
|
||||
{
|
||||
if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) continue;
|
||||
if($parentMenu['href'] == '#' && count($parentMenu['list'])) {
|
||||
$firstChild = current($parentMenu['list']);
|
||||
$menu->list[$parentKey]['href'] = $firstChild['href'];
|
||||
}
|
||||
|
||||
foreach($parentMenu['list'] as $childKey=>$childMenu)
|
||||
{
|
||||
if($subMenuTitle == $childMenu['text'])
|
||||
{
|
||||
$parentSrl = $childMenu['parent_srl'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Admin logo, title setup
|
||||
$objConfig = $oModuleModel->getModuleConfig('admin');
|
||||
$gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle:'XE Admin';
|
||||
$gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo:'modules/admin/tpl/img/xe.h1.png';
|
||||
|
||||
$browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard').' - '.$gnbTitleInfo->adminTitle;
|
||||
|
||||
// Get list of favorite
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$output = $oAdminAdminModel->getFavoriteList(0, true);
|
||||
Context::set('favorite_list', $output->get('favoriteList'));
|
||||
|
||||
// Retrieve recent news and set them into context,
|
||||
// move from index method, because use in admin footer
|
||||
$newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __ZBXE_VERSION__, _XE_PACKAGE_);
|
||||
$cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_);
|
||||
if(!file_exists($cache_file) || filemtime($cache_file)+ 60*60 < time()) {
|
||||
// Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page
|
||||
// Ensure to access the administration page even though news cannot be displayed
|
||||
FileHandler::writeFile($cache_file,'');
|
||||
FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL'=>getFullUrl('')));
|
||||
}
|
||||
|
||||
if(file_exists($cache_file)) {
|
||||
$oXml = new XmlParser();
|
||||
$buff = $oXml->parse(FileHandler::readFile($cache_file));
|
||||
|
||||
$item = $buff->zbxe_news->item;
|
||||
if($item) {
|
||||
if(!is_array($item)) $item = array($item);
|
||||
|
||||
foreach($item as $key => $val) {
|
||||
$obj = null;
|
||||
$obj->title = $val->body;
|
||||
$obj->date = $val->attrs->date;
|
||||
$obj->url = $val->attrs->url;
|
||||
$news[] = $obj;
|
||||
}
|
||||
Context::set('news', $news);
|
||||
if(isset($news) && is_array($news))
|
||||
{
|
||||
Context::set('latestVersion', array_shift($news));
|
||||
}
|
||||
}
|
||||
Context::set('released_version', $buff->zbxe_news->attrs->released_version);
|
||||
Context::set('download_link', $buff->zbxe_news->attrs->download_link);
|
||||
}
|
||||
|
||||
|
||||
Context::set('subMenuTitle', $subMenuTitle);
|
||||
Context::set('gnbUrlList', $menu->list);
|
||||
Context::set('parentSrl', $parentSrl);
|
||||
Context::set('gnb_title_info', $gnbTitleInfo);
|
||||
Context::setBrowserTitle($browserTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Super Admin Dashboard
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminIndex() {
|
||||
// Get statistics
|
||||
$args->date = date("Ymd000000", time()-60*60*24);
|
||||
$today = date("Ymd");
|
||||
// Admin logo, title setup
|
||||
$objConfig = $oModuleModel->getModuleConfig('admin');
|
||||
$gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle:'XE Admin';
|
||||
$gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo:'modules/admin/tpl/img/xe.h1.png';
|
||||
|
||||
// Member Status
|
||||
$oMemberAdminModel = &getAdminModel('member');
|
||||
$status->member->todayCount = $oMemberAdminModel->getMemberCountByDate($today);
|
||||
$status->member->totalCount = $oMemberAdminModel->getMemberCountByDate();
|
||||
$browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard').' - '.$gnbTitleInfo->adminTitle;
|
||||
|
||||
// Document Status
|
||||
$oDocumentAdminModel = &getAdminModel('document');
|
||||
$statusList = array('PUBLIC', 'SECRET');
|
||||
$status->document->todayCount = $oDocumentAdminModel->getDocumentCountByDate($today, array(), $statusList);
|
||||
$status->document->totalCount = $oDocumentAdminModel->getDocumentCountByDate('', array(), $statusList);
|
||||
// Get list of favorite
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$output = $oAdminAdminModel->getFavoriteList(0, true);
|
||||
Context::set('favorite_list', $output->get('favoriteList'));
|
||||
|
||||
// Comment Status
|
||||
$oCommentModel = &getModel('comment');
|
||||
$status->comment->todayCount = $oCommentModel->getCommentCountByDate($today);
|
||||
$status->comment->totalCount = $oCommentModel->getCommentCountByDate();
|
||||
|
||||
// Trackback Status
|
||||
$oTrackbackAdminModel = &getAdminModel('trackback');
|
||||
$status->trackback->todayCount = $oTrackbackAdminModel->getTrackbackCountByDate($today);
|
||||
$status->trackback->totalCount = $oTrackbackAdminModel->getTrackbackCountByDate();
|
||||
|
||||
// Attached files Status
|
||||
$oFileAdminModel = &getAdminModel('file');
|
||||
$status->file->todayCount = $oFileAdminModel->getFilesCountByDate($today);
|
||||
$status->file->totalCount = $oFileAdminModel->getFilesCountByDate();
|
||||
|
||||
Context::set('status', $status);
|
||||
|
||||
// Latest Document
|
||||
$oDocumentModel = &getModel('document');
|
||||
$columnList = array('document_srl', 'module_srl', 'category_srl', 'title', 'nick_name', 'member_srl');
|
||||
$args->list_count = 5;;
|
||||
$output = $oDocumentModel->getDocumentList($args, false, false, $columnList);
|
||||
Context::set('latestDocumentList', $output->data);
|
||||
$security = new Security();
|
||||
$security->encodeHTML('latestDocumentList..variables.nick_name');
|
||||
unset($args, $output, $columnList);
|
||||
|
||||
// Latest Comment
|
||||
$oCommentModel = &getModel('comment');
|
||||
$columnList = array('comment_srl', 'module_srl', 'document_srl', 'content', 'nick_name', 'member_srl');
|
||||
$args->list_count = 5;
|
||||
$output = $oCommentModel->getNewestCommentList($args, $columnList);
|
||||
if(is_array($output))
|
||||
{
|
||||
foreach($output AS $key=>$value)
|
||||
{
|
||||
$value->content = strip_tags($value->content);
|
||||
}
|
||||
}
|
||||
Context::set('latestCommentList', $output);
|
||||
unset($args, $output, $columnList);
|
||||
|
||||
//Latest Trackback
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$columnList = array();
|
||||
$args->list_count = 5;
|
||||
$output =$oTrackbackModel->getNewestTrackbackList($args);
|
||||
Context::set('latestTrackbackList', $output->data);
|
||||
unset($args, $output, $columnList);
|
||||
|
||||
// Get list of modules
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_list = $oModuleModel->getModuleList();
|
||||
if(is_array($module_list))
|
||||
{
|
||||
$needUpdate = false;
|
||||
$addTables = false;
|
||||
foreach($module_list AS $key=>$value)
|
||||
{
|
||||
if($value->need_install)
|
||||
{
|
||||
$addTables = true;
|
||||
}
|
||||
if($value->need_update)
|
||||
{
|
||||
$needUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Context::set('module_list', $module_list);
|
||||
Context::set('needUpdate', $isUpdated);
|
||||
Context::set('addTables', $addTables);
|
||||
Context::set('needUpdate', $needUpdate);
|
||||
|
||||
// gathering enviroment check
|
||||
$mainVersion = join('.', array_slice(explode('.', __ZBXE_VERSION__), 0, 2));
|
||||
$path = FileHandler::getRealPath('./files/env/'.$mainVersion);
|
||||
$isEnviromentGatheringAgreement = false;
|
||||
if(file_exists($path)) $isEnviromentGatheringAgreement = true;
|
||||
Context::set('isEnviromentGatheringAgreement', $isEnviromentGatheringAgreement);
|
||||
Context::set('layout','none');
|
||||
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Configuration(settings) page
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminConfigGeneral() {
|
||||
Context::loadLang('modules/install/lang');
|
||||
|
||||
$db_info = Context::getDBInfo();
|
||||
|
||||
Context::set('selected_lang', $db_info->lang_type);
|
||||
|
||||
Context::set('default_url', $db_info->default_url);
|
||||
Context::set('langs', Context::loadLangSupported());
|
||||
|
||||
Context::set('lang_selected', Context::loadLangSelected());
|
||||
|
||||
$admin_ip_list = preg_replace("/[,]+/","\r\n",$db_info->admin_ip_list);
|
||||
Context::set('admin_ip_list', $admin_ip_list);
|
||||
|
||||
$oAdminModel = &getAdminModel('admin');
|
||||
$favicon_url = $oAdminModel->getFaviconUrl();
|
||||
$mobicon_url = $oAdminModel->getMobileIconUrl();
|
||||
Context::set('favicon_url', $favicon_url);
|
||||
Context::set('mobicon_url', $mobicon_url);
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$config = $oDocumentModel->getDocumentConfig();
|
||||
Context::set('thumbnail_type',$config->thumbnail_type);
|
||||
|
||||
Context::set('IP',$_SERVER['REMOTE_ADDR']);
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('module');
|
||||
Context::set('siteTitle',$config->siteTitle);
|
||||
Context::set('htmlFooter',$config->htmlFooter);
|
||||
|
||||
|
||||
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl');
|
||||
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
|
||||
Context::set('start_module', $start_module);
|
||||
|
||||
Context::set('pwd',$pwd);
|
||||
$this->setTemplateFile('config_general');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('news..', 'released_version', 'download_link', 'selected_lang', 'module_list..', 'module_list..author..', 'addon_list..', 'addon_list..author..', 'start_module.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display FTP Configuration(settings) page
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminConfigFtp() {
|
||||
Context::loadLang('modules/install/lang');
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
Context::set('ftp_info', $ftp_info);
|
||||
Context::set('sftp_support', function_exists(ssh2_sftp));
|
||||
|
||||
$this->setTemplateFile('config_ftp');
|
||||
|
||||
// $security = new Security();
|
||||
// $security->encodeHTML('ftp_info..');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Admin Menu Configuration(settings) page
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminSetup()
|
||||
// Retrieve recent news and set them into context,
|
||||
// move from index method, because use in admin footer
|
||||
$newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __ZBXE_VERSION__, _XE_PACKAGE_);
|
||||
$cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_);
|
||||
if(!file_exists($cache_file) || filemtime($cache_file)+ 60*60 < time())
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$configObject = $oModuleModel->getModuleConfig('admin');
|
||||
|
||||
$oAdmin = &getClass('admin');
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$output = $oMenuAdminModel->getMenuByTitle($oAdmin->getAdminMenuName());
|
||||
|
||||
Context::set('menu_srl', $output->menu_srl);
|
||||
Context::set('menu_title', $output->title);
|
||||
Context::set('config_object', $configObject);
|
||||
$this->setTemplateFile('admin_setup');
|
||||
// Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page
|
||||
// Ensure to access the administration page even though news cannot be displayed
|
||||
FileHandler::writeFile($cache_file,'');
|
||||
FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL'=>getFullUrl('')));
|
||||
}
|
||||
|
||||
if(file_exists($cache_file))
|
||||
{
|
||||
$oXml = new XmlParser();
|
||||
$buff = $oXml->parse(FileHandler::readFile($cache_file));
|
||||
|
||||
/**
|
||||
* Enviroment information send to XE collect server
|
||||
* @return void
|
||||
*/
|
||||
function showSendEnv() {
|
||||
if(Context::getResponseMethod() != 'HTML') return;
|
||||
$item = $buff->zbxe_news->item;
|
||||
if($item)
|
||||
{
|
||||
if(!is_array($item)) $item = array($item);
|
||||
|
||||
$server = 'http://collect.xpressengine.com/env/img.php?';
|
||||
$path = './files/env/';
|
||||
$install_env = $path . 'install';
|
||||
$mainVersion = join('.', array_slice(explode('.', __ZBXE_VERSION__), 0, 2));
|
||||
foreach($item as $key => $val)
|
||||
{
|
||||
$obj = null;
|
||||
$obj->title = $val->body;
|
||||
$obj->date = $val->attrs->date;
|
||||
$obj->url = $val->attrs->url;
|
||||
$news[] = $obj;
|
||||
}
|
||||
Context::set('news', $news);
|
||||
if(isset($news) && is_array($news))
|
||||
{
|
||||
Context::set('latestVersion', array_shift($news));
|
||||
}
|
||||
}
|
||||
Context::set('released_version', $buff->zbxe_news->attrs->released_version);
|
||||
Context::set('download_link', $buff->zbxe_news->attrs->download_link);
|
||||
}
|
||||
|
||||
if(file_exists(FileHandler::getRealPath($install_env))) {
|
||||
Context::set('subMenuTitle', $subMenuTitle);
|
||||
Context::set('gnbUrlList', $menu->list);
|
||||
Context::set('parentSrl', $parentSrl);
|
||||
Context::set('gnb_title_info', $gnbTitleInfo);
|
||||
Context::setBrowserTitle($browserTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Super Admin Dashboard
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminIndex()
|
||||
{
|
||||
// Get statistics
|
||||
$args->date = date("Ymd000000", time()-60*60*24);
|
||||
$today = date("Ymd");
|
||||
|
||||
// Member Status
|
||||
$oMemberAdminModel = &getAdminModel('member');
|
||||
$status->member->todayCount = $oMemberAdminModel->getMemberCountByDate($today);
|
||||
$status->member->totalCount = $oMemberAdminModel->getMemberCountByDate();
|
||||
|
||||
// Document Status
|
||||
$oDocumentAdminModel = &getAdminModel('document');
|
||||
$statusList = array('PUBLIC', 'SECRET');
|
||||
$status->document->todayCount = $oDocumentAdminModel->getDocumentCountByDate($today, array(), $statusList);
|
||||
$status->document->totalCount = $oDocumentAdminModel->getDocumentCountByDate('', array(), $statusList);
|
||||
|
||||
// Comment Status
|
||||
$oCommentModel = &getModel('comment');
|
||||
$status->comment->todayCount = $oCommentModel->getCommentCountByDate($today);
|
||||
$status->comment->totalCount = $oCommentModel->getCommentCountByDate();
|
||||
|
||||
// Trackback Status
|
||||
$oTrackbackAdminModel = &getAdminModel('trackback');
|
||||
$status->trackback->todayCount = $oTrackbackAdminModel->getTrackbackCountByDate($today);
|
||||
$status->trackback->totalCount = $oTrackbackAdminModel->getTrackbackCountByDate();
|
||||
|
||||
// Attached files Status
|
||||
$oFileAdminModel = &getAdminModel('file');
|
||||
$status->file->todayCount = $oFileAdminModel->getFilesCountByDate($today);
|
||||
$status->file->totalCount = $oFileAdminModel->getFilesCountByDate();
|
||||
|
||||
Context::set('status', $status);
|
||||
|
||||
// Latest Document
|
||||
$oDocumentModel = &getModel('document');
|
||||
$columnList = array('document_srl', 'module_srl', 'category_srl', 'title', 'nick_name', 'member_srl');
|
||||
$args->list_count = 5;;
|
||||
$output = $oDocumentModel->getDocumentList($args, false, false, $columnList);
|
||||
Context::set('latestDocumentList', $output->data);
|
||||
$security = new Security();
|
||||
$security->encodeHTML('latestDocumentList..variables.nick_name');
|
||||
unset($args, $output, $columnList);
|
||||
|
||||
// Latest Comment
|
||||
$oCommentModel = &getModel('comment');
|
||||
$columnList = array('comment_srl', 'module_srl', 'document_srl', 'content', 'nick_name', 'member_srl');
|
||||
$args->list_count = 5;
|
||||
$output = $oCommentModel->getNewestCommentList($args, $columnList);
|
||||
if(is_array($output))
|
||||
{
|
||||
foreach($output AS $key=>$value)
|
||||
{
|
||||
$value->content = strip_tags($value->content);
|
||||
}
|
||||
}
|
||||
Context::set('latestCommentList', $output);
|
||||
unset($args, $output, $columnList);
|
||||
|
||||
//Latest Trackback
|
||||
$oTrackbackModel = &getModel('trackback');
|
||||
$columnList = array();
|
||||
$args->list_count = 5;
|
||||
$output =$oTrackbackModel->getNewestTrackbackList($args);
|
||||
Context::set('latestTrackbackList', $output->data);
|
||||
unset($args, $output, $columnList);
|
||||
|
||||
// Get list of modules
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_list = $oModuleModel->getModuleList();
|
||||
if(is_array($module_list))
|
||||
{
|
||||
$needUpdate = false;
|
||||
$addTables = false;
|
||||
foreach($module_list AS $key=>$value)
|
||||
{
|
||||
if($value->need_install)
|
||||
{
|
||||
$addTables = true;
|
||||
}
|
||||
if($value->need_update)
|
||||
{
|
||||
$needUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Context::set('module_list', $module_list);
|
||||
Context::set('needUpdate', $isUpdated);
|
||||
Context::set('addTables', $addTables);
|
||||
Context::set('needUpdate', $needUpdate);
|
||||
|
||||
// gathering enviroment check
|
||||
$mainVersion = join('.', array_slice(explode('.', __ZBXE_VERSION__), 0, 2));
|
||||
$path = FileHandler::getRealPath('./files/env/'.$mainVersion);
|
||||
$isEnviromentGatheringAgreement = false;
|
||||
if(file_exists($path)) $isEnviromentGatheringAgreement = true;
|
||||
Context::set('isEnviromentGatheringAgreement', $isEnviromentGatheringAgreement);
|
||||
Context::set('layout','none');
|
||||
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Configuration(settings) page
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminConfigGeneral()
|
||||
{
|
||||
Context::loadLang('modules/install/lang');
|
||||
|
||||
$db_info = Context::getDBInfo();
|
||||
|
||||
Context::set('selected_lang', $db_info->lang_type);
|
||||
|
||||
Context::set('default_url', $db_info->default_url);
|
||||
Context::set('langs', Context::loadLangSupported());
|
||||
|
||||
Context::set('lang_selected', Context::loadLangSelected());
|
||||
|
||||
$admin_ip_list = preg_replace("/[,]+/","\r\n",$db_info->admin_ip_list);
|
||||
Context::set('admin_ip_list', $admin_ip_list);
|
||||
|
||||
$oAdminModel = &getAdminModel('admin');
|
||||
$favicon_url = $oAdminModel->getFaviconUrl();
|
||||
$mobicon_url = $oAdminModel->getMobileIconUrl();
|
||||
Context::set('favicon_url', $favicon_url);
|
||||
Context::set('mobicon_url', $mobicon_url);
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$config = $oDocumentModel->getDocumentConfig();
|
||||
Context::set('thumbnail_type',$config->thumbnail_type);
|
||||
|
||||
Context::set('IP',$_SERVER['REMOTE_ADDR']);
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('module');
|
||||
Context::set('siteTitle',$config->siteTitle);
|
||||
Context::set('htmlFooter',$config->htmlFooter);
|
||||
|
||||
|
||||
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl');
|
||||
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
|
||||
Context::set('start_module', $start_module);
|
||||
|
||||
Context::set('pwd',$pwd);
|
||||
$this->setTemplateFile('config_general');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('news..', 'released_version', 'download_link', 'selected_lang', 'module_list..', 'module_list..author..', 'addon_list..', 'addon_list..author..', 'start_module.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display FTP Configuration(settings) page
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminConfigFtp()
|
||||
{
|
||||
Context::loadLang('modules/install/lang');
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
Context::set('ftp_info', $ftp_info);
|
||||
Context::set('sftp_support', function_exists(ssh2_sftp));
|
||||
|
||||
$this->setTemplateFile('config_ftp');
|
||||
|
||||
//$security = new Security();
|
||||
//$security->encodeHTML('ftp_info..');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Admin Menu Configuration(settings) page
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminSetup()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$configObject = $oModuleModel->getModuleConfig('admin');
|
||||
|
||||
$oAdmin = &getClass('admin');
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$output = $oMenuAdminModel->getMenuByTitle($oAdmin->getAdminMenuName());
|
||||
|
||||
Context::set('menu_srl', $output->menu_srl);
|
||||
Context::set('menu_title', $output->title);
|
||||
Context::set('config_object', $configObject);
|
||||
$this->setTemplateFile('admin_setup');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enviroment information send to XE collect server
|
||||
* @return void
|
||||
*/
|
||||
function showSendEnv()
|
||||
{
|
||||
if(Context::getResponseMethod() != 'HTML') return;
|
||||
|
||||
$server = 'http://collect.xpressengine.com/env/img.php?';
|
||||
$path = './files/env/';
|
||||
$install_env = $path . 'install';
|
||||
$mainVersion = join('.', array_slice(explode('.', __ZBXE_VERSION__), 0, 2));
|
||||
|
||||
if(file_exists(FileHandler::getRealPath($install_env)))
|
||||
{
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$params = $oAdminAdminModel->getEnv('INSTALL');
|
||||
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params);
|
||||
Context::addHtmlFooter($img);
|
||||
|
||||
FileHandler::removeDir($path);
|
||||
FileHandler::writeFile($path.$mainVersion,'1');
|
||||
}
|
||||
else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path.$mainVersion)))
|
||||
{
|
||||
if($_SESSION['enviroment_gather']=='Y')
|
||||
{
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$params = $oAdminAdminModel->getEnv('INSTALL');
|
||||
$params = $oAdminAdminModel->getEnv();
|
||||
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params);
|
||||
Context::addHtmlFooter($img);
|
||||
|
||||
FileHandler::removeDir($path);
|
||||
FileHandler::writeFile($path.$mainVersion,'1');
|
||||
|
||||
}
|
||||
else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path.$mainVersion)))
|
||||
{
|
||||
if($_SESSION['enviroment_gather']=='Y')
|
||||
{
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$params = $oAdminAdminModel->getEnv();
|
||||
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params);
|
||||
Context::addHtmlFooter($img);
|
||||
}
|
||||
|
||||
FileHandler::removeDir($path);
|
||||
FileHandler::writeFile($path.$mainVersion,'1');
|
||||
unset($_SESSION['enviroment_gather']);
|
||||
}
|
||||
FileHandler::removeDir($path);
|
||||
FileHandler::writeFile($path.$mainVersion,'1');
|
||||
unset($_SESSION['enviroment_gather']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file admin.admin.view.php */
|
||||
/* Location: ./modules/admin/admin.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,456 +1,464 @@
|
|||
<?php
|
||||
/**
|
||||
* admin class
|
||||
* Base class of admin module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/admin
|
||||
* @version 0.1
|
||||
*/
|
||||
class admin extends ModuleObject
|
||||
{
|
||||
private $adminMenuName = '__ADMINMENU_V17__';
|
||||
|
||||
public function getAdminMenuName()
|
||||
{
|
||||
return $this->adminMenuName;
|
||||
}
|
||||
|
||||
/**
|
||||
* admin class
|
||||
* Base class of admin module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/admin
|
||||
* @version 0.1
|
||||
* Install admin module
|
||||
* @return Object
|
||||
*/
|
||||
class admin extends ModuleObject {
|
||||
private $adminMenuName = '__ADMINMENU_V17__';
|
||||
function moduleInstall()
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
public function getAdminMenuName()
|
||||
/**
|
||||
* If update is necessary it returns true
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("admin_favorite", "type")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update module
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("admin_favorite", "type"))
|
||||
{
|
||||
return $this->adminMenuName;
|
||||
}
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$output = $oAdminAdminModel->getFavoriteList();
|
||||
$favoriteList = $output->get('favoriteList');
|
||||
|
||||
/**
|
||||
* Install admin module
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* If update is necessary it returns true
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("admin_favorite", "type")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update module
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("admin_favorite", "type"))
|
||||
$oDB->dropColumn('admin_favorite', 'admin_favorite_srl');
|
||||
$oDB->addColumn('admin_favorite',"admin_favorite_srl","number",11,0);
|
||||
$oDB->addColumn('admin_favorite',"type","varchar",30, 'module');
|
||||
if(is_array($favoriteList))
|
||||
{
|
||||
$oAdminAdminModel = &getAdminModel('admin');
|
||||
$output = $oAdminAdminModel->getFavoriteList();
|
||||
$favoriteList = $output->get('favoriteList');
|
||||
|
||||
$oDB->dropColumn('admin_favorite', 'admin_favorite_srl');
|
||||
$oDB->addColumn('admin_favorite',"admin_favorite_srl","number",11,0);
|
||||
$oDB->addColumn('admin_favorite',"type","varchar",30, 'module');
|
||||
if(is_array($favoriteList))
|
||||
$oAdminAdminController = &getAdminController('admin');
|
||||
$oAdminAdminController->_deleteAllFavorite();
|
||||
foreach($favoriteList AS $key=>$value)
|
||||
{
|
||||
$oAdminAdminController = &getAdminController('admin');
|
||||
$oAdminAdminController->_deleteAllFavorite();
|
||||
foreach($favoriteList AS $key=>$value)
|
||||
{
|
||||
$oAdminAdminController->_insertFavorite($value->site_srl, $value->module);
|
||||
}
|
||||
$oAdminAdminController->_insertFavorite($value->site_srl, $value->module);
|
||||
}
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache() {
|
||||
}
|
||||
|
||||
public function checkAdminMenu()
|
||||
{
|
||||
// for admin menu
|
||||
if(Context::isInstalled())
|
||||
{
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName);
|
||||
|
||||
if(!$output->menu_srl)
|
||||
{
|
||||
$oAdminClass = &getClass('admin');
|
||||
$oAdminClass->createXeAdminMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!is_readable(FileHandler::getRealPath($output->php_file)))
|
||||
{
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$oMenuAdminController->makeXmlFile($output->menu_srl);
|
||||
}
|
||||
Context::set('admin_menu_srl', $output->menu_srl);
|
||||
}
|
||||
|
||||
$this->_oldAdminmenuDelete();
|
||||
return FileHandler::getRealPath($output->php_file);
|
||||
}
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate xe admin default menu
|
||||
* @return void
|
||||
*/
|
||||
public function createXeAdminMenu()
|
||||
/**
|
||||
* Regenerate cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
|
||||
public function checkAdminMenu()
|
||||
{
|
||||
// for admin menu
|
||||
if(Context::isInstalled())
|
||||
{
|
||||
//insert menu
|
||||
$args->title = $this->adminMenuName;
|
||||
$args->menu_srl = getNextSequence();
|
||||
$args->listorder = $args->menu_srl * -1;
|
||||
$output = executeQuery('menu.insertMenu', $args);
|
||||
$menuSrl = $args->menu_srl;
|
||||
Context::set('admin_menu_srl', $menuSrl);
|
||||
unset($args);
|
||||
|
||||
// gnb item create
|
||||
$gnbList = array('dashboard', 'menu', 'user', 'content', 'configuration', 'advanced');
|
||||
foreach($gnbList AS $key=>$value)
|
||||
{
|
||||
//insert menu item
|
||||
$args->menu_srl = $menuSrl;
|
||||
$args->menu_item_srl = getNextSequence();
|
||||
$args->name = '{$lang->menu_gnb[\''.$value.'\']}';
|
||||
if($value == 'dashboard')
|
||||
{
|
||||
$args->url = 'index.php?module=admin';
|
||||
}
|
||||
else $args->url = '#';
|
||||
$args->listorder = -1*$args->menu_item_srl;
|
||||
$output = executeQuery('menu.insertMenuItem', $args);
|
||||
}
|
||||
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$columnList = array('menu_item_srl', 'name');
|
||||
$output = $oMenuAdminModel->getMenuItems($menuSrl, 0, $columnList);
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data AS $key=>$value)
|
||||
{
|
||||
preg_match('/\{\$lang->menu_gnb\[(.*?)\]\}/i', $value->name, $m);
|
||||
$gnbDBList[$m[1]] = $value->menu_item_srl;
|
||||
}
|
||||
}
|
||||
unset($args);
|
||||
$output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName);
|
||||
|
||||
$gnbModuleList = array(
|
||||
0=>array(
|
||||
'module'=>'menu',
|
||||
'subMenu'=>array('siteMap', 'siteDesign'),
|
||||
if(!$output->menu_srl)
|
||||
{
|
||||
$oAdminClass = &getClass('admin');
|
||||
$oAdminClass->createXeAdminMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!is_readable(FileHandler::getRealPath($output->php_file)))
|
||||
{
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$oMenuAdminController->makeXmlFile($output->menu_srl);
|
||||
}
|
||||
Context::set('admin_menu_srl', $output->menu_srl);
|
||||
}
|
||||
|
||||
$this->_oldAdminmenuDelete();
|
||||
return FileHandler::getRealPath($output->php_file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate xe admin default menu
|
||||
* @return void
|
||||
*/
|
||||
public function createXeAdminMenu()
|
||||
{
|
||||
//insert menu
|
||||
$args->title = $this->adminMenuName;
|
||||
$args->menu_srl = getNextSequence();
|
||||
$args->listorder = $args->menu_srl * -1;
|
||||
$output = executeQuery('menu.insertMenu', $args);
|
||||
$menuSrl = $args->menu_srl;
|
||||
Context::set('admin_menu_srl', $menuSrl);
|
||||
unset($args);
|
||||
|
||||
// gnb item create
|
||||
$gnbList = array('dashboard', 'menu', 'user', 'content', 'configuration', 'advanced');
|
||||
foreach($gnbList AS $key=>$value)
|
||||
{
|
||||
//insert menu item
|
||||
$args->menu_srl = $menuSrl;
|
||||
$args->menu_item_srl = getNextSequence();
|
||||
$args->name = '{$lang->menu_gnb[\''.$value.'\']}';
|
||||
if($value == 'dashboard')
|
||||
{
|
||||
$args->url = 'index.php?module=admin';
|
||||
}
|
||||
else $args->url = '#';
|
||||
$args->listorder = -1*$args->menu_item_srl;
|
||||
$output = executeQuery('menu.insertMenuItem', $args);
|
||||
}
|
||||
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$columnList = array('menu_item_srl', 'name');
|
||||
$output = $oMenuAdminModel->getMenuItems($menuSrl, 0, $columnList);
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data AS $key=>$value)
|
||||
{
|
||||
preg_match('/\{\$lang->menu_gnb\[(.*?)\]\}/i', $value->name, $m);
|
||||
$gnbDBList[$m[1]] = $value->menu_item_srl;
|
||||
}
|
||||
}
|
||||
unset($args);
|
||||
|
||||
$gnbModuleList = array(
|
||||
0=>array(
|
||||
'module'=>'menu',
|
||||
'subMenu'=>array('siteMap', 'siteDesign'),
|
||||
),
|
||||
1=>array(
|
||||
'module'=>'member',
|
||||
'subMenu'=>array('userList', 'userSetting', 'userGroup'),
|
||||
1=>array(
|
||||
'module'=>'member',
|
||||
'subMenu'=>array('userList', 'userSetting', 'userGroup'),
|
||||
),
|
||||
2=>array(
|
||||
'module'=>'document',
|
||||
'subMenu'=>array('document'),
|
||||
2=>array(
|
||||
'module'=>'document',
|
||||
'subMenu'=>array('document'),
|
||||
),
|
||||
3=>array(
|
||||
'module'=>'comment',
|
||||
'subMenu'=>array('comment'),
|
||||
3=>array(
|
||||
'module'=>'comment',
|
||||
'subMenu'=>array('comment'),
|
||||
),
|
||||
4=>array(
|
||||
'module'=>'trackback',
|
||||
'subMenu'=>array('trackback'),
|
||||
4=>array(
|
||||
'module'=>'trackback',
|
||||
'subMenu'=>array('trackback'),
|
||||
),
|
||||
5=>array(
|
||||
5=>array(
|
||||
'module'=>'file',
|
||||
'subMenu'=>array('file'),
|
||||
),
|
||||
6=>array(
|
||||
),
|
||||
6=>array(
|
||||
'module'=>'poll',
|
||||
'subMenu'=>array('poll'),
|
||||
),
|
||||
7=>array(
|
||||
),
|
||||
7=>array(
|
||||
'module'=>'rss',
|
||||
'subMenu'=>array('rss'),
|
||||
),
|
||||
8=>array(
|
||||
),
|
||||
8=>array(
|
||||
'module'=>'module',
|
||||
'subMenu'=>array('multilingual'),
|
||||
),
|
||||
9=>array(
|
||||
),
|
||||
9=>array(
|
||||
'module'=>'importer',
|
||||
'subMenu'=>array('importer'),
|
||||
),
|
||||
10=>array(
|
||||
),
|
||||
10=>array(
|
||||
'module'=>'trash',
|
||||
'subMenu'=>array('trash'),
|
||||
),
|
||||
11=>array(
|
||||
),
|
||||
11=>array(
|
||||
'module'=>'autoinstall',
|
||||
'subMenu'=>array('easyInstall'),
|
||||
),
|
||||
12=>array(
|
||||
),
|
||||
12=>array(
|
||||
'module'=>'layout',
|
||||
'subMenu'=>array('installedLayout'),
|
||||
),
|
||||
13=>array(
|
||||
),
|
||||
13=>array(
|
||||
'module'=>'module',
|
||||
'subMenu'=>array('installedModule'),
|
||||
),
|
||||
14=>array(
|
||||
),
|
||||
14=>array(
|
||||
'module'=>'widget',
|
||||
'subMenu'=>array('installedWidget'),
|
||||
),
|
||||
15=>array(
|
||||
),
|
||||
15=>array(
|
||||
'module'=>'addon',
|
||||
'subMenu'=>array('installedAddon'),
|
||||
),
|
||||
16=>array(
|
||||
),
|
||||
16=>array(
|
||||
'module'=>'editor',
|
||||
'subMenu'=>array('editor'),
|
||||
),
|
||||
17=>array(
|
||||
),
|
||||
17=>array(
|
||||
'module'=>'spamfilter',
|
||||
'subMenu'=>array('spamFilter'),
|
||||
),
|
||||
18=>array(
|
||||
),
|
||||
18=>array(
|
||||
'module'=>'admin',
|
||||
'subMenu'=>array('adminConfigurationGeneral', 'adminConfigurationFtp', 'adminMenuSetup'),
|
||||
),
|
||||
19=>array(
|
||||
),
|
||||
19=>array(
|
||||
'module'=>'file',
|
||||
'subMenu'=>array('fileUpload'),
|
||||
),
|
||||
20=>array(
|
||||
),
|
||||
20=>array(
|
||||
'module'=>'module',
|
||||
'subMenu'=>array('filebox'),
|
||||
),
|
||||
21=>array(
|
||||
),
|
||||
21=>array(
|
||||
'module'=>'point',
|
||||
'subMenu'=>array('point')
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$oMemberModel = &getModel('member');
|
||||
$output = $oMemberModel->getAdminGroup(array('group_srl'));
|
||||
$adminGroupSrl = $output->group_srl;
|
||||
$oMemberModel = &getModel('member');
|
||||
$output = $oMemberModel->getAdminGroup(array('group_srl'));
|
||||
$adminGroupSrl = $output->group_srl;
|
||||
|
||||
// gnb sub item create
|
||||
// common argument setting
|
||||
$args->menu_srl = $menuSrl;
|
||||
$args->open_window = 'N';
|
||||
$args->expand = 'N';
|
||||
$args->normal_btn = '';
|
||||
$args->hover_btn = '';
|
||||
$args->active_btn = '';
|
||||
$args->group_srls = $adminGroupSrl;
|
||||
$oModuleModel = &getModel('module');
|
||||
// gnb sub item create
|
||||
// common argument setting
|
||||
$args->menu_srl = $menuSrl;
|
||||
$args->open_window = 'N';
|
||||
$args->expand = 'N';
|
||||
$args->normal_btn = '';
|
||||
$args->hover_btn = '';
|
||||
$args->active_btn = '';
|
||||
$args->group_srls = $adminGroupSrl;
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
foreach($gnbModuleList AS $key=>$value)
|
||||
foreach($gnbModuleList AS $key=>$value)
|
||||
{
|
||||
if(is_array($value['subMenu']))
|
||||
{
|
||||
if(is_array($value['subMenu']))
|
||||
$moduleActionInfo = $oModuleModel->getModuleActionXml($value['module']);
|
||||
foreach($value['subMenu'] AS $key2=>$value2)
|
||||
{
|
||||
$moduleActionInfo = $oModuleModel->getModuleActionXml($value['module']);
|
||||
foreach($value['subMenu'] AS $key2=>$value2)
|
||||
{
|
||||
$gnbKey = "'".$this->_getGnbKey($value2)."'";
|
||||
$gnbKey = "'".$this->_getGnbKey($value2)."'";
|
||||
|
||||
//insert menu item
|
||||
$args->menu_item_srl = getNextSequence();
|
||||
$args->parent_srl = $gnbDBList[$gnbKey];
|
||||
$args->name = '{$lang->menu_gnb_sub[\''.$value2.'\']}';
|
||||
$args->url = 'index.php?module=admin&act='.$moduleActionInfo->menu->{$value2}->index;
|
||||
$args->listorder = -1*$args->menu_item_srl;
|
||||
$output = executeQuery('menu.insertMenuItem', $args);
|
||||
}
|
||||
//insert menu item
|
||||
$args->menu_item_srl = getNextSequence();
|
||||
$args->parent_srl = $gnbDBList[$gnbKey];
|
||||
$args->name = '{$lang->menu_gnb_sub[\''.$value2.'\']}';
|
||||
$args->url = 'index.php?module=admin&act='.$moduleActionInfo->menu->{$value2}->index;
|
||||
$args->listorder = -1*$args->menu_item_srl;
|
||||
$output = executeQuery('menu.insertMenuItem', $args);
|
||||
}
|
||||
}
|
||||
|
||||
$oMenuAdminConroller = &getAdminController('menu');
|
||||
$oMenuAdminConroller->makeXmlFile($menuSrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return parent menu key by child menu
|
||||
* @return string
|
||||
*/
|
||||
function _getGnbKey($menuName)
|
||||
$oMenuAdminConroller = &getAdminController('menu');
|
||||
$oMenuAdminConroller->makeXmlFile($menuSrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return parent menu key by child menu
|
||||
* @return string
|
||||
*/
|
||||
function _getGnbKey($menuName)
|
||||
{
|
||||
switch($menuName)
|
||||
{
|
||||
switch($menuName) {
|
||||
case 'siteMap':
|
||||
case 'siteDesign':
|
||||
return 'menu';
|
||||
break;
|
||||
case 'userList':
|
||||
case 'userSetting':
|
||||
case 'userGroup':
|
||||
case 'point':
|
||||
return 'user';
|
||||
break;
|
||||
case 'document':
|
||||
case 'comment':
|
||||
case 'trackback':
|
||||
case 'file':
|
||||
case 'poll':
|
||||
case 'rss':
|
||||
case 'multilingual':
|
||||
case 'importer':
|
||||
case 'trash':
|
||||
case 'spamFilter':
|
||||
return 'content';
|
||||
break;
|
||||
case 'easyInstall':
|
||||
case 'installedLayout':
|
||||
case 'installedModule':
|
||||
case 'installedWidget':
|
||||
case 'installedAddon':
|
||||
case 'editor':
|
||||
return 'advanced';
|
||||
break;
|
||||
case 'adminConfigurationGeneral':
|
||||
case 'adminConfigurationFtp':
|
||||
case 'adminMenuSetup':
|
||||
case 'fileUpload':
|
||||
case 'filebox':
|
||||
return 'configuration';
|
||||
break;
|
||||
default:
|
||||
return 'advanced';
|
||||
case 'siteMap':
|
||||
case 'siteDesign':
|
||||
return 'menu';
|
||||
break;
|
||||
case 'userList':
|
||||
case 'userSetting':
|
||||
case 'userGroup':
|
||||
case 'point':
|
||||
return 'user';
|
||||
break;
|
||||
case 'document':
|
||||
case 'comment':
|
||||
case 'trackback':
|
||||
case 'file':
|
||||
case 'poll':
|
||||
case 'rss':
|
||||
case 'multilingual':
|
||||
case 'importer':
|
||||
case 'trash':
|
||||
case 'spamFilter':
|
||||
return 'content';
|
||||
break;
|
||||
case 'easyInstall':
|
||||
case 'installedLayout':
|
||||
case 'installedModule':
|
||||
case 'installedWidget':
|
||||
case 'installedAddon':
|
||||
case 'editor':
|
||||
return 'advanced';
|
||||
break;
|
||||
case 'adminConfigurationGeneral':
|
||||
case 'adminConfigurationFtp':
|
||||
case 'adminMenuSetup':
|
||||
case 'fileUpload':
|
||||
case 'filebox':
|
||||
return 'configuration';
|
||||
break;
|
||||
default:
|
||||
return 'advanced';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return parent old menu key by child menu
|
||||
* @return string
|
||||
*/
|
||||
function _getOldGnbKey($menuName)
|
||||
{
|
||||
switch($menuName)
|
||||
{
|
||||
case 'siteMap':
|
||||
return 'menu';
|
||||
break;
|
||||
case 'userList':
|
||||
case 'userSetting':
|
||||
case 'userGroup':
|
||||
case 'point':
|
||||
return 'user';
|
||||
break;
|
||||
case 'document':
|
||||
case 'comment':
|
||||
case 'trackback':
|
||||
case 'file':
|
||||
case 'poll':
|
||||
case 'rss':
|
||||
case 'multilingual':
|
||||
case 'importer':
|
||||
case 'trash':
|
||||
return 'content';
|
||||
break;
|
||||
case 'easyInstall':
|
||||
case 'installedLayout':
|
||||
case 'installedModule':
|
||||
case 'installedWidget':
|
||||
case 'installedAddon':
|
||||
case 'editor':
|
||||
case 'spamFilter':
|
||||
return 'extensions';
|
||||
break;
|
||||
case 'adminConfigurationGeneral':
|
||||
case 'adminConfigurationFtp':
|
||||
case 'adminMenuSetup':
|
||||
case 'fileUpload':
|
||||
case 'filebox':
|
||||
return 'configuration';
|
||||
break;
|
||||
default:
|
||||
return 'user_added_menu';
|
||||
}
|
||||
}
|
||||
|
||||
private function _oldAdminmenuDelete()
|
||||
{
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
|
||||
$output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName);
|
||||
$newAdminmenuSrl = $output->menu_srl;
|
||||
$output = $oMenuAdminModel->getMenuItems($newAdminmenuSrl, 0);
|
||||
$newAdminParentMenuList = array();
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data AS $key=>$value)
|
||||
{
|
||||
$tmp = explode('\'', $value->name);
|
||||
$newAdminParentMenuList[$tmp[1]] = $value;
|
||||
}
|
||||
}
|
||||
unset($output);
|
||||
|
||||
/**
|
||||
* Return parent old menu key by child menu
|
||||
* @return string
|
||||
*/
|
||||
function _getOldGnbKey($menuName)
|
||||
// old admin menu
|
||||
$output = $oMenuAdminModel->getMenuByTitle('__XE_ADMIN__');
|
||||
$menuSrl = $output->menu_srl;
|
||||
|
||||
if($menuSrl)
|
||||
{
|
||||
switch($menuName) {
|
||||
case 'siteMap':
|
||||
return 'menu';
|
||||
break;
|
||||
case 'userList':
|
||||
case 'userSetting':
|
||||
case 'userGroup':
|
||||
case 'point':
|
||||
return 'user';
|
||||
break;
|
||||
case 'document':
|
||||
case 'comment':
|
||||
case 'trackback':
|
||||
case 'file':
|
||||
case 'poll':
|
||||
case 'rss':
|
||||
case 'multilingual':
|
||||
case 'importer':
|
||||
case 'trash':
|
||||
return 'content';
|
||||
break;
|
||||
case 'easyInstall':
|
||||
case 'installedLayout':
|
||||
case 'installedModule':
|
||||
case 'installedWidget':
|
||||
case 'installedAddon':
|
||||
case 'editor':
|
||||
case 'spamFilter':
|
||||
return 'extensions';
|
||||
break;
|
||||
case 'adminConfigurationGeneral':
|
||||
case 'adminConfigurationFtp':
|
||||
case 'adminMenuSetup':
|
||||
case 'fileUpload':
|
||||
case 'filebox':
|
||||
return 'configuration';
|
||||
break;
|
||||
default:
|
||||
return 'user_added_menu';
|
||||
}
|
||||
}
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
|
||||
private function _oldAdminmenuDelete()
|
||||
{
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
|
||||
$output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName);
|
||||
$newAdminmenuSrl = $output->menu_srl;
|
||||
$output = $oMenuAdminModel->getMenuItems($newAdminmenuSrl, 0);
|
||||
$newAdminParentMenuList = array();
|
||||
$output = $oMenuAdminModel->getMenuItems($menuSrl);
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data AS $key=>$value)
|
||||
$parentMenu = array();
|
||||
foreach($output->data AS $key=>$menuItem)
|
||||
{
|
||||
$tmp = explode('\'', $value->name);
|
||||
$newAdminParentMenuList[$tmp[1]] = $value;
|
||||
}
|
||||
}
|
||||
unset($output);
|
||||
|
||||
// old admin menu
|
||||
$output = $oMenuAdminModel->getMenuByTitle('__XE_ADMIN__');
|
||||
$menuSrl = $output->menu_srl;
|
||||
|
||||
if($menuSrl)
|
||||
{
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
|
||||
$output = $oMenuAdminModel->getMenuItems($menuSrl);
|
||||
if(is_array($output->data))
|
||||
{
|
||||
$parentMenu = array();
|
||||
foreach($output->data AS $key=>$menuItem)
|
||||
if($menuItem->parent_srl == 0)
|
||||
{
|
||||
if($menuItem->parent_srl == 0)
|
||||
{
|
||||
$tmp = explode('\'', $menuItem->name);
|
||||
$parentMenuKey = $tmp[1];
|
||||
$parentMenu[$menuItem->menu_item_srl] = $parentMenuKey;
|
||||
}
|
||||
$tmp = explode('\'', $menuItem->name);
|
||||
$parentMenuKey = $tmp[1];
|
||||
$parentMenu[$menuItem->menu_item_srl] = $parentMenuKey;
|
||||
}
|
||||
}
|
||||
|
||||
$isUserAddedMenuMoved = false;
|
||||
foreach($output->data AS $key=>$menuItem)
|
||||
$isUserAddedMenuMoved = false;
|
||||
foreach($output->data AS $key=>$menuItem)
|
||||
{
|
||||
if($menuItem->parent_srl != 0)
|
||||
{
|
||||
if($menuItem->parent_srl != 0)
|
||||
{
|
||||
$tmp = explode('\'', $menuItem->name);
|
||||
$menuKey = $tmp[1];
|
||||
$tmp = explode('\'', $menuItem->name);
|
||||
$menuKey = $tmp[1];
|
||||
|
||||
$result = $this->_getOldGnbKey($menuKey);
|
||||
if($result == 'user_added_menu')
|
||||
$result = $this->_getOldGnbKey($menuKey);
|
||||
if($result == 'user_added_menu')
|
||||
{
|
||||
// theme menu use not anymore
|
||||
/*if($parentMenu[$menuItem->parent_srl] == 'theme')
|
||||
{
|
||||
$newParentItem = $newAdminParentMenuList['menu'];
|
||||
}
|
||||
else*/
|
||||
if($parentMenu[$menuItem->parent_srl] == 'extensions')
|
||||
{
|
||||
// theme menu use not anymore
|
||||
/*if($parentMenu[$menuItem->parent_srl] == 'theme')
|
||||
{
|
||||
$newParentItem = $newAdminParentMenuList['menu'];
|
||||
}
|
||||
else*/
|
||||
if($parentMenu[$menuItem->parent_srl] == 'extensions')
|
||||
{
|
||||
$newParentItem = $newAdminParentMenuList['advanced'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$newParentItem = $newAdminParentMenuList[$parentMenu[$menuItem->parent_srl]];
|
||||
}
|
||||
$menuItem->menu_srl = $newParentItem->menu_srl;
|
||||
$menuItem->parent_srl = $newParentItem->menu_item_srl;
|
||||
|
||||
$output = executeQuery('menu.updateMenuItem', $menuItem);
|
||||
$isUserAddedMenuMoved = true;
|
||||
$newParentItem = $newAdminParentMenuList['advanced'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$newParentItem = $newAdminParentMenuList[$parentMenu[$menuItem->parent_srl]];
|
||||
}
|
||||
$menuItem->menu_srl = $newParentItem->menu_srl;
|
||||
$menuItem->parent_srl = $newParentItem->menu_item_srl;
|
||||
|
||||
if($isUserAddedMenuMoved)
|
||||
{
|
||||
$oMenuAdminController->makeXmlFile($newAdminmenuSrl);
|
||||
$output = executeQuery('menu.updateMenuItem', $menuItem);
|
||||
$isUserAddedMenuMoved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oMenuAdminController->deleteMenu($menuSrl);
|
||||
if($isUserAddedMenuMoved)
|
||||
{
|
||||
$oMenuAdminController->makeXmlFile($newAdminmenuSrl);
|
||||
}
|
||||
}
|
||||
|
||||
$oMenuAdminController->deleteMenu($menuSrl);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
}
|
||||
/* End of file admin.class.php */
|
||||
/* Location: ./modules/admin/admin.class.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue