Esempio n. 1
0
 public function index_spam_domains($noisy = FALSE)
 {
     SpamDomain::clear_domains_for_comment($this->comment_id);
     $blacklisted = 0;
     $hosts = $this->get_link_hosts();
     $link_ct = 0;
     foreach ($hosts as $domain => $links) {
         foreach ($links as $url => $linktexts) {
             $link_ct += count($linktexts);
         }
         $domain = new SpamDomain($domain, $noisy);
         try {
             $domain->link_to_comment($this->comment_id, count($links));
         } catch (Exception $e) {
             echo "Exception occurred processing comment {$this->comment_id}, domain {$domain}\n";
             echo "hosts: ";
             var_dump($hosts);
             throw $e;
         }
         if ($domain->blacklisted) {
             $blacklisted = 1;
         }
     }
     if ($blacklisted) {
         Comment::set_spam_state(array($this->comment_id), SPAM_STATE_DOMAIN_BLACKLIST);
         //      echo "setting spam (blacklist) flag for $this->comment_id due to a bad domain.\n";
         return TRUE;
     }
     if ($link_ct >= 10) {
         //      echo "deleting $this->comment_id due to too many links.\n";
         Comment::set_spam_state(array($this->comment_id), SPAM_STATE_TOO_MANY_LINKS);
         return TRUE;
     }
 }