• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revision079f317381660a1ee33886f6cda41cf7b94a9213 (tree)
Time2006-10-15 21:35:37
Authorhsur <hsur@1ca2...>
Commiterhsur

Log Message

pregに/m修飾子を追加

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@451 1ca29b6e-896d-4ea0-84a5-967f57386b96

Change Summary

Incremental Difference

--- a/trunk/NP_Blacklist/NP_Blacklist.php
+++ b/trunk/NP_Blacklist/NP_Blacklist.php
@@ -77,7 +77,7 @@ class NP_Blacklist extends NucleusPlugin {
7777 function getName() { return 'Blacklist'; }
7878 function getAuthor() { return 'xiffy + cles'; }
7979 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'; }
8181 function getDescription() { return 'Blacklist for commentspammers (SpamCheck API 2.0 compatible)'; }
8282 function supportsFeature($what) {
8383 switch($what) {
@@ -110,7 +110,10 @@ class NP_Blacklist extends NucleusPlugin {
110110
111111 function getEventList() {
112112 $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
114117 }
115118
116119 function hasAdminArea() {
--- a/trunk/NP_Blacklist/blacklist/blacklist_lib.php
+++ b/trunk/NP_Blacklist/blacklist/blacklist_lib.php
@@ -25,8 +25,8 @@ define('NP_BLACKLIST_CACHE_LIFE', 86400);
2525 define('NP_BLACKLIST_CACHE_GC_INTERVAL', NP_BLACKLIST_CACHE_LIFE/8);
2626 define('NP_BLACKLIST_CACHE_GC_TIMESTAMP', 'gctime');
2727 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');
3030
3131 function pbl_getconfig() {
3232 global $pbl_config;
@@ -79,7 +79,7 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule =
7979 $explodedSplitBuffer = explode("/", $expression);
8080 $expression = $explodedSplitBuffer[0];
8181 if (strlen($expression) > 0) {
82- if(preg_match("/".trim($expression)."/i", $text)) {
82+ if(preg_match("/".trim($expression)."/im", $text)) {
8383 if ($ipblock) {
8484 pbl_suspectIP ($ipthreshold);
8585 }
@@ -104,7 +104,7 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule =
104104 // if(is_domain($expression)) {
105105 // $expression = str_replace(".","\.",$expression);
106106 // }
107- if(preg_match("/".trim($expression)."/i", $text)) {
107+ if(preg_match("/".trim($expression)."/im", $text)) {
108108 if ($ipblock) {
109109 pbl_suspectIP ($ipthreshold);
110110 }
@@ -121,6 +121,15 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule =
121121
122122 if( $ipblock && $listedrbl = check_for_iprbl() ) {
123123 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
124133 $ref = serverVar('HTTP_REFERER');
125134 return "ip listed on {$listedrbl[0]} found (Referer:{$ref})";
126135 }
@@ -129,6 +138,15 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule =
129138 if ($ipblock) {
130139 pbl_suspectIP ($ipthreshold);
131140 }
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
132150 return("url(s) listed on {$listedrbl[0]} ({$listedrbl[1]}) found");
133151 }
134152
@@ -336,6 +354,12 @@ function pbl_addexpression($expression, $comment) {
336354 fwrite($handle, $expression."\n");
337355 fclose($handle);
338356
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
339363 }
340364 }
341365
@@ -351,7 +375,7 @@ function pbl_checkregexp($re) {
351375 global $g_reOk;
352376 $g_reOk = true;
353377 set_error_handler("_hdl");
354- preg_match("/".trim($re)."/i", "");
378+ preg_match("/".trim($re)."/im", "");
355379 restore_error_handler();
356380 return $g_reOk;
357381 }
@@ -512,7 +536,10 @@ function check_for_iprbl () {
512536 }
513537
514538 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
516543 //$regex_url = "/((http:\/\/)|(www\.))([^\/\"<\s]*)/i";
517544 $regex_url = "{https?://(?:www\.)?([a-z0-9._-]{2,})(?::[0-9]+)?((?:/[_.!~*a-z0-9;@&=+$,%-]+){0,2})}m";
518545 $comment_text = mb_strtolower($comment_text);
--- a/trunk/NP_Blacklist/blacklist/help.html
+++ b/trunk/NP_Blacklist/blacklist/help.html
@@ -1,6 +1,11 @@
11 <h3>バージョン履歴</h3>
22
33 <ul>
4+ <li>Version 0.98 jp9: (2006/*/*)</li>
5+ <li> [Changed] 正規表現に/m修飾子を追加</li>
6+</ul>
7+
8+<ul>
49 <li>Version 0.98 jp8: (2006/09/30)</li>
510 <li> [Changed] IPブロックが正常に動作していなかった不具合を修正</li>
611 <li> [Changed] ブロックの際に画面が真っ白になってしまう不具合を修正</li>
Show on old repository browser