Merge pull request #173 from misol/improvement/charge-with-something

신고/계정 거부에 이유를 적을 수 있게 하는 PR
This commit is contained in:
MinSoo Kim 2016-01-29 10:26:47 +09:00
commit 6b263844ad
38 changed files with 887 additions and 138 deletions

View file

@ -63,14 +63,16 @@ a img {
/* Popup Menu Area */
#popup_menu_area {
position: absolute;
z-index:9999;
margin: 10px 0;
padding: 10px;
border: 1px solid #e9e9e9;
border-radius: 3px;
padding: 0;
border: 1px solid #eeeeee;
border-radius: 2px;
font-size: 12px;
box-shadow: 0 0 6px #666;
filter: progid: DXImageTransform.Microsoft.Shadow(color=#999999,direction=135, strength=5);
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
background: #fff;
min-width:80px;
outline:none;
}
#popup_menu_area ul {
margin: 0;
@ -80,20 +82,31 @@ a img {
#popup_menu_area li {
margin: 0;
padding: 0;
line-height: 1.25;
line-height: 1.5;
}
#popup_menu_area a {
display: block;
padding: 1px 3px;
border-radius: 2px;
padding: 5px;
text-decoration: none;
color: #333;
color: #212121;
}
#popup_menu_area a:hover,
#popup_menu_area a:active,
#popup_menu_area a:focus {
color: #fff;
background: #666;
background: #eeeeee;
}
@media screen and (max-width: 400px) {
#popup_menu_area {
min-width:120px;
max-width:95%;
font-size: 13px;
}
#popup_menu_area a {
display: block;
padding: 10px;
text-decoration: none;
color: #212121;
}
}
/* Message */

View file

@ -945,7 +945,7 @@ jQuery(function($){
// display popup menu that contains member actions and document actions
$(document).on('click', function(evt) {
var $area = $('#popup_menu_area');
if(!$area.length) $area = $('<div id="popup_menu_area" tabindex="0" style="display:none;z-index:9999" />').appendTo(document.body);
if(!$area.length) $area = $('<div id="popup_menu_area" tabindex="0" style="display:none;" />').appendTo(document.body);
// 이전에 호출되었을지 모르는 팝업메뉴 숨김
$area.hide();

View file

@ -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 */

View file

@ -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');
}

View file

@ -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);
}
/**
@ -1313,9 +1325,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])
@ -1331,6 +1344,7 @@ class commentController extends comment
{
return $output;
}
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
$trigger_obj = new stdClass();
@ -1379,7 +1393,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.
@ -1411,6 +1427,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;
@ -1421,6 +1444,7 @@ class commentController extends comment
return $trigger_output;
}
// commit
$oDB->commit();
// leave into the session information

View file

@ -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)

View file

@ -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 */

View file

@ -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" />

View file

@ -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>

View 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>

View file

@ -6,6 +6,7 @@
<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>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset version="1.5.0">
<customrules>
</customrules>
<fields>
<field name="target_srl" required="true" rule="number" default="0" />
</fields>
</ruleset>

View file

@ -2,5 +2,6 @@
<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>

View 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;
}

View file

@ -0,0 +1,56 @@
{@Context::addMetaTag('viewport', 'width=device-width, user-scalable=no', FALSE);}
<load target="./css/declare_comment.css" />
<script cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/comment/tpl/1'">
alert("{$XE_VALIDATOR_MESSAGE}");
window.close();
</script>
<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>

View file

@ -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>

View 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', '')}">&laquo; {$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}">&hellip;</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}">&hellip;</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} &raquo;</a></li>
</ul>
</form>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<module>
<grants />
<permissions>
@ -24,6 +24,7 @@
<action name="dispDocumentPreview" type="view" />
<action name="dispDocumentManageDocument" type="view" />
<action name="dispTempSavedList" type="view" />
<action name="dispDocumentDeclare" type="view" />
<action name="getDocumentCategories" type="model" />
<action name="getDocumentMenu" type="model" />
@ -41,6 +42,7 @@
<action name="dispDocumentAdminConfig" type="view" />
<action name="dispDocumentAdminAlias" type="view" menu_name="document" />
<action name="dispDocumentAdminDeclared" type="view" menu_name="document" />
<action name="dispDocumentAdminDeclaredLogByDocumentSrl" type="view" menu_name="document" />
<action name="dispDocumentAdminTrashList" type="view" menu_name="document" />
<action name="getDocumentCategoryTplInfo" type="model" />

