dolibarr 24.0.0-beta
step4.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
4 * Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
5 * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
6 * Copyright (C) 2015-2016 Raphaƫl Doursenaud <rdoursenaud@gpcsolutions.fr>
7 * Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
30include_once 'inc.php';
44require_once $dolibarr_main_document_root.'/core/class/conf.class.php';
45require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
46
47global $langs;
48
49$setuplang = GETPOST('selectlang', 'aZ09', 3) ? GETPOST('selectlang', 'aZ09', 3) : (empty($argv[1]) ? 'auto' : $argv[1]);
50$langs->setDefaultLang($setuplang);
51
52$langs->loadLangs(array("admin", "install"));
53
54// Now we load forced value from install.forced.php file.
55$useforcedwizard = false;
56$forcedfile = "./install.forced.php";
57if ($conffile == "/etc/dolibarr/conf.php") {
58 $forcedfile = "/etc/dolibarr/install.forced.php";
59}
60if (@file_exists($forcedfile)) {
61 $useforcedwizard = true; // used into install.forced.php
62 include_once $forcedfile;
63}
64
65dolibarr_install_syslog("--- step4: entering step4.php page");
66
67$error = 0;
68$ok = 0;
69
70
71
72/*
73 * View
74 */
75
76pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("AdminAccountCreation"), "step5");
77
78// Test if we can run a first install process
79if (!is_writable($conffile)) {
80 print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
81 pFooter(1, $setuplang, 'jscheckparam');
82 exit;
83}
84
85
86print '<h3><img class="valignmiddle inline-block paddingright" src="../public/theme/common/key.svg" width="20" alt="Database"> '.$langs->trans("DolibarrAdminLogin").'</h3>';
87
88print $langs->trans("LastStepDesc").'<br><br>';
89
90
91print '<table cellspacing="0" cellpadding="2">';
92
93$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
94
95
96if ($db->ok) {
97 print '<tr><td><label for="login">'.$langs->trans("Login").' :</label></td><td>';
98 print '<input id="login" name="login" type="text" value="'.(GETPOSTISSET("login") ? GETPOST("login", 'alpha') : (!empty($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')).'"'.(@$force_install_noedit == 2 && !empty($force_install_dolibarrlogin) ? ' disabled' : '').' spellcheck="false" autofocus></td></tr>';
99 print '<tr><td><label for="pass">'.$langs->trans("Password").' :</label></td><td>';
100 print '<input type="password" id="pass" name="pass" autocomplete="new-password" minlength="8" value="'. (!empty($force_install_dolibarrpassword) ? '**********' : '').'"'.(@$force_install_noedit == 2 && !empty($force_install_dolibarrpassword) ? ' disabled' : '').'></td></tr>';
101 print '<tr><td><label for="pass_verif">'.$langs->trans("PasswordRetype").' :</label></td><td>';
102 print '<input type="password" id="pass_verif" name="pass_verif" autocomplete="new-password" minlength="8" value="'.(!empty($force_install_dolibarrpassword) ? '**********' : '').'"'.(@$force_install_noedit == 2 && !empty($force_install_dolibarrpassword) ? ' disabled' : '').'></td></tr>';
103 print '</table>';
104
105 if (GETPOSTINT("error") == 1) {
106 print '<br>';
107 print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
108 $error = 0; // We show button
109 }
110
111 if (GETPOSTINT("error") == 2) {
112 print '<br>';
113 print '<div class="error">';
114 print $langs->trans("PleaseTypePassword");
115 print '</div>';
116 $error = 0; // We show button
117 }
118
119 if (GETPOSTINT("error") == 3) {
120 print '<br>';
121 print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
122 $error = 0; // We show button
123 }
124}
125
126$ret = 0;
127if ($error && isset($argv[1])) {
128 $ret = 1;
129}
130dolibarr_install_syslog("Exit ".$ret);
131
132dolibarr_install_syslog("--- step4: end");
133
134pFooter($error, $setuplang);
135
136$db->close();
137
138// Return code if ran from command line
139if ($ret) {
140 exit($ret);
141}
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
$conffile
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
Definition inc.php:541
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition inc.php:635
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition inc.php:699