NOISSUE code rearrange

This commit is contained in:
ngleader 2013-11-22 06:46:26 +09:00
parent b146e48ff5
commit bc47f19615
22 changed files with 130 additions and 159 deletions

View file

@ -160,10 +160,7 @@ if($called_position == 'before_module_proc')
$tmp_arr = explode('/', $filename);
$filename = array_pop($tmp_arr);
if(!is_dir($tmp_uploaded_path))
{
FileHandler::makeDir($tmp_uploaded_path);
}
FileHandler::makeDir($tmp_uploaded_path);
$target_filename = sprintf('%s%s', $tmp_uploaded_path, $filename);
FileHandler::writeFile($target_filename, $filedata);

View file

@ -45,10 +45,7 @@ class CacheFile extends CacheBase
function CacheFile()
{
$this->cache_dir = _XE_PATH_ . $this->cache_dir;
if(!is_dir($this->cache_dir))
{
FileHandler::makeDir($this->cache_dir);
}
FileHandler::makeDir($this->cache_dir);
}
/**

View file

@ -254,7 +254,7 @@ class DB
{
if($value->enable)
{
array_push($enableList, $value);
$enableList[] = $value;
}
}
}
@ -281,7 +281,7 @@ class DB
{
if(!$value->enable)
{
array_push($disableList, $value);
$disableList[] = $value;
}
}
}
@ -712,10 +712,7 @@ class DB
}
$cache_path = sprintf('%s/%s%s', $this->count_cache_path, $this->prefix, $tables_str);
if(!is_dir($cache_path))
{
FileHandler::makeDir($cache_path);
}
FileHandler::makeDir($cache_path);
$cache_filename = sprintf('%s/%s.%s', $cache_path, $tables_str, $condition);
if(!file_exists($cache_filename))
@ -773,10 +770,7 @@ class DB
}
$cache_path = sprintf('%s/%s%s', $this->count_cache_path, $this->prefix, $tables_str);
if(!is_dir($cache_path))
{
FileHandler::makeDir($cache_path);
}
FileHandler::makeDir($cache_path);
$cache_filename = sprintf('%s/%s.%s', $cache_path, $tables_str, $condition);
@ -795,10 +789,7 @@ class DB
{
return FALSE;
}
if(!is_dir($this->count_cache_path))
{
return FileHandler::makeDir($this->count_cache_path);
}
return FileHandler::makeDir($this->count_cache_path);
if(!is_array($tables))
{

View file

@ -200,7 +200,7 @@ class DisplayHandler extends Handler
$queries_output = array(array('Query', 'Elapsed time', 'Result'));
foreach($GLOBALS['__db_queries__'] as $query)
{
array_push($queries_output, array($query['query'], sprintf('%0.5f', $query['elapsed_time']), $query['result']));
$queries_output[] = array($query['query'], sprintf('%0.5f', $query['elapsed_time']), $query['result']);
}
$firephp->fb(
array(
@ -214,6 +214,8 @@ class DisplayHandler extends Handler
}
else
{
$buff = "";
// display total execution time and Request/Response info
if(__DEBUG__ & 2)
{

View file

@ -84,17 +84,16 @@ class Purifier
$attributeList = array();
if(is_array($m[2]))
{
foreach($m[2] AS $key => $value)
foreach($m[2] as $key => $value)
{
unset($script, $m2);
$script = " {$m[2][$key]} editor_component={$m[3][$key]}";
preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2);
if(is_array($m2[1]))
if(preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2))
{
foreach($m2[1] AS $key2 => $value2)
foreach($m2[1] as $value2)
{
array_push($attributeList, $value2);
$attributeList[] = $value2;
}
}
}
@ -116,14 +115,13 @@ class Purifier
{
$content = str_replace('<img class="zbxe_widget_output"', '<img src="" class="zbxe_widget_output"', $content);
foreach($m[3] AS $key => $value)
foreach($m[3] as $key => $value)
{
preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $m[3][$key], $m2);
if(is_array($m2[1]))
if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $m[3][$key], $m2))
{
foreach($m2[1] AS $key2 => $value2)
foreach($m2[1] as $value2)
{
array_push($attributeList, $value2);
$attributeList[] = $value2;
}
}
}
@ -143,7 +141,7 @@ class Purifier
$i=1;
if(is_array($whiteIframeUrlList))
{
foreach($whiteIframeUrlList AS $key => $value)
foreach($whiteIframeUrlList as $value)
{
$whiteDomainRegex .= $value;
@ -163,10 +161,7 @@ class Purifier
{
// check htmlpurifier cache directory
$this->_cacheDir = _XE_PATH_ . 'files/cache/htmlpurifier';
if(!file_exists($this->_cacheDir))
{
FileHandler::makeDir($this->_cacheDir);
}
FileHandler::makeDir($this->_cacheDir);
}
public function purify(&$content)

View file

@ -32,7 +32,7 @@ class GeneralXmlParser
xml_parse($oParser, $input);
xml_parser_free($oParser);
if(!count($this->output))
if(count($this->output) < 1)
{
return;
}
@ -50,11 +50,12 @@ class GeneralXmlParser
*/
function _tagOpen($parser, $node_name, $attrs)
{
$obj = new stdClass();
$obj->node_name = strtolower($node_name);
$obj->attrs = $attrs;
$obj->childNodes = array();
array_push($this->output, $obj);
$this->output[] = $obj;
}
/**
@ -81,24 +82,22 @@ class GeneralXmlParser
$node_name = strtolower($node_name);
$cur_obj = array_pop($this->output);
$parent_obj = &$this->output[count($this->output) - 1];
$tmp_obj = &$parent_obj->childNodes[$node_name];
if($parent_obj->childNodes[$node_name])
if($tmp_obj)
{
$tmp_obj = $parent_obj->childNodes[$node_name];
if(is_array($tmp_obj))
{
array_push($parent_obj->childNodes[$node_name], $cur_obj);
$tmp_obj[] = $cur_obj;
}
else
{
$parent_obj->childNodes[$node_name] = array();
array_push($parent_obj->childNodes[$node_name], $tmp_obj);
array_push($parent_obj->childNodes[$node_name], $cur_obj);
$tmp_obj = array($tmp_obj, $cur_obj);
}
}
else
{
$parent_obj->childNodes[$node_name] = $cur_obj;
$tmp_obj = $cur_obj;
}
}

View file

@ -162,7 +162,7 @@ class XmlParser
$obj->node_name = strtolower($node_name);
$obj->attrs = $this->_arrToAttrsObj($attrs);
array_push($this->output, $obj);
$this->output[] = $obj;
}
/**
@ -203,13 +203,11 @@ class XmlParser
$tmp_obj = $parent_obj->{$node_name};
if(is_array($tmp_obj))
{
array_push($parent_obj->{$node_name}, $cur_obj);
$parent_obj->{$node_name}[] = $cur_obj;
}
else
{
$parent_obj->{$node_name} = array();
array_push($parent_obj->{$node_name}, $tmp_obj);
array_push($parent_obj->{$node_name}, $cur_obj);
$parent_obj->{$node_name} = array($tmp_obj, $cur_obj);
}
}
else

View file

@ -925,9 +925,9 @@ class commentController extends comment
if($comments->data)
{
$commentSrlList = array();
foreach($comments->data as $key => $comment)
foreach($comments->data as $comment)
{
array_push($commentSrlList, $comment->comment_srl);
$commentSrlList[] = $comment->comment_srl;
// call a trigger (before)
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
@ -1342,7 +1342,6 @@ class commentController extends comment
}
$commentSrls = Context::get('comment_srls');
if($commentSrls)
{
$commentSrlList = explode(',', $commentSrls);
@ -1355,7 +1354,7 @@ class commentController extends comment
if(is_array($commentList))
{
foreach($commentList AS $key => $value)
foreach($commentList as $value)
{
$value->content = strip_tags($value->content);
}
@ -1382,7 +1381,7 @@ class commentController extends comment
$oModuleController = getController('module');
if(is_array($obj->moduleSrlList))
{
foreach($obj->moduleSrlList AS $key => $moduleSrl)
foreach($obj->moduleSrlList as $moduleSrl)
{
$oModuleController->insertModulePartConfig('comment', $moduleSrl, $commentConfig);
}

View file

@ -639,10 +639,7 @@ class commentItem extends Object
$tmp_file = sprintf('./files/cache/tmp/%d', md5(rand(111111, 999999) . $this->comment_srl));
if(!is_dir('./files/cache/tmp'))
{
FileHandler::makeDir('./files/cache/tmp');
}
FileHandler::makeDir('./files/cache/tmp');
FileHandler::getRemoteFile($target_src, $tmp_file);

View file

@ -41,7 +41,7 @@ class documentAdminController extends document
$oDocumentController->deleteDocument($document_srl, true);
}
$this->setMessage( sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) );
$this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) );
}
/**
@ -91,7 +91,7 @@ class documentAdminController extends document
$files = $oDocument->getUploadedFiles();
if(is_array($files))
{
foreach($files as $key => $val)
foreach($files as $val)
{
$file_info = array();
$file_info['tmp_name'] = $val->uploaded_filename;
@ -214,7 +214,7 @@ class documentAdminController extends document
*/
function copyDocumentModule($document_srl_list, $module_srl, $category_srl)
{
if(!count($document_srl_list)) return;
if(count($document_srl_list) < 1) return;
$oDocumentModel = &getModel('document');
$oDocumentController = &getController('document');
@ -240,14 +240,14 @@ class documentAdminController extends document
$extraVarsListByDocumentSrl = array();
if(is_array($extraVarsList->data))
{
foreach($extraVarsList->data AS $key=>$value)
foreach($extraVarsList->data as $value)
{
if(!isset($extraVarsListByDocumentSrl[$value->document_srl]))
{
$extraVarsListByDocumentSrl[$value->document_srl] = array();
}
array_push($extraVarsListByDocumentSrl[$value->document_srl], $value);
$extraVarsListByDocumentSrl[$value->document_srl][] = $value;
}
}
@ -257,7 +257,6 @@ class documentAdminController extends document
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists()) continue;
$obj = null;
$obj = $oDocument->getObjectVars();
$extraVars = $extraVarsListByDocumentSrl[$document_srl];
@ -281,7 +280,7 @@ class documentAdminController extends document
if($oDocument->hasUploadedFiles())
{
$files = $oDocument->getUploadedFiles();
foreach($files as $key => $val)
foreach($files as $val)
{
$file_info = array();
$file_info['tmp_name'] = $val->uploaded_filename;
@ -315,7 +314,7 @@ class documentAdminController extends document
// copy multi language contents
if(is_array($extraVars))
{
foreach($extraVars AS $key=>$value)
foreach($extraVars as $value)
{
if($value->idx >= 0 && $value->lang_code == Context::getLangType())
{
@ -335,7 +334,7 @@ class documentAdminController extends document
$oCommentModel = &getModel('comment');
$comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999);
$comments = $comment_output->data;
if(count($comments))
if(count($comments) > 0)
{
$oCommentController = &getController('comment');
$success_count = 0;
@ -349,7 +348,7 @@ class documentAdminController extends document
if($comment_obj->uploaded_count)
{
$files = $oFileModel->getFiles($comment_obj->comment_srl, true);
foreach($files as $key => $val)
foreach($files as $val)
{
$file_info = array();
$file_info['tmp_name'] = $val->uploaded_filename;

View file

@ -191,8 +191,6 @@ class editorModel extends editor
}
}
$buff .= ' ?>';
FileHandler::writeFile($cache_file, $buff, "w");
unset($xml_info);
@ -579,7 +577,7 @@ class editorModel extends editor
{
$lang = Context::getLangType();
$cache_path = _XE_PATH_.'files/cache/editor/cache/';
if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);
FileHandler::makeDir($cache_path);
$cache_file = $cache_path.'component_list.' . $lang .'.';
if($filter_enabled) $cache_file .= 'filter.';
if($site_srl) $cache_file .= $site_srl.'.';
@ -600,7 +598,7 @@ class editorModel extends editor
}
if(!file_exists($cache_file)) return;
@include($cache_file);
include($cache_file);
$logged_info = Context::get('logged_info');
if($logged_info && is_array($logged_info->group_list))
{
@ -664,7 +662,7 @@ class editorModel extends editor
*/
function getComponent($component_name, $site_srl = 0)
{
$args =new stdClass();
$args = new stdClass();
$args->component_name = $component_name;
if($site_srl)

View file

@ -772,7 +772,7 @@ class fileController extends file
if($file_info->upload_target_srl)
{
array_push($documentSrlList, $file_info->upload_target_srl);
$documentSrlList[] = $file_info->upload_target_srl;
}
$source_filename = $output->data->source_filename;

View file

@ -178,7 +178,7 @@ class fileModel extends file
{
$file = $value;
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
array_push($fileList, $file);
$fileList[] = $file;
}
}
return $fileList;

View file

@ -1128,7 +1128,7 @@ class importerAdminController extends importer
function getTmpFilename()
{
$path = "./files/cache/importer";
if(!is_dir($path)) FileHandler::makeDir($path);
FileHandler::makeDir($path);
$filename = sprintf("%s/%d", $path, rand(11111111,99999999));
if(file_exists($filename)) $filename .= rand(111,999);
return $filename;

View file

@ -1110,7 +1110,7 @@ class menuAdminController extends menu
{
$this->_copyButton($insertedMenuItemSrl, $menuItemInfo);
}
array_push($this->insertedMenuItemSrlList, $insertedMenuItemSrl);
$this->insertedMenuItemSrlList[] = $insertedMenuItemSrl;
}
// if have a child menu, copy child menu also

View file

@ -340,7 +340,7 @@ class menuAdminModel extends menu
$allModules = array();
Context::loadLang('modules/page/lang');
foreach($_allModules AS $key=>$value)
foreach($_allModules as $value)
{
//$moduleInfo = $oModuleModel->getModuleInfoXml($value->module);
$defaultSkin = $oModuleModel->getModuleDefaultSkin($value->module, 'P');
@ -363,14 +363,12 @@ class menuAdminModel extends menu
$value->title = $pageTypeName['ARTICLE'];
$allModules['ARTICLE'] = $value;
$wModuleInfo = clone $value;
unset($wModuleInfo->default_skin);
unset($wModuleInfo->default_mskin);
unset($wModuleInfo->default_skin, $wModuleInfo->default_mskin);
$wModuleInfo->title = $pageTypeName['WIDGET'];
$wModuleInfo->no_skin = 'Y';
$allModules['WIDGET'] = $wModuleInfo;
$oModuleInfo = clone $value;
unset($oModuleInfo->default_skin);
unset($oModuleInfo->default_mskin);
unset($oModuleInfo->default_skin, $oModuleInfo->default_mskin);
$oModuleInfo->title = $pageTypeName['OUTSIDE'];
$oModuleInfo->no_skin = 'Y';
$allModules['OUTSIDE'] = $oModuleInfo;
@ -398,11 +396,11 @@ class menuAdminModel extends menu
$output = $oModuleModel->getModuleListByInstance($site_srl);
if(is_array($output->data))
{
foreach($output->data AS $key=>$value)
foreach($output->data as $value)
{
if($value->instanceCount > 1)
{
array_push($moduleList, $value->module);
$moduleList[] = $value->module;
}
}
}
@ -440,7 +438,7 @@ class menuAdminModel extends menu
Context::loadLang('modules/page/lang');
if(is_array($moduleList))
{
foreach($moduleList AS $key=>$value)
foreach($moduleList as $value)
{
$moduleInfo = $oModuleModel->getModuleInfoXml($value);
@ -450,14 +448,12 @@ class menuAdminModel extends menu
$moduleInfo->title = $pageTypeName['ARTICLE'];
$moduleInfoList['ARTICLE'] = $moduleInfo;
$wModuleInfo = clone $moduleInfo;
unset($wModuleInfo->default_skin);
unset($wModuleInfo->default_mskin);
unset($wModuleInfo->default_skin, $wModuleInfo->default_mskin);
$wModuleInfo->title = $pageTypeName['WIDGET'];
$wModuleInfo->no_skin = 'Y';
$moduleInfoList['WIDGET'] = $wModuleInfo;
$oModuleInfo = clone $moduleInfo;
unset($oModuleInfo->default_skin);
unset($oModuleInfo->default_mskin);
unset($oModuleInfo->default_skin, $oModuleInfo->default_mskin);
$oModuleInfo->title = $pageTypeName['OUTSIDE'];
$oModuleInfo->no_skin = 'Y';
$moduleInfoList['OUTSIDE'] = $oModuleInfo;
@ -514,7 +510,7 @@ class menuAdminModel extends menu
$menuItems->menuSrl = $output->menu_srl;
$menuItems->title = $output->title;
$menuItems->menuItems = $menu;
array_push($menuList, $menuItems);
$menuList[] = $menuItems;
}
else
{
@ -566,7 +562,7 @@ class menuAdminModel extends menu
}
else
{
array_push($menuList, $menuItems);
$menuList[] = $menuItems;
}
}
}
@ -649,8 +645,7 @@ class menuAdminModel extends menu
//if(!empty($menu['url']) && !preg_match('/^http/i', $menu['url']))
if($menu['is_shortcut'] != 'Y')
{
unset($midInfo);
unset($moduleInfo);
unset($midInfo, $moduleInfo);
$midInfo = $oModuleModel->getModuleInfoByMid($menu['url'], $siteSrl);
$moduleInfo = $oModuleModel->getModuleInfoXml($midInfo->module);
@ -688,7 +683,7 @@ class menuAdminModel extends menu
}
if(count($menu['list']) > 0)
{
foreach($menu['list'] AS $key=>$value)
foreach($menu['list'] as $key=>$value)
{
$this->_menuInfoSetting($menu['list'][$key], $start_module, $isMenuFixed, $menuSrl);
}

View file

@ -49,20 +49,19 @@ class menuAdminView extends menu
if(is_array($output))
{
$menuItems = array();
foreach($output AS $key=>$value)
foreach($output as $key=>$value)
{
if($value->title == $oAdmin->getAdminMenuName()) unset($output[$key]);
else
{
unset($menu);
unset($menuItems);
unset($menu, $menuItems);
//$value->xml_file = sprintf('./files/cache/menu/%s.xml.php',$value->menu_srl);
$value->php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php',$value->menu_srl);
if(file_exists($value->php_file)) include($value->php_file);
if(count($menu->list)>0)
{
foreach($menu->list AS $key2=>$value2)
foreach($menu->list as $key2=>$value2)
{
$this->_menuInfoSetting($menu->list[$key2]);
}
@ -73,7 +72,7 @@ class menuAdminView extends menu
$menuItems->menuSrl = $value->menu_srl;
$menuItems->title = $value->title;
$menuItems->menuItems = $menu;
array_push($menuList, $menuItems);
$menuList[] = $menuItems;
}
}
}
@ -92,7 +91,7 @@ class menuAdminView extends menu
$theme_file = _XE_PATH_.'files/theme/theme_info.php';
if(is_readable($theme_file))
{
@include($theme_file);
include($theme_file);
Context::set('current_layout', $theme_info->layout);
}
else
@ -108,7 +107,7 @@ class menuAdminView extends menu
if(is_array($output))
{
$groupList = array();
foreach($output AS $key=>$value)
foreach($output as $value)
{
$groupList[$value->group_srl] = new stdClass();
$groupList[$value->group_srl]->group_srl = $value->group_srl;
@ -153,7 +152,7 @@ class menuAdminView extends menu
}
if(count($menu['list']) > 0)
{
foreach($menu['list'] AS $key=>$value)
foreach($menu['list'] as $key=>$value)
{
$this->_menuInfoSetting($menu['list'][$key]);
}
@ -170,7 +169,7 @@ class menuAdminView extends menu
if(is_array($menuItems))
{
$arrangedMenuItemList = array();
foreach($menuItems AS $key=>$value)
foreach($menuItems as $value)
{
if($value->parent_srl == 0)
{

View file

@ -19,6 +19,7 @@ class moduleAdminController extends module
*/
function procModuleAdminInsertCategory()
{
$args = new stdClass();
$args->title = Context::get('title');
$output = executeQuery('module.insertModuleCategory', $args);
if(!$output->toBool()) return $output;
@ -62,6 +63,7 @@ class moduleAdminController extends module
*/
function doUpdateModuleCategory()
{
$args = new stdClass();
$args->title = Context::get('title');
$args->module_category_srl = Context::get('module_category_srl');
return executeQuery('module.updateModuleCategory', $args);
@ -111,7 +113,7 @@ class moduleAdminController extends module
if($mid && !$browser_title) $browser_title = $mid;
$clones[$mid] = $browser_title;
}
if(!count($clones))
if(count($clones) < 1)
{
return $this->_returnByProc($isProc);
}
@ -128,7 +130,7 @@ class moduleAdminController extends module
$grant = array();
if($output->data)
{
foreach($output->data as $key => $val) $grant[$val->name][] = $val->group_srl;
foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
}
// get Extra Vars
@ -149,7 +151,7 @@ class moduleAdminController extends module
if($tmpModuleSkinVars)
{
foreach($tmpModuleSkinVars AS $key=>$value)
foreach($tmpModuleSkinVars as $key=>$value)
{
$moduleSkinVars->{$key} = $value->value;
}
@ -157,7 +159,7 @@ class moduleAdminController extends module
if($tmpModuleMobileSkinVars)
{
foreach($tmpModuleMobileSkinVars AS $key=>$value)
foreach($tmpModuleMobileSkinVars as $key=>$value)
{
$moduleMobileSkinVars->{$key} = $value->value;
}
@ -215,13 +217,13 @@ class moduleAdminController extends module
}
// Grant module permissions
if(count($grant)) $oModuleController->insertModuleGrants($module_srl, $grant);
if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
array_push($triggerObj->moduleSrlList, $module_srl);
$triggerObj->moduleSrlList[] = $module_srl;
}
$output = ModuleHandler::triggerCall('module.procModuleAdminCopyModule', 'after', $triggerObj);
@ -286,9 +288,9 @@ class moduleAdminController extends module
if($admin_member)
{
$admin_members = explode(',',$admin_member);
for($i=0;$i<count($admin_members);$i++)
foreach($admin_members as $admin_id)
{
$admin_id = trim($admin_members[$i]);
$admin_id = trim($admin_id);
if(!$admin_id) continue;
$oModuleController->insertAdminId($module_srl, $admin_id);
}
@ -339,7 +341,7 @@ class moduleAdminController extends module
{
foreach($grant as $grant_name => $group_srls)
{
foreach($group_srls as $key => $val)
foreach($group_srls as $val)
{
$args = new stdClass();
$args->module_srl = $module_srl;
@ -507,7 +509,7 @@ class moduleAdminController extends module
if(!$vars->module_srls) return new Object(-1,'msg_invalid_request');
$module_srls = explode(',',$vars->module_srls);
if(!count($module_srls)) return new Object(-1,'msg_invalid_request');
if(count($module_srls) < 1) return new Object(-1,'msg_invalid_request');
$oModuleModel = &getModel('module');
$oModuleController= &getController('module');
@ -562,7 +564,7 @@ class moduleAdminController extends module
if(!$module_srls) return new Object(-1,'msg_invalid_request');
$modules = explode(',',$module_srls);
if(!count($modules)) return new Object(-1,'msg_invalid_request');
if(count($modules) < 1) return new Object(-1,'msg_invalid_request');
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
@ -616,7 +618,7 @@ class moduleAdminController extends module
// Permissions stored in the DB
foreach($grant as $grant_name => $group_srls)
{
foreach($group_srls as $key => $val)
foreach($group_srls as $val)
{
$args = new stdClass();
$args->module_srl = $module_srl;
@ -753,9 +755,9 @@ class moduleAdminController extends module
// Get a list of modules at the site
$output = executeQueryArray('module.getSiteModules', $args);
$mid_list = array();
if(count($output->data))
if(count($output->data) > 0)
{
foreach($output->data as $key => $val)
foreach($output->data as $val)
{
$module = trim($val->module);
if(!$module) continue;
@ -763,7 +765,7 @@ class moduleAdminController extends module
// replace user defined lang.
$oModuleController->replaceDefinedLangCode($val->browser_title);
$obj = null;
$obj = new stdClass();
$obj->module_srl = $val->module_srl;
$obj->layout_srl = $val->layout_srl;
$obj->browser_title = $val->browser_title;
@ -771,7 +773,7 @@ class moduleAdminController extends module
$obj->module_category_srl = $val->module_category_srl;
if($val->module_category_srl > 0)
{
array_push($moduleCategorySrl, $val->module_category_srl);
$moduleCategorySrl[] = $val->module_category_srl;
}
$mid_list[$module]->list[$val->mid] = $obj;
}
@ -783,14 +785,14 @@ class moduleAdminController extends module
$categoryNameList = array();
if(is_array($output))
{
foreach($output AS $key=>$value)
foreach($output as $value)
{
$categoryNameList[$value->module_category_srl] = $value->title;
}
}
$selected_module = Context::get('selected_module');
if(count($mid_list))
if(count($mid_list) > 0)
{
foreach($mid_list as $module => $val)
{
@ -808,7 +810,7 @@ class moduleAdminController extends module
// change module category srl to title
if(is_array($val->list))
{
foreach($val->list AS $key=>$value)
foreach($val->list as $key=>$value)
{
if($value->module_category_srl > 0)
{
@ -854,10 +856,10 @@ class moduleAdminController extends module
if(!$output->toBool() || !$output->data) return;
// Set the cache directory
$cache_path = _XE_PATH_.'files/cache/lang_defined/';
if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);
FileHandler::makeDir($cache_path);
$langMap = array();
foreach($output->data as $key => $val)
foreach($output->data as $val)
{
$langMap[$val->lang_code][$val->name] = $val->value;
}

View file

@ -877,8 +877,8 @@ class moduleModel extends module
}
if(is_array($info->menu->{$action->attrs->menu_name}->acts))
{
@array_push($info->menu->{$action->attrs->menu_name}->acts, $name);
$currentKey = @array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
$info->menu->{$action->attrs->menu_name}->acts[] = $name;
$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
}
$buff[] = sprintf('$info->menu->%s->acts[%d]=\'%s\';', $action->attrs->menu_name, $currentKey, $name);

View file

@ -55,9 +55,9 @@ class pollAdminView extends poll
if(is_array($output->data))
{
$uploadTargetSrlList = array();
foreach($output->data AS $key=>$value)
foreach($output->data as $value)
{
array_push($uploadTargetSrlList, $value->upload_target_srl);
$uploadTargetSrlList[] = $value->upload_target_srl;
}
$oDocumentModel = &getModel('document');
@ -69,7 +69,7 @@ class pollAdminView extends poll
$targetCommentOutput = $oCommentModel->getComments($uploadTargetSrlList, $columnList);
if(!is_array($targetCommentOutput)) $targetCommentOutput = array();
foreach($output->data AS $key=>$value)
foreach($output->data as $value)
{
if(array_key_exists($value->upload_target_srl, $targetDocumentOutput))
$value->document_srl = $value->upload_target_srl;
@ -132,25 +132,28 @@ class pollAdminView extends poll
// Popup layout
$this->setLayoutFile("popup_layout");
// Draw results
$args = new stdClass();
$args->poll_srl = Context::get('poll_srl');
$args->poll_index_srl = Context::get('poll_index_srl');
$output = executeQuery('poll.getPoll', $args);
if(!$output->data) return $this->stop('msg_poll_not_exists');
$poll = new stdClass();
$poll->stop_date = $output->data->stop_date;
$poll->poll_count = $output->data->poll_count;
$output = executeQuery('poll.getPollTitle', $args);
if(!$output->data) return $this->stop('msg_poll_not_exists');
$poll->poll[$args->poll_index_srl]->title = $output->data->title;
$poll->poll[$args->poll_index_srl]->checkcount = $output->data->checkcount;
$poll->poll[$args->poll_index_srl]->poll_count = $output->data->poll_count;
$tmp = &$poll->poll[$args->poll_index_srl];
$tmp->title = $output->data->title;
$tmp->checkcount = $output->data->checkcount;
$tmp->poll_count = $output->data->poll_count;
$output = executeQuery('poll.getPollItem', $args);
foreach($output->data as $key => $val)
foreach($output->data as $val)
{
$poll->poll[$val->poll_index_srl]->item[] = $val;
$tmp->item[] = $val;
}
$poll->poll_srl = $poll_srl;

View file

@ -17,23 +17,23 @@ class trashAdminController extends trash
*/
function insertTrash($obj)
{
if(Context::get('is_logged'))
if(!Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
$oTrashVO = new TrashVO();
$oTrashVO = &$obj;
if(!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence());
if(!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject()));
$oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']);
$oTrashVO->setRemoverSrl($logged_info->member_srl);
$oTrashVO->setRegdate(date('YmdHis'));
$output = executeQuery('trash.insertTrash', $oTrashVO);
return $output;
return new Object(-1, 'msg_not_permitted');
}
return new Object(-1, 'msg_not_permitted');
$logged_info = Context::get('logged_info');
$oTrashVO = new TrashVO();
$oTrashVO = &$obj;
if(!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence());
if(!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject()));
$oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']);
$oTrashVO->setRemoverSrl($logged_info->member_srl);
$oTrashVO->setRegdate(date('YmdHis'));
return executeQuery('trash.insertTrash', $oTrashVO);
}
/**
@ -78,8 +78,7 @@ class trashAdminController extends trash
$oTrashModel = &getModel('trash');
if($isAll == 'true')
{
$args = array();
$output = $oTrashModel->getTrashAllList($args);
$output = $oTrashModel->getTrashAllList(array());
if(!$output->toBool())
{
return new Object(-1, $output->message);
@ -87,14 +86,15 @@ class trashAdminController extends trash
if(is_array($output->data))
{
foreach($output->data AS $key=>$value)
foreach($output->data as $value)
{
array_push($trashSrls, $value->getTrashSrl());
$trashSrls[] = $value->getTrashSrl();
}
}
}
else
{
$args = new stdClass();
$args->trashSrl = $trashSrls;
$output = $oTrashModel->getTrashList($args);
if(!$output->toBool())
@ -105,7 +105,7 @@ class trashAdminController extends trash
if(is_array($output->data))
{
foreach($output->data AS $key=>$oTrashVO)
foreach($output->data as $oTrashVO)
{
//class file check
$classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule());
@ -140,7 +140,7 @@ class trashAdminController extends trash
$oDB = &DB::getInstance();
$oDB->begin();
// eache restore method call in each classfile
foreach($trashSrlList AS $key=>$value)
foreach($trashSrlList as $value)
{
$oTrashModel = &getModel('trash');
$output = $oTrashModel->getTrash($value);

View file

@ -377,7 +377,7 @@ class widgetController extends widget
/**
* Cache number and cache values are set so that the cache file should call
*/
if(!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path);
FileHandler::makeDir($this->cache_path);
// Wanted cache file
$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type);
// If the file exists in the cache, the file validation