/**
  * Finds subscriber without opt-in mail sent before
  *
  * @param Comment $comment
  *
  * @return object
  */
 public function findForSubscriptionMail(Comment $comment)
 {
     $query = $this->createQuery();
     $query->getQuerySettings()->setIgnoreEnableFields(TRUE);
     $query->matching($query->logicalAnd($query->equals('postUid', $comment->getPostId()), $query->equals('email', $comment->getEmail()), $query->equals('lastSent', 0), $query->equals('hidden', 1), $query->equals('deleted', 0)));
     return $query->execute()->getFirst();
 }
Beispiel #2
0
 /**
  * Checks comment for SPAM
  *
  * @param Comment $comment The comment to be checked
  * @param Request $request The request to be checked
  *
  * @return integer
  */
 public function process(Comment $comment, Request $request)
 {
     $spamPoints = 0;
     if (!$this->spamSettings['enable']) {
         return $spamPoints;
     }
     if ($this->spamSettings['honeypot']) {
         if (!$this->checkHoneyPotFields($request)) {
             $spamPoints += intval($this->spamSettings['honeypot']);
         }
     }
     if ($this->spamSettings['isHumanCheckbox']) {
         if (!$request->hasArgument('human') || !$request->hasArgument('human')) {
             $spamPoints += intval($this->spamSettings['isHumanCheckbox']);
         }
     }
     if ($this->spamSettings['cookie']) {
         if (!$_COOKIE['fe_typo_user']) {
             $spamPoints += intval($this->spamSettings['cookie']);
         }
     }
     if ($this->spamSettings['userAgent']) {
         if (GeneralUtility::getIndpEnv('HTTP_USER_AGENT') == '') {
             $spamPoints += intval($this->spamSettings['userAgent']);
         }
     }
     $comment->setSpamPoints($spamPoints);
     return $spamPoints;
 }
Beispiel #3
0
 /**
  * Removes a Comment
  *
  * @param \TYPO3\T3extblog\Domain\Model\Comment $commentToRemove The Comment to be removed
  * @return void
  */
 public function removeComment(Comment $commentToRemove)
 {
     $this->initComments();
     $commentToRemove->setDeleted(TRUE);
     $this->comments->detach($commentToRemove);
     $this->getCommentRepository()->update($commentToRemove);
 }
Beispiel #4
0
 /**
  * @test
  *
  * @return void
  */
 public function testIsValidUnapprovedAndSpam()
 {
     $this->fixture->setApproved(FALSE);
     $this->fixture->setSpam(TRUE);
     $this->assertFalse($this->fixture->isValid());
 }
 /**
  * Notify the blog admin
  *
  * @param Comment $comment
  * @param string $emailTemplate
  *
  * @return    void
  */
 protected function notifyAdmin(Comment $comment, $emailTemplate = 'AdminNewCommentMail.txt')
 {
     $settings = $this->settings['subscriptionManager']['admin'];
     if (!$settings['enable']) {
         return;
     }
     if (!(is_array($settings['mailTo']) && strlen($settings['mailTo']['email']) > 0)) {
         $this->log->error('No admin email configured.', $settings['mailTo']);
         return;
     }
     $this->log->dev('Send admin notification mail.');
     /* @var $post Post */
     $post = $comment->getPost();
     $subject = $this->translate('subject.admin.newSubscription', $post->getTitle());
     $variables = array('post' => $post, 'comment' => $comment, 'subject' => $subject);
     $emailBody = $this->emailService->render($variables, $emailTemplate);
     $this->emailService->send(array($settings['mailTo']['email'] => $settings['mailTo']['name']), array($settings['mailFrom']['email'] => $settings['mailFrom']['name']), $subject, $emailBody);
 }
 /**
  * Sanitize comment content
  *
  * @param Comment $comment
  *
  * @return void
  */
 protected function sanitizeComment(Comment $comment)
 {
     $allowTags = $this->settings['blogsystem']['comments']['allowTags'];
     $comment->setText(GeneralUtility::removeXSS(strip_tags($comment->getText(), trim($allowTags))));
 }