29define(
'DONOTLOADCONF', 1);
35$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') : (empty($argv[1]) ?
'' : $argv[1]);
36$setuplang =
GETPOST(
'selectlang',
'aZ09', 3) ?
GETPOST(
'selectlang',
'aZ09', 3) : (empty($argv[2]) ?
'auto' : $argv[2]);
37$langs->setDefaultLang($setuplang);
39$langs->loadLangs(array(
"admin",
"install",
"errors"));
42$main_dir =
GETPOST(
'main_dir') ?
GETPOST(
'main_dir') : (empty($argv[3]) ?
'' : $argv[3]);
44$main_data_dir =
GETPOST(
'main_data_dir') ?
GETPOST(
'main_data_dir') : (empty($argv[4]) ? ($main_dir.
'/documents') : $argv[4]);
46$main_url =
GETPOST(
'main_url') ?
GETPOST(
'main_url') : (empty($argv[5]) ?
'' : $argv[5]);
48$userroot =
GETPOST(
'db_user_root',
'alpha') ?
GETPOST(
'db_user_root',
'alpha') : (empty($argv[6]) ?
'' : $argv[6]);
49$passroot =
GETPOST(
'db_pass_root',
'none') ?
GETPOST(
'db_pass_root',
'none') : (empty($argv[7]) ?
'' : $argv[7]);
51$db_type =
GETPOST(
'db_type',
'aZ09') ?
GETPOST(
'db_type',
'aZ09') : (empty($argv[8]) ?
'' : $argv[8]);
52$db_host =
GETPOST(
'db_host',
'alpha') ?
GETPOST(
'db_host',
'alpha') : (empty($argv[9]) ?
'' : $argv[9]);
53$db_name =
GETPOST(
'db_name',
'aZ09') ?
GETPOST(
'db_name',
'aZ09') : (empty($argv[10]) ?
'' : $argv[10]);
54$db_user =
GETPOST(
'db_user',
'alpha') ?
GETPOST(
'db_user',
'alpha') : (empty($argv[11]) ?
'' : $argv[11]);
55$db_pass =
GETPOST(
'db_pass',
'none') ?
GETPOST(
'db_pass',
'none') : (empty($argv[12]) ?
'' : $argv[12]);
56$db_port =
GETPOST(
'db_port',
'int') ?
GETPOST(
'db_port',
'int') : (empty($argv[13]) ?
'' : $argv[13]);
57$db_prefix =
GETPOST(
'db_prefix',
'aZ09') ?
GETPOST(
'db_prefix',
'aZ09') : (empty($argv[14]) ?
'' : $argv[14]);
58$db_create_database =
GETPOST(
'db_create_database',
'alpha') ?
GETPOST(
'db_create_database',
'alpha') : (empty($argv[15]) ?
'' : $argv[15]);
59$db_create_user =
GETPOST(
'db_create_user',
'alpha') ?
GETPOST(
'db_create_user',
'alpha') : (empty($argv[16]) ?
'' : $argv[16]);
61$main_force_https = ((
GETPOST(
"main_force_https",
'alpha') && (
GETPOST(
"main_force_https",
'alpha') ==
"on" ||
GETPOST(
"main_force_https",
'alpha') == 1)) ?
'1' :
'0');
63$main_use_alt_dir = ((
GETPOST(
"main_use_alt_dir",
'alpha') ==
'' || (
GETPOST(
"main_use_alt_dir",
'alpha') ==
"on" ||
GETPOST(
"main_use_alt_dir",
'alpha') == 1)) ?
'' :
'//');
65$main_alt_dir_name = ((
GETPOST(
"main_alt_dir_name",
'alpha') &&
GETPOST(
"main_alt_dir_name",
'alpha') !=
'') ?
GETPOST(
"main_alt_dir_name",
'alpha') :
'custom');
67$dolibarr_main_distrib =
'standard';
72$_SESSION[
'dol_save_pass'] = $db_pass;
76$useforcedwizard =
false;
77$forcedfile =
"./install.forced.php";
78if ($conffile ==
"/etc/dolibarr/conf.php") {
79 $forcedfile =
"/etc/dolibarr/install.forced.php";
81if (@file_exists($forcedfile)) {
82 $useforcedwizard =
true;
83 include_once $forcedfile;
85 if ($force_install_noedit) {
87 if (!empty($argv[3])) {
90 if (!empty($force_install_main_data_root)) {
91 $main_data_dir = $force_install_main_data_root;
95 if (!empty($argv[4])) {
96 $main_data_dir = $argv[4];
99 if (!empty($argv[5])) {
100 $main_url = $argv[5];
103 if (!empty($force_install_databaserootlogin)) {
106 if (!empty($argv[6])) {
107 $userroot = $argv[6];
109 if (!empty($force_install_databaserootpass)) {
112 if (!empty($argv[7])) {
113 $passroot = $argv[7];
116 if ($force_install_noedit == 2) {
117 if (!empty($force_install_type)) {
118 $db_type = $force_install_type;
120 if (!empty($force_install_dbserver)) {
121 $db_host = $force_install_dbserver;
123 if (!empty($force_install_database)) {
124 $db_name = $force_install_database;
126 if (!empty($force_install_databaselogin)) {
127 $db_user = $force_install_databaselogin;
129 if (!empty($force_install_databasepass)) {
130 $db_pass = $force_install_databasepass;
132 if (!empty($force_install_port)) {
133 $db_port = $force_install_port;
135 if (!empty($force_install_prefix)) {
136 $db_prefix = $force_install_prefix;
138 if (!empty($force_install_createdatabase)) {
139 $db_create_database = $force_install_createdatabase;
141 if (!empty($force_install_createuser)) {
142 $db_create_user = $force_install_createuser;
144 if (!empty($force_install_mainforcehttps)) {
145 $main_force_https = $force_install_mainforcehttps;
149 if (!empty($force_install_distrib)) {
150 $dolibarr_main_distrib = $force_install_distrib;
164pHeader($langs->trans(
"ConfigurationFile"),
"step2");
167if (!is_writable($conffile)) {
168 print $langs->trans(
"ConfFileIsNotWritable", $conffiletoshow);
169 pFooter(1, $setuplang,
'jscheckparam');
176if (empty($db_type)) {
177 print
'<div class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DatabaseType")).
'</div>';
180 $is_sqlite = ($db_type ===
'sqlite' || $db_type ===
'sqlite3');
182if (empty($db_host) && !$is_sqlite) {
183 print
'<div class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Server")).
'</div>';
186if (empty($db_name)) {
187 print
'<div class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DatabaseName")).
'</div>';
190if (empty($db_user) && !$is_sqlite) {
191 print
'<div class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Login")).
'</div>';
194if (!empty($db_port) && !is_numeric($db_port)) {
195 print
'<div class="error">'.$langs->trans(
"ErrorBadValueForParameter", $db_port, $langs->transnoentities(
"Port")).
'</div>';
198if (!empty($db_prefix) && !preg_match(
'/^[a-z0-9]+_$/i', $db_prefix)) {
199 print
'<div class="error">'.$langs->trans(
"ErrorBadValueForParameter", $db_prefix, $langs->transnoentities(
"DatabasePrefix")).
'</div>';
205if (substr($main_dir,
dol_strlen($main_dir) - 1) ==
"/") {
206 $main_dir = substr($main_dir, 0,
dol_strlen($main_dir) - 1);
210if (!empty($main_url) && substr($main_url,
dol_strlen($main_url) - 1) ==
"/") {
211 $main_url = substr($main_url, 0,
dol_strlen($main_url) - 1);
215 print
'<div class="error">'.$langs->trans(
"ErrorBadValueForParameter", $main_dir, $langs->transnoentitiesnoconv(
"WebPagesDirectory")).
'</div>';
218 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
224 $result = @include_once $main_dir.
"/core/db/".$db_type.
'.class.php';
227 if (!empty($db_create_database) && !$userroot) {
228 print
'<div class="error">'.$langs->trans(
"YouAskDatabaseCreationSoDolibarrNeedToConnect", $db_name).
'</div>';
230 print $langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
231 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
234 if (!empty($db_create_user) && !$userroot) {
235 print
'<div class="error">'.$langs->trans(
"YouAskLoginCreationSoDolibarrNeedToConnect", $db_user).
'</div>';
237 print $langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
238 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
243 if (!$error && (!empty($db_create_database) || !empty($db_create_user))) {
244 $databasefortest = $db_name;
245 if (!empty($db_create_database)) {
246 if ($db_type ==
'mysql' || $db_type ==
'mysqli') {
247 $databasefortest =
'mysql';
248 } elseif ($db_type ==
'pgsql') {
249 $databasefortest =
'postgres';
251 $databasefortest =
'master';
255 $db =
getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, (
int) $db_port);
257 dol_syslog(
"databasefortest=".$databasefortest.
" connected=".$db->connected.
" database_selected=".$db->database_selected, LOG_DEBUG);
260 if (empty($db_create_database) && $db->connected && !$db->database_selected) {
261 print
'<div class="error">'.$langs->trans(
"ErrorConnectedButDatabaseNotFound", $db_name).
'</div>';
263 if (!$db->connected) {
264 print $langs->trans(
"IfDatabaseNotExistsGoBackAndUncheckCreate").
'<br><br>';
266 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
268 } elseif ($db->error && !(!empty($db_create_database) && $db->connected)) {
270 if ($db->error ==
"No such file or directory") {
271 print
'<div class="error">'.$langs->trans(
"ErrorToConnectToMysqlCheckInstance").
'</div>';
273 print
'<div class="error">'.$db->error.
'</div>';
275 if (!$db->connected) {
276 print $langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
279 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
286 if (!$error && (empty($db_create_database) && empty($db_create_user))) {
287 $db =
getDoliDBInstance($db_type, $db_host, $db_user, $db_pass, $db_name, (
int) $db_port);
290 print
'<div class="error">'.$db->error.
'</div>';
291 if (!$db->connected) {
292 print $langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
295 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
301 print
"<br>\nFailed to include_once(\"".$main_dir.
"/core/db/".$db_type.
".class.php\")<br>\n";
302 print
'<div class="error">'.$langs->trans(
"ErrorWrongValueForParameter", $langs->transnoentities(
"WebPagesDirectory")).
'</div>';
304 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
310 print $db->lasterror();
312 if (isset($db) && !$db->connected) {
313 print
'<br>'.$langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
315 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
319if (!$error && $db->connected) {
320 if (!empty($db_create_database)) {
321 $result = $db->select_db($db_name);
323 print
'<div class="error">'.$langs->trans(
"ErrorDatabaseAlreadyExists", $db_name).
'</div>';
324 print $langs->trans(
"IfDatabaseExistsGoBackAndCheckCreate").
'<br><br>';
325 print $langs->trans(
"ErrorGoBackAndCorrectParameters");
332if (!$error && $db->connected) {
333 if (!empty($db_create_database)) {
336 $defaultCharacterSet = $db->forcecharset;
337 $defaultDBSortingCollation = $db->forcecollate;
339 $defaultCharacterSet = $db->getDefaultCharacterSetDatabase();
340 $defaultDBSortingCollation = $db->getDefaultCollationDatabase();
344 if ($defaultCharacterSet ==
'utf8mb3' || $defaultDBSortingCollation ==
'utf8mb3_unicode_ci') {
345 $defaultCharacterSet =
'utf8';
346 $defaultDBSortingCollation =
'utf8_unicode_ci';
350 if ($defaultCharacterSet ==
'utf8mb4' || $defaultDBSortingCollation ==
'utf8mb4_unicode_ci') {
351 $defaultCharacterSet =
'utf8';
352 $defaultDBSortingCollation =
'utf8_unicode_ci';
355 print
'<input type="hidden" name="dolibarr_main_db_character_set" value="'.$defaultCharacterSet.
'">';
356 print
'<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.
'">';
357 $db_character_set = $defaultCharacterSet;
358 $db_collation = $defaultDBSortingCollation;
364if (!$error && $db->connected && $action ==
"set") {
366 if (is_array($_POST)) {
367 foreach ($_POST as $key => $value) {
368 if (!preg_match(
'/^db_pass/i', $key)) {
375 print
'<h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/gear.svg" width="20" alt="Configuration"> '.$langs->trans(
"ConfigurationFile").
'</h3>';
376 print
'<table cellspacing="0" width="100%" cellpadding="1" border="0">';
380 if (!is_dir($main_dir)) {
384 print $langs->trans(
"ErrorDirDoesNotExists", $main_dir).
'<br>';
385 print $langs->trans(
"ErrorWrongValueForParameter", $langs->transnoentitiesnoconv(
"WebPagesDirectory")).
'<br>';
386 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
388 print $langs->trans(
"Error");
402 if (!is_dir($main_data_dir)) {
406 if (!is_dir($main_data_dir)) {
407 print
"<tr><td>".$langs->trans(
"ErrorDirDoesNotExists", $main_data_dir);
408 print
' '.$langs->trans(
"YouMustCreateItAndAllowServerToWrite");
410 print
'<span class="error">'.$langs->trans(
"Error").
'</span>';
412 print
'<tr><td colspan="2"><br>'.$langs->trans(
"CorrectProblemAndReloadPage", $_SERVER[
'PHP_SELF'].
'?testget=ok').
'</td></tr>';
416 $pathhtaccess = $main_data_dir.
'/.htaccess';
417 if (!file_exists($pathhtaccess)) {
419 $handlehtaccess = @fopen($pathhtaccess,
'w');
420 if ($handlehtaccess) {
421 fwrite($handlehtaccess,
'Order allow,deny'.
"\n");
422 fwrite($handlehtaccess,
'Deny from all'.
"\n");
424 fclose($handlehtaccess);
431 $dir[] = $main_data_dir.
"/mycompany";
432 $dir[] = $main_data_dir.
"/medias";
433 $dir[] = $main_data_dir.
"/users";
434 $dir[] = $main_data_dir.
"/facture";
435 $dir[] = $main_data_dir.
"/propale";
436 $dir[] = $main_data_dir.
"/ficheinter";
437 $dir[] = $main_data_dir.
"/produit";
438 $dir[] = $main_data_dir.
"/doctemplates";
442 for ($i = 0; $i < $num; $i++) {
443 if (is_dir($dir[$i])) {
448 print
"Failed to create directory: ".$dir[$i];
450 print $langs->trans(
"Error");
459 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
462 $srcroot = $main_dir.
'/install/medias';
463 $destroot = $main_data_dir.
'/medias';
467 print
"<tr><td>".$langs->trans(
"ErrorDirDoesNotExists", $main_data_dir);
468 print
' '.$langs->trans(
"YouMustCreateItAndAllowServerToWrite");
470 print
'<span class="error">'.$langs->trans(
"Error").
'</span>';
472 print
'<tr><td colspan="2"><br>'.$langs->trans(
"CorrectProblemAndReloadPage", $_SERVER[
'PHP_SELF'].
'?testget=ok').
'</td></tr>';
475 $srcroot = $main_dir.
'/install/doctemplates';
476 $destroot = $main_data_dir.
'/doctemplates';
478 'contracts' =>
'contract',
479 'invoices' =>
'invoice',
481 'products' =>
'product',
482 'projects' =>
'project',
483 'proposals' =>
'proposal',
484 'shipments' =>
'shipment',
485 'supplier_proposals' =>
'supplier_proposal',
486 'tasks' =>
'task_summary',
487 'thirdparties' =>
'thirdparty',
488 'usergroups' =>
'usergroups',
491 foreach ($docs as $cursordir => $cursorfile) {
492 $src = $srcroot.
'/'.$cursordir.
'/template_'.$cursorfile.
'.odt';
493 $dirodt = $destroot.
'/'.$cursordir;
494 $dest = $dirodt.
'/template_'.$cursorfile.
'.odt';
497 $result =
dol_copy($src, $dest, 0, 0);
499 print
'<tr><td colspan="2"><br>'.$langs->trans(
'ErrorFailToCopyFile', $src, $dest).
'</td></tr>';
507 $main_db_prefix = (!empty($db_prefix) ? $db_prefix :
'llx_');
512 if (file_exists(
"$conffile")) {
516 @
dol_copy($conffile, $conffile.
'.old',
'0400');
525 conf($dolibarr_main_document_root);
528 print $langs->trans(
"ConfFileReload");
530 print
'<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
533 if (isset($db_create_user) && ($db_create_user ==
"1" || $db_create_user ==
"on")) {
537 $databasefortest = $conf->db->name;
538 if ($conf->db->type ==
'mysql' || $conf->db->type ==
'mysqli') {
539 $databasefortest =
'mysql';
540 } elseif ($conf->db->type ==
'pgsql') {
541 $databasefortest =
'postgres';
542 } elseif ($conf->db->type ==
'mssql') {
543 $databasefortest =
'master';
548 $db =
getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, $databasefortest, (
int) $conf->db->port);
551 print
'<div class="error">'.$db->error.
'</div>';
556 if ($db->connected) {
559 if (empty($dolibarr_main_db_pass)) {
562 print $langs->trans(
"UserCreation").
' : ';
563 print $dolibarr_main_db_user;
565 print
'<td>'.$langs->trans(
"Error").
": A password for database user is mandatory.</td></tr>";
568 $result = $db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
571 if ($databasefortest ==
'mysql') {
572 if (!in_array($dolibarr_main_db_host, array(
'127.0.0.1',
'::1',
'localhost',
'localhost.local'))) {
573 $resultbis = $db->DDLCreateUser(
'%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
577 if ($result > 0 && $resultbis > 0) {
579 print $langs->trans(
"UserCreation").
' : ';
580 print $dolibarr_main_db_user;
582 print
'<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
584 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS'
585 || $db->errno() ==
'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
586 || $db->errno() ==
'DB_ERROR_USER_ALREADY_EXISTS') {
589 print $langs->trans(
"UserCreation").
' : ';
590 print $dolibarr_main_db_user;
592 print
'<td>'.$langs->trans(
"LoginAlreadyExists").
'</td></tr>';
596 print $langs->trans(
"UserCreation").
' : ';
597 print $dolibarr_main_db_user;
599 print
'<td>'.$langs->trans(
"Error").
': '.$db->errno().
' '.$db->error().($db->error ?
'. '.$db->error :
'').
"</td></tr>";
607 print $langs->trans(
"UserCreation").
' : ';
608 print $dolibarr_main_db_user;
610 print
'<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
614 print
'<tr><td colspan="2"><br>';
615 print $langs->trans(
"YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
617 print $langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
618 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
628 if (!$error && (isset($db_create_database) && ($db_create_database ==
"1" || $db_create_database ==
"on"))) {
629 dolibarr_install_syslog(
"step1: create database: ".$dolibarr_main_db_name.
" ".$dolibarr_main_db_character_set.
" ".$dolibarr_main_db_collation.
" ".$dolibarr_main_db_user);
630 $newdb =
getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot,
'', (
int) $conf->db->port);
633 if ($newdb->connected) {
634 $result = $newdb->DDLCreateDb($dolibarr_main_db_name, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_db_user);
638 print $langs->trans(
"DatabaseCreation").
" (".$langs->trans(
"User").
" ".$userroot.
") : ";
639 print $dolibarr_main_db_name;
641 print
'<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
643 $newdb->select_db($dolibarr_main_db_name);
644 $check1 = $newdb->getDefaultCharacterSetDatabase();
645 $check2 = $newdb->getDefaultCollationDatabase();
653 print
'<tr><td colspan="2"><br>';
654 print $langs->trans(
"ErrorFailedToCreateDatabase", $dolibarr_main_db_name).
'<br>';
655 print $newdb->lasterror().
'<br>';
656 print $langs->trans(
"IfDatabaseExistsGoBackAndCheckCreate");
660 dolibarr_install_syslog(
'step1: failed to create database '.$dolibarr_main_db_name.
' '.$newdb->lasterrno().
' '.$newdb->lasterror(), LOG_ERR);
666 print $langs->trans(
"DatabaseCreation").
" (".$langs->trans(
"User").
" ".$userroot.
") : ";
667 print $dolibarr_main_db_name;
669 print
'<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
673 print
'<tr><td colspan="2"><br>';
674 print $langs->trans(
"YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
676 print $langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
677 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
687 dolibarr_install_syslog(
"step1: connection type=".$conf->db->type.
" on host=".$conf->db->host.
" port=".$conf->db->port.
" user=".$conf->db->user.
" name=".$conf->db->name);
690 $db =
getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (
int) $conf->db->port);
692 if ($db->connected) {
695 print $langs->trans(
"ServerConnection").
" (".$langs->trans(
"User").
" ".$conf->db->user.
") : ";
696 print $dolibarr_main_db_host;
698 print
'<img src="../theme/eldy/img/tick.png" alt="Ok">';
702 if ($db->database_selected) {
705 print $langs->trans(
"DatabaseConnection").
" (".$langs->trans(
"User").
" ".$conf->db->user.
") : ";
706 print $dolibarr_main_db_name;
708 print
'<img src="../theme/eldy/img/tick.png" alt="Ok">';
713 dolibarr_install_syslog(
"step1: connection to database ".$conf->db->name.
" by user ".$conf->db->user.
" failed", LOG_ERR);
715 print $langs->trans(
"DatabaseConnection").
" (".$langs->trans(
"User").
" ".$conf->db->user.
") : ";
716 print $dolibarr_main_db_name;
718 print
'<img src="../theme/eldy/img/error.png" alt="Error">';
722 print
'<tr><td colspan="2"><br>';
723 print $langs->trans(
'CheckThatDatabasenameIsCorrect', $dolibarr_main_db_name).
'<br>';
724 print $langs->trans(
'IfAlreadyExistsCheckOption').
'<br>';
725 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
733 print $langs->trans(
"ServerConnection").
" (".$langs->trans(
"User").
" ".$conf->db->user.
") : ";
734 print $dolibarr_main_db_host;
736 print
'<img src="../theme/eldy/img/error.png" alt="Error">';
740 print
'<tr><td colspan="2"><br>';
741 print $langs->trans(
"ErrorConnection", $conf->db->host, $conf->db->name, $conf->db->user);
742 print $langs->trans(
'IfLoginDoesNotExistsCheckCreateUser').
'<br>';
743 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
756<script
type=
"text/javascript">
763 document.getElementById(
'nextbutton').style.visibility=
"hidden";
764 document.getElementById(
'pleasewait').style.visibility=
"visible";
773if ($error && isset($argv[1])) {
780pFooter($error ? 1 : 0, $setuplang,
'jsinfo', 1);
797 $fp = @fopen(
"$mainfile",
"w");
800 fputs($fp,
'<?php'.
"\n");
801 fputs($fp,
"// Wrapper to include main into htdocs\n");
802 fputs($fp,
"include_once '".$main_dir.
"/main.inc.php';\n");
817 $fp = @fopen(
"$masterfile",
"w");
820 fputs($fp,
'<?php'.
"\n");
821 fputs($fp,
"// Wrapper to include master into htdocs\n");
822 fputs($fp,
"include_once '".$main_dir.
"/master.inc.php';\n");
836 global $conf, $langs;
837 global $main_url, $main_dir, $main_data_dir, $main_force_https, $main_use_alt_dir, $main_alt_dir_name, $main_db_prefix;
838 global $dolibarr_main_url_root, $dolibarr_main_document_root, $dolibarr_main_data_root, $dolibarr_main_db_host;
839 global $dolibarr_main_db_port, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass;
840 global $dolibarr_main_db_type, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_authentication;
841 global $dolibarr_main_distrib;
842 global $db_host, $db_port, $db_name, $db_user, $db_pass, $db_type, $db_character_set, $db_collation;
843 global $conffile, $conffiletoshow, $conffiletoshowshort;
844 global $force_dolibarr_lib_NUSOAP_PATH;
845 global $force_dolibarr_lib_TCPDF_PATH, $force_dolibarr_lib_FPDI_PATH;
846 global $force_dolibarr_lib_GEOIP_PATH;
847 global $force_dolibarr_lib_ODTPHP_PATH, $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP;
848 global $force_dolibarr_js_CKEDITOR, $force_dolibarr_js_JQUERY, $force_dolibarr_js_JQUERY_UI;
849 global $force_dolibarr_font_DOL_DEFAULT_TTF, $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD;
853 $key = md5(uniqid(mt_rand(),
true));
855 $fp = fopen(
"$conffile",
"w");
859 fputs($fp,
'<?php'.
"\n");
860 fputs($fp,
'//'.
"\n");
861 fputs($fp,
'// File generated by Dolibarr installer '.DOL_VERSION.
' on '.
dol_print_date(
dol_now(),
'').
"\n");
862 fputs($fp,
'//'.
"\n");
863 fputs($fp,
'// Take a look at conf.php.example file for an example of '.$conffiletoshowshort.
' file'.
"\n");
864 fputs($fp,
'// and explanations for all possibles parameters.'.
"\n");
865 fputs($fp,
'//'.
"\n");
867 fputs($fp,
'$dolibarr_main_url_root=\''.str_replace(
"'",
"\'", trim($main_url)).
'\';
');
870 fputs($fp, '$dolibarr_main_document_root=\
''.str_replace(
"'",
"\'", trim($main_dir)).
'\';
');
873 fputs($fp, $main_use_alt_dir.'$dolibarr_main_url_root_alt=\
''.str_replace(
"'",
"\'", trim(
"/".$main_alt_dir_name)).
'\';
');
876 fputs($fp, $main_use_alt_dir.'$dolibarr_main_document_root_alt=\
''.str_replace(
"'",
"\'", trim($main_dir.
"/".$main_alt_dir_name)).
'\';
');
879 fputs($fp, '$dolibarr_main_data_root=\
''.str_replace(
"'",
"\'", trim($main_data_dir)).
'\';
');
882 fputs($fp, '$dolibarr_main_db_host=\
''.str_replace(
"'",
"\'", trim($db_host)).
'\';
');
885 fputs($fp, '$dolibarr_main_db_port=\
''.str_replace(
"'",
"\'", trim($db_port)).
'\';
');
888 fputs($fp, '$dolibarr_main_db_name=\
''.str_replace(
"'",
"\'", trim($db_name)).
'\';
');
891 fputs($fp, '$dolibarr_main_db_prefix=\
''.str_replace(
"'",
"\'", trim($main_db_prefix)).
'\';
');
894 fputs($fp, '$dolibarr_main_db_user=\
''.str_replace(
"'",
"\'", trim($db_user)).
'\';
');
896 fputs($fp, '$dolibarr_main_db_pass=\
''.str_replace(
"'",
"\'", trim($db_pass)).
'\';
');
899 fputs($fp, '$dolibarr_main_db_type=\
''.str_replace(
"'",
"\'", trim($db_type)).
'\';
');
902 fputs($fp, '$dolibarr_main_db_character_set=\
''.str_replace(
"'",
"\'", trim($db_character_set)).
'\';
');
905 fputs($fp, '$dolibarr_main_db_collation=\
''.str_replace(
"'",
"\'", trim($db_collation)).
'\';
');
912 fputs($fp,
'$dolibarr_main_authentication=\'dolibarr\';');
915 fputs($fp,
'//$dolibarr_main_demo=\'autologin,autopass\';');
918 fputs($fp,
'// Security settings');
921 fputs($fp,
'$dolibarr_main_prod=\'0\';');
924 fputs($fp,
'$dolibarr_main_force_https=\''.$main_force_https.
'\';
');
927 fputs($fp, '$dolibarr_main_restrict_os_commands=\
'mariadb-dump, mariadb, mysqldump, mysql, pg_dump, pgrestore, clamdscan, clamscan.exe\';');
930 fputs($fp,
'$dolibarr_nocsrfcheck=\'0\';');
933 fputs($fp,
'$dolibarr_main_instance_unique_id=\''.$key.
'\';
');
936 fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\
'0\';');
938 fputs($fp,
'$dolibarr_mailing_limit_sendbycli=\'0\';');
943 if (empty($force_dolibarr_lib_FPDF_PATH)) {
945 $force_dolibarr_lib_FPDF_PATH =
'';
947 fputs($fp,
'$dolibarr_lib_FPDF_PATH=\''.$force_dolibarr_lib_FPDF_PATH.
'\';
');
949 if (empty($force_dolibarr_lib_TCPDF_PATH)) {
951 $force_dolibarr_lib_TCPDF_PATH =
'';
953 fputs($fp,
'$dolibarr_lib_TCPDF_PATH=\''.$force_dolibarr_lib_TCPDF_PATH.
'\';
');
955 if (empty($force_dolibarr_lib_FPDI_PATH)) {
957 $force_dolibarr_lib_FPDI_PATH =
'';
959 fputs($fp,
'$dolibarr_lib_FPDI_PATH=\''.$force_dolibarr_lib_FPDI_PATH.
'\';
');
961 if (empty($force_dolibarr_lib_TCPDI_PATH)) {
963 $force_dolibarr_lib_TCPDI_PATH =
'';
965 fputs($fp,
'$dolibarr_lib_TCPDI_PATH=\''.$force_dolibarr_lib_TCPDI_PATH.
'\';
');
967 if (empty($force_dolibarr_lib_GEOIP_PATH)) {
969 $force_dolibarr_lib_GEOIP_PATH =
'';
971 fputs($fp,
'$dolibarr_lib_GEOIP_PATH=\''.$force_dolibarr_lib_GEOIP_PATH.
'\';
');
973 if (empty($force_dolibarr_lib_NUSOAP_PATH)) {
975 $force_dolibarr_lib_NUSOAP_PATH =
'';
977 fputs($fp,
'$dolibarr_lib_NUSOAP_PATH=\''.$force_dolibarr_lib_NUSOAP_PATH.
'\';
');
979 if (empty($force_dolibarr_lib_ODTPHP_PATH)) {
981 $force_dolibarr_lib_ODTPHP_PATH =
'';
983 fputs($fp,
'$dolibarr_lib_ODTPHP_PATH=\''.$force_dolibarr_lib_ODTPHP_PATH.
'\';
');
985 if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) {
987 $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP =
'';
989 fputs($fp,
'$dolibarr_lib_ODTPHP_PATHTOPCLZIP=\''.$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP.
'\';
');
991 if (empty($force_dolibarr_js_CKEDITOR)) {
993 $force_dolibarr_js_CKEDITOR =
'';
995 fputs($fp,
'$dolibarr_js_CKEDITOR=\''.$force_dolibarr_js_CKEDITOR.
'\';
');
997 if (empty($force_dolibarr_js_JQUERY)) {
999 $force_dolibarr_js_JQUERY =
'';
1001 fputs($fp,
'$dolibarr_js_JQUERY=\''.$force_dolibarr_js_JQUERY.
'\';
');
1003 if (empty($force_dolibarr_js_JQUERY_UI)) {
1005 $force_dolibarr_js_JQUERY_UI =
'';
1007 fputs($fp,
'$dolibarr_js_JQUERY_UI=\''.$force_dolibarr_js_JQUERY_UI.
'\';
');
1010 // Write params to overwrites default font path
1012 if (empty($force_dolibarr_font_DOL_DEFAULT_TTF)) {
1014 $force_dolibarr_font_DOL_DEFAULT_TTF =
'';
1016 fputs($fp,
'$dolibarr_font_DOL_DEFAULT_TTF=\''.$force_dolibarr_font_DOL_DEFAULT_TTF.
'\';
');
1018 if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) {
1020 $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD =
'';
1022 fputs($fp,
'$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.
'\';
');
1026 fputs($fp, '$dolibarr_main_distrib=\
''.str_replace(
"'",
"\'", trim($dolibarr_main_distrib)).
'\';
');
1031 if (file_exists("$conffile")) {
1032 include $conffile; // force config reload, do not put include_once
1033 conf($dolibarr_main_document_root);
1036 print $langs->trans("SaveConfigurationFile");
1037 print ' <strong>
'.$conffile.'</strong>
';
1039 print '<img src=
"../theme/eldy/img/tick.png" alt=
"Ok">
';
dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0, $excludefileext=null)
Copy a dir to another dir.
dol_is_dir($folder)
Test if filename is a directory.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
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.
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.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
if( $ret) write_main_file($mainfile, $main_dir)
Create main file.
write_conf_file($conffile)
Save configuration file.
write_master_file($masterfile, $main_dir)
Create master file.