merge from 1.5.3.2 (~r11225)

git-svn-id: http://xe-core.googlecode.com/svn/trunk@11226 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-09-13 06:14:45 +00:00
parent 54e3a72065
commit 77f5aa2671
313 changed files with 8058 additions and 14251 deletions

View file

@ -82,7 +82,7 @@
$document_srl = $obj->document_srl;
if(!$document_srl) return new Object();
return $this->deleteComments($document_srl, true);
return $this->deleteComments($document_srl, $obj);
}
/**
@ -206,7 +206,11 @@
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
if(Mobile::isFromMobilePhone())
{
$obj->content = nl2br(htmlspecialchars($obj->content));
if($obj->use_html != 'Y')
{
$obj->content = htmlspecialchars($obj->content);
}
$obj->content = nl2br($obj->content);
}
if(!$obj->regdate) $obj->regdate = date("YmdHis");
// remove iframe and script if not a top administrator on the session.
@ -545,16 +549,55 @@
$oCommentModel = &getModel('comment');
// check if comment already exists
$comment = $oCommentModel->getComment($comment_srl);
if($comment->comment_srl != $comment_srl) return new Object(-1, 'msg_invalid_request');
if($comment->comment_srl != $comment_srl)
{
return new Object(-1, 'msg_invalid_request');
}
$document_srl = $comment->document_srl;
// call a trigger (before)
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
if(!$output->toBool()) return $output;
// check if child comment exists on the comment
$child_count = $oCommentModel->getChildCommentCount($comment_srl);
if($child_count>0) return new Object(-1, 'fail_to_delete_have_children');
if(!$output->toBool())
{
return $output;
}
// check if permission is granted
if(!$is_admin && !$comment->isGranted()) return new Object(-1, 'msg_not_permitted');
if(!$is_admin && !$comment->isGranted())
{
return new Object(-1, 'msg_not_permitted');
}
// check if child comment exists on the comment
$childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0)
{
$deleteAllComment = true;
if (!$is_admin)
{
$logged_info = Context::get('logged_info');
foreach($childs as $val)
{
if($val->member_srl != $logged_info->member_srl)
{
$deleteAllComment = false;
break;
}
}
}
if(!$deleteAllComment)
{
return new Object(-1, 'fail_to_delete_have_children');
}
else
{
foreach($childs as $val)
{
$output = $this->deleteComment($val->comment_srl, $is_admin, $isMoveToTrash);
if(!$output->toBool()) return $output;
}
}
}
// begin transaction
$oDB = &DB::getInstance();
@ -623,12 +666,21 @@
* @param int $document_srl
* @return object
*/
function deleteComments($document_srl) {
function deleteComments($document_srl, $obj = NULL) {
// create the document model object
$oDocumentModel = &getModel('document');
$oCommentModel = &getModel('comment');
// check if permission is granted
$oDocument = $oDocumentModel->getDocument($document_srl);
// check if permission is granted
if(is_object($obj))
{
$oDocument = new documentItem();
$oDocument->setAttribute($obj);
}
else
{
$oDocument = $oDocumentModel->getDocument($document_srl);
}
if(!$oDocument->isExists() || !$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
// get a list of comments and then execute a trigger(way to reduce the processing cost for delete all)
$args->document_srl = $document_srl;
@ -742,6 +794,10 @@
return new Object(-1, $failed_voted);
}
// begin transaction
$oDB = DB::getInstance();
$oDB->begin();
// update the number of votes
if($point < 0) {
$args->blamed_count = $oComment->get('blamed_count') + $point;
@ -753,6 +809,23 @@
// leave logs
$args->point = $point;
$output = executeQuery('comment.insertCommentVotedLog', $args);
$obj->member_srl = $oComment->get('member_srl');
$obj->module_srl = $oComment->get('module_srl');
$obj->comment_srl = $oComment->get('comment');
$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);
if(!$trigger_output->toBool())
{
$oDB->rollback();
return $trigger_output;
}
$oDB->commit();
// leave into session information
$_SESSION['voted_comment'][$comment_srl] = true;

View file

@ -71,7 +71,7 @@
$url = getUrl('','module','admin','act','dispCommentAdminList','search_target','ipaddress','search_keyword',$oComment->getIpAddress());
$oCommentController->addCommentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
$url = sprintf("var params = new Array(); params['ipaddress']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress());
$url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress());
$oCommentController->addCommentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript');
}
}
@ -107,6 +107,17 @@
return (int)$output->data->count;
}
/**
* Returns the number of child comments
* @param int $comment_srl
* @return int
*/
function getChildComments($comment_srl) {
$args->comment_srl = $comment_srl;
$output = executeQueryArray('comment.getChildComments', $args);
return $output->data;
}
/**
* Get the comment
* @param int $comment_srl

View file

@ -251,9 +251,11 @@
<item name="published_name_list" type="array">
<item name="Y">
<value xml:lang="en"><![CDATA[Published]]></value>
<value xml:lang="ko"><![CDATA[공개 발행]]></value>
</item>
<item name="N">
<value xml:lang="en"><![CDATA[Unpublished]]></value>
<value xml:lang="ko"><![CDATA[발행 대기]]></value>
</item>
</item>
<item name="comment_manager">
@ -266,7 +268,7 @@
<value xml:lang="ko"><![CDATA[선택한 댓글]]></value>
<value xml:lang="en"><![CDATA[Selected Comment]]></value>
<value xml:lang="jp"><![CDATA[選択したコメント]]></value>
<value xml:lang="zh-TW"><![CDATA[已選回覆]]></value>
<value xml:lang="zh-TW"><![CDATA[已選回覆]]></value>
</item>
<item name="cmd_comment_validation">
<value xml:lang="en"><![CDATA[Use comment validation]]></value>
@ -276,11 +278,22 @@
</item>
<item name="published">
<value xml:lang="en"><![CDATA[Publish status]]></value>
<value xml:lang="ko"><![CDATA[발행 상태]]></value>
</item>
<item name="cmd_publish">
<value xml:lang="en"><![CDATA[Publish]]></value>
<value xml:lang="ko"><![CDATA[발행]]></value>
</item>
<item name="cmd_unpublish">
<value xml:lang="en"><![CDATA[Unpublish]]></value>
<value xml:lang="ko"><![CDATA[발행 중지]]></value>
</item>
<item name="select_module">
<value xml:lang="ko"><![CDATA[모듈 선택]]></value>
<value xml:lang="en"><![CDATA[Select Module]]></value>
</item>
<item name="page">
<value xml:lang="ko"><![CDATA[페이지]]></value>
<value xml:lang="en"><![CDATA[Page]]></value>
</item>
</lang>

View file

@ -0,0 +1,12 @@
<query id="getChildComments" action="select">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="comment_srl" />
<column name="member_srl" />
</columns>
<conditions>
<condition operation="equal" column="parent_srl" var="comment_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -18,8 +18,8 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
| <a href="{getUrl('search_target','is_published','search_keyword', 'Y')}" <!--@if($search_target == 'is_published' && $search_keyword == 'Y')-->class="active"<!--@end-->>{$lang->published_name_list['Y']}</a>
<block cond="$modules_list">
| <label for="comment_modules" <!--@if($search_target == 'module')-->class="active"<!--@end-->>Select Module:
<select id="comment_modules" name="comment_modules" onchange="location.href='{getUrl('search_target','module','search_keyword','')}&search_keyword='+this.value">
| <label for="comment_modules" <!--@if($search_target == 'module')-->class="active"<!--@end-->>{$lang->select_module}:
<select id="comment_modules" name="comment_modules" onchange="location.href='{getUrl('search_target','module','search_keyword','')}&amp;search_keyword='+this.value">
<option></option>
<!--@foreach($modules_list as $key => $node)-->
<option value="{$key}"<!--@if($key==$search_keyword)-->selected<!--@end-->>{$node}</option>
@ -136,14 +136,14 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
</form>
</div>
<div class="search">
<form action="" class="pagination">
<form action="./" class="pagination">
<input type="hidden" name="error_return_url" value="" />
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="{$act}" />
<input cond="$search_keyword" type="hidden" name="search_keyword" value="{$search_keyword}" />
<input cond="$search_target" type="hidden" name="search_target" value="{$search_target}" />
<a href="{getUrl('page', '')}" class="direction">&laquo; FIRST</a>
<a href="{getUrl('page', '')}" class="direction">&laquo; {$lang->first_page}</a>
<block cond="$page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page && $page_navigation->page_count != $page_navigation->total_page">
{@$isGoTo = true}
<a href="{getUrl('page', '')}">1</a>
@ -159,7 +159,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<a href="#goTo" class="tgAnchor" title="{$lang->cmd_go_to_page}">...</a>
<a href="{getUrl('page', $page_navigation->last_page)}">{$page_navigation->last_page}</a>
</block>
<a href="{getUrl('page', $page_navigation->last_page)}" class="direction">LAST &raquo;</a>
<a href="{getUrl('page', $page_navigation->last_page)}" class="direction">{$lang->last_page} &raquo;</a>
<span cond="$isGoTo" id="goTo" class="tgContent">
<input name="page" title="{$lang->cmd_go_to_page}" />
<button type="submit">Go</button>

View file

@ -13,7 +13,7 @@
<!-- 목록 -->
<div class="table">
<table width="100%" border="1" cellspacing="0">
<caption>Total {number_format($total_count)}, Page {number_format($page)}/{number_format($total_page)}</caption>
<caption>{$lang->all} {number_format($total_count)}, {$lang->page} {number_format($page)}/{number_format($total_page)}</caption>
<thead>
<tr>
<th scope="col"><input type="checkbox" onclick="XE.checkboxToggleAll(); return false;" /></th>
@ -49,7 +49,7 @@
<!-- 페이지 네비게이션 -->
<div class="pagination">
<a href="{getUrl('page','','module_srl','')}" class="direction">&lsaquo; {$lang->first_page}</a>
<a href="{getUrl('page','','module_srl','')}" class="direction">&laquo; {$lang->first_page}</a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
<strong>{$page_no}</strong>
@ -57,5 +57,5 @@
<a href="{getUrl('page',$page_no,'module_srl','')}">{$page_no}</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'module_srl','')}" class="direction">{$lang->last_page} &rsaquo;</a>
<a href="{getUrl('page',$page_navigation->last_page,'module_srl','')}" class="direction">{$lang->last_page} &raquo;</a>
</div>