mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
댓글 신고시 신고 이유를 적을 수 있게 함
- 댓글에도 신고 이유를 적을 수 있다. - 코드 정리
This commit is contained in:
parent
a9915a7986
commit
4bbd91bd3c
18 changed files with 415 additions and 41 deletions
|
|
@ -140,6 +140,50 @@ class commentAdminView extends comment
|
|||
$this->setTemplateFile('declared_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a reported comment and log of reporting
|
||||
* @return void
|
||||
*/
|
||||
function dispCommentAdminDeclaredLogByCommentSrl()
|
||||
{
|
||||
// option for a list
|
||||
$args = new stdClass;
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||
$args->comment_srl = intval(Context::get('target_srl'));
|
||||
|
||||
|
||||
// get Status name list
|
||||
$oCommentModel = getModel('comment');
|
||||
$oMemberModel = getModel('member');
|
||||
$oComment = $oCommentModel->getComment($args->comment_srl);
|
||||
|
||||
$declared_output = executeQuery('comment.getDeclaredLogByCommentSrl', $args);
|
||||
if($declared_output->data && count($declared_output->data))
|
||||
{
|
||||
$reporter_list = array();
|
||||
|
||||
foreach($declared_output->data as $key => $log)
|
||||
{
|
||||
$reporter_list[$log->member_srl] = $oMemberModel->getMemberInfoByMemberSrl($log->member_srl);
|
||||
}
|
||||
}
|
||||
|
||||
// Set values of document_model::getDocumentList() objects for a template
|
||||
Context::set('total_count', $declared_output->total_count);
|
||||
Context::set('total_page', $declared_output->total_page);
|
||||
Context::set('page', $declared_output->page);
|
||||
Context::set('declare_log', $declared_output->data);
|
||||
Context::set('reporter_list', $reporter_list);
|
||||
Context::set('declared_comment', $oComment);
|
||||
Context::set('page_navigation', $declared_output->page_navigation);
|
||||
|
||||
// Set the template
|
||||
$this->setLayoutFile('popup_layout');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('declared_log');
|
||||
}
|
||||
}
|
||||
/* End of file comment.admin.view.php */
|
||||
/* Location: ./modules/comment/comment.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -101,6 +101,12 @@ class comment extends ModuleObject
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
// 2016. 1. 29: Add a column(declare_message) for report
|
||||
if(!$oDB->isColumnExists("comment_declared_log","declare_message"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -175,6 +181,12 @@ class comment extends ModuleObject
|
|||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after');
|
||||
}
|
||||
|
||||
// 2016. 1. 29: Add a column(declare_message) for report
|
||||
if(!$oDB->isColumnExists("comment_declared_log","declare_message"))
|
||||
{
|
||||
$oDB->addColumn('comment_declared_log',"declare_message","text");
|
||||
}
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,19 @@ class commentController extends comment
|
|||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
return $this->declaredComment($comment_srl);
|
||||
// if an user select message from options, message would be the option.
|
||||
$message_option = strval(Context::get('message_option'));
|
||||
$improper_comment_reasons = Context::getLang('improper_comment_reasons');
|
||||
$declare_message = ($message_option !== 'others' && isset($improper_comment_reasons[$message_option]))?
|
||||
$improper_comment_reasons[$message_option] : trim(Context::get('declare_message'));
|
||||
|
||||
// if there is return url, set that.
|
||||
if(Context::get('success_return_url'))
|
||||
{
|
||||
$this->setRedirectUrl(Context::get('success_return_url'));
|
||||
}
|
||||
|
||||
return $this->declaredComment($comment_srl, $declare_message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1304,9 +1316,10 @@ class commentController extends comment
|
|||
/**
|
||||
* Report a blamed comment
|
||||
* @param $comment_srl
|
||||
* @param string $declare_message
|
||||
* @return void
|
||||
*/
|
||||
function declaredComment($comment_srl)
|
||||
function declaredComment($comment_srl, $declare_message)
|
||||
{
|
||||
// Fail if session information already has a reported document
|
||||
if($_SESSION['declared_comment'][$comment_srl])
|
||||
|
|
@ -1322,6 +1335,7 @@ class commentController extends comment
|
|||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
|
||||
|
||||
$trigger_obj = new stdClass();
|
||||
|
|
@ -1370,7 +1384,9 @@ class commentController extends comment
|
|||
{
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
||||
$args->comment_srl = $comment_srl;
|
||||
$args->declare_message = trim(htmlspecialchars($declare_message));
|
||||
$log_output = executeQuery('comment.getCommentDeclaredLogInfo', $args);
|
||||
|
||||
// session registered if log info contains report log.
|
||||
|
|
@ -1402,6 +1418,13 @@ class commentController extends comment
|
|||
|
||||
// leave the log
|
||||
$output = executeQuery('comment.insertCommentDeclaredLog', $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->add('declared_count', $declared_count + 1);
|
||||
|
||||
// Call a trigger (after)
|
||||
$trigger_obj->declared_count = $declared_count + 1;
|
||||
|
|
@ -1412,6 +1435,7 @@ class commentController extends comment
|
|||
return $trigger_output;
|
||||
}
|
||||
|
||||
// commit
|
||||
$oDB->commit();
|
||||
|
||||
// leave into the session information
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ class commentModel extends comment
|
|||
}
|
||||
|
||||
// Add the report feature against abused posts
|
||||
$url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
|
||||
$oCommentController->addCommentPopupMenu($url, 'cmd_declare', '', 'javascript');
|
||||
$url = getUrl('', 'act', 'dispCommentDeclare', 'target_srl', $comment_srl);
|
||||
$oCommentController->addCommentPopupMenu($url, 'cmd_declare', '', 'popup');
|
||||
}
|
||||
|
||||
// call a trigger (after)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,44 @@ class commentView extends comment
|
|||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Report an improper comment
|
||||
* @return void
|
||||
*/
|
||||
function dispCommentDeclare()
|
||||
{
|
||||
$this->setLayoutFile('popup_layout');
|
||||
$comment_srl = Context::get('target_srl');
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
// A message appears if the user is not logged-in
|
||||
if(!$oMemberModel->isLogged())
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
// Create the comment object.
|
||||
$oCommentModel = getModel('comment');
|
||||
// Creates an object for displaying the selected comment
|
||||
$oComment = $oCommentModel->getComment($comment_srl);
|
||||
if(!$oComment->isExists())
|
||||
{
|
||||
return new Object(-1,'msg_invalid_request');
|
||||
}
|
||||
// Check permissions
|
||||
if(!$oComment->isAccessible())
|
||||
{
|
||||
return new Object(-1,'msg_not_permitted');
|
||||
}
|
||||
|
||||
// Browser title settings
|
||||
Context::set('target_comment', $oComment);
|
||||
|
||||
Context::set('target_srl', $comment_srl);
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('declare_comment');
|
||||
}
|
||||
}
|
||||
/* End of file comment.view.php */
|
||||
/* Location: ./modules/comment/comment.view.php */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module>
|
||||
<grants />
|
||||
<permissions>
|
||||
|
|
@ -8,17 +8,25 @@
|
|||
</permissions>
|
||||
<actions>
|
||||
<action name="getCommentMenu" type="model" />
|
||||
|
||||
<action name="dispCommentAdminList" type="view" admin_index="true" menu_name="comment" menu_index="true" />
|
||||
<action name="dispCommentAdminDeclared" type="view" menu_name="comment" />
|
||||
<action name="dispCommentAdminDeclaredLogByCommentSrl" type="view" menu_name="comment" />
|
||||
|
||||
<action name="dispCommentDeclare" type="view" />
|
||||
<action name="procCommentVoteUp" type="controller" />
|
||||
<action name="procCommentVoteDown" type="controller" />
|
||||
<action name="procCommentDeclare" type="controller" />
|
||||
|
||||
<action name="getCommentVotedMemberList" type="model" />
|
||||
|
||||
<action name="procCommentInsertModuleConfig" type="controller" ruleset="insertCommentModuleConfig" />
|
||||
<action name="procCommentAdminDeleteChecked" type="controller" ruleset="deleteChecked" />
|
||||
<action name="procCommentAdminChangeStatus" type="controller"/>
|
||||
<action name="procCommentAdminChangePublishedStatusChecked" type="controller" />
|
||||
|
||||
<action name="isModuleUsingPublishValidation" type="controller" />
|
||||
|
||||
<action name="procCommentAdminCancelDeclare" type="controller" />
|
||||
<action name="procCommentAdminAddCart" type="controller" />
|
||||
<action name="procCommentGetList" type="controller" />
|
||||
|
|
|
|||
|
|
@ -324,4 +324,54 @@
|
|||
<item name="msg_admin_c_comment_no_delete">
|
||||
<value xml:lang="ko"><![CDATA[이 댓글에 최고관리자의 댓글이 있어 삭제할 수 없습니다.]]></value>
|
||||
</item>
|
||||
<item name="improper_comment_declare">
|
||||
<value xml:lang="ko"><![CDATA[불량 댓글 신고]]></value>
|
||||
<value xml:lang="en"><![CDATA[Report an improper comment]]></value>
|
||||
</item>
|
||||
<item name="declaring_user">
|
||||
<value xml:lang="ko"><![CDATA[신고자]]></value>
|
||||
<value xml:lang="en"><![CDATA[Reporter]]></value>
|
||||
</item>
|
||||
<item name="improper_comment_declare_reason">
|
||||
<value xml:lang="ko"><![CDATA[신고 이유]]></value>
|
||||
<value xml:lang="en"><![CDATA[Reason]]></value>
|
||||
</item>
|
||||
<item name="improper_comment_reasons" type="array">
|
||||
<item name="advertisement">
|
||||
<value xml:lang="ko"><![CDATA[본문 주제나 흐름에 맞지 않는 광고 글입니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Advertisements that do not fit the topics or themes.]]></value>
|
||||
</item>
|
||||
<item name="theme">
|
||||
<value xml:lang="ko"><![CDATA[주제에 맞지 않는 글입니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Comments that do not fit the topics or themes.]]></value>
|
||||
</item>
|
||||
<item name="bad_word">
|
||||
<value xml:lang="ko"><![CDATA[과도한 욕설을 담고 있습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Too much bad words.]]></value>
|
||||
</item>
|
||||
<item name="violence">
|
||||
<value xml:lang="ko"><![CDATA[폭력적인 내용을 담고 있습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Violence.]]></value>
|
||||
</item>
|
||||
<item name="racism">
|
||||
<value xml:lang="ko"><![CDATA[인종차별적인 내용을 담고 있습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Racism.]]></value>
|
||||
</item>
|
||||
<item name="pornography">
|
||||
<value xml:lang="ko"><![CDATA[음란물을 포함하고 있습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Pornography.]]></value>
|
||||
</item>
|
||||
<item name="privacy">
|
||||
<value xml:lang="ko"><![CDATA[민감한 개인정보가 노출 되어있습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Privacy issue.]]></value>
|
||||
</item>
|
||||
<item name="others">
|
||||
<value xml:lang="ko"><![CDATA[기타(직접작성)]]></value>
|
||||
<value xml:lang="en"><![CDATA[Others (Write your own)]]></value>
|
||||
</item>
|
||||
</item>
|
||||
<item name="about_improper_comment_declare">
|
||||
<value xml:lang="ko"><![CDATA[댓글을 신고하신 이유를 간단히 적어서 제출해주시면 관리자 검토 후 조치하겠습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Write here why you report this comment as an improper thing.]]></value>
|
||||
</item>
|
||||
</lang>
|
||||
17
modules/comment/queries/getDeclaredLogByCommentSrl.xml
Normal file
17
modules/comment/queries/getDeclaredLogByCommentSrl.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<query id="getDeclaredLogByCommentSrl" action="select">
|
||||
<tables>
|
||||
<table name="comment_declared_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="comment_srl" var="comment_srl" default="0" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="regdate" order="order_type" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
<query id="insertCommentDeclaredLog" action="insert">
|
||||
<tables>
|
||||
<table name="comment_declared_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="comment_srl" var="comment_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="member_srl" var="member_srl" filter="number" default="0" />
|
||||
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
|
||||
<column name="regdate" var="regdate" default="curdate()" />
|
||||
</columns>
|
||||
<tables>
|
||||
<table name="comment_declared_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="comment_srl" var="comment_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="member_srl" var="member_srl" filter="number" default="0" />
|
||||
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
|
||||
<column name="declare_message" var="declare_message" />
|
||||
<column name="regdate" var="regdate" default="curdate()" />
|
||||
</columns>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<table name="comment_declared_log">
|
||||
<column name="comment_srl" type="number" size="11" notnull="notnull" index="idx_comment_srl" />
|
||||
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
|
||||
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress" />
|
||||
<column name="regdate" type="date" index="idx_regdate" />
|
||||
<column name="comment_srl" type="number" size="11" notnull="notnull" index="idx_comment_srl" />
|
||||
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
|
||||
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress" />
|
||||
<column name="declare_message" type="text" />
|
||||
<column name="regdate" type="date" index="idx_regdate" />
|
||||
</table>
|
||||
|
|
|
|||
19
modules/comment/tpl/css/declare_comment.css
Normal file
19
modules/comment/tpl/css/declare_comment.css
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
@charset "UTF-8";
|
||||
div.xe_mobile {
|
||||
display:none!important;
|
||||
}
|
||||
section.declare_comment{
|
||||
display:block;
|
||||
}
|
||||
section.declare_comment label{
|
||||
font-weight: bold;
|
||||
}
|
||||
section.declare_comment select,section.declare_comment textarea{
|
||||
box-sizing:border-box;
|
||||
height:auto;
|
||||
width: 100%;
|
||||
padding:7px;
|
||||
font-size: 11pt;
|
||||
line-height: normal;
|
||||
display:block;
|
||||
}
|
||||
55
modules/comment/tpl/declare_comment.html
Normal file
55
modules/comment/tpl/declare_comment.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{@Context::addMetaTag('viewport', 'width=device-width, user-scalable=no', FALSE);}
|
||||
<load target="./css/declare_comment.css" />
|
||||
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/comment/tpl/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<section class="declare_comment">
|
||||
<h1>{$lang->improper_comment_declare}</h1>
|
||||
<form action="./" method="post" id="fo_component" ruleset="insertDeclare">
|
||||
<input type="hidden" name="module" value="comment" />
|
||||
<input type="hidden" name="act" value="procCommentDeclare" />
|
||||
<input type="hidden" name="target_srl" value="{$target_srl}" />
|
||||
<input type="hidden" name="success_return_url" value="{getUrl('', 'act', $act, 'target_srl', $target_srl)}" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/comment/tpl/1" />
|
||||
<blockquote>
|
||||
<section class="target_article">
|
||||
<h1>{$lang->replies}</h1>
|
||||
<p>{$target_comment->getSummary(200)}</p>
|
||||
</section>
|
||||
</blockquote>
|
||||
<label class="x_control-label" for="message_option">{$lang->improper_comment_declare_reason}</label>
|
||||
<div class="x_controls">
|
||||
<select name="message_option" id="message_option">
|
||||
<option loop="$lang->improper_comment_reasons => $key,$text" value="{$key}">{$text}</option>
|
||||
</select>
|
||||
<textarea name="declare_message" id="declare_message"></textarea>
|
||||
<p>{$lang->about_improper_comment_declare}<p>
|
||||
</div>
|
||||
<div class="x_clearfix btnArea">
|
||||
<div class="x_pull-right">
|
||||
<button type="submit" class="x_btn x_btn-primary" />{$lang->cmd_submit}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<script>
|
||||
(function($){
|
||||
var msg_area = $('textarea[name="declare_message"]');
|
||||
$('select[name="message_option"]').change(function(){
|
||||
var option = {
|
||||
duration:200,
|
||||
complete: function(){setFixedPopupSize();}
|
||||
}
|
||||
if ($(this).val()==='others') {
|
||||
msg_area.slideDown(option);
|
||||
|
||||
}
|
||||
else {
|
||||
msg_area.slideUp(option);
|
||||
setFixedPopupSize();
|
||||
}
|
||||
});
|
||||
msg_area.hide();
|
||||
$(window).load(setFixedPopupSize);
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<td><a href="{getUrl('','document_srl',$oComment->get('document_srl'))}#comment_{$oComment->get('comment_srl')}" onclick="window.open(this.href);return false;">{$oComment->getSummary(100)}</a></td>
|
||||
<td><span class="member_{$oComment->getMemberSrl()}">{$oComment->getNickName()}</span></td>
|
||||
<td>{$oComment->getRegdate("Y-m-d")}</td>
|
||||
<td><strong>{$oComment->get('declared_count')}</strong></td>
|
||||
<td><strong>{$oComment->get('declared_count')} (<a href="{getUrl('', 'act', 'dispCommentAdminDeclaredLogByCommentSrl', 'target_srl',$oComment->get('comment_srl'))}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_comment_declare_reason}</a>)</strong></td>
|
||||
<td>{$oComment->get('ipaddress')}</td>
|
||||
<td><input type="checkbox" name="cart[]" value="{$oComment->get('comment_srl')}" /></td>
|
||||
</tr>
|
||||
|
|
|
|||
71
modules/comment/tpl/declared_log.html
Normal file
71
modules/comment/tpl/declared_log.html
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<h1>{$lang->improper_comment_declare}</h1>
|
||||
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/comment/tpl/declared_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<form id="fo_list" action="./" method="get">
|
||||
<input type="hidden" name="module" value="comment" />
|
||||
<input type="hidden" name="page" value="{$page}" />
|
||||
<blockquote>
|
||||
<section>
|
||||
<h1>{$lang->replies}</h1>
|
||||
<p>{$declared_comment->getSummary(200)}</p>
|
||||
<address cond="$declared_comment->get('member_srl')"><a href="#popup_menu_area" class="member_{$declared_comment->get('member_srl')}">{$declared_comment->getNickName()}</a></address>
|
||||
</section>
|
||||
</blockquote>
|
||||
<h2>{$lang->improper_comment_declare_reason}</h2>
|
||||
<table class="x_table x_table-striped x_table-hover" id="commentListTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="nowr">{$lang->declaring_user}</th>
|
||||
<th scope="col" class="nowr">{$lang->improper_comment_declare_reason}</th>
|
||||
<th scope="col" class="nowr">{$lang->date}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr loop="$declare_log => $no,$log">
|
||||
<td class="nowr"><a cond="$log->member_srl" href="#popup_menu_area" class="member_{$log->member_srl}">{$reporter_list[$log->member_srl]->nick_name}</a> ({$log->ipaddress})</td>
|
||||
<td class="nowr">{$log->declare_message}</td>
|
||||
<td class="nowr">{date('Y-m-d H:i:s', strtotime($log->regdate))}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<form action="./" class="x_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}" />
|
||||
|
||||
<ul>
|
||||
<li class="x_disabled"|cond="!$page || $page == 1"><a href="{getUrl('page', '')}">« {$lang->first_page}</a></li>
|
||||
<block cond="$page_navigation->first_page != 1 && $page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page - 1 && $page_navigation->page_count != $page_navigation->total_page">
|
||||
{@$isGoTo = true}
|
||||
<li>
|
||||
<a href="#goTo" data-toggle title="{$lang->cmd_go_to_page}">…</a>
|
||||
<span cond="$isGoTo" id="goTo" class="x_input-append">
|
||||
<input type="number" min="1" max="{$page_navigation->last_page}" required name="page" title="{$lang->cmd_go_to_page}" />
|
||||
<button type="submit" class="x_add-on">Go</button>
|
||||
</span>
|
||||
</li>
|
||||
</block>
|
||||
|
||||
<!--@while($page_no = $page_navigation->getNextPage())-->
|
||||
{@$last_page = $page_no}
|
||||
<li class="x_active"|cond="$page_no == $page"><a href="{getUrl('page', $page_no)}">{$page_no}</a></li>
|
||||
<!--@end-->
|
||||
|
||||
<block cond="$last_page != $page_navigation->last_page && $last_page + 1 != $page_navigation->last_page">
|
||||
{@$isGoTo = true}
|
||||
<li>
|
||||
<a href="#goTo" data-toggle title="{$lang->cmd_go_to_page}">…</a>
|
||||
<span cond="$isGoTo" id="goTo" class="x_input-append">
|
||||
<input type="number" min="1" max="{$page_navigation->last_page}" required name="page" title="{$lang->cmd_go_to_page}" />
|
||||
<button type="submit" class="x_add-on">Go</button>
|
||||
</span>
|
||||
</li>
|
||||
</block>
|
||||
<li class="x_disabled"|cond="$page == $page_navigation->last_page"><a href="{getUrl('page', $page_navigation->last_page)}" title="{$page_navigation->last_page}">{$lang->last_page} »</a></li>
|
||||
</ul>
|
||||
</form>
|
||||
|
|
@ -162,7 +162,7 @@ class documentAdminView extends document
|
|||
}
|
||||
|
||||
/**
|
||||
* Display a report list on the admin page
|
||||
* Display a reported post and log of reporting
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminDeclaredLogByDocumentSrl()
|
||||
|
|
@ -178,7 +178,6 @@ class documentAdminView extends document
|
|||
// get Status name list
|
||||
$oDocumentModel = getModel('document');
|
||||
$oMemberModel = getModel('member');
|
||||
$statusNameList = $oDocumentModel->getStatusNameList();
|
||||
$oDocument = $oDocumentModel->getDocument($args->document_srl);
|
||||
|
||||
$declared_output = executeQuery('document.getDeclaredLogByDocumentSrl', $args);
|
||||
|
|
@ -200,7 +199,6 @@ class documentAdminView extends document
|
|||
Context::set('reporter_list', $reporter_list);
|
||||
Context::set('declared_document', $oDocument);
|
||||
Context::set('page_navigation', $declared_output->page_navigation);
|
||||
Context::set('status_name_list', $statusNameList);
|
||||
|
||||
// Set the template
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
|
|
|||
|
|
@ -192,15 +192,24 @@ class documentController extends document
|
|||
*/
|
||||
function procDocumentDeclare()
|
||||
{
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object(-1, 'msg_not_logged');
|
||||
}
|
||||
|
||||
$document_srl = intval(Context::get('target_srl'));
|
||||
if(!$document_srl)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// if an user select message from options, message would be the option.
|
||||
$message_option = strval(Context::get('message_option'));
|
||||
$improper_document_reasons = Context::getLang('improper_document_reasons');
|
||||
$declare_message = ($message_option !== 'others' && isset($improper_document_reasons[$message_option]))?
|
||||
$improper_document_reasons[$message_option] : trim(Context::get('declare_message'));
|
||||
|
||||
$document_srl = Context::get('target_srl');
|
||||
$message_option = Context::get('message_option');
|
||||
$declare_message = ($message_option !== 'others' && isset($improper_document_reasons[$message_option]))? $improper_document_reasons[$message_option] : Context::get('declare_message');
|
||||
if(!$document_srl) return new Object(-1, 'msg_invalid_request');
|
||||
|
||||
// if there is return url, set that.
|
||||
if(Context::get('success_return_url'))
|
||||
{
|
||||
$this->setRedirectUrl(Context::get('success_return_url'));
|
||||
|
|
@ -1374,13 +1383,19 @@ class documentController extends document
|
|||
function declaredDocument($document_srl, $declare_message = '')
|
||||
{
|
||||
// Fail if session information already has a reported document
|
||||
if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
|
||||
if($_SESSION['declared_document'][$document_srl])
|
||||
{
|
||||
return new Object(-1, 'failed_declared');
|
||||
}
|
||||
|
||||
// Check if previously reported
|
||||
$args = new stdClass();
|
||||
$args->document_srl = $document_srl;
|
||||
$output = executeQuery('document.getDeclaredDocument', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
|
||||
|
||||
|
|
@ -1400,7 +1415,8 @@ class documentController extends document
|
|||
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
|
||||
|
||||
// Pass if the author's IP address is as same as visitor's.
|
||||
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
|
||||
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
|
||||
{
|
||||
$_SESSION['declared_document'][$document_srl] = true;
|
||||
return new Object(-1, 'failed_declared');
|
||||
}
|
||||
|
|
@ -1446,9 +1462,20 @@ class documentController extends document
|
|||
$oDB->begin();
|
||||
|
||||
// Add the declared document
|
||||
if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
|
||||
else $output = executeQuery('document.insertDeclaredDocument', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if($declared_count > 0)
|
||||
{
|
||||
$output = executeQuery('document.updateDeclaredDocument', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('document.insertDeclaredDocument', $args);
|
||||
}
|
||||
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Leave logs
|
||||
$output = executeQuery('document.insertDocumentDeclaredLog', $args);
|
||||
|
|
@ -1458,7 +1485,7 @@ class documentController extends document
|
|||
return $output;
|
||||
}
|
||||
|
||||
$this->add('declared_count', $declared_count+1);
|
||||
$this->add('declared_count', $declared_count + 1);
|
||||
|
||||
// Call a trigger (after)
|
||||
$trigger_obj->declared_count = $declared_count + 1;
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class documentView extends document
|
|||
}
|
||||
|
||||
/**
|
||||
* Document temp saved list
|
||||
* Report an improper post
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentDeclare()
|
||||
|
|
@ -186,15 +186,24 @@ class documentView extends document
|
|||
|
||||
$oMemberModel = getModel('member');
|
||||
// A message appears if the user is not logged-in
|
||||
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
|
||||
if(!$oMemberModel->isLogged())
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
// Create the document object. If the document module of basic data structures, write it all works .. -_-;
|
||||
$oDocumentModel = getModel('document');
|
||||
// Creates an object for displaying the selected document
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager, FALSE);
|
||||
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
|
||||
if(!$oDocument->isExists())
|
||||
{
|
||||
return new Object(-1,'msg_invalid_request');
|
||||
}
|
||||
// Check permissions
|
||||
if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
|
||||
if(!$oDocument->isAccessible())
|
||||
{
|
||||
return new Object(-1,'msg_not_permitted');
|
||||
}
|
||||
|
||||
// Browser title settings
|
||||
Context::set('target_document', $oDocument);
|
||||
|
|
|
|||
|
|
@ -1012,7 +1012,7 @@
|
|||
</item>
|
||||
</item>
|
||||
<item name="about_improper_document_declare">
|
||||
<value xml:lang="ko"><![CDATA[게시글 신고 사유를 간단히 적어서 제출해주시면 관리자 검토 후 조치하겠습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Write here the reason you report this article as an improper document.]]></value>
|
||||
<value xml:lang="ko"><![CDATA[게시글을 신고하신 이유를 간단히 적어서 제출해주시면 관리자 검토 후 조치하겠습니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Write here why you report this article as an improper document.]]></value>
|
||||
</item>
|
||||
</lang>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue