dolibarr  21.0.0-alpha
filefunc.inc.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
4  * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
6  * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
7  * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
8  * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
9  * Copyright (C) 2006 Andre Cianfarani <andre.cianfarani@acdeveloppement.net>
10  * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
11  * Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
12  * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program. If not, see <https://www.gnu.org/licenses/>.
26  */
27 
34 if (!defined('DOL_APPLICATION_TITLE')) {
35  define('DOL_APPLICATION_TITLE', 'Dolibarr');
36 }
37 if (!defined('DOL_VERSION')) {
38  define('DOL_VERSION', '21.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
39 }
40 
41 if (!defined('EURO')) {
42  define('EURO', chr(128));
43 }
44 
45 // Define syslog constants
46 if (!defined('LOG_DEBUG')) {
47  if (!function_exists("syslog")) {
48  // For PHP versions without syslog (like running on Windows OS)
49  define('LOG_EMERG', 0);
50  define('LOG_ALERT', 1);
51  define('LOG_CRIT', 2);
52  define('LOG_ERR', 3);
53  define('LOG_WARNING', 4);
54  define('LOG_NOTICE', 5);
55  define('LOG_INFO', 6);
56  define('LOG_DEBUG', 7);
57  }
58 }
59 
60 // End of common declaration part
61 if (defined('DOL_INC_FOR_VERSION_ERROR')) {
62  return;
63 }
64 
65 
72 {
73  session_start();
74 }
75 
82 {
83  return session_regenerate_id();
84 }
85 
93 function dol_session_rotate($sessionname = '')
94 {
95  $oldsessionid = session_id();
96 
97  // Backup the current session
98  $session_backup = $_SESSION;
99 
100  // Set current session to expire in 1 minute
101  $_SESSION['OBSOLETE'] = true;
102  $_SESSION['EXPIRES'] = time() + 60;
103 
104  // Close the current session
105  session_write_close();
106 
107  // Set a new session id and start the session
108  session_name($sessionname);
110 
111  // Restore the previous session backup
112  $_SESSION = $session_backup;
113 
114  // Clean up
115  unset($session_backup);
116  unset($_SESSION['OBSOLETE']);
117  unset($_SESSION['EXPIRES']);
118 
119  $newsessionid = session_id();
120  //var_dump("oldsessionid=".$oldsessionid." - newsessionid=".$newsessionid);
121 }
122 
123 
124 
125 // Define vars
126 $conffiletoshowshort = "conf.php";
127 // Define localization of conf file
128 // --- Start of part replaced by Dolibarr packager makepack-dolibarr
129 $conffile = "conf/conf.php";
130 $conffiletoshow = "htdocs/conf/conf.php";
131 // For debian/redhat like systems
132 //$conffile = "/etc/dolibarr/conf.php";
133 //$conffiletoshow = "/etc/dolibarr/conf.php";
134 
135 
136 // Include configuration
137 // --- End of part replaced by Dolibarr packager makepack-dolibarr
138 
139 // Include configuration
140 $result = @include_once $conffile; // Keep @ because with some error reporting mode, this breaks the redirect done when file is not found
141 
142 // Disable some not used PHP stream
143 $listofwrappers = stream_get_wrappers();
144 // We need '.phar' for geoip2. TODO Replace phar in geoip with exploded files so we can disable phar by default.
145 // phar stream does not auto unserialize content (possible code execution) since PHP 8.1
146 // zip stream is necessary by excel import module
147 $arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zlib');
148 if (!empty($dolibarr_main_stream_to_disable) && is_array($dolibarr_main_stream_to_disable)) {
149  $arrayofstreamtodisable = $dolibarr_main_stream_to_disable;
150 }
151 foreach ($arrayofstreamtodisable as $streamtodisable) {
152  if (!empty($listofwrappers) && in_array($streamtodisable, $listofwrappers)) {
153  /*if (!empty($dolibarr_main_stream_do_not_disable) && is_array($dolibarr_main_stream_do_not_disable) && in_array($streamtodisable, $dolibarr_main_stream_do_not_disable)) {
154  continue; // We do not disable this stream
155  }*/
156  stream_wrapper_unregister($streamtodisable);
157  }
158 }
159 
160 if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) { // If install not done and we are in a web session
161  if (!empty($_SERVER["CONTEXT_PREFIX"])) { // CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT are not defined on all apache versions
162  $path = $_SERVER["CONTEXT_PREFIX"]; // example '/dolibarr/' when using an apache alias.
163  if (!preg_match('/\/$/', $path)) {
164  $path .= '/';
165  }
166  } elseif (preg_match('/index\.php/', $_SERVER['PHP_SELF'])) {
167  // When we ask index.php, we MUST BE SURE that $path is '' at the end. This is required to make install process
168  // when using apache alias like '/dolibarr/' that point to htdocs.
169  // Note: If calling page was an index.php not into htdocs (ie comm/index.php, ...), then this redirect will fails,
170  // but we don't want to change this because when URL is correct, we must be sure the redirect to install/index.php will be correct.
171  $path = '';
172  } else {
173  // If what we look is not index.php, we can try to guess location of root. May not work all the time.
174  // There is no real solution, because the only way to know the apache url relative path is to have it into conf file.
175  // If it fails to find correct $path, then only solution is to ask user to enter the correct URL to index.php or install/index.php
176  $TDir = explode('/', $_SERVER['PHP_SELF']);
177  $path = '';
178  $i = count($TDir);
179  while ($i--) {
180  if (empty($TDir[$i]) || $TDir[$i] == 'htdocs') {
181  break;
182  }
183  if ($TDir[$i] == 'dolibarr') {
184  break;
185  }
186  if (substr($TDir[$i], -4, 4) == '.php') {
187  continue;
188  }
189 
190  $path .= '../';
191  }
192  }
193 
194  header("Location: ".$path."install/index.php");
195 
196  /*
197  print '<br><center>';
198  print 'The conf/conf.php file was not found or is not readable by the web server. If this is your first access, <a href="'.$path.'install/index.php">click here to start the Dolibarr installation process</a> to create it...';
199  print '</center><br>';
200  */
201 
202  exit;
203 }
204 
205 // Force PHP error_reporting setup (Dolibarr may report warning without this)
206 if (!empty($dolibarr_strict_mode)) {
207  error_reporting(E_ALL | E_STRICT);
208 } else {
209  error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED));
210 }
211 
212 // Disable php display errors
213 if (!empty($dolibarr_main_prod)) {
214  ini_set('display_errors', 'Off');
215 }
216 
217 // Clean parameters
218 $dolibarr_main_data_root = (empty($dolibarr_main_data_root) ? '' : trim($dolibarr_main_data_root));
219 $dolibarr_main_url_root = trim(preg_replace('/\/+$/', '', empty($dolibarr_main_url_root) ? '' : $dolibarr_main_url_root));
220 $dolibarr_main_url_root_alt = (empty($dolibarr_main_url_root_alt) ? '' : trim($dolibarr_main_url_root_alt));
221 $dolibarr_main_document_root = (empty($dolibarr_main_document_root) ? '' : trim($dolibarr_main_document_root));
222 $dolibarr_main_document_root_alt = (empty($dolibarr_main_document_root_alt) ? '' : trim($dolibarr_main_document_root_alt));
223 
224 if (!isset($dolibarr_main_db_port)) {
225  $dolibarr_main_db_port = 3306; // For compatibility with old configs, if not defined, we take 'mysql' type
226 }
227 if (empty($dolibarr_main_db_type)) {
228  $dolibarr_main_db_type = 'mysqli'; // For compatibility with old configs, if not defined, we take 'mysql' type
229 }
230 
231 // Mysql driver support has been removed in favor of mysqli
232 if ($dolibarr_main_db_type == 'mysql') {
233  $dolibarr_main_db_type = 'mysqli';
234 }
235 if (empty($dolibarr_main_db_prefix)) {
236  $dolibarr_main_db_prefix = 'llx_';
237 }
238 if (empty($dolibarr_main_db_character_set)) {
239  $dolibarr_main_db_character_set = ($dolibarr_main_db_type == 'mysqli' ? 'utf8' : ''); // Old installation
240 }
241 if (empty($dolibarr_main_db_collation)) {
242  $dolibarr_main_db_collation = ($dolibarr_main_db_type == 'mysqli' ? 'utf8_unicode_ci' : ''); // Old installation
243 }
244 if (empty($dolibarr_main_db_encryption)) {
245  $dolibarr_main_db_encryption = 0;
246 }
247 if (empty($dolibarr_main_db_cryptkey)) {
248  $dolibarr_main_db_cryptkey = '';
249 }
250 if (empty($dolibarr_main_limit_users)) {
251  $dolibarr_main_limit_users = 0;
252 }
253 if (empty($dolibarr_mailing_limit_sendbyweb)) {
254  $dolibarr_mailing_limit_sendbyweb = 0;
255 }
256 if (empty($dolibarr_mailing_limit_sendbycli)) {
257  $dolibarr_mailing_limit_sendbycli = 0;
258 }
259 if (empty($dolibarr_mailing_limit_sendbyday)) {
260  $dolibarr_mailing_limit_sendbyday = 0;
261 }
262 if (empty($dolibarr_strict_mode)) {
263  $dolibarr_strict_mode = 0; // For debug in php strict mode
264 }
265 
266 define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
267 
268 if (!file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) {
269  print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
270  print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
271  exit;
272 }
273 
274 
275 // Included by default (must be before the CSRF check so wa can use the dol_syslog)
276 include_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
277 include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
278 //print memory_get_usage();
279 
280 
281 // Security: CSRF protection
282 // This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])
283 // when we post forms (we allow GET and HEAD to accept direct link from a particular page).
284 // Note about $_SERVER[HTTP_HOST/SERVER_NAME]: http://shiflett.org/blog/2006/mar/server-name-versus-http-host
285 // See also CSRF protections done into main.inc.php
286 if (!defined('NOCSRFCHECK') && isset($dolibarr_nocsrfcheck) && $dolibarr_nocsrfcheck == 1) { // If $dolibarr_nocsrfcheck is 0, there is a strict CSRF test with token in main
287  if (!empty($_SERVER['REQUEST_METHOD']) && !in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD')) && !empty($_SERVER['HTTP_HOST'])) {
288  $csrfattack = false;
289  if (empty($_SERVER['HTTP_REFERER'])) {
290  $csrfattack = true; // An evil browser was used
291  } else {
292  $tmpa = parse_url($_SERVER['HTTP_HOST']);
293  $tmpb = parse_url($_SERVER['HTTP_REFERER']);
294  if ((empty($tmpa['host']) ? $tmpa['path'] : $tmpa['host']) != (empty($tmpb['host']) ? $tmpb['path'] : $tmpb['host'])) {
295  $csrfattack = true;
296  }
297  }
298  if ($csrfattack) {
299  //print 'NOCSRFCHECK='.defined('NOCSRFCHECK').' REQUEST_METHOD='.$_SERVER['REQUEST_METHOD'].' HTTP_HOST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER'];
300  // Note: We can't use dol_escape_htmltag here to escape output because lib functions.lib.ph is not yet loaded.
301  dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (Bad referrer).", LOG_WARNING);
302  print "Access refused by CSRF protection in main.inc.php. Referrer of form (".htmlentities(empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'], ENT_COMPAT, 'UTF-8').") is outside the server that serve this page (with method = ".htmlentities($_SERVER['REQUEST_METHOD'], ENT_COMPAT, 'UTF-8').").\n";
303  print "If you access your server behind a proxy using url rewriting, you might check that all HTTP headers are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file to remove this security check).\n";
304  die;
305  }
306  }
307  // Another test is done later on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
308 }
309 if (empty($dolibarr_main_db_host) && !defined('NOREQUIREDB')) {
310  print '<div class="center">Dolibarr setup is not yet complete.<br><br>'."\n";
311  print '<a href="install/index.php">Click here to finish Dolibarr install process</a> ...</div>'."\n";
312  die;
313 }
314 if (empty($dolibarr_main_url_root) && !defined('NOREQUIREVIRTUALURL')) {
315  print 'Value for parameter \'dolibarr_main_url_root\' is not defined in your \'htdocs\conf\conf.php\' file.<br>'."\n";
316  print 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)'."\n";
317  die;
318 }
319 
320 if (empty($dolibarr_main_document_root_alt)) {
321  $dolibarr_main_document_root_alt = $dolibarr_main_document_root.'/custom';
322 }
323 
324 if (empty($dolibarr_main_data_root)) {
325  // If directory not defined, we use the default hardcoded value
326  $dolibarr_main_data_root = str_replace("/htdocs", "", $dolibarr_main_document_root);
327  $dolibarr_main_data_root .= "/documents";
328 }
329 
330 // Define some constants
331 define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
332 define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
333 // Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT when root is not directly the main domain.
334 // Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
335 $tmp = '';
336 $found = 0;
337 $real_dolibarr_main_document_root = str_replace('\\', '/', realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
338 if (!empty($_SERVER["DOCUMENT_ROOT"])) {
339  $pathroot = $_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup (not defined on CLI mode), to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
340 } else {
341  $pathroot = 'NOTDEFINED';
342 }
343 $paths = explode('/', str_replace('\\', '/', $_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
344 // Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part.
345 $concatpath = '';
346 foreach ($paths as $tmppath) { // We check to find (B+start of C)=A
347  if (empty($tmppath)) {
348  continue;
349  }
350  $concatpath .= '/'.$tmppath;
351  //if ($tmppath) $concatpath.='/'.$tmppath;
352  //print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'<br>';
353  if ($real_dolibarr_main_document_root == @realpath($pathroot.$concatpath)) { // @ avoid warning when safe_mode is on.
354  //print "Found relative url = ".$concatpath;
355  $tmp3 = $concatpath;
356  $found = 1;
357  break;
358  }
359  //else print "Not found yet for concatpath=".$concatpath."<br>\n";
360 }
361 //print "found=".$found." dolibarr_main_url_root=".$dolibarr_main_url_root."\n";
362 if (!$found) {
363  // There is no subdir that compose the main url root or autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
364  $tmp = $dolibarr_main_url_root;
365 } else {
366  $tmp = 'http'.((!isHTTPS() && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : '');
367 }
368 
369 //print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n";
370 if (!empty($dolibarr_main_force_https)) {
371  $tmp = preg_replace('/^http:/i', 'https:', $tmp);
372 }
373 define('DOL_MAIN_URL_ROOT', $tmp); // URL absolute root (https://sss/dolibarr, ...)
374 $uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
375 $suburi = strstr($uri, '/'); // $suburi contains url without domain:port
376 if (empty($suburi) || $suburi === '/') {
377  $suburi = ''; // If $suburi is null or /, it is now ''
378 }
379 if (!defined('DOL_URL_ROOT')) {
380  define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
381 }
382 //print DOL_MAIN_URL_ROOT.'-'.DOL_URL_ROOT."\n";
383 
384 // Define prefix MAIN_DB_PREFIX
385 define('MAIN_DB_PREFIX', $dolibarr_main_db_prefix);
386 
387 
388 /*
389  * Define PATH to external libraries
390  * To use other version than embedded libraries, define here constant to path. Use '' to use include class path autodetect.
391  */
392 // Path to root libraries
393 if (!defined('TCPDF_PATH')) {
394  define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/');
395 }
396 if (!defined('TCPDI_PATH')) {
397  define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH.'/');
398 }
399 if (!defined('NUSOAP_PATH')) {
400  define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH.'/'));
401 }
402 if (!defined('PHPEXCELNEW_PATH')) {
403  define('PHPEXCELNEW_PATH', (!isset($dolibarr_lib_PHPEXCELNEW_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/phpoffice/phpspreadsheet/src/PhpSpreadsheet/' : (empty($dolibarr_lib_PHPEXCELNEW_PATH) ? '' : $dolibarr_lib_PHPEXCELNEW_PATH.'/'));
404 }
405 if (!defined('ODTPHP_PATH')) {
406  define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH.'/'));
407 }
408 if (!defined('ODTPHP_PATHTOPCLZIP')) {
409  define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ? DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/'));
410 }
411 if (!defined('JS_CKEDITOR')) {
412  define('JS_CKEDITOR', (!isset($dolibarr_js_CKEDITOR)) ? '' : (empty($dolibarr_js_CKEDITOR) ? '' : $dolibarr_js_CKEDITOR.'/'));
413 }
414 if (!defined('JS_JQUERY')) {
415  define('JS_JQUERY', (!isset($dolibarr_js_JQUERY)) ? '' : (empty($dolibarr_js_JQUERY) ? '' : $dolibarr_js_JQUERY.'/'));
416 }
417 if (!defined('JS_JQUERY_UI')) {
418  define('JS_JQUERY_UI', (!isset($dolibarr_js_JQUERY_UI)) ? '' : (empty($dolibarr_js_JQUERY_UI) ? '' : $dolibarr_js_JQUERY_UI.'/'));
419 }
420 // Other required path
421 if (!defined('DOL_DEFAULT_TTF')) {
422  define('DOL_DEFAULT_TTF', (!isset($dolibarr_font_DOL_DEFAULT_TTF)) ? DOL_DOCUMENT_ROOT.'/includes/fonts/Aerial.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF) ? '' : $dolibarr_font_DOL_DEFAULT_TTF));
423 }
424 if (!defined('DOL_DEFAULT_TTF_BOLD')) {
425  define('DOL_DEFAULT_TTF_BOLD', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD)) ? DOL_DOCUMENT_ROOT.'/includes/fonts/AerialBd.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF_BOLD) ? '' : $dolibarr_font_DOL_DEFAULT_TTF_BOLD));
426 }
427 
428 
429 /*
430  * Include functions
431  */
432 
433 // If password is encoded, we decode it. Note: When page is called for install, $dolibarr_main_db_pass may not be defined yet.
434 if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) {
435  if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) {
436  $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass);
437  $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass);
438  $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this so we can use it later to know the password was initially encrypted
439  } else {
440  $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
441  }
442 }
if(!defined('DOL_APPLICATION_TITLE')) if(!defined('DOL_VERSION')) if(!defined('EURO')) if(!defined('LOG_DEBUG')) if(defined('DOL_INC_FOR_VERSION_ERROR')) dol_session_start()
Replace session_start()
dol_session_regenerate_id()
Replace session_regenerate_id()
dol_session_rotate($sessionname='')
Destroy and recreate a new session without losing content.
isHTTPS()
Return if we are using a HTTPS connection Check HTTPS (no way to be modified by user but may be empty...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_decode($chain, $key='1')
Decode a base 64 encoded + specific delta change.