svnno****@sourc*****
svnno****@sourc*****
2010年 1月 16日 (土) 07:52:31 JST
Revision: 787 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=787 Author: rsk Date: 2010-01-16 07:52:31 +0900 (Sat, 16 Jan 2010) Log Message: ----------- expack: - lib/HostCheck.phpããconf/ip_jig.phpã«jigãã©ã¦ã¶ã®IPã¢ãã¬ã¹å¸¯åãåãåºããã - lib/HostCheck.phpã®isAddr*ç³»ã¡ã½ãããconf/ip_*.phpã®å¤æ°åãå¤æ´ã Modified Paths: -------------- p2ex/trunk/conf/ip_au.php p2ex/trunk/conf/ip_docomo.php p2ex/trunk/conf/ip_emobile.php p2ex/trunk/conf/ip_iphone.php p2ex/trunk/conf/ip_softbank.php p2ex/trunk/conf/ip_willcom.php p2ex/trunk/lib/HostCheck.php Added Paths: ----------- p2ex/trunk/conf/ip_jig.php -------------- next part -------------- Modified: p2ex/trunk/conf/ip_au.php =================================================================== --- p2ex/trunk/conf/ip_au.php 2010-01-15 22:33:34 UTC (rev 786) +++ p2ex/trunk/conf/ip_au.php 2010-01-15 22:52:31 UTC (rev 787) @@ -6,9 +6,9 @@ * @link http://www.au.kddi.com/ezfactory/tec/spec/ezsava_ip.html */ -$host = '/^w[ab](\\d\\dproxy\\d\\d|cc\\d\\d?s\\d\\d?)\\.ezweb\\.ne\\.jp$/'; +$reghost = '/^w[ab](\\d\\dproxy\\d\\d|cc\\d\\d?s\\d\\d?)\\.ezweb\\.ne\\.jp$/'; -$band = array( +$bands = array( '59.135.38.128/25', '61.117.1.0/28', '61.117.2.32/29', Modified: p2ex/trunk/conf/ip_docomo.php =================================================================== --- p2ex/trunk/conf/ip_docomo.php 2010-01-15 22:33:34 UTC (rev 786) +++ p2ex/trunk/conf/ip_docomo.php 2010-01-15 22:52:31 UTC (rev 787) @@ -6,9 +6,9 @@ * @link http://www.nttdocomo.co.jp/service/imode/make/content/ip/index.html */ -$host = '/^proxy[0-9a-f]\\d\\d\\.docomo\\.ne\\.jp$/'; +$reghost = '/^proxy[0-9a-f]\\d\\d\\.docomo\\.ne\\.jp$/'; -$band = array( +$bands = array( //'124.146.174.0/24', //'124.146.175.0/24', '124.146.174.0/23', // ãñÂðê Modified: p2ex/trunk/conf/ip_emobile.php =================================================================== --- p2ex/trunk/conf/ip_emobile.php 2010-01-15 22:33:34 UTC (rev 786) +++ p2ex/trunk/conf/ip_emobile.php 2010-01-15 22:52:31 UTC (rev 787) @@ -10,9 +10,9 @@ * @link http://whois.nic.ad.jp/cgi-bin/whois_gw */ -$host = '/\\.pool\\.e(?:mnet|-mobile)\\.ne\\.jp$/'; +$reghost = '/\\.pool\\.e(?:mnet|-mobile)\\.ne\\.jp$/'; -$band = array( +$bands = array( '60.254.192.0/18', // JPNIC Whois Gateway '114.48.0.0/14', // JPNIC Whois Gateway '117.55.0.0/17', // JPNIC Whois Gateway Modified: p2ex/trunk/conf/ip_iphone.php =================================================================== --- p2ex/trunk/conf/ip_iphone.php 2010-01-15 22:33:34 UTC (rev 786) +++ p2ex/trunk/conf/ip_iphone.php 2010-01-15 22:52:31 UTC (rev 787) @@ -4,9 +4,9 @@ * iPhoneÌ[gzXg³K\»ÆIPAhXÑæ */ -$host = '/\\.(?:[0-9]|1[0-5])\\.tik\\.panda-world\\.ne\\.jp$/'; +$reghost = '/\\.(?:[0-9]|1[0-5])\\.tik\\.panda-world\\.ne\\.jp$/'; -$band = array( +$bands = array( '126.240.0.0/12', // \tgoNBBª 126.0.0.0/8 ÈÌÅ // iPhoneÉÀèÅ«È¢¨»ê è ); Added: p2ex/trunk/conf/ip_jig.php =================================================================== --- p2ex/trunk/conf/ip_jig.php (rev 0) +++ p2ex/trunk/conf/ip_jig.php 2010-01-15 22:52:31 UTC (rev 787) @@ -0,0 +1,79 @@ +<?php + +/** + * jpgAvÌ[gzXg³K\»ÆIPAhXÑæ (2009/06/04 _) + * + * @link http://br.jig.jp/pc/ip_br.html + */ + +// br***.jig.jp +$reghost = '/^br\\d+\\.jig\\.jp$/'; + +// @updated 2009/06/04 +$bands = array( + '59.106.14.175/32', + '59.106.14.176/32', + '59.106.23.169/32', + '59.106.23.170/31', + '59.106.23.172/31', + '59.106.23.174/32', + '112.78.114.171/32', + '112.78.114.172/30', + '112.78.114.176/29', + '112.78.114.184/30', + '112.78.114.188/31', + '112.78.114.191/32', + '112.78.114.192/29', + '112.78.114.200/30', + '112.78.114.204/31', + '112.78.114.206/32', + '112.78.114.208/32', + '202.181.96.94/32', + '202.181.98.153/32', + '202.181.98.156/32', + '202.181.98.160/32', + '202.181.98.179/32', + '202.181.98.182/32', + '202.181.98.185/32', + '202.181.98.196/32', + '202.181.98.218/32', + '202.181.98.221/32', + '202.181.98.223/32', + '202.181.98.247/32', + '210.188.205.81/32', + '210.188.205.83/32', + '210.188.205.97/32', + '210.188.205.166/31', + '210.188.205.168/31', + '210.188.205.170/32', + '210.188.220.169/32', + '210.188.220.170/31', + '210.188.220.172/30', + '219.94.133.167/32', + '219.94.133.192/32', + '219.94.133.243/32', + '219.94.144.5/32', + '219.94.144.6/31', + '219.94.144.23/32', + '219.94.144.24/32', + '219.94.147.35/32', + '219.94.147.36/30', + '219.94.147.42/31', + '219.94.147.44/32', + '219.94.166.8/30', + '219.94.166.173/32', + '219.94.197.196/30', + '219.94.197.200/30', + '219.94.197.204/31' +); + +/* + * Local Variables: + * mode: php + * coding: cp932 + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ +// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker: Modified: p2ex/trunk/conf/ip_softbank.php =================================================================== --- p2ex/trunk/conf/ip_softbank.php 2010-01-15 22:33:34 UTC (rev 786) +++ p2ex/trunk/conf/ip_softbank.php 2010-01-15 22:52:31 UTC (rev 787) @@ -8,9 +8,9 @@ * @link http://creation.mb.softbank.jp/xseries/xseries_ip.html */ -$host = '/\\.(?:jp-[a-z]|[a-z]\\.vodafone|softbank|openmobile|pcsitebrowser)\\.ne\\.jp$/'; +$reghost = '/\\.(?:jp-[a-z]|[a-z]\\.vodafone|softbank|openmobile|pcsitebrowser)\\.ne\\.jp$/'; -$band = array( +$bands = array( // Yahoo!P[^C '123.108.236.0/24', '123.108.237.0/27', Modified: p2ex/trunk/conf/ip_willcom.php =================================================================== --- p2ex/trunk/conf/ip_willcom.php 2010-01-15 22:33:34 UTC (rev 786) +++ p2ex/trunk/conf/ip_willcom.php 2010-01-15 22:52:31 UTC (rev 787) @@ -6,9 +6,9 @@ * @link http://www.willcom-inc.com/ja/service/contents_service/create/center_info/index.html */ -$host = '/\\.ppp\\.prin\\.ne\\.jp$/'; +$reghost = '/\\.ppp\\.prin\\.ne\\.jp$/'; -$band = array( +$bands = array( '61.198.128.0/24', '61.198.129.0/24', '61.198.130.0/24', Modified: p2ex/trunk/lib/HostCheck.php =================================================================== --- p2ex/trunk/lib/HostCheck.php 2010-01-15 22:33:34 UTC (rev 786) +++ p2ex/trunk/lib/HostCheck.php 2010-01-15 22:52:31 UTC (rev 787) @@ -249,13 +249,13 @@ * 2. (1)Ìzñ * 3. IPAhXðL[ƵA}XN·àµÍTulbg}XNðlÉÆéAzzñ */ - static public function isAddressInBand($address, $band = null, $regex = null, + static public function isAddressInBand($address, $bands = null, $reghost = null, $cache_id = null, $data_mtime = 0) { global $_conf; - if (is_null($band)) { - $band = $address; + if (is_null($bands)) { + $bands = $address; $address = $_SERVER['REMOTE_ADDR']; } @@ -265,11 +265,11 @@ } // IPAhXÑæðWJELbV - if (!is_array($band)) { - $band = array($band); + if (!is_array($bands)) { + $bands = array($bands); } if (!is_string($cache_id)) { - $cache_id = sha1(serialize($band)); + $cache_id = sha1(serialize($bands)); } elseif (preg_match('/\\W/', $cache_id)) { $cache_id = preg_replace('/\\W/', '_', $cache_id); } @@ -290,7 +290,7 @@ include $cache_file; } else { $tmp = array(); - foreach ($band as $target => $mask) { + foreach ($bands as $target => $mask) { if (is_int($target) && is_string($mask)) { if (strpos($mask, '/') !== false) { list($target, $mask) = explode('/', $mask, 2); @@ -328,12 +328,12 @@ } $tmp[$target] = $mask; } - $band = $tmp; + $bands = $tmp; if (!file_exists($cache_file)) { FileCtl::make_datafile($cache_file); } - $cache_data = "<?php\n\$band = array(\n"; - foreach ($band as $target => $mask) { + $cache_data = "<?php\n\$bands = array(\n"; + foreach ($bands as $target => $mask) { $cache_data .= sprintf("%12d => %d,\n", $target, $mask); } $cache_data .= ");\n"; @@ -341,20 +341,20 @@ } // IPAhXÑæðØ - foreach ($band as $target => $mask) { + foreach ($bands as $target => $mask) { if (($address & $mask) == ($target & $mask)) { return true; } } // Ñæª}b`¹¸A³K\»ªwè³êÄ¢éÆ« - if ($regex) { + if ($reghost) { if ($address == $_SERVER['REMOTE_ADDR'] && isset($_SERVER['REMOTE_HOST'])) { $remote_host = $_SERVER['REMOTE_HOST']; } else { $remote_host = self::cachedGetHostByAddr(long2ip($address)); } - if (@preg_match($regex, strtolower($remote_host))) { + if (@preg_match($reghost, strtolower($remote_host))) { return true; } } @@ -372,10 +372,10 @@ * ̶ñܽͻÌzñÅwè·é * }XN·ªÈª³ê½êÍãÊ64bitðär·é */ - static public function isAddressInBand6($address, $band = null) + static public function isAddressInBand6($address, $bands = null) { - if (is_null($band)) { - $band = $address; + if (is_null($bands)) { + $bands = $address; $address = $_SERVER['REMOTE_ADDR']; } @@ -384,8 +384,8 @@ return false; } - $band = (array)$band; - foreach ($band as $target) { + $bands = (array)$bands; + foreach ($bands as $target) { if (strpos($target, '/') !== false) { list($target, $mask) = explode('/', $target, 2); $mask = (int)$mask; @@ -514,13 +514,11 @@ $address = $_SERVER['REMOTE_ADDR']; } - if ($GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { - $regex = $host; - } else { - $regex = null; + if (!$GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { + $reghost = null; } - return self::isAddressInBand($address, $band, $regex, + return self::isAddressInBand($address, $bands, $reghost, 'docomo', filemtime(P2_CONF_DIR . '/ip_docomo.php')); } @@ -538,13 +536,11 @@ $address = $_SERVER['REMOTE_ADDR']; } - if ($GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { - $regex = $host; - } else { - $regex = null; + if (!$GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { + $reghost = null; } - return self::isAddressInBand($address, $band, $regex, + return self::isAddressInBand($address, $bands, $reghost, 'au', filemtime(P2_CONF_DIR . '/ip_au.php')); } @@ -562,13 +558,11 @@ $address = $_SERVER['REMOTE_ADDR']; } - if ($GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { - $regex = $host; - } else { - $regex = null; + if (!$GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { + $reghost = null; } - return self::isAddressInBand($address, $band, $regex, + return self::isAddressInBand($address, $bands, $reghost, 'softbank', filemtime(P2_CONF_DIR . '/ip_softbank.php')); } @@ -586,13 +580,11 @@ $address = $_SERVER['REMOTE_ADDR']; } - if ($GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { - $regex = $host; - } else { - $regex = null; + if (!$GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { + $reghost = null; } - return self::isAddressInBand($address, $band, $regex, + return self::isAddressInBand($address, $bands, $reghost, 'willcom', filemtime(P2_CONF_DIR . '/ip_willcom.php')); } @@ -610,13 +602,11 @@ $address = $_SERVER['REMOTE_ADDR']; } - if ($GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { - $regex = $host; - } else { - $regex = null; + if (!$GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { + $reghost = null; } - return self::isAddressInBand($address, $band, $regex, + return self::isAddressInBand($address, $bands, $reghost, 'emobile', filemtime(P2_CONF_DIR . '/ip_emobile.php')); } @@ -634,13 +624,11 @@ $address = $_SERVER['REMOTE_ADDR']; } - if ($GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { - $regex = $host; - } else { - $regex = null; + if (!$GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { + $reghost = null; } - return self::isAddressInBand($address, $band, $regex, + return self::isAddressInBand($address, $bands, $reghost, 'iphone', filemtime(P2_CONF_DIR . '/ip_iphone.php')); } @@ -650,22 +638,28 @@ /** * IPÍ jig web? * - * @param string $addr + * @param string $address * @return boolean */ - function isAddressJigWeb($addr = null) + function isAddressJigWeb($address = null) { - if (is_null($addr)) { - $addr = $_SERVER['REMOTE_ADDR']; + if (is_null($address)) { + $address = $_SERVER['REMOTE_ADDR']; } + // bw5022.jig.jp - $reghost = '/^bw\d+\.jig\.jp$/'; + if ($GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { + $reghost = '/^bw\\d+\\.jig\\.jp$/'; + } else { + $reghost = null; + } $bands = array( '202.181.98.241', // 2007/08/06 //'210.143.108.0/24', // 2005/6/23 ); - return self::isAddressInBand($addr, $bands, $reghost, 'jigweb'); + + return self::isAddressInBand($address, $bands, $reghost, 'jigweb'); } // }}} @@ -679,73 +673,19 @@ * @access public * @return boolean */ - function isAddressJig($addr = null) + function isAddressJig($address = null) { - if (is_null($addr)) { - $addr = $_SERVER['REMOTE_ADDR']; + include P2_CONF_DIR . '/ip_jig.php'; + + if (is_null($address)) { + $address = $_SERVER['REMOTE_ADDR']; } - // br***.jig.jp - $reghost = '/^br\d+\.jig\.jp$/'; + if (!$GLOBALS['_HOSTCHKCONF']['mobile_use_regex']) { + $reghost = null; + } - // @updated 2009/06/04 - $bands = array( - '59.106.14.175/32', - '59.106.14.176/32', - '59.106.23.169/32', - '59.106.23.170/31', - '59.106.23.172/31', - '59.106.23.174/32', - '112.78.114.171/32', - '112.78.114.172/30', - '112.78.114.176/29', - '112.78.114.184/30', - '112.78.114.188/31', - '112.78.114.191/32', - '112.78.114.192/29', - '112.78.114.200/30', - '112.78.114.204/31', - '112.78.114.206/32', - '112.78.114.208/32', - '202.181.96.94/32', - '202.181.98.153/32', - '202.181.98.156/32', - '202.181.98.160/32', - '202.181.98.179/32', - '202.181.98.182/32', - '202.181.98.185/32', - '202.181.98.196/32', - '202.181.98.218/32', - '202.181.98.221/32', - '202.181.98.223/32', - '202.181.98.247/32', - '210.188.205.81/32', - '210.188.205.83/32', - '210.188.205.97/32', - '210.188.205.166/31', - '210.188.205.168/31', - '210.188.205.170/32', - '210.188.220.169/32', - '210.188.220.170/31', - '210.188.220.172/30', - '219.94.133.167/32', - '219.94.133.192/32', - '219.94.133.243/32', - '219.94.144.5/32', - '219.94.144.6/31', - '219.94.144.23/32', - '219.94.144.24/32', - '219.94.147.35/32', - '219.94.147.36/30', - '219.94.147.42/31', - '219.94.147.44/32', - '219.94.166.8/30', - '219.94.166.173/32', - '219.94.197.196/30', - '219.94.197.200/30', - '219.94.197.204/31' - ); - return self::isAddressInBand($addr, $bands, $reghost, 'jig'); + return self::isAddressInBand($address, $bands, $reghost, 'jig'); } // }}} @@ -758,10 +698,10 @@ * @access public * @return boolean */ - static public function isAddressIbis($addr = null) + static public function isAddressIbis($address = null) { - if (is_null($addr)) { - $addr = $_SERVER['REMOTE_ADDR']; + if (is_null($address)) { + $address = $_SERVER['REMOTE_ADDR']; } // http://qb5.2ch.net/test/read.cgi/operate/1183341095/504 @@ -769,7 +709,8 @@ '219.117.203.9', // VXeÚsª®¹·êÎpµÈÈéçµ¢ '59.106.52.16/29' ); - return self::isAddressInBand($addr, $bands); + + return self::isAddressInBand($address, $bands); } // }}}