NOISSUE PHP 버전 호환성 개선

This commit is contained in:
bnu 2013-12-17 18:41:11 +09:00
parent cd1dfda2a2
commit 0ccf7bb6a8
7 changed files with 57 additions and 35 deletions

View file

@ -913,6 +913,7 @@ class documentModel extends document
{
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('document');
if(!$config) $config = new stdClass;
if(!$config->thumbnail_type) $config->thumbnail_type = 'crop';
$GLOBALS['__document_config__'] = $config;
}

View file

@ -43,6 +43,7 @@ class image_gallery extends EditorHandler
*/
function transHTML($xml_obj)
{
$gallery_info = new stdClass;
$gallery_info->srl = rand(111111,999999);
$gallery_info->border_thickness = $xml_obj->attrs->border_thickness;
$gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
@ -57,12 +58,13 @@ class image_gallery extends EditorHandler
// If you set the output to output the XML code generated a list of the image
if(Context::getResponseMethod() == 'XMLRPC')
{
$output = '';
$output = array();
for($i=0;$i<count($gallery_info->images_list);$i++)
{
$output .= sprintf('<img src="%s" alt="" /><br />', $gallery_info->images_list[$i]);
$output[] = sprintf('<img src="%s" alt="" />', $gallery_info->images_list[$i]);
}
return $output;
$output[] = '<br />';
return implode('<br />', $output);
}
// HTML gallery output, the output settings via the template for the conversion to generate the html code should
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);

View file

