33 if (!defined(
'DOL_INC_FOR_VERSION_ERROR')) {
34 define(
'DOL_INC_FOR_VERSION_ERROR',
'1');
36 require_once
'../filefunc.inc.php';
41 if (!defined(
'DOL_DOCUMENT_ROOT')) {
42 define(
'DOL_DOCUMENT_ROOT',
'..');
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/conf.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
54 $_REQUEST[
"logtohtml"] = 1;
58 if (isset($_SERVER[
"DOCUMENT_URI"]) && $_SERVER[
"DOCUMENT_URI"]) {
59 $_SERVER[
"PHP_SELF"] = $_SERVER[
"DOCUMENT_URI"];
63 $includeconferror =
'';
67 $conffiletoshowshort =
"conf.php";
69 $conffile =
"../conf/conf.php";
70 $conffiletoshow =
"htdocs/conf/conf.php";
75 $short_options =
"c:h";
76 $long_options = array(
94 function usage($program, $header)
97 echo
" php ".$program.
" [options] [script options]\n";
99 echo
"Script syntax when using step2.php:\n";
100 echo
" php ".$program.
" [options] [action] [selectlang]\n";
103 echo
" Specify the action to execute for the file among the following ones.\n";
104 echo
" - set: Create tables, keys, functions and data for the instance.\n";
106 echo
" selectlang:\n";
107 echo
" Setup the default lang to use, default to 'auto'.\n";
109 echo
"Script syntax when using upgrade.php:\n";
110 echo
" php ".$program.
" [options] previous_version new_version [script options]\n";
112 echo
" dirmodule:\n";
113 echo
" Specify dirmodule to provide a path for an external module\n";
114 echo
" so the migration is done using a script from a module.\n";
116 echo
" ignoredbversion:\n";
117 echo
" Allow to run migration even if database version does\n";
118 echo
" not match start version of migration.\n";
120 echo
"Script syntax when using upgrade2.php:\n";
121 echo
" php ".$program.
" [options] previous_version new_version [module list]\n";
123 echo
" MAIN_MODULE_NAME1,MAIN_MODULE_NAME2:\n";
124 echo
" Specify a list of module-name to enable, in upper case, with MAIN_MODULE_ prefix, joined by comma.\n";
127 echo
" -c, --config <filename>:\n";
128 echo
" Provide a different conf.php file to use.\n";
130 echo
" -h, --help:\n";
131 echo
" Display this help message.\n";
134 if (php_sapi_name() ===
"cli" && (
float) PHP_VERSION > 7.0) {
136 $opts = getopt($short_options, $long_options, $rest_index);
138 foreach ($opts as $opt => $arg) {
143 $conffiletoshow = $arg;
147 usage($argv[0],
"Usage:");
153 $args_options = array_filter(
154 array_slice($argv, 0, $rest_index),
159 static function ($arg) {
160 return strlen($arg) >= 2 && $arg[0] ==
'-';
163 $parsed_options = array_map(
169 static function ($arg) {
170 if (strlen($arg) > 1) {
179 $unknown_options = array_diff($args_options, $parsed_options);
185 if (count($unknown_options) > 0) {
186 echo
"Unknown option: ".array_values($unknown_options)[0].
"\n";
187 usage($argv[0],
"Usage:");
195 $argv = array_merge(array($argv[0]), array_slice($argv, $rest_index));
196 $argc = count($argv);
200 if (!defined(
'DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) {
201 $result = include_once $conffile;
203 if (empty($dolibarr_main_db_type)) {
204 $dolibarr_main_db_type =
'mysqli';
208 if ($dolibarr_main_db_type ==
'mysql') {
209 $dolibarr_main_db_type =
'mysqli';
212 if (!isset($dolibarr_main_db_port) && ($dolibarr_main_db_type ==
'mysqli')) {
213 $dolibarr_main_db_port =
'3306';
217 $dolibarr_main_data_root = isset($dolibarr_main_data_root) ? trim($dolibarr_main_data_root) : DOL_DOCUMENT_ROOT.
'/../documents';
218 $dolibarr_main_url_root = isset($dolibarr_main_url_root) ? trim($dolibarr_main_url_root) :
'';
219 $dolibarr_main_url_root_alt = isset($dolibarr_main_url_root_alt) ? trim($dolibarr_main_url_root_alt) :
'';
220 $dolibarr_main_document_root = isset($dolibarr_main_document_root) ? trim($dolibarr_main_document_root) :
'';
221 $dolibarr_main_document_root_alt = isset($dolibarr_main_document_root_alt) ? trim($dolibarr_main_document_root_alt) :
'';
224 if (!empty($dolibarr_main_document_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_document_root)) {
225 $dolibarr_main_document_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_document_root);
227 if (!empty($dolibarr_main_url_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_url_root)) {
228 $dolibarr_main_url_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_url_root);
230 if (!empty($dolibarr_main_data_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_data_root)) {
231 $dolibarr_main_data_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_data_root);
233 if (!empty($dolibarr_main_document_root_alt) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_document_root_alt)) {
234 $dolibarr_main_document_root_alt = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_document_root_alt);
236 if (!empty($dolibarr_main_url_root_alt) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_url_root_alt)) {
237 $dolibarr_main_url_root_alt = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_url_root_alt);
241 if (!empty($dolibarr_main_document_root)) {
242 $result =
conf($dolibarr_main_document_root);
246 if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type)) {
247 $result = include_once $dolibarr_main_document_root.
"/core/db/".$dolibarr_main_db_type.
'.class.php';
249 $includeconferror =
'ErrorBadValueForDolibarrMainDBType';
253 $includeconferror =
'ErrorBadValueForDolibarrMainDocumentRoot';
256 $includeconferror =
'ErrorBadFormatForConfFile';
259 $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
262 if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) {
263 $dolibarr_main_db_prefix =
'llx_';
265 define(
'MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix :
''));
267 define(
'DOL_CLASS_PATH',
'class/');
268 define(
'DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : DOL_DOCUMENT_ROOT.
'/../documents'));
269 define(
'DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root :
''));
270 $uri = preg_replace(
'/^http(s?):\/\//i',
'', constant(
'DOL_MAIN_URL_ROOT'));
271 $suburi = strstr($uri,
'/');
272 if ($suburi ==
'/') {
275 define(
'DOL_URL_ROOT', $suburi);
278 if (empty($conf->file->character_set_client)) {
279 $conf->file->character_set_client =
"utf-8";
281 if (empty($conf->db->character_set)) {
282 $conf->db->character_set =
'utf8';
284 if (empty($conf->db->dolibarr_main_db_collation)) {
285 $conf->db->dolibarr_main_db_collation =
'utf8_unicode_ci';
287 if (empty($conf->db->dolibarr_main_db_encryption)) {
288 $conf->db->dolibarr_main_db_encryption = 0;
290 if (empty($conf->db->dolibarr_main_db_cryptkey)) {
291 $conf->db->dolibarr_main_db_cryptkey =
'';
293 if (empty($conf->db->user)) {
294 $conf->db->user =
'';
298 $conf->file->dol_document_root = array(DOL_DOCUMENT_ROOT);
299 if (!empty($dolibarr_main_document_root_alt)) {
301 $values = preg_split(
'/[;,]/', $dolibarr_main_document_root_alt);
302 foreach ($values as $value) {
303 $conf->file->dol_document_root[] = $value;
310 $lockfile = DOL_DATA_ROOT.
'/install.lock';
311 $lockfile2 = DOL_DOCUMENT_ROOT.
'/install.lock';
312 $upgradeunlockfile = DOL_DATA_ROOT.
'/upgrade.unlock';
313 $upgradeunlockfile2 = DOL_DOCUMENT_ROOT.
'/upgrade.unlock';
314 if (constant(
'DOL_DATA_ROOT') ===
null) {
317 $lockfile =
'../../documents/install.lock';
318 $upgradeunlockfile =
'../../documents/upgrade.unlock';
321 if (@file_exists($lockfile) || @file_exists($lockfile2)) {
322 if (!defined(
'ALLOWED_IF_UPGRADE_UNLOCK_FOUND') || (! @file_exists($upgradeunlockfile) && ! @file_exists($upgradeunlockfile2))) {
329 if (!isset($langs) || !is_object($langs)) {
331 $langs->setDefaultLang(
'auto');
333 $langs->load(
"install");
335 header(
"X-Content-Type-Options: nosniff");
336 header(
"X-Frame-Options: SAMEORIGIN");
338 if (
GETPOST(
'action') !=
'upgrade') {
339 print $langs->trans(
"YouTryInstallDisabledByFileLock").
'<br>';
341 print $langs->trans(
"YouTryUpgradeDisabledByMissingFileUnLock").
'<br>';
343 if (!empty($dolibarr_main_url_root)) {
344 if (
GETPOST(
'action') !=
'upgrade' && (!file_exists($conffile) || !isset($dolibarr_main_url_root))) {
345 print $langs->trans(
"ClickOnLinkOrRemoveManualy").
'<br>';
347 print $langs->trans(
"ClickOnLinkOrCreateUnlockFileManualy").
'<br>';
349 print
'<a href="'.$dolibarr_main_url_root.
'/admin/index.php?mainmenu=home&leftmenu=setup'.(
GETPOSTISSET(
"login") ?
'&username='.urlencode(
GETPOST(
"login")) :
'').
'">';
350 print $langs->trans(
"ClickHereToGoToApp");
353 print
'If you always reach this page, you must remove the install.lock file manually.<br>';
360 $conf->modules[
'syslog'] =
'syslog';
361 $conf->global->SYSLOG_LEVEL = constant(
'LOG_DEBUG');
362 if (!defined(
'SYSLOG_HANDLERS')) {
363 define(
'SYSLOG_HANDLERS',
'["mod_syslog_file"]');
365 if (!defined(
'SYSLOG_FILE')) {
366 if (@is_writable(
'/tmp')) {
367 define(
'SYSLOG_FILE',
'/tmp/dolibarr_install.log');
368 } elseif (!empty($_ENV[
"TMP"]) && @is_writable($_ENV[
"TMP"])) {
369 define(
'SYSLOG_FILE', $_ENV[
"TMP"].
'/dolibarr_install.log');
370 } elseif (!empty($_ENV[
"TEMP"]) && @is_writable($_ENV[
"TEMP"])) {
371 define(
'SYSLOG_FILE', $_ENV[
"TEMP"].
'/dolibarr_install.log');
372 } elseif (@is_writable(
'../../../../') && @file_exists(
'../../../../startdoliwamp.bat')) {
373 define(
'SYSLOG_FILE',
'../../../../dolibarr_install.log');
374 } elseif (@is_writable(
'../../')) {
375 define(
'SYSLOG_FILE',
'../../dolibarr_install.log');
379 if (defined(
'SYSLOG_FILE')) {
380 $conf->global->SYSLOG_FILE = constant(
'SYSLOG_FILE');
382 if (!defined(
'SYSLOG_FILE_NO_ERROR')) {
383 define(
'SYSLOG_FILE_NO_ERROR', 1);
386 $handlers = array(
'mod_syslog_file');
387 foreach ($handlers as $handler) {
388 $file = DOL_DOCUMENT_ROOT.
'/core/modules/syslog/'.$handler.
'.php';
389 if (!file_exists($file)) {
390 throw new Exception(
'Missing log handler file '.$handler.
'.php');
394 $loghandlerinstance =
new $handler();
395 if (!$loghandlerinstance instanceof
LogHandler) {
396 throw new Exception(
'Log handler does not extend LogHandler');
399 if (empty($conf->loghandlers[$handler])) {
400 $conf->loghandlers[$handler] = $loghandlerinstance;
407 $langs->setDefaultLang(
GETPOST(
'lang',
'aZ09'));
409 $langs->setDefaultLang(
'auto');
419 function conf($dolibarr_main_document_root)
422 global $dolibarr_main_db_type;
423 global $dolibarr_main_db_host;
424 global $dolibarr_main_db_port;
425 global $dolibarr_main_db_name;
426 global $dolibarr_main_db_user;
427 global $dolibarr_main_db_pass;
428 global $dolibarr_main_db_collation;
429 global $dolibarr_main_db_character_set;
430 global $character_set_client;
431 global $dolibarr_main_instance_unique_id;
432 global $dolibarr_main_cookie_cryptkey;
434 $return = include_once $dolibarr_main_document_root.
'/core/class/conf.class.php';
440 $conf->db->type = trim($dolibarr_main_db_type);
441 $conf->db->host = trim($dolibarr_main_db_host);
442 $conf->db->port = trim($dolibarr_main_db_port);
443 $conf->db->name = trim($dolibarr_main_db_name);
444 $conf->db->user = trim($dolibarr_main_db_user);
445 $conf->db->pass = (empty($dolibarr_main_db_pass) ?
'' : trim($dolibarr_main_db_pass));
448 if ($conf->db->type ==
'mysql') {
449 $conf->db->type =
'mysqli';
451 if (empty($character_set_client)) {
452 $character_set_client =
"UTF-8";
454 $conf->file->character_set_client = strtoupper($character_set_client);
456 $conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ?
'' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id;
457 if (empty($dolibarr_main_db_character_set)) {
458 $dolibarr_main_db_character_set = ($conf->db->type ==
'mysqli' ?
'utf8' :
'');
460 $conf->db->character_set = $dolibarr_main_db_character_set;
461 if (empty($dolibarr_main_db_collation)) {
462 $dolibarr_main_db_collation = ($conf->db->type ==
'mysqli' ?
'utf8_unicode_ci' :
'');
464 $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
465 if (empty($dolibarr_main_db_encryption)) {
466 $dolibarr_main_db_encryption = 0;
468 $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
469 if (empty($dolibarr_main_db_cryptkey)) {
470 $dolibarr_main_db_cryptkey =
'';
472 $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
475 $conf->modules[
'syslog'] =
'syslog';
476 $conf->global->SYSLOG_LEVEL = constant(
'LOG_DEBUG');
477 if (!defined(
'SYSLOG_HANDLERS')) {
478 define(
'SYSLOG_HANDLERS',
'["mod_syslog_file"]');
480 if (!defined(
'SYSLOG_FILE')) {
481 if (@is_writable(
'/tmp')) {
482 define(
'SYSLOG_FILE',
'/tmp/dolibarr_install.log');
483 } elseif (!empty($_ENV[
"TMP"]) && @is_writable($_ENV[
"TMP"])) {
484 define(
'SYSLOG_FILE', $_ENV[
"TMP"].
'/dolibarr_install.log');
485 } elseif (!empty($_ENV[
"TEMP"]) && @is_writable($_ENV[
"TEMP"])) {
486 define(
'SYSLOG_FILE', $_ENV[
"TEMP"].
'/dolibarr_install.log');
487 } elseif (@is_writable(
'../../../../') && @file_exists(
'../../../../startdoliwamp.bat')) {
488 define(
'SYSLOG_FILE',
'../../../../dolibarr_install.log');
489 } elseif (@is_writable(
'../../')) {
490 define(
'SYSLOG_FILE',
'../../dolibarr_install.log');
494 if (defined(
'SYSLOG_FILE')) {
495 $conf->global->SYSLOG_FILE = constant(
'SYSLOG_FILE');
497 if (!defined(
'SYSLOG_FILE_NO_ERROR')) {
498 define(
'SYSLOG_FILE_NO_ERROR', 1);
501 $handlers = array(
'mod_syslog_file');
502 foreach ($handlers as $handler) {
503 $file = DOL_DOCUMENT_ROOT.
'/core/modules/syslog/'.$handler.
'.php';
504 if (!file_exists($file)) {
505 throw new Exception(
'Missing log handler file '.$handler.
'.php');
509 $loghandlerinstance =
new $handler();
510 if (!$loghandlerinstance instanceof
LogHandler) {
511 throw new Exception(
'Log handler does not extend LogHandler');
514 if (empty($conf->loghandlers[$handler])) {
515 $conf->loghandlers[$handler] = $loghandlerinstance;
534 function pHeader($subtitle, $next, $action =
'set', $param =
'', $forcejqueryurl =
'', $csstable =
'main-inside')
538 $langs->load(
"main");
539 $langs->load(
"admin");
540 $langs->load(
"install");
542 $jquerytheme =
'base';
544 if ($forcejqueryurl) {
545 $jQueryCustomPath = $forcejqueryurl;
546 $jQueryUiCustomPath = $forcejqueryurl;
548 $jQueryCustomPath = (defined(
'JS_JQUERY') && constant(
'JS_JQUERY')) ? JS_JQUERY :
false;
549 $jQueryUiCustomPath = (defined(
'JS_JQUERY_UI') && constant(
'JS_JQUERY_UI')) ? JS_JQUERY_UI :
false;
553 header(
"Content-type: text/html; charset=".$conf->file->character_set_client);
554 header(
"X-Content-Type-Options: nosniff");
555 header(
"X-Frame-Options: SAMEORIGIN");
557 print
'<!DOCTYPE HTML>'.
"\n";
560 print
'<meta charset="'.$conf->file->character_set_client.
'">'.
"\n";
561 print
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'.
"\n";
562 print
'<meta name="generator" content="Dolibarr installer">'.
"\n";
563 print
'<link rel="stylesheet" type="text/css" href="default.css">'.
"\n";
565 print
'<!-- Includes CSS for JQuery -->'.
"\n";
566 if ($jQueryUiCustomPath) {
567 print
'<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.
'css/'.$jquerytheme.
'/jquery-ui.min.css" />'.
"\n";
569 print
'<link rel="stylesheet" type="text/css" href="../includes/jquery/css/'.$jquerytheme.
'/jquery-ui.min.css" />'.
"\n";
572 print
'<!-- Includes JS for JQuery -->'.
"\n";
573 if ($jQueryCustomPath) {
574 print
'<script type="text/javascript" src="'.$jQueryCustomPath.
'jquery.min.js"></script>'.
"\n";
576 print
'<script type="text/javascript" src="../includes/jquery/js/jquery.min.js"></script>'.
"\n";
578 if ($jQueryUiCustomPath) {
579 print
'<script type="text/javascript" src="'.$jQueryUiCustomPath.
'jquery-ui.min.js"></script>'.
"\n";
581 print
'<script type="text/javascript" src="../includes/jquery/js/jquery-ui.min.js"></script>'.
"\n";
584 print
'<title>'.$langs->trans(
"DolibarrSetup").
'</title>'.
"\n";
585 print
'</head>'.
"\n";
589 print
'<div class="divlogoinstall" style="text-align:center">';
590 print
'<img class="imglogoinstall" src="../theme/dolibarr_logo.svg" alt="Dolibarr logo" width="300px"><br>';
594 print
'<span class="titre">'.$langs->trans(
"DolibarrSetup");
596 print
' - '.$subtitle;
598 print
'</span>'.
"\n";
600 print
'<form name="forminstall" style="width: 100%" action="'.$next.
'.php'.($param ?
'?'.$param :
'').
'" method="POST"';
601 if ($next ==
'step5') {
602 print
' autocomplete="off"';
605 print
'<input type="hidden" name="testpost" value="ok">'.
"\n";
606 print
'<input type="hidden" name="action" value="'.$action.
'">'.
"\n";
608 print
'<table class="main" width="100%"><tr><td>'.
"\n";
610 print
'<table class="'.$csstable.
'" width="100%"><tr><td>'.
"\n";
623 function pFooter($nonext = 0, $setuplang =
'', $jscheckfunction =
'', $withpleasewait = 0, $morehtml =
'')
625 global $conf, $langs;
627 $langs->loadLangs(array(
"main",
"other",
"admin"));
629 print
'</td></tr></table>'.
"\n";
630 print
'</td></tr></table>'.
"\n";
632 print
'<!-- pFooter -->'.
"\n";
636 if (!$nonext || ($nonext ==
'2')) {
637 print
'<div class="nextbutton" id="nextbutton">';
638 if ($nonext ==
'2') {
639 print
'<span class="warning">';
640 print $langs->trans(
"ErrorFoundDuringMigration", isset($_SERVER[
"REQUEST_URI"]) ? $_SERVER[
"REQUEST_URI"].
'&ignoreerrors=1' :
'');
645 print
'<input type="submit" '.($nonext ==
'2' ?
'disabled="disabled" ' :
'').
'value="'.$langs->trans(
"NextStep").
' ->"';
646 if ($jscheckfunction) {
647 print
' onClick="return '.$jscheckfunction.
'();"';
650 if ($withpleasewait) {
651 print
'<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>'.$langs->trans(
"NextStepMightLastALongTime").
'<br><br><div class="blinkwait">'.$langs->trans(
"PleaseBePatient").
'</div></div>';
655 print
'<input type="hidden" name="selectlang" value="'.dol_escape_htmltag($setuplang).
'">';
658 print
'</form><br>'.
"\n";
661 if (isset($conf->logbuffer) && count($conf->logbuffer)) {
663 print
"<!-- Start of log output\n";
665 foreach ($conf->logbuffer as $logline) {
666 print $logline.
"<br>\n";
669 print
"End of log output -->\n";
673 print
'</body>'.
"\n";
674 print
'</html>'.
"\n";
686 if (!defined(
'LOG_DEBUG')) {
687 define(
'LOG_DEBUG', 6);
701 if ($_SERVER[
"SCRIPT_FILENAME"] ==
'php' || preg_match(
'/[\\/]php$/i', $_SERVER[
"SCRIPT_FILENAME"]) || preg_match(
'/php\.exe$/i', $_SERVER[
"SCRIPT_FILENAME"])) {
702 $dolibarr_main_document_root = $_SERVER[
"DOCUMENT_ROOT"];
704 if (!preg_match(
'/[\\/]dolibarr[\\/]htdocs$/i', $dolibarr_main_document_root)) {
705 $dolibarr_main_document_root .=
"/dolibarr/htdocs";
709 $dolibarr_main_document_root = dirname(dirname($_SERVER[
"SCRIPT_FILENAME"]));
712 return $dolibarr_main_document_root;
723 $dolibarr_main_data_root = preg_replace(
"/\/htdocs$/",
"", $dolibarr_main_document_root);
724 $dolibarr_main_data_root .=
"/documents";
725 return $dolibarr_main_data_root;
736 if (isset($_SERVER[
"SCRIPT_URI"])) {
737 $dolibarr_main_url_root = $_SERVER[
"SCRIPT_URI"];
738 } elseif (isset($_SERVER[
"SERVER_URL"]) && isset($_SERVER[
"DOCUMENT_URI"])) {
740 $dolibarr_main_url_root = $_SERVER[
"SERVER_URL"].$_SERVER[
"DOCUMENT_URI"];
743 $proto = ((!empty($_SERVER[
"HTTPS"]) && $_SERVER[
"HTTPS"] ==
'on') || (!empty($_SERVER[
'SERVER_PORT']) && $_SERVER[
'SERVER_PORT'] == 443)) ?
'https' :
'http';
744 if (!empty($_SERVER[
"HTTP_HOST"])) {
745 $serverport = $_SERVER[
"HTTP_HOST"];
746 } elseif (!empty($_SERVER[
"SERVER_NAME"])) {
747 $serverport = $_SERVER[
"SERVER_NAME"];
749 $serverport =
'localhost';
751 $dolibarr_main_url_root = $proto.
"://".$serverport.$_SERVER[
"SCRIPT_NAME"];
755 $dolibarr_main_url_root = dirname(dirname($dolibarr_main_url_root));
757 return $dolibarr_main_url_root;
768 return preg_replace(
'/__SUPERUSERLOGIN__/',
'root', $force_install_databaserootlogin);
779 return preg_replace(
'/__SUPERUSERPASSWORD__/',
'', $force_install_databaserootpass);
Class to stock current configuration.
Parent class for log handlers.
Class to manage translations.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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)
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
detect_dolibarr_main_data_root($dolibarr_main_document_root)
Automatically detect Dolibarr's main data root.
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
usage($program, $header)
Print the usage when executing scripts from install/.
parse_database_login($force_install_databaserootlogin)
Replaces automatic database login by actual value.
parse_database_pass($force_install_databaserootpass)
Replaces automatic database password by actual value.
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
detect_dolibarr_main_url_root()
Automatically detect Dolibarr's main URL root.
detect_dolibarr_main_document_root()
Automatically detect Dolibarr's main document root.