dolibarr  19.0.0-dev
step2.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2015 Cedric GROSS <c.gross@kreiz-it.fr>
5  * Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 include 'inc.php';
28 require_once $dolibarr_main_document_root.'/core/class/conf.class.php';
29 require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
30 
31 global $langs;
32 
33 $step = 2;
34 $ok = 0;
35 
36 
37 // This page can be long. We increase the time allowed. / Cette page peut etre longue. On augmente le delai autorise.
38 // Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode.
39 
40 $err = error_reporting();
41 error_reporting(0); // Disable all errors
42 //error_reporting(E_ALL);
43 @set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64
44 error_reporting($err);
45 
46 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]);
47 $setuplang = GETPOST('selectlang', 'aZ09', 3) ?GETPOST('selectlang', 'aZ09', 3) : (empty($argv[2]) ? 'auto' : $argv[2]);
48 $langs->setDefaultLang($setuplang);
49 
50 $langs->loadLangs(array("admin", "install"));
51 
52 
53 // Choice of DBMS
54 
55 $choix = 0;
56 if ($dolibarr_main_db_type == "mysqli") {
57  $choix = 1;
58 }
59 if ($dolibarr_main_db_type == "pgsql") {
60  $choix = 2;
61 }
62 if ($dolibarr_main_db_type == "mssql") {
63  $choix = 3;
64 }
65 if ($dolibarr_main_db_type == "sqlite") {
66  $choix = 4;
67 }
68 if ($dolibarr_main_db_type == "sqlite3") {
69  $choix = 5;
70 }
71 //if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page');
72 
73 
74 // Now we load forced values from install.forced.php file.
75 
76 $useforcedwizard = false;
77 $forcedfile = "./install.forced.php";
78 if ($conffile == "/etc/dolibarr/conf.php") {
79  $forcedfile = "/etc/dolibarr/install.forced.php";
80 }
81 if (@file_exists($forcedfile)) {
82  $useforcedwizard = true;
83  include_once $forcedfile;
84  // test for travis
85  if (!empty($argv[1]) && $argv[1] == "set") {
86  $action = "set";
87  }
88 }
89 
90 dolibarr_install_syslog("- step2: entering step2.php page");
91 
92 
93 /*
94  * View
95  */
96 
97 pHeader($langs->trans("CreateDatabaseObjects"), "step4");
98 
99 // Test if we can run a first install process
100 if (!is_writable($conffile)) {
101  print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
102  pFooter(1, $setuplang, 'jscheckparam');
103  exit;
104 }
105 
106 if ($action == "set") {
107  print '<h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/database.svg" width="20" alt="Database"> '.$langs->trans("Database").'</h3>';
108 
109  print '<table cellspacing="0" style="padding: 4px 4px 4px 0" border="0" width="100%">';
110  $error = 0;
111 
112  $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
113 
114  if ($db->connected) {
115  print "<tr><td>";
116  print $langs->trans("ServerConnection")." : ".$conf->db->host.'</td><td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
117  $ok = 1;
118  } else {
119  print "<tr><td>Failed to connect to server : ".$conf->db->host.'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
120  }
121 
122  if ($ok) {
123  if ($db->database_selected) {
124  dolibarr_install_syslog("step2: successful connection to database: ".$conf->db->name);
125  } else {
126  dolibarr_install_syslog("step2: failed connection to database :".$conf->db->name, LOG_ERR);
127  print "<tr><td>Failed to select database ".$conf->db->name.'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
128  $ok = 0;
129  }
130  }
131 
132 
133  // Display version / Affiche version
134  if ($ok) {
135  $version = $db->getVersion();
136  $versionarray = $db->getVersionArray();
137  print '<tr><td>'.$langs->trans("DatabaseVersion").'</td>';
138  print '<td>'.$version.'</td></tr>';
139  //print '<td class="right">'.join('.',$versionarray).'</td></tr>';
140 
141  print '<tr><td>'.$langs->trans("DatabaseName").'</td>';
142  print '<td>'.$db->database_name.'</td></tr>';
143  //print '<td class="right">'.join('.',$versionarray).'</td></tr>';
144  }
145 
146  $requestnb = 0;
147 
148  // To disable some code, so you can call step2 with url like
149  // http://localhost/dolibarrnew/install/step2.php?action=set&token='.newToken().'&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements
150  $createtables = GETPOSTISSET('createtables') ? GETPOST('createtables') : 1;
151  $createkeys = GETPOSTISSET('createkeys') ? GETPOST('createkeys') : 1;
152  $createfunctions = GETPOSTISSET('createfunctions') ? GETPOST('createfunction') : 1;
153  $createdata = GETPOSTISSET('createdata') ? GETPOST('createdata') : 1;
154 
155 
156  // To say sql requests are escaped for mysql so we need to unescape them
157  $db->unescapeslashquot = true;
158 
159 
160  /**************************************************************************************
161  *
162  * Load files tables/*.sql (not the *.key.sql). Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx').
163  * To do before the files *.key.sql
164  *
165  ***************************************************************************************/
166  if ($ok && $createtables) {
167  // We always choose in mysql directory (Conversion is done by driver to translate SQL syntax)
168  $dir = "mysql/tables/";
169 
170  $ok = 0;
171  $handle = opendir($dir);
172  dolibarr_install_syslog("step2: open tables directory ".$dir." handle=".$handle);
173  $tablefound = 0;
174  $tabledata = array();
175  if (is_resource($handle)) {
176  while (($file = readdir($handle)) !== false) {
177  if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\.key\.sql$/i', $file) && !preg_match('/\-/', $file)) {
178  $tablefound++;
179  $tabledata[] = $file;
180  }
181  }
182  closedir($handle);
183  }
184 
185  // Sort list of sql files on alphabetical order (load order is important)
186  sort($tabledata);
187  foreach ($tabledata as $file) {
188  $name = substr($file, 0, dol_strlen($file) - 4);
189  $buffer = '';
190  $fp = fopen($dir.$file, "r");
191  if ($fp) {
192  while (!feof($fp)) {
193  $buf = fgets($fp, 4096);
194  if (substr($buf, 0, 2) <> '--') {
195  $buf = preg_replace('/--(.+)*/', '', $buf);
196  $buffer .= $buf;
197  }
198  }
199  fclose($fp);
200 
201  $buffer = trim($buffer);
202  if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') { // For Mysql 5.5+, we must replace type=innodb with ENGINE=innodb
203  $buffer = preg_replace('/type=innodb/i', 'ENGINE=innodb', $buffer);
204  } else {
205  // Keyword ENGINE is MySQL-specific, so scrub it for
206  // other database types (mssql, pgsql)
207  $buffer = preg_replace('/type=innodb/i', '', $buffer);
208  $buffer = preg_replace('/ENGINE=innodb/i', '', $buffer);
209  }
210 
211  // Replace the prefix tables
212  if ($dolibarr_main_db_prefix != 'llx_') {
213  $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
214  }
215 
216  //print "<tr><td>Creation of table $name/td>";
217  $requestnb++;
218 
219  dolibarr_install_syslog("step2: request: ".$buffer);
220  $resql = $db->query($buffer, 0, 'dml');
221  if ($resql) {
222  // print "<td>OK request ==== $buffer</td></tr>";
223  $db->free($resql);
224  } else {
225  if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' ||
226  $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') {
227  //print "<td>already existing</td></tr>";
228  } else {
229  print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
230  print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.' <br>Executed query : '.$db->lastquery;
231  print "\n</td>";
232  print '<td><span class="error">'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'</span></td></tr>';
233  $error++;
234  }
235  }
236  } else {
237  print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
238  print "</td>";
239  print '<td><span class="error">'.$langs->trans("Error").' Failed to open file '.$dir.$file.'</span></td></tr>';
240  $error++;
241  dolibarr_install_syslog("step2: failed to open file ".$dir.$file, LOG_ERR);
242  }
243  }
244 
245  if ($tablefound) {
246  if ($error == 0) {
247  print '<tr><td>';
248  print $langs->trans("TablesAndPrimaryKeysCreation").'</td><td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
249  $ok = 1;
250  }
251  } else {
252  print '<tr><td>'.$langs->trans("ErrorFailedToFindSomeFiles", $dir).'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
253  dolibarr_install_syslog("step2: failed to find files to create database in directory ".$dir, LOG_ERR);
254  }
255  }
256 
257 
258  /***************************************************************************************
259  *
260  * Load files tables/*.key.sql. Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx').
261  * To do after the files *.sql
262  *
263  ***************************************************************************************/
264  if ($ok && $createkeys) {
265  // We always choose in mysql directory (Conversion is done by driver to translate SQL syntax)
266  $dir = "mysql/tables/";
267 
268  $okkeys = 0;
269  $handle = opendir($dir);
270  dolibarr_install_syslog("step2: open keys directory ".$dir." handle=".$handle);
271  $tablefound = 0;
272  $tabledata = array();
273  if (is_resource($handle)) {
274  while (($file = readdir($handle)) !== false) {
275  if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && preg_match('/\.key\.sql$/i', $file) && !preg_match('/\-/', $file)) {
276  $tablefound++;
277  $tabledata[] = $file;
278  }
279  }
280  closedir($handle);
281  }
282 
283  // Sort list of sql files on alphabetical order (load order is important)
284  sort($tabledata);
285  foreach ($tabledata as $file) {
286  $name = substr($file, 0, dol_strlen($file) - 4);
287  //print "<tr><td>Creation of table $name</td>";
288  $buffer = '';
289  $fp = fopen($dir.$file, "r");
290  if ($fp) {
291  while (!feof($fp)) {
292  $buf = fgets($fp, 4096);
293 
294  // Special case of lines allowed for some version only
295  // MySQL
296  if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) {
297  $versioncommande = explode('.', $reg[1]);
298  //var_dump($versioncommande);
299  //var_dump($versionarray);
300  if (count($versioncommande) && count($versionarray)
301  && versioncompare($versioncommande, $versionarray) <= 0) {
302  // Version qualified, delete SQL comments
303  $buf = preg_replace('/^--\sV([0-9\.]+)/i', '', $buf);
304  //print "Ligne $i qualifiee par version: ".$buf.'<br>';
305  }
306  }
307  // PGSQL
308  if ($choix == 2 && preg_match('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', $buf, $reg)) {
309  $versioncommande = explode('.', $reg[1]);
310  //var_dump($versioncommande);
311  //var_dump($versionarray);
312  if (count($versioncommande) && count($versionarray)
313  && versioncompare($versioncommande, $versionarray) <= 0) {
314  // Version qualified, delete SQL comments
315  $buf = preg_replace('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', '', $buf);
316  //print "Ligne $i qualifiee par version: ".$buf.'<br>';
317  }
318  }
319 
320  // Add line if no comment
321  if (!preg_match('/^--/i', $buf)) {
322  $buffer .= $buf;
323  }
324  }
325  fclose($fp);
326 
327  // If several requests, we loop on each
328  $listesql = explode(';', $buffer);
329  foreach ($listesql as $req) {
330  $buffer = trim($req);
331  if ($buffer) {
332  // Replace the prefix tables
333  if ($dolibarr_main_db_prefix != 'llx_') {
334  $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
335  }
336 
337  //print "<tr><td>Creation of keys and table index $name: '$buffer'</td>";
338  $requestnb++;
339 
340  dolibarr_install_syslog("step2: request: ".$buffer);
341  $resql = $db->query($buffer, 0, 'dml');
342  if ($resql) {
343  //print "<td>OK request ==== $buffer</td></tr>";
344  $db->free($resql);
345  } else {
346  if ($db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' ||
347  $db->errno() == 'DB_ERROR_CANNOT_CREATE' ||
348  $db->errno() == 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS' ||
349  $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS' ||
350  preg_match('/duplicate key name/i', $db->error())) {
351  //print "<td>Deja existante</td></tr>";
352  $key_exists = 1;
353  } else {
354  print "<tr><td>".$langs->trans("CreateOtherKeysForTable", $name);
355  print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$db->lastqueryerror();
356  print "\n</td>";
357  print '<td><span class="error">'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'</span></td></tr>';
358  $error++;
359  }
360  }
361  }
362  }
363  } else {
364  print "<tr><td>".$langs->trans("CreateOtherKeysForTable", $name);
365  print "</td>";
366  print '<td><span class="error">'.$langs->trans("Error")." Failed to open file ".$dir.$file."</span></td></tr>";
367  $error++;
368  dolibarr_install_syslog("step2: failed to open file ".$dir.$file, LOG_ERR);
369  }
370  }
371 
372  if ($tablefound && $error == 0) {
373  print '<tr><td>';
374  print $langs->trans("OtherKeysCreation").'</td><td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
375  $okkeys = 1;
376  }
377  }
378 
379 
380  /***************************************************************************************
381  *
382  * Load the file 'functions.sql'
383  *
384  ***************************************************************************************/
385  if ($ok && $createfunctions) {
386  // For this file, we use a directory according to database type
387  if ($choix == 1) {
388  $dir = "mysql/functions/";
389  } elseif ($choix == 2) {
390  $dir = "pgsql/functions/";
391  } elseif ($choix == 3) {
392  $dir = "mssql/functions/";
393  } elseif ($choix == 4) {
394  $dir = "sqlite3/functions/";
395  }
396 
397  // Creation of data
398  $file = "functions.sql";
399  if (file_exists($dir.$file)) {
400  $fp = fopen($dir.$file, "r");
401  dolibarr_install_syslog("step2: open function file ".$dir.$file." handle=".$fp);
402  if ($fp) {
403  $buffer = '';
404  while (!feof($fp)) {
405  $buf = fgets($fp, 4096);
406  if (substr($buf, 0, 2) <> '--') {
407  $buffer .= $buf."§";
408  }
409  }
410  fclose($fp);
411  }
412  //$buffer=preg_replace('/;\';/',";'§",$buffer);
413 
414  // If several requests, we loop on each of them
415  $listesql = explode('§', $buffer);
416  foreach ($listesql as $buffer) {
417  $buffer = trim($buffer);
418  if ($buffer) {
419  // Replace the prefix in table names
420  if ($dolibarr_main_db_prefix != 'llx_') {
421  $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
422  }
423  dolibarr_install_syslog("step2: request: ".$buffer);
424  print "<!-- Insert line : ".$buffer."<br>-->\n";
425  $resql = $db->query($buffer, 0, 'dml');
426  if ($resql) {
427  $ok = 1;
428  $db->free($resql);
429  } else {
430  if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS'
431  || $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS') {
432  //print "Insert line : ".$buffer."<br>\n";
433  } else {
434  $ok = 0;
435 
436  print "<tr><td>".$langs->trans("FunctionsCreation");
437  print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer;
438  print "\n</td>";
439  print '<td><span class="error">'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'</span></td></tr>';
440  $error++;
441  }
442  }
443  }
444  }
445 
446  print "<tr><td>".$langs->trans("FunctionsCreation")."</td>";
447  if ($ok) {
448  print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
449  } else {
450  print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
451  $ok = 1;
452  }
453  }
454  }
455 
456 
457  /***************************************************************************************
458  *
459  * Load files data/*.sql. Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx').
460  *
461  ***************************************************************************************/
462  if ($ok && $createdata) {
463  // We always choose in mysql directory (Conversion is done by driver to translate SQL syntax)
464  $dir = "mysql/data/";
465 
466  // Insert data
467  $handle = opendir($dir);
468  dolibarr_install_syslog("step2: open directory data ".$dir." handle=".$handle);
469  $tablefound = 0;
470  $tabledata = array();
471  if (is_resource($handle)) {
472  while (($file = readdir($handle)) !== false) {
473  if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\-/', $file)) {
474  if (preg_match('/^llx_accounting_account_/', $file)) {
475  continue; // We discard data file of chart of account. This will be loaded when a chart is selected.
476  }
477 
478  //print 'x'.$file.'-'.$createdata.'<br>';
479  if (is_numeric($createdata) || preg_match('/'.preg_quote($createdata).'/i', $file)) {
480  $tablefound++;
481  $tabledata[] = $file;
482  }
483  }
484  }
485  closedir($handle);
486  }
487 
488  // Sort list of data files on alphabetical order (load order is important)
489  sort($tabledata);
490  foreach ($tabledata as $file) {
491  $name = substr($file, 0, dol_strlen($file) - 4);
492  $fp = fopen($dir.$file, "r");
493  dolibarr_install_syslog("step2: open data file ".$dir.$file." handle=".$fp);
494  if ($fp) {
495  $arrayofrequests = array();
496  $linefound = 0;
497  $linegroup = 0;
498  $sizeofgroup = 1; // Grouping request to have 1 query for several requests does not works with mysql, so we use 1.
499 
500  // Load all requests
501  while (!feof($fp)) {
502  $buffer = fgets($fp, 4096);
503  $buffer = trim($buffer);
504  if ($buffer) {
505  if (substr($buffer, 0, 2) == '--') {
506  continue;
507  }
508 
509  if ($linefound && ($linefound % $sizeofgroup) == 0) {
510  $linegroup++;
511  }
512  if (empty($arrayofrequests[$linegroup])) {
513  $arrayofrequests[$linegroup] = $buffer;
514  } else {
515  $arrayofrequests[$linegroup] .= " ".$buffer;
516  }
517 
518  $linefound++;
519  }
520  }
521  fclose($fp);
522 
523  dolibarr_install_syslog("step2: found ".$linefound." records, defined ".count($arrayofrequests)." group(s).");
524 
525  $okallfile = 1;
526  $db->begin();
527 
528  // We loop on each requests of file
529  foreach ($arrayofrequests as $buffer) {
530  // Replace the tables prefixes
531  if ($dolibarr_main_db_prefix != 'llx_') {
532  $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
533  }
534 
535  //dolibarr_install_syslog("step2: request: " . $buffer);
536  $resql = $db->query($buffer, 1);
537  if ($resql) {
538  //$db->free($resql); // Not required as request we launch here does not return memory needs.
539  } else {
540  if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
541  //print "<tr><td>Insertion ligne : $buffer</td><td>";
542  } else {
543  $ok = 0;
544  $okallfile = 0;
545  print '<span class="error">'.$langs->trans("ErrorSQL")." : ".$db->lasterrno()." - ".$db->lastqueryerror()." - ".$db->lasterror()."</span><br>";
546  }
547  }
548  }
549 
550  if ($okallfile) {
551  $db->commit();
552  } else {
553  $db->rollback();
554  }
555  }
556  }
557 
558  print "<tr><td>".$langs->trans("ReferenceDataLoading")."</td>";
559  if ($ok) {
560  print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
561  } else {
562  print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
563  $ok = 1; // Data loading are not blocking errors
564  }
565  }
566  print '</table>';
567 } else {
568  print 'Parameter action=set not defined';
569 }
570 
571 
572 $ret = 0;
573 if (!$ok && isset($argv[1])) {
574  $ret = 1;
575 }
576 dolibarr_install_syslog("Exit ".$ret);
577 
578 dolibarr_install_syslog("- step2: end");
579 
580 
581 // Force here a value we need after because master.inc.php is not loaded into step2.
582 // This code must be similar with the one into main.inc.php
583 
584 $conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance
585 
586 $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
587 
588 $out = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno"'.((!empty($conf->global->MAIN_FIRST_PING_OK_ID) && $conf->global->MAIN_FIRST_PING_OK_ID == 'disabled') ? '' : ' value="checked" checked="true"').'> ';
589 $out .= '<label for="dolibarrpingno">'.$langs->trans("MakeAnonymousPing").'</label>';
590 
591 $out .= '<!-- Add js script to manage the uncheck of option to not send the ping -->';
592 $out .= '<script type="text/javascript">';
593 $out .= 'jQuery(document).ready(function(){';
594 $out .= ' document.cookie = "DOLINSTALLNOPING_'.$hash_unique_id.'=0; path=/"'."\n";
595 $out .= ' jQuery("#dolibarrpingno").click(function() {';
596 $out .= ' if (! $(this).is(\':checked\')) {';
597 $out .= ' console.log("We uncheck anonymous ping");';
598 $out .= ' document.cookie = "DOLINSTALLNOPING_'.$hash_unique_id.'=1; path=/"'."\n";
599 $out .= ' } else {'."\n";
600 $out .= ' console.log("We check anonymous ping");';
601 $out .= ' document.cookie = "DOLINSTALLNOPING_'.$hash_unique_id.'=0; path=/"'."\n";
602 $out .= ' }'."\n";
603 $out .= ' });';
604 $out .= '});';
605 $out .= '</script>';
606 
607 print $out;
608 
609 pFooter($ok ? 0 : 1, $setuplang);
610 
611 if (isset($db) && is_object($db)) {
612  $db->close();
613 }
614 
615 // Return code if ran from command line
616 if ($ret) {
617  exit($ret);
618 }
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
Definition: admin.lib.php:67
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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:513
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition: inc.php:602
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition: inc.php:663