From 09a1eeca77031543c90a282779a62fefce52d2e0 Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 20 Nov 2015 13:15:40 +0100 Subject: [PATCH] First part of today's bread. --- _sakura/components/Main.php | 8 ++++++++ _sakura/sakura.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index d729204..4b8cd46 100755 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -533,6 +533,14 @@ class Main // Get country code from CloudFlare header (which just returns XX if not found) public static function getCountryCode() { + // Attempt to get country code using PHP's built in geo thing + if (function_exists("geoip_country_code_by_name")) { + $code = geoip_country_code_by_name(self::getRemoteIP()); + // Check if $code is anything + if ($code) { + return $code; + } + } // Check if the required header is set and return it if (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) { diff --git a/_sakura/sakura.php b/_sakura/sakura.php index 3648dfd..355ae31 100755 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20151117'); +define('SAKURA_VERSION', '20151120'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_STABLE', false);