diff --git a/classes/cache/CacheFile.class.php b/classes/cache/CacheFile.class.php index 7dcd5cea98..bbd222b1fa 100644 --- a/classes/cache/CacheFile.class.php +++ b/classes/cache/CacheFile.class.php @@ -73,10 +73,13 @@ function isSupport() function put($key, $obj, $valid_time = 0) { $cache_file = $this->getCacheFileName($key); + $data = serialize($obj); + $data = str_replace('\\', '\\\\', $data); + $data = str_replace('\'', '\\\'', $data); $content = array(); $content[] = 'makeConfigFile(); } + if(version_compare(PHP_VERSION, '7.0', '>=')) + { + $db_info->master_db["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $db_info->master_db["db_type"]); + foreach($db_info->slave_db as &$slave_db_info) + { + $slave_db_info["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $slave_db_info["db_type"]); + } + } + if(!$db_info->use_prepared_statements) { $db_info->use_prepared_statements = 'Y'; @@ -1287,6 +1297,7 @@ function _setJSONRequestArgument() foreach($params as $key => $val) { + $key = htmlentities($key); $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); } } diff --git a/config/config.inc.php b/config/config.inc.php index 4caa8f7908..981ec4d167 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -29,7 +29,7 @@ /** * Display XE's full version. */ -define('__XE_VERSION__', '1.11.1'); +define('__XE_VERSION__', '1.11.2'); define('__XE_VERSION_ALPHA__', (stripos(__XE_VERSION__, 'alpha') !== false)); define('__XE_VERSION_BETA__', (stripos(__XE_VERSION__, 'beta') !== false)); define('__XE_VERSION_RC__', (stripos(__XE_VERSION__, 'rc') !== false)); diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index a202ac1e1b..c000f4a238 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -1095,35 +1095,44 @@ function updateVotedCount($comment_srl, $point = 1) return new BaseObject(-1, $failed_voted); } + // Call a trigger (before) + $trigger_obj = new stdClass; + $trigger_obj->member_srl = $oComment->get('member_srl'); + $trigger_obj->module_srl = $oComment->get('module_srl'); + $trigger_obj->document_srl = $oComment->get('document_srl'); + $trigger_obj->comment_srl = $oComment->get('comment_srl'); + $trigger_obj->update_target = ($point < 0) ? 'blamed_count' : 'voted_count'; + $trigger_obj->point = $point; + $trigger_obj->before_point = ($point < 0) ? $oComment->get('blamed_count') : $oComment->get('voted_count'); + $trigger_obj->after_point = $trigger_obj->before_point + $point; + $trigger_output = ModuleHandler::triggerCall('comment.updateVotedCount', 'before', $trigger_obj); + if(!$trigger_output->toBool()) + { + return $trigger_output; + } + // begin transaction $oDB = DB::getInstance(); $oDB->begin(); // update the number of votes - if($point < 0) + if($trigger_obj->update_target === 'blamed_count') { - $args->blamed_count = $oComment->get('blamed_count') + $point; + $args->blamed_count = $trigger_obj->after_point; $output = executeQuery('comment.updateBlamedCount', $args); } else { - $args->voted_count = $oComment->get('voted_count') + $point; + $args->voted_count = $trigger_obj->after_point; $output = executeQuery('comment.updateVotedCount', $args); } // leave logs - $args->point = $point; + $args->point = $trigger_obj->point; $output = executeQuery('comment.insertCommentVotedLog', $args); - $obj = new stdClass(); - $obj->member_srl = $oComment->get('member_srl'); - $obj->module_srl = $oComment->get('module_srl'); - $obj->comment_srl = $oComment->get('comment_srl'); - $obj->update_target = ($point < 0) ? 'blamed_count' : 'voted_count'; - $obj->point = $point; - $obj->before_point = ($point < 0) ? $oComment->get('blamed_count') : $oComment->get('voted_count'); - $obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count; - $trigger_output = ModuleHandler::triggerCall('comment.updateVotedCount', 'after', $obj); + // Call a trigger (after) + $trigger_output = ModuleHandler::triggerCall('comment.updateVotedCount', 'after', $trigger_obj); if(!$trigger_output->toBool()) { $oDB->rollback(); @@ -1137,13 +1146,13 @@ function updateVotedCount($comment_srl, $point = 1) // Return the result $output = new BaseObject(0, $success_message); - if($point > 0) + if($trigger_obj->update_target === 'voted_count') { - $output->add('voted_count', $obj->after_point); + $output->add('voted_count', $trigger_obj->after_point); } else { - $output->add('blamed_count', $obj->after_point); + $output->add('blamed_count', $trigger_obj->after_point); } return $output; diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php index a643de3367..a2b1aadb5b 100644 --- a/modules/comment/comment.model.php +++ b/modules/comment/comment.model.php @@ -508,6 +508,13 @@ function getCommentList($document_srl, $page = 0, $is_admin = FALSE, $count = 0) $args->status = 1; } + // call trigger (before) + $trigger_output = ModuleHandler::triggerCall('comment.getCommentList', 'before', $args); + if($trigger_output instanceof BaseObject && !$trigger_output->toBool()) + { + return $output; + } + $output = executeQueryArray('comment.getCommentPageList', $args); // return if an error occurs in the query results @@ -527,6 +534,13 @@ function getCommentList($document_srl, $page = 0, $is_admin = FALSE, $count = 0) } } + // call trigger (after) + $trigger_output = ModuleHandler::triggerCall('comment.getCommentList', 'after', $output); + if($trigger_output instanceof BaseObject && !$trigger_output->toBool()) + { + return $trigger_output; + } + return $output; } diff --git a/modules/communication/communication.controller.php b/modules/communication/communication.controller.php index 88a04b26ac..7abfd9f848 100644 --- a/modules/communication/communication.controller.php +++ b/modules/communication/communication.controller.php @@ -125,6 +125,8 @@ function procCommunicationSendMessage() return $output; } + $message_srl = $output->get('message_srl'); + // send an e-mail if($send_mail == 'Y') { @@ -140,7 +142,7 @@ function procCommunicationSendMessage() if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) { - if(Context::get('is_popup') != 'Y') + if(Context::get('is_popup') === 'Y') { global $lang; htmlHeader(); @@ -153,7 +155,7 @@ function procCommunicationSendMessage() else { $this->setMessage('success_sended'); - $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('','act', 'dispCommunicationMessages', 'message_type', 'S', 'receiver_srl', $receiver_srl, 'message_srl', ''); + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('act', 'dispCommunicationMessages', 'message_type', 'S', 'message_srl', $message_srl); $this->setRedirectUrl($returnUrl); } } @@ -262,7 +264,10 @@ function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log = $oDB->commit(); - return new BaseObject(0, 'success_sended'); + $result = new BaseObject(0, 'success_sended'); + $result->add('message_srl', $message_srl); + + return $result; } /** diff --git a/modules/communication/communication.mobile.php b/modules/communication/communication.mobile.php index e131da444d..bd5ef2de0c 100644 --- a/modules/communication/communication.mobile.php +++ b/modules/communication/communication.mobile.php @@ -178,7 +178,24 @@ function dispCommunicationSendMessage() return $this->stop('msg_invalid_request'); } + $oEditorModel = getModel('editor'); + $option = new stdClass(); + $option->primary_key_name = 'receiver_srl'; + $option->content_key_name = 'new_content'; + $option->allow_fileupload = FALSE; + $option->enable_autosave = FALSE; + $option->enable_default_component = TRUE; + $option->enable_component = FALSE; + $option->resizable = FALSE; + $option->disable_html = TRUE; + $option->height = 150; + $option->skin = $this->communication_config->editor_skin; + $option->colorset = $this->communication_config->editor_colorset; + $editor = $oEditorModel->getEditor($logged_info->member_srl, $option); + Context::set('receiver_info', $receiver_info); + Context::set('editor', $editor); + $this->setTemplateFile('send_message'); } diff --git a/modules/communication/m.skins/default/js/communication.js b/modules/communication/m.skins/default/js/communication.js index e37272d415..65c0e810b3 100644 --- a/modules/communication/m.skins/default/js/communication.js +++ b/modules/communication/m.skins/default/js/communication.js @@ -13,10 +13,20 @@ function completeDeleteMessage(ret_obj) { location.href = current_url.setQuery('message_srl',''); } -function mergeContents() -{ - var $form = jQuery('#fo_comm'); - var content = $form.find('textarea[name=new_content]').val() + $form.find('input[name=source_content]').val(); - $form.find('input[name=content]').val(content); - $form.submit(); +function mergeContents(data) { + var $form = jQuery('#fo_comm') + var editotSequence = data.editor_sequence || null + var content = '' + var sourceContent = $form.find('input[name=source_content]').val() || '' + + if (editotSequence) { + content = editorGetContent(editotSequence) + } else { + content = $form.find('[name=new_content]').val() + } + + content += sourceContent + + $form.find('input[name=content]').val(content) + $form.submit() } diff --git a/modules/communication/m.skins/default/send_message.html b/modules/communication/m.skins/default/send_message.html index 1b7c1834ca..c3d4f1470d 100644 --- a/modules/communication/m.skins/default/send_message.html +++ b/modules/communication/m.skins/default/send_message.html @@ -9,13 +9,11 @@

