Index: branches/5.2.x/units/poll_comments/poll_comment_eh.php =================================================================== diff -u -N -r14985 -r15060 --- branches/5.2.x/units/poll_comments/poll_comment_eh.php (.../poll_comment_eh.php) (revision 14985) +++ branches/5.2.x/units/poll_comments/poll_comment_eh.php (.../poll_comment_eh.php) (revision 15060) @@ -1,6 +1,6 @@ Application->isAdminUser ) { - return ; - } + if ( !$this->Application->isAdmin ) { + $object =& $event->getObject(); + /* @var $object kDBItem */ - $object =& $event->getObject(); - /* @var $object kDBItem */ + $parent_info = $object->getLinkedInfo($event->Special); + $poll_id = $parent_info['ParentId']; - $parent_info = $object->getLinkedInfo($event->Special); - $poll_id = $parent_info['ParentId']; + if ( $poll_id ) { + $spam_helper =& $this->Application->recallObject('SpamHelper'); + /* @var $spam_helper SpamHelper */ - if ( $poll_id ) { - $spam_helper =& $this->Application->recallObject('SpamHelper'); - /* @var $spam_helper SpamHelper */ + $spam_helper->InitHelper($poll_id, 'PollComment', 0); // ResourceId used for SpamControl only - $spam_helper->InitHelper($poll_id, 'PollComment', 0); // ResourceId used for SpamControl only + if ( $spam_helper->InSpamControl() ) { + $event->status = kEvent::erFAIL; + $object->SetError('CommentText', 'too_frequent', 'lu_error_AlreadyCommented'); + return ; + } - if ( $spam_helper->InSpamControl() ) { - $event->status = kEvent::erFAIL; - $object->SetError('CommentText', 'too_frequent', 'lu_error_AlreadyCommented'); - return ; + $object->SetDBField('PollId', $poll_id); // PollId } - $object->SetDBField('PollId', $poll_id); // PollId + $object->SetDBField('CreatedById', $this->Application->RecallVar('user_id')); + $object->SetDBField('UserIP', $_SERVER['REMOTE_ADDR']); + $object->SetDBField('Status', STATUS_ACTIVE); } - $object->SetDBField('CreatedById', $this->Application->RecallVar('user_id')); - $object->SetDBField('UserIP', $_SERVER['REMOTE_ADDR']); - $object->SetDBField('Status', STATUS_ACTIVE); - parent::OnBeforeItemCreate($event); } /** * Updates item review counter * * @param kEvent $event + * @return void + * @access protected */ - function OnCreate(&$event) + protected function OnCreate(kEvent &$event) { parent::OnCreate($event); - if ($this->Application->isAdminUser) { - return; - } - - if ($event->status == kEvent::erSUCCESS) { + if ( !$this->Application->isAdmin && $event->status == kEvent::erSUCCESS ) { $event->setRedirectParam('opener', 's'); $event->setRedirectParam('pass', 'm,poll'); $event->redirect = $this->Application->GetVar('success_template'); @@ -145,7 +141,7 @@ * @return void * @access protected */ - protected function OnAfterItemCreate(&$event) + protected function OnAfterItemCreate(kEvent &$event) { parent::OnAfterItemCreate($event);