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:
ovclas 2012-11-15 08:48:11 +00:00
parent 376dc12c9c
commit db5e4b2ff0
4 changed files with 1873 additions and 1808 deletions

View file

@ -1,17 +1,19 @@
<?php <?php
/** /**
* adminAdminController class * adminAdminController class
* admin controller class of admin module * admin controller class of admin module
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @package /modules/admin * @package /modules/admin
* @version 0.1 * @version 0.1
*/ */
class adminAdminController extends admin { class adminAdminController extends admin
{
/** /**
* initialization * initialization
* @return void * @return void
*/ */
function init() { function init()
{
// forbit access if the user is not an administrator // forbit access if the user is not an administrator
$oMemberModel = &getModel('member'); $oMemberModel = &getModel('member');
$logged_info = $oMemberModel->getLoggedInfo(); $logged_info = $oMemberModel->getLoggedInfo();
@ -22,13 +24,14 @@
* Admin menu reset * Admin menu reset
* @return void * @return void
*/ */
function procAdminMenuReset(){ function procAdminMenuReset()
{
$menuSrl = Context::get('menu_srl'); $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); $output = $oMenuAdminController->deleteMenu($menuSrl);
if (!$output->toBool()) return $output; if(!$output->toBool()) return $output;
FileHandler::removeDir('./files/cache/menu/admin_lang/'); FileHandler::removeDir('./files/cache/menu/admin_lang/');
@ -39,7 +42,8 @@
* Regenerate all cache files * Regenerate all cache files
* @return void * @return void
*/ */
function procAdminRecompileCacheFile() { function procAdminRecompileCacheFile()
{
// rename cache dir // rename cache dir
$temp_cache_dir = './files/cache_'. time(); $temp_cache_dir = './files/cache_'. time();
FileHandler::rename('./files/cache', $temp_cache_dir); FileHandler::rename('./files/cache', $temp_cache_dir);
@ -54,7 +58,8 @@
$module_list = $oModuleModel->getModuleList(); $module_list = $oModuleModel->getModuleList();
// call recompileCache for each module // call recompileCache for each module
foreach($module_list as $module) { foreach($module_list as $module)
{
$oModule = null; $oModule = null;
$oModule = &getClass($module->module); $oModule = &getClass($module->module);
if(method_exists($oModule, 'recompileCache')) $oModule->recompileCache(); if(method_exists($oModule, 'recompileCache')) $oModule->recompileCache();
@ -65,23 +70,27 @@
$oObjectCacheHandler = &CacheHandler::getInstance('object'); $oObjectCacheHandler = &CacheHandler::getInstance('object');
$oTemplateCacheHandler = &CacheHandler::getInstance('template'); $oTemplateCacheHandler = &CacheHandler::getInstance('template');
if($oObjectCacheHandler->isSupport()){ if($oObjectCacheHandler->isSupport())
{
$truncated[] = $oObjectCacheHandler->truncate(); $truncated[] = $oObjectCacheHandler->truncate();
} }
if($oTemplateCacheHandler->isSupport()){ if($oTemplateCacheHandler->isSupport())
{
$truncated[] = $oTemplateCacheHandler->truncate(); $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 // 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){ if($tmp_cache_list)
foreach($tmp_cache_list as $tmp_dir){ {
foreach($tmp_cache_list as $tmp_dir)
{
if($tmp_dir) FileHandler::removeDir('./files/'.$tmp_dir); if($tmp_dir) FileHandler::removeDir('./files/'.$tmp_dir);
} }
} }
@ -93,7 +102,6 @@
$db = &DB::getInstance(); $db = &DB::getInstance();
$db->deleteDuplicateIndexes(); $db->deleteDuplicateIndexes();
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
} }
@ -101,7 +109,8 @@
* Logout * Logout
* @return void * @return void
*/ */
function procAdminLogout() { function procAdminLogout()
{
$oMemberController = &getController('member'); $oMemberController = &getController('member');
$oMemberController->procMemberLogout(); $oMemberController->procMemberLogout();
@ -138,7 +147,7 @@
$layoutTarget = 'layout_srl'; $layoutTarget = 'layout_srl';
$skinTarget = 'skin'; $skinTarget = 'skin';
if ($vars->target_type == 'M') if($vars->target_type == 'M')
{ {
$layoutTarget = 'mlayout_srl'; $layoutTarget = 'mlayout_srl';
$skinTarget = 'mskin'; $skinTarget = 'mskin';
@ -209,16 +218,15 @@
// check favorite exists // check favorite exists
$oModel = &getAdminModel('admin'); $oModel = &getAdminModel('admin');
$output = $oModel->isExistsFavorite($siteSrl, $moduleName); $output = $oModel->isExistsFavorite($siteSrl, $moduleName);
if (!$output->toBool()) return $output; if(!$output->toBool()) return $output;
// if exists, delete favorite // if exists, delete favorite
if ($output->get('result')) if($output->get('result'))
{ {
$favoriteSrl = $output->get('favoriteSrl'); $favoriteSrl = $output->get('favoriteSrl');
$output = $this->_deleteFavorite($favoriteSrl); $output = $this->_deleteFavorite($favoriteSrl);
$result = 'off'; $result = 'off';
} }
// if not exists, insert favorite // if not exists, insert favorite
else else
{ {
@ -226,7 +234,7 @@
$result = 'on'; $result = 'on';
} }
if (!$output->toBool()) return $output; if(!$output->toBool()) return $output;
$this->add('result', $result); $this->add('result', $result);
@ -402,12 +410,16 @@
function procAdminRemoveIcons(){ function procAdminRemoveIcons(){
$iconname = Context::get('iconname'); $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) { if($file_exist)
{
@FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$iconname); @FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$iconname);
} else { }
else
{
return new Object(-1,'fail_to_delete'); 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 */

View file

@ -1,13 +1,13 @@
<?php <?php
/** /**
* adminAdminModel class * adminAdminModel class
* admin model class of admin module * admin model class of admin module
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @package /modules/admin * @package /modules/admin
* @version 0.1 * @version 0.1
*/ */
class adminAdminModel extends admin class adminAdminModel extends admin
{ {
/** /**
* Ftp root path * Ftp root path
* @var string * @var string
@ -207,7 +207,8 @@
$dh = @opendir($curpwd); $dh = @opendir($curpwd);
if(!$dh) return new Object(-1, 'msg_ftp_invalid_path'); if(!$dh) return new Object(-1, 'msg_ftp_invalid_path');
$list = array(); $list = array();
while(($file = readdir($dh)) !== false) { while(($file = readdir($dh)) !== false)
{
if(is_dir($curpwd.$file)) if(is_dir($curpwd.$file))
{ {
$file .= "/"; $file .= "/";
@ -258,8 +259,10 @@
} }
$oFtp = new ftp(); $oFtp = new ftp();
if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)){ if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) { {
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
{
$_list = $oFtp->ftp_rawlist($this->pwd); $_list = $oFtp->ftp_rawlist($this->pwd);
$oFtp->ftp_quit(); $oFtp->ftp_quit();
} }
@ -270,8 +273,10 @@
} }
$list = array(); $list = array();
if($_list){ if($_list)
foreach($_list as $k => $v){ {
foreach($_list as $k => $v)
{
$src = null; $src = null;
$src->data = $v; $src->data = $v;
$res = Context::convertEncoding($src); $res = Context::convertEncoding($src);
@ -291,8 +296,8 @@
* @param string $type 'WORKING', 'INSTALL' * @param string $type 'WORKING', 'INSTALL'
* @return string * @return string
*/ */
function getEnv($type='WORKING') { function getEnv($type='WORKING')
{
$skip = array( $skip = array(
'ext' => array('pcre','json','hash','dom','session','spl','standard','date','ctype','tokenizer','apache2handler','filter','posix','reflection','pdo') 'ext' => array('pcre','json','hash','dom','session','spl','standard','date','ctype','tokenizer','apache2handler','filter','posix','reflection','pdo')
,'module' => array('addon','admin','autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget') ,'module' => array('addon','admin','autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget')
@ -315,7 +320,8 @@
$info['use_ssl'] = $db_info->use_ssl; $info['use_ssl'] = $db_info->use_ssl;
$info['phpext'] = ''; $info['phpext'] = '';
foreach (get_loaded_extensions() as $ext) { foreach (get_loaded_extensions() as $ext)
{
$ext = strtolower($ext); $ext = strtolower($ext);
if(in_array($ext, $skip['ext'])) continue; if(in_array($ext, $skip['ext'])) continue;
$info['phpext'] .= '|'. $ext; $info['phpext'] .= '|'. $ext;
@ -325,7 +331,8 @@
$info['module'] = ''; $info['module'] = '';
$oModuleModel = &getModel('module'); $oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList(); $module_list = $oModuleModel->getModuleList();
foreach($module_list as $module){ foreach($module_list as $module)
{
if(in_array($module->module, $skip['module'])) continue; if(in_array($module->module, $skip['module'])) continue;
$info['module'] .= '|'.$module->module; $info['module'] .= '|'.$module->module;
} }
@ -334,14 +341,16 @@
$info['addon'] = ''; $info['addon'] = '';
$oAddonAdminModel = &getAdminModel('addon'); $oAddonAdminModel = &getAdminModel('addon');
$addon_list = $oAddonAdminModel->getAddonList(); $addon_list = $oAddonAdminModel->getAddonList();
foreach($addon_list as $addon){ foreach($addon_list as $addon)
{
if(in_array($addon->addon, $skip['addon'])) continue; if(in_array($addon->addon, $skip['addon'])) continue;
$info['addon'] .= '|'.$addon->addon; $info['addon'] .= '|'.$addon->addon;
} }
$info['addon'] = substr($info['addon'],1); $info['addon'] = substr($info['addon'],1);
$param = ''; $param = '';
foreach($info as $k => $v){ foreach($info as $k => $v)
{
if($v) $param .= sprintf('&%s=%s',$k,urlencode($v)); if($v) $param .= sprintf('&%s=%s',$k,urlencode($v));
} }
$param = substr($param, 1); $param = substr($param, 1);
@ -353,13 +362,16 @@
* Return theme info list by theme directory list * Return theme info list by theme directory list
* @return array * @return array
*/ */
function getThemeList(){ function getThemeList()
{
$path = _XE_PATH_.'themes'; $path = _XE_PATH_.'themes';
$list = FileHandler::readDir($path); $list = FileHandler::readDir($path);
$theme_info = array(); $theme_info = array();
if(count($list) > 0){ if(count($list) > 0)
foreach($list as $val){ {
foreach($list as $val)
{
$theme_info[$val] = $this->getThemeInfo($val); $theme_info[$val] = $this->getThemeInfo($val);
} }
} }
@ -373,7 +385,8 @@
* @param array $layout_list * @param array $layout_list
* @return object * @return object
*/ */
function getThemeInfo($theme_name, $layout_list = null){ function getThemeInfo($theme_name, $layout_list = null)
{
if ($GLOBALS['__ThemeInfo__'][$theme_name]) return $GLOBALS['__ThemeInfo__'][$theme_name]; if ($GLOBALS['__ThemeInfo__'][$theme_name]) return $GLOBALS['__ThemeInfo__'][$theme_name];
$info_file = _XE_PATH_.'themes/'.$theme_name.'/conf/info.xml'; $info_file = _XE_PATH_.'themes/'.$theme_name.'/conf/info.xml';
@ -399,7 +412,8 @@
if(!is_array($xml_obj->publisher)) $publisher_list[] = $xml_obj->publisher; if(!is_array($xml_obj->publisher)) $publisher_list[] = $xml_obj->publisher;
else $publisher_list = $xml_obj->publisher; else $publisher_list = $xml_obj->publisher;
foreach($publisher_list as $publisher) { foreach($publisher_list as $publisher)
{
unset($publisher_obj); unset($publisher_obj);
$publisher_obj->name = $publisher->name->body; $publisher_obj->name = $publisher->name->body;
$publisher_obj->email_address = $publisher->attrs->email_address; $publisher_obj->email_address = $publisher->attrs->email_address;
@ -410,12 +424,15 @@
$layout = $xml_obj->layout; $layout = $xml_obj->layout;
$layout_path = $layout->directory->attrs->path; $layout_path = $layout->directory->attrs->path;
$layout_parse = explode('/',$layout_path); $layout_parse = explode('/',$layout_path);
switch($layout_parse[1]){ switch($layout_parse[1])
case 'themes' : { {
case 'themes' :
{
$layout_info->name = $theme_name.'|@|'.$layout_parse[count($layout_parse)-1]; $layout_info->name = $theme_name.'|@|'.$layout_parse[count($layout_parse)-1];
break; break;
} }
case 'layouts' : { case 'layouts' :
{
$layout_info->name = $layout_parse[count($layout_parse)-1]; $layout_info->name = $layout_parse[count($layout_parse)-1];
break; break;
} }
@ -429,9 +446,12 @@
$oLayoutModel = &getModel('layout'); $oLayoutModel = &getModel('layout');
$layout_info_list = array(); $layout_info_list = array();
$layout_list = $oLayoutModel->getLayoutList($site_info->site_srl); $layout_list = $oLayoutModel->getLayoutList($site_info->site_srl);
if ($layout_list){ if($layout_list)
foreach($layout_list as $val){ {
if ($val->layout == $layout_info->name){ foreach($layout_list as $val)
{
if($val->layout == $layout_info->name)
{
$is_new_layout = false; $is_new_layout = false;
$layout_info->layout_srl = $val->layout_srl; $layout_info->layout_srl = $val->layout_srl;
break; break;
@ -439,7 +459,8 @@
} }
} }
if ($is_new_layout){ if ($is_new_layout)
{
$site_module_info = Context::get('site_module_info'); $site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl; $args->site_srl = (int)$site_module_info->site_srl;
$args->layout_srl = getNextSequence(); $args->layout_srl = getNextSequence();
@ -460,18 +481,22 @@
$oModuleModel = &getModel('module'); $oModuleModel = &getModel('module');
$skins = array(); $skins = array();
foreach($skin_list as $val){ foreach($skin_list as $val)
{
unset($skin_info); unset($skin_info);
unset($skin_parse); unset($skin_parse);
$skin_parse = explode('/',$val->directory->attrs->path); $skin_parse = explode('/',$val->directory->attrs->path);
switch($skin_parse[1]){ switch($skin_parse[1])
case 'themes' : { {
case 'themes' :
{
$is_theme = true; $is_theme = true;
$module_name = $skin_parse[count($skin_parse)-1]; $module_name = $skin_parse[count($skin_parse)-1];
$skin_info->name = $theme_name.'|@|'.$module_name; $skin_info->name = $theme_name.'|@|'.$module_name;
break; break;
} }
case 'modules' : { case 'modules' :
{
$is_theme = false; $is_theme = false;
$module_name = $skin_parse[2]; $module_name = $skin_parse[2];
$skin_info->name = $skin_parse[count($skin_parse)-1]; $skin_info->name = $skin_parse[count($skin_parse)-1];
@ -482,8 +507,10 @@
$skin_info->is_theme = $is_theme; $skin_info->is_theme = $is_theme;
$skins[$module_name] = $skin_info; $skins[$module_name] = $skin_info;
if ($is_theme){ if($is_theme)
if (!$GLOBALS['__ThemeModuleSkin__'][$module_name]){ {
if(!$GLOBALS['__ThemeModuleSkin__'][$module_name])
{
$GLOBALS['__ThemeModuleSkin__'][$module_name] = array(); $GLOBALS['__ThemeModuleSkin__'][$module_name] = array();
$GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array(); $GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array();
$moduleInfo = $oModuleModel->getModuleInfoXml($module_name); $moduleInfo = $oModuleModel->getModuleInfoXml($module_name);
@ -513,11 +540,14 @@
$exceptionModule = array('editor', 'poll', 'homepage', 'textyle'); $exceptionModule = array('editor', 'poll', 'homepage', 'textyle');
$oModuleModel = &getModel('module'); $oModuleModel = &getModel('module');
foreach($searched_list as $val) { foreach($searched_list as $val)
{
$skin_list = $oModuleModel->getSkins('./modules/'.$val); $skin_list = $oModuleModel->getSkins('./modules/'.$val);
if (is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule)){ if(is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule))
if(!$GLOBALS['__ThemeModuleSkin__'][$val]){ {
if(!$GLOBALS['__ThemeModuleSkin__'][$val])
{
$GLOBALS['__ThemeModuleSkin__'][$val] = array(); $GLOBALS['__ThemeModuleSkin__'][$val] = array();
$moduleInfo = $oModuleModel->getModuleInfoXml($val); $moduleInfo = $oModuleModel->getModuleInfoXml($val);
$GLOBALS['__ThemeModuleSkin__'][$val]['title'] = $moduleInfo->title; $GLOBALS['__ThemeModuleSkin__'][$val]['title'] = $moduleInfo->title;
@ -577,8 +607,8 @@
{ {
$args->site_srl = $siteSrl; $args->site_srl = $siteSrl;
$output = executeQueryArray('admin.getFavoriteList', $args); $output = executeQueryArray('admin.getFavoriteList', $args);
if (!$output->toBool()) return $output; if(!$output->toBool()) return $output;
if (!$output->data) return new Object(); if(!$output->data) return new Object();
if($isGetModuleInfo && is_array($output->data)) if($isGetModuleInfo && is_array($output->data))
{ {
@ -610,7 +640,7 @@
if (!$output->toBool()) return $output; if (!$output->toBool()) return $output;
$returnObject = new Object(); $returnObject = new Object();
if ($output->data) if($output->data)
{ {
$returnObject->add('result', true); $returnObject->add('result', true);
$returnObject->add('favoriteSrl', $output->data->admin_favorite_srl); $returnObject->add('favoriteSrl', $output->data->admin_favorite_srl);
@ -705,11 +735,16 @@
function iconUrlCheck($iconname,$default_icon_name) function iconUrlCheck($iconname,$default_icon_name)
{ {
$file_exsit = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$iconname); $file_exsit = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$iconname);
if(!$file_exsit){ if(!$file_exsit)
{
$icon_url = './modules/admin/tpl/img/'.$default_icon_name ; $icon_url = './modules/admin/tpl/img/'.$default_icon_name ;
} else { }
else
{
$icon_url = $db_info->default_url.'files/attach/xeicon/'.$iconname; $icon_url = $db_info->default_url.'files/attach/xeicon/'.$iconname;
} }
return $icon_url; return $icon_url;
} }
} }
/* End of file admin.admin.model.php */
/* Location: ./modules/admin/admin.admin.model.php */

View file

@ -1,5 +1,5 @@
<?php <?php
/** /**
* adminAdminView class * adminAdminView class
* Admin view class of admin module * Admin view class of admin module
* *
@ -7,7 +7,8 @@
* @package /modules/admin * @package /modules/admin
* @version 0.1 * @version 0.1
*/ */
class adminAdminView extends admin { class adminAdminView extends admin
{
/** /**
* layout list * layout list
* @var array * @var array
@ -23,7 +24,8 @@
* Initilization * Initilization
* @return void * @return void
*/ */
function init() { function init()
{
// forbit access if the user is not an administrator // forbit access if the user is not an administrator
$oMemberModel = &getModel('member'); $oMemberModel = &getModel('member');
$logged_info = $oMemberModel->getLoggedInfo(); $logged_info = $oMemberModel->getLoggedInfo();
@ -138,7 +140,8 @@
foreach((array)$menu->list as $parentKey=>$parentMenu) foreach((array)$menu->list as $parentKey=>$parentMenu)
{ {
if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) continue; if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) continue;
if($parentMenu['href'] == '#' && count($parentMenu['list'])) { if($parentMenu['href'] == '#' && count($parentMenu['list']))
{
$firstChild = current($parentMenu['list']); $firstChild = current($parentMenu['list']);
$menu->list[$parentKey]['href'] = $firstChild['href']; $menu->list[$parentKey]['href'] = $firstChild['href'];
} }
@ -169,22 +172,26 @@
// move from index method, because use in admin footer // 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_); $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_); $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()) { 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 // 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 // Ensure to access the administration page even though news cannot be displayed
FileHandler::writeFile($cache_file,''); FileHandler::writeFile($cache_file,'');
FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL'=>getFullUrl(''))); FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL'=>getFullUrl('')));
} }
if(file_exists($cache_file)) { if(file_exists($cache_file))
{
$oXml = new XmlParser(); $oXml = new XmlParser();
$buff = $oXml->parse(FileHandler::readFile($cache_file)); $buff = $oXml->parse(FileHandler::readFile($cache_file));
$item = $buff->zbxe_news->item; $item = $buff->zbxe_news->item;
if($item) { if($item)
{
if(!is_array($item)) $item = array($item); if(!is_array($item)) $item = array($item);
foreach($item as $key => $val) { foreach($item as $key => $val)
{
$obj = null; $obj = null;
$obj->title = $val->body; $obj->title = $val->body;
$obj->date = $val->attrs->date; $obj->date = $val->attrs->date;
@ -201,7 +208,6 @@
Context::set('download_link', $buff->zbxe_news->attrs->download_link); Context::set('download_link', $buff->zbxe_news->attrs->download_link);
} }
Context::set('subMenuTitle', $subMenuTitle); Context::set('subMenuTitle', $subMenuTitle);
Context::set('gnbUrlList', $menu->list); Context::set('gnbUrlList', $menu->list);
Context::set('parentSrl', $parentSrl); Context::set('parentSrl', $parentSrl);
@ -213,7 +219,8 @@
* Display Super Admin Dashboard * Display Super Admin Dashboard
* @return void * @return void
*/ */
function dispAdminIndex() { function dispAdminIndex()
{
// Get statistics // Get statistics
$args->date = date("Ymd000000", time()-60*60*24); $args->date = date("Ymd000000", time()-60*60*24);
$today = date("Ymd"); $today = date("Ymd");
@ -318,7 +325,8 @@
* Display Configuration(settings) page * Display Configuration(settings) page
* @return void * @return void
*/ */
function dispAdminConfigGeneral() { function dispAdminConfigGeneral()
{
Context::loadLang('modules/install/lang'); Context::loadLang('modules/install/lang');
$db_info = Context::getDBInfo(); $db_info = Context::getDBInfo();
@ -366,7 +374,8 @@
* Display FTP Configuration(settings) page * Display FTP Configuration(settings) page
* @return void * @return void
*/ */
function dispAdminConfigFtp() { function dispAdminConfigFtp()
{
Context::loadLang('modules/install/lang'); Context::loadLang('modules/install/lang');
$ftp_info = Context::getFTPInfo(); $ftp_info = Context::getFTPInfo();
@ -375,9 +384,8 @@
$this->setTemplateFile('config_ftp'); $this->setTemplateFile('config_ftp');
// $security = new Security(); //$security = new Security();
// $security->encodeHTML('ftp_info..'); //$security->encodeHTML('ftp_info..');
} }
/** /**
@ -404,7 +412,8 @@
* Enviroment information send to XE collect server * Enviroment information send to XE collect server
* @return void * @return void
*/ */
function showSendEnv() { function showSendEnv()
{
if(Context::getResponseMethod() != 'HTML') return; if(Context::getResponseMethod() != 'HTML') return;
$server = 'http://collect.xpressengine.com/env/img.php?'; $server = 'http://collect.xpressengine.com/env/img.php?';
@ -412,7 +421,8 @@
$install_env = $path . 'install'; $install_env = $path . 'install';
$mainVersion = join('.', array_slice(explode('.', __ZBXE_VERSION__), 0, 2)); $mainVersion = join('.', array_slice(explode('.', __ZBXE_VERSION__), 0, 2));
if(file_exists(FileHandler::getRealPath($install_env))) { if(file_exists(FileHandler::getRealPath($install_env)))
{
$oAdminAdminModel = &getAdminModel('admin'); $oAdminAdminModel = &getAdminModel('admin');
$params = $oAdminAdminModel->getEnv('INSTALL'); $params = $oAdminAdminModel->getEnv('INSTALL');
$img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params);
@ -420,7 +430,6 @@
FileHandler::removeDir($path); FileHandler::removeDir($path);
FileHandler::writeFile($path.$mainVersion,'1'); FileHandler::writeFile($path.$mainVersion,'1');
} }
else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path.$mainVersion))) else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path.$mainVersion)))
{ {
@ -437,5 +446,6 @@
unset($_SESSION['enviroment_gather']); unset($_SESSION['enviroment_gather']);
} }
} }
}
} /* End of file admin.admin.view.php */
/* Location: ./modules/admin/admin.admin.view.php */

View file

@ -1,5 +1,5 @@
<?php <?php
/** /**
* admin class * admin class
* Base class of admin module * Base class of admin module
* *
@ -7,7 +7,8 @@
* @package /modules/admin * @package /modules/admin
* @version 0.1 * @version 0.1
*/ */
class admin extends ModuleObject { class admin extends ModuleObject
{
private $adminMenuName = '__ADMINMENU_V17__'; private $adminMenuName = '__ADMINMENU_V17__';
public function getAdminMenuName() public function getAdminMenuName()
@ -19,7 +20,8 @@
* Install admin module * Install admin module
* @return Object * @return Object
*/ */
function moduleInstall() { function moduleInstall()
{
return new Object(); return new Object();
} }
@ -27,7 +29,8 @@
* If update is necessary it returns true * If update is necessary it returns true
* @return bool * @return bool
*/ */
function checkUpdate() { function checkUpdate()
{
$oDB = &DB::getInstance(); $oDB = &DB::getInstance();
if(!$oDB->isColumnExists("admin_favorite", "type")) return true; if(!$oDB->isColumnExists("admin_favorite", "type")) return true;
@ -38,7 +41,8 @@
* Update module * Update module
* @return Object * @return Object
*/ */
function moduleUpdate() { function moduleUpdate()
{
$oDB = &DB::getInstance(); $oDB = &DB::getInstance();
if(!$oDB->isColumnExists("admin_favorite", "type")) if(!$oDB->isColumnExists("admin_favorite", "type"))
{ {
@ -66,7 +70,8 @@
* Regenerate cache file * Regenerate cache file
* @return void * @return void
*/ */
function recompileCache() { function recompileCache()
{
} }
public function checkAdminMenu() public function checkAdminMenu()
@ -278,7 +283,8 @@
*/ */
function _getGnbKey($menuName) function _getGnbKey($menuName)
{ {
switch($menuName) { switch($menuName)
{
case 'siteMap': case 'siteMap':
case 'siteDesign': case 'siteDesign':
return 'menu'; return 'menu';
@ -327,7 +333,8 @@
*/ */
function _getOldGnbKey($menuName) function _getOldGnbKey($menuName)
{ {
switch($menuName) { switch($menuName)
{
case 'siteMap': case 'siteMap':
return 'menu'; return 'menu';
break; break;
@ -452,5 +459,6 @@
$oMenuAdminController->deleteMenu($menuSrl); $oMenuAdminController->deleteMenu($menuSrl);
} }
} }
} }
?> /* End of file admin.class.php */
/* Location: ./modules/admin/admin.class.php */