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;
340 $defaultCharacterSet = $db->getDefaultCharacterSetDatabase();
341 $defaultDBSortingCollation = $db->getDefaultCollationDatabase();
346 if ($defaultCharacterSet ==
'utf8mb4' || $defaultDBSortingCollation ==
'utf8mb4_unicode_ci') {
347 $defaultCharacterSet =
'utf8';
348 $defaultDBSortingCollation =
'utf8_unicode_ci';
351 print
'<input type="hidden" name="dolibarr_main_db_character_set" value="'.$defaultCharacterSet.
'">';
352 print
'<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.
'">';
353 $db_character_set = $defaultCharacterSet;
354 $db_collation = $defaultDBSortingCollation;
360if (!$error && $db->connected && $action ==
"set") {
362 if (is_array($_POST)) {
363 foreach ($_POST as $key => $value) {
364 if (!preg_match(
'/^db_pass/i', $key)) {
371 print
'<h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/gear.svg" width="20" alt="Configuration"> '.$langs->trans(
"ConfigurationFile").
'</h3>';
372 print
'<table cellspacing="0" width="100%" cellpadding="1" border="0">';
376 if (!is_dir($main_dir)) {
380 print $langs->trans(
"ErrorDirDoesNotExists", $main_dir).
'<br>';
381 print $langs->trans(
"ErrorWrongValueForParameter", $langs->transnoentitiesnoconv(
"WebPagesDirectory")).
'<br>';
382 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
384 print $langs->trans(
"Error");
398 if (!is_dir($main_data_dir)) {
402 if (!is_dir($main_data_dir)) {
403 print
"<tr><td>".$langs->trans(
"ErrorDirDoesNotExists", $main_data_dir);
404 print
' '.$langs->trans(
"YouMustCreateItAndAllowServerToWrite");
406 print
'<span class="error">'.$langs->trans(
"Error").
'</span>';
408 print
'<tr><td colspan="2"><br>'.$langs->trans(
"CorrectProblemAndReloadPage", $_SERVER[
'PHP_SELF'].
'?testget=ok').
'</td></tr>';
412 $pathhtaccess = $main_data_dir.
'/.htaccess';
413 if (!file_exists($pathhtaccess)) {
415 $handlehtaccess = @fopen($pathhtaccess,
'w');
416 if ($handlehtaccess) {
417 fwrite($handlehtaccess,
'Order allow,deny'.
"\n");
418 fwrite($handlehtaccess,
'Deny from all'.
"\n");
420 fclose($handlehtaccess);
427 $dir[] = $main_data_dir.
"/mycompany";
428 $dir[] = $main_data_dir.
"/medias";
429 $dir[] = $main_data_dir.
"/users";
430 $dir[] = $main_data_dir.
"/facture";
431 $dir[] = $main_data_dir.
"/propale";
432 $dir[] = $main_data_dir.
"/ficheinter";
433 $dir[] = $main_data_dir.
"/produit";
434 $dir[] = $main_data_dir.
"/doctemplates";
438 for ($i = 0; $i < $num; $i++) {
439 if (is_dir($dir[$i])) {
444 print
"Failed to create directory: ".$dir[$i];
446 print $langs->trans(
"Error");
455 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
458 $srcroot = $main_dir.
'/install/medias';
459 $destroot = $main_data_dir.
'/medias';
463 print
"<tr><td>".$langs->trans(
"ErrorDirDoesNotExists", $main_data_dir);
464 print
' '.$langs->trans(
"YouMustCreateItAndAllowServerToWrite");
466 print
'<span class="error">'.$langs->trans(
"Error").
'</span>';
468 print
'<tr><td colspan="2"><br>'.$langs->trans(
"CorrectProblemAndReloadPage", $_SERVER[
'PHP_SELF'].
'?testget=ok').
'</td></tr>';
471 $srcroot = $main_dir.
'/install/doctemplates';
472 $destroot = $main_data_dir.
'/doctemplates';
474 'contracts' =>
'contract',
475 'invoices' =>
'invoice',
477 'products' =>
'product',
478 'projects' =>
'project',
479 'proposals' =>
'proposal',
480 'shipments' =>
'shipment',
481 'supplier_proposals' =>
'supplier_proposal',
482 'tasks' =>
'task_summary',
483 'thirdparties' =>
'thirdparty',
484 'usergroups' =>
'usergroups',
487 foreach ($docs as $cursordir => $cursorfile) {
488 $src = $srcroot.
'/'.$cursordir.
'/template_'.$cursorfile.
'.odt';
489 $dirodt = $destroot.
'/'.$cursordir;
490 $dest = $dirodt.
'/template_'.$cursorfile.
'.odt';
493 $result =
dol_copy($src, $dest, 0, 0);
495 print
'<tr><td colspan="2"><br>'.$langs->trans(
'ErrorFailToCopyFile', $src, $dest).
'</td></tr>';
503 $main_db_prefix = (!empty($db_prefix) ? $db_prefix :
'llx_');
508 if (file_exists(
"$conffile")) {
512 @
dol_copy($conffile, $conffile.
'.old',
'0400');
521 conf($dolibarr_main_document_root);
524 print $langs->trans(
"ConfFileReload");
526 print
'<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
529 if (isset($db_create_user) && ($db_create_user ==
"1" || $db_create_user ==
"on")) {
533 $databasefortest = $conf->db->name;
534 if ($conf->db->type ==
'mysql' || $conf->db->type ==
'mysqli') {
535 $databasefortest =
'mysql';
536 } elseif ($conf->db->type ==
'pgsql') {
537 $databasefortest =
'postgres';
538 } elseif ($conf->db->type ==
'mssql') {
539 $databasefortest =
'master';
544 $db =
getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, $databasefortest, (
int) $conf->db->port);
547 print
'<div class="error">'.$db->error.
'</div>';
552 if ($db->connected) {
555 if (empty($dolibarr_main_db_pass)) {
558 print $langs->trans(
"UserCreation").
' : ';
559 print $dolibarr_main_db_user;
561 print
'<td>'.$langs->trans(
"Error").
": A password for database user is mandatory.</td></tr>";
564 $result = $db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
567 if ($databasefortest ==
'mysql') {
568 if (!in_array($dolibarr_main_db_host, array(
'127.0.0.1',
'::1',
'localhost',
'localhost.local'))) {
569 $resultbis = $db->DDLCreateUser(
'%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
573 if ($result > 0 && $resultbis > 0) {
575 print $langs->trans(
"UserCreation").
' : ';
576 print $dolibarr_main_db_user;
578 print
'<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
580 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS'
581 || $db->errno() ==
'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
582 || $db->errno() ==
'DB_ERROR_USER_ALREADY_EXISTS') {
585 print $langs->trans(
"UserCreation").
' : ';
586 print $dolibarr_main_db_user;
588 print
'<td>'.$langs->trans(
"LoginAlreadyExists").
'</td></tr>';
592 print $langs->trans(
"UserCreation").
' : ';
593 print $dolibarr_main_db_user;
595 print
'<td>'.$langs->trans(
"Error").
': '.$db->errno().
' '.$db->error().($db->error ?
'. '.$db->error :
'').
"</td></tr>";
603 print $langs->trans(
"UserCreation").
' : ';
604 print $dolibarr_main_db_user;
606 print
'<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
610 print
'<tr><td colspan="2"><br>';
611 print $langs->trans(
"YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
613 print $langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
614 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
624 if (!$error && (isset($db_create_database) && ($db_create_database ==
"1" || $db_create_database ==
"on"))) {
625 dolibarr_install_syslog(
"step1: create database: ".$dolibarr_main_db_name.
" ".$dolibarr_main_db_character_set.
" ".$dolibarr_main_db_collation.
" ".$dolibarr_main_db_user);
626 $newdb =
getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot,
'', (
int) $conf->db->port);
629 if ($newdb->connected) {
630 $result = $newdb->DDLCreateDb($dolibarr_main_db_name, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_db_user);
634 print $langs->trans(
"DatabaseCreation").
" (".$langs->trans(
"User").
" ".$userroot.
") : ";
635 print $dolibarr_main_db_name;
637 print
'<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
639 $newdb->select_db($dolibarr_main_db_name);
640 $check1 = $newdb->getDefaultCharacterSetDatabase();
641 $check2 = $newdb->getDefaultCollationDatabase();
649 print
'<tr><td colspan="2"><br>';
650 print $langs->trans(
"ErrorFailedToCreateDatabase", $dolibarr_main_db_name).
'<br>';
651 print $newdb->lasterror().
'<br>';
652 print $langs->trans(
"IfDatabaseExistsGoBackAndCheckCreate");
656 dolibarr_install_syslog(
'step1: failed to create database '.$dolibarr_main_db_name.
' '.$newdb->lasterrno().
' '.$newdb->lasterror(), LOG_ERR);
662 print $langs->trans(
"DatabaseCreation").
" (".$langs->trans(
"User").
" ".$userroot.
") : ";
663 print $dolibarr_main_db_name;
665 print
'<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
669 print
'<tr><td colspan="2"><br>';
670 print $langs->trans(
"YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
672 print $langs->trans(
"BecauseConnectionFailedParametersMayBeWrong").
'<br><br>';
673 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
683 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);
686 $db =
getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (
int) $conf->db->port);
688 if ($db->connected) {
691 print $langs->trans(
"ServerConnection").
" (".$langs->trans(
"User").
" ".$conf->db->user.
") : ";
692 print $dolibarr_main_db_host;
694 print
'<img src="../theme/eldy/img/tick.png" alt="Ok">';
698 if ($db->database_selected) {
701 print $langs->trans(
"DatabaseConnection").
" (".$langs->trans(
"User").
" ".$conf->db->user.
") : ";
702 print $dolibarr_main_db_name;
704 print
'<img src="../theme/eldy/img/tick.png" alt="Ok">';
709 dolibarr_install_syslog(
"step1: connection to database ".$conf->db->name.
" by user ".$conf->db->user.
" failed", LOG_ERR);
711 print $langs->trans(
"DatabaseConnection").
" (".$langs->trans(
"User").
" ".$conf->db->user.
") : ";
712 print $dolibarr_main_db_name;
714 print
'<img src="../theme/eldy/img/error.png" alt="Error">';
718 print
'<tr><td colspan="2"><br>';
719 print $langs->trans(
'CheckThatDatabasenameIsCorrect', $dolibarr_main_db_name).
'<br>';
720 print $langs->trans(
'IfAlreadyExistsCheckOption').
'<br>';
721 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
729 print $langs->trans(
"ServerConnection").
" (".$langs->trans(
"User").
" ".$conf->db->user.
") : ";
730 print $dolibarr_main_db_host;
732 print
'<img src="../theme/eldy/img/error.png" alt="Error">';
736 print
'<tr><td colspan="2"><br>';
737 print $langs->trans(
"ErrorConnection", $conf->db->host, $conf->db->name, $conf->db->user);
738 print $langs->trans(
'IfLoginDoesNotExistsCheckCreateUser').
'<br>';
739 print $langs->trans(
"ErrorGoBackAndCorrectParameters").
'<br><br>';
752<script
type=
"text/javascript">
759 document.getElementById(
'nextbutton').style.visibility=
"hidden";
760 document.getElementById(
'pleasewait').style.visibility=
"visible";
769if ($error && isset($argv[1])) {
776pFooter($error ? 1 : 0, $setuplang,
'jsinfo', 1);
793 $fp = @fopen(
"$mainfile",
"w");
796 fputs($fp,
'<?php'.
"\n");
797 fputs($fp,
"// Wrapper to include main into htdocs\n");
798 fputs($fp,
"include_once '".$main_dir.
"/main.inc.php';\n");
813 $fp = @fopen(
"$masterfile",
"w");
816 fputs($fp,
'<?php'.
"\n");
817 fputs($fp,
"// Wrapper to include master into htdocs\n");
818 fputs($fp,
"include_once '".$main_dir.
"/master.inc.php';\n");
832 global $conf, $langs;
833 global $main_url, $main_dir, $main_data_dir, $main_force_https, $main_use_alt_dir, $main_alt_dir_name, $main_db_prefix;
834 global $dolibarr_main_url_root, $dolibarr_main_document_root, $dolibarr_main_data_root, $dolibarr_main_db_host;
835 global $dolibarr_main_db_port, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass;
836 global $dolibarr_main_db_type, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_authentication;
837 global $dolibarr_main_distrib;
838 global $db_host, $db_port, $db_name, $db_user, $db_pass, $db_type, $db_character_set, $db_collation;
839 global $conffile, $conffiletoshow, $conffiletoshowshort;
840 global $force_dolibarr_lib_NUSOAP_PATH;
841 global $force_dolibarr_lib_TCPDF_PATH, $force_dolibarr_lib_FPDI_PATH;
842 global $force_dolibarr_lib_GEOIP_PATH;
843 global $force_dolibarr_lib_ODTPHP_PATH, $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP;
844 global $force_dolibarr_js_CKEDITOR, $force_dolibarr_js_JQUERY, $force_dolibarr_js_JQUERY_UI;
845 global $force_dolibarr_font_DOL_DEFAULT_TTF, $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD;
849 $key = md5(uniqid(mt_rand(),
true));
851 $fp = fopen(
"$conffile",
"w");
855 fputs($fp,
'<?php'.
"\n");
856 fputs($fp,
'//'.
"\n");
857 fputs($fp,
'// File generated by Dolibarr installer '.DOL_VERSION.
' on '.
dol_print_date(
dol_now(),
'').
"\n");
858 fputs($fp,
'//'.
"\n");
859 fputs($fp,
'// Take a look at conf.php.example file for an example of '.$conffiletoshowshort.
' file'.
"\n");
860 fputs($fp,
'// and explanations for all possibles parameters.'.
"\n");
861 fputs($fp,
'//'.
"\n");
863 fputs($fp,
'$dolibarr_main_url_root=\''.str_replace(
"'",
"\'", trim($main_url)).
'\';
');
866 fputs($fp, '$dolibarr_main_document_root=\
''.str_replace(
"'",
"\'", trim($main_dir)).
'\';
');
869 fputs($fp, $main_use_alt_dir.'$dolibarr_main_url_root_alt=\
''.str_replace(
"'",
"\'", trim(
"/".$main_alt_dir_name)).
'\';
');
872 fputs($fp, $main_use_alt_dir.'$dolibarr_main_document_root_alt=\
''.str_replace(
"'",
"\'", trim($main_dir.
"/".$main_alt_dir_name)).
'\';
');
875 fputs($fp, '$dolibarr_main_data_root=\
''.str_replace(
"'",
"\'", trim($main_data_dir)).
'\';
');
878 fputs($fp, '$dolibarr_main_db_host=\
''.str_replace(
"'",
"\'", trim($db_host)).
'\';
');
881 fputs($fp, '$dolibarr_main_db_port=\
''.str_replace(
"'",
"\'", trim($db_port)).
'\';
');
884 fputs($fp, '$dolibarr_main_db_name=\
''.str_replace(
"'",
"\'", trim($db_name)).
'\';
');
887 fputs($fp, '$dolibarr_main_db_prefix=\
''.str_replace(
"'",
"\'", trim($main_db_prefix)).
'\';
');
890 fputs($fp, '$dolibarr_main_db_user=\
''.str_replace(
"'",
"\'", trim($db_user)).
'\';
');
892 fputs($fp, '$dolibarr_main_db_pass=\
''.str_replace(
"'",
"\'", trim($db_pass)).
'\';
');
895 fputs($fp, '$dolibarr_main_db_type=\
''.str_replace(
"'",
"\'", trim($db_type)).
'\';
');
898 fputs($fp, '$dolibarr_main_db_character_set=\
''.str_replace(
"'",
"\'", trim($db_character_set)).
'\';
');
901 fputs($fp, '$dolibarr_main_db_collation=\
''.str_replace(
"'",
"\'", trim($db_collation)).
'\';
');
908 fputs($fp,
'$dolibarr_main_authentication=\'dolibarr\';');
911 fputs($fp,
'//$dolibarr_main_demo=\'autologin,autopass\';');
914 fputs($fp,
'// Security settings');
917 fputs($fp,
'$dolibarr_main_prod=\'0\';');
920 fputs($fp,
'$dolibarr_main_force_https=\''.$main_force_https.
'\';
');
923 fputs($fp, '$dolibarr_main_restrict_os_commands=\
'mysqldump, mysql, pg_dump, pgrestore, clamdscan, clamscan.exe\';');
926 fputs($fp,
'$dolibarr_nocsrfcheck=\'0\';');
929 fputs($fp,
'$dolibarr_main_instance_unique_id=\''.$key.
'\';
');
932 fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\
'0\';');
934 fputs($fp,
'$dolibarr_mailing_limit_sendbycli=\'0\';');
939 if (empty($force_dolibarr_lib_FPDF_PATH)) {
940 fputs($fp,
'//'); $force_dolibarr_lib_FPDF_PATH =
'';
942 fputs($fp,
'$dolibarr_lib_FPDF_PATH=\''.$force_dolibarr_lib_FPDF_PATH.
'\';
');
944 if (empty($force_dolibarr_lib_TCPDF_PATH)) {
947 fputs($fp,
'$dolibarr_lib_TCPDF_PATH=\''.$force_dolibarr_lib_TCPDF_PATH.
'\';
');
949 if (empty($force_dolibarr_lib_FPDI_PATH)) {
952 fputs($fp,
'$dolibarr_lib_FPDI_PATH=\''.$force_dolibarr_lib_FPDI_PATH.
'\';
');
954 if (empty($force_dolibarr_lib_TCPDI_PATH)) {
957 fputs($fp,
'$dolibarr_lib_TCPDI_PATH=\''.$force_dolibarr_lib_TCPDI_PATH.
'\';
');
959 if (empty($force_dolibarr_lib_GEOIP_PATH)) {
962 fputs($fp,
'$dolibarr_lib_GEOIP_PATH=\''.$force_dolibarr_lib_GEOIP_PATH.
'\';
');
964 if (empty($force_dolibarr_lib_NUSOAP_PATH)) {
967 fputs($fp,
'$dolibarr_lib_NUSOAP_PATH=\''.$force_dolibarr_lib_NUSOAP_PATH.
'\';
');
969 if (empty($force_dolibarr_lib_ODTPHP_PATH)) {
972 fputs($fp,
'$dolibarr_lib_ODTPHP_PATH=\''.$force_dolibarr_lib_ODTPHP_PATH.
'\';
');
974 if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) {
977 fputs($fp,
'$dolibarr_lib_ODTPHP_PATHTOPCLZIP=\''.$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP.
'\';
');
979 if (empty($force_dolibarr_js_CKEDITOR)) {
982 fputs($fp,
'$dolibarr_js_CKEDITOR=\''.$force_dolibarr_js_CKEDITOR.
'\';
');
984 if (empty($force_dolibarr_js_JQUERY)) {
987 fputs($fp,
'$dolibarr_js_JQUERY=\''.$force_dolibarr_js_JQUERY.
'\';
');
989 if (empty($force_dolibarr_js_JQUERY_UI)) {
992 fputs($fp,
'$dolibarr_js_JQUERY_UI=\''.$force_dolibarr_js_JQUERY_UI.
'\';
');
995 // Write params to overwrites default font path
997 if (empty($force_dolibarr_font_DOL_DEFAULT_TTF)) {
1000 fputs($fp,
'$dolibarr_font_DOL_DEFAULT_TTF=\''.$force_dolibarr_font_DOL_DEFAULT_TTF.
'\';
');
1002 if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) {
1005 fputs($fp,
'$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.
'\';
');
1009 fputs($fp, '$dolibarr_main_distrib=\
''.str_replace(
"'",
"\'", trim($dolibarr_main_distrib)).
'\';
');
1014 if (file_exists("$conffile")) {
1015 include $conffile; // force config reload, do not put include_once
1016 conf($dolibarr_main_document_root);
1019 print $langs->trans("SaveConfigurationFile");
1020 print ' <strong>
'.$conffile.'</strong>
';
1022 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.