dolibarr 19.0.3
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 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30include_once 'inc.php';
31
32global $langs;
33
34$err = 0;
35
36$setuplang = GETPOST("selectlang", 'alpha', 3) ? GETPOST("selectlang", 'alpha', 3) : (GETPOST('lang', 'alpha', 1) ? GETPOST('lang', 'alpha', 1) : 'auto');
37$langs->setDefaultLang($setuplang);
38
39$langs->loadLangs(array("install", "errors"));
40
41dolibarr_install_syslog("- fileconf: entering fileconf.php page");
42
43// You can force preselected values of the config step of Dolibarr by adding a file
44// install.forced.php into directory htdocs/install (This is the case with some wizard
45// installer like DoliWamp, DoliMamp or DoliBuntu).
46// We first init "forced values" to nothing.
47if (!isset($force_install_noedit)) {
48 $force_install_noedit = ''; // 1=To block vars specific to distrib, 2 to block all technical parameters
49}
50if (!isset($force_install_type)) {
51 $force_install_type = '';
52}
53if (!isset($force_install_dbserver)) {
54 $force_install_dbserver = '';
55}
56if (!isset($force_install_port)) {
57 $force_install_port = '';
58}
59if (!isset($force_install_database)) {
60 $force_install_database = '';
61}
62if (!isset($force_install_prefix)) {
63 $force_install_prefix = '';
64}
65if (!isset($force_install_createdatabase)) {
66 $force_install_createdatabase = '';
67}
68if (!isset($force_install_databaselogin)) {
69 $force_install_databaselogin = '';
70}
71if (!isset($force_install_databasepass)) {
72 $force_install_databasepass = '';
73}
74if (!isset($force_install_databaserootlogin)) {
75 $force_install_databaserootlogin = '';
76}
77if (!isset($force_install_databaserootpass)) {
78 $force_install_databaserootpass = '';
79}
80// Now we load forced values from install.forced.php file.
81$useforcedwizard = false;
82$forcedfile = "./install.forced.php";
83if ($conffile == "/etc/dolibarr/conf.php") {
84 $forcedfile = "/etc/dolibarr/install.forced.php"; // Must be after inc.php
85}
86if (@file_exists($forcedfile)) {
87 $useforcedwizard = true;
88 include_once $forcedfile;
89}
90
91
92
93/*
94 * View
95 */
96
97session_start(); // To be able to keep info into session (used for not losing pass during navigation. pass must not transit through parmaeters)
98
99pHeader($langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY) ? '' : $force_dolibarr_js_JQUERY.'/'), 'main-inside-bis');
100
101// Test if we can run a first install process
102if (!is_writable($conffile)) {
103 print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
104 dolibarr_install_syslog("fileconf: config file is not writable", LOG_WARNING);
105 dolibarr_install_syslog("- fileconf: end");
106 pFooter(1, $setuplang, 'jscheckparam');
107 exit;
108}
109
110if (!empty($force_install_message)) {
111 print '<div><br>'.$langs->trans($force_install_message).'</div>';
112
113 /*print '<script type="text/javascript">';
114 print ' jQuery(document).ready(function() {
115 jQuery("#linktoshowtechnicalparam").click(function() {
116 jQuery(".hidewhenedit").hide();
117 jQuery(".hidewhennoedit").show();
118 });';
119 if ($force_install_noedit) print 'jQuery(".hidewhennoedit").hide();';
120 print '});';
121 print '</script>';
122
123 print '<br><a href="#" id="linktoshowtechnicalparam" class="hidewhenedit">'.$langs->trans("ShowEditTechnicalParameters").'</a><br>';
124 */
125}
126
127?>
128<div>
129
130
131<table class="nobordernopadding<?php if ($force_install_noedit) {
132 print ' hidewhennoedit';
133 } ?>">
134
135 <tr>
136 <td colspan="3" class="label">
137 <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>
138 </td>
139 </tr>
140
141 <!-- Documents root $dolibarr_main_document_root -->
142 <tr>
143 <td class="label"><label for="main_dir"><b><?php print $langs->trans("WebPagesDirectory"); ?></b></label></td>
144<?php
145if (empty($dolibarr_main_document_root)) {
146 $dolibarr_main_document_root = GETPOSTISSET('main_dir') ? GETPOST('main_dir') : detect_dolibarr_main_document_root();
147}
148?>
149 <td class="label">
150 <input type="text"
151 class="minwidth300"
152 id="main_dir"
153 name="main_dir"
154 value="<?php print $dolibarr_main_document_root ?>"
155<?php
156if (!empty($force_install_noedit)) {
157 print ' disabled';
158}
159?>
160 >
161 </td>
162 <td class="comment"><?php
163 print '<span class="opacitymedium">'.$langs->trans("WithNoSlashAtTheEnd")."</span><br>";
164 print $langs->trans("Examples").":<br>";
165 ?>
166 <ul>
167 <li>/var/www/dolibarr/htdocs</li>
168 <li>C:/wwwroot/dolibarr/htdocs</li>
169 </ul>
170 </td>
171 </tr>
172
173 <!-- Documents URL $dolibarr_main_data_root -->
174 <tr>
175 <td class="label"><label for="main_data_dir"><b><?php print $langs->trans("DocumentsDirectory"); ?></b></label></td>
176 <?php
177 if (!empty($force_install_main_data_root)) {
178 $dolibarr_main_data_root = @$force_install_main_data_root;
179 }
180 if (empty($dolibarr_main_data_root)) {
181 $dolibarr_main_data_root = GETPOSTISSET('main_data_dir') ? GETPOST('main_data_dir') : detect_dolibarr_main_data_root($dolibarr_main_document_root);
182 }
183 ?>
184 <td class="label">
185 <input type="text"
186 class="minwidth300"
187 id="main_data_dir"
188 name="main_data_dir"
189 value="<?php print $dolibarr_main_data_root ?>"
190<?php if (!empty($force_install_noedit)) {
191 print ' disabled';
192} ?>
193 >
194 </td>
195 <td class="comment"><?php
196 print '<span class="opacitymedium">'.$langs->trans("WithNoSlashAtTheEnd")."</span><br>";
197 print $langs->trans("DirectoryRecommendation")."<br>";
198 print $langs->trans("Examples").":<br>";
199 ?>
200 <ul>
201 <li>/var/lib/dolibarr/documents</li>
202 <li>C:/My Documents/dolibarr/documents</li>
203 </ul>
204 </td>
205 </tr>
206
207 <!-- Root URL $dolibarr_main_url_root -->
208 <?php
209 if (empty($dolibarr_main_url_root)) {
210 $dolibarr_main_url_root = GETPOSTISSET('main_url') ? GETPOST('main_url') : detect_dolibarr_main_url_root();
211 }
212 ?>
213 <tr>
214 <td class="label"><label for="main_url"><b><?php echo $langs->trans("URLRoot"); ?></b></label>
215 </td>
216 <td class="label">
217 <input type="text"
218 class="minwidth300"
219 id="main_url"
220 name="main_url"
221 value="<?php print $dolibarr_main_url_root; ?> "
222<?php if (!empty($force_install_noedit)) {
223 print ' disabled';
224}
225?>
226 >
227 </td>
228 <td class="comment"><?php print $langs->trans("Examples").":<br>"; ?>
229 <ul>
230 <li>http://localhost/</li>
231 <li>http://www.myserver.com:8180/dolibarr</li>
232 <li>https://www.myvirtualfordolibarr.com/</li>
233 </ul>
234 </td>
235 </tr>
236
237 <?php
238 if (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') { // Enabled if the installation process is "https://"
239 ?>
240 <tr>
241 <td class="label"><label for="main_force_https"><?php echo $langs->trans("ForceHttps"); ?></label></td>
242 <td class="label">
243 <input type="checkbox"
244 id="main_force_https"
245 name="main_force_https"
246 <?php if (!empty($force_install_mainforcehttps)) {
247 print ' checked';
248 } ?>
249 <?php if ($force_install_noedit == 2 && $force_install_mainforcehttps !== null) {
250 print ' disabled';
251 } ?>
252 >
253 </td>
254 <td class="comment"><?php echo $langs->trans("CheckToForceHttps"); ?>
255 </td>
256
257 </tr>
258 <?php
259 }
260 ?>
261
262 <!-- Dolibarr database -->
263
264 <tr>
265 <td colspan="3" class="label"><br>
266 <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>
267 </td>
268 </tr>
269
270 <tr>
271 <td class="label"><label for="db_name"><b><?php echo $langs->trans("DatabaseName"); ?></b></label></td>
272 <td class="label">
273 <input type="text"
274 id="db_name"
275 name="db_name"
276 value="<?php echo (!empty($dolibarr_main_db_name)) ? $dolibarr_main_db_name : ($force_install_database ? $force_install_database : 'dolibarr'); ?>"
277 <?php if ($force_install_noedit == 2 && $force_install_database !== null) {
278 print ' disabled';
279 } ?>
280 >
281 </td>
282 <td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td>
283 </tr>
284
285
286 <?php
287 if (!isset($dolibarr_main_db_host)) {
288 $dolibarr_main_db_host = "localhost";
289 }
290 ?>
291 <tr>
292 <!-- Driver type -->
293 <td class="label"><label for="db_type"><b><?php echo $langs->trans("DriverType"); ?></b></label></td>
294
295 <td class="label">
296 <?php
297
298 $defaultype = !empty($dolibarr_main_db_type) ? $dolibarr_main_db_type : (empty($force_install_type) ? 'mysqli' : $force_install_type);
299
300 $modules = array();
301 $nbok = $nbko = 0;
302 $option = '';
303
304 // Scan les drivers
305 $dir = DOL_DOCUMENT_ROOT.'/core/db';
306 $handle = opendir($dir);
307 if (is_resource($handle)) {
308 while (($file = readdir($handle)) !== false) {
309 if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) {
310 $type = $reg[1];
311 if ($type === 'DoliDB') {
312 continue; // Skip abstract class
313 }
314 $class = 'DoliDB'.ucfirst($type);
315 include_once $dir."/".$file;
316
317 if ($type == 'sqlite') {
318 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)
319 }
320 if ($type == 'sqlite3') {
321 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)
322 }
323
324 // Version min of database
325 $versionbasemin = explode('.', $class::VERSIONMIN);
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 $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*'));
498 if (!empty($dolibarr_main_prod) && empty($_SESSION['dol_save_pass'])) { // So value can't be found if install page still accessible
499 $autofill = '';
500 }
501 print dol_escape_htmltag($autofill);
502 ?>"
503 <?php if ($force_install_noedit == 2 && $force_install_databasepass !== null) {
504 print ' disabled';
505 } ?>
506 >
507 </td>
508 <td class="comment"><?php echo $langs->trans("AdminPassword"); ?></td>
509 </tr>
510
511 <tr class="hidesqlite">
512 <td class="label"><label for="db_create_user"><?php echo $langs->trans("CreateUser"); ?></label></td>
513 <td class="label">
514 <input type="checkbox"
515 id="db_create_user"
516 name="db_create_user"
517 value="on"
518 <?php
519 $checked = 0;
520 if (!empty($force_install_createuser)) {
521 $checked = 1;
522 print ' checked';
523 } ?>
524 <?php if ($force_install_noedit == 2 && $force_install_createuser !== null) {
525 print ' disabled';
526 } ?>
527 >
528 </td>
529 <td class="comment">
530 <?php echo $langs->trans("CheckToCreateUser"); ?>
531 </td>
532 </tr>
533
534
535 <!-- Super access -->
536 <?php
537 $force_install_databaserootlogin = parse_database_login($force_install_databaserootlogin);
538 $force_install_databaserootpass = parse_database_pass($force_install_databaserootpass);
539 ?>
540 <tr class="hidesqlite hideroot">
541 <td colspan="3" class="label"><br>
542 <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>
543 </td>
544 </tr>
545
546 <tr class="hidesqlite hideroot">
547 <td class="label"><label for="db_user_root"><b><?php echo $langs->trans("Login"); ?></b></label></td>
548 <td class="label">
549 <input type="text"
550 id="db_user_root"
551 name="db_user_root"
552 class="needroot"
553 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 : '')); ?>"
554 <?php if ($force_install_noedit > 0 && !empty($force_install_databaserootlogin)) {
555 print ' disabled';
556 } ?>
557 >
558 </td>
559 <td class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?>
560 <!--
561 <?php echo '<br>'.$langs->trans("Examples").':<br>' ?>
562 <ul>
563 <li>root (Mysql)</li>
564 <li>postgres (PostgreSql)</li>
565 </ul>
566 </td>
567 -->
568
569 </tr>
570 <tr class="hidesqlite hideroot">
571 <td class="label"><label for="db_pass_root"><b><?php echo $langs->trans("Password"); ?></b></label></td>
572 <td class="label">
573 <input type="password"
574 autocomplete="off"
575 id="db_pass_root"
576 name="db_pass_root"
577 class="needroot text-security"
578 value="<?php
579 // 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.
580 $autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : (isset($db_pass_root) ? $db_pass_root : ''));
581 if (!empty($dolibarr_main_prod)) {
582 $autofill = '';
583 }
584 // Do not autofill password if instance is a production instance
585 if (!empty($_SERVER["SERVER_NAME"]) && !in_array(
586 $_SERVER["SERVER_NAME"],
587 array('127.0.0.1', 'localhost', 'localhostgit')
588 )
589 ) {
590 $autofill = '';
591 } // Do not autofill password for remote access
592 print dol_escape_htmltag($autofill);
593 ?>"
594 <?php if ($force_install_noedit > 0 && !empty($force_install_databaserootpass)) {
595 print ' disabled'; /* May be removed by javascript*/
596 } ?>
597 >
598 </td>
599 <td class="comment"><?php echo $langs->trans("KeepEmptyIfNoPassword"); ?>
600 </td>
601 </tr>
602
603</table>
604</div>
605
606<script type="text/javascript">
607function init_needroot()
608{
609 console.log("init_needroot force_install_noedit=<?php echo $force_install_noedit?>");
610 console.log(jQuery("#db_create_database").is(":checked"));
611 console.log(jQuery("#db_create_user").is(":checked"));
612
613 if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked"))
614 {
615 console.log("init_needroot show root section");
616 jQuery(".hideroot").show();
617 <?php
618 if (empty($force_install_noedit)) { ?>
619 jQuery(".needroot").removeAttr('disabled');
620 <?php } ?>
621 }
622 else
623 {
624 console.log("init_needroot hide root section");
625 jQuery(".hideroot").hide();
626 jQuery(".needroot").prop('disabled', true);
627 }
628}
629
630function checkDatabaseName(databasename) {
631 if (databasename.match(/[;\.]/)) { return false; }
632 return true;
633}
634
635function jscheckparam()
636{
637 console.log("Click on jscheckparam");
638
639 var ok = true;
640
641 if (document.forminstall.main_dir.value == '')
642 {
643 ok=false;
644 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("WebPagesDirectory"))); ?>');
645 }
646 else if (document.forminstall.main_data_dir.value == '')
647 {
648 ok=false;
649 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("DocumentsDirectory"))); ?>');
650 }
651 else if (document.forminstall.main_url.value == '')
652 {
653 ok=false;
654 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("URLRoot"))); ?>');
655 }
656 else if (document.forminstall.db_host.value == '')
657 {
658 ok=false;
659 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("Server"))); ?>');
660 }
661 else if (document.forminstall.db_name.value == '')
662 {
663 ok=false;
664 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatabaseName"))); ?>');
665 }
666 else if (! checkDatabaseName(document.forminstall.db_name.value))
667 {
668 ok=false;
669 alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentitiesnoconv("DatabaseName"))); ?>');
670 }
671 // If create database asked
672 else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == ''))
673 {
674 ok=false;
675 alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>');
676 init_needroot();
677 }
678 // If create user asked
679 else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == ''))
680 {
681 ok=false;
682 alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>');
683 init_needroot();
684 }
685
686 return ok;
687}
688
689
690jQuery(document).ready(function() { // TODO Test $( window ).load(function() to see if the init_needroot work better after a back
691
692 var dbtype = jQuery("#db_type");
693
694 dbtype.change(function () {
695 if (dbtype.val() == 'sqlite' || dbtype.val() == 'sqlite3') {
696 jQuery(".hidesqlite").hide();
697 } else {
698 jQuery(".hidesqlite").show();
699 }
700
701 // Automatically set default database ports and admin user
702 if (dbtype.val() == 'mysql' || dbtype.val() == 'mysqli') {
703 jQuery("#db_port").val(3306);
704 jQuery("#db_user_root").val('root');
705 } else if (dbtype.val() == 'pgsql') {
706 jQuery("#db_port").val(5432);
707 jQuery("#db_user_root").val('postgres');
708 } else if (dbtype.val() == 'mssql') {
709 jQuery("#db_port").val(1433);
710 jQuery("#db_user_root").val('sa');
711 }
712
713 });
714
715 jQuery("#db_create_database").click(function() {
716 console.log("click on db_create_database");
717 init_needroot();
718 });
719 jQuery("#db_create_user").click(function() {
720 console.log("click on db_create_user");
721 init_needroot();
722 });
723 <?php if ($force_install_noedit == 2 && empty($force_install_databasepass)) { ?>
724 jQuery("#db_pass").focus();
725 <?php } ?>
726
727 init_needroot();
728});
729</script>
730
731
732<?php
733
734// $db->close(); Not database connexion yet
735
736dolibarr_install_syslog("- fileconf: end");
737pFooter($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.
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
Definition inc.php:516
detect_dolibarr_main_data_root($dolibarr_main_document_root)
Automatically detect Dolibarr's main data root.
Definition inc.php:703
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition inc.php:605
parse_database_login($force_install_databaserootlogin)
Replaces automatic database login by actual value.
Definition inc.php:748
parse_database_pass($force_install_databaserootpass)
Replaces automatic database password by actual value.
Definition inc.php:759
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition inc.php:666
detect_dolibarr_main_url_root()
Automatically detect Dolibarr's main URL root.
Definition inc.php:715
detect_dolibarr_main_document_root()
Automatically detect Dolibarr's main document root.
Definition inc.php:679
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:121
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:124