dolibarr 19.0.4
security2.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 * or see https://www.gnu.org/
18 */
19
35function dol_getwebuser($mode)
36{
37 $t = '?';
38 if ($mode == 'user') {
39 $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty
40 }
41 if ($mode == 'group') {
42 $t = getenv('APACHE_RUN_GROUP');
43 }
44 return $t;
45}
46
57function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context = '')
58{
59 global $conf, $langs;
60
61 // Check parameters
62 if ($entitytotest == '') {
63 $entitytotest = 1;
64 }
65
66 dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',', $authmode));
67 $login = '';
68
69 // Validation of login/pass/entity with standard modules
70 if (empty($login)) {
71 $test = true;
72 foreach ($authmode as $mode) {
73 if ($test && $mode && !$login) {
74 // Validation of login/pass/entity for mode $mode
75 $mode = trim($mode);
76 $authfile = 'functions_'.$mode.'.php';
77 $fullauthfile = '';
78
79 $dirlogin = array_merge(array("/core/login"), (array) $conf->modules_parts['login']);
80 foreach ($dirlogin as $reldir) {
81 $dir = dol_buildpath($reldir, 0);
82 $newdir = dol_osencode($dir);
83
84 // Check if file found (do not use dol_is_file to avoid loading files.lib.php)
85 $tmpnewauthfile = $newdir.(preg_match('/\/$/', $newdir) ? '' : '/').$authfile;
86 if (is_file($tmpnewauthfile)) {
87 $fullauthfile = $tmpnewauthfile;
88 }
89 }
90
91 $result = false;
92 if ($fullauthfile) {
93 $result = include_once $fullauthfile;
94 }
95 if ($fullauthfile && $result) {
96 // Call function to check user/password
97 $function = 'check_user_password_'.$mode;
98 $login = call_user_func($function, $usertotest, $passwordtotest, $entitytotest, $context);
99 if ($login && $login != '--bad-login-validity--') {
100 // Login is successfull with this method
101 $test = false; // To stop once at first login success
102 $conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used
103 /*$dol_tz = GETPOST('tz');
104 $dol_dst = GETPOST('dst');
105 $dol_screenwidth = GETPOST('screenwidth');
106 $dol_screenheight = GETPOST('screenheight');*/
107 }
108 } else {
109 dol_syslog("Authentication KO - failed to load file '".$authfile."'", LOG_ERR);
110 sleep(1);
111 // Load translation files required by the page
112 $langs->loadLangs(array('other', 'main', 'errors'));
113
114 $_SESSION["dol_loginmesg"] = (empty($_SESSION["dol_loginmesg"]) ? '' : $_SESSION["dol_loginmesg"].', ').$langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode);
115 }
116 }
117 }
118 }
119
120 return $login;
121}
122
123
124if (!function_exists('dol_loginfunction')) {
134 function dol_loginfunction($langs, $conf, $mysoc)
135 {
136 global $dolibarr_main_demo, $dolibarr_main_force_https;
137 global $db, $hookmanager;
138
139 $langs->loadLangs(array("main", "other", "help", "admin"));
140
141 // Instantiate hooks of thirdparty module only if not already define
142 $hookmanager->initHooks(array('mainloginpage'));
143
144 $main_authentication = $conf->file->main_authentication;
145
146 $session_name = session_name(); // Get current session name
147
148 $dol_url_root = DOL_URL_ROOT;
149
150 // Title
151 $appli = constant('DOL_APPLICATION_TITLE');
152 $title = $appli.' '.constant('DOL_VERSION');
153 if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
154 $title = $conf->global->MAIN_APPLICATION_TITLE;
155 }
156 $titletruedolibarrversion = constant('DOL_VERSION'); // $title used by login template after the @ to inform of true Dolibarr version
157
158 // Note: $conf->css looks like '/theme/eldy/style.css.php'
159 /*
160 $conf->css = "/theme/".(GETPOST('theme','aZ09')?GETPOST('theme','aZ09'):$conf->theme)."/style.css.php";
161 $themepath=dol_buildpath($conf->css,1);
162 if (!empty($conf->modules_parts['theme'])) // Using this feature slow down application
163 {
164 foreach($conf->modules_parts['theme'] as $reldir)
165 {
166 if (file_exists(dol_buildpath($reldir.$conf->css, 0)))
167 {
168 $themepath=dol_buildpath($reldir.$conf->css, 1);
169 break;
170 }
171 }
172 }
173 $conf_css = $themepath."?lang=".$langs->defaultlang;
174 */
175
176 // Select templates dir
177 if (!empty($conf->modules_parts['tpl'])) { // Using this feature slow down application
178 $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl/'));
179 foreach ($dirtpls as $reldir) {
180 $tmp = dol_buildpath($reldir.'login.tpl.php');
181 if (file_exists($tmp)) {
182 $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp);
183 break;
184 }
185 }
186 } else {
187 $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
188 }
189
190 // Set cookie for timeout management. We set it as a cookie so we will be able to use it to set timeout on next page before the session start
191 // and the conf file is loaded.
192 $prefix = dol_getprefix('');
193 $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
194
195 if (getDolGlobalString('MAIN_SESSION_TIMEOUT')) {
196 if (session_status() != PHP_SESSION_ACTIVE) {
197 if (PHP_VERSION_ID < 70300) {
198 session_set_cookie_params(0, '/', null, ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
199 } else {
200 // Only available for php >= 7.3
201 $sessioncookieparams = array(
202 'lifetime' => 0,
203 'path' => '/',
204 //'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains
205 'secure' => ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true),
206 'httponly' => true,
207 'samesite' => 'Lax' // None || Lax || Strict
208 );
209 session_set_cookie_params($sessioncookieparams);
210 }
211
212 setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, (empty($dolibarr_main_force_https) ? false : true), true);
213 }
214 }
215
216 if (GETPOST('urlfrom', 'alpha')) {
217 $_SESSION["urlfrom"] = GETPOST('urlfrom', 'alpha');
218 } else {
219 unset($_SESSION["urlfrom"]);
220 }
221
222 if (!GETPOST("username", 'alpha')) {
223 $focus_element = 'username';
224 } else {
225 $focus_element = 'password';
226 }
227
228 $demologin = '';
229 $demopassword = '';
230 if (!empty($dolibarr_main_demo)) {
231 $tab = explode(',', $dolibarr_main_demo);
232 $demologin = $tab[0];
233 $demopassword = $tab[1];
234 }
235
236 // Execute hook getLoginPageOptions (for table)
237 $parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
238 $reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
239 $morelogincontent = $hookmanager->resPrint;
240
241 // Execute hook getLoginPageExtraOptions (eg for js)
242 $parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
243 $reshook = $hookmanager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
244 $moreloginextracontent = $hookmanager->resPrint;
245
246 //Redirect after connection
247 $parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
248 $reshook = $hookmanager->executeHooks('redirectAfterConnection', $parameters); // Note that $action and $object may have been modified by some hooks.
249 $php_self = $hookmanager->resPrint;
250
251 // Login
252 $login = (!empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha") ? GETPOST("username", "alpha") : $demologin));
253 $password = $demopassword;
254
255 // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
256 $width = 0;
257 $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
258
259 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
260 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
261 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
262 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
263 $width = 128;
264 } elseif (!empty($mysoc->logo_squarred_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
265 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small);
266 } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
267 $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
268 }
269
270 // Security graphical code
271 $captcha = 0;
272 $captcha_refresh = '';
273 if (function_exists("imagecreatefrompng") && getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) {
274 $captcha = 1;
275 $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
276 }
277
278 // Extra link
279 $forgetpasslink = 0;
280 $helpcenterlink = 0;
281 if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK') || !getDolGlobalString('MAIN_HELPCENTER_DISABLELINK')) {
282 if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
283 $forgetpasslink = 1;
284 }
285
286 if (!getDolGlobalString('MAIN_HELPCENTER_DISABLELINK')) {
287 $helpcenterlink = 1;
288 }
289 }
290
291 // Home message
292 $main_home = '';
293 if (getDolGlobalString('MAIN_HOME')) {
294 $substitutionarray = getCommonSubstitutionArray($langs);
295 complete_substitutions_array($substitutionarray, $langs);
296 $texttoshow = make_substitutions(getDolGlobalString('MAIN_HOME'), $substitutionarray, $langs);
297
298 $main_home = dol_htmlcleanlastbr($texttoshow);
299 }
300
301 // Google AD
302 $main_google_ad_client = ((getDolGlobalString('MAIN_GOOGLE_AD_CLIENT') && getDolGlobalString('MAIN_GOOGLE_AD_SLOT')) ? 1 : 0);
303
304 // Set jquery theme
305 $dol_loginmesg = (!empty($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"] : '');
306
307 $favicon = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png';
308 if (!empty($mysoc->logo_squarred_mini)) {
309 $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini);
310 }
311 if (getDolGlobalString('MAIN_FAVICON_URL')) {
312 $favicon = $conf->global->MAIN_FAVICON_URL;
313 }
314
315 $jquerytheme = 'base';
316 if (getDolGlobalString('MAIN_USE_JQUERY_THEME')) {
317 $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
318 }
319
320 // Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_no_mouse_hover
321 $dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int');
322 $dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int');
323 $dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int');
324 $dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int');
325 $dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
326
327 // Include login page template
328 include $template_dir.'login.tpl.php';
329
330 // Global html output events ($mesgs, $errors, $warnings)
332
333 $_SESSION["dol_loginmesg"] = '';
334 }
335}
336
345function makesalt($type = CRYPT_SALT_LENGTH)
346{
347 dol_syslog("makesalt type=".$type);
348 switch ($type) {
349 case 12: // 8 + 4
350 $saltlen = 8;
351 $saltprefix = '$1$';
352 $saltsuffix = '$';
353 break;
354 case 8: // 8 (Pour compatibilite, ne devrait pas etre utilise)
355 $saltlen = 8;
356 $saltprefix = '$1$';
357 $saltsuffix = '$';
358 break;
359 case 2: // 2
360 default: // by default, fall back on Standard DES (should work everywhere)
361 $saltlen = 2;
362 $saltprefix = '';
363 $saltsuffix = '';
364 break;
365 }
366 $salt = '';
367 while (dol_strlen($salt) < $saltlen) {
368 $salt .= chr(mt_rand(64, 126));
369 }
370
371 $result = $saltprefix.$salt.$saltsuffix;
372 dol_syslog("makesalt return=".$result);
373 return $result;
374}
375
382function encodedecode_dbpassconf($level = 0)
383{
384 dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG);
385 $config = '';
386 $passwd = '';
387 $passwd_crypted = '';
388
389 if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php', 'r')) {
390 while (!feof($fp)) {
391 $buffer = fgets($fp, 4096);
392
393 $lineofpass = 0;
394
395 $reg = array();
396 if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i', $buffer, $reg)) { // Old way to save crypted value
397 $val = trim($reg[1]); // This also remove CR/LF
398 $val = preg_replace('/^["\']/', '', $val);
399 $val = preg_replace('/["\'][\s;]*$/', '', $val);
400 if (!empty($val)) {
401 $passwd_crypted = $val;
402 // method dol_encode/dol_decode
403 $val = dol_decode($val);
404 //$val = dolEncrypt($val);
405 $passwd = $val;
406 $lineofpass = 1;
407 }
408 } elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i', $buffer, $reg)) {
409 $val = trim($reg[1]); // This also remove CR/LF
410 $val = preg_replace('/^["\']/', '', $val);
411 $val = preg_replace('/["\'][\s;]*$/', '', $val);
412 if (preg_match('/crypted:/i', $buffer)) {
413 // method dol_encode/dol_decode
414 $mode = 'crypted:';
415 $val = preg_replace('/crypted:/i', '', $val);
416 $passwd_crypted = $val;
417 $val = dol_decode($val);
418 $passwd = $val;
419 } elseif (preg_match('/^dolcrypt:([^:]+):(.*)$/i', $buffer, $reg)) {
420 // method dolEncrypt/dolDecrypt
421 $mode = 'dolcrypt:';
422 $val = preg_replace('/crypted:([^:]+):/i', '', $val);
423 $passwd_crypted = $val;
424 $val = dolDecrypt($buffer);
425 $passwd = $val;
426 } else {
427 $passwd = $val;
428 $mode = 'crypted:';
429 $val = dol_encode($val);
430 $passwd_crypted = $val;
431 // TODO replace with dolEncrypt()
432 // ...
433 }
434 $lineofpass = 1;
435 }
436
437 // Output line
438 if ($lineofpass) {
439 // Add value at end of file
440 if ($level == 0) {
441 $config .= '$dolibarr_main_db_pass=\''.$passwd.'\';'."\n";
442 }
443 if ($level == 1) {
444 $config .= '$dolibarr_main_db_pass=\''.$mode.$passwd_crypted.'\';'."\n";
445 }
446
447 //print 'passwd = '.$passwd.' - passwd_crypted = '.$passwd_crypted;
448 //exit;
449 } else {
450 $config .= $buffer;
451 }
452 }
453 fclose($fp);
454
455 // Write new conf file
456 $file = DOL_DOCUMENT_ROOT.'/conf/conf.php';
457 if ($fp = @fopen($file, 'w')) {
458 fputs($fp, $config);
459 fflush($fp);
460 fclose($fp);
461 clearstatcache();
462
463 // It's config file, so we set read permission for creator only.
464 // Should set permission to web user and groups for users used by batch
465 //dolChmod($file, '0600');
466
467 return 1;
468 } else {
469 dol_syslog("encodedecode_dbpassconf Failed to open conf.php file for writing", LOG_WARNING);
470 return -1;
471 }
472 } else {
473 dol_syslog("encodedecode_dbpassconf Failed to read conf.php", LOG_ERR);
474 return -2;
475 }
476}
477
487function getRandomPassword($generic = false, $replaceambiguouschars = null, $length = 32)
488{
489 global $db, $conf, $langs, $user;
490
491 $generated_password = '';
492 if ($generic) {
493 $lowercase = "qwertyuiopasdfghjklzxcvbnm";
494 $uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
495 $numbers = "1234567890";
496 $randomCode = "";
497 $nbofchar = round($length / 3);
498 $nbofcharlast = ($length - 2 * $nbofchar);
499 //var_dump($nbofchar.'-'.$nbofcharlast);
500 if (function_exists('random_int')) { // Cryptographic random
501 $max = strlen($lowercase) - 1;
502 for ($x = 0; $x < $nbofchar; $x++) {
503 $tmp = random_int(0, $max);
504 $randomCode .= $lowercase[$tmp];
505 }
506 $max = strlen($uppercase) - 1;
507 for ($x = 0; $x < $nbofchar; $x++) {
508 $tmp = random_int(0, $max);
509 $randomCode .= $uppercase[$tmp];
510 }
511 $max = strlen($numbers) - 1;
512 for ($x = 0; $x < $nbofcharlast; $x++) {
513 $tmp = random_int(0, $max);
514 $randomCode .= $numbers[$tmp];
515 }
516
517 $generated_password = str_shuffle($randomCode);
518 } else {
519 // Old platform, non cryptographic random
520 $max = strlen($lowercase) - 1;
521 for ($x = 0; $x < $nbofchar; $x++) {
522 $tmp = mt_rand(0, $max);
523 $randomCode .= $lowercase[$tmp];
524 }
525 $max = strlen($uppercase) - 1;
526 for ($x = 0; $x < $nbofchar; $x++) {
527 $tmp = mt_rand(0, $max);
528 $randomCode .= $uppercase[$tmp];
529 }
530 $max = strlen($numbers) - 1;
531 for ($x = 0; $x < $nbofcharlast; $x++) {
532 $tmp = mt_rand(0, $max);
533 $randomCode .= $numbers[$tmp];
534 }
535
536 $generated_password = str_shuffle($randomCode);
537 }
538 } elseif (getDolGlobalString('USER_PASSWORD_GENERATED')) {
539 $nomclass = "modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
540 $nomfichier = $nomclass.".class.php";
541 //print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass;
542 require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier;
543 $genhandler = new $nomclass($db, $conf, $langs, $user);
544 $generated_password = $genhandler->getNewGeneratedPassword();
545 unset($genhandler);
546 }
547
548 // Do we have to discard some alphabetic characters ?
549 if (is_array($replaceambiguouschars) && count($replaceambiguouschars) > 0) {
550 $numbers = "ABCDEF";
551 $max = strlen($numbers) - 1;
552 if (function_exists('random_int')) { // Cryptographic random
553 $tmp = random_int(0, $max);
554 $generated_password = str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password);
555 } else {
556 $tmp = mt_rand(0, $max);
557 $generated_password = str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password);
558 }
559 }
560
561 return $generated_password;
562}
563
573function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token', $generic = 1)
574{
575 global $conf;
576
577 $out = '';
578
579 if (!empty($conf->use_javascript_ajax)) {
580 $out .= "\n".'<!-- Js code to suggest a security key -->';
581 $out .= '<script nonce="'.getNonce().'" type="text/javascript">';
582 $out .= 'jQuery(document).ready(function () {
583 jQuery("#'.dol_escape_js($htmlnameofbutton).'").click(function() {
584 var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content");
585 console.log("We click on the button '.dol_escape_js($htmlnameofbutton).' to suggest a key. anti-csrf-currentotken is "+currenttoken+". We will fill '.dol_escape_js($htmlname).'");
586 jQuery.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
587 action: \'getrandompassword\',
588 generic: '.($generic ? '1' : '0').',
589 token: currenttoken
590 },
591 function(result) {
592 if (jQuery("input#'.dol_escape_js($htmlname).'").attr("type") == "password") {
593 jQuery("input#'.dol_escape_js($htmlname).'").attr("type", "text");
594 }
595 jQuery("#'.dol_escape_js($htmlname).'").val(result);
596 });
597 });
598 });'."\n";
599 $out .= '</script>';
600 }
601
602 return $out;
603}
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
isHTTPS()
Return if we are using a HTTPS connexion Check HTTPS (no way to be modified by user but may be empty ...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
dol_htmloutput_events($disabledoutputofmessages=0)
Print formated messages to output (Used to show messages on html output).
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
conf($dolibarr_main_document_root)
Load conf file (file must exists)
Definition inc.php:403
if(empty($reshook)) $dol_url_root
View.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Ouput javacript to autoset a generated password using default module into a HTML element.
dol_getwebuser($mode)
Return user/group account of web server.
encodedecode_dbpassconf($level=0)
Encode or decode database password in config file.
checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context='')
Return a login if login/pass was successfull.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
if(!function_exists( 'dol_loginfunction')) makesalt($type=CRYPT_SALT_LENGTH)
Fonction pour initialiser un salt pour la fonction crypt.
dol_encode($chain, $key='1')
Encode a string with base 64 algorithm + specific delta change.
dol_decode($chain, $key='1')
Decode a base 64 encoded + specific delta change.
dolDecrypt($chain, $key='')
Decode a string with a symetric encryption.