function getName() { return 'Blacklist'; }
function getAuthor() { return 'xiffy + cles'; }
function getURL() { return 'http://blog.cles.jp/np_cles/category/31/subcatid/11'; }
- function getVersion() { return '0.98 jp8'; }
+ function getVersion() { return '0.98 jp9'; }
function getDescription() { return 'Blacklist for commentspammers (SpamCheck API 2.0 compatible)'; }
function supportsFeature($what) {
switch($what) {
function getEventList() {
$this->_initSettings();
- return array('QuickMenu','PreAddComment','PreSkinParse','ValidateForm', 'SpamCheck');
+// cles::blog
+ //return array('QuickMenu','PreAddComment','PreSkinParse','ValidateForm', 'SpamCheck');
+ return array('QuickMenu', 'SpamCheck', 'PreSkinParse');
+// cles::blog
}
function hasAdminArea() {
define('NP_BLACKLIST_CACHE_GC_INTERVAL', NP_BLACKLIST_CACHE_LIFE/8);
define('NP_BLACKLIST_CACHE_GC_TIMESTAMP', 'gctime');
define('NP_BLACKLIST_CACHE_GC_TIMESTAMP_LIFE', NP_BLACKLIST_CACHE_LIFE*3);
-require_once(dirname(__FILE__).'/cache_file.php');
-//require_once(dirname(__FILE__).'/cache_eaccelerator.php');
+//require_once(dirname(__FILE__).'/cache_file.php');
+require_once(dirname(__FILE__).'/cache_eaccelerator.php');
function pbl_getconfig() {
global $pbl_config;
$explodedSplitBuffer = explode("/", $expression);
$expression = $explodedSplitBuffer[0];
if (strlen($expression) > 0) {
- if(preg_match("/".trim($expression)."/i", $text)) {
+ if(preg_match("/".trim($expression)."/im", $text)) {
if ($ipblock) {
pbl_suspectIP ($ipthreshold);
}
// if(is_domain($expression)) {
// $expression = str_replace(".","\.",$expression);
// }
- if(preg_match("/".trim($expression)."/i", $text)) {
+ if(preg_match("/".trim($expression)."/im", $text)) {
if ($ipblock) {
pbl_suspectIP ($ipthreshold);
}
if( $ipblock && $listedrbl = check_for_iprbl() ) {
pbl_suspectIP ($ipthreshold);
+// cles::blog
+ if( $listedrbl[0] != 'rbl.cles.net'){
+ $query = sprintf("INSERT INTO cles_iprbl(ip, reason) values('%s','%s')"
+ , mysql_real_escape_string( $listedrbl[1] )
+ , mysql_real_escape_string( 'RBL:' . $listedrbl[0] )
+ );
+ @mysql_query($query);
+ }
+// cles::blog
$ref = serverVar('HTTP_REFERER');
return "ip listed on {$listedrbl[0]} found (Referer:{$ref})";
}
if ($ipblock) {
pbl_suspectIP ($ipthreshold);
}
+// cles::blog
+ if( $listedrbl[0] != 'rbl.cles.net'){
+ $query = sprintf("INSERT INTO cles_urlrbl(url, reason) values('%s','%s')"
+ , mysql_real_escape_string( $listedrbl[1] )
+ , mysql_real_escape_string( 'RBL:' . $listedrbl[0] )
+ );
+ @mysql_query($query);
+ }
+// cles::blog
return("url(s) listed on {$listedrbl[0]} ({$listedrbl[1]}) found");
}
fwrite($handle, $expression."\n");
fclose($handle);
+//cles::blog
+ $query = "update " . sql_table("plugin_referrer_cache") .
+ " set ref_block = 1, ref_spam = 1 " .
+ "WHERE ref_from REGEXP '" . $expression . "'";
+ mysql_query($query);
+//cles::blog
}
}
global $g_reOk;
$g_reOk = true;
set_error_handler("_hdl");
- preg_match("/".trim($re)."/i", "");
+ preg_match("/".trim($re)."/im", "");
restore_error_handler();
return $g_reOk;
}
}
function check_for_domainrbl ( $comment_text ) {
- $domainrbl = array('rbl.bulkfeeds.jp', 'url.rbl.jp', 'bsb.spamlookup.net');
+// cles::blog
+ $domainrbl = array('rbl.cles.net', 'rbl.bulkfeeds.jp', 'url.rbl.jp', 'bsb.spamlookup.net');
+// $domainrbl = array('rbl.bulkfeeds.jp', 'url.rbl.jp', 'bsb.spamlookup.net');
+// cles::blog
//$regex_url = "/((http:\/\/)|(www\.))([^\/\"<\s]*)/i";
$regex_url = "{https?://(?:www\.)?([a-z0-9._-]{2,})(?::[0-9]+)?((?:/[_.!~*a-z0-9;@&=+$,%-]+){0,2})}m";
$comment_text = mb_strtolower($comment_text);