diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index 675abfbc634..2b72a4395ca 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -67,7 +67,6 @@ if ($action == 'set') } - /* * View */ @@ -85,6 +84,13 @@ $geoip=''; if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE)) { $geoip=new DolGeoIP('country',$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE); + //if ($geoip->error) print dol_htmloutput_errors($geoip->errorlabel,'',1); + if ($geoip->gi == 'NOGI') $geointernal=true; + else $geointernal=false; +} +else +{ + if (function_exists('geoip_country_code_by_name')) $geointernal=true; } // Mode @@ -102,6 +108,8 @@ print "\n"; $var=!$var; print ''.$langs->trans("PathToGeoIPMaxmindCountryDataFile").''; print ''; + +if ($geointernal) print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).'
'; print ''; if ($geoip) $version=$geoip->getVersion(); if ($version) diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index f8ccd749bb3..14364ea7902 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -65,18 +65,18 @@ class DolGeoIP print $this->errorlabel; return 0; } - if (! file_exists($datfile)) + if (! file_exists($datfile) || ! is_readable($datfile)) { //dol_syslog("DolGeoIP::DolGeoIP datafile ".$datfile." can not be read", LOG_ERR); $this->error='ErrorGeoIPClassNotInitialized'; $this->errorlabel="Datafile ".$datfile." not found"; - print $this->errorlabel; + print $this->errorlabel; // To be sure to understand when it fails on screens return 0; } if (function_exists('geoip_open')) { - $this->gi = geoip_open($datfile,GEOIP_STANDARD); + $this->gi = geoip_open($datfile,GEOIP_STANDARD); } else { @@ -133,7 +133,7 @@ class DolGeoIP function getVersion() { if ($this->gi == 'NOGI') return geoip_database_info(); - return ''; + return 'Not available (not using PHP internal geo functions)'; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a90fa297ef7..43f9b80c3d9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1442,7 +1442,7 @@ SuppliersInvoiceModel=Complete template of supplier invoice (logo...) SuppliersInvoiceNumberingModel=Supplier invoices numbering models ##### GeoIPMaxmind ##### GeoIPMaxmindSetup=GeoIP Maxmind module setup -PathToGeoIPMaxmindCountryDataFile=Path to file containing Maxmind ip to country translation.
Example: /usr/local/share/GeoIP/GeoIP.dat +PathToGeoIPMaxmindCountryDataFile=Path to file containing Maxmind ip to country translation.
Examples:
/usr/local/share/GeoIP/GeoIP.dat
/usr/share/GeoIP/GeoIP.dat NoteOnPathLocation=Note that your ip to country data file must be inside a directory your PHP can read (Check your PHP open_basedir setup and filesystem permissions). YouCanDownloadFreeDatFileTo=You can download a free demo version of the Maxmind GeoIP country file at %s. YouCanDownloadAdvancedDatFileTo=You can also download a more complete version, with updates, of the Maxmind GeoIP country file at %s. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index b25fb49a7e0..7f922675783 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1441,7 +1441,7 @@ SuppliersInvoiceModel=Modèle de factures fournisseur complet (logo…) SuppliersInvoiceNumberingModel=Modèles de numérotation des factures fournisseur ##### GeoIPMaxmind ##### GeoIPMaxmindSetup=Configuration du module GeoIP Maxmind -PathToGeoIPMaxmindCountryDataFile=Chemin du fichier Maxmind contenant les conversions IP->Pays.
Exemple: /usr/local/share/GeoIP/GeoIP.dat +PathToGeoIPMaxmindCountryDataFile=Chemin du fichier Maxmind contenant les conversions IP->Pays.
Exemples
/usr/local/share/GeoIP/GeoIP.dat
/usr/share/GeoIP/GeoIP.dat NoteOnPathLocation=Notez que ce fichier doit être dans un répertoire accessible à votre PHP (Vérifiez le paramètre open_basedir de votre PHP et les permissions du fichier/répertoires). YouCanDownloadFreeDatFileTo=Vous pouvez télécharger une version démo gratuite de la base Maxmind à l'adresse %s. YouCanDownloadAdvancedDatFileTo=Vous pouvez aussi télécharger une version plus complète avec mise à jours de la base Maxmind à l'adresse %s.