dolibarr 20.0.0
fileconf.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
4 * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
6 * Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
7 * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
8 * Copyright (C) 2016 Raphaƫl Doursenaud <rdoursenaud@gpcsolutions.fr>
9 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
31include_once 'inc.php';
32
33global $langs;
34
35$err = 0;
36
37$setuplang = GETPOST("selectlang", 'alpha', 3) ? GETPOST("selectlang", 'alpha', 3) : (GETPOST('lang', 'alpha', 1) ? GETPOST('lang', 'alpha', 1) : 'auto');
38$langs->setDefaultLang($setuplang);
39
40$langs->loadLangs(array("install", "errors"));
41
42dolibarr_install_syslog("- fileconf: entering fileconf.php page");
43
44// You can force preselected values of the config step of Dolibarr by adding a file
45// install.forced.php into directory htdocs/install (This is the case with some wizard
46// installer like DoliWamp, DoliMamp or DoliBuntu).
47// We first init "forced values" to nothing.
48if (!isset($force_install_noedit)) {
49 $force_install_noedit = ''; // 1=To block vars specific to distrib, 2 to block all technical parameters
50}
51if (!isset($force_install_type)) {
52 $force_install_type = '';
53}
54if (!isset($force_install_dbserver)) {
55 $force_install_dbserver = '';
56}
57if (!isset($force_install_port)) {
58 $force_install_port = '';
59}
60if (!isset($force_install_database)) {
61 $force_install_database = '';
62}
63if (!isset($force_install_prefix)) {
64 $force_install_prefix = '';
65}
66if (!isset($force_install_createdatabase)) {
67 $force_install_createdatabase = '';
68}
69if (!isset($force_install_databaselogin)) {
70 $force_install_databaselogin = '';
71}
72if (!isset($force_install_databasepass)) {
73 $force_install_databasepass = '';
74}
75if (!isset($force_install_databaserootlogin)) {
76 $force_install_databaserootlogin = '';
77}
78if (!isset($force_install_databaserootpass)) {
79 $force_install_databaserootpass = '';
80}
81// Now we load forced values from install.forced.php file.
82$useforcedwizard = false;
83$forcedfile = "./install.forced.php";
84if ($conffile == "/etc/dolibarr/conf.php") {
85 $forcedfile = "/etc/dolibarr/install.forced.php"; // Must be after inc.php
86}
87if (@file_exists($forcedfile)) {
88 $useforcedwizard = true;
89 include_once $forcedfile;
90}
91
92
93
94/*
95 * View
96 */
97
98session_start(); // To be able to keep info into session (used for not losing pass during navigation. pass must not transit through parameters)
99
100pHeader($langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY) ? '' : $force_dolibarr_js_JQUERY.'/'), 'main-inside-bis');
101
102// Test if we can run a first install process
103if (!is_writable($conffile)) {
104 print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
105 dolibarr_install_syslog("fileconf: config file is not writable", LOG_WARNING);
106 dolibarr_install_syslog("- fileconf: end");
107 pFooter(1, $setuplang, 'jscheckparam');
108 exit;
109}
110
111if (!empty($force_install_message)) {
112 print '<div><br>'.$langs->trans($force_install_message).'</div>';
113
114 /*print '<script type="text/javascript">';
115 print ' jQuery(document).ready(function() {
116 jQuery("#linktoshowtechnicalparam").click(function() {
117 jQuery(".hidewhenedit").hide();
118 jQuery(".hidewhennoedit").show();
119 });';
120 if ($force_install_noedit) print 'jQuery(".hidewhennoedit").hide();';
121 print '});';
122 print '</script>';
123
124 print '<br><a href="#" id="linktoshowtechnicalparam" class="hidewhenedit">'.$langs->trans("ShowEditTechnicalParameters").'</a><br>';
125 */
126}
127
128?>
129<div>
130
131
132<table class="nobordernopadding<?php if ($force_install_noedit) {
133 print ' hidewhennoedit';
134 } ?>">
135
136 <tr>
137 <td colspan="3" class="label">
138 <h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/globe.svg" width="20" alt="webserver"> <?php echo $langs->trans("WebServer"); ?></h3>
139 </td>
140 </tr>
141
142 <!-- Documents root $dolibarr_main_document_root -->
143 <tr>
144 <td class="label"><label for="main_dir"><b><?php print $langs->trans("WebPagesDirectory"); ?></b></label></td>
145<?php
146if (empty($dolibarr_main_document_root)) {
147 $dolibarr_main_document_root = GETPOSTISSET('main_dir') ? GETPOST('main_dir') : detect_dolibarr_main_document_root();
148}
149?>
150 <td class="label">
151 <input type="text"
152 class="minwidth300"
153 id="main_dir"
154 name="main_dir"
155 value="<?php print $dolibarr_main_document_root ?>"
156<?php
157if (!empty($force_install_noedit)) {
158 print ' disabled';
159}
160?>
161 >
162 </td>
163 <td class="comment"><?php
164 print '<span class="opacitymedium">'.$langs->trans("WithNoSlashAtTheEnd")."</span><br>";
165 print $langs->trans("Examples").":<br>";
166 ?>
167 <ul>
168 <li>/var/www/dolibarr/htdocs</li>
169 <li>C:/wwwroot/dolibarr/htdocs</li>
170 </ul>
171 </td>
172 </tr>
173
174 <!-- Documents URL $dolibarr_main_data_root -->
175 <tr>
176 <td class="label"><label for="main_data_dir"><b><?php print $langs->trans("DocumentsDirectory"); ?></b></label></td>
177 <?php
178 if (!empty($force_install_main_data_root)) {
179 $dolibarr_main_data_root = @$force_install_main_data_root;
180 }
181 if (empty($dolibarr_main_data_root)) {
182 $dolibarr_main_data_root = GETPOSTISSET('main_data_dir') ? GETPOST('main_data_dir') : detect_dolibarr_main_data_root($dolibarr_main_document_root);
183 }
184 ?>
185 <td class="label">
186 <input type="text"
187 class="minwidth300"
188 id="main_data_dir"
189 name="main_data_dir"
190 value="<?php print $dolibarr_main_data_root ?>"
191<?php if (!empty($force_install_noedit)) {
192 print ' disabled';
193} ?>
194 >
195 </td>
196 <td class="comment"><?php
197 print '<span class="opacitymedium">'.$langs->trans("WithNoSlashAtTheEnd")."</span><br>";
198 print $langs->trans("DirectoryRecommendation")."<br>";
199 print $langs->trans("Examples").":<br>";
200 ?>
201 <ul>
202 <li>/var/lib/dolibarr/documents</li>
203 <li>C:/My Documents/dolibarr/documents</li>
204 </ul>
205 </td>
206 </tr>
207
208 <!-- Root URL $dolibarr_main_url_root -->
209 <?php
210 if (empty($dolibarr_main_url_root)) {
211 $dolibarr_main_url_root = GETPOSTISSET('main_url') ? GETPOST('main_url') : detect_dolibarr_main_url_root();
212 }
213 ?>
214 <tr>
215 <td class="label"><label for="main_url"><b><?php echo $langs->trans("URLRoot"); ?></b></label>
216 </td>
217 <td class="label">
218 <input type="text"
219 class="minwidth300"
220 id="main_url"
221 name="main_url"
222 value="<?php print $dolibarr_main_url_root; ?> "
223<?php if (!empty($force_install_noedit)) {
224 print ' disabled';
225}
226?>
227 >
228 </td>
229 <td class="comment"><?php print $langs->trans("Examples").":<br>"; ?>
230 <ul>
231 <li>http://localhost/</li>
232 <li>http://www.myserver.com:8180/dolibarr</li>
233 <li>https://www.myvirtualfordolibarr.com/</li>
234 </ul>
235 </td>
236 </tr>
237
238 <?php
239 if (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') { // Enabled if the installation process is "https://"
240 ?>
241 <tr>
242 <td class="label"><label for="main_force_https"><?php echo $langs->trans("ForceHttps"); ?></label></td>
243 <td class="label">
244 <input type="checkbox"
245 id="main_force_https"
246 name="main_force_https"
247 <?php if (!empty($force_install_mainforcehttps)) {
248 print ' checked';
249 } ?>
250 <?php if ($force_install_noedit == 2 && $force_install_mainforcehttps !== null) {
251 print ' disabled';
252 } ?>
253 >
254 </td>
255 <td class="comment"><?php echo $langs->trans("CheckToForceHttps"); ?>
256 </td>
257
258 </tr>
259 <?php
260 }
261 ?>
262
263 <!-- Dolibarr database -->
264
265 <tr>
266 <td colspan="3" class="label"><br>
267 <h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/database.svg" width="20" alt="webserver"> <?php echo $langs->trans("DolibarrDatabase"); ?></h3>
268 </td>
269 </tr>
270
271 <tr>
272 <td class="label"><label for="db_name"><b><?php echo $langs->trans("DatabaseName"); ?></b></label></td>
273 <td class="label">
274 <input type="text"
275 id="db_name"
276 name="db_name"
277 value="<?php echo (!empty($dolibarr_main_db_name)) ? $dolibarr_main_db_name : ($force_install_database ? $force_install_database : 'dolibarr'); ?>"
278 <?php if ($force_install_noedit == 2 && $force_install_database !== null) {
279 print ' disabled';
280 } ?>
281 >
282 </td>
283 <td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td>
284 </tr>
285
286
287 <?php
288 if (!isset($dolibarr_main_db_host)) {
289 $dolibarr_main_db_host = "localhost";
290 }
291 ?>
292 <tr>
293 <!-- Driver type -->
294 <td class="label"><label for="db_type"><b><?php echo $langs->trans("DriverType"); ?></b></label></td>
295
296 <td class="label">
297 <?php
298
299 $defaultype = !empty($dolibarr_main_db_type) ? $dolibarr_main_db_type : (empty($force_install_type) ? 'mysqli' : $force_install_type);
300
301 $modules = array();
302 $nbok = $nbko = 0;
303 $option = '';
304
305 // Scan les drivers
306 $dir = DOL_DOCUMENT_ROOT.'/core/db';
307 $handle = opendir($dir);
308 if (is_resource($handle)) {
309 while (($file = readdir($handle)) !== false) {
310 if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) {
311 $type = $reg[1];
312 if ($type === 'DoliDB') {
313 continue; // Skip abstract class
314 }
315 $class = 'DoliDB'.ucfirst($type);
316 include_once $dir."/".$file;
317
318 if ($type == 'sqlite') {
319 continue; // We hide sqlite because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported)
320 }
321 if ($type == 'sqlite3') {
322 continue; // We hide sqlite3 because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported)
323 }
324
325 // Version min of database
326 $note = '('.$class::LABEL.' >= '.$class::VERSIONMIN.')';
327
328 // Switch to mysql if mysqli is not present
329 if ($defaultype == 'mysqli' && !function_exists('mysqli_connect')) {
330 $defaultype = 'mysql';
331 }
332
333 // Show line into list
334 if ($type == 'mysql') {
335 $testfunction = 'mysql_connect';
336 $testclass = '';
337 }
338 if ($type == 'mysqli') {
339 $testfunction = 'mysqli_connect';
340 $testclass = '';
341 }
342 if ($type == 'pgsql') {
343 $testfunction = 'pg_connect';
344 $testclass = '';
345 }
346 if ($type == 'mssql') {
347 $testfunction = 'mssql_connect';
348 $testclass = '';
349 }
350 if ($type == 'sqlite') {
351 $testfunction = '';
352 $testclass = 'PDO';
353 }
354 if ($type == 'sqlite3') {
355 $testfunction = '';
356 $testclass = 'SQLite3';
357 }
358 $option .= '<option value="'.$type.'"'.($defaultype == $type ? ' selected' : '');
359 if ($testfunction && !function_exists($testfunction)) {
360 $option .= ' disabled';
361 }
362 if ($testclass && !class_exists($testclass)) {
363 $option .= ' disabled';
364 }
365 $option .= '>';
366 $option .= $type.'&nbsp; &nbsp;';
367 if ($note) {
368 $option .= ' '.$note;
369 }
370 // Deprecated and experimental
371 if ($type == 'mysql') {
372 $option .= ' '.$langs->trans("Deprecated");
373 } elseif ($type == 'mssql') {
374 $option .= ' '.$langs->trans("VersionExperimental");
375 } elseif ($type == 'sqlite') {
376 $option .= ' '.$langs->trans("VersionExperimental");
377 } elseif ($type == 'sqlite3') {
378 $option .= ' '.$langs->trans("VersionExperimental");
379 } elseif (!function_exists($testfunction)) {
380 // No available
381 $option .= ' - '.$langs->trans("FunctionNotAvailableInThisPHP");
382 }
383 $option .= '</option>';
384 }
385 }
386 }
387 ?>
388 <select id="db_type"
389 name="db_type"
390 <?php if ($force_install_noedit == 2 && $force_install_type !== null) {
391 print ' disabled';
392 } ?>
393 >
394 <?php print $option; ?>
395 </select>
396
397 </td>
398 <td class="comment"><?php echo $langs->trans("DatabaseType"); ?></td>
399
400 </tr>
401
402 <tr class="hidesqlite">
403 <td class="label"><label for="db_host"><b><?php echo $langs->trans("DatabaseServer"); ?></b></label></td>
404 <td class="label">
405 <input type="text"
406 id="db_host"
407 name="db_host"
408 value="<?php print(!empty($force_install_dbserver) ? $force_install_dbserver : (!empty($dolibarr_main_db_host) ? $dolibarr_main_db_host : 'localhost')); ?>"
409 <?php if ($force_install_noedit == 2 && $force_install_dbserver !== null) {
410 print ' disabled';
411 } ?>
412 >
413 </td>
414 <td class="comment"><?php echo $langs->trans("ServerAddressDescription"); ?>
415 </td>
416
417 </tr>
418
419 <tr class="hidesqlite">
420 <td class="label"><label for="db_port"><?php echo $langs->trans("Port"); ?></label></td>
421 <td class="label">
422 <input type="text"
423 name="db_port"
424 id="db_port"
425 value="<?php print (!empty($force_install_port)) ? $force_install_port : $dolibarr_main_db_port; ?>"
426 <?php if ($force_install_noedit == 2 && $force_install_port !== null) {
427 print ' disabled';
428 } ?>
429 >
430 </td>
431 <td class="comment"><?php echo $langs->trans("ServerPortDescription"); ?>
432 </td>
433
434 </tr>
435
436 <tr class="hidesqlite">
437 <td class="label"><label for="db_prefix"><?php echo $langs->trans("DatabasePrefix"); ?></label></td>
438 <td class="label">
439 <input type="text"
440 id="db_prefix"
441 name="db_prefix"
442 value="<?php echo(!empty($force_install_prefix) ? $force_install_prefix : (!empty($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : 'llx_')); ?>"
443 <?php if ($force_install_noedit == 2 && $force_install_prefix !== null) {
444 print ' disabled';
445 } ?>
446 >
447 </td>
448 <td class="comment"><?php echo $langs->trans("DatabasePrefixDescription"); ?></td>
449 </tr>
450
451 <tr class="hidesqlite">
452 <td class="label"><label for="db_create_database"><?php echo $langs->trans("CreateDatabase"); ?></label></td>
453 <td class="label">
454 <input type="checkbox"
455 id="db_create_database"
456 name="db_create_database"
457 value="on"
458 <?php
459 $checked = 0;
460 if ($force_install_createdatabase) {
461 $checked = 1;
462 print ' checked';
463 } ?>
464 <?php if ($force_install_noedit == 2 && $force_install_createdatabase !== null) {
465 print ' disabled';
466 } ?>
467 >
468 </td>
469 <td class="comment">
470 <?php echo $langs->trans("CheckToCreateDatabase"); ?>
471 </td>
472 </tr>
473
474 <tr class="hidesqlite">
475 <td class="label"><label for="db_user"><b><?php echo $langs->trans("Login"); ?></b></label></td>
476 <td class="label">
477 <input type="text"
478 id="db_user"
479 name="db_user"
480 value="<?php print (!empty($force_install_databaselogin)) ? $force_install_databaselogin : $dolibarr_main_db_user; ?>"
481 <?php if ($force_install_noedit == 2 && $force_install_databaselogin !== null) {
482 print ' disabled';
483 } ?>
484 >
485 </td>
486 <td class="comment"><?php echo $langs->trans("AdminLogin"); ?></td>
487 </tr>
488
489 <tr class="hidesqlite">
490 <td class="label"><label for="db_pass"><b><?php echo $langs->trans("Password"); ?></b></label></td>
491 <td class="label">
492 <input type="password" class="text-security"
493 id="db_pass" autocomplete="off"
494 name="db_pass"
495 value="<?php
496 // If $force_install_databasepass is on, we don't want to set password, we just show '***'. Real value will be extracted from the forced install file at step1.
497 // @phan-suppress-next-line PhanParamSuspiciousOrder
498 $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*'));
499 if (!empty($dolibarr_main_prod) && empty($_SESSION['dol_save_pass'])) { // So value can't be found if install page still accessible
500 $autofill = '';
501 }
502 print dol_escape_htmltag($autofill);
503 ?>"
504 <?php if ($force_install_noedit == 2 && $force_install_databasepass !== null) {
505 print ' disabled';
506 } ?>
507 >
508 </td>
509 <td class="comment"><?php echo $langs->trans("AdminPassword"); ?></td>
510 </tr>
511
512 <tr class="hidesqlite">
513 <td class="label"><label for="db_create_user"><?php echo $langs->trans("CreateUser"); ?></label></td>
514 <td class="label">
515 <input type="checkbox"
516 id="db_create_user"
517 name="db_create_user"
518 value="on"
519 <?php
520 $checked = 0;
521 if (!empty($force_install_createuser)) {
522 $checked = 1;
523 print ' checked';
524 } ?>
525 <?php if ($force_install_noedit == 2 && $force_install_createuser !== null) {
526 print ' disabled';
527 } ?>
528 >
529 </td>
530 <td class="comment">
531 <?php echo $langs->trans("CheckToCreateUser"); ?>
532 </td>
533 </tr>
534
535
536 <!-- Super access -->
537 <?php
538 $force_install_databaserootlogin = parse_database_login($force_install_databaserootlogin);
539 $force_install_databaserootpass = parse_database_pass($force_install_databaserootpass);
540 ?>
541 <tr class="hidesqlite hideroot">
542 <td colspan="3" class="label"><br>
543 <h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/shield.svg" width="20" alt="webserver"> <?php echo $langs->trans("DatabaseSuperUserAccess"); ?></h3>
544 </td>
545 </tr>
546
547 <tr class="hidesqlite hideroot">
548 <td class="label"><label for="db_user_root"><b><?php echo $langs->trans("Login"); ?></b></label></td>
549 <td class="label">
550 <input type="text"
551 id="db_user_root"
552 name="db_user_root"
553 class="needroot"
554 value="<?php print (!empty($force_install_databaserootlogin)) ? $force_install_databaserootlogin : (GETPOSTISSET('db_user_root') ? GETPOST('db_user_root') : (isset($db_user_root) ? $db_user_root : '')); ?>"
555 <?php if ($force_install_noedit > 0 && !empty($force_install_databaserootlogin)) {
556 print ' disabled';
557 } ?>
558 >
559 </td>
560 <td class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?>
561 <!--
562 <?php echo '<br>'.$langs->trans("Examples").':<br>' ?>
563 <ul>
564 <li>root (Mysql)</li>
565 <li>postgres (PostgreSql)</li>
566 </ul>
567 </td>
568 -->
569
570 </tr>
571 <tr class="hidesqlite hideroot">
572 <td class="label"><label for="db_pass_root"><b><?php echo $langs->trans("Password"); ?></b></label></td>
573 <td class="label">
574 <input type="password"
575 autocomplete="off"
576 id="db_pass_root"
577 name="db_pass_root"
578 class="needroot text-security"
579 value="<?php
580 // If $force_install_databaserootpass is on, we don't want to set password here, we just show '***'. Real value will be extracted from the forced install file at step1.
581 // @phan-suppress-next-line PhanParamSuspiciousOrder
582 $autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : (isset($db_pass_root) ? $db_pass_root : ''));
583 if (!empty($dolibarr_main_prod)) {
584 $autofill = '';
585 }
586 // Do not autofill password if instance is a production instance
587 if (!empty($_SERVER["SERVER_NAME"]) && !in_array(
588 $_SERVER["SERVER_NAME"],
589 array('127.0.0.1', 'localhost', 'localhostgit')
590 )
591 ) {
592 $autofill = '';
593 } // Do not autofill password for remote access
594 print dol_escape_htmltag($autofill);
595 ?>"
596 <?php if ($force_install_noedit > 0 && !empty($force_install_databaserootpass)) {
597 print ' disabled'; /* May be removed by javascript*/
598 } ?>
599 >
600 </td>
601 <td class="comment"><?php echo $langs->trans("KeepEmptyIfNoPassword"); ?>
602 </td>
603 </tr>
604
605</table>
606</div>
607
608
609<script type="text/javascript">
610function init_needroot()
611{
612 console.log("init_needroot force_install_noedit=<?php echo $force_install_noedit?>");
613 console.log(jQuery("#db_create_database").is(":checked"));
614 console.log(jQuery("#db_create_user").is(":checked"));
615
616 if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked"))
617 {
618 console.log("init_needroot show root section");
619 jQuery(".hideroot").show();
620 <?php
621 if (empty($force_install_noedit)) { ?>
622 jQuery(".needroot").removeAttr('disabled');
623 <?php } ?>
624 }
625 else
626 {
627 console.log("init_needroot hide root section");
628 jQuery(".hideroot").hide();
629 jQuery(".needroot").prop('disabled', true);
630 }
631}
632
633function checkDatabaseName(databasename) {
634 if (databasename.match(/[;\.]/)) { return false; }
635 return true;
636}
637
638function jscheckparam()
639{
640 console.log("Click on jscheckparam");
641
642 var ok = true;
643
644 if (document.forminstall.main_dir.value == '')
645 {
646 ok=false;
647 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("WebPagesDirectory"))); ?>');
648 }
649 else if (document.forminstall.main_data_dir.value == '')
650 {
651 ok=false;
652 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("DocumentsDirectory"))); ?>');
653 }
654 else if (document.forminstall.main_url.value == '')
655 {
656 ok=false;
657 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("URLRoot"))); ?>');
658 }
659 else if (document.forminstall.db_host.value == '')
660 {
661 ok=false;
662 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("Server"))); ?>');
663 }
664 else if (document.forminstall.db_name.value == '')
665 {
666 ok=false;
667 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatabaseName"))); ?>');
668 }
669 else if (! checkDatabaseName(document.forminstall.db_name.value))
670 {
671 ok=false;
672 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentitiesnoconv("DatabaseName"))); ?>');
673 }
674 // If create database asked
675 else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == ''))
676 {
677 ok=false;
678 alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>');
679 init_needroot();
680 }
681 // If create user asked
682 else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == ''))
683 {
684 ok=false;
685 alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>');
686 init_needroot();
687 }
688
689 return ok;
690}
691
692
693jQuery(document).ready(function() { // TODO Test $( window ).load(function() to see if the init_needroot work better after a back
694
695 var dbtype = jQuery("#db_type");
696
697 dbtype.change(function () {
698 if (dbtype.val() == 'sqlite' || dbtype.val() == 'sqlite3') {
699 jQuery(".hidesqlite").hide();
700 } else {
701 jQuery(".hidesqlite").show();
702 }
703
704 // Automatically set default database ports and admin user
705 if (dbtype.val() == 'mysql' || dbtype.val() == 'mysqli') {
706 jQuery("#db_port").val(3306);
707 jQuery("#db_user_root").val('root');
708 } else if (dbtype.val() == 'pgsql') {
709 jQuery("#db_port").val(5432);
710 jQuery("#db_user_root").val('postgres');
711 } else if (dbtype.val() == 'mssql') {
712 jQuery("#db_port").val(1433);
713 jQuery("#db_user_root").val('sa');
714 }
715
716 });
717
718 jQuery("#db_create_database").click(function() {
719 console.log("click on db_create_database");
720 init_needroot();
721 });
722 jQuery("#db_create_user").click(function() {
723 console.log("click on db_create_user");
724 init_needroot();
725 });
726 <?php if ($force_install_noedit == 2 && empty($force_install_databasepass)) { ?>
727 jQuery("#db_pass").focus();
728 <?php } ?>
729
730 init_needroot();
731});
732</script>
733
734
735<?php
736
737// $db->close(); Not database connection yet
738
739dolibarr_install_syslog("- fileconf: end");
740
741pFooter($err, $setuplang, 'jscheckparam');
API class for receive files.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
treeview li table
No Email.
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
Definition inc.php:535
detect_dolibarr_main_data_root($dolibarr_main_document_root)
Automatically detect Dolibarr's main data root.
Definition inc.php:727
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition inc.php:626
parse_database_login($force_install_databaserootlogin)
Replaces automatic database login by actual value.
Definition inc.php:772
parse_database_pass($force_install_databaserootpass)
Replaces automatic database password by actual value.
Definition inc.php:783
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition inc.php:690
detect_dolibarr_main_url_root()
Automatically detect Dolibarr's main URL root.
Definition inc.php:739
detect_dolibarr_main_document_root()
Automatically detect Dolibarr's main document root.
Definition inc.php:703
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:139
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:142