@ -22,6 +22,7 @@ class editorController extends editor
$this->deleteSavedDoc(false);
$args = new stdClass;
$args->document_srl = Context::get('document_srl');
$args->content = Context::get('content');
$args->title = Context::get('title');
@ -67,7 +68,10 @@ class editorController extends editor
$vars = $oComponent->getVariables();
if(count($vars))
{
foreach($vars as $key=>$val) $this->add($key, $val);
foreach($vars as $key => $val)
{
$this->add($key, $val);
}
}
}
@ -112,7 +116,7 @@ class editorController extends editor
{
$editor_config->{$key} = array();
}
else if(is_array($grant))
else if(is_array($grant))
{
$editor_config->{$key} = $grant;
}
@ -182,11 +186,12 @@ class editorController extends editor
$content_font_size = $editor_config->content_font_size;
if($content_font || $content_font_size)
{
$buff = '<style> .xe_content { ';
if($content_font) $buff .= 'font-family:'.$content_font.';';
if($content_font_size) $buff .= 'font-size:'.$content_font_size.';';
$buff .= ' }</style>';
Context::addHtmlHeader($buff);
$buff = array();
$buff[] = '<style> .xe_content { ';
if($content_font) $buff[] = 'font-family:'.$content_font.';';
if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';';
$buff[] = ' }</style>';
Context::addHtmlHeader(implode('', $buff));
}
}
@ -213,6 +218,7 @@ class editorController extends editor
preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m);
$xml_obj = new stdClass;
$xml_obj->attrs = new stdClass;
for($i=0,$c=count($m[0]);$i<$c;$i++)
{
$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
@ -220,6 +226,7 @@ class editorController extends editor
$xml_obj->body = $match[4];
if(!$xml_obj->attrs->editor_component) return $match[0];
// Get converted codes by using component::transHTML()
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
@ -243,6 +250,7 @@ class editorController extends editor
{
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
// Get the current module if module_srl doesn't exist
if(!$args->module_srl)
{
@ -345,6 +353,7 @@ class editorController extends editor
function makeCache($filter_enabled = true, $site_srl)
{
$oEditorModel = &getModel('editor');
$args = new stdClass;
if($filter_enabled) $args->enabled = "Y";
@ -355,8 +364,10 @@ class editorController extends editor
}
else $output = executeQuery('editor.getComponentList', $args);
$db_list = $output->data;
// Get a list of files
$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
// Get information about log-in status and its group
$is_logged = Context::get('is_logged');
if($is_logged)
@ -368,6 +379,7 @@ class editorController extends editor
}
else $group_list = array();
}
// Get xml information for looping DB list
if(!is_array($db_list)) $db_list = array($db_list);
$component_list = new stdClass();
@ -389,7 +401,7 @@ class editorController extends editor
$extra_vars = unserialize($component->extra_vars);
if($extra_vars->target_group)
{
$xml_info->target_group = $extra_vars->target_group;
$xml_info->target_group = $extra_vars->target_group;
}
if($extra_vars->mid_list && count($extra_vars->mid_list))
@ -435,6 +447,7 @@ class editorController extends editor
if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
}
// Return if it checks enabled only
if($filter_enabled)
{
@ -443,6 +456,7 @@ class editorController extends editor
FileHandler::writeFile($cache_file, $buff);
return $component_list;
}
// Get xml_info of downloaded list
foreach($downloaded_list as $component_name)
{

View file

@ -114,7 +114,7 @@ class fileController extends file
if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio'))
{
$output->info = getimagesize($output_src);
$output->info = getimagesize($output_src);
$output->src = $output_src;
}
else
@ -122,7 +122,7 @@ class fileController extends file
return new Object(-1,'msg_invalid_request');
}
$this->add('resized_info',$output);
$this->add('resized_info',$output);
}
/**
@ -293,13 +293,13 @@ class fileController extends file
$uploaded_filename = $file_obj->uploaded_filename;
if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found');
if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key)
{
unset($_SESSION[$session_key][$file_srl]);
return $this->stop('msg_invalid_request');
}
$file_size = $file_obj->file_size;
$filename = $file_obj->source_filename;
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
@ -321,13 +321,13 @@ class fileController extends file
if(!$fp) return $this->stop('msg_file_not_found');
header("Cache-Control: ");
header("Pragma: ");
header("Content-Type: application/octet-stream");
header("Pragma: ");
header("Content-Type: application/octet-stream");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Content-Length: " .(string)($file_size));
header("Content-Length: " .(string)($file_size));
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
header("Content-Transfer-Encoding: binary\n");
// if file size is lager than 10MB, use fread function (#18675748)
if(filesize($uploaded_filename) > 1024 * 1024)
@ -337,7 +337,7 @@ class fileController extends file
}
else
{
fpassthru($fp);
fpassthru($fp);
}
exit();
@ -379,7 +379,7 @@ class fileController extends file
$file_info = $output->data;
if(!$file_info) continue;
$file_grant = $oFileModel->getFileGrant($file_info, $logged_info);
$file_grant = $oFileModel->getFileGrant($file_info, $logged_info);
if(!$file_grant->is_deletable) continue;
@ -555,7 +555,7 @@ class fileController extends file
}
/**
* Set the attachements of the upload_target_srl to be valid
* Set the attachements of the upload_target_srl to be valid
* By changing its state to valid when a document is inserted, it prevents from being considered as a unnecessary file
*
* @param int $upload_target_srl
@ -602,6 +602,7 @@ class fileController extends file
function insertFile($file_info, $module_srl, $upload_target_srl, $download_count = 0, $manual_insert = false)
{
// Call a trigger (before)
$trigger_obj = new stdClass;
$trigger_obj->module_srl = $module_srl;
$trigger_obj->upload_target_srl = $upload_target_srl;
$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj);
@ -626,6 +627,7 @@ class fileController extends file
// An error appears if file size exceeds a limit
if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size');
// Get total file size of all attachements (from DB)
$size_args = new stdClass;
$size_args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.getAttachedFileSize', $size_args);
$attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']);
@ -664,10 +666,10 @@ class fileController extends file
}
// Create a directory
if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create');
// Check uploaded file
if(!checkUploadedFile($file_info['tmp_name'])) return new Object(-1,'msg_file_upload_error');
// Move the file
if($manual_insert)
{
@ -690,6 +692,7 @@ class fileController extends file
$oMemberModel = &getModel('member');
$member_srl = $oMemberModel->getLoggedMemberSrl();
// List file information
$args = new stdClass;
$args->file_srl = getNextSequence();
$args->upload_target_srl = $upload_target_srl;
$args->module_srl = $module_srl;
@ -879,7 +882,7 @@ class fileController extends file
// Move the file
FileHandler::rename($old_file, $new_file);
// Update DB information
unset($args);
$args = new stdClass;
$args->file_srl = $file_info->file_srl;
$args->uploaded_filename = $new_file;
$args->module_srl = $file_info->module_srl;

View file

@ -40,6 +40,7 @@ class integration_searchView extends integration_search
if(!$this->grant->access) return new Object(-1,'msg_not_permitted');
$config = $oModuleModel->getModuleConfig('integration_search');
if(!$config) $config = new stdClass;
if(!$config->skin)
{
$config->skin = 'default';
@ -60,7 +61,8 @@ class integration_searchView extends integration_search
}
// Template path
$this->setTemplatePath($template_path);
Context::set('module_info', unserialize($config->skin_vars));
$skin_vars = ($config->skin_vars) ? unserialize($config->skin_vars) : new stdClass;
Context::set('module_info', $skin_vars);
$target = $config->target;
if(!$target) $target = 'include';
@ -77,7 +79,7 @@ class integration_searchView extends integration_search
if(!$page) $page = 1;
// Search by search tab
$where = Context::get('where');
// Create integration search model object
// Create integration search model object
if($is_keyword)
{
$oIS = &getModel('integration_search');

View file

@ -1730,6 +1730,7 @@ class memberController extends member
if($keep_signed)
{
// Key generate for auto login
$autologin_args = new stdClass;
$autologin_args->autologin_key = md5(strtolower($user_id).$this->memberInfo->password.$_SERVER['HTTP_USER_AGENT']);
$autologin_args->member_srl = $this->memberInfo->member_srl;
executeQuery('member.deleteAutologin', $autologin_args);

View file

@ -28,6 +28,7 @@ class pollController extends poll
$logged_info = Context::get('logged_info');
$vars = Context::getRequestVars();
$args = new stdClass;
$tmp_args = array();
foreach($vars as $key => $val)
{
@ -41,6 +42,7 @@ class pollController extends poll
if($logged_info->is_admin != 'Y') $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
$tmp_args[$poll_index] = new stdClass;
if($tmp_arr[0]=='title') $tmp_args[$poll_index]->title = $val;
else if($tmp_arr[0]=='checkcount') $tmp_args[$poll_index]->checkcount = $val;
else if($tmp_arr[0]=='item') $tmp_args[$poll_index]->item[] = $val;
@ -64,7 +66,6 @@ class pollController extends poll
$oDB->begin();
// Register the poll
unset($poll_args);
$poll_args = new stdClass;
$poll_args->poll_srl = $poll_srl;
$poll_args->member_srl = $member_srl;
@ -81,7 +82,6 @@ class pollController extends poll
// Individual poll registration
foreach($args->poll as $key => $val)
{
unset($title_args);
$title_args = new stdClass;
$title_args->poll_srl = $poll_srl;
$title_args->poll_index_srl = getNextSequence();
@ -101,7 +101,6 @@ class pollController extends poll
// Add the individual survey items
foreach($val->item as $k => $v)
{
unset($item_args);
$item_args = new stdClass;
$item_args->poll_srl = $poll_srl;
$item_args->poll_index_srl = $title_args->poll_index_srl;
@ -128,8 +127,8 @@ class pollController extends poll
*/
function procPoll()
{
$poll_srl = Context::get('poll_srl');
$poll_srl_indexes = Context::get('poll_srl_indexes');
$poll_srl = Context::get('poll_srl');
$poll_srl_indexes = Context::get('poll_srl_indexes');
$tmp_item_srls = explode(',',$poll_srl_indexes);
for($i=0;$i<count($tmp_item_srls);$i++)
{
@ -183,7 +182,7 @@ class pollController extends poll
$oDB->commit();
$skin = Context::get('skin');
$skin = Context::get('skin');
if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default';
// Get tpl
$tpl = $oPollModel->getPollHtml($poll_srl, '', $skin);
@ -201,9 +200,9 @@ class pollController extends poll
*/
function procPollViewResult()
{
$poll_srl = Context::get('poll_srl');
$poll_srl = Context::get('poll_srl');
$skin = Context::get('skin');
$skin = Context::get('skin');
if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default';
$oPollModel = &getModel('poll');