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
24/**
25 *       \file       htdocs/install/fileconf.php
26 *       \ingroup    install
27 *       \brief      Ask all information required to build Dolibarr htdocs/conf/conf.php file (will be written to disk on next page step1)
28 */
29
30include_once 'inc.php';
31
32global $langs;
33
34$err = 0;
35
36$setuplang = GETPOST("selectlang", '', 3) ?GETPOST("selectlang", '', 3) : (isset($_GET["lang"]) ? $_GET["lang"] : '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="valigntextbottom" 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_url_root)) {
146	$dolibarr_main_document_root = 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		$dolibarr_main_data_root = @$force_install_main_data_root;
178		if (empty($dolibarr_main_data_root)) {
179			$dolibarr_main_data_root = detect_dolibarr_main_data_root($dolibarr_main_document_root);
180		}
181		?>
182		<td class="label">
183			<input type="text"
184				   class="minwidth300"
185				   id="main_data_dir"
186				   name="main_data_dir"
187				   value="<?php print $dolibarr_main_data_root ?>"
188<?php if (!empty($force_install_noedit)) {
189	print ' disabled';
190} ?>
191			>
192		</td>
193		<td class="comment"><?php
194		print '<span class="opacitymedium">'.$langs->trans("WithNoSlashAtTheEnd")."</span><br>";
195		print $langs->trans("DirectoryRecommendation")."<br>";
196		print $langs->trans("Examples").":<br>";
197		?>
198		<ul>
199			<li>/var/lib/dolibarr/documents</li>
200			<li>C:/My Documents/dolibarr/documents</li>
201		</ul>
202		</td>
203	</tr>
204
205	<!-- Root URL $dolibarr_main_url_root -->
206	<?php
207	if (empty($dolibarr_main_url_root)) {
208		$dolibarr_main_url_root = detect_dolibarr_main_url_root();
209	}
210	?>
211	<tr>
212		<td class="label"><label for="main_url"><b><?php echo $langs->trans("URLRoot"); ?></b></label>
213		</td>
214		<td class="label">
215			<input type="text"
216				   class="minwidth300"
217				   id="main_url"
218				   name="main_url"
219				   value="<?php print $dolibarr_main_url_root; ?> "
220<?php if (!empty($force_install_noedit)) {
221	print ' disabled';
222}
223?>
224			>
225		</td>
226		<td class="comment"><?php print $langs->trans("Examples").":<br>"; ?>
227		<ul>
228			<li>http://localhost/</li>
229			<li>http://www.myserver.com:8180/dolibarr</li>
230			<li>https://www.myvirtualfordolibarr.com/</li>
231		</ul>
232		</td>
233	</tr>
234
235	<?php
236	if (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') {   // Enabled if the installation process is "https://"
237		?>
238	<tr>
239					<td class="label"><label for="main_force_https"><?php echo $langs->trans("ForceHttps"); ?></label></td>
240					<td class="label">
241						<input type="checkbox"
242							   id="main_force_https"
243							   name="main_force_https"
244				<?php if (!empty($force_install_mainforcehttps)) {
245					print ' checked';
246				} ?>
247				<?php if ($force_install_noedit == 2 && $force_install_mainforcehttps !== null) {
248					print ' disabled';
249				} ?>
250			>
251		</td>
252		<td class="comment"><?php echo $langs->trans("CheckToForceHttps"); ?>
253		</td>
254
255	</tr>
256		<?php
257	}
258	?>
259
260	<!-- Dolibarr database -->
261
262	<tr>
263		<td colspan="3" class="label"><br>
264		<h3><img class="valigntextbottom" src="../theme/common/octicons/build/svg/database.svg" width="20" alt="webserver"> <?php echo $langs->trans("DolibarrDatabase"); ?></h3>
265		</td>
266	</tr>
267
268	<tr>
269		<td class="label"><label for="db_name"><b><?php echo $langs->trans("DatabaseName"); ?></b></label></td>
270		<td class="label">
271			<input type="text"
272				   id="db_name"
273				   name="db_name"
274				   value="<?php echo (!empty($dolibarr_main_db_name)) ? $dolibarr_main_db_name : ($force_install_database ? $force_install_database : 'dolibarr'); ?>"
275				<?php if ($force_install_noedit == 2 && $force_install_database !== null) {
276					print ' disabled';
277				} ?>
278			>
279		</td>
280		<td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td>
281	</tr>
282
283
284	<?php
285	if (!isset($dolibarr_main_db_host)) {
286		$dolibarr_main_db_host = "localhost";
287	}
288	?>
289	<tr>
290		<!-- Driver type -->
291		<td class="label"><label for="db_type"><b><?php echo $langs->trans("DriverType"); ?></b></label></td>
292
293		<td class="label">
294		<?php
295
296		$defaultype = !empty($dolibarr_main_db_type) ? $dolibarr_main_db_type : ($force_install_type ? $force_install_type : 'mysqli');
297
298		$modules = array();
299		$nbok = $nbko = 0;
300		$option = '';
301
302		// Scan les drivers
303		$dir = DOL_DOCUMENT_ROOT.'/core/db';
304		$handle = opendir($dir);
305		if (is_resource($handle)) {
306			while (($file = readdir($handle)) !== false) {
307				if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) {
308					$type = $reg[1];
309					if ($type === 'DoliDB') {
310						continue; // Skip abstract class
311					}
312					$class = 'DoliDB'.ucfirst($type);
313					include_once $dir."/".$file;
314
315					if ($type == 'sqlite') {
316						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)
317					}
318					if ($type == 'sqlite3') {
319						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)
320					}
321
322					// Version min of database
323					$versionbasemin = explode('.', $class::VERSIONMIN);
324					$note = '('.$class::LABEL.' >= '.$class::VERSIONMIN.')';
325
326					// Switch to mysql if mysqli is not present
327					if ($defaultype == 'mysqli' && !function_exists('mysqli_connect')) {
328						$defaultype = 'mysql';
329					}
330
331					// Show line into list
332					if ($type == 'mysql') {
333						$testfunction = 'mysql_connect'; $testclass = '';
334					}
335					if ($type == 'mysqli') {
336						$testfunction = 'mysqli_connect'; $testclass = '';
337					}
338					if ($type == 'pgsql') {
339						$testfunction = 'pg_connect'; $testclass = '';
340					}
341					if ($type == 'mssql') {
342						$testfunction = 'mssql_connect'; $testclass = '';
343					}
344					if ($type == 'sqlite') {
345						$testfunction = ''; $testclass = 'PDO';
346					}
347					if ($type == 'sqlite3') {
348						$testfunction = ''; $testclass = 'SQLite3';
349					}
350					$option .= '<option value="'.$type.'"'.($defaultype == $type ? ' selected' : '');
351					if ($testfunction && !function_exists($testfunction)) {
352						$option .= ' disabled';
353					}
354					if ($testclass && !class_exists($testclass)) {
355						$option .= ' disabled';
356					}
357					$option .= '>';
358					$option .= $type.'&nbsp; &nbsp;';
359					if ($note) {
360						$option .= ' '.$note;
361					}
362					// Deprecated and experimental
363					if ($type == 'mysql') {
364						$option .= ' '.$langs->trans("Deprecated");
365					} elseif ($type == 'mssql') {
366						$option .= ' '.$langs->trans("VersionExperimental");
367					} elseif ($type == 'sqlite') {
368						$option .= ' '.$langs->trans("VersionExperimental");
369					} elseif ($type == 'sqlite3') {
370						$option .= ' '.$langs->trans("VersionExperimental");
371					} elseif (!function_exists($testfunction)) {
372						// No available
373						$option .= ' - '.$langs->trans("FunctionNotAvailableInThisPHP");
374					}
375					$option .= '</option>';
376				}
377			}
378		}
379		?>
380			<select id="db_type"
381					name="db_type"
382				<?php if ($force_install_noedit == 2 && $force_install_type !== null) {
383					print ' disabled';
384				} ?>
385			>
386				<?php print $option; ?>
387			</select>
388
389		</td>
390		<td class="comment"><?php echo $langs->trans("DatabaseType"); ?></td>
391
392	</tr>
393
394	<tr class="hidesqlite">
395		<td class="label"><label for="db_host"><b><?php echo $langs->trans("DatabaseServer"); ?></b></label></td>
396		<td class="label">
397			<input type="text"
398				   id="db_host"
399				   name="db_host"
400				   value="<?php print (!empty($force_install_dbserver) ? $force_install_dbserver : (!empty($dolibarr_main_db_host) ? $dolibarr_main_db_host : 'localhost')); ?>"
401				<?php if ($force_install_noedit == 2 && $force_install_dbserver !== null) {
402					print ' disabled';
403				} ?>
404			>
405		</td>
406		<td class="comment"><?php echo $langs->trans("ServerAddressDescription"); ?>
407		</td>
408
409	</tr>
410
411	<tr class="hidesqlite">
412		<td class="label"><label for="db_port"><?php echo $langs->trans("Port"); ?></label></td>
413		<td class="label">
414			<input type="text"
415				   name="db_port"
416				   id="db_port"
417				   value="<?php print (!empty($force_install_port)) ? $force_install_port : $dolibarr_main_db_port; ?>"
418				<?php if ($force_install_noedit == 2 && $force_install_port !== null) {
419					print ' disabled';
420				} ?>
421			>
422		</td>
423		<td class="comment"><?php echo $langs->trans("ServerPortDescription"); ?>
424		</td>
425
426	</tr>
427
428	<tr class="hidesqlite">
429		<td class="label"><label for="db_prefix"><?php echo $langs->trans("DatabasePrefix"); ?></label></td>
430		<td class="label">
431			<input type="text"
432				   id="db_prefix"
433				   name="db_prefix"
434				   value="<?php echo(!empty($force_install_prefix) ? $force_install_prefix : (!empty($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : 'llx_')); ?>"
435				<?php if ($force_install_noedit == 2 && $force_install_prefix !== null) {
436					print ' disabled';
437				} ?>
438			>
439		</td>
440		<td class="comment"><?php echo $langs->trans("DatabasePrefixDescription"); ?></td>
441	</tr>
442
443	<tr class="hidesqlite">
444		<td class="label"><label for="db_create_database"><?php echo $langs->trans("CreateDatabase"); ?></label></td>
445		<td class="label">
446			<input type="checkbox"
447				   id="db_create_database"
448				   name="db_create_database"
449				<?php if ($force_install_createdatabase) {
450					print ' checked';
451				} ?>
452				<?php if ($force_install_noedit == 2 && $force_install_createdatabase !== null) {
453					print ' disabled';
454				} ?>
455			>
456		</td>
457		<td class="comment"><?php echo $langs->trans("CheckToCreateDatabase"); ?>
458		</td>
459	</tr>
460
461	<tr class="hidesqlite">
462		<td class="label"><label for="db_user"><b><?php echo $langs->trans("Login"); ?></b></label></td>
463		<td class="label">
464			<input type="text"
465				   id="db_user"
466				   name="db_user"
467				   value="<?php print (!empty($force_install_databaselogin)) ? $force_install_databaselogin : $dolibarr_main_db_user; ?>"
468				<?php if ($force_install_noedit == 2 && $force_install_databaselogin !== null) {
469					print ' disabled';
470				} ?>
471			>
472		</td>
473		<td class="comment"><?php echo $langs->trans("AdminLogin"); ?></td>
474	</tr>
475
476	<tr class="hidesqlite">
477		<td class="label"><label for="db_pass"><b><?php echo $langs->trans("Password"); ?></b></label></td>
478		<td class="label">
479			<input type="password"
480				   id="db_pass" autocomplete="off"
481				   name="db_pass"
482				   value="<?php
483					// 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.
484					$autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*'));
485					if (!empty($dolibarr_main_prod)) {
486						$autofill = '';
487					}
488					print dol_escape_htmltag($autofill);
489					?>"
490				<?php if ($force_install_noedit == 2 && $force_install_databasepass !== null) {
491					print ' disabled';
492				} ?>
493			>
494		</td>
495		<td class="comment"><?php echo $langs->trans("AdminPassword"); ?></td>
496	</tr>
497
498	<tr class="hidesqlite">
499		<td class="label"><label for="db_create_user"><?php echo $langs->trans("CreateUser"); ?></label></td>
500		<td class="label">
501			<input type="checkbox"
502				   id="db_create_user"
503				   name="db_create_user"
504				<?php if (!empty($force_install_createuser)) {
505					print ' checked';
506				} ?>
507				<?php if ($force_install_noedit == 2 && $force_install_createuser !== null) {
508					print ' disabled';
509				} ?>
510			>
511		</td>
512		<td class="comment"><?php echo $langs->trans("CheckToCreateUser"); ?>
513		</td>
514	</tr>
515
516
517	<!-- Super access -->
518	<?php
519	$force_install_databaserootlogin = parse_database_login($force_install_databaserootlogin);
520	$force_install_databaserootpass = parse_database_pass($force_install_databaserootpass);
521	?>
522	<tr class="hidesqlite hideroot">
523		<td colspan="3" class="label"><br>
524		<h3><img class="valigntextbottom" src="../theme/common/octicons/build/svg/shield.svg" width="20" alt="webserver"> <?php echo $langs->trans("DatabaseSuperUserAccess"); ?></h3>
525		</td>
526	</tr>
527
528	<tr class="hidesqlite hideroot">
529		<td class="label"><label for="db_user_root"><b><?php echo $langs->trans("Login"); ?></b></label></td>
530		<td class="label">
531			<input type="text"
532				   id="db_user_root"
533				   name="db_user_root"
534				   class="needroot"
535				   value="<?php print (!empty($force_install_databaserootlogin)) ? $force_install_databaserootlogin : @$db_user_root; ?>"
536				<?php if ($force_install_noedit > 0 && !empty($force_install_databaserootlogin)) {
537					print ' disabled';
538				} ?>
539			>
540		</td>
541		<td class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?>
542		<!--
543		<?php echo '<br>'.$langs->trans("Examples").':<br>' ?>
544		<ul>
545			<li>root (Mysql)</li>
546			<li>postgres (PostgreSql)</li>
547		</ul>
548		</td>
549		 -->
550
551	</tr>
552	<tr class="hidesqlite hideroot">
553		<td class="label"><label for="db_pass_root"><b><?php echo $langs->trans("Password"); ?></b></label></td>
554		<td class="label">
555			<input type="password"
556				   autocomplete="off"
557				   id="db_pass_root"
558				   name="db_pass_root"
559				   class="needroot"
560				   value="<?php
561					// 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.
562					$autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : @$db_pass_root);
563					if (!empty($dolibarr_main_prod)) {
564						$autofill = '';
565					}
566					// Do not autofill password if instance is a production instance
567					if (!empty($_SERVER["SERVER_NAME"]) && !in_array(
568						$_SERVER["SERVER_NAME"],
569						array('127.0.0.1', 'localhost', 'localhostgit')
570					)
571					) {
572						$autofill = '';
573					}    // Do not autofill password for remote access
574					print dol_escape_htmltag($autofill);
575					?>"
576				<?php if ($force_install_noedit > 0 && !empty($force_install_databaserootpass)) {
577					print ' disabled'; /* May be removed by javascript*/
578				} ?>
579			>
580		</td>
581		<td class="comment"><?php echo $langs->trans("KeepEmptyIfNoPassword"); ?>
582		</td>
583	</tr>
584
585</table>
586</div>
587
588<script type="text/javascript">
589jQuery(document).ready(function() {
590
591	var dbtype = jQuery("#db_type");
592
593	dbtype.change(function () {
594		if (dbtype.val() == 'sqlite' || dbtype.val() == 'sqlite3') {
595			jQuery(".hidesqlite").hide();
596		} else {
597			jQuery(".hidesqlite").show();
598		}
599
600		// Automatically set default database ports and admin user
601		if (dbtype.val() == 'mysql' || dbtype.val() == 'mysqli') {
602			jQuery("#db_port").val(3306);
603			jQuery("#db_user_root").val('root');
604		} else if (dbtype.val() == 'pgsql') {
605			jQuery("#db_port").val(5432);
606			jQuery("#db_user_root").val('postgres');
607		} else if (dbtype.val() == 'mssql') {
608			jQuery("#db_port").val(1433);
609			jQuery("#db_user_root").val('sa');
610		}
611
612	});
613
614	function init_needroot()
615	{
616		/*alert(jQuery("#db_create_database").prop("checked")); */
617		if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked"))
618		{
619			jQuery(".hideroot").show();
620			<?php
621			if ($force_install_noedit == 0) { ?>
622				jQuery(".needroot").removeAttr('disabled');
623			<?php } ?>
624		}
625		else
626		{
627			jQuery(".hideroot").hide();
628			jQuery(".needroot").prop('disabled', true);
629		}
630	}
631
632	init_needroot();
633	jQuery("#db_create_database").click(function() {
634		init_needroot();
635	});
636	jQuery("#db_create_user").click(function() {
637		init_needroot();
638	});
639	<?php if ($force_install_noedit == 2 && empty($force_install_databasepass)) { ?>
640	jQuery("#db_pass").focus();
641	<?php } ?>
642});
643
644function checkDatabaseName(databasename) {
645	if (databasename.match(/[;\.]/)) { return false; }
646	return true;
647}
648
649function jscheckparam()
650{
651	ok=true;
652
653	if (document.forminstall.main_dir.value == '')
654	{
655		ok=false;
656		alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("WebPagesDirectory"))); ?>');
657	}
658	else if (document.forminstall.main_data_dir.value == '')
659	{
660		ok=false;
661		alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("DocumentsDirectory"))); ?>');
662	}
663	else if (document.forminstall.main_url.value == '')
664	{
665		ok=false;
666		alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("URLRoot"))); ?>');
667	}
668	else if (document.forminstall.db_host.value == '')
669	{
670		ok=false;
671		alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("Server"))); ?>');
672	}
673	else if (document.forminstall.db_name.value == '')
674	{
675		ok=false;
676		alert('<?php echo dol_escape_js($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatabaseName"))); ?>');
677	}
678	else if (! checkDatabaseName(document.forminstall.db_name.value))
679	{
680		ok=false;
681		alert('<?php echo dol_escape_js($langs->transnoentities("ErrorSpecialCharNotAllowedForField", $langs->transnoentitiesnoconv("DatabaseName"))); ?>');
682	}
683	// If create database asked
684	else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == ''))
685	{
686		ok=false;
687		alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseSoRootRequired")); ?>');
688	}
689	// If create user asked
690	else if (document.forminstall.db_create_user.checked == true && (document.forminstall.db_user_root.value == ''))
691	{
692		ok=false;
693		alert('<?php echo dol_escape_js($langs->transnoentities("YouAskToCreateDatabaseUserSoRootRequired")); ?>');
694	}
695
696	return ok;
697}
698</script>
699
700
701<?php
702
703// $db->close();	Not database connexion yet
704
705dolibarr_install_syslog("- fileconf: end");
706pFooter($err, $setuplang, 'jscheckparam');
707