From 131553106e2c025e4b29bdb6bdad52504fe7fbc1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Wed, 14 Oct 2009 11:04:09 +0000 Subject: [PATCH] Uniformize code --- htdocs/admin/barcode.php | 2 +- htdocs/admin/clicktodial.php | 2 +- htdocs/admin/geoipmaxmind.php | 132 ++++++++++++++++++ htdocs/admin/mailing.php | 15 +- htdocs/admin/paybox.php | 2 +- .../modules/modGeoIPMaxmind.class.php | 4 +- htdocs/langs/ar_AR/errors.lang | 2 +- htdocs/langs/ca_ES/errors.lang | 2 +- htdocs/langs/da_DA/errors.lang | 2 +- htdocs/langs/de_DE/errors.lang | 2 +- htdocs/langs/en_US/admin.lang | 9 +- htdocs/langs/en_US/errors.lang | 2 +- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/es_ES/errors.lang | 2 +- htdocs/langs/fi_FI/errors.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 9 +- htdocs/langs/fr_FR/errors.lang | 2 +- htdocs/langs/fr_FR/main.lang | 1 + htdocs/langs/it_IT/errors.lang | 2 +- htdocs/langs/nb_NO/errors.lang | 2 +- htdocs/langs/nl_BE/errors.lang | 2 +- htdocs/langs/nl_NL/errors.lang | 2 +- htdocs/langs/pl_PL/errors.lang | 2 +- htdocs/langs/pt_BR/errors.lang | 2 +- htdocs/langs/pt_PT/errors.lang | 2 +- htdocs/langs/ro_RO/errors.lang | 2 +- htdocs/langs/ru_RU/errors.lang | 2 +- htdocs/lib/dolgeoip.class.php | 25 +++- htdocs/lib/functions.lib.php | 21 ++- 29 files changed, 217 insertions(+), 40 deletions(-) create mode 100644 htdocs/admin/geoipmaxmind.php diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 40bf9ec74b3..4b23fdce4a3 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -239,7 +239,7 @@ if (!isset($_ENV['windir']) && !file_exists($_ENV['windir'])) if (! empty($conf->global->GENBARCODE_LOCATION) && ! file_exists($conf->global->GENBARCODE_LOCATION)) { $langs->load("errors"); - print '<br><font class="error">'.$langs->trans("ErrorGenbarCodeNotfound").'</font>'; + print '<br><font class="error">'.$langs->trans("ErrorFileNotFound",$conf->global->GENBARCODE_LOCATION).'</font>'; } print '</td>'; print '<td width="60" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index a9d82aa30e4..956028459ac 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -68,7 +68,7 @@ print '<input type="hidden" name="action" value="setvalue">'; $var=true; -print '<table class="noborder" width="100%">'; +print '<table class="nobordernopadding" width="100%">'; print '<tr class="liste_titre">'; print '<td>'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Value").'</td><td>'.$langs->trans("Description").'</td>'; diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php new file mode 100644 index 00000000000..21bd4f72bc8 --- /dev/null +++ b/htdocs/admin/geoipmaxmind.php @@ -0,0 +1,132 @@ +<?php +/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/admin/geoipmaxmind.php + * \ingroup geoipmaxmind + * \brief Setup page for geoipmaxmind module + * \version $Id$ + */ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/dolgeoip.class.php"); + +// Security check +if (!$user->admin) +accessforbidden(); + +$langs->load("admin"); +$langs->load("errors"); + +/* + * Actions + */ +if ($_POST["action"] == 'set') +{ + $error=0; + if (! empty($_POST["GEOIPMAXMIND_COUNTRY_DATAFILE"]) && ! file_exists($_POST["GEOIPMAXMIND_COUNTRY_DATAFILE"])) + { + $mesg='<div class="error">'.$langs->trans("ErrorFileNotFound",$_POST["GEOIPMAXMIND_COUNTRY_DATAFILE"]).'</div>'; + $error++; + } + + if (! $error) + { + dolibarr_set_const($db,"GEOIPMAXMIND_COUNTRY_DATAFILE",$_POST["GEOIPMAXMIND_COUNTRY_DATAFILE"],'chaine',0,'',$conf->entity); + } +} + + + +/* + * View + */ + +$form=new Form($db); + +llxHeader(); + +$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; +print_fiche_titre($langs->trans("GeoIPMaxmindSetup"),$linkback,'setup'); +print '<br>'; + +if ($mesg) print $mesg; + +$version=''; +$geoip=''; +if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE)) +{ + $geoip=new DolGeoIP('country',$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE); +} + +// Mode +$var=true; +print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; +print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; +print '<input type="hidden" name="action" value="set">'; + +print '<table class="noborder" width="100%">'; +print '<tr class="liste_titre">'; +print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>'; +print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; +print "</tr>\n"; + +$var=!$var; +print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>'; +print '<td colspan="2">'; +print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">'; +if ($geoip) $version=$geoip->getVersion(); +if ($version) +{ + print '<br>'.$langs->trans("Version").': '.$version; +} +print '</td></tr>'; + +print '</table>'; + +print "</form>\n"; + +print '<br>'; + +print $langs->trans("NoteOnPathLocation").'<br>'; + +$url1='http://www.maxmind.com/app/perl?rId=awstats'; +print $langs->trans("YouCanDownloadFreeDatFileTo",'<a href="'.$url1.'" target="_blank">'.$url1.'</a>'); + +print '<br>'; + +$url2='http://www.maxmind.com/app/perl?rId=awstats'; +print $langs->trans("YouCanDownloadAdvancedDatFileTo",'<a href="'.$url2.'" target="_blank">'.$url2.'</a>'); + +if ($geoip) +{ + print '<br><br>'; + print '<br>'; + $ip='24.24.24.24'; + print $langs->trans("TestGeoIPResult",$ip).':<br>'; + print $ip.' -> '; + $result=dol_print_ip($ip,1); + if ($result) print $result; + else print $langs->trans("Error"); + + $geoip->close(); +} + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index bc1c1d0f728..fdf249bea5b 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -15,15 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \file htdocs/admin/mailing.php \ingroup mailing - \brief Page d'administration/configuration du module mailing - \version $Revision$ + \brief Page to setup emailing module + \version $Id$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); @@ -34,6 +32,10 @@ if (!$user->admin) accessforbidden(); +/* + * Actions + */ + if ($_POST["action"] == 'setvalue' && $user->admin) { $result=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$_POST["email_from"],'chaine',0,'',$conf->entity); @@ -50,8 +52,7 @@ if ($_POST["action"] == 'setvalue' && $user->admin) /* - * - * + * View */ llxHeader(); @@ -68,7 +69,7 @@ print '<input type="hidden" name="action" value="setvalue">'; $var=true; -print '<table class="noborder" width="100%">'; +print '<table class="nobordernopadding" width="100%">'; print '<tr class="liste_titre">'; print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Value").'</td>'; diff --git a/htdocs/admin/paybox.php b/htdocs/admin/paybox.php index 7848b5f9786..e017aa8b352 100644 --- a/htdocs/admin/paybox.php +++ b/htdocs/admin/paybox.php @@ -85,7 +85,7 @@ print '<input type="hidden" name="action" value="setvalue">'; $var=true; -print '<table class="noborder" width="100%">'; +print '<table class="nobordernopadding" width="100%">'; print '<tr class="liste_titre">'; print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Value").'</td>'; diff --git a/htdocs/includes/modules/modGeoIPMaxmind.class.php b/htdocs/includes/modules/modGeoIPMaxmind.class.php index 837455688be..b9866cee0ae 100644 --- a/htdocs/includes/modules/modGeoIPMaxmind.class.php +++ b/htdocs/includes/modules/modGeoIPMaxmind.class.php @@ -53,7 +53,7 @@ class modGeoIPMaxmind extends DolibarrModules // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "GeoIP Maxmind conversions capabilities"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'experimental'; + $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) @@ -67,7 +67,7 @@ class modGeoIPMaxmind extends DolibarrModules $this->dirs = array("/geoipmaxmind"); // Config pages - $this->config_page_url = array(); + $this->config_page_url = array("geoipmaxmind.php"); // D�pendances $this->depends = array(); diff --git a/htdocs/langs/ar_AR/errors.lang b/htdocs/langs/ar_AR/errors.lang index f84b905cfeb..6cdc4e009d2 100644 --- a/htdocs/langs/ar_AR/errors.lang +++ b/htdocs/langs/ar_AR/errors.lang @@ -40,7 +40,7 @@ ErrorNoMailDefinedForThisUser=البريد لا يعرف لهذا المستخد ErrorFeatureNeedJavascript=هذه الميزة تحتاج إلى تفعيل جافا سكريبت في العمل. هذا التغيير في البنية -- عرض. ErrorTopMenuMustHaveAParentWithId0=وهناك قائمة من نوع 'توب' لا يمكن أن يكون أحد الوالدين القائمة. 0 وضعت في القائمة أو الأم في اختيار قائمة من نوع 'اليسار'. ErrorLeftMenuMustHaveAParentId=وهناك قائمة من نوع 'اليسار' يجب أن يكون لها هوية الوالد. -ErrorGenbarCodeNotfound=لم يتم العثور على الملف (باد الطريق الخطأ أو أذونات الوصول نفى المعلم openbasedir) +ErrorFileNotFound=لم يتم العثور على الملف (باد الطريق الخطأ أو أذونات الوصول نفى المعلم openbasedir) ErrorFunctionNotAvailableInPHP=<b>ق ٪</b> وظيفة مطلوبة لهذه الميزة ولكن لا تتوافر في هذه النسخة / الإعداد للPHP. ErrorDirAlreadyExists=دليل بهذا الاسم بالفعل. ErrorFieldCanNotContainSpecialCharacters=ميدان <b>٪ ق</b> يجب ألا يحتوي على أحرف خاصة. diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index f1ffd4b2fff..08425d3fad8 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -33,7 +33,7 @@ ErrorNoMailDefinedForThisUser = E-Mail no definit per a aquest usuari ErrorFeatureNeedJavascript = Aquesta funcionalitat requereix javascript actiu per funcionar. Modifiqueu en configuració->entorn. ErrorTopMenuMustHaveAParentWithId0 = Un menú del tipus 'Superior' no pot tenir un menú pare. Poseu 0 en l'ID pare o busqueu un menu del tipus 'Esquerra' ErrorLeftMenuMustHaveAParentId = Un menú del tipus 'Esquerra' ha de tenir un ID de pare -ErrorGenbarCodeNotfound = Arxiu no trobat (ruta incorrecta, permisos incorrectes o accés prohibit pel paràmetre openbasedir) +ErrorFileNotFound = Arxiu no trobat (ruta incorrecta, permisos incorrectes o accés prohibit pel paràmetre openbasedir) ErrorFunctionNotAvailableInPHP = La funció <b>%s</b> és requerida per aquesta característica, però no es troba disponible en aquesta versió/instal·lació de PHP. ErrorDirAlreadyExists = Ja existeix una carpeta amb aquest nom. ErrorFieldCanNotContainSpecialCharacters = El camp <b>%s</b> no ha de contenir caràcters especials diff --git a/htdocs/langs/da_DA/errors.lang b/htdocs/langs/da_DA/errors.lang index 8d4de2ed807..6a8ff3510df 100644 --- a/htdocs/langs/da_DA/errors.lang +++ b/htdocs/langs/da_DA/errors.lang @@ -40,7 +40,7 @@ ErrorNoMailDefinedForThisUser=Nr. mail defineret for denne bruger ErrorFeatureNeedJavascript=Denne funktion skal have Javascript skal aktiveres for at arbejde. Ændre dette i opsætningen - displayet. ErrorTopMenuMustHaveAParentWithId0=En menu af type 'Top' kan ikke have en forælder menuen. Sæt 0 i moderselskabet menu eller vælge en menu af typen »Venstre«. ErrorLeftMenuMustHaveAParentId=En menu af typen »Venstre« skal have en forælder id. -ErrorGenbarCodeNotfound=Filen blev ikke fundet (Forkert sti, forkerte tilladelser eller adgang nægtet ved openbasedir parameter) +ErrorFileNotFound=Filen blev ikke fundet (Forkert sti, forkerte tilladelser eller adgang nægtet ved openbasedir parameter) ErrorFunctionNotAvailableInPHP=<b>Funktion% s</b> er påkrævet for denne funktion, men er ikke tilgængelig i denne version / opsætning af PHP. ErrorDirAlreadyExists=En mappe med dette navn findes allerede. ErrorFieldCanNotContainSpecialCharacters=<b>Felt% s</b> må ikke indeholder specialtegn. diff --git a/htdocs/langs/de_DE/errors.lang b/htdocs/langs/de_DE/errors.lang index 7448a8423fd..59504a106c6 100644 --- a/htdocs/langs/de_DE/errors.lang +++ b/htdocs/langs/de_DE/errors.lang @@ -38,7 +38,7 @@ ErrorNoMailDefinedForThisUser=Keine Mail, die für dieses Benutzers ErrorFeatureNeedJavascript=Diese Funktion muss JavaScript aktiviert werden zu arbeiten. Ändern Sie diese im Setup - Display. ErrorTopMenuMustHaveAParentWithId0=Ein Menü vom Typ 'Top' kann nicht sein, Eltern-Menü. Put 0 in Stamm-Menü oder wählen Sie ein Menü vom Typ 'Links'. ErrorLeftMenuMustHaveAParentId=Ein Menü vom Typ 'Linke' muss ein Elternteil id. -ErrorGenbarCodeNotfound=Datei nicht gefunden (Bad Weg, falsche Berechtigungen oder der Zugriff wurde verweigert, indem openbasedir-Parameter) +ErrorFileNotFound=Datei nicht gefunden (Bad Weg, falsche Berechtigungen oder der Zugriff wurde verweigert, indem openbasedir-Parameter) ErrorFunctionNotAvailableInPHP=<b>Funktion% s</b> ist für diese Funktion ist aber nicht in dieser Version / Konfiguration von PHP. ErrorDirAlreadyExists=Ein Verzeichnis mit diesem Namen ist bereits vorhanden. ErrorFieldCanNotContainSpecialCharacters=<b>Feld% s</b> ist nicht Sonderzeichen. diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index de41df9468a..2dfaee4c4ef 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1108,4 +1108,11 @@ FreeLegalTextOnChequeReceipts=Free text on cheque receipts ##### Multicompany ##### MultiCompanySetup=Multi-company module setup ##### Suppliers ##### -SuppliersSetup=Supplier module setup \ No newline at end of file +SuppliersSetup=Supplier module setup +##### GeoIPMaxmind ##### +GeoIPMaxmindSetup=GeoIP Maxmind module setup +PathToGeoIPMaxmindCountryDataFile=Path to file containing Maxmind ip to country translation.<br>Example: /usr/local/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. +TestGeoIPResult=Test of a conversion IP -> country \ No newline at end of file diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 3966cfae4cb..b74c1544a64 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -32,7 +32,7 @@ ErrorNoMailDefinedForThisUser=No mail defined for this user ErrorFeatureNeedJavascript=This feature need javascript to be activated to work. Change this in setup - display. ErrorTopMenuMustHaveAParentWithId0=A menu of type 'Top' can't have a parent menu. Put 0 in parent menu or choose a menu of type 'Left'. ErrorLeftMenuMustHaveAParentId=A menu of type 'Left' must have a parent id. -ErrorGenbarCodeNotfound=File not found (Bad path, wrong permissions or access denied by openbasedir parameter) +ErrorFileNotFound=File <b>%s</b> not found (Bad path, wrong permissions or access denied by PHP openbasedir or safe_mode parameter) ErrorFunctionNotAvailableInPHP=Function <b>%s</b> is required for this feature but is not available in this version/setup of PHP. ErrorDirAlreadyExists=A directory with this name already exists. ErrorFieldCanNotContainSpecialCharacters=Field <b>%s</b> must not contains special characters. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 34836c9112a..9c2988c1ab3 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -539,6 +539,7 @@ WarningYouAreInMaintenanceMode=Warning, you are in a maintenance mode, so only l CreditCard=Credit card FieldsWithAreMandatory=Fields with <b>%s</b> are mandatory FieldsWithIsForPublic=Fields with <b>%s</b> are shown on public list of members. If you don't want this, check the "public" box. +AccordingToGeoIPDatabase=(according to GeoIP convertion) # Week day Day1=Monday diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index f681110831a..2ebf42aa30c 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -33,7 +33,7 @@ ErrorNoMailDefinedForThisUser = E-Mail no definido para este usuario ErrorFeatureNeedJavascript = Esta funcionalidad precisa de javascript activo para funcionar. Modifique en configuración->entorno. ErrorTopMenuMustHaveAParentWithId0 = Un menú del tipo 'Superior' no puede tener un menú padre. Ponga 0 en el ID padre o busque un menu del tipo 'Izquierdo' ErrorLeftMenuMustHaveAParentId = Un menú del tipo 'Izquierdo' debe de tener un ID de padre -ErrorGenbarCodeNotfound = Archivo no encontrado (ruta incorrecta, permisos incorrectos o acceso prohibido por el parámetro openbasedir) +ErrorFileNotFound = Archivo <b>%s</b> no encontrado (ruta incorrecta, permisos incorrectos o acceso prohibido por el parámetro openbasedir) ErrorFunctionNotAvailableInPHP = La función <b>%s</b> es requerida por esta funcionalidad, pero no se encuetra disponible en esta versión/instalación de PHP. ErrorDirAlreadyExists = Ya existe una carpeta con ese nombre. ErrorFieldCanNotContainSpecialCharacters = El campo <b>%s</b> no debe contener carácteres especiales diff --git a/htdocs/langs/fi_FI/errors.lang b/htdocs/langs/fi_FI/errors.lang index 516c425e306..41956d3cc9b 100644 --- a/htdocs/langs/fi_FI/errors.lang +++ b/htdocs/langs/fi_FI/errors.lang @@ -38,7 +38,7 @@ ErrorNoMailDefinedForThisUser=Ei postia määritelty tälle käyttäjälle ErrorFeatureNeedJavascript=Tätä ominaisuutta tarvitaan JavaScript on aktivoitu työstä. Muuta tämän setup - näyttö. ErrorTopMenuMustHaveAParentWithId0=A-valikosta tyyppi "Alkuun" ei voi olla emo-valikosta. Laita 0 vanhemman valikosta tai valita valikosta tyyppi "vasemmisto". ErrorLeftMenuMustHaveAParentId=A-valikosta tyyppi "vasemmisto" on oltava vanhemman id. -ErrorGenbarCodeNotfound=Tiedostoa ei löydy (Bad polku väärä oikeudet tai pääsy evätty openbasedir parametri) +ErrorFileNotFound=Tiedostoa ei löydy (Bad polku väärä oikeudet tai pääsy evätty openbasedir parametri) ErrorFunctionNotAvailableInPHP=<b>Tehtävä% s</b> tarvitaan tätä ominaisuutta, mutta ei ole käytettävissä tässä versiossa / setup PHP. ErrorDirAlreadyExists=A-hakemisto on jo olemassa. ErrorFieldCanNotContainSpecialCharacters=<b>Kenttä% s</b> ei saa sisältää erikoismerkkejä. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 82549e6a283..560481448cc 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1107,4 +1107,11 @@ FreeLegalTextOnChequeReceipts=Mention complémentaire sur les bordereaux de remi ##### Multicompany ##### MultiCompanySetup=Configuration du module Multi-société ##### Suppliers ##### -SuppliersSetup=Configuration du module Fournisseurs \ No newline at end of file +SuppliersSetup=Configuration du module Fournisseurs +##### 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 +NoteOnPathLocation=Notez que ce fichier doit etre 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échargez une <b>version demo 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. +TestGeoIPResult=Test de conversion IP -> Pays \ No newline at end of file diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 1ae1c3d378b..b85bf0c77ae 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -33,7 +33,7 @@ ErrorNoMailDefinedForThisUser=EMail non defini pour cet utilisateur ErrorFeatureNeedJavascript=Cette fonctionnalité a besoin de javascript activé pour fonctionner. Modifier dans configuration - affichage. ErrorTopMenuMustHaveAParentWithId0=Un menu de type 'Top' ne peut avoir de menu père. Mettre 0 dans l'id père ou choisir un menu de type 'Left'. ErrorLeftMenuMustHaveAParentId=Un menu de type 'Left' doit avoir un id de père. -ErrorGenbarCodeNotfound=Fichier introuvable (Mauvais chemin, permissions incorrectes ou accès interdit par le paramètre openbasedir) +ErrorFileNotFound=Fichier <b>%s</b> introuvable (Mauvais chemin, permissions incorrectes ou accès interdit par le paramètre PHP openbasedir ou safe_mode) ErrorFunctionNotAvailableInPHP=La fonction <b>%s</b> est requise pour cette fonctionnalité mais n'est pas disponible dans cette version/installation de PHP. ErrorDirAlreadyExists=Un répertoire portant ce nom existe déjà. ErrorFieldCanNotContainSpecialCharacters=Le champ <b>%s</b> ne peut contenir de caractères spéciaux. diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index f3be801a66e..1ab2d47b6c6 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -538,6 +538,7 @@ WarningYouAreInMaintenanceMode=Attention, vous êtes en mode maintenance, aussi CreditCard=Carte de crédit FieldsWithAreMandatory=Les champs marqués par un <b>%s</b> sont obligatoires FieldsWithIsForPublic=Les champs marqués par <b>%s</b> seront affiches sur la liste publique des membres. Si vous ne le souhaitez pas, décochez la case "public". +AccordingToGeoIPDatabase=(obtenu par conversion GeoIP) # Week day Day1=Lundi diff --git a/htdocs/langs/it_IT/errors.lang b/htdocs/langs/it_IT/errors.lang index 5c1468f52f6..57d6f711fc2 100644 --- a/htdocs/langs/it_IT/errors.lang +++ b/htdocs/langs/it_IT/errors.lang @@ -27,7 +27,7 @@ ErrorNoMailDefinedForThisUser =Nessun messaggio definito per questo utente ErrorFeatureNeedJavascript =Questa funzione javascript necessita di essere attivata al lavoro. Modificare questa impostazione in - visualizzazione. ErrorTopMenuMustHaveAParentWithId0 =Un menu di tipo 'Top' non può avere un menu principale. Metti 0 menu genitori o scegliere un menu di tipo 'sinistra'. ErrorLeftMenuMustHaveAParentId =Un menu di tipo 'rimasto' necessario disporre di un id genitore . -ErrorGenbarCodeNotfound =File non trovato (Bad percorso sbagliato autorizzazioni o accesso negato da openbasedir parametro) +ErrorFileNotFound =File non trovato (Bad percorso sbagliato autorizzazioni o accesso negato da openbasedir parametro) ErrorFunctionNotAvailableInPHP =Funzione <b> %s </b> è necessario per questa funzione, ma non è disponibile in questa versione / configurazione di PHP. ErrorDirAlreadyExists =Una directory con questo nome esiste già. WarningAllowUrlFopenMustBeOn =Parametro <b> allow_url_fopen </b> deve essere impostato su <b> su </b> nel filer <b> php.ini </b> per avere questo modulo di lavoro completamente. È necessario modificare questo file manualmente. diff --git a/htdocs/langs/nb_NO/errors.lang b/htdocs/langs/nb_NO/errors.lang index ed60f1b54c2..9444ad89efd 100644 --- a/htdocs/langs/nb_NO/errors.lang +++ b/htdocs/langs/nb_NO/errors.lang @@ -28,7 +28,7 @@ ErrorNoMailDefinedForThisUser=Ingen e-post angitt for denne brukeren. ErrorFeatureNeedJavascript=Denne funksjonen krever javascript for å virke. Endre dette i innstillinger - visning. ErrorTopMenuMustHaveAParentWithId0=En meny av typen 'Topp' kan ikke ha noen foreldremeny. Skriv 0 i foreldremeny eller velg menytypen 'Venstre'. ErrorLeftMenuMustHaveAParentId=En meny av typen 'Venstre' må ha foreldre-ID. -ErrorGenbarCodeNotfound=Fant ikke filen (Feil sti, feil tillatelser eller access denied av openbasedir-parameter) +ErrorFileNotFound=Fant ikke filen (Feil sti, feil tillatelser eller access denied av openbasedir-parameter) ErrorFunctionNotAvailableInPHP=Funksjonen <b>%s</b> kreves for denne funksjonen, men den er ikke tilgjengelig i denne versjonen/oppsettet av PHP. ErrorDirAlreadyExists=En mappe med dette navnet eksisterer allerede. ErrorFieldCanNotContainSpecialCharacters=Feltet <b>%s</b> kan ikke inneholde spesialtegn. diff --git a/htdocs/langs/nl_BE/errors.lang b/htdocs/langs/nl_BE/errors.lang index 32df484788e..fa2231fb7ad 100644 --- a/htdocs/langs/nl_BE/errors.lang +++ b/htdocs/langs/nl_BE/errors.lang @@ -30,7 +30,7 @@ ErrorNoMailDefinedForThisUser=Geen mail gedefinieerd voor deze gebruiker ErrorFeatureNeedJavascript=Javascript moet geactiveerd zijn voor deze functie. Verander dit in de setup - display. ErrorTopMenuMustHaveAParentWithId0=A menu of type 'Top' can't have a parent menu. Put 0 in parent menu or choose a menu of type 'Left'. ErrorLeftMenuMustHaveAParentId=A menu of type 'Left' must have a parent id. -ErrorGenbarCodeNotfound=Bestand niet gevonden (Slecht pad, verkeerde permissies of toegang geweigerd door openbasedir parameter) +ErrorFileNotFound=Bestand niet gevonden (Slecht pad, verkeerde permissies of toegang geweigerd door openbasedir parameter) ErrorFunctionNotAvailableInPHP=Functie <b>%s</b> is vereist voor deze toepassing, maar is niet beschikbaar in deze versie / setup van PHP. ErrorDirAlreadyExists=Een map met deze naam bestaat al. ErrorFieldCanNotContainSpecialCharacters=Veld <b>%s</b> mag geen speciale tekens bevat. diff --git a/htdocs/langs/nl_NL/errors.lang b/htdocs/langs/nl_NL/errors.lang index 5d774d9113a..a403bcb6534 100644 --- a/htdocs/langs/nl_NL/errors.lang +++ b/htdocs/langs/nl_NL/errors.lang @@ -40,7 +40,7 @@ ErrorNoMailDefinedForThisUser=No mail gedefinieerd voor deze gebruiker ErrorFeatureNeedJavascript=Deze functie moet javascript geactiveerd te werken. Verander dit in de setup - display. ErrorTopMenuMustHaveAParentWithId0=Een menu van het type 'Top' kan niet beschikken over een ouder menu. Leg 0 bij de ouders menu of kiezen uit een menu van het type 'Links'. ErrorLeftMenuMustHaveAParentId=Een menu van het type 'links' moeten een ouder id. -ErrorGenbarCodeNotfound=Bestand niet gevonden (Bad pad, verkeerde permissies of toegang geweigerd door openbasedir parameter) +ErrorFileNotFound=Bestand niet gevonden (Bad pad, verkeerde permissies of toegang geweigerd door openbasedir parameter) ErrorFunctionNotAvailableInPHP=<b>Functie% s</b> is vereist voor deze functie, maar is niet beschikbaar in deze versie / setup van PHP. ErrorDirAlreadyExists=Een map met deze naam al bestaat. ErrorFieldCanNotContainSpecialCharacters=<b>Veld% s</b> mag geen speciale tekens bevat. diff --git a/htdocs/langs/pl_PL/errors.lang b/htdocs/langs/pl_PL/errors.lang index eb2d1359958..eb890e64f5e 100644 --- a/htdocs/langs/pl_PL/errors.lang +++ b/htdocs/langs/pl_PL/errors.lang @@ -40,7 +40,7 @@ ErrorNoMailDefinedForThisUser=Nie określono mail do tego użytkownika ErrorFeatureNeedJavascript=Ta funkcja JavaScript trzeba być aktywowany do pracy. Zmień to w konfiguracji - wyświetlacz. ErrorTopMenuMustHaveAParentWithId0=Menu typu "góry" nie może mieć dominującej menu. Umieść 0 dominującej w menu lub wybrać z menu typu "Lewy". ErrorLeftMenuMustHaveAParentId=Menu typu "Lewy" musi mieć identyfikator rodzica. -ErrorGenbarCodeNotfound=Nie znaleziono pliku (Złe drogi, złe uprawnienia lub odmowa dostępu przez openbasedir parametr) +ErrorFileNotFound=Nie znaleziono pliku (Złe drogi, złe uprawnienia lub odmowa dostępu przez openbasedir parametr) ErrorFunctionNotAvailableInPHP=<b>Funkcja% s</b> jest wymagane dla tej funkcji, ale nie jest dostępny w tej wersji / konfiguracji PHP. ErrorDirAlreadyExists=A katalog o takiej nazwie już istnieje. ErrorFieldCanNotContainSpecialCharacters=<b>Pole% s</b> nie zawiera znaki specjalne. diff --git a/htdocs/langs/pt_BR/errors.lang b/htdocs/langs/pt_BR/errors.lang index 147d9977c7e..305f11f8788 100644 --- a/htdocs/langs/pt_BR/errors.lang +++ b/htdocs/langs/pt_BR/errors.lang @@ -32,7 +32,7 @@ ErrorNoMailDefinedForThisUser=E-Mail não definido para este usuário ErrorFeatureNeedJavascript=Esta Funcionalidade precisa de javascript ativo para funcionar. Modifique em configuração->entorno. ErrorTopMenuMustHaveAParentWithId0=um menu do tipo 'Superior' não pode ter um menu pai. Coloque 0 ao ID pai o busque um menu do tipo 'esquerdo' ErrorLeftMenuMustHaveAParentId=um menu do tipo 'esquerdo' deve de ter um ID de pai -ErrorGenbarCodeNotfound=Arquivo não encontrado (Rota incorreta, permissões incorretos o acesso prohibido por o parâmetro openbasedir) +ErrorFileNotFound=Arquivo não encontrado (Rota incorreta, permissões incorretos o acesso prohibido por o parâmetro openbasedir) ErrorFunctionNotAvailableInPHP=a função <b>%s</b> é requerida por esta Funcionalidade, mas não se encuetra disponível nesta Versão/Instalação de PHP. ErrorDirAlreadyExists=já existe uma pasta com ese Nome. ErrorFieldCanNotContainSpecialCharacters=o campo <b>%s</b> não deve contener caracter0es especiais diff --git a/htdocs/langs/pt_PT/errors.lang b/htdocs/langs/pt_PT/errors.lang index 1e3155c1fc7..f22c27d234f 100644 --- a/htdocs/langs/pt_PT/errors.lang +++ b/htdocs/langs/pt_PT/errors.lang @@ -31,7 +31,7 @@ ErrorNoMailDefinedForThisUser=E-Mail não definido para este utilizador ErrorFeatureNeedJavascript=Esta Funcionalidade precisa de javascript activo para funcionar. Modifique em configuração->entorno. ErrorTopMenuMustHaveAParentWithId0=um menu do tipo 'Superior' não pode ter um menu pai. Coloque 0 ao ID pai o busque um menu do tipo 'esquerdo' ErrorLeftMenuMustHaveAParentId=um menu do tipo 'esquerdo' deve de ter um ID de pai -ErrorGenbarCodeNotfound=Ficheiro não encontrado (Rota incorrecta, permissões incorrectos o acesso prohibido por o parâmetro openbasedir) +ErrorFileNotFound=Ficheiro não encontrado (Rota incorrecta, permissões incorrectos o acesso prohibido por o parâmetro openbasedir) ErrorFunctionNotAvailableInPHP=a função <b>%s</b> é requerida por esta Funcionalidade, mas não se encuetra disponivel em esta Versão/Instalação de PHP. ErrorDirAlreadyExists=já existe uma pasta com ese Nome. ErrorFieldCanNotContainSpecialCharacters=o campo <b>%s</b> não deve contener carácteres especiais diff --git a/htdocs/langs/ro_RO/errors.lang b/htdocs/langs/ro_RO/errors.lang index 4d9cd3b179c..3c7501bb7b9 100644 --- a/htdocs/langs/ro_RO/errors.lang +++ b/htdocs/langs/ro_RO/errors.lang @@ -38,7 +38,7 @@ ErrorNoMailDefinedForThisUser=Nu mail definite pentru acest utilizator ErrorFeatureNeedJavascript=Această caracteristică JavaScript trebuie activat pentru a fi la locul de muncă. Schimbare în acest setup - display. ErrorTopMenuMustHaveAParentWithId0=Un meniu de tip "Top" nu poate avea un părinte de meniu. Pune-0 în meniul părinte sau alege un meniu de tip "stânga". ErrorLeftMenuMustHaveAParentId=Un meniu de tip "stânga" trebuie să aibă o mamă id. -ErrorGenbarCodeNotfound=Fişierul nu a fost găsit (Bad calea, greşit permisiunile de acces refuzat sau de openbasedir parametru) +ErrorFileNotFound=Fişierul nu a fost găsit (Bad calea, greşit permisiunile de acces refuzat sau de openbasedir parametru) ErrorFunctionNotAvailableInPHP=<b>Funcţia% s</b> este necesar pentru această funcţie, dar nu este disponibil în această versiune / setup de PHP. ErrorDirAlreadyExists=Un director cu acest nume există deja. ErrorFieldCanNotContainSpecialCharacters=<b>Câmp% s</b> trebuie să nu conţine caractere speciale. diff --git a/htdocs/langs/ru_RU/errors.lang b/htdocs/langs/ru_RU/errors.lang index 05fbec2c91f..24cf853ecf4 100644 --- a/htdocs/langs/ru_RU/errors.lang +++ b/htdocs/langs/ru_RU/errors.lang @@ -38,7 +38,7 @@ ErrorNoMailDefinedForThisUser=Нет почты определить для эт ErrorFeatureNeedJavascript=Эта функция JavaScript должны быть активированы на работу. Изменить это в настройки - дисплей. ErrorTopMenuMustHaveAParentWithId0=Меню типа 'Top' не может быть родителем меню. Положить 0 родителей в меню или выбрать меню типа 'левых'. ErrorLeftMenuMustHaveAParentId=Меню типа 'левых' должен иметь родителя ID. -ErrorGenbarCodeNotfound=Файл не найден (Неверный путь, неправильное или разрешения доступа отказано openbasedir параметр) +ErrorFileNotFound=Файл не найден (Неверный путь, неправильное или разрешения доступа отказано openbasedir параметр) ErrorFunctionNotAvailableInPHP=<b>Функция% S</b> необходим для этой функции, но не доступен в этой версии / настройки PHP. ErrorDirAlreadyExists=Каталог с таким именем уже существует. ErrorFieldCanNotContainSpecialCharacters=<b>Поле% S</b> не содержит специальных символов. diff --git a/htdocs/lib/dolgeoip.class.php b/htdocs/lib/dolgeoip.class.php index 64f9cba797e..5b27bd0a9e0 100644 --- a/htdocs/lib/dolgeoip.class.php +++ b/htdocs/lib/dolgeoip.class.php @@ -71,7 +71,8 @@ class DolGeoIP } /** - * Return in lower cas the country code + * Return in lower case the country code from an ip + * * @param $ip IP to scan * @return string Country code (two letters) */ @@ -84,19 +85,35 @@ class DolGeoIP return strtolower(geoip_country_code_by_addr($this->gi, $ip)); } - function getCountryCodeFromName($ip) + /** + * Return in lower case the country code from a host name + * + * @param $name FQN of host (example: myserver.xyz.com) + * @return string Country code (two letters) + */ + function getCountryCodeFromName($name) { if (empty($this->gi)) { return ''; } - return geoip_country_code_by_name($this->gi, $ip); + return geoip_country_code_by_name($this->gi, $name); + } + + /** + * Return verion of data file + */ + function getVersion() + { + return ''; } + /** + * Close geoip object + */ function close() { geoip_close($this->gi); } - } ?> diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 11f3ccc581a..7e495054b0d 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -860,12 +860,21 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ= return $newphone; } -function dol_print_ip($ip) +/** + * \brief Return an IP formated to be shown on screen + * \param ip IP + * \param mode 1=return only country/flag,2=return only IP + * \return string Formated IP, with country if GeoIP module is enabled + */ +function dol_print_ip($ip,$mode=0) { global $conf,$langs; - print $ip; - if (! empty($conf->geoipmaxmind->enabled)) + $ret=''; + + if (empty($mode)) $ret.=$ip; + + if (! empty($conf->geoipmaxmind->enabled) && $mode != 2) { $datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE; //$ip='24.24.24.24'; @@ -878,11 +887,13 @@ function dol_print_ip($ip) { if (file_exists(DOL_DOCUMENT_ROOT.'/theme/common/flags/'.$countrycode.'.png')) { - print ' '.img_picto($langs->trans("AccordingToGeoIPDatabase"),DOL_URL_ROOT.'/theme/common/flags/'.$countrycode.'.png','',1); + $ret.=' '.img_picto($countrycode.' '.$langs->trans("AccordingToGeoIPDatabase"),DOL_URL_ROOT.'/theme/common/flags/'.$countrycode.'.png','',1); } - else print ' ('.$countrycode.')'; + else $ret.=' ('.$countrycode.')'; } } + + return $ret; } /** -- GitLab