View file

@ -161,6 +161,51 @@ class documentAdminView extends document
$this->setTemplateFile('declared_list');
}
/**
* Display a reported post and log of reporting
* @return void
*/
function dispDocumentAdminDeclaredLogByDocumentSrl()
{
// 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->document_srl = intval(Context::get('target_srl'));
// get Status name list
$oDocumentModel = getModel('document');
$oMemberModel = getModel('member');
$oDocument = $oDocumentModel->getDocument($args->document_srl);
$declared_output = executeQuery('document.getDeclaredLogByDocumentSrl', $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_document', $oDocument);
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');
}
/**
* Display a alias list on the admin page
* @return void

View file

@ -124,6 +124,9 @@ class document extends ModuleObject
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
// 2016. 1. 27: Add a column(declare_message) for report
if(!$oDB->isColumnExists("document_declared_log","declare_message")) return true;
return false;
}
@ -320,6 +323,12 @@ class document extends ModuleObject
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after');
}
// 2016. 1. 27: Add a column(declare_message) for report
if(!$oDB->isColumnExists("document_declared_log","declare_message"))
{
$oDB->addColumn('document_declared_log',"declare_message","text");
}
return new Object(0,'success_updated');
}

View file

@ -192,12 +192,30 @@ class documentController extends document
*/
function procDocumentDeclare()
{
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
if(!Context::get('is_logged'))
{
return new Object(-1, 'msg_not_logged');
}
$document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request');
$document_srl = intval(Context::get('target_srl'));
if(!$document_srl)
{
return new Object(-1, 'msg_invalid_request');
}
return $this->declaredDocument($document_srl);
// 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'));
// if there is return url, set that.
if(Context::get('success_return_url'))
{
$this->setRedirectUrl(Context::get('success_return_url'));
}
return $this->declaredDocument($document_srl, $declare_message);
}
/**
@ -1359,18 +1377,25 @@ class documentController extends document
/**
* Report posts
* @param int $document_srl
* @param string $declare_message
* @return void|Object
*/
function declaredDocument($document_srl)
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;
@ -1390,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');
}
@ -1421,6 +1447,7 @@ class documentController extends document
}
$args->document_srl = $document_srl;
$args->declare_message = trim(htmlspecialchars($declare_message));
$output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
// Pass after registering a sesson if reported/declared documents are in the logs.
@ -1435,9 +1462,21 @@ 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);
if(!$output->toBool())

View file

@ -514,8 +514,8 @@ class documentModel extends document
}
// Adding Report
$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript');
$url = getUrl('', 'act', 'dispDocumentDeclare', 'target_srl', $document_srl);
$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','popup');
// Add Bookmark button
$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);

View file

@ -175,6 +175,44 @@ class documentView extends document
$this->setTemplateFile('saved_list_popup');
}
/**
* Report an improper post
* @return void
*/
function dispDocumentDeclare()
{
$this->setLayoutFile('popup_layout');
$document_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 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');
}
// Check permissions
if(!$oDocument->isAccessible())
{
return new Object(-1,'msg_not_permitted');
}
// Browser title settings
Context::set('target_document', $oDocument);
Context::set('target_srl', $document_srl);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('declare_document');
}
}
/* End of file document.view.php */
/* Location: ./modules/document/document.view.php */

View file

