Dotclear


Ignore:
Timestamp:
11/17/13 20:25:53 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Children:
2567:6c11245cbf04, 2568:61c67a7d17fa
Message:

Add some people in CREDITS, remove trailing spaces and tabs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/antispam/inc/class.dc.spamfilters.php

    r1179 r2566  
    1717     private $filters_opt = array(); 
    1818     private $core; 
    19       
     19 
    2020     public function __construct($core) 
    2121     { 
    2222          $this->core =& $core; 
    2323     } 
    24       
     24 
    2525     public function init($filters) 
    2626     { 
     
    3030                    continue; 
    3131               } 
    32                 
     32 
    3333               $r = new ReflectionClass($f); 
    3434               $p = $r->getParentClass(); 
    35                 
     35 
    3636               if (!$p || $p->name != 'dcSpamFilter') { 
    3737                    continue; 
    3838               } 
    39                 
     39 
    4040               $this->filters[$f] = new $f($this->core); 
    4141          } 
    42            
     42 
    4343          $this->setFilterOpts(); 
    4444          if (!empty($this->filters_opt)) { 
     
    4646          } 
    4747     } 
    48       
     48 
    4949     public function getFilters() 
    5050     { 
    5151          return $this->filters; 
    5252     } 
    53       
     53 
    5454     public function isSpam($cur) 
    5555     { 
     
    5959                    continue; 
    6060               } 
    61                 
     61 
    6262               $type = $cur->comment_trackback ? 'trackback' : 'comment'; 
    6363               $author = $cur->comment_author; 
     
    6767               $content = $cur->comment_content; 
    6868               $post_id = $cur->post_id; 
    69                 
     69 
    7070               $is_spam = $f->isSpam($type,$author,$email,$site,$ip,$content,$post_id,$status); 
    71                 
     71 
    7272               if ($is_spam === true) { 
    7373                    if ($f->auto_delete) { 
     
    8383               } 
    8484          } 
    85            
     85 
    8686          return false; 
    8787     } 
    88       
     88 
    8989     public function trainFilters($rs,$status,$filter_name) 
    9090     { 
     
    9494                    continue; 
    9595               } 
    96                 
     96 
    9797               $type = $rs->comment_trackback ? 'trackback' : 'comment'; 
    9898               $author = $rs->comment_author; 
     
    101101               $ip = $rs->comment_ip; 
    102102               $content = $rs->comment_content; 
    103                 
     103 
    104104               $f->trainFilter($status,$filter_name,$type,$author,$email,$site,$ip,$content,$rs); 
    105105          } 
    106106     } 
    107       
     107 
    108108     public function statusMessage($rs,$filter_name) 
    109109     { 
    110110          $f = isset($this->filters[$filter_name]) ? $this->filters[$filter_name] : null; 
    111            
     111 
    112112          if ($f === null) 
    113113          { 
     
    117117          { 
    118118               $status = $rs->exists('comment_spam_status') ? $rs->comment_spam_status : null; 
    119                 
     119 
    120120               return $f->getStatusMessage($status,$rs->comment_id); 
    121121          } 
    122122     } 
    123       
     123 
    124124     public function saveFilterOpts($opts,$global=false) 
    125125     { 
     
    130130          $this->core->blog->settings->antispam->put('antispam_filters',serialize($opts),'string','Antispam Filters',true,$global); 
    131131     } 
    132       
     132 
    133133     private function setFilterOpts() 
    134134     { 
     
    136136               $this->filters_opt = @unserialize($this->core->blog->settings->antispam->antispam_filters); 
    137137          } 
    138            
     138 
    139139          # Create default options if needed 
    140140          if (!is_array($this->filters_opt)) { 
     
    142142               $this->filters_opt = array(); 
    143143          } 
    144            
     144 
    145145          foreach ($this->filters_opt as $k => $o) 
    146146          { 
    147                if (isset($this->filters[$k]) && is_array($o)) {        
     147               if (isset($this->filters[$k]) && is_array($o)) { 
    148148                    $this->filters[$k]->active = isset($o[0])?$o[0]:false; 
    149149                    $this->filters[$k]->order = isset($o[1])?$o[1]:0; 
     
    152152          } 
    153153     } 
    154       
     154 
    155155     private function orderCallBack($a,$b) 
    156156     { 
     
    158158               return 0; 
    159159          } 
    160            
     160 
    161161          return $a->order > $b->order ? 1 : -1; 
    162162     } 
    163163} 
    164 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map