{$lang->cmd_send_message}

- - + -
{$lang->cmd_back} - +
diff --git a/modules/communication/skins/default/send_message.html b/modules/communication/skins/default/send_message.html index 1adf2984ee..aabf5cfd23 100644 --- a/modules/communication/skins/default/send_message.html +++ b/modules/communication/skins/default/send_message.html @@ -8,7 +8,8 @@

{$lang->cmd_send_message}

- + + diff --git a/modules/document/document.admin.view.php b/modules/document/document.admin.view.php index 696ac78847..258b227d4d 100644 --- a/modules/document/document.admin.view.php +++ b/modules/document/document.admin.view.php @@ -50,7 +50,7 @@ function dispDocumentAdminList() // get a list $oDocumentModel = getModel('document'); - $columnList = array('document_srl', 'module_srl', 'title', 'member_srl', 'nick_name', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status', 'category_srl'); + $columnList = array('document_srl', 'module_srl', 'title', 'member_srl', 'nick_name', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status', 'category_srl', 'comment_count'); $output = $oDocumentModel->getDocumentList($args, false, true, $columnList); // get Status name list diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index c51f1722c7..b2c03e27a3 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -1120,36 +1120,45 @@ function updateVotedCount($document_srl, $point = 1) return new BaseObject(-1, $failed_voted); } + // Call a trigger (before) + $trigger_obj = new stdClass; + $trigger_obj->member_srl = $oDocument->get('member_srl'); + $trigger_obj->module_srl = $oDocument->get('module_srl'); + $trigger_obj->document_srl = $oDocument->get('document_srl'); + $trigger_obj->update_target = ($point < 0) ? 'blamed_count' : 'voted_count'; + $trigger_obj->point = $point; + $trigger_obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count'); + $trigger_obj->after_point = $trigger_obj->before_point + $point; + $trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'before', $trigger_obj); + if(!$trigger_output->toBool()) + { + return $trigger_output; + } + // begin transaction $oDB = DB::getInstance(); $oDB->begin(); // Update the voted count - if($point < 0) + if($trigger_obj->update_target === 'blamed_count') { - $args->blamed_count = $oDocument->get('blamed_count') + $point; + $args->blamed_count = $trigger_obj->after_point; $output = executeQuery('document.updateBlamedCount', $args); } else { - $args->voted_count = $oDocument->get('voted_count') + $point; + $args->voted_count = $trigger_obj->after_point; $output = executeQuery('document.updateVotedCount', $args); } if(!$output->toBool()) return $output; + // Leave logs - $args->point = $point; + $args->point = $trigger_obj->point; $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'); - $obj->update_target = ($point < 0) ? 'blamed_count' : 'voted_count'; - $obj->point = $point; - $obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count'); - $obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count; - $trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $obj); + // Call a trigger (after) + $trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $trigger_obj); if(!$trigger_output->toBool()) { $oDB->rollback(); @@ -1171,15 +1180,15 @@ function updateVotedCount($document_srl, $point = 1) // Return result $output = new BaseObject(); - if($point > 0) + if($trigger_obj->update_target === 'voted_count') { $output->setMessage('success_voted'); - $output->add('voted_count', $obj->after_point); + $output->add('voted_count', $trigger_obj->after_point); } else { $output->setMessage('success_blamed'); - $output->add('blamed_count', $obj->after_point); + $output->add('blamed_count', $trigger_obj->after_point); } return $output; @@ -1838,6 +1847,9 @@ function makeCategoryFile($module_srl) { // Return if there is no information you need for creating a cache file if(!$module_srl) return false; + + $module_srl = (int)$module_srl; + // Get module information (to obtain mid) $oModuleModel = getModel('module'); $columnList = array('module_srl', 'mid', 'site_srl'); @@ -2229,16 +2241,17 @@ function procDocumentManageCheckedDocument() } $type = Context::get('type'); - $target_module = Context::get('target_module'); + $target_module = Context::get('target_module_srl'); $module_srl = Context::get('module_srl'); if($target_module && !$module_srl) $module_srl = $target_module; - $category_srl = Context::get('target_category'); - $message_content = Context::get('message_content'); + $category_srl = Context::get('target_category_srl'); + $message_content = strip_tags(Context::get('message_content')); if($message_content) $message_content = nl2br($message_content); $cart = Context::get('cart'); - if(!is_array($cart)) $document_srl_list = explode('|@|', $cart); - else $document_srl_list = $cart; + $document_srl_list = (!is_array($cart)) ? explode('|@|', $cart) : $cart; + + array_map(function ($value) { return (int)$value; }, $document_srl_list); $document_srl_count = count($document_srl_list); diff --git a/modules/document/document.item.php b/modules/document/document.item.php index 6f4fb2dcff..fcf0e094a7 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -781,6 +781,9 @@ function getComments() Context::set('cpage', $output->page_navigation->cur_page); if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; + // Call trigger (after) + $output = ModuleHandler::triggerCall('document.getComments', 'after', $comment_list); + return $comment_list; } diff --git a/modules/document/document.model.php b/modules/document/document.model.php index 81405c7c3b..f14354a5fd 100644 --- a/modules/document/document.model.php +++ b/modules/document/document.model.php @@ -747,6 +747,8 @@ function getCategoryChlidCount($category_srl) */ function getCategoryList($module_srl, $columnList = array()) { + $module_srl = (int)$module_srl; + // Category of the target module file swollen $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); // If the target file to the cache file regeneration category diff --git a/modules/document/tpl/checked_list.html b/modules/document/tpl/checked_list.html index 2814b3afb6..9add61a116 100644 --- a/modules/document/tpl/checked_list.html +++ b/modules/document/tpl/checked_list.html @@ -24,7 +24,7 @@

