dolibarr/htdocs/install/step4.php

129 lines
4.1 KiB
PHP
Raw Normal View History

<?php
/* 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
* 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
*/
/**
2015-07-06 15:29:58 +02:00
* \file htdocs/install/step4.php
* \ingroup install
* \brief Ask login and password of Dolibarr admin user
2008-12-15 02:04:32 +01:00
*/
2012-08-23 02:46:16 +02:00
include_once 'inc.php';
require_once $dolibarr_main_document_root.'/core/class/conf.class.php';
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
global $langs;
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);
$langs->load("admin");
$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";
if (@file_exists($forcedfile)) {
$useforcedwizard = true;
include_once $forcedfile;
}
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;
2005-10-30 02:07:00 +01:00
2008-12-15 02:04:32 +01:00
/*
* View
*/
2015-07-06 15:29:58 +02:00
pHeader($langs->trans("AdminAccountCreation"),"step5");
// Test if we can run a first install process
if (! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",$conffiletoshow);
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>';
print $langs->trans("LastStepDesc").'<br><br>';
2011-06-07 20:07:27 +02:00
print '<table cellspacing="0" cellpadding="2" width="100%">';
2004-02-12 17:44:49 +01:00
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
2015-05-12 19:01:01 +02:00
if ($db->ok)
2004-01-27 15:36:40 +01: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
}
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);