Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2013-07-09 13:51:27 +02:00
commit 0ca4e4ffe8
4 changed files with 15 additions and 7 deletions

View File

@ -67,7 +67,6 @@ if ($action == 'set')
} }
/* /*
* View * View
*/ */
@ -85,6 +84,13 @@ $geoip='';
if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE)) if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE))
{ {
$geoip=new DolGeoIP('country',$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 // Mode
@ -102,6 +108,8 @@ print "</tr>\n";
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>'; print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
print '<td colspan="2">'; 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.'">'; print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
if ($geoip) $version=$geoip->getVersion(); if ($geoip) $version=$geoip->getVersion();
if ($version) if ($version)

View File

@ -65,18 +65,18 @@ class DolGeoIP
print $this->errorlabel; print $this->errorlabel;
return 0; 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); //dol_syslog("DolGeoIP::DolGeoIP datafile ".$datfile." can not be read", LOG_ERR);
$this->error='ErrorGeoIPClassNotInitialized'; $this->error='ErrorGeoIPClassNotInitialized';
$this->errorlabel="Datafile ".$datfile." not found"; $this->errorlabel="Datafile ".$datfile." not found";
print $this->errorlabel; print $this->errorlabel; // To be sure to understand when it fails on screens
return 0; return 0;
} }
if (function_exists('geoip_open')) if (function_exists('geoip_open'))
{ {
$this->gi = geoip_open($datfile,GEOIP_STANDARD); $this->gi = geoip_open($datfile,GEOIP_STANDARD);
} }
else else
{ {
@ -133,7 +133,7 @@ class DolGeoIP
function getVersion() function getVersion()
{ {
if ($this->gi == 'NOGI') return geoip_database_info(); if ($this->gi == 'NOGI') return geoip_database_info();
return ''; return 'Not available (not using PHP internal geo functions)';
} }
/** /**

View File

@ -1442,7 +1442,7 @@ SuppliersInvoiceModel=Complete template of supplier invoice (logo...)
SuppliersInvoiceNumberingModel=Supplier invoices numbering models SuppliersInvoiceNumberingModel=Supplier invoices numbering models
##### GeoIPMaxmind ##### ##### GeoIPMaxmind #####
GeoIPMaxmindSetup=GeoIP Maxmind module setup 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). 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. 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. YouCanDownloadAdvancedDatFileTo=You can also download a more <b>complete version, with updates,</b> of the Maxmind GeoIP country file at %s.

View File

@ -1441,7 +1441,7 @@ SuppliersInvoiceModel=Modèle de factures fournisseur complet (logo…)
SuppliersInvoiceNumberingModel=Modèles de numérotation des factures fournisseur SuppliersInvoiceNumberingModel=Modèles de numérotation des factures fournisseur
##### GeoIPMaxmind ##### ##### GeoIPMaxmind #####
GeoIPMaxmindSetup=Configuration du module GeoIP Maxmind 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). 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. 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. YouCanDownloadAdvancedDatFileTo=Vous pouvez aussi télécharger une <b>version plus complète avec mise à jours</b> de la base Maxmind à l'adresse %s.