From 18f4755a90c67beb421fe6032d75e6a6e86068de Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 14 Sep 2018 10:20:21 +0200 Subject: [PATCH] Standardize and update code --- htdocs/core/class/html.formticket.class.php | 4 ++-- htdocs/core/lib/files.lib.php | 4 ++-- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/core/lib/security2.lib.php | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 5cad99b2a9f..7ed11bb81e8 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -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'; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 432c857850b..4df32ca4a35 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a73a107c0dc..e648a89f6ed 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 { diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 8c8bb3cbb10..c9f4ece6445 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -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); } }