2004-10-20 00:24:10 +02:00
|
|
|
<?php
|
2016-02-22 18:45:00 +01:00
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
|
|
|
|
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
|
|
|
|
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
|
|
* Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
2004-02-12 17:44:49 +01:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-02-12 17:44:49 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-02-12 17:44:49 +01:00
|
|
|
*/
|
2005-03-26 13:55:20 +01:00
|
|
|
|
|
|
|
|
/**
|
2015-07-06 15:29:58 +02:00
|
|
|
* \file htdocs/install/step4.php
|
2009-11-27 19:26:03 +01:00
|
|
|
* \ingroup install
|
|
|
|
|
* \brief Ask login and password of Dolibarr admin user
|
2008-12-15 02:04:32 +01:00
|
|
|
*/
|
2005-03-26 13:55:20 +01:00
|
|
|
|
|
|
|
|
|
2012-08-23 02:46:16 +02:00
|
|
|
include_once 'inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once $dolibarr_main_document_root.'/core/class/conf.class.php';
|
|
|
|
|
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
|
2006-08-06 01:55:10 +02:00
|
|
|
|
2016-02-22 18:45:00 +01:00
|
|
|
global $langs;
|
2005-02-12 22:25:39 +01:00
|
|
|
|
2023-12-04 12:36:19 +01:00
|
|
|
$setuplang = GETPOST('selectlang', 'aZ09', 3) ? GETPOST('selectlang', 'aZ09', 3) : (empty($argv[1]) ? 'auto' : $argv[1]);
|
2005-10-30 02:07:00 +01:00
|
|
|
$langs->setDefaultLang($setuplang);
|
|
|
|
|
|
2018-10-01 08:22:23 +02:00
|
|
|
$langs->loadLangs(array("admin", "install"));
|
2005-02-12 22:25:39 +01:00
|
|
|
|
2012-04-08 23:18:36 +02:00
|
|
|
// Now we load forced value from install.forced.php file.
|
2020-04-10 10:59:32 +02:00
|
|
|
$useforcedwizard = false;
|
|
|
|
|
$forcedfile = "./install.forced.php";
|
2021-02-22 15:18:01 +01:00
|
|
|
if ($conffile == "/etc/dolibarr/conf.php") {
|
|
|
|
|
$forcedfile = "/etc/dolibarr/install.forced.php";
|
|
|
|
|
}
|
2016-02-22 18:45:00 +01:00
|
|
|
if (@file_exists($forcedfile)) {
|
|
|
|
|
$useforcedwizard = true;
|
|
|
|
|
include_once $forcedfile;
|
|
|
|
|
}
|
2008-03-12 23:14:24 +01:00
|
|
|
|
2023-10-25 17:03:37 +02:00
|
|
|
dolibarr_install_syslog("--- step4: entering step4.php page");
|
2008-04-21 09:21:13 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$error = 0;
|
2008-12-15 02:04:32 +01:00
|
|
|
$ok = 0;
|
2008-03-12 23:14:24 +01:00
|
|
|
|
2005-10-30 02:07:00 +01:00
|
|
|
|
2005-02-12 22:25:39 +01:00
|
|
|
|
2008-12-15 02:04:32 +01:00
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
2004-08-25 22:12:02 +02:00
|
|
|
|
2024-09-05 11:49:33 +02:00
|
|
|
pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("AdminAccountCreation"), "step5");
|
2004-08-25 22:12:02 +02:00
|
|
|
|
2010-09-29 10:09:17 +02:00
|
|
|
// Test if we can run a first install process
|
2021-02-22 15:18:01 +01:00
|
|
|
if (!is_writable($conffile)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
|
|
|
|
|
pFooter(1, $setuplang, 'jscheckparam');
|
|
|
|
|
exit;
|
2010-09-29 10:09:17 +02:00
|
|
|
}
|
|
|
|
|
|
2011-06-07 20:07:27 +02:00
|
|
|
|
2021-04-30 15:34:02 +02:00
|
|
|
print '<h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/key.svg" width="20" alt="Database"> '.$langs->trans("DolibarrAdminLogin").'</h3>';
|
2017-07-08 12:48:17 +02:00
|
|
|
|
|
|
|
|
print $langs->trans("LastStepDesc").'<br><br>';
|
2011-06-07 20:07:27 +02:00
|
|
|
|
|
|
|
|
|
2018-07-07 23:50:41 +02:00
|
|
|
print '<table cellspacing="0" cellpadding="2">';
|
2004-02-12 17:44:49 +01:00
|
|
|
|
2023-06-24 04:04:02 +02:00
|
|
|
$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
|
2011-09-28 19:41:08 +02:00
|
|
|
|
2021-02-22 15:18:01 +01:00
|
|
|
if ($db->ok) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<tr><td><label for="login">'.$langs->trans("Login").' :</label></td><td>';
|
2022-07-04 03:06:56 +02:00
|
|
|
print '<input id="login" name="login" type="text" value="'.(GETPOSTISSET("login") ? GETPOST("login", 'alpha') : (isset($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')).'"'.(@$force_install_noedit == 2 && $force_install_dolibarrlogin !== null ? ' disabled' : '').' autofocus></td></tr>';
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<tr><td><label for="pass">'.$langs->trans("Password").' :</label></td><td>';
|
2022-05-08 15:18:34 +02:00
|
|
|
print '<input type="password" id="pass" name="pass" autocomplete="new-password" minlength="8"></td></tr>';
|
2022-08-13 12:33:00 +02:00
|
|
|
print '<tr><td><label for="pass_verif">'.$langs->trans("PasswordRetype").' :</label></td><td>';
|
2022-05-08 15:18:34 +02:00
|
|
|
print '<input type="password" id="pass_verif" name="pass_verif" autocomplete="new-password" minlength="8"></td></tr>';
|
2020-10-31 14:32:18 +01:00
|
|
|
print '</table>';
|
|
|
|
|
|
2024-03-28 20:19:28 +01:00
|
|
|
if (GETPOSTINT("error") == 1) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<br>';
|
|
|
|
|
print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
|
|
|
|
|
$error = 0; // We show button
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-28 20:19:28 +01:00
|
|
|
if (GETPOSTINT("error") == 2) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<br>';
|
|
|
|
|
print '<div class="error">';
|
|
|
|
|
print $langs->trans("PleaseTypePassword");
|
|
|
|
|
print '</div>';
|
|
|
|
|
$error = 0; // We show button
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-28 20:19:28 +01:00
|
|
|
if (GETPOSTINT("error") == 3) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<br>';
|
|
|
|
|
print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
|
|
|
|
|
$error = 0; // We show button
|
|
|
|
|
}
|
2004-01-27 15:36:40 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$ret = 0;
|
2021-02-22 15:18:01 +01:00
|
|
|
if ($error && isset($argv[1])) {
|
|
|
|
|
$ret = 1;
|
|
|
|
|
}
|
2018-04-12 19:13:06 +02:00
|
|
|
dolibarr_install_syslog("Exit ".$ret);
|
|
|
|
|
|
2023-10-25 17:03:37 +02:00
|
|
|
dolibarr_install_syslog("--- step4: end");
|
2011-06-08 13:23:55 +02:00
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
pFooter($error, $setuplang);
|
2012-04-08 23:18:36 +02:00
|
|
|
|
|
|
|
|
$db->close();
|
2018-04-12 19:13:06 +02:00
|
|
|
|
|
|
|
|
// Return code if ran from command line
|
2021-02-22 15:18:01 +01:00
|
|
|
if ($ret) {
|
|
|
|
|
exit($ret);
|
|
|
|
|
}
|