dolibarr  13.0.2
step1.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
5  * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
6  * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
7  * Copyright (C) 2015-2016 RaphaĆ«l Doursenaud <rdoursenaud@gpcsolutions.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
29 define('DONOTLOADCONF', 1); // To avoid loading conf by file inc.php
30 
31 include 'inc.php';
32 
33 global $langs;
34 
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);
38 
39 $langs->loadLangs(array("admin", "install", "errors"));
40 
41 // Dolibarr pages directory
42 $main_dir = GETPOST('main_dir') ?GETPOST('main_dir') : (empty($argv[3]) ? '' : $argv[3]);
43 // Directory for generated documents (invoices, orders, ecm, etc...)
44 $main_data_dir = GETPOST('main_data_dir') ? GETPOST('main_data_dir') : (empty($argv[4]) ? ($main_dir.'/documents') : $argv[4]);
45 // Dolibarr root URL
46 $main_url = GETPOST('main_url') ?GETPOST('main_url') : (empty($argv[5]) ? '' : $argv[5]);
47 // Database login information
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]);
50 // Database server
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]);
60 // Force https
61 $main_force_https = ((GETPOST("main_force_https", 'alpha') && (GETPOST("main_force_https", 'alpha') == "on" || GETPOST("main_force_https", 'alpha') == 1)) ? '1' : '0');
62 // Use alternative directory
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)) ? '' : '//');
64 // Alternative root directory name
65 $main_alt_dir_name = ((GETPOST("main_alt_dir_name", 'alpha') && GETPOST("main_alt_dir_name", 'alpha') != '') ? GETPOST("main_alt_dir_name", 'alpha') : 'custom');
66 
67 $dolibarr_main_distrib = 'standard';
68 
69 session_start(); // To be able to keep info into session (used for not losing password during navigation. The password must not transit through parameters)
70 
71 // Save a flag to tell to restore input value if we go back
72 $_SESSION['dol_save_pass'] = $db_pass;
73 //$_SESSION['dol_save_passroot']=$passroot;
74 
75 // Now we load forced values from install.forced.php file.
76 $useforcedwizard = false;
77 $forcedfile = "./install.forced.php";
78 if ($conffile == "/etc/dolibarr/conf.php") $forcedfile = "/etc/dolibarr/install.forced.php";
79 if (@file_exists($forcedfile)) {
80  $useforcedwizard = true;
81  include_once $forcedfile;
82  // If forced install is enabled, replace the post values. These are empty because form fields are disabled.
83  if ($force_install_noedit) {
85  if (!empty($argv[1])) $main_dir = $argv[1]; // override when executing the script in command line
86  if (!empty($force_install_main_data_root)) {
87  $main_data_dir = $force_install_main_data_root;
88  } else {
89  $main_data_dir = detect_dolibarr_main_data_root($main_dir);
90  }
91  $main_url = detect_dolibarr_main_url_root();
92 
93  if (!empty($force_install_databaserootlogin)) {
94  $userroot = parse_database_login($force_install_databaserootlogin);
95  }
96  if (!empty($force_install_databaserootpass)) {
97  $passroot = parse_database_pass($force_install_databaserootpass);
98  }
99  }
100  if ($force_install_noedit == 2) {
101  if (!empty($force_install_type)) {
102  $db_type = $force_install_type;
103  }
104  if (!empty($force_install_dbserver)) {
105  $db_host = $force_install_dbserver;
106  }
107  if (!empty($force_install_database)) {
108  $db_name = $force_install_database;
109  }
110  if (!empty($force_install_databaselogin)) {
111  $db_user = $force_install_databaselogin;
112  }
113  if (!empty($force_install_databasepass)) {
114  $db_pass = $force_install_databasepass;
115  }
116  if (!empty($force_install_port)) {
117  $db_port = $force_install_port;
118  }
119  if (!empty($force_install_prefix)) {
120  $db_prefix = $force_install_prefix;
121  }
122  if (!empty($force_install_createdatabase)) {
123  $db_create_database = $force_install_createdatabase;
124  }
125  if (!empty($force_install_createuser)) {
126  $db_create_user = $force_install_createuser;
127  }
128  if (!empty($force_install_mainforcehttps)) {
129  $main_force_https = $force_install_mainforcehttps;
130  }
131  }
132 
133  if (!empty($force_install_distrib)) {
134  $dolibarr_main_distrib = $force_install_distrib;
135  }
136 }
137 
138 
139 $error = 0;
140 
141 
142 /*
143  * View
144  */
145 
146 dolibarr_install_syslog("--- step1: entering step1.php page");
147 
148 pHeader($langs->trans("ConfigurationFile"), "step2");
149 
150 // Test if we can run a first install process
151 if (!is_writable($conffile))
152 {
153  print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
154  pFooter(1, $setuplang, 'jscheckparam');
155  exit;
156 }
157 
158 
159 // Check parameters
160 $is_sqlite = false;
161 if (empty($db_type))
162 {
163  print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("DatabaseType")).'</div>';
164  $error++;
165 } else {
166  $is_sqlite = ($db_type === 'sqlite' || $db_type === 'sqlite3');
167 }
168 if (empty($db_host) && !$is_sqlite)
169 {
170  print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("Server")).'</div>';
171  $error++;
172 }
173 if (empty($db_name))
174 {
175  print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("DatabaseName")).'</div>';
176  $error++;
177 }
178 if (empty($db_user) && !$is_sqlite)
179 {
180  print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("Login")).'</div>';
181  $error++;
182 }
183 if (!empty($db_port) && !is_numeric($db_port))
184 {
185  print '<div class="error">'.$langs->trans("ErrorBadValueForParameter", $db_port, $langs->transnoentities("Port")).'</div>';
186  $error++;
187 }
188 if (!empty($db_prefix) && !preg_match('/^[a-z0-9]+_$/i', $db_prefix))
189 {
190  print '<div class="error">'.$langs->trans("ErrorBadValueForParameter", $db_prefix, $langs->transnoentities("DatabasePrefix")).'</div>';
191  $error++;
192 }
193 
194 
195 // Remove last / into dans main_dir
196 if (substr($main_dir, dol_strlen($main_dir) - 1) == "/")
197 {
198  $main_dir = substr($main_dir, 0, dol_strlen($main_dir) - 1);
199 }
200 
201 // Remove last / into dans main_url
202 if (!empty($main_url) && substr($main_url, dol_strlen($main_url) - 1) == "/")
203 {
204  $main_url = substr($main_url, 0, dol_strlen($main_url) - 1);
205 }
206 
207 // Test database connection
208 if (!$error) {
209  $result = @include_once $main_dir."/core/db/".$db_type.'.class.php';
210  if ($result)
211  {
212  // If we require database or user creation we need to connect as root, so we need root login credentials
213  if (!empty($db_create_database) && !$userroot) {
214  print '<div class="error">'.$langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $db_name).'</div>';
215  print '<br>';
216  print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
217  print $langs->trans("ErrorGoBackAndCorrectParameters");
218  $error++;
219  }
220  if (!empty($db_create_user) && !$userroot) {
221  print '<div class="error">'.$langs->trans("YouAskLoginCreationSoDolibarrNeedToConnect", $db_user).'</div>';
222  print '<br>';
223  print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
224  print $langs->trans("ErrorGoBackAndCorrectParameters");
225  $error++;
226  }
227 
228  // If we need root access
229  if (!$error && (!empty($db_create_database) || !empty($db_create_user))) {
230  $databasefortest = $db_name;
231  if (!empty($db_create_database)) {
232  if ($db_type == 'mysql' || $db_type == 'mysqli')
233  {
234  $databasefortest = 'mysql';
235  } elseif ($db_type == 'pgsql')
236  {
237  $databasefortest = 'postgres';
238  } else {
239  $databasefortest = 'master';
240  }
241  }
242  //print $_POST["db_type"].",".$_POST["db_host"].",$userroot,$passroot,$databasefortest,".$_POST["db_port"];
243 
244  $db = getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, $db_port);
245 
246  dol_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG);
247  //print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected;
248 
249  if (empty($db_create_database) && $db->connected && !$db->database_selected) {
250  print '<div class="error">'.$langs->trans("ErrorConnectedButDatabaseNotFound", $db_name).'</div>';
251  print '<br>';
252  if (!$db->connected) print $langs->trans("IfDatabaseNotExistsGoBackAndUncheckCreate").'<br><br>';
253  print $langs->trans("ErrorGoBackAndCorrectParameters");
254  $error++;
255  } elseif ($db->error && !(!empty($db_create_database) && $db->connected)) {
256  // Note: you may experience error here with message "No such file or directory" when mysql was installed for the first time but not yet launched.
257  if ($db->error == "No such file or directory") print '<div class="error">'.$langs->trans("ErrorToConnectToMysqlCheckInstance").'</div>';
258  else print '<div class="error">'.$db->error.'</div>';
259  if (!$db->connected) print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
260  //print '<a href="#" onClick="javascript: history.back();">';
261  print $langs->trans("ErrorGoBackAndCorrectParameters");
262  //print '</a>';
263  $error++;
264  }
265  }
266  // If we need simple access
267  if (!$error && (empty($db_create_database) && empty($db_create_user))) {
268  $db = getDoliDBInstance($db_type, $db_host, $db_user, $db_pass, $db_name, $db_port);
269 
270  if ($db->error)
271  {
272  print '<div class="error">'.$db->error.'</div>';
273  if (!$db->connected) print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
274  //print '<a href="#" onClick="javascript: history.back();">';
275  print $langs->trans("ErrorGoBackAndCorrectParameters");
276  //print '</a>';
277  $error++;
278  }
279  }
280  } else {
281  print "<br>\nFailed to include_once(\"".$main_dir."/core/db/".$db_type.".class.php\")<br>\n";
282  print '<div class="error">'.$langs->trans("ErrorWrongValueForParameter", $langs->transnoentities("WebPagesDirectory")).'</div>';
283  //print '<a href="#" onClick="javascript: history.back();">';
284  print $langs->trans("ErrorGoBackAndCorrectParameters");
285  //print '</a>';
286  $error++;
287  }
288 } else {
289  if (isset($db)) print $db->lasterror();
290  if (isset($db) && !$db->connected) print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
291  print $langs->trans("ErrorGoBackAndCorrectParameters");
292  $error++;
293 }
294 
295 if (!$error && $db->connected)
296 {
297  if (!empty($db_create_database)) {
298  $result = $db->select_db($db_name);
299  if ($result)
300  {
301  print '<div class="error">'.$langs->trans("ErrorDatabaseAlreadyExists", $db_name).'</div>';
302  print $langs->trans("IfDatabaseExistsGoBackAndCheckCreate").'<br><br>';
303  print $langs->trans("ErrorGoBackAndCorrectParameters");
304  $error++;
305  }
306  }
307 }
308 
309 // Define $defaultCharacterSet and $defaultDBSortingCollation
310 if (!$error && $db->connected)
311 {
312  if (!empty($db_create_database)) // If we create database, we force default value
313  {
314  // Default values come from the database handler
315 
316  $defaultCharacterSet = $db->forcecharset;
317  $defaultDBSortingCollation = $db->forcecollate;
318  } else // If already created, we take current value
319  {
320  $defaultCharacterSet = $db->getDefaultCharacterSetDatabase();
321  $defaultDBSortingCollation = $db->getDefaultCollationDatabase();
322  }
323 
324  // Force to avoid utf8mb4 because index on field char 255 reach limit of 767 char for indexes (example with mysql 5.6.34 = mariadb 10.0.29)
325  // TODO Remove this when utf8mb4 is supported
326  if ($defaultCharacterSet == 'utf8mb4' || $defaultDBSortingCollation == 'utf8mb4_unicode_ci')
327  {
328  $defaultCharacterSet = 'utf8';
329  $defaultDBSortingCollation = 'utf8_unicode_ci';
330  }
331 
332  print '<input type="hidden" name="dolibarr_main_db_character_set" value="'.$defaultCharacterSet.'">';
333  print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">';
334  $db_character_set = $defaultCharacterSet;
335  $db_collation = $defaultDBSortingCollation;
336  dolibarr_install_syslog("step1: db_character_set=".$db_character_set." db_collation=".$db_collation);
337 }
338 
339 
340 // Create config file
341 if (!$error && $db->connected && $action == "set")
342 {
343  umask(0);
344  if (is_array($_POST))
345  {
346  foreach ($_POST as $key => $value)
347  {
348  if (!preg_match('/^db_pass/i', $key)) {
349  dolibarr_install_syslog("step1: choice for ".$key." = ".$value);
350  }
351  }
352  }
353 
354  // Show title of step
355  print '<h3><img class="valigntextbottom" src="../theme/common/octicons/build/svg/gear.svg" width="20" alt="Configuration"> '.$langs->trans("ConfigurationFile").'</h3>';
356  print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
357 
358  // Check parameter main_dir
359  if (!$error)
360  {
361  if (!is_dir($main_dir))
362  {
363  dolibarr_install_syslog("step1: directory '".$main_dir."' is unavailable or can't be accessed");
364 
365  print "<tr><td>";
366  print $langs->trans("ErrorDirDoesNotExists", $main_dir).'<br>';
367  print $langs->trans("ErrorWrongValueForParameter", $langs->transnoentitiesnoconv("WebPagesDirectory")).'<br>';
368  print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
369  print '</td><td>';
370  print $langs->trans("Error");
371  print "</td></tr>";
372  $error++;
373  }
374  }
375 
376  if (!$error)
377  {
378  dolibarr_install_syslog("step1: directory '".$main_dir."' exists");
379  }
380 
381 
382  // Create subdirectory main_data_dir
383  if (!$error)
384  {
385  // Create directory for documents
386  if (!is_dir($main_data_dir))
387  {
388  dol_mkdir($main_data_dir);
389  }
390 
391  if (!is_dir($main_data_dir))
392  {
393  print "<tr><td>".$langs->trans("ErrorDirDoesNotExists", $main_data_dir);
394  print ' '.$langs->trans("YouMustCreateItAndAllowServerToWrite");
395  print '</td><td>';
396  print '<span class="error">'.$langs->trans("Error").'</span>';
397  print "</td></tr>";
398  print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
399  $error++;
400  } else {
401  // Create .htaccess file in document directory
402  $pathhtaccess = $main_data_dir.'/.htaccess';
403  if (!file_exists($pathhtaccess))
404  {
405  dolibarr_install_syslog("step1: .htaccess file did not exist, we created it in '".$main_data_dir."'");
406  $handlehtaccess = @fopen($pathhtaccess, 'w');
407  if ($handlehtaccess)
408  {
409  fwrite($handlehtaccess, 'Order allow,deny'."\n");
410  fwrite($handlehtaccess, 'Deny from all'."\n");
411 
412  fclose($handlehtaccess);
413  dolibarr_install_syslog("step1: .htaccess file created");
414  }
415  }
416 
417  // Documents are stored above the web pages root to prevent being downloaded without authentification
418  $dir = array();
419  $dir[] = $main_data_dir."/mycompany";
420  $dir[] = $main_data_dir."/medias";
421  $dir[] = $main_data_dir."/users";
422  $dir[] = $main_data_dir."/facture";
423  $dir[] = $main_data_dir."/propale";
424  $dir[] = $main_data_dir."/ficheinter";
425  $dir[] = $main_data_dir."/produit";
426  $dir[] = $main_data_dir."/doctemplates";
427 
428  // Loop on each directory of dir [] to create them if they do not exist
429  $num = count($dir);
430  for ($i = 0; $i < $num; $i++)
431  {
432  if (is_dir($dir[$i]))
433  {
434  dolibarr_install_syslog("step1: directory '".$dir[$i]."' exists");
435  } else {
436  if (dol_mkdir($dir[$i]) < 0)
437  {
438  print "<tr><td>";
439  print "Failed to create directory: ".$dir[$i];
440  print '</td><td>';
441  print $langs->trans("Error");
442  print "</td></tr>";
443  $error++;
444  } else {
445  dolibarr_install_syslog("step1: directory '".$dir[$i]."' created");
446  }
447  }
448  }
449 
450  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
451 
452  // Copy directory medias
453  $srcroot = $main_dir.'/install/medias';
454  $destroot = $main_data_dir.'/medias';
455  dolCopyDir($srcroot, $destroot, 0, 0);
456 
457  if ($error)
458  {
459  print "<tr><td>".$langs->trans("ErrorDirDoesNotExists", $main_data_dir);
460  print ' '.$langs->trans("YouMustCreateItAndAllowServerToWrite");
461  print '</td><td>';
462  print '<span class="error">'.$langs->trans("Error").'</span>';
463  print "</td></tr>";
464  print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
465  } else {
466  //ODT templates
467  $srcroot = $main_dir.'/install/doctemplates';
468  $destroot = $main_data_dir.'/doctemplates';
469  $docs = array(
470  'contracts' => 'contract',
471  'invoices' => 'invoice',
472  'orders' => 'order',
473  'products' => 'product',
474  'projects' => 'project',
475  'proposals' => 'proposal',
476  'shipments' => 'shipment',
477  'supplier_proposals' => 'supplier_proposal',
478  'tasks' => 'task_summary',
479  'thirdparties' => 'thirdparty',
480  'usergroups' => 'usergroups',
481  'users' => 'user',
482  );
483  foreach ($docs as $cursordir => $cursorfile)
484  {
485  $src = $srcroot.'/'.$cursordir.'/template_'.$cursorfile.'.odt';
486  $dirodt = $destroot.'/'.$cursordir;
487  $dest = $dirodt.'/template_'.$cursorfile.'.odt';
488 
489  dol_mkdir($dirodt);
490  $result = dol_copy($src, $dest, 0, 0);
491  if ($result < 0)
492  {
493  print '<tr><td colspan="2"><br>'.$langs->trans('ErrorFailToCopyFile', $src, $dest).'</td></tr>';
494  }
495  }
496  }
497  }
498  }
499 
500  // Table prefix
501  $main_db_prefix = (!empty($db_prefix) ? $db_prefix : 'llx_');
502 
503  // Write conf file on disk
504  if (!$error)
505  {
506  // Save old conf file on disk
507  if (file_exists("$conffile"))
508  {
509  // We must ignore errors as an existing old file may already exist and not be replaceable or
510  // the installer (like for ubuntu) may not have permission to create another file than conf.php.
511  // Also no other process must be able to read file or we expose the new file, so content with password.
512  @dol_copy($conffile, $conffile.'.old', '0400');
513  }
514 
515  $error += write_conf_file($conffile);
516  }
517 
518  // Create database and admin user database
519  if (!$error)
520  {
521  // We reload configuration file
522  conf($dolibarr_main_document_root);
523 
524  print '<tr><td>';
525  print $langs->trans("ConfFileReload");
526  print '</td>';
527  print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
528 
529  // Create database user if requested
530  if (isset($db_create_user) && ($db_create_user == "1" || $db_create_user == "on")) {
531  dolibarr_install_syslog("step1: create database user: ".$dolibarr_main_db_user);
532 
533  //print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port;
534  $databasefortest = $conf->db->name;
535  if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
536  {
537  $databasefortest = 'mysql';
538  } elseif ($conf->db->type == 'pgsql')
539  {
540  $databasefortest = 'postgres';
541  } elseif ($conf->db->type == 'mssql')
542  {
543  $databasefortest = 'master';
544  }
545 
546  // Check database connection
547 
548  $db = getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, $databasefortest, $conf->db->port);
549 
550  if ($db->error)
551  {
552  print '<div class="error">'.$db->error.'</div>';
553  $error++;
554  }
555 
556  if (!$error)
557  {
558  if ($db->connected)
559  {
560  $resultbis = 1;
561 
562  // Create user
563  $result = $db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
564 
565  // Create user bis
566  if ($databasefortest == 'mysql')
567  {
568  if (!in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local')))
569  {
570  $resultbis = $db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
571  }
572  }
573 
574  if ($result > 0 && $resultbis > 0)
575  {
576  print '<tr><td>';
577  print $langs->trans("UserCreation").' : ';
578  print $dolibarr_main_db_user;
579  print '</td>';
580  print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
581  } else {
582  if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS'
583  || $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
584  || $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS')
585  {
586  dolibarr_install_syslog("step1: user already exists");
587  print '<tr><td>';
588  print $langs->trans("UserCreation").' : ';
589  print $dolibarr_main_db_user;
590  print '</td>';
591  print '<td>'.$langs->trans("LoginAlreadyExists").'</td></tr>';
592  } else {
593  dolibarr_install_syslog("step1: failed to create user", LOG_ERR);
594  print '<tr><td>';
595  print $langs->trans("UserCreation").' : ';
596  print $dolibarr_main_db_user;
597  print '</td>';
598  print '<td>'.$langs->trans("Error").': '.$db->errno().' '.$db->error().($db->error ? '. '.$db->error : '')."</td></tr>";
599  }
600  }
601 
602  $db->close();
603  } else {
604  print '<tr><td>';
605  print $langs->trans("UserCreation").' : ';
606  print $dolibarr_main_db_user;
607  print '</td>';
608  print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
609  print '</tr>';
610 
611  // warning message due to connection failure
612  print '<tr><td colspan="2"><br>';
613  print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
614  print '<br>';
615  print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
616  print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
617  print '</td></tr>';
618 
619  $error++;
620  }
621  }
622  } // end of user account creation
623 
624 
625  // If database creation was asked, we create it
626  if (!$error && (isset($db_create_database) && ($db_create_database == "1" || $db_create_database == "on"))) {
627  dolibarr_install_syslog("step1: create database: ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user);
628  $newdb = getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, '', $conf->db->port);
629  //print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;
630 
631  if ($newdb->connected)
632  {
633  $result = $newdb->DDLCreateDb($dolibarr_main_db_name, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_db_user);
634 
635  if ($result)
636  {
637  print '<tr><td>';
638  print $langs->trans("DatabaseCreation")." (".$langs->trans("User")." ".$userroot.") : ";
639  print $dolibarr_main_db_name;
640  print '</td>';
641  print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
642 
643  $newdb->select_db($dolibarr_main_db_name);
644  $check1 = $newdb->getDefaultCharacterSetDatabase();
645  $check2 = $newdb->getDefaultCollationDatabase();
646  dolibarr_install_syslog('step1: new database is using charset='.$check1.' collation='.$check2);
647 
648  // If values differs, we save conf file again
649  //if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('step1: value for character_set is not the one asked for database creation', LOG_WARNING);
650  //if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('step1: value for collation is not the one asked for database creation', LOG_WARNING);
651  } else {
652  // warning message
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");
657  print '<br>';
658  print '</td></tr>';
659 
660  dolibarr_install_syslog('step1: failed to create database '.$dolibarr_main_db_name.' '.$newdb->lasterrno().' '.$newdb->lasterror(), LOG_ERR);
661  $error++;
662  }
663  $newdb->close();
664  } else {
665  print '<tr><td>';
666  print $langs->trans("DatabaseCreation")." (".$langs->trans("User")." ".$userroot.") : ";
667  print $dolibarr_main_db_name;
668  print '</td>';
669  print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
670  print '</tr>';
671 
672  // warning message
673  print '<tr><td colspan="2"><br>';
674  print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
675  print '<br>';
676  print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
677  print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
678  print '</td></tr>';
679 
680  $error++;
681  }
682  } // end of create database
683 
684 
685  // We test access with dolibarr database user (not admin)
686  if (!$error)
687  {
688  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);
689  //print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name;
690 
691  $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
692 
693  if ($db->connected)
694  {
695  dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." ok");
696  print "<tr><td>";
697  print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
698  print $dolibarr_main_db_host;
699  print "</td><td>";
700  print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
701  print "</td></tr>";
702 
703  // server access ok, basic access ok
704  if ($db->database_selected)
705  {
706  dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." ok");
707  print "<tr><td>";
708  print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
709  print $dolibarr_main_db_name;
710  print "</td><td>";
711  print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
712  print "</td></tr>";
713 
714  $error = 0;
715  } else {
716  dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." failed", LOG_ERR);
717  print "<tr><td>";
718  print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
719  print $dolibarr_main_db_name;
720  print '</td><td>';
721  print '<img src="../theme/eldy/img/error.png" alt="Error">';
722  print "</td></tr>";
723 
724  // warning message
725  print '<tr><td colspan="2"><br>';
726  print $langs->trans('CheckThatDatabasenameIsCorrect', $dolibarr_main_db_name).'<br>';
727  print $langs->trans('IfAlreadyExistsCheckOption').'<br>';
728  print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
729  print '</td></tr>';
730 
731  $error++;
732  }
733  } else {
734  dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." failed", LOG_ERR);
735  print "<tr><td>";
736  print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
737  print $dolibarr_main_db_host;
738  print '</td><td>';
739  print '<img src="../theme/eldy/img/error.png" alt="Error">';
740  print "</td></tr>";
741 
742  // warning message
743  print '<tr><td colspan="2"><br>';
744  print $langs->trans("ErrorConnection", $conf->db->host, $conf->db->name, $conf->db->user);
745  print $langs->trans('IfLoginDoesNotExistsCheckCreateUser').'<br>';
746  print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
747  print '</td></tr>';
748 
749  $error++;
750  }
751  }
752  }
753 
754  print '</table>';
755 }
756 
757 ?>
758 
759 <script type="text/javascript">
760 function jsinfo()
761 {
762  ok=true;
763 
764  //alert('<?php echo dol_escape_js($langs->transnoentities("NextStepMightLastALongTime")); ?>');
765 
766  document.getElementById('nextbutton').style.visibility="hidden";
767  document.getElementById('pleasewait').style.visibility="visible";
768 
769  return ok;
770 }
771 </script>
772 
773 <?php
774 
775 $ret = 0;
776 if ($error && isset($argv[1])) $ret = 1;
777 dolibarr_install_syslog("Exit ".$ret);
778 
779 dolibarr_install_syslog("--- step1: end");
780 
781 pFooter($error ? 1 : 0, $setuplang, 'jsinfo', 1);
782 
783 // Return code if ran from command line
784 if ($ret) exit($ret);
785 
786 
794 function write_main_file($mainfile, $main_dir)
795 {
796  $fp = @fopen("$mainfile", "w");
797  if ($fp)
798  {
799  clearstatcache();
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");
803  fclose($fp);
804  }
805 }
806 
807 
815 function write_master_file($masterfile, $main_dir)
816 {
817  $fp = @fopen("$masterfile", "w");
818  if ($fp)
819  {
820  clearstatcache();
821  fputs($fp, '<?php'."\n");
822  fputs($fp, "// Wrapper to include master into htdocs\n");
823  fputs($fp, "include_once '".$main_dir."/master.inc.php';\n");
824  fclose($fp);
825  }
826 }
827 
828 
835 function write_conf_file($conffile)
836 {
837  global $conf, $langs;
838  global $main_url, $main_dir, $main_data_dir, $main_force_https, $main_use_alt_dir, $main_alt_dir_name, $main_db_prefix;
839  global $dolibarr_main_url_root, $dolibarr_main_document_root, $dolibarr_main_data_root, $dolibarr_main_db_host;
840  global $dolibarr_main_db_port, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass;
841  global $dolibarr_main_db_type, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_authentication;
842  global $dolibarr_main_distrib;
843  global $db_host, $db_port, $db_name, $db_user, $db_pass, $db_type, $db_character_set, $db_collation;
844  global $conffile, $conffiletoshow, $conffiletoshowshort;
845  global $force_dolibarr_lib_ADODB_PATH, $force_dolibarr_lib_NUSOAP_PATH;
846  global $force_dolibarr_lib_TCPDF_PATH, $force_dolibarr_lib_FPDI_PATH;
847  global $force_dolibarr_lib_GEOIP_PATH;
848  global $force_dolibarr_lib_ODTPHP_PATH, $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP;
849  global $force_dolibarr_js_CKEDITOR, $force_dolibarr_js_JQUERY, $force_dolibarr_js_JQUERY_UI;
850  global $force_dolibarr_font_DOL_DEFAULT_TTF, $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD;
851 
852  $error = 0;
853 
854  $key = md5(uniqid(mt_rand(), true)); // Generate random hash
855 
856  $fp = fopen("$conffile", "w");
857  if ($fp)
858  {
859  clearstatcache();
860 
861  fputs($fp, '<?php'."\n");
862  fputs($fp, '//'."\n");
863  fputs($fp, '// File generated by Dolibarr installer '.DOL_VERSION.' on '.dol_print_date(dol_now(), '')."\n");
864  fputs($fp, '//'."\n");
865  fputs($fp, '// Take a look at conf.php.example file for an example of '.$conffiletoshowshort.' file'."\n");
866  fputs($fp, '// and explanations for all possibles parameters.'."\n");
867  fputs($fp, '//'."\n");
868 
869  fputs($fp, '$dolibarr_main_url_root=\''.str_replace("'", "\'", trim($main_url)).'\';');
870  fputs($fp, "\n");
871 
872  fputs($fp, '$dolibarr_main_document_root=\''.str_replace("'", "\'", trim($main_dir)).'\';');
873  fputs($fp, "\n");
874 
875  fputs($fp, $main_use_alt_dir.'$dolibarr_main_url_root_alt=\''.str_replace("'", "\'", trim("/".$main_alt_dir_name)).'\';');
876  fputs($fp, "\n");
877 
878  fputs($fp, $main_use_alt_dir.'$dolibarr_main_document_root_alt=\''.str_replace("'", "\'", trim($main_dir."/".$main_alt_dir_name)).'\';');
879  fputs($fp, "\n");
880 
881  fputs($fp, '$dolibarr_main_data_root=\''.str_replace("'", "\'", trim($main_data_dir)).'\';');
882  fputs($fp, "\n");
883 
884  fputs($fp, '$dolibarr_main_db_host=\''.str_replace("'", "\'", trim($db_host)).'\';');
885  fputs($fp, "\n");
886 
887  fputs($fp, '$dolibarr_main_db_port=\''.str_replace("'", "\'", trim($db_port)).'\';');
888  fputs($fp, "\n");
889 
890  fputs($fp, '$dolibarr_main_db_name=\''.str_replace("'", "\'", trim($db_name)).'\';');
891  fputs($fp, "\n");
892 
893  fputs($fp, '$dolibarr_main_db_prefix=\''.str_replace("'", "\'", trim($main_db_prefix)).'\';');
894  fputs($fp, "\n");
895 
896  fputs($fp, '$dolibarr_main_db_user=\''.str_replace("'", "\'", trim($db_user)).'\';');
897  fputs($fp, "\n");
898  fputs($fp, '$dolibarr_main_db_pass=\''.str_replace("'", "\'", trim($db_pass)).'\';');
899  fputs($fp, "\n");
900 
901  fputs($fp, '$dolibarr_main_db_type=\''.str_replace("'", "\'", trim($db_type)).'\';');
902  fputs($fp, "\n");
903 
904  fputs($fp, '$dolibarr_main_db_character_set=\''.str_replace("'", "\'", trim($db_character_set)).'\';');
905  fputs($fp, "\n");
906 
907  fputs($fp, '$dolibarr_main_db_collation=\''.str_replace("'", "\'", trim($db_collation)).'\';');
908  fputs($fp, "\n");
909 
910  // Authentication
911  fputs($fp, '// Authentication settings');
912  fputs($fp, "\n");
913 
914  fputs($fp, '$dolibarr_main_authentication=\'dolibarr\';');
915  fputs($fp, "\n\n");
916 
917  fputs($fp, '//$dolibarr_main_demo=\'autologin,autopass\';');
918  fputs($fp, "\n");
919 
920  fputs($fp, '// Security settings');
921  fputs($fp, "\n");
922 
923  fputs($fp, '$dolibarr_main_prod=\'0\';');
924  fputs($fp, "\n");
925 
926  fputs($fp, '$dolibarr_main_force_https=\''.$main_force_https.'\';');
927  fputs($fp, "\n");
928 
929  fputs($fp, '$dolibarr_main_restrict_os_commands=\'mysqldump, mysql, pg_dump, pgrestore\';');
930  fputs($fp, "\n");
931 
932  fputs($fp, '$dolibarr_nocsrfcheck=\'0\';');
933  fputs($fp, "\n");
934 
935  fputs($fp, '$dolibarr_main_instance_unique_id=\''.$key.'\';');
936  fputs($fp, "\n");
937 
938  fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';');
939  fputs($fp, "\n");
940 
941  // Write params to overwrites default lib path
942  fputs($fp, "\n");
943  if (empty($force_dolibarr_lib_FPDF_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_FPDF_PATH = ''; }
944  fputs($fp, '$dolibarr_lib_FPDF_PATH=\''.$force_dolibarr_lib_FPDF_PATH.'\';');
945  fputs($fp, "\n");
946  if (empty($force_dolibarr_lib_TCPDF_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_TCPDF_PATH = ''; }
947  fputs($fp, '$dolibarr_lib_TCPDF_PATH=\''.$force_dolibarr_lib_TCPDF_PATH.'\';');
948  fputs($fp, "\n");
949  if (empty($force_dolibarr_lib_FPDI_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_FPDI_PATH = ''; }
950  fputs($fp, '$dolibarr_lib_FPDI_PATH=\''.$force_dolibarr_lib_FPDI_PATH.'\';');
951  fputs($fp, "\n");
952  if (empty($force_dolibarr_lib_TCPDI_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_TCPDI_PATH = ''; }
953  fputs($fp, '$dolibarr_lib_TCPDI_PATH=\''.$force_dolibarr_lib_TCPDI_PATH.'\';');
954  fputs($fp, "\n");
955  if (empty($force_dolibarr_lib_ADODB_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_ADODB_PATH = ''; }
956  fputs($fp, '$dolibarr_lib_ADODB_PATH=\''.$force_dolibarr_lib_ADODB_PATH.'\';');
957  fputs($fp, "\n");
958  if (empty($force_dolibarr_lib_GEOIP_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_GEOIP_PATH = ''; }
959  fputs($fp, '$dolibarr_lib_GEOIP_PATH=\''.$force_dolibarr_lib_GEOIP_PATH.'\';');
960  fputs($fp, "\n");
961  if (empty($force_dolibarr_lib_NUSOAP_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_NUSOAP_PATH = ''; }
962  fputs($fp, '$dolibarr_lib_NUSOAP_PATH=\''.$force_dolibarr_lib_NUSOAP_PATH.'\';');
963  fputs($fp, "\n");
964  if (empty($force_dolibarr_lib_ODTPHP_PATH)) { fputs($fp, '//'); $force_dolibarr_lib_ODTPHP_PATH = ''; }
965  fputs($fp, '$dolibarr_lib_ODTPHP_PATH=\''.$force_dolibarr_lib_ODTPHP_PATH.'\';');
966  fputs($fp, "\n");
967  if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) { fputs($fp, '//'); $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = ''; }
968  fputs($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP=\''.$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP.'\';');
969  fputs($fp, "\n");
970  if (empty($force_dolibarr_js_CKEDITOR)) { fputs($fp, '//'); $force_dolibarr_js_CKEDITOR = ''; }
971  fputs($fp, '$dolibarr_js_CKEDITOR=\''.$force_dolibarr_js_CKEDITOR.'\';');
972  fputs($fp, "\n");
973  if (empty($force_dolibarr_js_JQUERY)) { fputs($fp, '//'); $force_dolibarr_js_JQUERY = ''; }
974  fputs($fp, '$dolibarr_js_JQUERY=\''.$force_dolibarr_js_JQUERY.'\';');
975  fputs($fp, "\n");
976  if (empty($force_dolibarr_js_JQUERY_UI)) { fputs($fp, '//'); $force_dolibarr_js_JQUERY_UI = ''; }
977  fputs($fp, '$dolibarr_js_JQUERY_UI=\''.$force_dolibarr_js_JQUERY_UI.'\';');
978  fputs($fp, "\n");
979 
980  // Write params to overwrites default font path
981  fputs($fp, "\n");
982  if (empty($force_dolibarr_font_DOL_DEFAULT_TTF)) { fputs($fp, '//'); $force_dolibarr_font_DOL_DEFAULT_TTF = ''; }
983  fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF=\''.$force_dolibarr_font_DOL_DEFAULT_TTF.'\';');
984  fputs($fp, "\n");
985  if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) { fputs($fp, '//'); $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = ''; }
986  fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.'\';');
987  fputs($fp, "\n");
988 
989  // Other
990  fputs($fp, '$dolibarr_main_distrib=\''.str_replace("'", "\'", trim($dolibarr_main_distrib)).'\';');
991  fputs($fp, "\n");
992 
993  fclose($fp);
994 
995  if (file_exists("$conffile"))
996  {
997  include $conffile; // force config reload, do not put include_once
998  conf($dolibarr_main_document_root);
999 
1000  print "<tr><td>";
1001  print $langs->trans("SaveConfigurationFile");
1002  print ' <strong>'.$conffile.'</strong>';
1003  print "</td><td>";
1004  print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
1005  print "</td></tr>";
1006  } else {
1007  $error++;
1008  }
1009  }
1010 
1011  return $error;
1012 }
detect_dolibarr_main_document_root()
Automatically detect Dolibarr&#39;s main document root.
Definition: inc.php:493
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
Copy a file to another file.
Definition: files.lib.php:663
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0)
Copy a dir to another dir.
Definition: files.lib.php:720
pHeader($subtitle, $next, $action= 'set', $param= '', $forcejqueryurl= '', $csstable= 'main-inside')
Show HTML header of install pages.
Definition: inc.php:347
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
conf($dolibarr_main_document_root)
Load conf file (file must exists)
Definition: inc.php:262
dol_now($mode= 'auto')
Return date for now.
parse_database_login($force_install_databaserootlogin)
Replaces automatic database login by actual value.
Definition: inc.php:563
write_main_file($mainfile, $main_dir)
Create main file.
Definition: step1.php:794
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition: inc.php:482
write_master_file($masterfile, $main_dir)
Create master file.
Definition: step1.php:815
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
parse_database_pass($force_install_databaserootpass)
Replaces automatic database password by actual value.
Definition: inc.php:574
detect_dolibarr_main_url_root()
Automatically detect Dolibarr&#39;s main URL root.
Definition: inc.php:530
print $_SERVER["PHP_SELF"]
Edit parameters.
detect_dolibarr_main_data_root($dolibarr_main_document_root)
Automatically detect Dolibarr&#39;s main data root.
Definition: inc.php:518
pFooter($nonext=0, $setuplang= '', $jscheckfunction= '', $withpleasewait=0)
Print HTML footer of install pages.
Definition: inc.php:424
print
Draft customers invoices.
Definition: index.php:89
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
write_conf_file($conffile)
Save configuration file.
Definition: step1.php:835
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)