Skip to content

Commit

Permalink
Merge branch 'release/1.11.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bnu committed Dec 18, 2018
2 parents 44a98c2 + 2b15157 commit 636838f
Show file tree
Hide file tree
Showing 69 changed files with 246 additions and 1,981 deletions.
7 changes: 5 additions & 2 deletions classes/cache/CacheFile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = '<?php';
$content[] = 'if(!defined(\'__XE__\')) { exit(); }';
$content[] = 'return \'' . addslashes(serialize($obj)) . '\';';
$content[] = 'return \'' . $data . '\';';
FileHandler::writeFile($cache_file, implode(PHP_EOL, $content));
if(function_exists('opcache_invalidate'))
{
Expand Down Expand Up @@ -131,7 +134,7 @@ function get($key, $modified_time = 0)

$content = include($cache_file);

return unserialize(stripslashes($content));
return unserialize($content);
}

/**
Expand Down
11 changes: 11 additions & 0 deletions classes/context/Context.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ function init()
{
$oSessionModel = getModel('session');
$oSessionController = getController('session');
ini_set('session.serialize_handler', 'php');
session_set_save_handler(
array(&$oSessionController, 'open'), array(&$oSessionController, 'close'), array(&$oSessionModel, 'read'), array(&$oSessionController, 'write'), array(&$oSessionController, 'destroy'), array(&$oSessionController, 'gc')
);
Expand Down Expand Up @@ -487,6 +488,15 @@ function loadDBInfo()
$oInstallController->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';
Expand Down Expand Up @@ -1287,6 +1297,7 @@ function _setJSONRequestArgument()

foreach($params as $key => $val)
{
$key = htmlentities($key);
$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
}
}
Expand Down
2 changes: 1 addition & 1 deletion config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
41 changes: 25 additions & 16 deletions modules/comment/comment.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions modules/comment/comment.model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand Down
11 changes: 8 additions & 3 deletions modules/communication/communication.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ function procCommunicationSendMessage()
return $output;
}

$message_srl = $output->get('message_srl');

// send an e-mail
if($send_mail == 'Y')
{
Expand All @@ -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();
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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;
}

/**
Expand Down
17 changes: 17 additions & 0 deletions modules/communication/communication.mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
22 changes: 16 additions & 6 deletions modules/communication/m.skins/default/js/communication.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
9 changes: 4 additions & 5 deletions modules/communication/m.skins/default/send_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ <h2>{$lang->cmd_send_message}</h2>
</div>
<form ruleset="sendMessage" action="./" method="post" class="ff" id="fo_comm">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="is_popup" value="Y" />
<input type="hidden" name="act" value="procCommunicationSendMessage" />
<input type="hidden" name="receiver_srl" value="{$receiver_info->member_srl}" />
<input type="hidden" name="source_content" value="{$source_message->content}" />
<input type="hidden" name="source_content" value="{$source_message->content|autoescape}" />
<input type="hidden" name="content" value="" />
<input type="hidden" name="xe_validator_id" value="modules/communication/m.skins/default/send_message/1" />
<input type="hidden" name="success_return_url" value="{getNotEncodedUrl('','act', 'dispCommunicationSendMessage', 'receiver_srl', $receiver_info->member_srl)}" />
<ul>
<li>
<span class="memberInfo">{$receiver_info->nick_name}</span>
Expand All @@ -29,15 +27,16 @@ <h2>{$lang->cmd_send_message}</h2>
</li>
<li>
<label for="message_content">{$lang->content}</label>
<textarea id="message_content" name="new_content" rows="8" style="width:100%"></textarea>
<textarea name="new_content" style="display:none;"></textarea>
{$editor}
</li>
<li>
<span id="message_send_mail"><input type="checkbox" value="Y" name="send_mail" /> {$lang->cmd_send_mail}</span>
</li>
</ul>
<div class="bna">
<span class="fl"><a href="{getUrl('act', 'dispCommunicationMessages')}" class="bn white">{$lang->cmd_back}</a></span>
<span class="fr"><button type="button" class="bn white" onClick="mergeContents();">{$lang->cmd_send_message}</button></span>
<span class="fr"><button type="button" class="bn white" onClick="mergeContents({editor_sequence: '{$editor_sequence}'});">{$lang->cmd_send_message}</button></span>
</div>
</form>

Expand Down
3 changes: 2 additions & 1 deletion modules/communication/skins/default/send_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ <h1>{$lang->cmd_send_message}</h1>
<form ruleset="sendMessage" action="./" method="post">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="act" value="procCommunicationSendMessage" />
<input type="hidden" name="content" value="{$source_message->content}" />
<input type="hidden" name="is_popup" value="Y" />
<input type="hidden" name="content" value="{$source_message->content|autoescape}" />
<input type="hidden" name="receiver_srl" value="{$receiver_info->member_srl}" />
<input type="hidden" name="xe_validator_id" value="modules/communication/skins/default/send_message/1" />
<table class="table table-striped table-hover">
Expand Down
2 changes: 1 addition & 1 deletion modules/document/document.admin.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 636838f

Please sign in to comment.