@ -965,4 +965,54 @@
<value xml:lang="vi"><![CDATA[deletes]]></value>
</item>
</item>
<item name="improper_document_declare">
<value xml:lang="ko"><![CDATA[불량 게시글 신고]]></value>
<value xml:lang="en"><![CDATA[Report an improper document]]></value>
</item>
<item name="declaring_user">
<value xml:lang="ko"><![CDATA[신고자]]></value>
<value xml:lang="en"><![CDATA[Reporter]]></value>
</item>
<item name="improper_document_declare_reason">
<value xml:lang="ko"><![CDATA[신고 이유]]></value>
<value xml:lang="en"><![CDATA[Reason]]></value>
</item>
<item name="improper_document_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[Posts 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_document_declare">
<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>

View file

@ -0,0 +1,17 @@
<query id="getDeclaredLogByDocumentSrl" action="select">
<tables>
<table name="document_declared_log" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_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>

View file

@ -6,6 +6,7 @@
<column name="document_srl" var="document_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>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset version="1.5.0">
<customrules>
</customrules>
<fields>
<field name="target_srl" required="true" rule="number" default="0" />
</fields>
</ruleset>

View file

@ -2,5 +2,6 @@
<column name="document_srl" type="number" size="11" notnull="notnull" index="idx_document_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>

View file

@ -0,0 +1,19 @@
@charset "UTF-8";
div.xe_mobile {
display:none!important;
}
section.declare_document{
display:block;
}
section.declare_document label{
font-weight: bold;
}
section.declare_document select,section.declare_document textarea{
box-sizing:border-box;
height:auto;
width: 100%;
padding:7px;
font-size: 11pt;
line-height: normal;
display:block;
}

View file

