From: hsur Date: Sat, 7 Apr 2007 05:56:40 +0000 (+0000) Subject: v1.1.1 X-Git-Url: http://git.osdn.net/view?p=nucleus-jp%2Fnucleus-plugins.git;a=commitdiff_plain;h=901bf2f616502c325c1124b774414f83a2b90564 v1.1.1 git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@552 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- diff --git a/trunk/NP_Blacklist/NP_Blacklist.php b/trunk/NP_Blacklist/NP_Blacklist.php index 0803f9a..7b2b57a 100644 --- a/trunk/NP_Blacklist/NP_Blacklist.php +++ b/trunk/NP_Blacklist/NP_Blacklist.php @@ -1,9 +1,9 @@ '.NP_BLACKLIST_description; + return '[$Revision: 1.11 $]
'.NP_BLACKLIST_description; } function supportsFeature($what) { switch ($what) { @@ -108,7 +108,6 @@ class NP_Blacklist extends NucleusPlugin { // handle SpamCheck event function event_SpamCheck(& $data) { - global $DIR_PLUGINS; if (isset ($data['spamcheck']['result']) && $data['spamcheck']['result'] == true) { // Already checked... and is spam return; @@ -137,7 +136,7 @@ class NP_Blacklist extends NucleusPlugin { break; } } - $ipblock = ($data['spamcheck']['ipblock']) || ($data['spamcheck']['live']); + $ipblock = ($data['spamcheck']['ipblock'] == true ) || ($data['spamcheck']['live'] == true); // Check for spam $result = $this->blacklist($data['spamcheck']['type'], $data['spamcheck']['data'], $ipblock); @@ -159,7 +158,7 @@ class NP_Blacklist extends NucleusPlugin { } function blacklist($type, $testString, $ipblock = true) { - global $DIR_PLUGINS, $member; + global $member; if ($this->resultCache) return $this->resultCache.'[Cached]'; diff --git a/trunk/NP_Blacklist/blacklist/blacklist_lib.php b/trunk/NP_Blacklist/blacklist/blacklist_lib.php index a13767e..c789fbf 100644 --- a/trunk/NP_Blacklist/blacklist/blacklist_lib.php +++ b/trunk/NP_Blacklist/blacklist/blacklist_lib.php @@ -19,7 +19,7 @@ // // Modified by hsur // http://blog.cles.jp -// $Id: blacklist_lib.php,v 1.9 2007-03-06 20:54:37 hsur Exp $ +// $Id: blacklist_lib.php,v 1.10 2007-04-07 05:56:37 hsur Exp $ define('__WEBLOG_ROOT', dirname(dirname(realpath(__FILE__)))); define('__EXT', '/blacklist'); @@ -52,13 +52,14 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule = // check whether a string contains spam // if it does, we return the rule that was matched first - // whitelist if (pbl_checkIp('white')) { + // whitelist + if (pbl_checkIp('white')) { return ''; } // first line of defense; block notorious spammers if ($ipblock) { - if (pbl_checkIp()) { + if (pbl_checkIp()){ return "".NP_BLACKLIST_ipBlocked.": ".serverVar('REMOTE_ADDR')." (".serverVar('REMOTE_HOST').")"; } } @@ -117,11 +118,11 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule = return NP_BLACKLIST_ipListed." {$listedrbl[0]} ".NP_BLACKLIST_found." (Referer:{$ref})"; } - if ($text && ($listedrbl = check_for_domainrbl($text))) { + if ($text && $listedrbl = check_for_domainrbl($text)) { if ($ipblock) { pbl_suspectIP($ipthreshold); } - return (NP_BLACKLIST_urlListed." {$listedrbl[0]} ({$listedrbl[1]})".NP_BLACKLIST_found); + return NP_BLACKLIST_urlListed." {$listedrbl[0]} ({$listedrbl[1]})".NP_BLACKLIST_found; } // w00t! it's probably not spam! @@ -390,13 +391,13 @@ function check_for_domainrbl($comment_text) { function pbl_checkIp($type = 'block') { $remote_ip = trim(serverVar('REMOTE_ADDR')); $filename = __WEBLOG_ROOT.__EXT.'/settings/'.$type.'ip.pbl'; - $block = false; + $match = false; // already in ipblock? if (file_exists($filename)) { - $fp = fopen(__WEBLOG_ROOT.__EXT."/settings/blockip.pbl", "r"); + $fp = fopen($filename, "r"); while ($line = trim(fgets($fp, 255))) { if (pbl_netMatch($line, $remote_ip)) { - $block = true; + $match = true; } } fclose($fp); @@ -405,7 +406,7 @@ function pbl_checkIp($type = 'block') { fwrite($fp, ""); fclose($fp); } - return $block; + return $match; } function pbl_logRule($expression) { @@ -440,7 +441,8 @@ function pbl_suspectIP($threshold, $remote_ip = '', $type = 'block') { if($type == 'white'){ $threshold = false; } - $blockfile = __WEBLOG_ROOT.__EXT.'/settings/'.$type.'ip.pbl'; + + $blockfile = __WEBLOG_ROOT.__EXT.'/settings/'.$type.'ip.pbl'; $filename = __WEBLOG_ROOT.__EXT.'/settings/suspects.pbl'; $count = 0; @@ -585,6 +587,8 @@ function pbl_resetfile($type) { $files = pbl_getlogfiles(); foreach( $files as $file ) @ unlink($file); + @ touch(__WEBLOG_ROOT.__EXT."/settings/blacklist.log"); + @ chmod(__WEBLOG_ROOT.__EXT."/settings/blacklist.log", 0666); break; case 'ip' : $filename = __WEBLOG_ROOT.__EXT."/settings/blockip.pbl"; diff --git a/trunk/NP_Blacklist/blacklist/help.html b/trunk/NP_Blacklist/blacklist/help.html index c223a1e..51ed680 100644 --- a/trunk/NP_Blacklist/blacklist/help.html +++ b/trunk/NP_Blacklist/blacklist/help.html @@ -6,6 +6,9 @@
  •  [Fixed] IPアドレスの判定が不適切であった問題を修正
  •  [Changed] 正規表現判定の/m修飾子を削除
  •  [Changed] ソースコードから不要部分を削除
  • + +
  •  [Fixed] 一部環境において管理画面でエラーが出る問題を修正
  • +
  •  [Fixed] IPブロックがきちんと働いていなかったバグを修正