diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index fb7b4348cd9..33e203aa81f 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -33,10 +33,10 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.commande.class.php'); if ($conf->tax->enabled) require_once(DOL_DOCUMENT_ROOT.'/chargesociales.class.php'); -// L'espace compta/tréso doit toujours etre actif car c'est un espace partagé -// par de nombreux modules (banque, facture, commande à facturer, etc...) indépendemment +// L'espace compta/tr�so doit toujours etre actif car c'est un espace partag� +// par de nombreux modules (banque, facture, commande � facturer, etc...) ind�pendemment // de l'utilisation de la compta ou non. C'est au sein de cet espace que chaque sous fonction -// est protégé par le droit qui va bien du module concerné. +// est prot�g� par le droit qui va bien du module concern�. //if (!$user->rights->compta->general->lire) // accessforbidden(); @@ -653,7 +653,7 @@ if ($conf->tax->enabled && $user->rights->tax->charges->lire) } /* - * Commandes clients à facturer + * Commandes clients � facturer */ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->commande->lire) { @@ -752,7 +752,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman } /* - * Factures clients impayées + * Factures clients impay�es */ if ($conf->facture->enabled && $user->rights->facture->lire) { @@ -851,7 +851,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) } /* - * Factures fournisseurs impayées + * Factures fournisseurs impay�es */ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) { diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 31d05541dbd..dac87b6ec9d 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -1,179 +1,194 @@ - + diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index b484bd616b8..73b91665c2b 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -1684,12 +1684,13 @@ function dolibarr_print_error($db='',$error='') * On doit appeler cette fonction quand une erreur technique bloquante est rencontree. * Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant * renvoyer leur erreur par l'intermediaire de leur propriete "error". - * \param db Database handler - * \param error Chaine erreur ou tableau de chaines erreur complementaires a afficher + * \param db Database handler + * \param error Chaine erreur ou tableau de chaines erreur complementaires a afficher */ function dol_print_error($db='',$error='') { global $conf,$langs,$argv; + $out = ''; $syslog = ''; // Si erreur intervenue avant chargement langue @@ -1699,28 +1700,29 @@ function dol_print_error($db='',$error='') $langs = new Translate("", $conf); $langs->load("main"); } + $langs->load("errors"); if ($_SERVER['DOCUMENT_ROOT']) // Mode web { - print $langs->trans("DolibarrHasDetectedError").".
\n"; + $out.=$langs->trans("DolibarrHasDetectedError").".
\n"; if (! empty($conf->global->MAIN_FEATURES_LEVEL)) - print "You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.
\n"; - print $langs->trans("InformationToHelpDiagnose").":
\n"; + $out.="You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.
\n"; + $out.=$langs->trans("InformationToHelpDiagnose").":
\n"; - print "".$langs->trans("Dolibarr").": ".DOL_VERSION."
\n";; - print "".$langs->trans("Date").": ".dol_print_date(time(),'dayhourlog')."
\n";; - if (isset($conf->global->MAIN_FEATURES_LEVEL)) print "".$langs->trans("LevelOfFeature").": ".$conf->global->MAIN_FEATURES_LEVEL."
\n";; - print "".$langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."
\n";; - print "".$langs->trans("Referer").": ".$_SERVER["HTTP_REFERER"]."
\n";; - print "".$langs->trans("RequestedUrl").": ".$_SERVER["REQUEST_URI"]."
\n";; - print "".$langs->trans("MenuManager").": ".$conf->left_menu.'/'.$conf->top_menu."
\n"; - print "
\n"; + $out.="".$langs->trans("Dolibarr").": ".DOL_VERSION."
\n";; + $out.="".$langs->trans("Date").": ".dol_print_date(time(),'dayhourlog')."
\n";; + if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out.="".$langs->trans("LevelOfFeature").": ".$conf->global->MAIN_FEATURES_LEVEL."
\n";; + $out.="".$langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."
\n";; + $out.="".$langs->trans("Referer").": ".$_SERVER["HTTP_REFERER"]."
\n";; + $out.="".$langs->trans("RequestedUrl").": ".$_SERVER["REQUEST_URI"]."
\n";; + $out.="".$langs->trans("MenuManager").": ".$conf->left_menu.'/'.$conf->top_menu."
\n"; + $out.="
\n"; $syslog.="url=".$_SERVER["REQUEST_URI"]; $syslog.=", query_string=".$_SERVER["QUERY_STRING"]; } else // Mode CLI { - print '> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n"; + $out.='> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n"; $syslog.="pid=".getmypid(); } @@ -1728,18 +1730,18 @@ function dol_print_error($db='',$error='') { if ($_SERVER['DOCUMENT_ROOT']) // Mode web { - print "".$langs->trans("DatabaseTypeManager").": ".$db->type."
\n"; - print "".$langs->trans("RequestLastAccessInError").": ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."
\n"; - print "".$langs->trans("ReturnCodeLastAccessInError").": ".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."
\n"; - print "".$langs->trans("InformationLastAccessInError").": ".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."
\n"; - print "
\n"; + $out.="".$langs->trans("DatabaseTypeManager").": ".$db->type."
\n"; + $out.="".$langs->trans("RequestLastAccessInError").": ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."
\n"; + $out.="".$langs->trans("ReturnCodeLastAccessInError").": ".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."
\n"; + $out.="".$langs->trans("InformationLastAccessInError").": ".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."
\n"; + $out.="
\n"; } else // Mode CLI { - print '> '.$langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n"; - print '> '.$langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n"; - print '> '.$langs->transnoentities("ReturnCodeLastAccessInError").":\n".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."\n"; - print '> '.$langs->transnoentities("InformationLastAccessInError").":\n".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."\n"; + $out.='> '.$langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n"; + $out.='> '.$langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n"; + $out.='> '.$langs->transnoentities("ReturnCodeLastAccessInError").":\n".($db->lasterrno()?$db->lasterrno():$langs->trans("ErrorNoRequestInError"))."\n"; + $out.='> '.$langs->transnoentities("InformationLastAccessInError").":\n".($db->lasterror()?$db->lasterror():$langs->trans("ErrorNoRequestInError"))."\n"; } $syslog.=", sql=".$db->lastquery(); @@ -1758,23 +1760,26 @@ function dol_print_error($db='',$error='') $msg=$langs->trans($msg); if ($_SERVER['DOCUMENT_ROOT']) // Mode web { - print "".$langs->trans("Message").": ".$msg."
\n" ; + $out.="".$langs->trans("Message").": ".$msg."
\n" ; } else // Mode CLI { - print '> '.$langs->transnoentities("Message").":\n".$msg."\n" ; + $out.='> '.$langs->transnoentities("Message").":\n".$msg."\n" ; } $syslog.=", msg=".$msg; } } if ($_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_call_file')) { - print 'XDebug informations:'."
\n"; - print 'File: '.xdebug_call_file()."
\n"; - print 'Line: '.xdebug_call_line()."
\n"; - print "
\n"; + $out.='XDebug informations:'."
\n"; + $out.='File: '.xdebug_call_file()."
\n"; + $out.='Line: '.xdebug_call_line()."
\n"; + $out.="
\n"; } + global $dolibarr_main_prod; + if (empty($dolibarr_main_prod)) print $out; + else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported on browsers. Please read the log file for error message.'; dol_syslog("Error ".$syslog, LOG_ERR); } diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 19a1fe14ff7..95c2e0a4ef9 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -126,9 +126,11 @@ function dol_loginfunction($langs,$conf,$mysoc) $demologin=''; $demopassword=''; - if (! empty($conf->global->MAIN_DEMO)) + + global $dolibarr_main_demo; + if (! empty($dolibarr_main_demo)) { - $tab=split(',',$conf->global->MAIN_DEMO); + $tab=split(',',$dolibarr_main_demo); $demologin=$tab[0]; $demopassword=$tab[1]; } diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index e6812600ee1..9c6ed7f2ec7 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -34,7 +34,8 @@ $langs->load("main"); $langs->load("other"); // Security check -if (empty($conf->global->MAIN_DEMO)) accessforbidden('Constant MAIN_DEMO must be defined in Home->Setup->Misc with value "default login,default pass" to enable the demo entry page',1,1,1); +global $dolibarr_main_demo; +if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',1,1,1); $demoprofiles=array( diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 60ae8eb8336..514b3553a1a 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -166,7 +166,7 @@ if ($_GET["action"] == 'edit') print ''.$langs->trans("Language").''; print ''.($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$conf->global->MAIN_LANG_DEFAULT).''; print 'conf->MAIN_LANG_DEFAULT?" checked":""); - print ! empty($conf->global->MAIN_DEMO)?' disabled="true"':''; // Disabled for demo + print ! empty($dolibarr_main_demo)?' disabled="true"':''; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; $html=new Form($db); @@ -178,7 +178,7 @@ if ($_GET["action"] == 'edit') print ''.$langs->trans("MaxSizeList").''; print ''.$conf->global->MAIN_SIZE_LISTE_LIMIT.''; print 'conf->MAIN_SIZE_LISTE_LIMIT?" checked":""); - print ! empty($conf->global->MAIN_DEMO)?' disabled="true"':''; // Disabled for demo + print ! empty($dolibarr_main_demo)?' disabled="true"':''; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; @@ -186,7 +186,7 @@ if ($_GET["action"] == 'edit') // Theme - show_theme($fuser,$conf->global->MAIN_DEMO?0:1,true); + show_theme($fuser,empty($dolibarr_main_demo)?1:0,true); print ''; @@ -226,7 +226,7 @@ else print ''; print '
'; - if ($conf->global->MAIN_DEMO) + if (! empty($dolibarr_main_demo)) { print "trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify").""; }