OSDN Git Service

jp9
authorhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 26 Nov 2006 05:52:33 +0000 (05:52 +0000)
committerhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 26 Nov 2006 05:52:33 +0000 (05:52 +0000)
[Added] localhostからのアクセスをspam判定しないようにした
[Added] ユーザーがログインしている場合にspam判定しないようにした
[Changed] PreSkinParseイベントを廃止

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

trunk/NP_Blacklist/NP_Blacklist.php
trunk/NP_Blacklist/blacklist/blacklist_lib.php
trunk/NP_Blacklist/blacklist/cache_eaccelerator.php
trunk/NP_Blacklist/blacklist/help.html

index 0e020d1..87891a1 100644 (file)
@@ -110,7 +110,7 @@ class NP_Blacklist extends NucleusPlugin {
 
        function getEventList() {
                $this->_initSettings();
-               return array('QuickMenu','PreAddComment','PreSkinParse','ValidateForm', 'SpamCheck');
+               return array('QuickMenu','PreAddComment','ValidateForm', 'SpamCheck');
        }
 
        function hasAdminArea() {
@@ -234,10 +234,14 @@ class NP_Blacklist extends NucleusPlugin {
        }
 
        function blacklist($type, $testString, $ipblock = true) {
-        global $DIR_PLUGINS;
+        global $DIR_PLUGINS, $member;
                if( $this->resultCache )
                        return $this->resultCache . '[Cached]';
                
+               if( $member->isLoggedIn() ){
+                       return '';
+               }
+               
            if ($this->getOption('enabled') == 'yes') {
             // update the blacklist first file
             //pbl_updateblacklist($this->getOption('update'),false);
index 59423c5..e833788 100644 (file)
@@ -25,8 +25,8 @@ define('NP_BLACKLIST_CACHE_LIFE', 86400);
 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;
@@ -489,7 +489,7 @@ function check_for_surbl ( $comment_text ) {
                if (strlen($domain_to_test) > 3)
                {
                        $domain_to_test = $domain_to_test . ".multi.surbl.org";
-                       if( strstr(gethostbyname($domain_to_test),'127.0.0')) {
+                       if( strpos(gethostbyname($domain_to_test),'127.0.0') !== false) {
                                return true;
                        }
                }
@@ -502,14 +502,16 @@ function check_for_surbl ( $comment_text ) {
 function check_for_iprbl () {
        if( pbl_ipcache_read() ) return false;
        
-       //$iprbl = array('sc.surbl.org', 'bsb.spamlookup.net', 'opm.blitzed.org', 'list.dsbl.org');
-       $iprbl = array('niku.2ch.net', 'list.dsbl.org', 'bsb.spamlookup.net');
-
        $spammer_ip = serverVar('REMOTE_ADDR');
+       if( strpos( $spammer_ip,'127.0.0') !== false ){
+               return false;
+       }
+       
+       $iprbl = array('niku.2ch.net', 'list.dsbl.org', 'bsb.spamlookup.net');
        list($a, $b, $c, $d) = explode('.', $spammer_ip);
                
        foreach($iprbl as $rbl ){
-               if( strstr( gethostbyname( "$d.$c.$b.$a.$rbl" ),'127.0.0') ) {
+               if( strpos( gethostbyname( "$d.$c.$b.$a.$rbl" ),'127.0.0') !== false ) {
                        return array($rbl, $spammer_ip);
                }
        }
@@ -533,7 +535,7 @@ function check_for_domainrbl ( $comment_text ) {
                foreach($domainrbl as $rbl ){
                        if (strlen($domain_to_test) > 3)
                        {
-                               if( strstr(gethostbyname($domain_to_test.'.'.$rbl),'127.0.0')) {
+                               if( strpos(gethostbyname($domain_to_test.'.'.$rbl),'127.0.0') ==! false) {
                                        return array($rbl, $domain_to_test);
                                }
                        }
@@ -729,7 +731,7 @@ function pbl_htaccess($type) {
         }
     }
     if ($type != "ip") {
-        $htaccess .= "\nRewriteRule .* ?¿½ [F,L]\n";
+        $htaccess .= "\nRewriteRule .* ï¿½ [F,L]\n";
     }
     return $htaccess;
 }
@@ -741,7 +743,7 @@ function pbl_htaccesspage() {
        }
 
     if (isset($_POST["type"])) {
-        if (strstr(postVar("type"),"blocked")) {
+        if ( strpos(postVar("type"),"blocked") !== false ) {
             $type = 'ip';
         } else {
             $type = 'rules';
index 9fc26fd..3637252 100644 (file)
@@ -1,19 +1,19 @@
 <?php
 
 /**
-* cache_eaccelerator.php ($Revision: 1.3 $)
+* cache_eaccelerator.php ($Revision: 1.4 $)
 * 
 * by hsur ( http://blog.cles.jp/np_cles )
-* $Id: cache_eaccelerator.php,v 1.3 2006-10-17 15:37:58 hsur Exp $
+* $Id: cache_eaccelerator.php,v 1.4 2006-11-26 05:52:33 hsur Exp $
 */
 
 function pbl_ipcache_write(){
        $key = sprintf("BL%u", ip2long(serverVar('REMOTE_ADDR')));
-       if( ! rand(0,19) ) pbl_ipcache_gc();
+       if( ! rand(0,100) ) pbl_ipcache_gc();
        
        // eAccelerator Cache
        eaccelerator_lock($key);
-       eaccelerator_put($key, true, NP_BLACKLIST_CACHE_LIFE);
+       eaccelerator_put($key, '1', NP_BLACKLIST_CACHE_LIFE);
        eaccelerator_unlock($key);
 }
 
index 265b7fc..e45024e 100644 (file)
@@ -1,9 +1,12 @@
 <h3>バージョン履歴</h3>
 
 <ul>
-       <li>Version 0.98 jp9: (2006/*/*)</li>
+       <li>Version 0.98 jp9: (2006/11/26)</li>
        <li> [Changed] 正規表現に/m修飾子を追加</li>
        <li> [Added] Ticket処理を追加(CSRF対策)</li>
+       <li> [Added] localhostからのアクセスをspam判定しないようにした</li>
+       <li> [Added] ユーザーがログインしている場合にspam判定しないようにした</li>
+       <li> [Changed] PreSkinParseイベントを廃止</li>
 </ul>
 
 <ul>