Пример #1
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;
 }