mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-15 00:12:43 +09:00
#9 댓글 트리거 추가.
- 문서 트리는 이미 있었으나 (아마 테스트를 위해) IP체크 부분이 주석처리 되어있던 코드를 복원 함
This commit is contained in:
parent
757187aabf
commit
a4f550fa5c
2 changed files with 42 additions and 12 deletions
|
|
@ -1134,6 +1134,18 @@ class commentController extends comment
|
|||
{
|
||||
return $output;
|
||||
}
|
||||
$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
|
||||
|
||||
$trigger_obj = new stdClass();
|
||||
$trigger_obj->comment_srl = $comment_srl;
|
||||
$trigger_obj->declared_count = $declared_count;
|
||||
|
||||
// Call a trigger (before)
|
||||
$trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'before', $trigger_obj);
|
||||
if(!$trigger_output->toBool())
|
||||
{
|
||||
return $trigger_output;
|
||||
}
|
||||
|
||||
// get the original comment
|
||||
$oCommentModel = getModel('comment');
|
||||
|
|
@ -1180,6 +1192,10 @@ class commentController extends comment
|
|||
return new Object(-1, 'failed_declared');
|
||||
}
|
||||
|
||||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
// execute insert
|
||||
if($output->data->declared_count > 0)
|
||||
{
|
||||
|
|
@ -1192,12 +1208,24 @@ class commentController extends comment
|
|||
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// leave the log
|
||||
$output = executeQuery('comment.insertCommentDeclaredLog', $args);
|
||||
|
||||
// Call a trigger (after)
|
||||
$trigger_obj->declared_count = $declared_count + 1;
|
||||
$trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'after', $trigger_obj);
|
||||
if(!$trigger_output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $trigger_output;
|
||||
}
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
// leave into the session information
|
||||
$_SESSION['declared_comment'][$comment_srl] = TRUE;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue