diff --git a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php index 3e9b51488b0fa7b0a85c5bb8427e8fab43a1a242..b7df99663772e078ab55bcd05dc0a95e0c8efa22 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php +++ b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php @@ -28,6 +28,7 @@ class ServerBased extends GeoIp const TITLE = 'GeoIP (%s)'; const TEST_SERVER_VAR = 'GEOIP_ADDR'; const TEST_SERVER_VAR_ALT = 'GEOIP_COUNTRY_CODE'; + const TEST_SERVER_VAR_ALT_IPV6 = 'GEOIP_COUNTRY_CODE_V6'; private static $geoIpServerVars = array( parent::COUNTRY_CODE_KEY => 'GEOIP_COUNTRY_CODE', @@ -96,6 +97,11 @@ class ServerBased extends GeoIp if (!empty($_SERVER[$geoipVarName])) { $result[$resultKey] = $_SERVER[$geoipVarName]; } + + $geoipVarNameV6 = $geoipVarName . '_V6'; + if (!empty($_SERVER[$geoipVarNameV6])) { + $result[$resultKey] = $_SERVER[$geoipVarNameV6]; + } } foreach (self::$geoIpUtfServerVars as $resultKey => $geoipVarName) { if (!empty($_SERVER[$geoipVarName])) { @@ -150,25 +156,27 @@ class ServerBased extends GeoIp } $available = !empty($_SERVER[self::TEST_SERVER_VAR]) - || !empty($_SERVER[self::TEST_SERVER_VAR_ALT]); + || !empty($_SERVER[self::TEST_SERVER_VAR_ALT]) + || !empty($_SERVER[self::TEST_SERVER_VAR_ALT_IPV6]) + ; if ($available) { return true; - } else // if not available return message w/ extra info - { - if (!function_exists('apache_get_modules')) { - return Piwik::translate('General_Note') . ': ' . Piwik::translate('UserCountry_AssumingNonApache'); - } + } - $message = "<strong><em>" . Piwik::translate('General_Note') . ': ' - . Piwik::translate('UserCountry_FoundApacheModules') - . "</em></strong>:<br/><br/>\n<ul style=\"list-style:disc;margin-left:24px\">\n"; - foreach (apache_get_modules() as $name) { - $message .= "<li>$name</li>\n"; - } - $message .= "</ul>"; - return $message; + // if not available return message w/ extra info + if (!function_exists('apache_get_modules')) { + return Piwik::translate('General_Note') . ': ' . Piwik::translate('UserCountry_AssumingNonApache'); + } + + $message = "<strong><em>" . Piwik::translate('General_Note') . ': ' + . Piwik::translate('UserCountry_FoundApacheModules') + . "</em></strong>:<br/><br/>\n<ul style=\"list-style:disc;margin-left:24px\">\n"; + foreach (apache_get_modules() as $name) { + $message .= "<li>$name</li>\n"; } + $message .= "</ul>"; + return $message; } /** @@ -180,6 +188,7 @@ class ServerBased extends GeoIp { if (empty($_SERVER[self::TEST_SERVER_VAR]) && empty($_SERVER[self::TEST_SERVER_VAR_ALT]) + && empty($_SERVER[self::TEST_SERVER_VAR_ALT_IPV6]) ) { return Piwik::translate("UserCountry_CannotFindGeoIPServerVar", self::TEST_SERVER_VAR . ' $_SERVER'); }