{$lang->cmd_manage_document}

- + {$lang->cmd_select} @@ -33,7 +33,7 @@

{$lang->cmd_manage_document}

- +
diff --git a/modules/editor/editor.controller.php b/modules/editor/editor.controller.php index 2700100e93..c40972bd1e 100644 --- a/modules/editor/editor.controller.php +++ b/modules/editor/editor.controller.php @@ -476,36 +476,32 @@ function makeCache($filter_enabled = true, $site_srl) } // Return if it checks enabled only - if($filter_enabled) - { - $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); - $buff = sprintf('', str_replace('"','\\"',serialize($component_list))); - FileHandler::writeFile($cache_file, $buff); - return $component_list; + if(!$filter_enabled) { + // Get xml_info of downloaded list + foreach($downloaded_list as $component_name) + { + if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue; + if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; + // Pass if configured + if($component_list->{$component_name}) continue; + // Insert data into the DB + $oEditorController = getAdminController('editor'); + $oEditorController->insertComponent($component_name, false, $site_srl); + // Add to component_list + unset($xml_info); + $xml_info = $oEditorModel->getComponentXmlInfo($component_name); + $xml_info->enabled = 'N'; + + $component_list->{$component_name} = $xml_info; + } } - // Get xml_info of downloaded list - foreach($downloaded_list as $component_name) - { - if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue; - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; - // Pass if configured - if($component_list->{$component_name}) continue; - // Insert data into the DB - $oEditorController = getAdminController('editor'); - $oEditorController->insertComponent($component_name, false, $site_srl); - // Add to component_list - unset($xml_info); - $xml_info = $oEditorModel->getComponentXmlInfo($component_name); - $xml_info->enabled = 'N'; - - $component_list->{$component_name} = $xml_info; + $oCacheHandler = CacheHandler::getInstance('object', null, true); + if($oCacheHandler->isSupport()) { + $cache_key = $oEditorModel->getComponentListCacheKey($filter_enabled, $site_srl); + $oCacheHandler->put($cache_key, $component_list); } - $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); - $buff = sprintf('', str_replace('"','\\"',serialize($component_list))); - FileHandler::writeFile($cache_file, $buff); - return $component_list; } @@ -517,6 +513,14 @@ function removeCache($site_srl = 0) $oEditorModel = getModel('editor'); FileHandler::removeFile($oEditorModel->getCacheFile(true, $site_srl)); FileHandler::removeFile($oEditorModel->getCacheFile(false, $site_srl)); + + $oCacheHandler = CacheHandler::getInstance('object', null, true); + if($oCacheHandler->isSupport()) { + $cache_key = $oEditorModel->getComponentListCacheKey(true, $site_srl); + $oCacheHandler->delete($cache_key); + $cache_key = $oEditorModel->getComponentListCacheKey(false, $site_srl); + $oCacheHandler->delete($cache_key); + } } function triggerCopyModule(&$obj) diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index 0a5dc34084..2248607ebe 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -228,6 +228,9 @@ function getEditor($upload_target_srl = 0, $option = null) // Set Height if(!$option->height) $editor_height = 300; else $editor_height = $option->height; + if(Mobile::isFromMobilePhone()) { + $editor_height = 150; + } // Skin Setting $skin = $option->skin; if(!$skin) $skin = 'ckeditor'; @@ -594,20 +597,38 @@ function getCacheFile($filter_enabled= true, $site_srl = 0) return $cache_file; } + function getComponentListCacheKey($filter_enabled = true, $site_srl = 0) + { + $cache_key = array(); + $cache_key[] = Context::getLangType(); + if ($filter_enabled) $cache_key[] = 'filter'; + if ($site_srl) $cache_key[] = $site_srl; + + return 'editor.component_list:' . implode('.', $cache_key); + } + /** * @brief Return a component list (DB Information included) */ function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false) { - $cache_file = $this->getCacheFile(false, $site_srl); - if($from_db || !file_exists($cache_file)) + $component_list = false; + + $oCacheHandler = CacheHandler::getInstance('object', null, true); + if($oCacheHandler->isSupport()) { + $cache_key = $this->getComponentListCacheKey(false, $site_srl); + $component_list = $oCacheHandler->get($cache_key); + } + + if($from_db || $component_list === false) { $oEditorController = getController('editor'); - $oEditorController->makeCache(false, $site_srl); + $component_list = $oEditorController->makeCache(false, $site_srl); + } - if(!file_exists($cache_file)) return; - include($cache_file); + if(!$component_list) return array(); + $logged_info = Context::get('logged_info'); if($logged_info && is_array($logged_info->group_list)) { diff --git a/modules/editor/skins/ckeditor/editor.html b/modules/editor/skins/ckeditor/editor.html index 2b71093ea6..f8e2abcaed 100755 --- a/modules/editor/skins/ckeditor/editor.html +++ b/modules/editor/skins/ckeditor/editor.html @@ -29,6 +29,10 @@ +{@ + $editorContentCssFilemtime = filemtime(_XE_PATH_ . $content_style_path . '/editor.css'); +} +