Lines Matching refs:this

137     $this->debug = (bool)$setting;
138 $this->debugToLog = (bool) $setting;
158 $this->dbg('FSC Init');
160 $this->honeyPotApiKey = $hpKey;
161 $this->doHpCheck = true;
163 $this->honeyPotApiKey = $GLOBALS['honeyPotApiKey'];
164 $this->doHpCheck = true;
167 $this->akismetApiKey = $akismetKey;
168 $this->akismetEnabled = true;
170 $this->akismetApiKey = $GLOBALS['akismetApiKey'];
171 $this->akismetEnabled = true;
174 $this->akismetBlogURL = $akismetUrl;
176 $this->akismetBlogURL = $GLOBALS['akismetBlogURL'];
179 $this->akismetBlogURL = $_SERVER['HTTP_HOST'];
183 $this->logRoot = $GLOBALS['logRoot'];
186 $this->spamTriggers = $GLOBALS['ForumSpamBanTriggers'];
190 $this->setMemcached($GLOBALS['memCachedServer']);
193 $this->dbg('memcache not available, class "Memcached" not found');
195 $this->dbg('memcache not available, config "memCachedServer" not set');
200 $this->dbg('loading mollom');
203 $this->mollomCheck = new Mollom();
204 $this->dbg('mollom instantiated');
206 $this->mollomCheck->setPrivateKey($mollomPrivateKey);
207 $this->mollomCheck->setPublicKey($mollomPublicKey);
208 $serverList = $this->getCache('mollomServerList');
210 $serverList = $this->mollomCheck->getServerList();
211 $this->setCache('mollomServerList',$serverList);
213 $this->mollomCheck->setServerList($serverList);
215 $validKey = $this->getCache('mollomKeyValid');
217 $this->mollomEnabled = true;
219 if ($this->mollomCheck->verifyKey()) {
220 $this->mollomEnabled = true;
221 $this->setCache('mollomKeyValid','YES');
223 $this->setCache('mollomKeyValid','NO');
227 $this->dbg('Mollon exception: '.$e->getMessage());
228 $this->mollomEnabled = false;
231 $this->dbg('mollom class not found');
234 $this->dbg('mollom not enabled');
238 $this->startTime = $now['sec'] * 1000000 + $now['usec'];
250 $this->logRoot = $dir;
251 $this->dbg('Logging to '.$dir);
254 $this->dbg('Unable to write logs to '.$dir);
269 $this->memCached = new Memcached();
276 $this->dbg('memcache: '.$server);
277 return $this->memCached->addServer($server,$port);
283 if ($this->debugToLog) {
284 $this->addLogEntry('fsc-debug.log',$msg);
287 if (!$this->debug) return;
300 $elapsed = $end - $this->startTime;
305 if (empty($this->logRoot)) return;
306 if (!$this->logActivity) return;
308 if (!is_writable($this->logRoot)) {
318 file_put_contents($this->logRoot.'/'.$logFile.date('Y-m-d').'.log',$logEntry."\n",FILE_APPEND);
322 if (!$this->memCached) return false;
323 $val = $this->memCached->get($key);
324 $this->dbg('CACHE: '.$key .' = '.$val);
329 if (!$this->memCached) return false;
331 return $this->memCached->set($key,$val,$expiry);
346 … if (!isset($data['ips']) || !is_array($data['ips'])) $data['ips'] = array($this->defaults('ip'));
359 if (!$this->doHpCheck) return;
363 $lookup = $this->honeyPotApiKey.'.'.implode('.', $rev) . '.dnsbl.httpbl.org';
367 $this->matchedOn = 'ip';
368 $this->addLogEntry('honeypot.log','SPAM '.$lookup.' '.$rev);
369 $this->isSpam = true;
372 $this->addLogEntry('honeypot.log','HAM '.$lookup.' '.$rev);
381 if (empty($this->akismetApiKey)) {
382 $this->dbg('No Akismet API Key');
385 $cached = $this->getCache('akismetKeyValid');
388 'key'=> $this->akismetApiKey,
389 'blog' => $this->akismetBlogURL
392 $keyValid = $this->doPOST('http://rest.akismet.com/1.1/verify-key',$request);
394 $this->setCache('akismetKeyValid',$keyValid);
396 $this->addLogEntry('akismet.log','KEY CHECK (cached) '.$cached);
397 $this->dbg('akismet key (cached) '.$cached);
402 $this->dbg('akismet key valid');
405 $this->dbg('akismet key not valid');
420 if (!$this->mollomEnabled) return false;
421 $this->dbg('mollom check');
422 $data = $this->setDefaults($data);
423 $cached = $this->getCache('mollom'.md5(serialize($data)));
429 $isSpam = $this->mollomCheck->checkContent(
440 $this->setCache('mollom'.md5(serialize($data)),$isSpam);
443 $this->dbg('Exception thrown '.$e->getMessage());
449 $this->dbg('mollom check SPAM');
450 $this->matchedOn = 'unknown';
451 …$this->addLogEntry('mollom.log',$data['fromcache'].' SPAM '.$data['username'].' '.$data['email'].'…
452 $this->isSpam = true;
456 $this->dbg('mollom check HAM');
457 …$this->addLogEntry('mollom.log',$data['fromcache'].' HAM '.$data['username'].' '.$data['email'].' …
473 if (!$this->akismetEnabled) return false;
474 if (!$this->akismet_verify_key()) return false;
475 $this->dbg('akismet check');
479 …$data['user_ip'] = !empty($data['ips'][0]) ? $data['ips'][0]: $this->defaults('ip'); ## akismet on…
480 …$data['comment_author'] = !empty($data['username']) ? $data['username'] : $this->defaults('usernam…
481 …$data['comment_author_email'] = !empty($data['email']) ? $data['email'] : $this->defaults('email');
482 …$data['comment_content'] = !empty($data['content']) ? $data['content'] : $this->defaults('content'…
484 foreach ($this->akismetFields as $field) {
488 case 'blog': $data['blog'] = $this->akismetBlogURL;break;
508 $this->setCache('akismet'.md5(serialize($data)),$isSpam);
513 $this->dbg('akismet check SPAM');
514 $this->matchedOn = 'unknown';
515 …$this->addLogEntry('akismet.log',$data['fromcache'].' SPAM '.$data['username'].' '.$data['email'].…
516 $this->isSpam = true;
519 $this->dbg('akismet check HAM');
520 …$this->addLogEntry('akismet.log',$data['fromcache'].' HAM '.$data['username'].' '.$data['email'].'…
547 $header .= $param.$this->LE;
558 curl_setopt($curl, CURLOPT_USERAGENT,$this->UA);
567 $this->dbg('Curl Error '.$status.' '.$error);
634 $this->spamTriggers = $triggers;
664 $this->dbg('SFS check');
666 $spamTriggers = $this->sfsSpamTriggers;
696 $cached = $this->getCache('SFS'.$apiRequest);
698 $cUrl = $this->stopSpamAPIUrl.'?'.$apiRequest.'&unix';
699 $this->addLogEntry('sfs-apicall.log',$cUrl);
700 $xml = $this->doGET($cUrl);
703 $this->addLogEntry('sfs-apicall.log','FAIL ON XML');
706 $this->setCache('SFS'.$apiRequest,$xml);
735 $this->matchedOn .= $trigger .';';
746 $this->matchDetails = $spamMatched;
748 $this->dbg('SFS check SPAM');
749 $this->addLogEntry('munin-graph.log',$muninEntry);
750 …$this->addLogEntry('sfs.log',$cached.' SPAM '.$data['username'].' '.$data['email'].' '.join(',',$d…
752 $this->dbg('SFS check HAM');
753 …$this->addLogEntry('sfs.log',$cached.' HAM '.$data['username'].' '.$data['email'].' '.join(',',$da…
755 $this->isSpam = $this->isSpam || $isSfsSpam > 0;
787 $this->dbg('isSpam call');
791 $this->matchedBy = 'HAM test';
794 $this->matchedBy = 'SPAM test';
802 if ($this->doHpCheck && !empty($data['ips'])) {
803 $this->dbg('hpCheck');
806 $this->dbg('hpCheck IP '.$ip);
807 if ($this->honeypotCheck($ip)) {
808 $this->dbg('hpCheck SPAM');
810 $this->matchedBy = 'Honeypot Project';
816 $this->addLogEntry('munin-graph.log','HPSPAM');
818 $this->addLogEntry('munin-graph.log','HPHAM');
822 $num = $this->stopForumSpamCheck($data);
824 $this->matchedBy = 'Stop Forum Spam';
825 $this->dbg('SFS SPAM');
826 $this->addLogEntry('munin-graph.log','SFSSPAM');
830 $this->addLogEntry('munin-graph.log','SFSHAM');
833 if ((!$isSpam || $checkAll) && $this->akismetEnabled) {
834 if ($this->akismetCheck($data)) {
835 $this->dbg('Akismet SPAM');
836 $this->matchedBy = 'Akismet';
839 $this->addLogEntry('munin-graph.log','AKISPAM');
841 $this->addLogEntry('munin-graph.log','AKIHAM');
845 if ((!$isSpam || $checkAll) && $this->mollomEnabled) {
846 if ($this->mollomCheck($data)) {
847 $this->dbg('Mollom SPAM');
848 $this->matchedBy = 'Mollom';
851 $this->addLogEntry('munin-graph.log','MOLSPAM');
853 $this->addLogEntry('munin-graph.log','MOLHAM');
865 foreach (array_keys($this->services) as $svcMain) {
867 foreach (array_keys($this->services) as $svcCompare) {
870 $this->addLogEntry('munin-graph-compare.log',$svcMain.' - '.$svcCompare.' HIT ');
872 $this->addLogEntry('munin-graph-compare.log',$svcMain.' - '.$svcCompare.' MISS ');
880 $this->dbg('overall SpamScore '.sprintf('%d',$isSpam));
881 $this->isSpam = (bool) $isSpam > 0;
882 if ($this->isSpam) {
883 $this->addLogEntry('munin-graph.log','TOTAL LEVEL '.$isSpam);
885 $this->addLogEntry('munin-graph-timing.log',$this->elapsed());