OSDN Git Service

v1.1.0
authorhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 6 Mar 2007 20:54:37 +0000 (20:54 +0000)
committerhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 6 Mar 2007 20:54:37 +0000 (20:54 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@536 1ca29b6e-896d-4ea0-84a5-967f57386b96

18 files changed:
trunk/NP_Blacklist/NP_AddSpamCheckEvent.php
trunk/NP_Blacklist/NP_Blacklist.php
trunk/NP_Blacklist/blacklist/blacklist_lib.php
trunk/NP_Blacklist/blacklist/help.html
trunk/NP_Blacklist/blacklist/index.php
trunk/NP_Blacklist/blacklist/settings/whiteip.pbl.dist [new file with mode: 0644]
trunk/NP_Blacklist/blacklist/template/index/htaccess_japanese-euc.html
trunk/NP_Blacklist/blacklist/template/index/htaccess_japanese-utf8.html
trunk/NP_Blacklist/blacklist/template/index/ipblock_header_english.html
trunk/NP_Blacklist/blacklist/template/index/ipblock_header_japanese-euc.html
trunk/NP_Blacklist/blacklist/template/index/ipblock_header_japanese-utf8.html
trunk/NP_Blacklist/blacklist/template/index/ipwhite_footer_english.html [new file with mode: 0644]
trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_english.html [new file with mode: 0644]
trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_japanese-euc.html [new file with mode: 0644]
trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Blacklist/blacklist/template/index/menu_english.html
trunk/NP_Blacklist/blacklist/template/index/menu_japanese-euc.html
trunk/NP_Blacklist/blacklist/template/index/menu_japanese-utf8.html

index 099179b..71b1cf0 100644 (file)
@@ -2,9 +2,9 @@
 // vim: tabstop=2:shiftwidth=2
 
 /**
-  * NP_CommentSpamCheck ($Revision: 1.1 $)
+  * NP_CommentSpamCheck ($Revision: 1.2 $)
   * by hsur ( http://blog.cles.jp/np_cles )
-  * $Id: NP_AddSpamCheckEvent.php,v 1.1 2007-02-02 16:48:25 hsur Exp $
+  * $Id: NP_AddSpamCheckEvent.php,v 1.2 2007-03-06 20:54:37 hsur Exp $
 */
 
 /*
@@ -44,10 +44,10 @@ class NP_AddSpamCheckEvent extends NucleusPlugin {
                return 'hsur';
        }
        function getURL() {
-               return 'http://blog.cles.jp/';
+               return 'http://blog.cles.jp/np_cles/';
        }
        function getVersion() {
-               return '1.1.0';
+               return '1.2.0';
        }
        function getDescription() {
                return 'Add SpamCheck event';
@@ -62,53 +62,43 @@ class NP_AddSpamCheckEvent extends NucleusPlugin {
        }
 
        function getEventList() {
-               return array ('PreAddComment', 'ValidateForm');
-       }
-
-       function event_PreAddComment(& $data) {
-               global $manager, $member;
-               if ($member->isLoggedIn())
-                       return;
-
-               // spamcheck
-               $spamcheck = array (
-                       'type' => 'comment', 
-                       'body' => postVar('body'), 
-                       'author' => $data['comment']['user'], 
-                       'url' => $data['comment']['userid'], 
-                       'id' => intval($data['comment']['itemid']), 
-                       'live' => true, 
-                       'return' => true,
-                       //SpamCheck API1 Compat
-                       'data' => postVar('body')."\n".$data['comment']['user']."\n".$data['comment']['userid'],
-               );
-               $manager->notify('SpamCheck', array ('spamcheck' => & $spamcheck));
-
-               if (isset ($spamcheck['result']) && $spamcheck['result'] == true) {
-                       if ($manager->pluginInstalled('NP_Blacklist')) {
-                               $plugin = & $manager->getPlugin('NP_Blacklist');
-                               $plugin->_redirect($plugin->getOption('redirect'));
-                       } else {
-                               $this->_showForbiddenMessage($spamcheck['message']);
-                       }
-               }
+               return array ('ValidateForm');
        }
 
        function event_ValidateForm(& $data) {
                global $manager, $member;
                if ($member->isLoggedIn())
                        return;
+                       
+               $spamcheck = array();
+               switch( $data['type'] ){
+                       case 'membermail':
+                               $spamcheck = array (
+                                       'type' => 'membermail', 
+                                       'data' => postVar('frommail')."\n".postVar('message'), 
+                                       'live' => true, 
+                                       'return' => true,
+                               );
+                               break;
+                       case 'comment':
+                               $spamcheck = array (
+                                       'type' => 'comment', 
+                                       'body' => postVar('body'), 
+                                       'author' => $data['comment']['user'], 
+                                       'url' => $data['comment']['userid'], 
+                                       'id' => intval($data['comment']['itemid']), 
+                                       'live' => true, 
+                                       'return' => true,
+                                       //SpamCheck API1 Compat
+                                       'data' => postVar('body')."\n".$data['comment']['user']."\n".$data['comment']['userid'],
+                               );
+                               break;
+                       default:
+                               return;
+               }
 
-               if ($data['type'] != 'membermail')
-                       return;
-               $spamcheck = array (
-                       'type' => 'membermail', 
-                       'data' => postVar('frommail')."\n".postVar('message'), 
-                       'live' => true, 
-                       'return' => true,
-               );
                $manager->notify('SpamCheck', array ('spamcheck' => & $spamcheck));
-               if (isset ($spamcheck['result']) && $spamcheck['result'] == true) {
+               if (isset($spamcheck['result']) && $spamcheck['result'] == true) {
                        if ($manager->pluginInstalled('NP_Blacklist')) {
                                $plugin = & $manager->getPlugin('NP_Blacklist');
                                $plugin->_redirect($plugin->getOption('redirect'));
index bea0c39..0803f9a 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
 /**
-  * NP_Blacklist(JP) ($Revision: 1.9 $)
+  * NP_Blacklist(JP) ($Revision: 1.10 $)
   * by hsur ( http://blog.cles.jp/np_cles )
-  * $Id: NP_Blacklist.php,v 1.9 2007-02-20 08:06:07 hsur Exp $
+  * $Id: NP_Blacklist.php,v 1.10 2007-03-06 20:54:37 hsur Exp $
   *
   * Based on NP_Blacklist 0.98
   * by xiffy
@@ -41,10 +41,10 @@ class NP_Blacklist extends NucleusPlugin {
                return 'http://blog.cles.jp/np_cles/category/31/subcatid/11';
        }
        function getVersion() {
-               return '1.0.3';
+               return '1.1.0';
        }
        function getDescription() {
-               return '[$Revision: 1.9 $]<br />'.NP_BLACKLIST_description;
+               return '[$Revision: 1.10 $]<br />'.NP_BLACKLIST_description;
        }
        function supportsFeature($what) {
                switch ($what) {
@@ -158,45 +158,6 @@ class NP_Blacklist extends NucleusPlugin {
                }
        }
 
-       // Obsolete
-       function event_PreAddComment(& $data) {
-               $comment = $data['comment'];
-               $result = $this->blacklist('comment', postVar('body')."\n".$comment['host']."\n".$comment['user']."\n".$comment['userid']);
-               if ($result) {
-                       pbl_logspammer('comment: '.$result);
-                       $this->_redirect($this->getOption('redirect'));
-               }
-       }
-
-       // Obsolete
-       function event_ValidateForm(& $data) {
-               if ($data['type'] == 'comment') {
-                       $comment = $data['comment'];
-                       $result = $this->blacklist('comment', postVar('body')."\n".$comment['host']."\n".$comment['user']."\n".$comment['userid']);
-                       if ($result) {
-                               pbl_logspammer('comment: '.$result);
-                               $this->_redirect($this->getOption('redirect'));
-                       }
-               } else {
-                       if ($data['type'] == 'membermail') {
-                               $result = $this->blacklist('membermail', postVar('frommail')."\n".postVar('message'));
-                               if ($result) {
-                                       pbl_logspammer('membermail: '.$result);
-                                       $this->_redirect($this->getOption('redirect'));
-                               }
-                       }
-               }
-       }
-
-       // Obsolete
-       function event_PreSkinParse(& $data) {
-               $result = $this->blacklist('PreSkinParse', '');
-               if ($result) {
-                       pbl_logspammer('PreSkinParse: '.$result);
-                       $this->_redirect($this->getOption('redirect'));
-               }
-       }
-
        function blacklist($type, $testString, $ipblock = true) {
                global $DIR_PLUGINS, $member;
                if ($this->resultCache)
@@ -310,30 +271,40 @@ class NP_Blacklist extends NucleusPlugin {
 
        function _initSettings() {
                $settingsDir = dirname(__FILE__).'/blacklist/settings/';
-               $settings = array ('blacklist.log', 'blockip.pbl', 'matched.pbl', 'blacklist.pbl', 'blacklist.txt', 'suspects.pbl',);
-               $personalBlacklist = $settingsDir.'personal_blacklist.pbl';
-               $personalBlacklistDist = $settingsDir.'personal_blacklist.pbl.dist';
+               $settings = array (
+                       'blacklist.log', 
+                       'blockip.pbl', 
+                       'whiteip.pbl',
+                       'matched.pbl', 
+                       'blacklist.pbl', 
+                       'blacklist.txt', 
+                       'suspects.pbl',
+                       'personal_blacklist.pbl',
+               );
 
                // setup settings
                if ($this->_is_writable($settingsDir)) {
+                       // setup distfile\r                      foreach (glob($settingsDir.'*.dist') as $distfile) {
+                               $userFile = substr($distfile, 0, strlen($distfile)-5);
+                               if (!file_exists($userFile)) {
+                                       if (copy($distfile, $userFile)) {
+                                               @chmod($userFile, 0666);
+                                               $this->_warn("'$userFile' ".NP_BLACKLIST_isCreated);
+                                       } else {
+                                               $this->_warn("'$userFile' ".NP_BLACKLIST_canNotCreate);
+                                       }
+                               }
+                       }
+                       
                        foreach ($settings as $setting) {
                                @touch($settingsDir.$setting);
                        }
-                       // setup personal blacklist
-                       if (!file_exists($personalBlacklist)) {
-                               if (copy($personalBlacklistDist, $personalBlacklist)) {
-                                       $this->_warn("'$personalBlacklist' ".NP_BLACKLIST_isCreated);
-                               } else {
-                                       $this->_warn("'$personalBlacklist' ".NP_BLACKLIST_canNotCreate);
-                               }
-                       }
                }
 
                // check settings       
                foreach ($settings as $setting) {
                        $this->_is_writable($settingsDir.$setting);
                }
-               $this->_is_writable($personalBlacklist);
 
                // setup and check cache dir
                $cacheDir = NP_BLACKLIST_CACHE_DIR;
index 83ab53f..a13767e 100644 (file)
@@ -19,7 +19,7 @@
 //
 // Modified by hsur
 // http://blog.cles.jp
-// $Id: blacklist_lib.php,v 1.8 2007-02-20 08:06:07 hsur Exp $
+// $Id: blacklist_lib.php,v 1.9 2007-03-06 20:54:37 hsur Exp $
 
 define('__WEBLOG_ROOT', dirname(dirname(realpath(__FILE__))));
 define('__EXT', '/blacklist');
@@ -51,11 +51,14 @@ function pbl_getconfig() {
 function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule = true) {
        // check whether a string contains spam
        // if it does, we return the rule that was matched first
-       $text = trim($text);
 
+       // whitelist\r   if (pbl_checkIp('white')) {
+               return '';
+       }
+       
        // first line of defense; block notorious spammers
        if ($ipblock) {
-               if (pbl_blockIP()) {
+               if (pbl_checkIp()) {
                        return "<b>".NP_BLACKLIST_ipBlocked."</b>: ".serverVar('REMOTE_ADDR')." (".serverVar('REMOTE_HOST').")";
                }
        }
@@ -70,9 +73,9 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule =
                        $explodedSplitBuffer = explode("/", $expression);
                        $expression = $explodedSplitBuffer[0];
                        if (strlen($expression) > 0) {
-                               if (preg_match("/".trim($expression)."/im", $text)) {
+                               if (preg_match("/".trim($expression)."/i", $text)) {
                                        if ($ipblock) {
-                                               pbl_suspectIP($ipthreshold);
+                                               pbl_suspectIp($ipthreshold);
                                        }
                                        if ($logrule) {
                                                pbl_logRule($expression);
@@ -93,9 +96,9 @@ function pbl_checkforspam($text, $ipblock = false, $ipthreshold = 10, $logrule =
                        $splitbuffer = explode("####", $buffer);
                        $expression = $splitbuffer[0];
                        if (strlen($expression) > 0) {
-                               if (preg_match("/".trim($expression)."/im", $text)) {
+                               if (preg_match("/".trim($expression)."/i", $text)) {
                                        if ($ipblock) {
-                                               pbl_suspectIP($ipthreshold);
+                                               pbl_suspectIp($ipthreshold);
                                        }
                                        if ($logrule) {
                                                pbl_logRule($expression);
@@ -203,7 +206,7 @@ function pbl_checkregexp($re) {
        global $g_reOk;
        $g_reOk = true;
        set_error_handler("_hdl");
-       preg_match("/".trim($re)."/im", "");
+       preg_match("/".trim($re)."/i", "");
        restore_error_handler();
        return $g_reOk;
 }
@@ -300,6 +303,7 @@ function pbl_log($text) {
 function pbl_getlogfiles(){
        $tmp = array(); 
        foreach (glob(__WEBLOG_ROOT.__EXT."/settings/blacklist.log*") as $filename) {
+               @chmod($filename, 0666);
                $tmp[$filename] = filemtime($filename);
        }
        arsort($tmp);
@@ -348,15 +352,11 @@ function check_for_iprbl() {
                return false;
 
        $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 (strpos(gethostbyname("$d.$c.$b.$a.$rbl"), '127.0.0') !== false) {
+               if (strpos(gethostbyname("$d.$c.$b.$a.$rbl"), '127.') === 0) {
                        return array ($rbl, $spammer_ip);
                }
        }
@@ -366,7 +366,7 @@ function check_for_iprbl() {
 
 function check_for_domainrbl($comment_text) {
        $domainrbl = array ('rbl.bulkfeeds.jp', 'url.rbl.jp', 'bsb.spamlookup.net');
-       $regex_url = "{https?://(?:www\.)?([a-z0-9._-]{2,})(?::[0-9]+)?((?:/[_.!~*a-z0-9;@&=+$,%-]+){0,2})}mi";
+       $regex_url = "{https?://(?:www\.)?([a-z0-9._-]{2,})(?::[0-9]+)?((?:/[_.!~*a-z0-9;@&=+$,%-]+){0,2})}i";
 
        $mk_regex_array = array ();
        preg_match_all($regex_url, $comment_text, $mk_regex_array);
@@ -377,7 +377,8 @@ function check_for_domainrbl($comment_text) {
                $domain_to_test = rtrim($mk_regex_array[1][$cnt], "\\");
                foreach ($domainrbl as $rbl) {
                        if (strlen($domain_to_test) > 3) {
-                               if (strpos(gethostbyname($domain_to_test.'.'.$rbl), '127.0.0') == !false) {
+                               //pbl_log('DNSBL Lookup: ' . $domain_to_test.'.'.$rbl);
+                               if (strpos(gethostbyname($domain_to_test.'.'.$rbl), '127.') === 0) {
                                        return array ($rbl, $domain_to_test);
                                }
                        }
@@ -386,21 +387,21 @@ function check_for_domainrbl($comment_text) {
        return false;
 }
 
-function pbl_blockIP() {
+function pbl_checkIp($type = 'block') {
        $remote_ip = trim(serverVar('REMOTE_ADDR'));
-       $filename = __WEBLOG_ROOT.__EXT."/settings/blockip.pbl";
+       $filename = __WEBLOG_ROOT.__EXT.'/settings/'.$type.'ip.pbl';
        $block = false;
        // already in ipblock?
        if (file_exists($filename)) {
                $fp = fopen(__WEBLOG_ROOT.__EXT."/settings/blockip.pbl", "r");
                while ($line = trim(fgets($fp, 255))) {
-                       if (strpos($remote_ip, $line) !== false) {
+                       if (pbl_netMatch($line, $remote_ip)) {
                                $block = true;
                        }
                }
                fclose($fp);
        } else {
-               $fp = fopen(__WEBLOG_ROOT.__EXT."/settings/blockip.pbl", "w");
+               $fp = fopen($filename, "w");
                fwrite($fp, "");
                fclose($fp);
        }
@@ -432,47 +433,55 @@ function pbl_logRule($expression) {
 // this list is the first line of defense, so notorious spamming machine will be kicked of real fast
 // improves blacklist performance
 // possible danger: blacklisting real humans who post on-the-edge comments
-function pbl_suspectIP($threshold, $remote_ip = '') {
+function pbl_suspectIP($threshold, $remote_ip = '', $type = 'block') {
        if ($remote_ip == '') {
                $remote_ip = serverVar('REMOTE_ADDR');
        }
-       $filename = __WEBLOG_ROOT.__EXT."/settings/suspects.pbl";
-       $blockfile = __WEBLOG_ROOT.__EXT."/settings/blockip.pbl";
-       $count = 0;
-       // suspectfile ?
-       if (!file_exists($filename)) {
-               $fp = fopen($filename, "w");
-               fwrite($fp, "");
-               fclose($fp);
+       if($type == 'white'){
+               $threshold = false;
        }
+       \r       $blockfile = __WEBLOG_ROOT.__EXT.'/settings/'.$type.'ip.pbl';
+       $filename = __WEBLOG_ROOT.__EXT.'/settings/suspects.pbl';
+       $count = 0;
 
-       $fp = fopen($filename, "r");
-       while ($line = fgets($fp, 255)) {
-               if (strpos($line, $remote_ip) !== false) {
-                       $count ++;
+       if( $threshold ){
+               // suspectfile ?
+               if (!file_exists($filename)) {
+                       $fp = fopen($filename, "w");
+                       fwrite($fp, "");
+                       fclose($fp);
+               }
+       
+               $fp = fopen($filename, "r");
+               while ($line = fgets($fp, 255)) {
+                       if (strpos($line, $remote_ip) === 0) {
+                               $count ++;
+                       }
                }
+               fclose($fp);
        }
-       fclose($fp);
 
        // not above threshold ? add ip to suspect ...
-       if ($count < $threshold) {
+       if ($threshold !== false && $count < $threshold) {
                $fp = fopen($filename, 'a+');
                fwrite($fp, $remote_ip."\n");
                fclose($fp);
        } else {
-               // remove from suspect to ip-block
-               $fp = fopen($filename, "r");
-               $rewrite = "";
-               while ($line = fgets($fp, 255)) {
-                       // keep all lines except the catched ip-address
-                       if (strpos($line, $remote_ip) !== false) {
-                               $rewrite .= $line;
+               if($threshold !== false){
+                       // remove from suspect to ip-block
+                       $fp = fopen($filename, "r");
+                       $rewrite = "";
+                       while ($line = fgets($fp, 255)) {
+                               // keep all lines except the catched ip-address
+                               if (strpos($line, $remote_ip) === 0) {
+                                       $rewrite .= $line;
+                               }
                        }
+                       fclose($fp);
+                       $fp = fopen($filename, "w");
+                       fwrite($fp, $rewrite);
+                       fclose($fp);
                }
-               fclose($fp);
-               $fp = fopen($filename, "w");
-               fwrite($fp, $rewrite);
-               fclose($fp);
                // transfer to blocked-ip file
                $fp = fopen($blockfile, 'a+');
                fwrite($fp, $remote_ip."\n");
@@ -480,9 +489,9 @@ function pbl_suspectIP($threshold, $remote_ip = '') {
        }
 }
 
-function pbl_showipblock() {
+function pbl_showIp($type = 'block') {
        global $pblmessage, $manager;
-       $filename = __WEBLOG_ROOT.__EXT."/settings/blockip.pbl";
+       $filename = __WEBLOG_ROOT.__EXT.'/settings/'.$type.'ip.pbl';
        $line = 0;
        $fp = fopen($filename, 'r');
        
@@ -492,22 +501,22 @@ function pbl_showipblock() {
                        echo "<tr><td>".$ip."</td><td>[".gethostbyaddr(rtrim($ip))."]</td><td>";
                else
                        echo "<tr><td>".$ip."</td><td>[<em>skipped</em>]</td><td>";
-               echo "<a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=deleteipblock&line=".$line), ENT_QUOTES)."\">".NP_BLACKLIST_delete."</a>";
+               echo "<a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF').'?action=deleteip'.$type.'&line='.$line), ENT_QUOTES)."\">".NP_BLACKLIST_delete."</a>";
                echo "</td></tr>";
        }
 }
 
-function pbl_addipblock() {
+function pbl_addIp($type = 'block') {
        if (isset ($_POST["ipaddress"])) {
-               pbl_suspectIP(0, postVar("ipaddress"));
+               pbl_suspectIP(0, postVar("ipaddress"), $type);
                return "<div class=\"pblmessage\">".NP_BLACKLIST_newEntryAdded.": <b>".htmlspecialchars(postVar("ipaddress"), ENT_QUOTES)."</b></div>";
        }
        return '';
 }
 
-function pbl_deleteipblock() {
+function pbl_deleteIp($type = 'block') {
        global $pblmessage;
-       $filename = __WEBLOG_ROOT.__EXT."/settings/blockip.pbl";
+       $filename = __WEBLOG_ROOT.__EXT.'/settings/'.$type.'ip.pbl';
        if (isset ($_GET["line"])) {
                $handle = fopen($filename, "r");
                $line = 0;
@@ -608,3 +617,14 @@ function pbl_test() {
        }
        return '';
 }
+
+function pbl_netMatch($network, $ip) {
+       if (strpos($network, '/') !== false) {
+               list($network, $mask) = explode('/', $network);
+               $network = ip2long($network);
+               $mask = 0xffffffff << (32 - intval($mask));
+               $ip = ip2long($ip);
+               return ($ip & $mask) == ($network & $mask);
+       }
+       return strpos($ip, $network) === 0;
+}
index e5e9bbf..a45fa58 100644 (file)
@@ -1,14 +1,27 @@
 <h3>バージョン履歴</h3>
+<ul>
+       <li>Version 1.1: (2006/03/**)</li>
+       <li> [Added] IPホワイトリスト機能を追加</li>
+       <li> [Fixed] DNSBLの参照が正常に行われていなかった問題を修正</li>
+       <li> [Fixed] IPアドレスの判定が不適切であった問題を修正</li>
+       <li> [Changed] 正規表現判定の/m修飾子を削除</li>
+       <li> [Changed] ソースコードから不要部分を削除</li>
+</ul>
 
 <ul>
-       <li>Version 1.0.0: (2006/02/04)</li>
+       <li>Version 1.0: (2006/02/04)</li>
        <li> [Added] .htaccess snipets生成時にorder allow,denyとallow from allを追加</li>
        <li> [Added] spam判定時、$spamcheckにメッセージを残すようにした。</li>
        <li> [Added] インタフェイスの日本語化</li>
        <li> [Changed] Referrerによるブロック機能の廃止</li>
        <li> [Added] ログの自動ローテート機能を追加(最大7日分)</li>
        <li> [Changed] PreAddCommentとValidateFormへの対応を廃止</li>
+       <li> [Fixed] Rewriteルールを生成の際に規定外の文字が混入していた問題を修正</li>
+       <li> [Fixed] ブラウザがIEの場合に.htaccess生成ボタンがきちんと動作しない問題を修正</li>
+       <li> [Fixed] touch()でエラーが表示される問題を修正</li>
+       <li> [Fixed] mb_string関連のエラーが出る問題を修正しました。</li>
 </ul>
+
 <ul>
        <li>Version 0.98 jp9: (2006/11/26)</li>
        <li> [Changed] 正規表現に/m修飾子を追加</li>
index 3520a3e..6406ebd 100644 (file)
@@ -39,7 +39,6 @@
        // get the plugin options; stored in the DB
     $pbl_config['enabled']       = $oPluginAdmin->plugin->getOption('enabled');
     $pbl_config['redirect']      = $oPluginAdmin->plugin->getOption('redirect');
-    $pbl_config['referrerblock'] = $oPluginAdmin->plugin->getOption('referrerblock');
     $pbl_config['ipblock']       = $oPluginAdmin->plugin->getOption('ipblock');
     $pbl_config['ipthreshold']   = $oPluginAdmin->plugin->getOption('ipthreshold');
     $pbl_config['BulkfeedsKey']   = $oPluginAdmin->plugin->getOption('BulkfeedsKey');
                        $action = 'testpage';
                        break;
                        
-               case 'addip':
-                       $tplVars['message'] = pbl_addipblock();
+               case 'addipblock':
+                       $tplVars['message'] = pbl_addIp();
                        $action = 'showipblock';
                        break;
                        
                case 'deleteipblock':
-                       $tplVars['message'] = pbl_deleteipblock();
+                       $tplVars['message'] = pbl_deleteIp();
                        $action = 'showipblock';
                        break;
 
+               case 'addipwhite':
+                       $tplVars['message'] = pbl_addIp('white');
+                       $action = 'showipwhite';
+                       break;
+               
+               case 'deleteipwhite':
+                       $tplVars['message'] = pbl_deleteIp('white');
+                       $action = 'showipwhite';
+                       break;
+               
                case 'htaccess':
                        $type = '';
                        if (isset ($_POST["type"])) {
                case 'showipblock':
                        $content = $templateEngine->fetch('ipblock_header', NP_BLACKLIST_TEMPLATEDIR_INDEX);
                        echo $templateEngine->fill($content, $tplVars, null);
-                       pbl_showipblock();
+                       pbl_showIp();
                        $content = $templateEngine->fetch('ipblock_footer', NP_BLACKLIST_TEMPLATEDIR_INDEX);
                        break;
+                       
+               case 'showipwhite':
+                       $content = $templateEngine->fetch('ipwhite_header', NP_BLACKLIST_TEMPLATEDIR_INDEX);
+                       echo $templateEngine->fill($content, $tplVars, null);
+                       pbl_showIp('white');
+                       $content = $templateEngine->fetch('ipwhite_footer', NP_BLACKLIST_TEMPLATEDIR_INDEX);
+                       break;
 
                case 'htaccess':
                        $content = $templateEngine->fetch('htaccess', NP_BLACKLIST_TEMPLATEDIR_INDEX);
diff --git a/trunk/NP_Blacklist/blacklist/settings/whiteip.pbl.dist b/trunk/NP_Blacklist/blacklist/settings/whiteip.pbl.dist
new file mode 100644 (file)
index 0000000..c31d12f
--- /dev/null
@@ -0,0 +1,4 @@
+127.0.0.0/24
+10.0.0.0/8
+172.16.0.0/12
+192.168.0.0/24
index d61fd11..7f1e8fd 100644 (file)
@@ -28,5 +28,9 @@
                <input type="hidden" name="action" value="htaccess" />
                <input type="hidden" name="type" value="reset_rule" />
                <input type="submit" name="submit" value="Rewrite¥ë¡¼¥ë¤Î¥ê¥»¥Ã¥È" />
-       </form>
+       </form><br />
+       <span style="color: red;">
+               ¥ë¡¼¥ë¤Î¥ê¥»¥Ã¥È¤ò¹Ô¤¦¤È¡¢¤³¤ì¤Þ¤Ç¤ËÃßÀѤµ¤ì¤¿³Æ¥Ç¡¼¥¿¤¬Á´¤Æ¾Ãµî¤µ¤ì¤Þ¤¹¡£<br />
+               ¾Ãµî¤·¤¿¥Ç¡¼¥¿¤ÎÉü³è¤Ï¤Ç¤­¤Þ¤»¤ó¤Î¤Ç¤´Ãí°Õ¤¯¤À¤µ¤¤¡£
+       </span>
 </div>
\ No newline at end of file
index b5eca54..2e76ca1 100644 (file)
@@ -28,5 +28,9 @@
                <input type="hidden" name="action" value="htaccess" />
                <input type="hidden" name="type" value="reset_rule" />
                <input type="submit" name="submit" value="Rewriteルールのリセット" />
-       </form>
+       </form><br />
+       <span style="color: red;">
+               ルールのリセットを行うと、これまでに蓄積された各データが全て消去されます。<br />
+               消去したデータの復活はできませんのでご注意ください。
+       </span>
 </div>
\ No newline at end of file
index ffed0e0..7e61717 100644 (file)
@@ -1,8 +1,11 @@
 <span style="color: red;">{{message}}</span>
-<h2>Show blocked ip addresses</h2>
+<h2>Show ip blacklist</h2>
+<p>Expression is allowed a front match or CIDR notation (###.###.###.###/##). 
+Example 1)10. -> from 10.0.0.0 to 10.255.255.255.255<br />
+Example 2)192.168.1.0/24 -> from 192.168.1.0 to 192.168.1.255</p>
 <div class="pbform">
        <form action="{{indexurl}}" method="post">
-               <input type="hidden" name="action" value="addip" />
+               <input type="hidden" name="action" value="addipblock" />
                <input type="hidden" name="ticket" value="{{ticket|}}" />
                Add IP to block: 
                <input class="pbltextinput" type="text" name="ipaddress" />
index d6615c9..a457617 100644 (file)
@@ -1,8 +1,11 @@
 <span style="color: red;">{{message}}</span>
 <h2>IP¥Ö¥é¥Ã¥¯¥ê¥¹¥ÈÊÔ½¸</h2>
+<p>IP¥¢¥É¥ì¥¹¤ÏÁ°Êý°ìÃפ⤷¤¯¤Ï¡¢CIDR·Á¼°(###.###.###.###/##)¤Ç»ØÄê¤Ç¤­¤Þ¤¹¡£<br />
+Îã1¡Ë10. -> 10.0.0.0¤«¤é10.255.255.255.255¤Þ¤Ç<br />
+Îã2¡Ë192.168.1.0/24 -> 192.168.1.0¤«¤é192.168.1.255¤Þ¤Ç<p>
 <div class="pbform">
        <form action="{{indexurl}}" method="post">
-               <input type="hidden" name="action" value="addip" />
+               <input type="hidden" name="action" value="addipblock" />
                <input type="hidden" name="ticket" value="{{ticket|}}" />
                ¶Ø»ß¥ê¥¹¥È¤ËÄɲÃ: 
                <input class="pbltextinput" type="text" name="ipaddress" />
index 87c2748..fa248d3 100644 (file)
@@ -1,8 +1,11 @@
 <span style="color: red;">{{message}}</span>
 <h2>IPブラックリスト編集</h2>
+<p>IPアドレスは前方一致もしくは、CIDR形式(###.###.###.###/##)で指定できます。<br />
+例1)10. -> 10.0.0.0から10.255.255.255.255まで<br />
+例2)192.168.1.0/24 -> 192.168.1.0から192.168.1.255まで<p>
 <div class="pbform">
        <form action="{{indexurl}}" method="post">
-               <input type="hidden" name="action" value="addip" />
+               <input type="hidden" name="action" value="addipblock" />
                <input type="hidden" name="ticket" value="{{ticket|}}" />
                禁止リストに追加: 
                <input class="pbltextinput" type="text" name="ipaddress" />
diff --git a/trunk/NP_Blacklist/blacklist/template/index/ipwhite_footer_english.html b/trunk/NP_Blacklist/blacklist/template/index/ipwhite_footer_english.html
new file mode 100644 (file)
index 0000000..000ca4b
--- /dev/null
@@ -0,0 +1 @@
+</table>
diff --git a/trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_english.html b/trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_english.html
new file mode 100644 (file)
index 0000000..919add0
--- /dev/null
@@ -0,0 +1,23 @@
+<span style="color: red;">{{message}}</span>
+<h2>Show ip white list</h2>
+<p>Expression is allowed a front match or CIDR notation (###.###.###.###/##). 
+Example 1)10. -> from 10.0.0.0 to 10.255.255.255.255<br />
+Example 2)192.168.1.0/24 -> from 192.168.1.0 to 192.168.1.255<p>
+<div class="pbform">
+       <form action="{{indexurl}}" method="post">
+               <input type="hidden" name="action" value="addipwhite" />
+               <input type="hidden" name="ticket" value="{{ticket|}}" />
+               Add IP to block: 
+               <input class="pbltextinput" type="text" name="ipaddress" />
+               <input type="submit" value="Add" />
+       </form>
+</div>
+
+<h3>These ip-addresses are permitted</h3>
+<p>Even if ip-addresses is listed on blacklist.</p>
+<table>
+       <tr>
+               <th>IP Address</th>
+               <th>reversed lookup</th>
+               <th>deletion</th>
+       </tr>
\ No newline at end of file
diff --git a/trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_japanese-euc.html b/trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_japanese-euc.html
new file mode 100644 (file)
index 0000000..54e6fe4
--- /dev/null
@@ -0,0 +1,25 @@
+<span style="color: red;">{{message}}</span>
+<h2>IP¥Û¥ï¥¤¥È¥ê¥¹¥ÈÊÔ½¸</h2>
+<p>IP¥¢¥É¥ì¥¹¤ÏÁ°Êý°ìÃפ⤷¤¯¤Ï¡¢CIDR·Á¼°(###.###.###.###/##)¤Ç»ØÄê¤Ç¤­¤Þ¤¹¡£<br />
+Îã1¡Ë10. ->    10.0.0.0¤«¤é10.255.255.255.255¤Þ¤Ç<br />
+Îã2¡Ë192.168.1.0/24 -> 192.168.1.0¤«¤é192.168.1.255¤Þ¤Ç<p>
+
+<div class="pbform">
+       <form action="{{indexurl}}" method="post">
+               <input type="hidden" name="action" value="addipwhite" />
+               <input type="hidden" name="ticket" value="{{ticket|}}" />
+               ¥Û¥ï¥¤¥È¥ê¥¹¥È¤ËÄɲÃ: 
+               <input class="pbltextinput" type="text" name="ipaddress" />
+               <input type="submit" value="ÄɲÃ" />
+       </form>
+</div>
+
+<h3>°Ê²¼¤ÎIP¥¢¥É¥ì¥¹¤«¤é¤Î¥¢¥¯¥»¥¹¤òµö²Ä¤·¤Æ¤¤¤Þ¤¹</h3>
+<p>¥Ö¥é¥Ã¥¯¥ê¥¹¥È¤Ë·ÇºÜ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ç¤â¥¢¥¯¥»¥¹¤¬µö²Ä¤µ¤ì¤Þ¤¹<p>
+       
+<table>
+       <tr>
+               <th>IP Address</th>
+               <th>¥Û¥¹¥È̾</th>
+               <th>ºï½ü</th>
+       </tr>
\ No newline at end of file
diff --git a/trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_japanese-utf8.html b/trunk/NP_Blacklist/blacklist/template/index/ipwhite_header_japanese-utf8.html
new file mode 100644 (file)
index 0000000..4a845ac
--- /dev/null
@@ -0,0 +1,25 @@
+<span style="color: red;">{{message}}</span>
+<h2>IPホワイトリスト編集</h2>
+<p>IPアドレスは前方一致もしくは、CIDR形式(###.###.###.###/##)で指定できます。<br />
+例1)10. ->  10.0.0.0から10.255.255.255.255まで<br />
+例2)192.168.1.0/24 -> 192.168.1.0から192.168.1.255まで<p>
+
+<div class="pbform">
+       <form action="{{indexurl}}" method="post">
+               <input type="hidden" name="action" value="addipwhite" />
+               <input type="hidden" name="ticket" value="{{ticket|}}" />
+               ホワイトリストに追加: 
+               <input class="pbltextinput" type="text" name="ipaddress" />
+               <input type="submit" value="追加" />
+       </form>
+</div>
+
+<h3>以下のIPアドレスからのアクセスを許可しています</h3>
+<p>ブラックリストに掲載されている場合でもアクセスが許可されます<p>
+       
+<table>
+       <tr>
+               <th>IP Address</th>
+               <th>ホスト名</th>
+               <th>削除</th>
+       </tr>
\ No newline at end of file
index 2a03e23..cfa5ff7 100644 (file)
                </a>
        </li>
        <li>
+               <a href="{{indexurl}}?action=showipwhite&amp;ticket={{ticket|}}">
+                       <img src="{{plugindirurl}}icons/i_edit.gif" />
+                       Edit ip white list
+               </a>
+       </li>
+       <li>
                <a href="{{indexurl}}?action=showipblock&amp;ticket={{ticket|}}">
-                       <img src="{{plugindirurl}}icons/i_log.gif" />
-                       Show blocked ip addresses
+                       <img src="{{plugindirurl}}icons/i_edit.gif" />
+                       Show ip black list 
                </a>
        </li>
        <li>
index 31fbbe2..c8c96a8 100644 (file)
                </a>
        </li>
        <li>
+               <a href="{{indexurl}}?action=showipwhite&amp;ticket={{ticket|}}">
+                       <img src="{{plugindirurl}}icons/i_edit.gif" />
+                       IP¥Û¥ï¥¤¥È¥ê¥¹¥ÈÊÔ½¸
+               </a>
+       </li>
+       <li>
                <a href="{{indexurl}}?action=showipblock&amp;ticket={{ticket|}}">
-                       <img src="{{plugindirurl}}icons/i_log.gif" />
+                       <img src="{{plugindirurl}}icons/i_edit.gif" />
                        IP¥Ö¥é¥Ã¥¯¥ê¥¹¥ÈÊÔ½¸
                </a>
        </li>
index 35736a5..305b3f3 100644 (file)
                </a>
        </li>
        <li>
+               <a href="{{indexurl}}?action=showipwhite&amp;ticket={{ticket|}}">
+                       <img src="{{plugindirurl}}icons/i_edit.gif" />
+                       IPホワイトリスト編集
+               </a>
+       </li>
+       <li>
                <a href="{{indexurl}}?action=showipblock&amp;ticket={{ticket|}}">
-                       <img src="{{plugindirurl}}icons/i_log.gif" />
+                       <img src="{{plugindirurl}}icons/i_edit.gif" />
                        IPブラックリスト編集
                </a>
        </li>