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