- Timestamp:
- 05/08/11 21:44:10 (14 years ago)
- Branch:
- default
- Children:
- 224:23ec5a339bcf, 225:411ee50a8664, 249:d0a17b7ca6e0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/antispam/filters/class.dc.filter.iplookup.php
r0 r223 16 16 public $name = 'IP Lookup'; 17 17 public $has_gui = true; 18 18 19 19 private $default_bls = 'sbl-xbl.spamhaus.org , bsb.spamlookup.net'; 20 20 21 21 public function __construct($core) 22 22 { 23 23 parent::__construct($core); 24 24 25 25 if (defined('DC_DNSBL_SUPER') && DC_DNSBL_SUPER && !$core->auth->isSuperAdmin()) { 26 26 $this->has_gui = false; 27 27 } 28 28 } 29 29 30 30 protected function setInfo() 31 31 { 32 32 $this->description = __('Checks sender IP address against DNSBL servers'); 33 33 } 34 34 35 35 public function getStatusMessage($status,$comment_id) 36 36 { 37 37 return sprintf(__('Filtered by %1$s with server %2$s.'),$this->guiLink(),$status); 38 38 } 39 39 40 40 public function isSpam($type,$author,$email,$site,$ip,$content,$post_id,&$status) 41 41 { … … 43 43 return; 44 44 } 45 45 46 46 $match = array(); 47 47 48 48 $bls = $this->getServers(); 49 49 $bls = preg_split('/\s*,\s*/',$bls); 50 50 51 51 foreach ($bls as $bl) 52 52 { … … 55 55 } 56 56 } 57 57 58 58 if (!empty($match)) { 59 59 $status = substr(implode(', ',$match),0,128); … … 61 61 } 62 62 } 63 63 64 64 public function gui($url) 65 65 { 66 66 $bls = $this->getServers(); 67 67 68 68 if (isset($_POST['bls'])) 69 69 { … … 76 76 } 77 77 } 78 78 79 79 /* DISPLAY 80 80 ---------------------------------------------- */ 81 81 $res = ''; 82 82 83 83 $res .= 84 84 '<form action="'.html::escapeURL($url).'" method="post">'. 85 85 '<fieldset><legend>' . __('IP Lookup servers') . '</legend>'. 86 '<p>'. __('Add here a coma separated list of servers.').'</p>'.87 '<p>'.form::textarea('bls',40,3,html::escapeHTML($bls),'maximal').'</p>'.86 '<p>'.'<label for="bls">'.__('Add here a coma separated list of servers.').'</label>'. 87 form::textarea('bls',40,3,html::escapeHTML($bls),'maximal').'</p>'. 88 88 '<p><input type="submit" value="'.__('Save').'" />'. 89 89 $this->core->formNonce().'</p>'. 90 90 '</fieldset>'. 91 91 '</form>'; 92 92 93 93 return $res; 94 94 } 95 95 96 96 private function getServers() 97 97 { … … 102 102 return $this->default_bls; 103 103 } 104 104 105 105 return $bls; 106 106 } 107 107 108 108 private function dnsblLookup($ip,$bl) 109 109 { 110 110 $revIp = implode('.',array_reverse(explode('.',$ip))); 111 111 112 112 $host = $revIp.'.'.$bl.'.'; 113 113 if (gethostbyname($host) != $host) { 114 114 return true; 115 115 } 116 116 117 117 return false; 118 118 } 119 119 } 120 120 ?> 121
Note: See TracChangeset
for help on using the changeset viewer.