Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの
Revision | 079f317381660a1ee33886f6cda41cf7b94a9213 (tree) |
---|---|
Time | 2006-10-15 21:35:37 |
Author | hsur <hsur@1ca2...> |
Commiter | hsur |
pregに/m修飾子を追加
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@451 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -77,7 +77,7 @@ class NP_Blacklist extends NucleusPlugin { | ||
77 | 77 | function getName() { return 'Blacklist'; } |
78 | 78 | function getAuthor() { return 'xiffy + cles'; } |
79 | 79 | function getURL() { return 'http://blog.cles.jp/np_cles/category/31/subcatid/11'; } |
80 | - function getVersion() { return '0.98 jp8'; } | |
80 | + function getVersion() { return '0.98 jp9'; } | |
81 | 81 | function getDescription() { return 'Blacklist for commentspammers (SpamCheck API 2.0 compatible)'; } |
82 | 82 | function supportsFeature($what) { |
83 | 83 | switch($what) { |
@@ -110,7 +110,10 @@ class NP_Blacklist extends NucleusPlugin { | ||
110 | 110 | |
111 | 111 | function getEventList() { |
112 | 112 | $this->_initSettings(); |
113 | - return array('QuickMenu','PreAddComment','PreSkinParse','ValidateForm', 'SpamCheck'); | |
113 | +// cles::blog | |
114 | + //return array('QuickMenu','PreAddComment','PreSkinParse','ValidateForm', 'SpamCheck'); | |
115 | + return array('QuickMenu', 'SpamCheck', 'PreSkinParse'); | |
116 | +// cles::blog | |
114 | 117 | } |
115 | 118 | |
116 | 119 | function hasAdminArea() { |
@@ -25,8 +25,8 @@ define('NP_BLACKLIST_CACHE_LIFE', 86400); | ||
25 | 25 | define('NP_BLACKLIST_CACHE_GC_INTERVAL', NP_BLACKLIST_CACHE_LIFE/8); |
26 | 26 | define('NP_BLACKLIST_CACHE_GC_TIMESTAMP', 'gctime'); |
27 | 27 | define('NP_BLACKLIST_CACHE_GC_TIMESTAMP_LIFE', NP_BLACKLIST_CACHE_LIFE*3); |
28 | -require_once(dirname(__FILE__).'/cache_file.php'); | |
29 | -//require_once(dirname(__FILE__).'/cache_eaccelerator.php'); | |
28 | +//require_once(dirname(__FILE__).'/cache_file.php'); | |
29 | +require_once(dirname(__FILE__).'/cache_eaccelerator.php'); | |
30 | 30 | |
31 | 31 | function pbl_getconfig() { |
32 | 32 | global $pbl_config; |
@@ -79,7 +79,7 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule = | ||
79 | 79 | $explodedSplitBuffer = explode("/", $expression); |
80 | 80 | $expression = $explodedSplitBuffer[0]; |
81 | 81 | if (strlen($expression) > 0) { |
82 | - if(preg_match("/".trim($expression)."/i", $text)) { | |
82 | + if(preg_match("/".trim($expression)."/im", $text)) { | |
83 | 83 | if ($ipblock) { |
84 | 84 | pbl_suspectIP ($ipthreshold); |
85 | 85 | } |
@@ -104,7 +104,7 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule = | ||
104 | 104 | // if(is_domain($expression)) { |
105 | 105 | // $expression = str_replace(".","\.",$expression); |
106 | 106 | // } |
107 | - if(preg_match("/".trim($expression)."/i", $text)) { | |
107 | + if(preg_match("/".trim($expression)."/im", $text)) { | |
108 | 108 | if ($ipblock) { |
109 | 109 | pbl_suspectIP ($ipthreshold); |
110 | 110 | } |
@@ -121,6 +121,15 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule = | ||
121 | 121 | |
122 | 122 | if( $ipblock && $listedrbl = check_for_iprbl() ) { |
123 | 123 | pbl_suspectIP ($ipthreshold); |
124 | +// cles::blog | |
125 | + if( $listedrbl[0] != 'rbl.cles.net'){ | |
126 | + $query = sprintf("INSERT INTO cles_iprbl(ip, reason) values('%s','%s')" | |
127 | + , mysql_real_escape_string( $listedrbl[1] ) | |
128 | + , mysql_real_escape_string( 'RBL:' . $listedrbl[0] ) | |
129 | + ); | |
130 | + @mysql_query($query); | |
131 | + } | |
132 | +// cles::blog | |
124 | 133 | $ref = serverVar('HTTP_REFERER'); |
125 | 134 | return "ip listed on {$listedrbl[0]} found (Referer:{$ref})"; |
126 | 135 | } |
@@ -129,6 +138,15 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule = | ||
129 | 138 | if ($ipblock) { |
130 | 139 | pbl_suspectIP ($ipthreshold); |
131 | 140 | } |
141 | +// cles::blog | |
142 | + if( $listedrbl[0] != 'rbl.cles.net'){ | |
143 | + $query = sprintf("INSERT INTO cles_urlrbl(url, reason) values('%s','%s')" | |
144 | + , mysql_real_escape_string( $listedrbl[1] ) | |
145 | + , mysql_real_escape_string( 'RBL:' . $listedrbl[0] ) | |
146 | + ); | |
147 | + @mysql_query($query); | |
148 | + } | |
149 | +// cles::blog | |
132 | 150 | return("url(s) listed on {$listedrbl[0]} ({$listedrbl[1]}) found"); |
133 | 151 | } |
134 | 152 |
@@ -336,6 +354,12 @@ function pbl_addexpression($expression, $comment) { | ||
336 | 354 | fwrite($handle, $expression."\n"); |
337 | 355 | fclose($handle); |
338 | 356 | |
357 | +//cles::blog | |
358 | + $query = "update " . sql_table("plugin_referrer_cache") . | |
359 | + " set ref_block = 1, ref_spam = 1 " . | |
360 | + "WHERE ref_from REGEXP '" . $expression . "'"; | |
361 | + mysql_query($query); | |
362 | +//cles::blog | |
339 | 363 | } |
340 | 364 | } |
341 | 365 |
@@ -351,7 +375,7 @@ function pbl_checkregexp($re) { | ||
351 | 375 | global $g_reOk; |
352 | 376 | $g_reOk = true; |
353 | 377 | set_error_handler("_hdl"); |
354 | - preg_match("/".trim($re)."/i", ""); | |
378 | + preg_match("/".trim($re)."/im", ""); | |
355 | 379 | restore_error_handler(); |
356 | 380 | return $g_reOk; |
357 | 381 | } |
@@ -512,7 +536,10 @@ function check_for_iprbl () { | ||
512 | 536 | } |
513 | 537 | |
514 | 538 | function check_for_domainrbl ( $comment_text ) { |
515 | - $domainrbl = array('rbl.bulkfeeds.jp', 'url.rbl.jp', 'bsb.spamlookup.net'); | |
539 | +// cles::blog | |
540 | + $domainrbl = array('rbl.cles.net', 'rbl.bulkfeeds.jp', 'url.rbl.jp', 'bsb.spamlookup.net'); | |
541 | +// $domainrbl = array('rbl.bulkfeeds.jp', 'url.rbl.jp', 'bsb.spamlookup.net'); | |
542 | +// cles::blog | |
516 | 543 | //$regex_url = "/((http:\/\/)|(www\.))([^\/\"<\s]*)/i"; |
517 | 544 | $regex_url = "{https?://(?:www\.)?([a-z0-9._-]{2,})(?::[0-9]+)?((?:/[_.!~*a-z0-9;@&=+$,%-]+){0,2})}m"; |
518 | 545 | $comment_text = mb_strtolower($comment_text); |
@@ -1,6 +1,11 @@ | ||
1 | 1 | <h3>バージョン履歴</h3> |
2 | 2 | |
3 | 3 | <ul> |
4 | + <li>Version 0.98 jp9: (2006/*/*)</li> | |
5 | + <li> [Changed] 正規表現に/m修飾子を追加</li> | |
6 | +</ul> | |
7 | + | |
8 | +<ul> | |
4 | 9 | <li>Version 0.98 jp8: (2006/09/30)</li> |
5 | 10 | <li> [Changed] IPブロックが正常に動作していなかった不具合を修正</li> |
6 | 11 | <li> [Changed] ブロックの際に画面が真っ白になってしまう不具合を修正</li> |