#133 PHP 5.4 이상에서의 호환성 개선

This commit is contained in:
bnu 2013-12-04 22:49:00 +09:00
parent 23406d1708
commit 1b60833bad
17 changed files with 78 additions and 31 deletions

View file

@ -1440,7 +1440,7 @@ class Context
}
}
$get_vars = null;
$get_vars = array();
// If there is no GET variables or first argument is '' to reset variables
if(!$self->get_vars || $args_list[0] == '')

View file

@ -589,8 +589,8 @@ class commentModel extends comment
// Sort comments by the hierarchical structure
$comment_count = count($source_list);
$root = NULL;
$list = NULL;
$root = new stdClass;
$list = array();
$comment_list = array();
// get the log-in information for logged-in users

View file

@ -51,6 +51,7 @@ class documentController extends document
*/
function insertAlias($module_srl, $document_srl, $alias_title)
{
$args = new stdClass;
$args->alias_srl = getNextSequence();
$args->module_srl = $module_srl;
$args->document_srl = $document_srl;
@ -117,7 +118,7 @@ class documentController extends document
*/
function deleteDocumentAliasByDocument($document_srl)
{
$args =new stdClass();
$args = new stdClass();
$args->document_srl = $document_srl;
executeQuery("document.deleteAlias", $args);
}
@ -370,6 +371,7 @@ class documentController extends document
if($bUseHistory)
{
$args = new stdClass;
$args->history_srl = getNextSequence();
$args->document_srl = $obj->document_srl;
$args->module_srl = $module_srl;
@ -459,9 +461,11 @@ class documentController extends document
}
else
{
$extra_content = new stdClass;
$extra_content->title = $obj->title;
$extra_content->content = $obj->content;
$document_args = new stdClass;
$document_args->document_srl = $source_obj->get('document_srl');
$document_output = executeQuery('document.getDocument', $document_args);
$obj->title = $document_output->data->title;
@ -557,7 +561,7 @@ class documentController extends document
function deleteDocument($document_srl, $is_admin = false, $isEmptyTrash = false, $oDocument = null)
{
// Call a trigger (before)
$trigger_obj =new stdClass();
$trigger_obj = new stdClass();
$trigger_obj->document_srl = $document_srl;
$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
if(!$output->toBool()) return $output;
@ -815,6 +819,7 @@ class documentController extends document
return false;
}
// Update read counts
$args = new stdClass;
$args->document_srl = $document_srl;
$output = executeQuery('document.updateReadedCount', $args);
// Register session
@ -941,6 +946,7 @@ class documentController extends document
if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request');
if(!$lang_code) $lang_code = Context::getLangType();
$obj = new stdClass;
$obj->module_srl = $module_srl;
$obj->document_srl = $document_srl;
$obj->var_idx = $var_idx;
@ -962,7 +968,7 @@ class documentController extends document
*/
function deleteDocumentExtraVars($module_srl, $document_srl = null, $var_idx = null, $lang_code = null, $eid = null)
{
$obj =new stdClass();
$obj = new stdClass();
$obj->module_srl = $module_srl;
if(!is_null($document_srl)) $obj->document_srl = $document_srl;
if(!is_null($var_idx)) $obj->var_idx = $var_idx;
@ -1012,7 +1018,9 @@ class documentController extends document
return new Object(-1, $failed_voted);
}
}
// Use member_srl for logged-in members and IP address for non-members.
$args = new stdClass;
if($member_srl)
{
$args->member_srl = $member_srl;
@ -1051,6 +1059,7 @@ class documentController extends document
$output = executeQuery('document.insertDocumentVotedLog', $args);
if(!$output->toBool()) return $output;
$obj = new stdClass;
$obj->member_srl = $oDocument->get('member_srl');
$obj->module_srl = $oDocument->get('module_srl');
$obj->document_srl = $oDocument->get('document_srl');
@ -1135,6 +1144,7 @@ class documentController extends document
}
// Use member_srl for logged-in members and IP address for non-members.
$args = new stdClass;
if($member_srl)
{
$args->member_srl = $member_srl;
@ -1232,6 +1242,7 @@ class documentController extends document
*/
function updateTrackbackCount($document_srl, $trackback_count)
{
$args = new stdClass;
$args->document_srl = $document_srl;
$args->trackback_count = $trackback_count;
@ -1278,6 +1289,7 @@ class documentController extends document
*/
function updateCategoryListOrder($module_srl, $list_order)
{
$args = new stdClass;
$args->module_srl = $module_srl;
$args->list_order = $list_order;
return executeQuery('document.updateCategoryOrder', $args);
@ -1368,6 +1380,7 @@ class documentController extends document
{
$oDocumentModel = &getModel('document');
// Get information of the selected category
$args = new stdClass;
$args->category_srl = $category_srl;
$output = executeQuery('document.getCategory', $args);
@ -1390,11 +1403,13 @@ class documentController extends document
// Return if the selected category is the top level
if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved'));
// Information of the selected category
$cur_args = new stdClass;
$cur_args->category_srl = $category_srl;
$cur_args->list_order = $prev_category->list_order;
$cur_args->title = $category->title;
$this->updateCategory($cur_args);
// Category information
$prev_args = new stdClass;
$prev_args->category_srl = $prev_category->category_srl;
$prev_args->list_order = $list_order;
$prev_args->title = $prev_category->title;
@ -1412,6 +1427,7 @@ class documentController extends document
{
$oDocumentModel = &getModel('document');
// Get information of the selected category
$args = new stdClass;
$args->category_srl = $category_srl;
$output = executeQuery('document.getCategory', $args);
@ -1432,12 +1448,13 @@ class documentController extends document
if(!$category_list[$next_category_srl]) return new Object(-1,Context::getLang('msg_category_not_moved'));
$next_category = $category_list[$next_category_srl];
// Information of the selected category
$cur_args = new stdClass;
$cur_args->category_srl = $category_srl;
$cur_args->list_order = $next_category->list_order;
$cur_args->title = $category->title;
$this->updateCategory($cur_args);
// Category information
$next_args->category_srl = $next_category->category_srl;
$next_args = new stdClass;
$next_args->list_order = $list_order;
$next_args->title = $next_category->title;
$this->updateCategory($next_args);
@ -1578,11 +1595,14 @@ class documentController extends document
$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList);
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if(!$grant->manager) return new Object(-1,'msg_not_permitted');
// First child of the parent_category_srl
$source_args = new stdClass;
if($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0))
{
$parent_category = $oDocumentModel->getCategory($parent_category_srl);
$args = new stdClass;
$args->module_srl = $source_category->module_srl;
$args->parent_srl = $parent_category_srl;
$output = executeQuery('document.getChildCategoryMinListOrder', $args);
@ -2022,6 +2042,7 @@ class documentController extends document
if(!count($document_srls)) return;
// Get module_srl of the documents
$args = new stdClass;
$args->list_count = count($document_srls);
$args->document_srls = implode(',',$document_srls);
$args->order_type = 'asc';
@ -2291,6 +2312,7 @@ class documentController extends document
// Set the attachment to be invalid state
if($oDocument->hasUploadedFiles())
{
$args = new stdClass;
$args->upload_target_srl = $oDocument->document_srl;
$args->isvalid = 'N';
executeQuery('file.updateFileValid', $args);

View file

@ -900,12 +900,12 @@ class documentItem extends Object
$buffs = $this->getExtraImages($time_check);
if(!count($buffs)) return;
$buff = null;
$buff = array();
foreach($buffs as $key => $val)
{
$buff .= sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
}
return $buff;
return implode('', $buff);
}
function hasUploadedFiles()

View file

@ -784,6 +784,7 @@ class documentModel extends document
*/
function getCategoryDocumentCount($module_srl, $category_srl)
{
$args = new stdClass;
$args->module_srl = $module_srl;
$args->category_srl = $category_srl;
$output = executeQuery('document.getCategoryDocumentCount', $args);
@ -836,6 +837,7 @@ class documentModel extends document
unset($obj->mid);
}
// Module_srl passed the array may be a check whether the array
$args = new stdClass;
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
@ -861,6 +863,7 @@ class documentModel extends document
unset($obj->mid);
}
// Module_srl passed the array may be a check whether the array
$args = new stdClass;
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
$args->regdate = $obj->regdate;
@ -992,6 +995,7 @@ class documentModel extends document
{
if(!$mid || !$alias) return null;
$site_module_info = Context::get('site_module_info');
$args = new stdClass;
$args->mid = $mid;
$args->alias_title = $alias;
$args->site_srl = $site_module_info->site_srl;
@ -1009,6 +1013,7 @@ class documentModel extends document
function getDocumentSrlByTitle($module_srl, $title)
{
if(!$module_srl || !$title) return null;
$args = new stdClass;
$args->module_srl = $module_srl;
$args->title = $title;
$output = executeQuery('document.getDocumentSrlByTitle', $args);
@ -1028,6 +1033,7 @@ class documentModel extends document
function getAlias($document_srl)
{
if(!$document_srl) return null;
$args = new stdClass;
$args->document_srl = $document_srl;
$output = executeQueryArray('document.getAliases', $args);
@ -1044,6 +1050,7 @@ class documentModel extends document
*/
function getHistories($document_srl, $list_count, $page)
{
$args = new stdClass;
$args->list_count = $list_count;
$args->page = $page;
$args->document_srl = $document_srl;
@ -1058,6 +1065,7 @@ class documentModel extends document
*/
function getHistory($history_srl)
{
$args = new stdClass;
$args->history_srl = $history_srl;
$output = executeQuery('document.getHistory', $args);
return $output->data;
@ -1071,6 +1079,7 @@ class documentModel extends document
function getTrashList($obj)
{
// Variable check
$args = new stdClass;
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
$args->sort_index = $obj->sort_index;
$args->order_type = $obj->order_type?$obj->order_type:'desc';
@ -1150,6 +1159,7 @@ class documentModel extends document
*/
function getDocumentVotedMemberList()
{
$args = new stdClass;
$document_srl = Context::get('document_srl');
if(!$document_srl) return new Object(-1,'msg_invalid_request');

View file

@ -20,14 +20,14 @@ class editorAdminController extends editor
function procEditorAdminCheckUseListOrder()
{
$site_module_info = Context::get('site_module_info');
$enables = Context::get('enables');
$enables = Context::get('enables');
$component_names = Context::get('component_names');
if(!is_array($component_names)) $component_names = array();
if(!is_array($enables)) $enables = array();
$unables = array_diff($component_names, $enables);
$componentList = array();
$componentList = array();
foreach($enables as $component_name)
{
@ -102,7 +102,7 @@ class editorAdminController extends editor
if(!$output->toBool()) return new Object();
$list_order_num++;
}
}
}
unset($component_names);
return $output;
}
@ -121,6 +121,7 @@ class editorAdminController extends editor
unset($extra_vars->act);
unset($extra_vars->body);
$args = new stdClass;
$args->component_name = $component_name;
$args->extra_vars = serialize($extra_vars);
$args->site_srl = (int)$site_module_info->site_srl;
@ -174,6 +175,7 @@ class editorAdminController extends editor
if($enabled) $enabled = 'Y';
else $enabled = 'N';
$args = new stdClass;
$args->component_name = $component_name;
$args->enabled = $enabled;
$args->site_srl = $site_srl;

View file

@ -81,8 +81,7 @@ class editorController extends editor
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
$editor_config = null;
$editor_config = new stdClass;
$editor_config->editor_skin = Context::get('editor_skin');
$editor_config->comment_editor_skin = Context::get('comment_editor_skin');
$editor_config->content_style = Context::get('content_style');

View file

@ -41,7 +41,7 @@ class fileModel extends file
$file_info = $tmp_files[$i];
if(!$file_info->file_srl) continue;
$obj = null;
$obj = new stdClass;
$obj->file_srl = $file_info->file_srl;
$obj->source_filename = $file_info->source_filename;
$obj->file_size = $file_info->file_size;
@ -117,7 +117,7 @@ class fileModel extends file
if(!$file_config) $file_config = $file_module_config;
$config = new stdClass();
if($file_config)
{
$config->allowed_filesize = $file_config->allowed_filesize;
@ -303,7 +303,7 @@ class fileModel extends file
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl);
if($oDocument->isExists()) $document_grant = $oDocument->isGranted();
if($oDocument->isExists()) $document_grant = $oDocument->isGranted();
$file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager);

View file

@ -670,7 +670,7 @@ class importerAdminController extends importer
$fp = fopen($target_file,"r");
if(!$fp) continue;
$obj = null;
$obj = new stdClass;
$obj->module_srl = $module_srl;
$obj->document_srl = getNextSequence();
@ -678,7 +678,7 @@ class importerAdminController extends importer
$extra_vars = array();
$started = false;
$buff = null;
$buff = array();
// Start from the body data
while(!feof($fp))
{
@ -713,10 +713,10 @@ class importerAdminController extends importer
continue;
}
if($started) $buff .= $str;
if($started) $buff[] = $str;
}
$xmlDoc = $this->oXmlParser->parse($buff);
$xmlDoc = $this->oXmlParser->parse(implode('', $buff));
$category = base64_decode($xmlDoc->post->category->body);
if($category_titles[$category]) $obj->category_srl = $category_titles[$category];
@ -848,7 +848,7 @@ class importerAdminController extends importer
{
$xmlDoc = $this->oXmlParser->parse($buff);
$obj = null;
$obj = new stdClass;
$obj->trackback_srl = getNextSequence();
$obj->module_srl = $module_srl;
$obj->document_srl = $document_srl;
@ -893,7 +893,7 @@ class importerAdminController extends importer
if(trim($str) == '<comment>')
{
$started = true;
$obj = null;
$obj = new stdClass;
$obj->comment_srl = getNextSequence();
$files = array();
}
@ -1010,13 +1010,13 @@ class importerAdminController extends importer
while(!feof($fp))
{
$file_obj = new stdClass;
$str = trim(fgets($fp, 1024));
// If it ends with </attaches>, break
if(trim($str) == '</attaches>') break;
// If it starts with <attach>, collect attachments
if(trim($str) == '<attach>')
{
$file_obj = null;
$file_obj->file_srl = getNextSequence();
$file_obj->upload_target_srl = $upload_target_srl;
$file_obj->module_srl = $module_srl;

View file

@ -34,12 +34,14 @@ $oMenuAdminController->makeXmlFile($menuSrl);
// create Layout
//extra_vars init
$extra_vars = new stdClass;
$extra_vars->GNB = $menuSrl;
$extra_vars->LAYOUT_TYPE = 'MAIN_PAGE';
$extra_vars->VISUAL_USE = 'YES';
$extra_vars->menu_name_list = array();
$extra_vars->menu_name_list[$menuSrl] = 'Welcome menu';
$args = new stdClass;
$args->site_srl = 0;
$layout_srl = $args->layout_srl = getNextSequence();
$args->layout = 'default';
@ -93,6 +95,7 @@ foreach($skinTypes as $key => $dir)
$skinType = $key == 'skin' ? 'P' : 'M';
foreach($moduleList as $moduleName)
{
$designInfo->module->{$moduleName} = new stdClass;
$designInfo->module->{$moduleName}->{$key} = $oModuleModel->getModuleDefaultSkin($moduleName, $skinType, 0, false);
}
}
@ -110,6 +113,7 @@ $oTemplateHandler = TemplateHandler::getInstance();
$oDocumentModel = getModel('document'); /* @var $oDocumentModel documentModel */
$oDocumentController = getController('document'); /* @var $oDocumentController documentController */
$obj = new stdClass;
$obj->module_srl = $module_srl;
Context::set('version', __XE_VERSION__);
$obj->title = 'Welcome XE';
@ -136,6 +140,7 @@ $output = $oModuleController->updateModule($module_info);
if(!$output->toBool()) return $output;
// insertFirstModule
$site_args = new stdClass;
$site_args->site_srl = 0;
$site_args->index_module_srl = $module_srl;
$oModuleController->updateSite($site_args);

View file

@ -174,7 +174,7 @@ class integration_searchModel extends module
$list = array();
foreach($output->data as $key => $val)
{
$obj = null;
$obj = new stdClass;
$obj->filename = $val->source_filename;
$obj->download_count = $val->download_count;
if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);

View file

@ -93,18 +93,19 @@ class member extends ModuleObject {
if(!count($groups))
{
// Set an administrator, regular member(group1), and associate member(group2)
$group_args = new stdClass;
$group_args->title = Context::getLang('admin_group');
$group_args->is_default = 'N';
$group_args->is_admin = 'Y';
$output = $oMemberAdminController->insertGroup($group_args);
unset($group_args);
$group_args = new stdClass;
$group_args->title = Context::getLang('default_group_1');
$group_args->is_default = 'Y';
$group_args->is_admin = 'N';
$output = $oMemberAdminController->insertGroup($group_args);
unset($group_args);
$group_args = new stdClass;
$group_args->title = Context::getLang('default_group_2');
$group_args->is_default = 'N';
$group_args->is_admin = 'N';
@ -112,6 +113,7 @@ class member extends ModuleObject {
}
// Configure administrator information
$admin_args = new stdClass;
$admin_args->is_admin = 'Y';
$output = executeQuery('member.getMemberList', $admin_args);
if(!$output->data)

View file

@ -439,7 +439,7 @@ class module extends ModuleObject
$output = executeQuery('module.updateMobileSkinFixModules');
$oModuleController = getController('module');
if(!isset($moduleConfig)) $moduleConfig = new stdClass;
if(!$moduleConfig) $moduleConfig = new stdClass;
$moduleConfig->isUpdateFixedValue = TRUE;
$output = $oModuleController->updateModuleConfig('module', $moduleConfig);
}

View file

@ -160,7 +160,7 @@ class moduleController extends module
$oModuleModel = &getModel('module');
$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
if(!isset($origin_config)) $origin_config = new stdClass;
if(!$origin_config) $origin_config = new stdClass;
foreach($config as $key => $val)
{
@ -426,6 +426,7 @@ class moduleController extends module
$siteMapArgs->site_srl = 0;
$siteMapArgs->title = 'Temporary menu';
$siteMapArgs->listorder = $siteMapArgs->menu_srl * -1;
$tempMenu = new stdClass;
$tempMenu->menu_srl = $siteMapArgs->menu_srl = getNextSequence();
$siteMapOutput = executeQuery('menu.insertMenu', $siteMapArgs);

View file

@ -1464,6 +1464,8 @@ class moduleModel extends module
$info = NULL;
$info = $this->getModuleInfoXml($module_name);
if(!$info) continue;
$info->module = $module_name;
$info->category = $info->category;
$info->created_table_count = $created_table_count;

View file

@ -19,6 +19,7 @@ class point extends ModuleObject
$oModuleController = &getController('module');
// The highest level
$config = new stdClass;
$config->max_level = 30;
// Per-level score
for($i=1;$i<=30;$i++)

View file

@ -147,6 +147,7 @@ class pollController extends poll
$oDB = &DB::getInstance();
$oDB->begin();
$args = new stdClass;
$args->poll_srl = $poll_srl;
// Update all poll responses related to the post
$output = executeQuery('poll.updatePoll', $args);
@ -165,6 +166,7 @@ class pollController extends poll
return $output;
}
// Log the respondent's information
$log_args = new stdClass;
$log_args->poll_srl = $poll_srl;
$logged_info = Context::get('logged_info');
@ -224,6 +226,7 @@ class pollController extends poll
if(count($pollSrlList) > 0)
{
$oPollAdminModel = &getAdminModel('poll');
$args = new stdClass;
$args->pollIndexSrlList = $pollSrlList;
$output = $oPollAdminModel->getPollListWithMember($args);
$pollList = $output->data;
@ -358,7 +361,7 @@ class pollController extends poll
{
$poll_srl = $matches[3][$i];
$args = null;
$args = new stdClass;
$args->poll_srl = $poll_srl;
$output = executeQuery('poll.getPoll', $args);
$poll = $output->data;