dolibarr  16.0.5
step5.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
5  * Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
6  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
7  * Copyright (C) 2015-2016 RaphaĆ«l Doursenaud <rdoursenaud@gpcsolutions.fr>
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 
29 include_once 'inc.php';
30 if (file_exists($conffile)) {
31  include_once $conffile;
32 }
33 require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
34 require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; // for dol_hash
35 
36 global $langs;
37 
38 $versionfrom = GETPOST("versionfrom", 'alpha', 3) ?GETPOST("versionfrom", 'alpha', 3) : (empty($argv[1]) ? '' : $argv[1]);
39 $versionto = GETPOST("versionto", 'alpha', 3) ?GETPOST("versionto", 'alpha', 3) : (empty($argv[2]) ? '' : $argv[2]);
40 $setuplang = GETPOST('selectlang', 'aZ09', 3) ?GETPOST('selectlang', 'aZ09', 3) : (empty($argv[3]) ? 'auto' : $argv[3]);
41 $langs->setDefaultLang($setuplang);
42 $action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : (empty($argv[4]) ? '' : $argv[4]);
43 
44 // Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install
45 // or MAIN_VERSION_LAST_UPGRADE for upgrade.
46 $targetversion = DOL_VERSION; // If it's latest upgrade
47 if (!empty($action) && preg_match('/upgrade/i', $action)) {
48  // If it's an old upgrade
49  $tmp = explode('_', $action, 2);
50  if ($tmp[0] == 'upgrade') {
51  if (!empty($tmp[1])) {
52  $targetversion = $tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta'
53  } else {
54  $targetversion = DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION
55  }
56  }
57 }
58 
59 $langs->loadLangs(array("admin", "install"));
60 
61 $login = GETPOST('login', 'alpha') ?GETPOST('login', 'alpha') : (empty($argv[5]) ? '' : $argv[5]);
62 $pass = GETPOST('pass', 'alpha') ?GETPOST('pass', 'alpha') : (empty($argv[6]) ? '' : $argv[6]);
63 $pass_verif = GETPOST('pass_verif', 'alpha') ?GETPOST('pass_verif', 'alpha') : (empty($argv[7]) ? '' : $argv[7]);
64 $force_install_lockinstall = (int) (!empty($force_install_lockinstall) ? $force_install_lockinstall : (GETPOST('installlock', 'aZ09') ?GETPOST('installlock', 'aZ09') : (empty($argv[8]) ? '' : $argv[8])));
65 
66 $success = 0;
67 
68 $useforcedwizard = false;
69 $forcedfile = "./install.forced.php";
70 if ($conffile == "/etc/dolibarr/conf.php") {
71  $forcedfile = "/etc/dolibarr/install.forced.php";
72 }
73 if (@file_exists($forcedfile)) {
74  $useforcedwizard = true;
75  include_once $forcedfile;
76  // If forced install is enabled, replace post values. These are empty because form fields are disabled.
77  if ($force_install_noedit == 2) {
78  if (!empty($force_install_dolibarrlogin)) {
79  $login = $force_install_dolibarrlogin;
80  }
81  }
82 }
83 
84 dolibarr_install_syslog("- step5: entering step5.php page");
85 
86 $error = 0;
87 
88 /*
89  * Actions
90  */
91 
92 // If install, check password and password_verification used to create admin account
93 if ($action == "set") {
94  if ($pass <> $pass_verif) {
95  header("Location: step4.php?error=1&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
96  exit;
97  }
98 
99  if (dol_strlen(trim($pass)) == 0) {
100  header("Location: step4.php?error=2&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
101  exit;
102  }
103 
104  if (dol_strlen(trim($login)) == 0) {
105  header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
106  exit;
107  }
108 }
109 
110 
111 /*
112  * View
113  */
114 
115 $morehtml = '';
116 
117 pHeader($langs->trans("SetupEnd"), "step5", 'set', '', '', 'main-inside main-inside-borderbottom');
118 print '<br>';
119 
120 // Test if we can run a first install process
121 if (empty($versionfrom) && empty($versionto) && !is_writable($conffile)) {
122  print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
123  pFooter(1, $setuplang, 'jscheckparam');
124  exit;
125 }
126 
127 if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
128  $error = 0;
129 
130  // If password is encoded, we decode it
131  if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
132  require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
133  if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) {
134  $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass);
135  $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass);
136  $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted
137  } else {
138  $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
139  }
140  }
141 
142  $conf->db->type = $dolibarr_main_db_type;
143  $conf->db->host = $dolibarr_main_db_host;
144  $conf->db->port = $dolibarr_main_db_port;
145  $conf->db->name = $dolibarr_main_db_name;
146  $conf->db->user = $dolibarr_main_db_user;
147  $conf->db->pass = $dolibarr_main_db_pass;
148  $conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption) ? $dolibarr_main_db_encryption : '';
149  $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey) ? $dolibarr_main_db_cryptkey : '';
150 
151  $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
152 
153  // Create the global $hookmanager object
154  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
155  $hookmanager = new HookManager($db);
156 
157  $ok = 0;
158 
159  // If first install
160  if ($action == "set") {
161  // Active module user
162  $modName = 'modUser';
163  $file = $modName.".class.php";
164  dolibarr_install_syslog('step5: load module user '.DOL_DOCUMENT_ROOT."/core/modules/".$file, LOG_INFO);
165  include_once DOL_DOCUMENT_ROOT."/core/modules/".$file;
166  $objMod = new $modName($db);
167  $result = $objMod->init();
168  if (!$result) {
169  print "ERROR: failed to init module file = ".$file;
170  }
171 
172  if ($db->connected) {
173  $conf->setValues($db);
174  // Reset forced setup after the setValues
175  if (defined('SYSLOG_FILE')) {
176  $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
177  }
178  $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
179 
180  // Create admin user
181  include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
182 
183  // Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database)
184  $sql = "SELECT u.rowid, u.pass, u.pass_crypted";
185  $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
186  $resql = $db->query($sql);
187  if ($resql) {
188  $numrows = $db->num_rows($resql);
189  if ($numrows == 0) {
190  // Define default setup for password encryption
191  dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
192  dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities
193  if (function_exists('password_hash')) {
194  dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities
195  } else {
196  dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities
197  }
198  }
199 
200  dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
201  }
202 
203  // Create user used to create the admin user
204  $createuser = new User($db);
205  $createuser->id = 0;
206  $createuser->admin = 1;
207 
208  // Set admin user
209  $newuser = new User($db);
210  $newuser->lastname = 'SuperAdmin';
211  $newuser->firstname = '';
212  $newuser->login = $login;
213  $newuser->pass = $pass;
214  $newuser->admin = 1;
215  $newuser->entity = 0;
216 
217  $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email
218  $conf->global->USER_PASSWORD_GENERATED = ''; // To not use any rule for password validation
219 
220  $result = $newuser->create($createuser, 1);
221  if ($result > 0) {
222  print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>";
223  $success = 1;
224  } else {
225  if ($result == -6) { //login or email already exists
226  dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
227  print '<br><div class="warning">'.$newuser->error."</div><br>";
228  $success = 1;
229  } else {
230  dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
231  setEventMessages($langs->trans("FailedToCreateAdminLogin").' '.$newuser->error, null, 'errors');
232  //header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
233  print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").': '.$newuser->error.'</div><br><br>';
234  print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
235  }
236  }
237 
238  if ($success) {
239  // Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests.
240  $db->begin();
241  dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to '.$targetversion, LOG_DEBUG);
242  $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name, value, type, visible, note, entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version when first install', 0)");
243  if ($resql) {
244  $conf->global->MAIN_VERSION_FIRST_INSTALL = $targetversion;
245  $db->commit();
246  } else {
247  //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
248  $db->commit();
249  }
250 
251  $db->begin();
252 
253  dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to '.$targetversion, LOG_DEBUG);
254  $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_VERSION_LAST_INSTALL'");
255  if (!$resql) {
256  dol_print_error($db, 'Error in setup program');
257  }
258  $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version when last install', 0)");
259  if (!$resql) {
260  dol_print_error($db, 'Error in setup program');
261  }
262  $conf->global->MAIN_VERSION_LAST_INSTALL = $targetversion;
263 
264  if ($useforcedwizard) {
265  dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
266  $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_REMOVE_INSTALL_WARNING'");
267  if (!$resql) {
268  dol_print_error($db, 'Error in setup program');
269  }
270  $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING').", ".$db->encrypt(1).", 'chaine', 1, 'Disable install warnings', 0)");
271  if (!$resql) {
272  dol_print_error($db, 'Error in setup program');
273  }
274  $conf->global->MAIN_REMOVE_INSTALL_WARNING = 1;
275  }
276 
277  // If we ask to force some modules to be enabled
278  if (!empty($force_install_module)) {
279  if (!defined('DOL_DOCUMENT_ROOT') && !empty($dolibarr_main_document_root)) {
280  define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);
281  }
282 
283  $tmparray = explode(',', $force_install_module);
284  foreach ($tmparray as $modtoactivate) {
285  $modtoactivatenew = preg_replace('/\.class\.php$/i', '', $modtoactivate);
286  print $langs->trans("ActivateModule", $modtoactivatenew).'<br>';
287 
288  $file = $modtoactivatenew.'.class.php';
289  dolibarr_install_syslog('step5: activate module file='.$file);
290  $res = dol_include_once("/core/modules/".$file);
291 
292  $res = activateModule($modtoactivatenew, 1);
293  if (!empty($res['errors'])) {
294  print 'ERROR: failed to activateModule() file='.$file;
295  }
296  }
297  }
298 
299  dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
300  $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'");
301  if (!$resql) {
302  dol_print_error($db, 'Error in setup program');
303  }
304 
305  $db->commit();
306  }
307  } else {
308  print $langs->trans("ErrorFailedToConnect")."<br>";
309  }
310  } elseif (empty($action) || preg_match('/upgrade/i', $action)) {
311  // If upgrade
312  if ($db->connected) {
313  $conf->setValues($db);
314  // Reset forced setup after the setValues
315  if (defined('SYSLOG_FILE')) {
316  $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
317  }
318  $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
319 
320  // Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database
321  $tagdatabase = false;
322  if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) {
323  $tagdatabase = true; // We don't know what it was before, so now we consider we are version choosed.
324  } else {
325  $mainversionlastupgradearray = preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE);
326  $targetversionarray = preg_split('/[.-]/', $targetversion);
327  if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) {
328  $tagdatabase = true;
329  }
330  }
331 
332  if ($tagdatabase) {
333  dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value '.$targetversion);
334  $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_VERSION_LAST_UPGRADE'");
335  if (!$resql) {
336  dol_print_error($db, 'Error in setup program');
337  }
338  $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name, value, type, visible, note, entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version for last upgrade', 0)");
339  if (!$resql) {
340  dol_print_error($db, 'Error in setup program');
341  }
342  $conf->global->MAIN_VERSION_LAST_UPGRADE = $targetversion;
343  } else {
344  dolibarr_install_syslog('step5: we run an upgrade to version '.$targetversion.' but database was already upgraded to '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
345  }
346  } else {
347  print $langs->trans("ErrorFailedToConnect")."<br>";
348  }
349  } else {
350  dol_print_error('', 'step5.php: unknown choice of action');
351  }
352 
353  // May fail if parameter already defined
354  $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_LANG_DEFAULT').", ".$db->encrypt($setuplang).", 'chaine', 0, 'Default language', 1)");
355  //if (! $resql) dol_print_error($db,'Error in setup program');
356 
357  $db->close();
358 }
359 
360 
361 
362 // Create lock file
363 
364 // If first install
365 if ($action == "set") {
366  if ($success) {
367  if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
368  // Install is finished
369  print '<br>'.$langs->trans("SystemIsInstalled")."<br>";
370 
371  $createlock = 0;
372 
373  if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
374  // Install is finished, we create the lock file
375  $lockfile = DOL_DATA_ROOT.'/install.lock';
376  $fp = @fopen($lockfile, "w");
377  if ($fp) {
378  if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
379  $force_install_lockinstall = 444; // For backward compatibility
380  }
381  fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
382  fclose($fp);
383  @chmod($lockfile, octdec($force_install_lockinstall));
384  $createlock = 1;
385  }
386  }
387  if (empty($createlock)) {
388  print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
389  }
390 
391  print "<br>";
392 
393  print $langs->trans("YouNeedToPersonalizeSetup")."<br><br><br>";
394 
395  print '<div class="center">&gt; <a href="../admin/index.php?mainmenu=home&leftmenu=setup'.(isset($login) ? '&username='.urlencode($login) : '').'">';
396  print '<span class="fas fa-external-link-alt"></span> '.$langs->trans("GoToSetupArea");
397  print '</a></div><br>';
398  } else {
399  // If here MAIN_VERSION_LAST_UPGRADE is not empty
400  print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
401  print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
402  print $langs->trans("MigrationNotFinished").'<br>';
403  print "<br>";
404 
405  print '<div class="center"><a href="'.$dolibarr_main_url_root.'/install/index.php">';
406  print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
407  print '</a></div>';
408  }
409  }
410 } elseif (empty($action) || preg_match('/upgrade/i', $action)) {
411  // If upgrade
412  if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
413  // Upgrade is finished
414  print '<img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/checklist.svg" width="20" alt="Configuration"> <span class="valignmiddle">'.$langs->trans("SystemIsUpgraded")."</span><br>";
415 
416  $createlock = 0;
417 
418  if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
419  // Upgrade is finished, we create the lock file
420  $lockfile = DOL_DATA_ROOT.'/install.lock';
421  $fp = @fopen($lockfile, "w");
422  if ($fp) {
423  if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
424  $force_install_lockinstall = 444; // For backward compatibility
425  }
426  fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
427  fclose($fp);
428  @chmod($lockfile, octdec($force_install_lockinstall));
429  $createlock = 1;
430  }
431  }
432  if (empty($createlock)) {
433  print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
434  }
435 
436  print "<br>";
437 
438  $morehtml = '<br><div class="center"><a href="../index.php?mainmenu=home'.(isset($login) ? '&username='.urlencode($login) : '').'">';
439  $morehtml .= '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToDolibarr").'...';
440  $morehtml .= '</a></div><br>';
441  } else {
442  // If here MAIN_VERSION_LAST_UPGRADE is not empty
443  print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
444  print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
445 
446  print "<br>";
447 
448  $morehtml = '<br><div class="center"><a href="../install/index.php">';
449  $morehtml .= '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
450  $morehtml .= '</a></div>';
451  }
452 } else {
453  dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction');
454 }
455 
456 // Clear cache files
457 clearstatcache();
458 
459 $ret = 0;
460 if ($error && isset($argv[1])) {
461  $ret = 1;
462 }
463 dolibarr_install_syslog("Exit ".$ret);
464 
465 dolibarr_install_syslog("- step5: Dolibarr setup finished");
466 
467 pFooter(1, $setuplang, '', 0, $morehtml);
468 
469 // Return code if ran from command line
470 if ($ret) {
471  exit($ret);
472 }
versioncompare
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
Definition: admin.lib.php:66
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
dol_include_once
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
Definition: functions.lib.php:1033
getDoliDBInstance
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
Definition: functions.lib.php:122
activateModule
activateModule($value, $withdeps=1)
Enable a module.
Definition: admin.lib.php:1075
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
dolibarr_install_syslog
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition: inc.php:559
pHeader
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
Definition: inc.php:409
pFooter
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition: inc.php:498
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3747
dolibarr_set_const
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:627
User
Class to manage Dolibarr users.
Definition: user.class.php:44
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
HookManager
Class to manage hooks.
Definition: hookmanager.class.php:30
dol_decode
dol_decode($chain, $key='1')
Decode a base 64 encoded + specific delta change.
Definition: security.lib.php:69