mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
parent-merge 36589 - Added check for default country for GeoIP.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@45058 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
2881bf34a4
commit
4a65391d09
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
class Geoip extends Object {
|
class Geoip extends Object {
|
||||||
|
|
||||||
static $default_country_code;
|
public static $default_country_code = false;
|
||||||
|
|
||||||
/** ISO 3166 Country Codes **/
|
/** ISO 3166 Country Codes **/
|
||||||
/**
|
/**
|
||||||
* Includes additional codes for Europe,
|
* Includes additional codes for Europe,
|
||||||
@ -310,9 +310,10 @@ class Geoip extends Object {
|
|||||||
if ($start) $start+=2;
|
if ($start) $start+=2;
|
||||||
$code = substr($country, $start, 2); // skip space
|
$code = substr($country, $start, 2); // skip space
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($code == 'IP' || $code == '--') {
|
if ($code == 'IP' || $code == '--') {
|
||||||
if(self::$default_country_code) $code = self::$default_country_code;
|
if (self::$default_country_code) $code = self::$default_country_code;
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$codeOnly) {
|
if(!$codeOnly) {
|
||||||
@ -395,4 +396,4 @@ class Geoip extends Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user