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
|
2011-08-01 01:24:38 +02:00
|
|
|
* along with this program. If not, see <http://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
|
|
|
|
2018-04-12 19:13:06 +02: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);
|
|
|
|
|
|
2005-02-13 17:47:32 +01:00
|
|
|
$langs->load("admin");
|
2005-02-12 22:25:39 +01:00
|
|
|
$langs->load("install");
|
|
|
|
|
|
2012-04-08 23:18:36 +02:00
|
|
|
// Now we load forced value from install.forced.php file.
|
2011-07-30 16:56:11 +02:00
|
|
|
$useforcedwizard=false;
|
2012-04-08 23:18:36 +02:00
|
|
|
$forcedfile="./install.forced.php";
|
|
|
|
|
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
|
|
|
|
2015-07-06 16:33:45 +02:00
|
|
|
dolibarr_install_syslog("--- step4: entering step4.php page");
|
2008-04-21 09:21:13 +02:00
|
|
|
|
2018-04-12 19:13:06 +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
|
|
|
|
2015-07-06 15:29:58 +02:00
|
|
|
pHeader($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
|
|
|
|
|
if (! is_writable($conffile))
|
|
|
|
|
{
|
2011-07-30 12:23:24 +02:00
|
|
|
print $langs->trans("ConfFileIsNotWritable",$conffiletoshow);
|
2010-09-29 10:09:17 +02:00
|
|
|
pFooter(1,$setuplang,'jscheckparam');
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-07 20:07:27 +02:00
|
|
|
|
2018-04-15 11:27:12 +02:00
|
|
|
print '<h3><img class="valigntextbottom" 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
|
|
|
|
|
|
|
|
|
2005-06-11 13:35:58 +02:00
|
|
|
print '<table cellspacing="0" cellpadding="2" width="100%">';
|
2004-02-12 17:44:49 +01:00
|
|
|
|
2011-09-28 16:26:49 +02:00
|
|
|
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
|
2011-09-28 19:41:08 +02:00
|
|
|
|
2015-05-12 19:01:01 +02:00
|
|
|
if ($db->ok)
|
2004-01-27 15:36:40 +01:00
|
|
|
{
|
2017-07-08 12:48:17 +02:00
|
|
|
print '<tr><td>'.$langs->trans("Login").' :</td><td>';
|
2016-12-18 13:21:09 +01:00
|
|
|
print '<input name="login" type="text" value="' . (!empty($_GET["login"]) ? GETPOST("login") : (isset($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')) . '"' . (@$force_install_noedit == 2 && $force_install_dolibarrlogin !== null ? ' disabled' : '') . '></td></tr>';
|
2011-09-29 22:21:57 +02:00
|
|
|
print '<tr><td>'.$langs->trans("Password").' :</td><td>';
|
|
|
|
|
print '<input type="password" name="pass"></td></tr>';
|
|
|
|
|
print '<tr><td>'.$langs->trans("PasswordAgain").' :</td><td>';
|
|
|
|
|
print '<input type="password" name="pass_verif"></td></tr>';
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
if (isset($_GET["error"]) && $_GET["error"] == 1)
|
|
|
|
|
{
|
|
|
|
|
print '<br>';
|
|
|
|
|
print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
|
2018-04-12 19:13:06 +02:00
|
|
|
$error=0; // We show button
|
2011-09-29 22:21:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_GET["error"]) && $_GET["error"] == 2)
|
|
|
|
|
{
|
|
|
|
|
print '<br>';
|
|
|
|
|
print '<div class="error">';
|
|
|
|
|
print $langs->trans("PleaseTypePassword");
|
|
|
|
|
print '</div>';
|
2018-04-12 19:13:06 +02:00
|
|
|
$error=0; // We show button
|
2011-09-29 22:21:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_GET["error"]) && $_GET["error"] == 3)
|
|
|
|
|
{
|
|
|
|
|
print '<br>';
|
|
|
|
|
print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
|
2018-04-12 19:13:06 +02:00
|
|
|
$error=0; // We show button
|
2011-09-29 22:21:57 +02:00
|
|
|
}
|
2005-04-02 22:56:18 +02:00
|
|
|
|
2004-01-27 15:36:40 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-12 19:13:06 +02:00
|
|
|
|
|
|
|
|
$ret=0;
|
|
|
|
|
if ($error && isset($argv[1])) $ret=1;
|
|
|
|
|
dolibarr_install_syslog("Exit ".$ret);
|
|
|
|
|
|
2015-07-06 16:33:45 +02:00
|
|
|
dolibarr_install_syslog("--- step4: end");
|
2011-06-08 13:23:55 +02:00
|
|
|
|
2018-04-12 19:13:06 +02: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
|
|
|
|
|
if ($ret) exit($ret);
|