Dotclear

Changeset 2522:2712786c6df4


Ignore:
Timestamp:
11/08/13 08:39:09 (10 years ago)
Author:
Dsls
Branch:
default
Message:

Prevent 1-word domains warnings in links lookup antispam, fixes #1853

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/antispam/filters/class.dc.filter.linkslookup.php

    r1366 r2522  
    1515{ 
    1616     public $name = 'Links Lookup'; 
    17       
     17 
    1818     private $server = 'multi.surbl.org'; 
    19       
     19 
    2020     protected function setInfo() 
    2121     { 
    2222          $this->description = __('Checks links in comments against surbl.org'); 
    2323     } 
    24       
     24 
    2525     public function getStatusMessage($status,$comment_id) 
    2626     { 
    2727          return sprintf(__('Filtered by %1$s with server %2$s.'),$this->guiLink(),$status); 
    2828     } 
    29       
     29 
    3030     public function isSpam($type,$author,$email,$site,$ip,$content,$post_id,&$status) 
    3131     { 
     
    3333               return; 
    3434          } 
    35            
     35 
    3636          $urls = $this->getLinks($content); 
    3737          array_unshift($urls,$site); 
    38            
     38 
    3939          foreach ($urls as $u) 
    4040          { 
     
    4848 
    4949               $i = count($domain_elem) - 1; 
     50               if ($i == 0) { 
     51                    // "domain" is 1 word long, don't check it 
     52                    return false; 
     53               } 
    5054               $host = $domain_elem[$i]; 
    5155               do 
     
    5357                    $host = $domain_elem[$i - 1].'.'.$host; 
    5458                    $i--; 
    55                     if (substr(gethostbyname($host.'.'.$this->server),0,3) == "127" )  
     59                    if (substr(gethostbyname($host.'.'.$this->server),0,3) == "127" ) 
    5660                    { 
    5761                         $status = substr($domain,0,128); 
    5862                         return true; 
    59                     }                    
     63                    } 
    6064               } while ($i > 0); 
    6165          } 
    6266     } 
    63       
     67 
    6468     private function getLinks($text) 
    6569     { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map