@ -0,0 +1,56 @@
{@Context::addMetaTag('viewport', 'width=device-width, user-scalable=no', FALSE);}
<load target="./css/declare_document.css" />
<script cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/document/tpl/1'">
alert("{$XE_VALIDATOR_MESSAGE}");
window.close();
</script>
<section class="declare_document">
<h1>{$lang->improper_document_declare}</h1>
<form action="./" method="post" id="fo_component" ruleset="insertDeclare">
<input type="hidden" name="module" value="document" />
<input type="hidden" name="act" value="procDocumentDeclare" />
<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/document/tpl/1" />
<blockquote>
<section class="target_article">
<h1>{$target_document->getTitleText()}</h1>
<p>{$target_document->getSummary(200)}</p>
</section>
</blockquote>
<label class="x_control-label" for="message_option">{$lang->improper_document_declare_reason}</label>
<div class="x_controls">
<select name="message_option" id="message_option">
<option loop="$lang->improper_document_reasons => $key,$text" value="{$key}">{$text}</option>
</select>
<textarea name="declare_message" id="declare_message"></textarea>
<p>{$lang->about_improper_document_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>

View file

@ -46,7 +46,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<tr loop="$document_list => $no,$oDocument">
<td class="title"><a href="{getUrl('','document_srl',$oDocument->document_srl)}" target="_blank">{$oDocument->getTitle()}</a></td>
<td class="nowr"><a href="#popup_menu_area" class="member_{$oDocument->get('member_srl')}">{$oDocument->getNickName()}</a></td>
<td class="nowr">{$oDocument->get('declared_count')}</td>
<td class="nowr">{$oDocument->get('declared_count')} (<a href="{getUrl('', 'act', 'dispDocumentAdminDeclaredLogByDocumentSrl', 'target_srl',$oDocument->document_srl)}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_document_declare_reason}</a>)</td>
<td class="nowr">{$oDocument->get('readed_count')}</td>
<td class="nowr">{$oDocument->get('voted_count')}/{$oDocument->get('blamed_count')}</td>
<td class="nowr">{$oDocument->getRegdate("Y-m-d H:i")}</td>

View file

@ -0,0 +1,71 @@
<h1>{$lang->improper_document_declare}</h1>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/document/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="document" />
<input type="hidden" name="page" value="{$page}" />
<blockquote>
<section>
<h1>{$declared_document->getTitleText()}</h1>
<p>{$declared_document->getSummary(200)}</p>
<address cond="$declared_document->get('member_srl')"><a href="#popup_menu_area" class="member_{$declared_document->get('member_srl')}">{$declared_document->getNickName()}</a></address>
</section>
</blockquote>
<h2>{$lang->improper_document_declare_reason}</h2>
<table class="x_table x_table-striped x_table-hover" id="documentListTable">
<thead>
<tr>
<th scope="col" class="nowr">{$lang->declaring_user}</th>
<th scope="col" class="nowr">{$lang->improper_document_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', '')}">&laquo; {$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}">&hellip;</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}">&hellip;</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} &raquo;</a></li>
</ul>
</form>

View file

@ -2665,6 +2665,14 @@
<value xml:lang="zh-TW"><![CDATA[拒絕]]></value>
<value xml:lang="zh-CN"><![CDATA[拒绝]]></value>
</item>
<item name="refused_reason">
<value xml:lang="ko"><![CDATA[계정 거부 사유]]></value>
<value xml:lang="en"><![CDATA[Reason for account refusing]]></value>
</item>
<item name="about_refused_reason">
<value xml:lang="ko"><![CDATA[계정이 정지된 이유를 적어주세요. 이 항목에 기록된 내용은 해당 회원에게 로그인 후 화면을 통해 안내됩니다.]]></value>
<value xml:lang="en"><![CDATA[Describe the reason why you refuse this account. Something you write in this field would be displayed when this user signs in.]]></value>
</item>
<item name="use_group_image_mark">
<value xml:lang="ko"><![CDATA[그룹 이미지 마크 사용]]></value>
<value xml:lang="en"><![CDATA[Use group image mark]]></value>

View file

@ -24,12 +24,12 @@ class memberAdminController extends member
// if(Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request");
// Extract the necessary information in advance
$logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y' || !checkCSRF())
if($logged_info->is_admin !== 'Y' || !checkCSRF())
{
return new Object(-1, 'msg_invalid_request');
}
$args = Context::gets('member_srl','email_address','find_account_answer', 'allow_mailing','allow_message','denied','is_admin','description','group_srl_list','limit_date');
$args = new stdClass;
$oMemberModel = &getModel ('member');
$config = $oMemberModel->getMemberConfig ();
$getVars = array();
@ -47,7 +47,7 @@ class memberAdminController extends member
{
$args->{$val} = Context::get($val);
}
$args->member_srl = Context::get('member_srl');
$args = Context::gets('member_srl','email_address','find_account_answer', 'allow_mailing', 'allow_message', 'denied', 'is_admin', 'description', 'group_srl_list', 'limit_date');
if(Context::get('reset_password'))
$args->password = Context::get('reset_password');
else unset($args->password);

View file

@ -1751,7 +1751,7 @@ class memberController extends member
$redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail');
return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed'));
}
return new Object(-1,'msg_user_denied');
return new Object(-1, ($this->memberInfo->refused_reason)? Context::getLang('msg_user_denied') . "\n" . $this->memberInfo->refused_reason : 'msg_user_denied');
}
// Notify if denied_date is less than the current time
if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d")));

View file

@ -77,6 +77,13 @@
<label class="x_inline" for="deny"><input type="radio" name="denied" id="deny" value="Y" checked="checked"|cond="$member_info->denied == 'Y'" > {$lang->denied}</label>
</div>
</div>
<div class="x_control-group div_refused_reason">
<label class="x_control-label">{$lang->refused_reason}</label>
<div class="x_controls">
<textarea name="refused_reason" id="refused_reason" rows="2" cols="42" style="vertical-align:top">{$member_info->refused_reason}</textarea>
<span class="x_help-inline">{$lang->about_refused_reason}</span>
</div>
</div>
<div class="x_control-group" cond="$member_srl">
<label class="x_control-label" for="until">{$lang->limit_date}</label>
<div class="x_controls">
@ -127,5 +134,21 @@
return false;
});
});
var refused_reason_division = $('.div_refused_reason');
if(!$('#deny').is(':checked'))
{
refused_reason_division.hide();
}
$('#deny').change(function(){
if($(this).is(':checked')){
refused_reason_division.slideDown(200);
}
});
$('#appoval').change(function(){
if($(this).is(':checked')){
refused_reason_division.slideUp(200);
}
});
})(jQuery);
</script>