dolibarr  13.0.2
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") $forcedfile = "/etc/dolibarr/install.forced.php";
44 if (@file_exists($forcedfile)) {
45  $useforcedwizard = true;
46  include_once $forcedfile;
47 }
48 
49 dolibarr_install_syslog("- step4: entering step4.php page");
50 
51 $error = 0;
52 $ok = 0;
53 
54 
55 
56 /*
57  * View
58  */
59 
60 pHeader($langs->trans("AdminAccountCreation"), "step5");
61 
62 // Test if we can run a first install process
63 if (!is_writable($conffile))
64 {
65  print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
66  pFooter(1, $setuplang, 'jscheckparam');
67  exit;
68 }
69 
70 
71 print '<h3><img class="valigntextbottom" src="../theme/common/octicons/build/svg/key.svg" width="20" alt="Database"> '.$langs->trans("DolibarrAdminLogin").'</h3>';
72 
73 print $langs->trans("LastStepDesc").'<br><br>';
74 
75 
76 print '<table cellspacing="0" cellpadding="2">';
77 
78 $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
79 
80 if ($db->ok)
81 {
82  print '<tr><td><label for="login">'.$langs->trans("Login").' :</label></td><td>';
83  print '<input id="login" name="login" type="text" value="'.(!empty($_GET["login"]) ? GETPOST("login", 'alpha') : (isset($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')).'"'.(@$force_install_noedit == 2 && $force_install_dolibarrlogin !== null ? ' disabled' : '').'></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"></td></tr>';
86  print '<tr><td><label for="pass_verif">'.$langs->trans("PasswordAgain").' :</label></td><td>';
87  print '<input type="password" id="pass_verif" name="pass_verif" autocomplete="new-password"></td></tr>';
88  print '</table>';
89 
90  if (isset($_GET["error"]) && $_GET["error"] == 1)
91  {
92  print '<br>';
93  print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
94  $error = 0; // We show button
95  }
96 
97  if (isset($_GET["error"]) && $_GET["error"] == 2)
98  {
99  print '<br>';
100  print '<div class="error">';
101  print $langs->trans("PleaseTypePassword");
102  print '</div>';
103  $error = 0; // We show button
104  }
105 
106  if (isset($_GET["error"]) && $_GET["error"] == 3)
107  {
108  print '<br>';
109  print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
110  $error = 0; // We show button
111  }
112 }
113 
114 $ret = 0;
115 if ($error && isset($argv[1])) $ret = 1;
116 dolibarr_install_syslog("Exit ".$ret);
117 
118 dolibarr_install_syslog("- step4: end");
119 
120 pFooter($error, $setuplang);
121 
122 $db->close();
123 
124 // Return code if ran from command line
125 if ($ret) exit($ret);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
pHeader($subtitle, $next, $action= 'set', $param= '', $forcejqueryurl= '', $csstable= 'main-inside')
Show HTML header of install pages.
Definition: inc.php:347
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition: inc.php:482
pFooter($nonext=0, $setuplang= '', $jscheckfunction= '', $withpleasewait=0)
Print HTML footer of install pages.
Definition: inc.php:424
print
Draft customers invoices.
Definition: index.php:89