dolibarr 20.0.5
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("DolibarrSetup").' - '.$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 if (!isset($dolibarr_main_db_port)) {
292 $dolibarr_main_db_port = "";
293 }
294 if (!isset($dolibarr_main_db_user)) {
295 $dolibarr_main_db_user = "";
296 }
297 ?>
298 <tr>
299 <!-- Driver type -->
300 <td class="label"><label for="db_type"><b><?php echo $langs->trans("DriverType"); ?></b></label></td>
301
302 <td class="label">
303 <?php
304
305 $defaultype = !empty($dolibarr_main_db_type) ? $dolibarr_main_db_type : (empty($force_install_type) ? 'mysqli' : $force_install_type);
306
307 $modules = array();
308 $nbok = $nbko = 0;
309 $option = '';
310
311 // Scan les drivers
312 $dir = DOL_DOCUMENT_ROOT.'/core/db';
313 $handle = opendir($dir);
314 if (is_resource($handle)) {
315 while (($file = readdir($handle)) !== false) {
316 if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) {
317 $type = $reg[1];
318 if ($type === 'DoliDB') {
319 continue; // Skip abstract class
320 }
321 $class = 'DoliDB'.ucfirst($type);
322 include_once $dir."/".$file;
323
324 if ($type == 'sqlite') {
325 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)
326 }
327 if ($type == 'sqlite3') {
328 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)
329 }
330
331 // Version min of database
332 $note = '('.$class::LABEL.' >= '.$class::VERSIONMIN.')';
333
334 // Switch to mysql if mysqli is not present
335 if ($defaultype == 'mysqli' && !function_exists('mysqli_connect')) {
336 $defaultype = 'mysql';
337 }
338
339 // Show line into list
340 if ($type == 'mysql') {
341 $testfunction = 'mysql_connect';
342 $testclass = '';
343 }
344 if ($type == 'mysqli') {
345 $testfunction = 'mysqli_connect';
346 $testclass = '';
347 }
348 if ($type == 'pgsql') {
349 $testfunction = 'pg_connect';
350 $testclass = '';
351 }
352 if ($type == 'mssql') {
353 $testfunction = 'mssql_connect';
354 $testclass = '';
355 }
356 if ($type == 'sqlite') {
357 $testfunction = '';
358 $testclass = 'PDO';
359 }
360 if ($type == 'sqlite3') {
361 $testfunction = '';
362 $testclass = 'SQLite3';
363 }
364 $option .= '<option value="'.$type.'"'.($defaultype == $type ? ' selected' : '');
365 if ($testfunction && !function_exists($testfunction)) {
366 $option .= ' disabled';
367 }
368 if ($testclass && !class_exists($testclass)) {
369 $option .= ' disabled';
370 }
371 $option .= '>';
372 $option .= $type.'&nbsp; &nbsp;';
373 if ($note) {
374 $option .= ' '.$note;
375 }
376 // Deprecated and experimental
377 if ($type == 'mysql') {
378 $option .= ' '.$langs->trans("Deprecated");
379 } elseif ($type == 'mssql') {
380 $option .= ' '.$langs->trans("VersionExperimental");
381 } elseif ($type == 'sqlite') {
382 $option .= ' '.$langs->trans("VersionExperimental");
383 } elseif ($type == 'sqlite3') {
384 $option .= ' '.$langs->trans("VersionExperimental");
385 } elseif (!function_exists($testfunction)) {
386 // No available
387 $option .= ' - '.$langs->trans("FunctionNotAvailableInThisPHP");
388 }
389 $option .= '</option>';
390 }
391 }
392 }
393 ?>
394 <select id="db_type"
395 name="db_type"
396 <?php if ($force_install_noedit == 2 && $force_install_type !== null) {
397 print ' disabled';
398 } ?>
399 >
400 <?php print $option; ?>
401 </select>
402
403 </td>
404 <td class="comment"><?php echo $langs->trans("DatabaseType"); ?></td>
405
406 </tr>
407
408 <tr class="hidesqlite">
409 <td class="label"><label for="db_host"><b><?php echo $langs->trans("DatabaseServer"); ?></b></label></td>
410 <td class="label">
411 <input type="text"
412 id="db_host"
413 name="db_host"
414 value="<?php print(!empty($force_install_dbserver) ? $force_install_dbserver : (!empty($dolibarr_main_db_host) ? $dolibarr_main_db_host : 'localhost')); ?>"
415 <?php if ($force_install_noedit == 2 && $force_install_dbserver !== null) {
416 print ' disabled';
417 } ?>
418 >
419 </td>
420 <td class="comment"><?php echo $langs->trans("ServerAddressDescription"); ?>
421 </td>
422
423 </tr>
424
425 <tr class="hidesqlite">
426 <td class="label"><label for="db_port"><?php echo $langs->trans("Port"); ?></label></td>
427 <td class="label">
428 <input type="text"
429 name="db_port"
430 id="db_port"
431 value="<?php print (!empty($force_install_port)) ? $force_install_port : $dolibarr_main_db_port; ?>"
432 <?php if ($force_install_noedit == 2 && $force_install_port !== null) {
433 print ' disabled';
434 } ?>
435 >
436 </td>
437 <td class="comment"><?php echo $langs->trans("ServerPortDescription"); ?>
438 </td>
439
440 </tr>
441
442 <tr class="hidesqlite">
443 <td class="label"><label for="db_prefix"><?php echo $langs->trans("DatabasePrefix"); ?></label></td>
444 <td class="label">
445 <input type="text"
446 id="db_prefix"
447 name="db_prefix"
448 value="<?php echo(!empty($force_install_prefix) ? $force_install_prefix : (!empty($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : 'llx_')); ?>"
449 <?php if ($force_install_noedit == 2 && $force_install_prefix !== null) {
450 print ' disabled';
451 } ?>
452 >
453 </td>
454 <td class="comment"><?php echo $langs->trans("DatabasePrefixDescription"); ?></td>
455 </tr>
456
457 <tr class="hidesqlite">
458 <td class="label"><label for="db_create_database"><?php echo $langs->trans("CreateDatabase"); ?></label></td>
459 <td class="label">
460 <input type="checkbox"
461 id="db_create_database"
462 name="db_create_database"
463 value="on"
464 <?php
465 $checked = 0;
466 if ($force_install_createdatabase) {
467 $checked = 1;
468 print ' checked';
469 } ?>
470 <?php if ($force_install_noedit == 2 && $force_install_createdatabase !== null) {
471 print ' disabled';
472 } ?>
473 >
474 </td>
475 <td class="comment">
476 <?php echo $langs->trans("CheckToCreateDatabase"); ?>
477 </td>
478 </tr>
479
480 <tr class="hidesqlite">
481 <td class="label"><label for="db_user"><b><?php echo $langs->trans("Login"); ?></b></label></td>
482 <td class="label">
483 <input type="text"
484 id="db_user"
485 name="db_user"
486 value="<?php print (!empty($force_install_databaselogin)) ? $force_install_databaselogin : $dolibarr_main_db_user; ?>"
487 <?php if ($force_install_noedit == 2 && $force_install_databaselogin !== null) {
488 print ' disabled';
489 } ?>
490 >
491 </td>
492 <td class="comment"><?php echo $langs->trans("AdminLogin"); ?></td>
493 </tr>
494
495 <tr class="hidesqlite">
496 <td class="label"><label for="db_pass"><b><?php echo $langs->trans("Password"); ?></b></label></td>
497 <td class="label">
498 <input type="password" class="text-security"
499 id="db_pass" autocomplete="off"
500 name="db_pass"
501 value="<?php
502 // 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.
503 // @phan-suppress-next-line PhanParamSuspiciousOrder
504 $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*'));
505 if (!empty($dolibarr_main_prod) && empty($_SESSION['dol_save_pass'])) { // So value can't be found if install page still accessible
506 $autofill = '';
507 }
508 print dol_escape_htmltag($autofill);
509 ?>"
510 <?php if ($force_install_noedit == 2 && $force_install_databasepass !== null) {
511 print ' disabled';
512 } ?>
513 >
514 </td>
515 <td class="comment"><?php echo $langs->trans("AdminPassword"); ?></td>
516 </tr>
517
518 <tr class="hidesqlite">
519 <td class="label"><label for="db_create_user"><?php echo $langs->trans("CreateUser"); ?></label></td>
520 <td class="label">
521 <input type="checkbox"
522 id="db_create_user"
523 name="db_create_user"
524 value="on"
525 <?php
526 $checked = 0;
527 if (!empty($force_install_createuser)) {
528 $checked = 1;
529 print ' checked';
530 } ?>
531 <?php if ($force_install_noedit == 2 && $force_install_createuser !== null) {
532 print ' disabled';
533 } ?>
534 >
535 </td>
536 <td class="comment">
537 <?php echo $langs->trans("CheckToCreateUser"); ?>
538 </td>
539 </tr>
540
541
542 <!-- Super access -->
543 <?php
544 $force_install_databaserootlogin = parse_database_login($force_install_databaserootlogin);
545 $force_install_databaserootpass = parse_database_pass($force_install_databaserootpass);
546 ?>
547 <tr class="hidesqlite hideroot">
548 <td colspan="3" class="label"><br>
549 <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>
550 </td>
551 </tr>
552
553 <tr class="hidesqlite hideroot">
554 <td class="label"><label for="db_user_root"><b><?php echo $langs->trans("Login"); ?></b></label></td>
555 <td class="label">
556 <input type="text"
557 id="db_user_root"
558 name="db_user_root"
559 class="needroot"
560 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 : '')); ?>"
561 <?php if ($force_install_noedit > 0 && !empty($force_install_databaserootlogin)) {
562 print ' disabled';
563 } ?>
564 >
565 </td>
566 <td class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?>
567 <!--
568 <?php echo '<br>'.$langs->trans("Examples").':<br>' ?>
569 <ul>
570 <li>root (Mysql)</li>
571 <li>postgres (PostgreSql)</li>
572 </ul>
573 </td>
574 -->
575
576 </tr>
577 <tr class="hidesqlite hideroot">
578 <td class="label"><label for="db_pass_root"><b><?php echo $langs->trans("Password"); ?></b></label></td>
579 <td class="label">
580 <input type="password"
581 autocomplete="off"
582 id="db_pass_root"
583 name="db_pass_root"
584 class="needroot text-security"
585 value="<?php
586 // 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.
587 // @phan-suppress-next-line PhanParamSuspiciousOrder
588 $autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : (isset($db_pass_root) ? $db_pass_root : ''));
589 if (!empty($dolibarr_main_prod)) {
590 $autofill = '';
591 }
592 // Do not autofill password if instance is a production instance
593 if (!empty($_SERVER["SERVER_NAME"]) && !in_array(
594 $_SERVER["SERVER_NAME"],
595 array('127.0.0.1', 'localhost', 'localhostgit')
596 )
597 ) {
598 $autofill = '';
599 } // Do not autofill password for remote access
600 print dol_escape_htmltag($autofill);
601 ?>"
602 <?php if ($force_install_noedit > 0 && !empty($force_install_databaserootpass)) {
603 print ' disabled'; /* May be removed by javascript*/
604 } ?>
605 >
606 </td>
607 <td class="comment"><?php echo $langs->trans("KeepEmptyIfNoPassword"); ?>
608 </td>
609 </tr>
610
611</table>
612</div>
613
614
615<script type="text/javascript">
616function init_needroot()
617{
618 console.log("init_needroot force_install_noedit=<?php echo $force_install_noedit?>");
619 console.log(jQuery("#db_create_database").is(":checked"));
620 console.log(jQuery("#db_create_user").is(":checked"));
621
622 if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked"))
623 {
624 console.log("init_needroot show root section");
625 jQuery(".hideroot").show();
626 <?php
627 if (empty($force_install_noedit)) { ?>
628 jQuery(".needroot").removeAttr('disabled');
629 <?php } ?>
630 }
631 else
632 {
633 console.log("init_needroot hide root section");
634 jQuery(".hideroot").hide();
635 jQuery(".needroot").prop('disabled', true);
636 }
637}
638
639function checkDatabaseName(databasename) {
640 if (databasename.match(/[;\.]/)) { return false; }
641 return true;
642}
643
644function jscheckparam()
645{
646 console.log("Click on jscheckparam");
647
648 var ok = true;
649
650 if (document.forminstall.main_dir.value == '')
651 {
652 ok=false;
653 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("WebPagesDirectory"))); ?>');
654 }
655 else if (document.forminstall.main_data_dir.value == '')
656 {
657 ok=false;
658 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("DocumentsDirectory"))); ?>');
659 }
660 else if (document.forminstall.main_url.value == '')
661 {
662 ok=false;
663 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("URLRoot"))); ?>');
664 }
665 else if (document.forminstall.db_host.value == '')
666 {
667 ok=false;
668 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("Server"))); ?>');
669 }
670 else if (document.forminstall.db_name.value == '')
671 {
672 ok=false;
673 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatabaseName"))); ?>');
674 }
675 else if (! checkDatabaseName(document.forminstall.db_name.value))
676 {
677 ok=false;
678 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentitiesnoconv("DatabaseName"))); ?>');
679 }
680 // If create database asked
681 else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == ''))
682 {
683 ok=false;
684 alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>');
685 init_needroot();
686 }
687 // If create user asked
688 else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == ''))
689 {
690 ok=false;
691 alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>');
692 init_needroot();
693 }
694
695 return ok;
696}
697
698
699jQuery(document).ready(function() { // TODO Test $( window ).load(function() to see if the init_needroot work better after a back
700
701 var dbtype = jQuery("#db_type");
702
703 dbtype.change(function () {
704 if (dbtype.val() == 'sqlite' || dbtype.val() == 'sqlite3') {
705 jQuery(".hidesqlite").hide();
706 } else {
707 jQuery(".hidesqlite").show();
708 }
709
710 // Automatically set default database ports and admin user
711 if (dbtype.val() == 'mysql' || dbtype.val() == 'mysqli') {
712 jQuery("#db_port").val(3306);
713 jQuery("#db_user_root").val('root');
714 } else if (dbtype.val() == 'pgsql') {
715 jQuery("#db_port").val(5432);
716 jQuery("#db_user_root").val('postgres');
717 } else if (dbtype.val() == 'mssql') {
718 jQuery("#db_port").val(1433);
719 jQuery("#db_user_root").val('sa');
720 }
721
722 });
723
724 jQuery("#db_create_database").click(function() {
725 console.log("click on db_create_database");
726 init_needroot();
727 });
728 jQuery("#db_create_user").click(function() {
729 console.log("click on db_create_user");
730 init_needroot();
731 });
732 <?php if ($force_install_noedit == 2 && empty($force_install_databasepass)) { ?>
733 jQuery("#db_pass").focus();
734 <?php } ?>
735
736 init_needroot();
737});
738</script>
739
740
741<?php
742
743// $db->close(); Not database connection yet
744
745dolibarr_install_syslog("- fileconf: end");
746
747pFooter($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:729
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition inc.php:628
parse_database_login($force_install_databaserootlogin)
Replaces automatic database login by actual value.
Definition inc.php:774
parse_database_pass($force_install_databaserootpass)
Replaces automatic database password by actual value.
Definition inc.php:785
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition inc.php:692
detect_dolibarr_main_url_root()
Automatically detect Dolibarr's main URL root.
Definition inc.php:741
detect_dolibarr_main_document_root()
Automatically detect Dolibarr's main document root.
Definition inc.php:705
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:137
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140