Merge pull request #9509 from grandoc/new_branch_14_09_2018

Standardize and update code
This commit is contained in:
Laurent Destailleur 2018-09-15 17:30:14 +02:00 committed by GitHub
commit 69dcdcbe75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 55 additions and 45 deletions

View File

@ -727,8 +727,8 @@ class FormTicket
{
global $conf, $langs, $user, $mysoc;
$langs->load("other");
$langs->load("mails");
// Load translation files required by the page
$langs->loadLangs(array('other', 'mails'));
$addfileaction = 'addfile';

View File

@ -1141,8 +1141,8 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
global $db, $conf, $user, $langs;
global $hookmanager;
$langs->load("other");
$langs->load("errors");
// Load translation files required by the page
$langs->loadLangs(array('other', 'errors'));
dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook);

View File

@ -3865,8 +3865,8 @@ function dol_print_error($db='',$error='',$errors=null)
$langs = new Translate('', $conf);
$langs->load("main");
}
$langs->load("main");
$langs->load("errors");
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{

View File

@ -105,9 +105,9 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
{
dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
sleep(1);
$langs->load('main');
$langs->load('other');
$langs->load('errors');
// Load translation files required by the page
$langs->loadLangs(array('other', 'main', 'errors'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
}
}

View File

@ -111,8 +111,10 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
{
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."'");
sleep(2); // Anti brut force protection
$langs->load('main');
$langs->load('errors');
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
}
@ -137,8 +139,10 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
{
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko user not found for '".$usertotest."'");
sleep(1);
$langs->load('main');
$langs->load('errors');
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
}
}

View File

@ -54,8 +54,10 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
{
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP. LDAP functions are disabled on this PHP");
sleep(1);
$langs->load('main');
$langs->load('other');
// Load translation files required by the page
$langs->loadLangs(array('main', 'other'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->trans("TryAnotherConnectionMode");
return;
}
@ -207,8 +209,10 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
{
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko bad user/password for '".$usertotest."'");
sleep(1);
$langs->load('main');
$langs->load('other');
// Load translation files required by the page
$langs->loadLangs(array('main', 'other'));
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
}
}
@ -230,9 +234,10 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);
}
sleep(2); // Anti brut force protection
$langs->load('main');
$langs->load('other');
$langs->load('errors');
// Load translation files required by the page
$langs->loadLangs(array('main', 'other', 'errors'));
;
$_SESSION["dol_loginmesg"]=($ldap->error?$ldap->error:$langs->trans("ErrorBadLoginPassword"));
}

View File

@ -565,8 +565,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', '<i class="fa fa-server fa-fw paddingright"></i>');
if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/',$leftmenu))
{
$langs->load("admin");
$langs->load("help");
// Load translation files required by the page
$langs->loadLangs(array('admin', 'help'));
$newmenu->add('/admin/system/dolibarr.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1);
if ($usemenuhider || empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Modules'), 2);

View File

@ -37,10 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_contract_odt extends ModelePDFContract
{
var $emetteur; // Objet societe qui emet
public $emetteur; // Objet societe qui emet
var $phpmin = array(5,2,0); // Minimum version of PHP required by module
var $version = 'dolibarr';
public $phpmin = array(5,4,0); // Minimum version of PHP required by module
public $version = 'dolibarr';
/**
@ -97,8 +97,8 @@ class doc_generic_contract_odt extends ModelePDFContract
{
global $conf,$langs;
$langs->load("companies");
$langs->load("errors");
// Load translation files required by the page
$langs->loadLangs(array('companies', 'errors'));
$form = new Form($this->db);

View File

@ -38,10 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_invoice_odt extends ModelePDFFactures
{
var $emetteur; // Objet societe qui emet
public $emetteur; // Objet societe qui emet
var $phpmin = array(5,2,0); // Minimum version of PHP required by module
var $version = 'dolibarr';
public $phpmin = array(5,4,0); // Minimum version of PHP required by module
public $version = 'dolibarr';
/**
@ -53,8 +53,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
{
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("companies");
// Load translation files required by the page
$langs->loadLangs(array("main","companies"));
$this->db = $db;
$this->name = "ODT/ODS templates";

View File

@ -237,8 +237,9 @@ class mailing_fraise extends MailingTargets
}
global $langs,$_POST;
$langs->load("members");
$langs->load("companies");
// Load translation files required by the page
$langs->loadLangs(array("members","companies"));
$cibles = array();
$now=dol_now();

View File

@ -96,8 +96,8 @@ class doc_generic_stock_odt extends ModelePDFStock
{
global $conf,$langs;
$langs->load("companies");
$langs->load("errors");
// Load translation files required by the page
$langs->loadLangs(array("errors","companies"));
$form = new Form($this->db);

View File

@ -46,8 +46,8 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
{
global $conf,$langs;
$langs->load("bills");
$langs->load("admin");
// Load translation files required by the page
$langs->loadLangs(array("bills","admin"));
$form = new Form($this->db);

View File

@ -37,10 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/
class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
{
var $emetteur; // Objet societe qui emet
public $emetteur; // Objet societe qui emet
var $phpmin = array(5,2,0); // Minimum version of PHP required by module
var $version = 'dolibarr';
public $phpmin = array(5,4,0); // Minimum version of PHP required by module
public $version = 'dolibarr';
/**
@ -52,8 +52,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
{
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("companies");
// Load translation files required by the page
$langs->loadLangs(array("main","companies"));
$this->db = $db;
$this->name = "ODT templates";

View File

@ -43,8 +43,8 @@ class mod_ticket_universal extends ModeleNumRefTicket
{
global $conf, $langs;
$langs->load("ticket");
$langs->load("admin");
// Load translation files required by the page
$langs->loadLangs(array("ticket","admin"));
$form = new Form($this->db);