aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mga_geoip.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-02-21 23:11:54 +0000
committerRomain d'Alverny <rda@mageia.org>2012-02-21 23:11:54 +0000
commit5416b74173ef12f2cdb33bc55f7737fd3147959f (patch)
tree442d28e69015a5d18f9533b57d26d44bf7688aca /lib/mga_geoip.php
parent09728f52801d2cbb1bf7aaa2d82c622750bdc1f3 (diff)
downloadwww-5416b74173ef12f2cdb33bc55f7737fd3147959f.tar
www-5416b74173ef12f2cdb33bc55f7737fd3147959f.tar.gz
www-5416b74173ef12f2cdb33bc55f7737fd3147959f.tar.bz2
www-5416b74173ef12f2cdb33bc55f7737fd3147959f.tar.xz
www-5416b74173ef12f2cdb33bc55f7737fd3147959f.zip
typos
Diffstat (limited to 'lib/mga_geoip.php')
-rw-r--r--lib/mga_geoip.php25
1 files changed, 2 insertions, 23 deletions
diff --git a/lib/mga_geoip.php b/lib/mga_geoip.php
index dab82f537..93edb558a 100644
--- a/lib/mga_geoip.php
+++ b/lib/mga_geoip.php
@@ -22,11 +22,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-require 'maxmind/geoip/geoip.inc.php';
-
// "iso 3166 country","continent code"
// taken from http://www.maxmind.com/app/country_continent
-$GEOIP_COUNTRY_TO_CONTINENT = array(
+$MGA_GEOIP_COUNTRY_TO_CONTINENT = array(
'A1' => '--', 'A2' => '--', 'AD' => 'EU', 'AE' => 'AS', 'AF' => 'AS',
'AG' => 'NA', 'AI' => 'NA', 'AL' => 'EU', 'AM' => 'AS', 'AN' => 'NA',
'AO' => 'AF', 'AP' => 'AS', 'AQ' => 'AN', 'AR' => 'SA', 'AS' => 'OC',
@@ -116,25 +114,6 @@ $GEOIP_COUNTRY_TO_CONTINENT = array(
);
/**
- * Naive function to return the version number of the IP address format.
- * Very naive, so to improve or discard with a better solution.
- *
- * @param string $addr
- *
- * @return int
-*/
-function _ip_version($addr) {
- $addr = trim($addr);
- if ($addr == '')
- return null;
-
- if (strpos(':', $addr) !== false)
- return 6;
-
- return 4;
-}
-
-/**
* Wrapper to PHP module function or available MaxMind API library.
* Works with IPv4 and IPv6 addresses.
*
@@ -152,7 +131,7 @@ function mga_geoip_country_by_ip($ip, $try_php_module = true)
if ($ip == '127.0.0.1' || $ip == '::1')
return null;
- if (function_exists('geoip_country_code_by_name'))
+ if ($try_php_module && function_exists('geoip_country_code_by_name'))
{
// may shout a "Host {IP} not found"
$loc = @geoip_country_code_by_name($ip);