dolibarr  17.0.4
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  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
29 include_once 'inc.php';
30 require_once $dolibarr_main_document_root.'/core/class/conf.class.php';
31 require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
32 
33 global $langs;
34 
35 $setuplang = GETPOST('selectlang', 'aZ09', 3) ?GETPOST('selectlang', 'aZ09', 3) : (empty($argv[1]) ? 'auto' : $argv[1]);
36 $langs->setDefaultLang($setuplang);
37 
38 $langs->loadLangs(array("admin", "install"));
39 
40 // Now we load forced value from install.forced.php file.
41 $useforcedwizard = false;
42 $forcedfile = "./install.forced.php";
43 if ($conffile == "/etc/dolibarr/conf.php") {
44  $forcedfile = "/etc/dolibarr/install.forced.php";
45 }
46 if (@file_exists($forcedfile)) {
47  $useforcedwizard = true;
48  include_once $forcedfile;
49 }
50 
51 dolibarr_install_syslog("- step4: entering step4.php page");
52 
53 $error = 0;
54 $ok = 0;
55 
56 
57 
58 /*
59  * View
60  */
61 
62 pHeader($langs->trans("AdminAccountCreation"), "step5");
63 
64 // Test if we can run a first install process
65 if (!is_writable($conffile)) {
66  print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
67  pFooter(1, $setuplang, 'jscheckparam');
68  exit;
69 }
70 
71 
72 print '<h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/key.svg" width="20" alt="Database"> '.$langs->trans("DolibarrAdminLogin").'</h3>';
73 
74 print $langs->trans("LastStepDesc").'<br><br>';
75 
76 
77 print '<table cellspacing="0" cellpadding="2">';
78 
79 $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
80 
81 if ($db->ok) {
82  print '<tr><td><label for="login">'.$langs->trans("Login").' :</label></td><td>';
83  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>';
84  print '<tr><td><label for="pass">'.$langs->trans("Password").' :</label></td><td>';
85  print '<input type="password" id="pass" name="pass" autocomplete="new-password" minlength="8"></td></tr>';
86  print '<tr><td><label for="pass_verif">'.$langs->trans("PasswordRetype").' :</label></td><td>';
87  print '<input type="password" id="pass_verif" name="pass_verif" autocomplete="new-password" minlength="8"></td></tr>';
88  print '</table>';
89 
90  if (isset($_GET["error"]) && $_GET["error"] == 1) {
91  print '<br>';
92  print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
93  $error = 0; // We show button
94  }
95 
96  if (isset($_GET["error"]) && $_GET["error"] == 2) {
97  print '<br>';
98  print '<div class="error">';
99  print $langs->trans("PleaseTypePassword");
100  print '</div>';
101  $error = 0; // We show button
102  }
103 
104  if (isset($_GET["error"]) && $_GET["error"] == 3) {
105  print '<br>';
106  print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
107  $error = 0; // We show button
108  }
109 }
110 
111 $ret = 0;
112 if ($error && isset($argv[1])) {
113  $ret = 1;
114 }
115 dolibarr_install_syslog("Exit ".$ret);
116 
117 dolibarr_install_syslog("- step4: end");
118 
119 pFooter($error, $setuplang);
120 
121 $db->close();
122 
123 // Return code if ran from command line
124 if ($ret) {
125  exit($ret);
126 }
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:401
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition: inc.php:490
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition: inc.php:551