mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-11 14:53:15 +09:00
#17201756 스패머로 등록시 해당 IP로 작성된 문서, 댓글 삭제
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5330 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
6b885bbc11
commit
b9acbd344d
1 changed files with 82 additions and 0 deletions
|
|
@ -155,6 +155,88 @@
|
|||
**/
|
||||
function insertIP($ipaddress) {
|
||||
$args->ipaddress = $ipaddress;
|
||||
$args->search_target = 'ipaddress';
|
||||
Context::set('search_target', 'ipaddress');
|
||||
$args->search_keyword = $ipaddress;
|
||||
Context::set('search_keyword', $ipaddress);
|
||||
$args->start_date = ((int)date('Ymd')-2).'0000'; // 이틀 전
|
||||
$oDocumentModel = &getModel('document');
|
||||
$output = $oDocumentModel->getDocumentList($args);
|
||||
$document_list = $output->data;
|
||||
|
||||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
if(is_array($document_list)) {
|
||||
foreach($document_list as $oDocument) {
|
||||
if($oDocument->isExists()) {
|
||||
// 글 삭제
|
||||
$args->document_srl = $oDocument->document_srl;
|
||||
$output = executeQuery('document.deleteDocument', $args);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// 카테고리가 있으면 카테고리 정보 변경
|
||||
if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
|
||||
|
||||
// 신고 삭제
|
||||
executeQuery('document.deleteDeclared', $args);
|
||||
|
||||
// 썸네일 파일 제거
|
||||
FileHandler::removeDir(sprintf('files/cache/thumbnails/%s',getNumberingPath($document_srl, 3)));
|
||||
|
||||
// commit
|
||||
$oDB->commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
$oCommentModel = &getModel('comment');
|
||||
$output = $oCommentModel->getTotalCommentList($args);
|
||||
$comment_list = $output->data;
|
||||
if(is_array($comment_list)) {
|
||||
foreach($comment_list as $oComment) {
|
||||
$comment_srl = $oComment->comment_srl;
|
||||
$comment = $oCommentModel->getComment($comment_srl);
|
||||
if($comment->comment_srl != $comment_srl) return new Object(-1, 'msg_invalid_request');
|
||||
$document_srl = $comment->document_srl;
|
||||
|
||||
// 해당 댓글에 child가 있는지 확인
|
||||
$child_count = $oCommentModel->getChildCommentCount($comment_srl);
|
||||
if($child_count==0) {
|
||||
|
||||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
// 삭제
|
||||
$args->comment_srl = $comment_srl;
|
||||
$output = executeQuery('comment.deleteComment', $args);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
}
|
||||
|
||||
$output = executeQuery('comment.deleteCommentList', $args);
|
||||
|
||||
// 댓글 수를 구해서 업데이트
|
||||
$comment_count = $oCommentModel->getCommentCount($document_srl);
|
||||
|
||||
// document의 controller 객체 생성
|
||||
$oDocumentController = &getController('document');
|
||||
|
||||
// 해당글의 댓글 수를 업데이트
|
||||
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, null, false);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
}
|
||||
|
||||
// commit
|
||||
$oDB->commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
return executeQuery('spamfilter.insertDeniedIP', $args);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue