From ac9ede48dee2a4243fffdef4c9191b39c662c0e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Sat, 5 Mar 2011 17:38:28 +0000 Subject: [PATCH] Work on SMS features --- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + htdocs/lib/functions.lib.php | 49 ++++++++++++++++++++++------------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9796c29d3d4..e6ab70df4fb 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -816,6 +816,7 @@ TranslationUncomplete=Partial translation SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix <b>.lang</b> text files into directory <b>htdocs/langs</b> and submit them on the forum at <a href="http://www.dolibarr.org/forum" target="_blank">http://www.dolibarr.org</a>. MenuUseLayout=Make vertical menu hidable (option javascript must not be disabled) MAIN_DISABLE_METEO=Disable meteo view +TestLoginToAPI=Test login to API ##### Module password generation PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 09a5fc491d9..ee9fadfed7f 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -826,6 +826,7 @@ TranslationUncomplete=Traduction partielle SomeTranslationAreUncomplete=Certaines langues sont traduites partiellement ou peuvent contenir des erreurs. Si vous en détectez, vous pouvez corriger les fichiers textes <b>.lang</b> du répertoire <b>htdocs/langs</b> et les soumettre sur le forum à <a href="http://www.dolibarr.fr/forum" target="_blank">http://www.dolibarr.fr</a>. MenuUseLayout=Rendre le menu gauche cachable (L'option javascript ne doit pas avoir été désactivée) MAIN_DISABLE_METEO=Désactiver la vue météo +TestLoginToAPI=Tester connexion à l'API ##### Module password generation= undefined PasswordGenerationStandard= Renvoie un mot de passe généré selon algorithme interne Dolibarr: 8 caractères, chiffres et caractères en minuscules mélangés. diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index c1d6495a5c8..97c5322baf2 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -94,12 +94,12 @@ function dol_include_once($relpath) /** * Return path of url or filesystem. Return default_root or alternate root if file_exist fails. * @param path Relative path to file (if mode=0, ie: mydir/myfile, ../myfile, ...) or relative url (if mode=1). - * @param mode 0=Used for a Filesystem path, 1=Used for an URL path + * @param type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path) * @return string Full filsystem path (if mode=0), Full url path (if mode=1) */ -function dol_buildpath($path,$mode=0) +function dol_buildpath($path,$type=0) { - if (empty($mode)) // For a filesystem path + if (empty($type)) // For a filesystem path { $res = DOL_DOCUMENT_ROOT.$path; // Standard value if (defined('DOL_DOCUMENT_ROOT_ALT') && DOL_DOCUMENT_ROOT_ALT) // We check only if alternate feature is used @@ -109,21 +109,34 @@ function dol_buildpath($path,$mode=0) } else // For an url path { - $res = DOL_URL_ROOT.$path; // Standard value - if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used - { - // We try to get local path of file on filesystem from url - // FIXME Trying to know if a file on disk exist by forging path on disk from url - // works only for some web server and some setup. This is bugged when - // using proxy, rewriting, virtual path, etc... - preg_match('/^([^.]+(\.css)?(\.php)?(\.js)?)/i',$path,$regs); - if (! empty($regs[1])) $filepath = $regs[1]; - // An alternative for proxy but extremely slow - //$url = 'http://'.$_SERVER["SERVER_NAME"].DOL_URL_ROOT.$path; - //if (! @file_get_contents($url)) $res = DOL_URL_ROOT_ALT.$path; - //if (! @fopen($url, 'r')) $res = DOL_URL_ROOT_ALT.$path; - if (! file_exists(DOL_DOCUMENT_ROOT.$filepath)) $res = DOL_URL_ROOT_ALT.$path; - } + // We try to get local path of file on filesystem from url + // Note that trying to know if a file on disk exist by forging path on disk from url + // works only for some web server and some setup. This is bugged when + // using proxy, rewriting, virtual path, etc... + if ($type == 1) + { + $res = DOL_URL_ROOT.$path; // Standard value + if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used + { + preg_match('/^([^.]+(\.css)?(\.php)?(\.js)?)/i',$path,$regs); // Take part before '?' + if (! empty($regs[1])) + { + if (! file_exists(DOL_DOCUMENT_ROOT.$regs[1])) $res = DOL_URL_ROOT_ALT.$path; + } + } + } + if ($type == 2) + { + $res = DOL_MAIN_URL_ROOT.$path; // Standard value + if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used + { + preg_match('/^([^.]+(\.css)?(\.php)?(\.js)?)/i',$path,$regs); // Take part before '?' + if (! empty($regs[1])) + { + if (! file_exists(DOL_DOCUMENT_ROOT.$regs[1])) $res = DOL_MAIN_URL_ROOT_ALT.$path; + } + } + } } return $res; -- GitLab