Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
eldy committed Jul 9, 2013
2 parents 5706779 + c1cb5e9 commit 0ca4e4f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
10 changes: 9 additions & 1 deletion htdocs/admin/geoipmaxmind.php
Expand Up @@ -67,7 +67,6 @@
}



/*
* View
*/
Expand All @@ -85,6 +84,13 @@
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
Expand All @@ -102,6 +108,8 @@
$var=!$var;
print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
print '<td colspan="2">';

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).'<br>';
print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
if ($geoip) $version=$geoip->getVersion();
if ($version)
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/class/dolgeoip.class.php
Expand Up @@ -65,18 +65,18 @@ function __construct($type,$datfile)
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
{
Expand Down Expand Up @@ -133,7 +133,7 @@ function getCountryCodeFromName($name)
function getVersion()
{
if ($this->gi == 'NOGI') return geoip_database_info();
return '';
return 'Not available (not using PHP internal geo functions)';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/admin.lang
Expand Up @@ -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.<br>Example: /usr/local/share/GeoIP/GeoIP.dat
PathToGeoIPMaxmindCountryDataFile=Path to file containing Maxmind ip to country translation.<br>Examples:<br>/usr/local/share/GeoIP/GeoIP.dat<br>/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 <b>free demo version</b> of the Maxmind GeoIP country file at %s.
YouCanDownloadAdvancedDatFileTo=You can also download a more <b>complete version, with updates,</b> of the Maxmind GeoIP country file at %s.
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/fr_FR/admin.lang
Expand Up @@ -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.<br>Exemple: /usr/local/share/GeoIP/GeoIP.dat
PathToGeoIPMaxmindCountryDataFile=Chemin du fichier Maxmind contenant les conversions IP->Pays.<br>Exemples<br>/usr/local/share/GeoIP/GeoIP.dat<br>/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 <b>version démo gratuite</b> de la base Maxmind à l'adresse %s.
YouCanDownloadAdvancedDatFileTo=Vous pouvez aussi télécharger une <b>version plus complète avec mise à jours</b> de la base Maxmind à l'adresse %s.
Expand Down

0 comments on commit 0ca4e4f

Please sign in to comment.