First part of today's bread.

This commit is contained in:
flash 2015-11-20 13:15:40 +01:00
parent 5b79940270
commit 09a1eeca77
2 changed files with 9 additions and 1 deletions

View file

@ -533,6 +533,14 @@ class Main
// Get country code from CloudFlare header (which just returns XX if not found) // Get country code from CloudFlare header (which just returns XX if not found)
public static function getCountryCode() 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 // Check if the required header is set and return it
if (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) { if (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) {

View file

@ -8,7 +8,7 @@
namespace Sakura; namespace Sakura;
// Define Sakura version // Define Sakura version
define('SAKURA_VERSION', '20151117'); define('SAKURA_VERSION', '20151120');
define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_COLOUR', '#6C3082');
define('SAKURA_STABLE', false); define('SAKURA_STABLE', false);