Example #1
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $this->add = isset($settings['add']) ? $settings['add'] : 1;
     $table = isset($settings['table']) ? $settings['table'] : 'plonker';
     $this->plonker = new Plonker($this->services->getDB(), $table);
 }
Example #2
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $this->add = !empty($settings['add']);
     $tableprefix = !isset($settings['prefix']) ? 'links' : $settings['prefix'];
     $ignorefile = !isset($settings['ignore']) ? 'data/spamvertignore.txt' : $settings['ignore'];
     $this->db = new BayesBase($this->services->getDB(), $tableprefix, $ignorefile);
 }
Example #3
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $this->add = !empty($settings['add']);
     $tableprefix = !isset($settings['prefix']) ? 'bayes' : $settings['prefix'];
     $ignorefile = !isset($settings['ignore']) ? 'data/bayesignore.txt' : $settings['ignore'];
     $this->db = new BayesBase($this->services->getDB(), $tableprefix, $ignorefile, $this->add ? 0.2 : 0);
     // FIXME: hardcoded 0.3
 }
Example #4
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $whitelist = isset($settings['whitelist']) ? $settings['whitelist'] : "pl uk";
     $blacklist = isset($settings['blacklist']) ? $settings['blacklist'] : "cn ru ua kr jp ca br hk tw th biz my ni vn mx invalid arpa il info";
     $isps = @file_get_contents(isset($settings['spamisp']) ? $settings['spamisp'] : "data/blockisp.txt");
     if (!$isps) {
         throw new Exception("Unable to load file with banned ISPs");
     }
     $this->whitelist = trim(preg_replace('/[^a-z]+/', '|', trim($whitelist)), "|");
     $this->blacklist = trim(preg_replace('/[^a-z]+/', '|', trim($blacklist)), "|");
     $this->isps = trim(preg_replace('/[^a-z0-9.]+/', '|', trim($isps)), "|");
 }
Example #5
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $this->timeout = isset($settings['timeout']) ? min(100, max(2, (int) $settings['timeout'])) : 5;
     $ignorefile = isset($settings['ignore']) ? $settings['ignore'] : 'data/spamvertignore.txt';
     $this->ignore = array();
     foreach (file($ignorefile) as $line) {
         $line = trim(preg_replace('!^\\s*(?:https?://)?([a-z0-9.-]*)(?:\\s*\\#.*)?!', '\\1', $line));
         if (!$line) {
             continue;
         }
         $this->ignore[$line] = true;
     }
 }
Example #6
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $name = empty($settings['patterns']) ? 'data/scalpel.txt' : $settings['patterns'];
     $this->patterns = array();
     foreach (file($name) as $line) {
         $line = trim($line);
         if (!$line || $line[0] == '#') {
             continue;
         }
         if (!preg_match('!^\\s*(-?\\d+(?:\\.\\d+)?)\\s*[=:] ?(/.+/i?$|[^/].*)!', $line, $res)) {
             throw new Exception("Syntax error in patterns: {$line}");
         }
         if ($res[2][0] !== '/') {
             $res[2] = '/' . preg_quote($res[2], '/') . '/';
         }
         $this->patterns[] = array($res[2] . "u", (double) $res[1]);
     }
     //d($this->patterns,'scalpel patterns');
 }
Example #7
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $this->blocklist = !empty($settings['blocklist2']) ? $settings['blocklist2'] : 'data/blocklist.txt';
 }
Example #8
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $this->db = $this->services->getDB();
 }
Example #9
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $this->score = isset($settings['score']) ? $settings['score'] : -0.35;
 }
Example #10
0
 function __construct(array $settings, ISblamServices $services)
 {
     parent::__construct($settings, $services);
     $this->whitelist = @file(isset($settings['whitelist']) ? $settings['whitelist'] : "data/whiteip.txt");
 }