Ejemplo n.º 1
0
 /**
  * Finds pending comments by post
  *
  * @param Post $post
  *
  * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  */
 public function findPendingByPost(Post $post)
 {
     $query = $this->createQuery();
     $query->matching($query->logicalAnd($query->equals('postId', $post->getUid()), $this->getPendingConstraints($query)));
     return $query->execute();
 }
Ejemplo n.º 2
0
 /**
  * @param Post $post The post the comment is related to
  *
  * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  */
 public function findForNotification(Post $post)
 {
     $query = $this->createQuery();
     $query->matching($query->equals('postUid', $post->getUid()));
     return $query->execute();
 }
Ejemplo n.º 3
0
 /**
  * Process comment request
  *
  * @param Comment $comment The comment to be deleted
  * @param Post $post The comment to be deleted
  *
  * @return void
  */
 protected function checkSpamPoints(Comment $comment, Post $post)
 {
     $settings = $this->settings['blogsystem']['comments']['spamCheck'];
     $threshold = $settings['threshold'];
     $logData = array('postUid' => $post->getUid(), 'spamPoints' => $comment->getSpamPoints());
     // block comment and redirect user
     if ($threshold['redirect'] > 0 && $comment->getSpamPoints() >= intval($threshold['redirect'])) {
         $this->log->notice('New comment blocked and user redirected because of SPAM.', $logData);
         $this->redirect('', NULL, NULL, $settings['redirect']['arguments'], intval($settings['redirect']['pid']), $statusCode = 403);
     }
     // block comment and show message
     if ($threshold['block'] > 0 && $comment->getSpamPoints() >= intval($threshold['block'])) {
         $this->log->notice('New comment blocked because of SPAM.', $logData);
         $this->addFlashMessageByKey('blockedAsSpam', FlashMessage::ERROR);
         $this->errorAction();
     }
     // mark as spam
     if ($comment->getSpamPoints() >= intval($threshold['markAsSpam'])) {
         $this->log->notice('New comment marked as SPAM.', $logData);
         $comment->markAsSpam();
         $this->addFlashMessageByKey('markedAsSpam', FlashMessage::NOTICE);
     }
 }