mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-25 21:32:51 +09:00
댓글 신고시 신고 이유를 적을 수 있게 함
- 댓글에도 신고 이유를 적을 수 있다. - 코드 정리
This commit is contained in:
parent
a9915a7986
commit
4bbd91bd3c
18 changed files with 415 additions and 41 deletions
|
|
@ -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