NOISSUE PHP 5.4 이상 호환성 개선.

This commit is contained in:
bnu 2013-11-30 17:35:22 +09:00
parent 742af78932
commit 41ff8ace3b
32 changed files with 365 additions and 113 deletions

View file

@ -705,7 +705,7 @@ class documentController extends document
$trash_args->nick_name = htmlspecialchars_decode($logged_info->nick_name);
}
// Date setting for updating documents
$doucment_args = new stdClass();
$document_args = new stdClass;
$document_args->module_srl = 0;
$document_args->document_srl = $obj->document_srl;
@ -1143,7 +1143,7 @@ class documentController extends document
{
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->document_srl = $document_srl;
$output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
@ -1296,6 +1296,7 @@ class documentController extends document
$oDocumentModel = &getModel('document');
if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl);
$args = new stdClass;
$args->category_srl = $category_srl;
$args->document_count = $document_count;
$output = executeQuery('document.updateCategoryCount', $args);
@ -1784,10 +1785,10 @@ class documentController extends document
$php_buff = sprintf(
'<?php '.
'if(!defined("__XE__")) exit(); '.
'%s; '.
'%s; '.
'$menu->list = array(%s); '.
'?>',
'%s'.
'%s'.
'$menu = new stdClass;'.
'$menu->list = array(%s); ',
$header_script,
$php_header_buff,
$php_output['buff']
@ -1831,11 +1832,24 @@ class documentController extends document
$title = $node->title;
$oModuleAdminModel = &getAdminModel('module');
$langs = $oModuleAdminModel->getLangCode($site_srl, $title);
if(count($langs)) foreach($langs as $key => $val) $xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
if(count($langs))
{
foreach($langs as $key => $val)
{
$xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
}
}
$langx = $oModuleAdminModel->getLangCode($site_srl, $description);
if(count($langx)) foreach($langx as $key => $val) $xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
if(count($langx))
{
foreach($langx as $key => $val)
{
$xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
}
}
$attribute = sprintf(
'mid="%s" module_srl="%d" node_srl="%d" parent_srl="%d" category_srl="%d" text="<?php echo (%s?($_titles[%d][$lang_type]):"")?>" url="%s" expand="%s" color="%s" description="<?php echo (%s?($_descriptions[%d][$lang_type]):"")?>" document_count="%d" ',
@ -1875,30 +1889,70 @@ class documentController extends document
{
$output = array("buff"=>"", "category_srl_list"=>array());
if(!$source_node) return $output;
// Set to an arraty for looping and then generate php script codes to be included
foreach($source_node as $category_srl => $node)
{
// Get data from child nodes first if exist.
if($category_srl&&$tree[$category_srl]) $child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff);
else $child_output = array("buff"=>"", "category_srl_list"=>array());
if($category_srl && $tree[$category_srl]){
$child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff);
} else {
$child_output = array("buff"=>"", "category_srl_list"=>array());
}
// Set values into category_srl_list arrary if url of the current node is not empty
$child_output['category_srl_list'][] = $node->category_srl;
$output['category_srl_list'] = array_merge($output['category_srl_list'], $child_output['category_srl_list']);
// If node->group_srls value exists
if($node->group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls);
else $group_check_code = "true";
if($node->group_srls) {
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls);
} else {
$group_check_code = "true";
}
// List variables
$selected = '"'.implode('","',$child_output['category_srl_list']).'"';
$selected = '"' . implode('","', $child_output['category_srl_list']) . '"';
$child_buff = $child_output['buff'];
$expand = $node->expand;
$title = $node->title;
$description= $node->description;
$description = $node->description;
$oModuleAdminModel = &getAdminModel('module');
$langs = $oModuleAdminModel->getLangCode($site_srl, $title);
if(count($langs)) foreach($langs as $key => $val) $php_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
if(count($langs))
{
$php_header_buff .= '$_titles = array();';
foreach($langs as $key => $val)
{
$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
$php_header_buff .= sprintf(
'$_titles[%d]["%s"] = "%s"; ',
$category_srl,
$key,
str_replace('"','\\"', $val)
);
}
}
$langx = $oModuleAdminModel->getLangCode($site_srl, $description);
if(count($langx)) foreach($langx as $key => $val) $php_header_buff .= sprintf('$_descriptions[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
if(count($langx))
{
$php_header_buff .= '$_descriptions = array();';
foreach($langx as $key => $val)
{
$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
$php_header_buff .= sprintf(
'$_descriptions[%d]["%s"] = "%s"; ',
$category_srl,
$key,
str_replace('"','\\"', $val)
);
}
}
// Create attributes(Use the category_srl_list to check whether to belong to the menu's node. It seems to be tricky but fast fast and powerful;)
$attribute = sprintf(
'"mid" => "%s", "module_srl" => "%d","node_srl"=>"%s","category_srl"=>"%s","parent_srl"=>"%s","text"=>$_titles[%d][$lang_type],"selected"=>(in_array(Context::get("category"),array(%s))?1:0),"expand"=>"%s","color"=>"%s","description"=>$_descriptions[%d][$lang_type],"list"=>array(%s),"document_count"=>"%d","grant"=>%s?true:false',
@ -1920,6 +1974,7 @@ class documentController extends document
// Generate buff data
$output['buff'] .= sprintf('%s=>array(%s),', $node->category_srl, $attribute);
}
return $output;
}
@ -1953,15 +2008,19 @@ class documentController extends document
function procDocumentAddCart()
{
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
// Get document_srl
$srls = explode(',',Context::get('srls'));
for($i=0;$i<count($srls);$i++)
for($i = 0; $i < count($srls); $i++)
{
$srl = trim($srls[$i]);
if(!$srl) continue;
$document_srls[] = $srl;
}
if(!count($document_srls)) return;
// Get module_srl of the documents
$args->list_count = count($document_srls);
$args->document_srls = implode(',',$document_srls);
@ -1975,6 +2034,7 @@ class documentController extends document
$document_srls[$val->module_srl][] = $val->document_srl;
}
if(!$document_srls || !count($document_srls)) return new Object();
// Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents)
$oModuleModel = &getModel('module');
$module_srls = array_keys($document_srls);