32 if (!defined(
'DOL_INC_FOR_VERSION_ERROR')) {
33 define(
'DOL_INC_FOR_VERSION_ERROR',
'1');
35 require_once
'../filefunc.inc.php';
40 if (!defined(
'DOL_DOCUMENT_ROOT')) {
41 define(
'DOL_DOCUMENT_ROOT',
'..');
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/conf.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/translate.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
53 $_REQUEST[
"logtohtml"] = 1;
57 if (isset($_SERVER[
"DOCUMENT_URI"]) && $_SERVER[
"DOCUMENT_URI"]) {
58 $_SERVER[
"PHP_SELF"] = $_SERVER[
"DOCUMENT_URI"];
62 $includeconferror =
'';
66 $conffiletoshowshort =
"conf.php";
68 $conffile =
"../conf/conf.php";
69 $conffiletoshow =
"htdocs/conf/conf.php";
74 $short_options =
"c:h";
75 $long_options = array(
93 function usage($program, $header)
96 echo
" php ".$program.
" [options] [script options]\n";
98 echo
"Script syntax when using step2.php:\n";
99 echo
" php ".$program.
" [options] [action] [selectlang]\n";
102 echo
" Specify the action to execute for the file among the following ones.\n";
103 echo
" - set: Create tables, keys, functions and data for the instance.\n";
105 echo
" selectlang:\n";
106 echo
" Setup the default lang to use, default to 'auto'.\n";
108 echo
"Script syntax when using upgrade.php:\n";
109 echo
" php ".$program.
" [options] previous_version new_version [script options]\n";
111 echo
" dirmodule:\n";
112 echo
" Specify dirmodule to provide a path for an external module\n";
113 echo
" so the migration is done using a script from a module.\n";
115 echo
" ignoredbversion:\n";
116 echo
" Allow to run migration even if database version does\n";
117 echo
" not match start version of migration.\n";
119 echo
"Script syntax when using upgrade2.php:\n";
120 echo
" php ".$program.
" [options] previous_version new_version [module list]\n";
122 echo
" MAIN_MODULE_NAME1,MAIN_MODULE_NAME2:\n";
123 echo
" Specify a list of module-name to enable, in upper case, with MAIN_MODULE_ prefix, joined by comma.\n";
126 echo
" -c, --config <filename>:\n";
127 echo
" Provide a different conf.php file to use.\n";
129 echo
" -h, --help:\n";
130 echo
" Display this help message.\n";
133 if (php_sapi_name() ===
"cli") {
135 $opts = getopt($short_options, $long_options, $rest_index);
137 foreach ($opts as $opt => $arg)
switch ($opt) {
141 $conffiletoshow = $arg;
145 usage($argv[0],
"Usage:");
150 $args_options = array_filter(array_slice($argv, 0, $rest_index),
function ($arg) {
151 return strlen($arg) >= 2 && $arg[0] ==
'-';
153 $parsed_options = array_map(
function ($arg) {
154 if (strlen($arg) > 1)
157 }, array_keys($opts));
160 $unknown_options = array_diff($args_options, $parsed_options);
166 if (count($unknown_options) > 0) {
167 echo
"Unknown option: ".array_values($unknown_options)[0].
"\n";
168 usage($argv[0],
"Usage:");
176 $argv = array_merge(array($argv[0]), array_slice($argv, $rest_index));
177 $argc = count($argv);
181 if (!defined(
'DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) {
182 $result = include_once $conffile;
184 if (empty($dolibarr_main_db_type)) {
185 $dolibarr_main_db_type =
'mysqli';
189 if ($dolibarr_main_db_type ==
'mysql') {
190 $dolibarr_main_db_type =
'mysqli';
193 if (empty($dolibarr_main_db_port) && ($dolibarr_main_db_type ==
'mysqli')) {
194 $dolibarr_main_db_port =
'3306';
198 $dolibarr_main_data_root = isset($dolibarr_main_data_root) ?trim($dolibarr_main_data_root) : DOL_DOCUMENT_ROOT.
'/../documents';
199 $dolibarr_main_url_root = isset($dolibarr_main_url_root) ?trim($dolibarr_main_url_root) :
'';
200 $dolibarr_main_url_root_alt = isset($dolibarr_main_url_root_alt) ?trim($dolibarr_main_url_root_alt) :
'';
201 $dolibarr_main_document_root = isset($dolibarr_main_document_root) ?trim($dolibarr_main_document_root) :
'';
202 $dolibarr_main_document_root_alt = isset($dolibarr_main_document_root_alt) ?trim($dolibarr_main_document_root_alt) :
'';
205 if (!empty($dolibarr_main_document_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_document_root)) {
206 $dolibarr_main_document_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_document_root);
208 if (!empty($dolibarr_main_url_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_url_root)) {
209 $dolibarr_main_url_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_url_root);
211 if (!empty($dolibarr_main_data_root) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_data_root)) {
212 $dolibarr_main_data_root = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_data_root);
214 if (!empty($dolibarr_main_document_root_alt) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_document_root_alt)) {
215 $dolibarr_main_document_root_alt = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_document_root_alt);
217 if (!empty($dolibarr_main_url_root_alt) && !preg_match(
'/^[\\/]+$/', $dolibarr_main_url_root_alt)) {
218 $dolibarr_main_url_root_alt = preg_replace(
'/[\\/]+$/',
'', $dolibarr_main_url_root_alt);
222 if (!empty($dolibarr_main_document_root)) {
223 $result =
conf($dolibarr_main_document_root);
227 if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type)) {
228 $result = include_once $dolibarr_main_document_root.
"/core/db/".$dolibarr_main_db_type.
'.class.php';
230 $includeconferror =
'ErrorBadValueForDolibarrMainDBType';
234 $includeconferror =
'ErrorBadValueForDolibarrMainDocumentRoot';
237 $includeconferror =
'ErrorBadFormatForConfFile';
240 $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
243 if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) {
244 $dolibarr_main_db_prefix =
'llx_';
246 define(
'MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix :
''));
248 define(
'DOL_CLASS_PATH',
'class/');
249 define(
'DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : DOL_DOCUMENT_ROOT.
'/../documents'));
250 define(
'DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root :
''));
251 $uri = preg_replace(
'/^http(s?):\/\//i',
'', constant(
'DOL_MAIN_URL_ROOT'));
252 $suburi = strstr($uri,
'/');
253 if ($suburi ==
'/') {
256 define(
'DOL_URL_ROOT', $suburi);
259 if (empty($conf->file->character_set_client)) {
260 $conf->file->character_set_client =
"utf-8";
262 if (empty($conf->db->character_set)) {
263 $conf->db->character_set =
'utf8';
265 if (empty($conf->db->dolibarr_main_db_collation)) {
266 $conf->db->dolibarr_main_db_collation =
'utf8_unicode_ci';
268 if (empty($conf->db->dolibarr_main_db_encryption)) {
269 $conf->db->dolibarr_main_db_encryption = 0;
271 if (empty($conf->db->dolibarr_main_db_cryptkey)) {
272 $conf->db->dolibarr_main_db_cryptkey =
'';
274 if (empty($conf->db->user)) {
275 $conf->db->user =
'';
279 $conf->file->dol_document_root = array(DOL_DOCUMENT_ROOT);
280 if (!empty($dolibarr_main_document_root_alt)) {
282 $values = preg_split(
'/[;,]/', $dolibarr_main_document_root_alt);
283 foreach ($values as $value) {
284 $conf->file->dol_document_root[] = $value;
291 $lockfile = DOL_DATA_ROOT.
'/install.lock';
292 $lockfile2 = DOL_DOCUMENT_ROOT.
'/install.lock';
293 $upgradeunlockfile = DOL_DATA_ROOT.
'/upgrade.unlock';
294 $upgradeunlockfile2 = DOL_DOCUMENT_ROOT.
'/upgrade.unlock';
295 if (constant(
'DOL_DATA_ROOT') ===
null) {
298 $lockfile =
'../../documents/install.lock';
299 $upgradeunlockfile =
'../../documents/upgrade.unlock';
302 if (@file_exists($lockfile) || @file_exists($lockfile2)) {
303 if (!defined(
'ALLOWED_IF_UPGRADE_UNLOCK_FOUND') || (! @file_exists($upgradeunlockfile) && ! @file_exists($upgradeunlockfile2))) {
310 if (!isset($langs) || !is_object($langs)) {
312 $langs->setDefaultLang(
'auto');
314 $langs->load(
"install");
316 header(
"X-Content-Type-Options: nosniff");
317 header(
"X-Frame-Options: SAMEORIGIN");
319 if (
GETPOST(
'action') !=
'upgrade') {
320 print $langs->trans(
"YouTryInstallDisabledByFileLock").
'<br>';
322 print $langs->trans(
"YouTryUpgradeDisabledByMissingFileUnLock").
'<br>';
324 if (!empty($dolibarr_main_url_root)) {
325 if (
GETPOST(
'action') !=
'upgrade') {
326 print $langs->trans(
"ClickOnLinkOrRemoveManualy").
'<br>';
328 print $langs->trans(
"ClickOnLinkOrCreateUnlockFileManualy").
'<br>';
330 print
'<a href="'.$dolibarr_main_url_root.
'/admin/index.php?mainmenu=home&leftmenu=setup'.(
GETPOSTISSET(
"login") ?
'&username='.urlencode(
GETPOST(
"login")) :
'').
'">';
331 print $langs->trans(
"ClickHereToGoToApp");
334 print
'If you always reach this page, you must remove the install.lock file manually.<br>';
341 $conf->modules[
'syslog'] =
'syslog';
342 $conf->global->SYSLOG_LEVEL = constant(
'LOG_DEBUG');
343 if (!defined(
'SYSLOG_HANDLERS')) {
344 define(
'SYSLOG_HANDLERS',
'["mod_syslog_file"]');
346 if (!defined(
'SYSLOG_FILE')) {
347 if (@is_writable(
'/tmp')) {
348 define(
'SYSLOG_FILE',
'/tmp/dolibarr_install.log');
349 } elseif (!empty($_ENV[
"TMP"]) && @is_writable($_ENV[
"TMP"])) {
350 define(
'SYSLOG_FILE', $_ENV[
"TMP"].
'/dolibarr_install.log');
351 } elseif (!empty($_ENV[
"TEMP"]) && @is_writable($_ENV[
"TEMP"])) {
352 define(
'SYSLOG_FILE', $_ENV[
"TEMP"].
'/dolibarr_install.log');
353 } elseif (@is_writable(
'../../../../') && @file_exists(
'../../../../startdoliwamp.bat')) {
354 define(
'SYSLOG_FILE',
'../../../../dolibarr_install.log');
355 } elseif (@is_writable(
'../../')) {
356 define(
'SYSLOG_FILE',
'../../dolibarr_install.log');
360 if (defined(
'SYSLOG_FILE')) {
361 $conf->global->SYSLOG_FILE = constant(
'SYSLOG_FILE');
363 if (!defined(
'SYSLOG_FILE_NO_ERROR')) {
364 define(
'SYSLOG_FILE_NO_ERROR', 1);
367 $handlers = array(
'mod_syslog_file');
368 foreach ($handlers as $handler) {
369 $file = DOL_DOCUMENT_ROOT.
'/core/modules/syslog/'.$handler.
'.php';
370 if (!file_exists($file)) {
371 throw new Exception(
'Missing log handler file '.$handler.
'.php');
375 $loghandlerinstance =
new $handler();
377 throw new Exception(
'Log handler does not extend LogHandlerInterface');
380 if (empty($conf->loghandlers[$handler])) {
381 $conf->loghandlers[$handler] = $loghandlerinstance;
388 $langs->setDefaultLang(
GETPOST(
'lang',
'aZ09'));
390 $langs->setDefaultLang(
'auto');
400 function conf($dolibarr_main_document_root)
403 global $dolibarr_main_db_type;
404 global $dolibarr_main_db_host;
405 global $dolibarr_main_db_port;
406 global $dolibarr_main_db_name;
407 global $dolibarr_main_db_user;
408 global $dolibarr_main_db_pass;
409 global $character_set_client;
410 global $dolibarr_main_instance_unique_id;
411 global $dolibarr_main_cookie_cryptkey;
413 $return = include_once $dolibarr_main_document_root.
'/core/class/conf.class.php';
419 $conf->db->type = trim($dolibarr_main_db_type);
420 $conf->db->host = trim($dolibarr_main_db_host);
421 $conf->db->port = trim($dolibarr_main_db_port);
422 $conf->db->name = trim($dolibarr_main_db_name);
423 $conf->db->user = trim($dolibarr_main_db_user);
424 $conf->db->pass = (empty($dolibarr_main_db_pass) ?
'' : trim($dolibarr_main_db_pass));
427 if ($conf->db->type ==
'mysql') {
428 $conf->db->type =
'mysqli';
430 if (empty($character_set_client)) {
431 $character_set_client =
"UTF-8";
433 $conf->file->character_set_client = strtoupper($character_set_client);
435 $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;
436 if (empty($dolibarr_main_db_character_set)) {
437 $dolibarr_main_db_character_set = ($conf->db->type ==
'mysqli' ?
'utf8' :
'');
439 $conf->db->character_set = $dolibarr_main_db_character_set;
440 if (empty($dolibarr_main_db_collation)) {
441 $dolibarr_main_db_collation = ($conf->db->type ==
'mysqli' ?
'utf8_unicode_ci' :
'');
443 $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
444 if (empty($dolibarr_main_db_encryption)) {
445 $dolibarr_main_db_encryption = 0;
447 $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
448 if (empty($dolibarr_main_db_cryptkey)) {
449 $dolibarr_main_db_cryptkey =
'';
451 $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
454 $conf->modules[
'syslog'] =
'syslog';
455 $conf->global->SYSLOG_LEVEL = constant(
'LOG_DEBUG');
456 if (!defined(
'SYSLOG_HANDLERS')) {
457 define(
'SYSLOG_HANDLERS',
'["mod_syslog_file"]');
459 if (!defined(
'SYSLOG_FILE')) {
460 if (@is_writable(
'/tmp')) {
461 define(
'SYSLOG_FILE',
'/tmp/dolibarr_install.log');
462 } elseif (!empty($_ENV[
"TMP"]) && @is_writable($_ENV[
"TMP"])) {
463 define(
'SYSLOG_FILE', $_ENV[
"TMP"].
'/dolibarr_install.log');
464 } elseif (!empty($_ENV[
"TEMP"]) && @is_writable($_ENV[
"TEMP"])) {
465 define(
'SYSLOG_FILE', $_ENV[
"TEMP"].
'/dolibarr_install.log');
466 } elseif (@is_writable(
'../../../../') && @file_exists(
'../../../../startdoliwamp.bat')) {
467 define(
'SYSLOG_FILE',
'../../../../dolibarr_install.log');
468 } elseif (@is_writable(
'../../')) {
469 define(
'SYSLOG_FILE',
'../../dolibarr_install.log');
473 if (defined(
'SYSLOG_FILE')) {
474 $conf->global->SYSLOG_FILE = constant(
'SYSLOG_FILE');
476 if (!defined(
'SYSLOG_FILE_NO_ERROR')) {
477 define(
'SYSLOG_FILE_NO_ERROR', 1);
480 $handlers = array(
'mod_syslog_file');
481 foreach ($handlers as $handler) {
482 $file = DOL_DOCUMENT_ROOT.
'/core/modules/syslog/'.$handler.
'.php';
483 if (!file_exists($file)) {
484 throw new Exception(
'Missing log handler file '.$handler.
'.php');
488 $loghandlerinstance =
new $handler();
490 throw new Exception(
'Log handler does not extend LogHandlerInterface');
493 if (empty($conf->loghandlers[$handler])) {
494 $conf->loghandlers[$handler] = $loghandlerinstance;
513 function pHeader($subtitle, $next, $action =
'set', $param =
'', $forcejqueryurl =
'', $csstable =
'main-inside')
517 $langs->load(
"main");
518 $langs->load(
"admin");
519 $langs->load(
"install");
521 $jquerytheme =
'base';
523 if ($forcejqueryurl) {
524 $jQueryCustomPath = $forcejqueryurl;
525 $jQueryUiCustomPath = $forcejqueryurl;
527 $jQueryCustomPath = (defined(
'JS_JQUERY') && constant(
'JS_JQUERY')) ? JS_JQUERY :
false;
528 $jQueryUiCustomPath = (defined(
'JS_JQUERY_UI') && constant(
'JS_JQUERY_UI')) ? JS_JQUERY_UI :
false;
532 header(
"Content-type: text/html; charset=".$conf->file->character_set_client);
533 header(
"X-Content-Type-Options: nosniff");
534 header(
"X-Frame-Options: SAMEORIGIN");
536 print
'<!DOCTYPE HTML>'.
"\n";
539 print
'<meta charset="'.$conf->file->character_set_client.
'">'.
"\n";
540 print
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'.
"\n";
541 print
'<meta name="generator" content="Dolibarr installer">'.
"\n";
542 print
'<link rel="stylesheet" type="text/css" href="default.css">'.
"\n";
544 print
'<!-- Includes CSS for JQuery -->'.
"\n";
545 if ($jQueryUiCustomPath) {
546 print
'<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.
'css/'.$jquerytheme.
'/jquery-ui.min.css" />'.
"\n";
548 print
'<link rel="stylesheet" type="text/css" href="../includes/jquery/css/'.$jquerytheme.
'/jquery-ui.min.css" />'.
"\n";
551 print
'<!-- Includes JS for JQuery -->'.
"\n";
552 if ($jQueryCustomPath) {
553 print
'<script type="text/javascript" src="'.$jQueryCustomPath.
'jquery.min.js"></script>'.
"\n";
555 print
'<script type="text/javascript" src="../includes/jquery/js/jquery.min.js"></script>'.
"\n";
557 if ($jQueryUiCustomPath) {
558 print
'<script type="text/javascript" src="'.$jQueryUiCustomPath.
'jquery-ui.min.js"></script>'.
"\n";
560 print
'<script type="text/javascript" src="../includes/jquery/js/jquery-ui.min.js"></script>'.
"\n";
563 print
'<title>'.$langs->trans(
"DolibarrSetup").
'</title>'.
"\n";
564 print
'</head>'.
"\n";
568 print
'<div class="divlogoinstall" style="text-align:center">';
569 print
'<img class="imglogoinstall" src="../theme/dolibarr_logo.svg" alt="Dolibarr logo" width="300px"><br>';
573 print
'<span class="titre">'.$langs->trans(
"DolibarrSetup");
575 print
' - '.$subtitle;
577 print
'</span>'.
"\n";
579 print
'<form name="forminstall" style="width: 100%" action="'.$next.
'.php'.($param ?
'?'.$param :
'').
'" method="POST"';
580 if ($next ==
'step5') {
581 print
' autocomplete="off"';
584 print
'<input type="hidden" name="testpost" value="ok">'.
"\n";
585 print
'<input type="hidden" name="action" value="'.$action.
'">'.
"\n";
587 print
'<table class="main" width="100%"><tr><td>'.
"\n";
589 print
'<table class="'.$csstable.
'" width="100%"><tr><td>'.
"\n";
602 function pFooter($nonext = 0, $setuplang =
'', $jscheckfunction =
'', $withpleasewait = 0, $morehtml =
'')
604 global $conf, $langs;
606 $langs->loadLangs(array(
"main",
"other",
"admin"));
608 print
'</td></tr></table>'.
"\n";
609 print
'</td></tr></table>'.
"\n";
611 print
'<!-- pFooter -->'.
"\n";
615 if (!$nonext || ($nonext ==
'2')) {
616 print
'<div class="nextbutton" id="nextbutton">';
617 if ($nonext ==
'2') {
618 print
'<span class="warning">';
619 print $langs->trans(
"ErrorFoundDuringMigration", isset($_SERVER[
"REQUEST_URI"]) ? $_SERVER[
"REQUEST_URI"].
'&ignoreerrors=1' :
'');
624 print
'<input type="submit" '.($nonext ==
'2' ?
'disabled="disabled" ' :
'').
'value="'.$langs->trans(
"NextStep").
' ->"';
625 if ($jscheckfunction) {
626 print
' onClick="return '.$jscheckfunction.
'();"';
629 if ($withpleasewait) {
630 print
'<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>'.$langs->trans(
"NextStepMightLastALongTime").
'<br><br><div class="blinkwait">'.$langs->trans(
"PleaseBePatient").
'</div></div>';
634 print
'<input type="hidden" name="selectlang" value="'.dol_escape_htmltag($setuplang).
'">';
637 print
'</form><br>'.
"\n";
640 if (isset($conf->logbuffer) && count($conf->logbuffer)) {
642 print
"<!-- Start of log output\n";
644 foreach ($conf->logbuffer as $logline) {
645 print $logline.
"<br>\n";
648 print
"End of log output -->\n";
652 print
'</body>'.
"\n";
653 print
'</html>'.
"\n";
665 if (!defined(
'LOG_DEBUG')) {
666 define(
'LOG_DEBUG', 6);
680 if ($_SERVER[
"SCRIPT_FILENAME"] ==
'php' || preg_match(
'/[\\/]php$/i', $_SERVER[
"SCRIPT_FILENAME"]) || preg_match(
'/php\.exe$/i', $_SERVER[
"SCRIPT_FILENAME"])) {
681 $dolibarr_main_document_root = $_SERVER[
"DOCUMENT_ROOT"];
683 if (!preg_match(
'/[\\/]dolibarr[\\/]htdocs$/i', $dolibarr_main_document_root)) {
684 $dolibarr_main_document_root .=
"/dolibarr/htdocs";
688 $dolibarr_main_document_root = dirname(dirname($_SERVER[
"SCRIPT_FILENAME"]));
691 return $dolibarr_main_document_root;
702 $dolibarr_main_data_root = preg_replace(
"/\/htdocs$/",
"", $dolibarr_main_document_root);
703 $dolibarr_main_data_root .=
"/documents";
704 return $dolibarr_main_data_root;
715 if (isset($_SERVER[
"SCRIPT_URI"])) {
716 $dolibarr_main_url_root = $_SERVER[
"SCRIPT_URI"];
717 } elseif (isset($_SERVER[
"SERVER_URL"]) && isset($_SERVER[
"DOCUMENT_URI"])) {
719 $dolibarr_main_url_root = $_SERVER[
"SERVER_URL"].$_SERVER[
"DOCUMENT_URI"];
722 $proto = ((!empty($_SERVER[
"HTTPS"]) && $_SERVER[
"HTTPS"] ==
'on') || (!empty($_SERVER[
'SERVER_PORT']) && $_SERVER[
'SERVER_PORT'] == 443)) ?
'https' :
'http';
723 if (!empty($_SERVER[
"HTTP_HOST"])) {
724 $serverport = $_SERVER[
"HTTP_HOST"];
725 } elseif (!empty($_SERVER[
"SERVER_NAME"])) {
726 $serverport = $_SERVER[
"SERVER_NAME"];
728 $serverport =
'localhost';
730 $dolibarr_main_url_root = $proto.
"://".$serverport.$_SERVER[
"SCRIPT_NAME"];
734 $dolibarr_main_url_root = dirname(dirname($dolibarr_main_url_root));
736 return $dolibarr_main_url_root;
747 return preg_replace(
'/__SUPERUSERLOGIN__/',
'root', $force_install_databaserootlogin);
758 return preg_replace(
'/__SUPERUSERPASSWORD__/',
'', $force_install_databaserootpass);