[-] Core : maxmind geoip API was outdated #PSCFV-5941

This commit is contained in:
Damien Metzger
2012-12-14 15:29:35 +01:00
parent 2b06e54e78
commit 3fd4fd6f70
3 changed files with 768 additions and 564 deletions
+715 -532
View File
File diff suppressed because it is too large Load Diff
+25 -5
View File
@@ -67,9 +67,9 @@ class geoipdnsrecord {
function getrecordwithdnsservice($str){
$record = new geoipdnsrecord;
$keyvalue = split(";",$str);
$keyvalue = explode(";",$str);
foreach ($keyvalue as $keyvalue2){
list($key,$value) = split("=",$keyvalue2);
list($key,$value) = explode("=",$keyvalue2);
if ($key == "co"){
$record->country_code = $value;
}
@@ -115,12 +115,16 @@ function getrecordwithdnsservice($str){
return $record;
}
function _get_record($gi,$ipnum){
$seek_country = _geoip_seek_country($gi,$ipnum);
function _get_record_v6($gi,$ipnum){
$seek_country = _geoip_seek_country_v6($gi,$ipnum);
if ($seek_country == $gi->databaseSegments) {
return NULL;
}
return _common_get_record($gi, $seek_country);
}
function _common_get_record($gi, $seek_country){
// workaround php's broken substr, strpos, etc handling with
// mbstring.func_overload and mbstring.internal_encoding
$enc = mb_internal_encoding();
@@ -206,6 +210,22 @@ function _get_record($gi,$ipnum){
return $record;
}
function GeoIP_record_by_addr_v6 ($gi,$addr){
if ($addr == NULL){
return 0;
}
$ipnum = inet_pton($addr);
return _get_record_v6($gi, $ipnum);
}
function _get_record($gi,$ipnum){
$seek_country = _geoip_seek_country($gi,$ipnum);
if ($seek_country == $gi->databaseSegments) {
return NULL;
}
return _common_get_record($gi, $seek_country);
}
function GeoIP_record_by_addr ($gi,$addr){
if ($addr == NULL){
return 0;
+28 -27
View File
@@ -1,5 +1,5 @@
<?php
# Copyright 2010 Maxmind LLC All Rights Reserved
# Copyright 2012 Maxmind LLC All Rights Reserved
$GEOIP_REGION_NAME = array(
"AD" => array(
"02" => "Canillo",
@@ -254,7 +254,9 @@ $GEOIP_REGION_NAME = array(
"09" => "West-Vlaanderen",
"10" => "Brabant Wallon",
"11" => "Brussels Hoofdstedelijk Gewest",
"12" => "Vlaams-Brabant"),
"12" => "Vlaams-Brabant",
"13" => "Flanders",
"14" => "Wallonia"),
"BF" => array(
"15" => "Bam",
"19" => "Boulkiemde",
@@ -675,9 +677,6 @@ $GEOIP_REGION_NAME = array(
"02" => "Antioquia",
"03" => "Arauca",
"04" => "Atlantico",
"05" => "Bolivar Department",
"06" => "Boyaca Department",
"07" => "Caldas Department",
"08" => "Caqueta",
"09" => "Cauca",
"10" => "Cesar",
@@ -687,7 +686,6 @@ $GEOIP_REGION_NAME = array(
"15" => "Guainia",
"16" => "Huila",
"17" => "La Guajira",
"18" => "Magdalena Department",
"19" => "Meta",
"20" => "Narino",
"21" => "Norte de Santander",
@@ -1621,26 +1619,19 @@ $GEOIP_REGION_NAME = array(
"03" => "Bengkulu",
"04" => "Jakarta Raya",
"05" => "Jambi",
"06" => "Jawa Barat",
"07" => "Jawa Tengah",
"08" => "Jawa Timur",
"09" => "Papua",
"10" => "Yogyakarta",
"11" => "Kalimantan Barat",
"12" => "Kalimantan Selatan",
"13" => "Kalimantan Tengah",
"14" => "Kalimantan Timur",
"15" => "Lampung",
"16" => "Maluku",
"17" => "Nusa Tenggara Barat",
"18" => "Nusa Tenggara Timur",
"19" => "Riau",
"20" => "Sulawesi Selatan",
"21" => "Sulawesi Tengah",
"22" => "Sulawesi Tenggara",
"23" => "Sulawesi Utara",
"24" => "Sumatera Barat",
"25" => "Sumatera Selatan",
"26" => "Sumatera Utara",
"28" => "Maluku",
"29" => "Maluku Utara",
@@ -1850,14 +1841,17 @@ $GEOIP_REGION_NAME = array(
"17" => "Kingston"),
"JO" => array(
"02" => "Al Balqa'",
"07" => "Ma",
"09" => "Al Karak",
"10" => "Al Mafraq",
"11" => "Amman Governorate",
"12" => "At Tafilah",
"13" => "Az Zarqa",
"14" => "Irbid",
"16" => "Amman"),
"15" => "Al Mafraq",
"16" => "Amman",
"17" => "Az Zaraqa",
"18" => "Irbid",
"19" => "Ma'an",
"20" => "Ajlun",
"21" => "Al Aqabah",
"22" => "Jarash",
"23" => "Madaba"),
"JP" => array(
"01" => "Aichi",
"02" => "Akita",
@@ -2272,6 +2266,7 @@ $GEOIP_REGION_NAME = array(
"79" => "Leova",
"80" => "Nisporeni",
"81" => "Ocnita",
"82" => "Orhei",
"83" => "Rezina",
"84" => "Riscani",
"85" => "Singerei",
@@ -2721,7 +2716,6 @@ $GEOIP_REGION_NAME = array(
"05" => "Limburg",
"06" => "Noord-Brabant",
"07" => "Noord-Holland",
"08" => "Overijssel",
"09" => "Utrecht",
"10" => "Zeeland",
"11" => "Zuid-Holland",
@@ -3217,7 +3211,8 @@ $GEOIP_REGION_NAME = array(
"89" => "Yevrey",
"90" => "Permskiy Kray",
"91" => "Krasnoyarskiy Kray",
"CI" => "Chechnya Republic"),
"92" => "Kamchatskiy Kray",
"93" => "Zabaykal'skiy Kray"),
"RW" => array(
"01" => "Butare",
"06" => "Gitarama",
@@ -3230,12 +3225,11 @@ $GEOIP_REGION_NAME = array(
"15" => "Sud"),
"SA" => array(
"02" => "Al Bahah",
"03" => "Al Jawf",
"05" => "Al Madinah",
"06" => "Ash Sharqiyah",
"08" => "Al Qasim",
"09" => "Al Qurayyat",
"10" => "Ar Riyad",
"11" => "Asir Province",
"13" => "Ha'il",
"14" => "Makkah",
"15" => "Al Hudud ash Shamaliyah",
@@ -4142,19 +4136,26 @@ $GEOIP_REGION_NAME = array(
"03" => "Al Mahrah",
"04" => "Hadramawt",
"05" => "Shabwah",
"06" => "Al Ghaydah",
"06" => "Lahij",
"07" => "Al Bayda'",
"08" => "Al Hudaydah",
"09" => "Al Jawf",
"10" => "Al Mahwit",
"11" => "Dhamar",
"12" => "Hajjah",
"13" => "Ibb",
"14" => "Ma'rib",
"15" => "Sa",
"16" => "San",
"15" => "Sa'dah",
"16" => "San'a'",
"17" => "Taizz",
"18" => "Ad Dali",
"19" => "Amran",
"20" => "Al Bayda'",
"21" => "Al Jawf",
"22" => "Hajjah",
"23" => "Ibb",
"24" => "Lahij",
"25" => "Ta"),
"25" => "Taizz"),
"ZA" => array(
"01" => "North-Western Province",
"02" => "KwaZulu-Natal",