lang: english comments only

This commit is contained in:
r2gnl 2010-02-19 13:50:49 +00:00
parent 11a418029e
commit a1874eb10a

View File

@ -30,7 +30,7 @@
*/ */
// For optionnal tuning. Enabled if environment variable DOL_TUNING is defined. // For optionnal tuning. Enabled if environment variable DOL_TUNING is defined.
// A appeler avant tout. Fait l'equivalent de la fonction dol_microtime_float pas encore chargee. // A call first. Is the equivalent function dol_microtime_float not yet loaded.
$micro_start_time=0; $micro_start_time=0;
if (! empty($_SERVER['DOL_TUNING'])) if (! empty($_SERVER['DOL_TUNING']))
{ {
@ -41,11 +41,10 @@ if (! empty($_SERVER['DOL_TUNING']))
if (defined('XDEBUGCOVERAGE')) { xdebug_start_code_coverage(); } if (defined('XDEBUGCOVERAGE')) { xdebug_start_code_coverage(); }
} }
// Forcing parameter setting magic_quotes_gpc and cleaning parameters
// Forcage du parametrage PHP magic_quotes_gpc et nettoyage des parametres // (Otherwise he would have for each position, condition
// (Sinon il faudrait a chaque POST, conditionner // Reading stripslashes variable according to state get_magic_quotes_gpc).
// la lecture de variable par stripslashes selon etat de get_magic_quotes). // Off mode (recommended, you just do addslashes when an insert / update.
// En mode off (recommande, il faut juste faire addslashes au moment d'un insert/update.
function stripslashes_deep($value) function stripslashes_deep($value)
{ {
return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value)); return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value));
@ -195,7 +194,7 @@ if ((! empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_V
} }
} }
// Creation d'un jeton contre les failles CSRF // Creation of a token against CSRF vulnerabilities
if (! defined('NOTOKENRENEWAL')) if (! defined('NOTOKENRENEWAL'))
{ {
$token = md5(uniqid(mt_rand(),TRUE)); // Genere un hash d'un nombre aleatoire $token = md5(uniqid(mt_rand(),TRUE)); // Genere un hash d'un nombre aleatoire
@ -255,7 +254,7 @@ if (sizeof($conf->need_smarty) > 0 || $conf->global->MAIN_SMARTY)
$login=''; $login='';
if (! defined('NOLOGIN')) if (! defined('NOLOGIN'))
{ {
// $authmode contient la liste des differents modes d'identification a tester par ordre de preference. // $authmode lists the different means of identification to be tested in order of preference.
// Example: 'http' // Example: 'http'
// Example: 'dolibarr' // Example: 'dolibarr'
// Example: 'ldap' // Example: 'ldap'
@ -277,22 +276,22 @@ if (! defined('NOLOGIN'))
exit; exit;
} }
// Si la demande du login a deja eu lieu, on le recupere depuis la session // If requested by the login has already occurred, it is retrieved from the session
// sinon appel du module qui realise sa demande. // Call module if not realized that his request.
// A l'issu de cette phase, la variable $login sera definie. // At the end of this phase, the variable $login is defined.
$resultFetchUser=''; $resultFetchUser='';
$test=true; $test=true;
if (! isset($_SESSION["dol_login"])) if (! isset($_SESSION["dol_login"]))
{ {
// On est pas deja authentifie, on demande le login/mot de passe // It is not already authenticated, it requests the login / password
// Verification du code securite graphique // Verification security graphic code
if ($test && isset($_POST["username"]) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) if ($test && isset($_POST["username"]) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{ {
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php'; require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
require_once ARTICHOW."/AntiSpam.class.php"; require_once ARTICHOW."/AntiSpam.class.php";
// On cree l'objet anti-spam // It creates an anti-spam object
$object = new AntiSpam(); $object = new AntiSpam();
// Verifie code // Verifie code
@ -315,9 +314,9 @@ if (! defined('NOLOGIN'))
} }
} }
// Tests de validation user/mot de passe // Validation tests user / password
// Si ok, la variable login sera initialisee // If ok, the variable will be initialized login
// Si erreur, on a placera message erreur dans session sous le nom dol_loginmesg // If error, we will put error message in session under the name dol_loginmesg $goontestloop=false;
$goontestloop=false; $goontestloop=false;
if (isset($_SERVER["REMOTE_USER"]) && in_array('http',$authmode)) $goontestloop=true; if (isset($_SERVER["REMOTE_USER"]) && in_array('http',$authmode)) $goontestloop=true;
if (isset($_POST["username"])) $goontestloop=true; if (isset($_POST["username"])) $goontestloop=true;
@ -373,7 +372,7 @@ if (! defined('NOLOGIN'))
} }
} }
// Fin des tests de login/passwords // End test login / passwords
if (! $login) if (! $login)
{ {
// We show login page // We show login page
@ -404,12 +403,12 @@ if (! defined('NOLOGIN'))
$_SESSION["dol_loginmesg"]=$user->error; $_SESSION["dol_loginmesg"]=$user->error;
} }
// Appel des triggers // Call triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,$_POST["entity"]); $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,$_POST["entity"]);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// Fin appel triggers // End call triggers
header('Location: '.DOL_URL_ROOT.'/index.php'); header('Location: '.DOL_URL_ROOT.'/index.php');
exit; exit;
@ -417,8 +416,8 @@ if (! defined('NOLOGIN'))
} }
else else
{ {
// On est deja en session qui a sauvegarde login // It is already in a backup session login
// Remarks: On ne sauvegarde pas objet user car pose pb dans certains cas mal identifies // Remarks: We do not save user object poses for bp in some cases misidentified
$login=$_SESSION["dol_login"]; $login=$_SESSION["dol_login"];
$resultFetchUser=$user->fetch($login); $resultFetchUser=$user->fetch($login);
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login); dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
@ -445,12 +444,12 @@ if (! defined('NOLOGIN'))
$_SESSION["dol_loginmesg"]=$user->error; $_SESSION["dol_loginmesg"]=$user->error;
} }
// Appel des triggers // Call triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,(isset($_POST["entity"])?$_POST["entity"]:0)); $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,(isset($_POST["entity"])?$_POST["entity"]:0));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// Fin appel triggers // End call triggers
header('Location: '.DOL_URL_ROOT.'/index.php'); header('Location: '.DOL_URL_ROOT.'/index.php');
exit; exit;
@ -473,12 +472,12 @@ if (! defined('NOLOGIN'))
$user->update_last_login_date(); $user->update_last_login_date();
// Appel des triggers // Call triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGIN',$user,$user,$langs,$conf,$_POST["entity"]); $result=$interface->run_triggers('USER_LOGIN',$user,$user,$langs,$conf,$_POST["entity"]);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// Fin appel triggers // End call triggers
if ($error) if ($error)
{ {
@ -499,9 +498,9 @@ if (! defined('NOLOGIN'))
$entity = $_SESSION["dol_login"].'|'.$_POST["entity"]; $entity = $_SESSION["dol_login"].'|'.$_POST["entity"];
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); $entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
// TTL : sera defini dans la page de config multicompany // TTL : is defined in the config page multicompany
$ttl = (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE_TTL) ? $conf->global->MAIN_MULTICOMPANY_COOKIE_TTL : time()+60*60*8 ); $ttl = (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE_TTL) ? $conf->global->MAIN_MULTICOMPANY_COOKIE_TTL : time()+60*60*8 );
// Cryptkey : sera cree aleatoirement dans la page de config multicompany // Cryptkey : will be created randomly in the config page multicompany
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' ); $cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($cryptkey); $entityCookie = new DolCookie($cryptkey);
@ -513,13 +512,13 @@ if (! defined('NOLOGIN'))
{ {
$domain=''; $domain='';
// Creation du cookie permettant de sauver le login // Creation of a cookie to save login
$cookiename='webcalendar_login'; $cookiename='webcalendar_login';
if (! isset($_COOKIE[$cookiename])) if (! isset($_COOKIE[$cookiename]))
{ {
setcookie($cookiename, $user->webcal_login, 0, "/", $domain, 0); setcookie($cookiename, $user->webcal_login, 0, "/", $domain, 0);
} }
// Creation du cookie permettant de sauver la session // Creation of a cookie to save session
$cookiename='webcalendar_session'; $cookiename='webcalendar_session';
if (! isset($_COOKIE[$cookiename])) if (! isset($_COOKIE[$cookiename]))
{ {
@ -539,7 +538,7 @@ if (! defined('NOLOGIN'))
} }
// Si user admin, on force droits sur les modules base // If user admin, we force the rights-based modules
if ($user->admin) if ($user->admin)
{ {
$user->rights->user->user->lire=1; $user->rights->user->user->lire=1;
@ -580,7 +579,7 @@ if (! defined('NOLOGIN'))
if (empty($_GET["lang"])) // If language was not forced on URL if (empty($_GET["lang"])) // If language was not forced on URL
{ {
// If user has choosed its own language // If user has chosen its own language
if (! empty($user->conf->MAIN_LANG_DEFAULT)) if (! empty($user->conf->MAIN_LANG_DEFAULT))
{ {
// If different than current language // If different than current language
@ -597,7 +596,7 @@ else // If language was forced on URL
} }
// Cas de forcage du style depuis url // Case forcing style from url
if (! empty($_GET["theme"])) if (! empty($_GET["theme"]))
{ {
$conf->theme=$_GET["theme"]; $conf->theme=$_GET["theme"];
@ -607,14 +606,14 @@ if (! empty($_GET["theme"]))
//$conf->css.=".php"; //$conf->css.=".php";
// Define menu manager to use // Define menu manager to use
if (empty($user->societe_id)) // Si utilisateur interne ou non defini if (empty($user->societe_id)) // If internal user or not defined
{ {
$conf->top_menu=$conf->global->MAIN_MENU_BARRETOP; $conf->top_menu=$conf->global->MAIN_MENU_BARRETOP;
$conf->left_menu=$conf->global->MAIN_MENU_BARRELEFT; $conf->left_menu=$conf->global->MAIN_MENU_BARRELEFT;
// Pour compatibilite // Pour compatibilite
if ($conf->left_menu == 'eldy.php') $conf->left_menu='eldy_backoffice.php'; if ($conf->left_menu == 'eldy.php') $conf->left_menu='eldy_backoffice.php';
} }
else // Si utilisateur externe else // If external user
{ {
$conf->top_menu=$conf->global->MAIN_MENUFRONT_BARRETOP; $conf->top_menu=$conf->global->MAIN_MENUFRONT_BARRETOP;
$conf->left_menu=$conf->global->MAIN_MENUFRONT_BARRELEFT; $conf->left_menu=$conf->global->MAIN_MENUFRONT_BARRELEFT;
@ -623,14 +622,14 @@ else // Si utilisateur externe
if (! defined('NOLOGIN')) if (! defined('NOLOGIN'))
{ {
// Si le login n'a pu etre recupere, on est identifie avec un compte qui n'existe pas. // If the login is not recovered, it is identified with an account that does not exist.
// Tentative de hacking ? // Hacking attempt?
if (! $user->login) accessforbidden(); if (! $user->login) accessforbidden();
// Check if user is active // Check if user is active
if ($user->statut < 1) if ($user->statut < 1)
{ {
// Si non actif, on delogue le user // If not active, we refuse the user
$langs->load("other"); $langs->load("other");
dol_syslog ("Authentification ko as login is disabled"); dol_syslog ("Authentification ko as login is disabled");
accessforbidden($langs->trans("ErrorLoginDisabled")); accessforbidden($langs->trans("ErrorLoginDisabled"));
@ -648,7 +647,7 @@ dol_syslog("Access to ".$_SERVER["PHP_SELF"]);
// For backward compatibility // For backward compatibility
if (! defined('MAIN_INFO_SOCIETE_PAYS')) define('MAIN_INFO_SOCIETE_PAYS','1'); if (! defined('MAIN_INFO_SOCIETE_PAYS')) define('MAIN_INFO_SOCIETE_PAYS','1');
// On charge les fichiers lang principaux // It supports main lang files
$langs->load("main"); $langs->load("main");
$langs->load("dict"); $langs->load("dict");
@ -656,7 +655,7 @@ $langs->load("dict");
$bc[0]="class=\"impair\""; $bc[0]="class=\"impair\"";
$bc[1]="class=\"pair\""; $bc[1]="class=\"pair\"";
// Sert uniquement dans module telephonie // Used only in telephony module
$yesno[0]="no"; $yesno[0]="no";
$yesno[1]="yes"; $yesno[1]="yes";
@ -716,11 +715,11 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$conf->file->character_set_client."\">\n"; print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$conf->file->character_set_client."\">\n";
// Affiche meta // Displays meta
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots
print '<meta name="author" content="Dolibarr Development Team">'."\n"; print '<meta name="author" content="Dolibarr Development Team">'."\n";
// Affiche title // Displays title
$appli='Dolibarr'; $appli='Dolibarr';
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
@ -828,7 +827,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
/** /**
* \brief Show an HTML header + a BODY + The top menu bar * \brief Show an HTML header + a BODY + The top menu bar
* \param head lignes d'en-tete head * \param head lines in the HEAD
* \param title titre page web * \param title titre page web
* \param target target to add in menu links * \param target target to add in menu links
*/ */
@ -929,11 +928,11 @@ function top_menu($head, $title='', $target='')
/** /**
* \brief Show left menu bar * \brief Show left menu bar
* \param menu_array Tableau des entrees de menu * \param menu_array Table menu entries
* \param helppagename Name of wiki page for help ('' by default). * \param helppagename Name of wiki page for help ('' by default).
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
* For other external page: http://server/url * For other external page: http://server/url
* \param moresearchform Formulaire de recherche permanant supplementaire * \param moresearchform Search Form Permanent Supplemental
*/ */
function left_menu($menu_array, $helppagename='', $moresearchform='') function left_menu($menu_array, $helppagename='', $moresearchform='')
{ {
@ -1133,11 +1132,11 @@ function getHelpParamFor($helppagename,$langs)
/** /**
* \brief Show a search area * \brief Show a search area
* \param urlaction Url du post * \param urlaction Url post
* \param urlobject Url du lien sur titre de la zone de recherche * \param urlobject Url of the link under the search box
* \param title Titre de la zone de recherche * \param title Title search area
* \param htmlmodesearch 'search' * \param htmlmodesearch 'search'
* \param htmlinputname Nom du champ input du formulaire * \param htmlinputname Field Name input form
*/ */
function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$htmlinputname) function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$htmlinputname)
{ {