@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct() |
27 | 27 | { |
28 | - if (! extension_loaded('openssl')) { |
|
28 | + if (!extension_loaded('openssl')) { |
|
29 | 29 | throw new \RuntimeException(sprintf( |
30 | 30 | "You need the OpenSSL extension to use %s", |
31 | 31 | __CLASS__ |
32 | 32 | )); |
33 | 33 | } |
34 | - if (! extension_loaded('mbstring')) { |
|
34 | + if (!extension_loaded('mbstring')) { |
|
35 | 35 | throw new \RuntimeException(sprintf( |
36 | 36 | "You need the Multibytes extension to use %s", |
37 | 37 | __CLASS__ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function open($save_path, $session_name): bool |
49 | 49 | { |
50 | - $this->key = $this->getKey('KEY_' . $session_name); |
|
50 | + $this->key = $this->getKey('KEY_'.$session_name); |
|
51 | 51 | return parent::open($save_path, $session_name); |
52 | 52 | } |
53 | 53 | |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | // Authentication |
95 | 95 | $hmac = hash_hmac( |
96 | 96 | 'SHA256', |
97 | - $iv . $ciphertext, |
|
97 | + $iv.$ciphertext, |
|
98 | 98 | mb_substr($key, 32, null, '8bit'), |
99 | 99 | true |
100 | 100 | ); |
101 | - return $hmac . $iv . $ciphertext; |
|
101 | + return $hmac.$iv.$ciphertext; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | // Authentication |
117 | 117 | $hmacNew = hash_hmac( |
118 | 118 | 'SHA256', |
119 | - $iv . $ciphertext, |
|
119 | + $iv.$ciphertext, |
|
120 | 120 | mb_substr($key, 32, null, '8bit'), |
121 | 121 | true |
122 | 122 | ); |
123 | - if (! hash_equals($hmac, $hmacNew)) { |
|
123 | + if (!hash_equals($hmac, $hmacNew)) { |
|
124 | 124 | throw new Exception\AuthenticationFailedException('Authentication failed'); |
125 | 125 | } |
126 | 126 | // Decrypt |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | // if session cookie lifetime > 0 then add to current time |
149 | 149 | // otherwise leave it as zero, honoring zero's special meaning |
150 | 150 | // expire at browser close. |
151 | - $arr_cookie_options = array ( |
|
151 | + $arr_cookie_options = array( |
|
152 | 152 | 'expires' => ($cookieParam['lifetime'] > 0) ? time() + $cookieParam['lifetime'] : 0, |
153 | 153 | 'path' => '/', |
154 | 154 | 'secure' => true, |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | //Do a copy of the existing file |
72 | 72 | if (!copy( |
73 | 73 | $settingsFile, |
74 | - $settingsFile . '.' . date( |
|
74 | + $settingsFile.'.'.date( |
|
75 | 75 | 'Y_m_d_H_i_s', |
76 | 76 | mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y')) |
77 | 77 | ) |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | // CHeck if old sk.php exists. |
89 | 89 | // If yes then get keys to database and delete it |
90 | 90 | if (empty($post_sk_path) === false || defined('SECUREPATH') === true) { |
91 | - $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH) . '/sk.php'; |
|
91 | + $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH).'/sk.php'; |
|
92 | 92 | if (file_exists($filename)) { |
93 | 93 | include_once $filename; |
94 | 94 | unlink($filename); |
@@ -97,63 +97,63 @@ discard block |
||
97 | 97 | // SKEY |
98 | 98 | $tmp = mysqli_query( |
99 | 99 | $db_link, |
100 | - "SELECT INTO `" . $pre . "misc` |
|
100 | + "SELECT INTO `".$pre."misc` |
|
101 | 101 | WHERE type = 'admin' AND intitule = 'duo_skey'" |
102 | 102 | ); |
103 | 103 | if ($tmp) { |
104 | 104 | mysqli_query( |
105 | 105 | $db_link, |
106 | - "UPDATE `" . $pre . "misc` |
|
107 | - set valeur = '" . SKEY . "', type = 'admin', intitule = 'duo_skey'" |
|
106 | + "UPDATE `".$pre."misc` |
|
107 | + set valeur = '" . SKEY."', type = 'admin', intitule = 'duo_skey'" |
|
108 | 108 | ); |
109 | 109 | } else { |
110 | 110 | mysqli_query( |
111 | 111 | $db_link, |
112 | - "INSERT INTO `" . $pre . "misc` |
|
112 | + "INSERT INTO `".$pre."misc` |
|
113 | 113 | (`valeur`, `type`, `intitule`) |
114 | - VALUES ('" . SKEY . "', 'admin', 'duo_skey')" |
|
114 | + VALUES ('" . SKEY."', 'admin', 'duo_skey')" |
|
115 | 115 | ); |
116 | 116 | } |
117 | 117 | |
118 | 118 | // IKEY |
119 | 119 | $tmp = mysqli_query( |
120 | 120 | $db_link, |
121 | - "SELECT INTO `" . $pre . "misc` |
|
121 | + "SELECT INTO `".$pre."misc` |
|
122 | 122 | WHERE type = 'admin' AND intitule = 'duo_ikey'" |
123 | 123 | ); |
124 | 124 | if ($tmp) { |
125 | 125 | mysqli_query( |
126 | 126 | $db_link, |
127 | - "UPDATE `" . $pre . "misc` |
|
128 | - set valeur = '" . IKEY . "', type = 'admin', intitule = 'duo_ikey'" |
|
127 | + "UPDATE `".$pre."misc` |
|
128 | + set valeur = '" . IKEY."', type = 'admin', intitule = 'duo_ikey'" |
|
129 | 129 | ); |
130 | 130 | } else { |
131 | 131 | mysqli_query( |
132 | 132 | $db_link, |
133 | - "INSERT INTO `" . $pre . "misc` |
|
133 | + "INSERT INTO `".$pre."misc` |
|
134 | 134 | (`valeur`, `type`, `intitule`) |
135 | - VALUES ('" . IKEY . "', 'admin', 'duo_ikey')" |
|
135 | + VALUES ('" . IKEY."', 'admin', 'duo_ikey')" |
|
136 | 136 | ); |
137 | 137 | } |
138 | 138 | |
139 | 139 | // HOST |
140 | 140 | $tmp = mysqli_query( |
141 | 141 | $db_link, |
142 | - "SELECT INTO `" . $pre . "misc` |
|
142 | + "SELECT INTO `".$pre."misc` |
|
143 | 143 | WHERE type = 'admin' AND intitule = 'duo_host'" |
144 | 144 | ); |
145 | 145 | if ($tmp) { |
146 | 146 | mysqli_query( |
147 | 147 | $db_link, |
148 | - "UPDATE `" . $pre . "misc` |
|
149 | - set valeur = '" . HOST . "', type = 'admin', intitule = 'duo_host'" |
|
148 | + "UPDATE `".$pre."misc` |
|
149 | + set valeur = '" . HOST."', type = 'admin', intitule = 'duo_host'" |
|
150 | 150 | ); |
151 | 151 | } else { |
152 | 152 | mysqli_query( |
153 | 153 | $db_link, |
154 | - "INSERT INTO `" . $pre . "misc` |
|
154 | + "INSERT INTO `".$pre."misc` |
|
155 | 155 | (`valeur`, `type`, `intitule`) |
156 | - VALUES ('" . HOST . "', 'admin', 'duo_host')" |
|
156 | + VALUES ('" . HOST."', 'admin', 'duo_host')" |
|
157 | 157 | ); |
158 | 158 | } |
159 | 159 | } |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | |
170 | 170 | $settingsTxt = '<?php |
171 | 171 | // DATABASE connexion parameters |
172 | -define("DB_HOST", "' . $server . '"); |
|
173 | -define("DB_USER", "' . $user . '"); |
|
174 | -define("DB_PASSWD", "' . $pass . '"); |
|
175 | -define("DB_NAME", "' . $database . '"); |
|
176 | -define("DB_PREFIX", "' . $pre . '"); |
|
177 | -define("DB_PORT", "' . $port . '"); |
|
178 | -define("DB_ENCODING", "' . $encoding . '"); |
|
172 | +define("DB_HOST", "' . $server.'"); |
|
173 | +define("DB_USER", "' . $user.'"); |
|
174 | +define("DB_PASSWD", "' . $pass.'"); |
|
175 | +define("DB_NAME", "' . $database.'"); |
|
176 | +define("DB_PREFIX", "' . $pre.'"); |
|
177 | +define("DB_PORT", "' . $port.'"); |
|
178 | +define("DB_ENCODING", "' . $encoding.'"); |
|
179 | 179 | define("DB_SSL", false); // if DB over SSL then comment this line |
180 | 180 | // if DB over SSL then uncomment the following lines |
181 | 181 | //define("DB_SSL", array( |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | define("DB_CONNECT_OPTIONS", array( |
189 | 189 | MYSQLI_OPT_CONNECT_TIMEOUT => 10 |
190 | 190 | )); |
191 | -define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");'; |
|
191 | +define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH).'");'; |
|
192 | 192 | define("SECUREFILE", "' . SECUREFILE. '"); |
193 | 193 | |
194 | 194 | if (defined('IKEY') === true) $settingsTxt .= ' |
195 | -define("IKEY", "' . IKEY . '");'; |
|
195 | +define("IKEY", "' . IKEY.'");'; |
|
196 | 196 | else $settingsTxt .= ' |
197 | 197 | define("IKEY", "");'; |
198 | 198 | if (defined('SKEY') === true) $settingsTxt .= ' |
199 | -define("SKEY", "' . SKEY . '");'; |
|
199 | +define("SKEY", "' . SKEY.'");'; |
|
200 | 200 | else $settingsTxt .= ' |
201 | 201 | define("SKEY", "");'; |
202 | 202 | if (defined('HOST') === true) $settingsTxt .= ' |
203 | -define("HOST", "' . HOST . '");'; |
|
203 | +define("HOST", "' . HOST.'");'; |
|
204 | 204 | else $settingsTxt .= ' |
205 | 205 | define("HOST", "");'; |
206 | 206 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | '}]'; |
297 | 297 | break; |
298 | 298 | } |
299 | - if (!file_exists(SECUREPATH . '/sk.php')) { |
|
299 | + if (!file_exists(SECUREPATH.'/sk.php')) { |
|
300 | 300 | echo '[{'. |
301 | 301 | '"error" : "Error in settings.php file!<br>Check correctness of path indicated in file `includes/config/settings.php`.<br>Reload this page and retry.",'. |
302 | 302 | '"index" : ""'. |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | $user_info = mysqli_fetch_array( |
313 | 313 | mysqli_query( |
314 | 314 | $db_link, |
315 | - 'SELECT id, pw, admin FROM ' . $pre . "users |
|
316 | - WHERE login='" . mysqli_escape_string($db_link, stripslashes($post_login)) . "'" |
|
315 | + 'SELECT id, pw, admin FROM '.$pre."users |
|
316 | + WHERE login='" . mysqli_escape_string($db_link, stripslashes($post_login))."'" |
|
317 | 317 | ) |
318 | 318 | ); |
319 | 319 | |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | echo '[{'. |
333 | 333 | '"error" : "",'. |
334 | 334 | '"index" : 1,'. |
335 | - '"info" : "' . base64_encode(json_encode( |
|
335 | + '"info" : "'.base64_encode(json_encode( |
|
336 | 336 | array(mysqli_escape_string($db_link, stripslashes($post_login)), $post_pwd, $user_info['id']) |
337 | - )) . '"'. |
|
337 | + )).'"'. |
|
338 | 338 | '}]'; |
339 | 339 | } else { |
340 | 340 | $superGlobal->put('user_granted', false, 'SESSION'); |
@@ -367,14 +367,14 @@ discard block |
||
367 | 367 | $txt = ''; |
368 | 368 | $var_x = 1; |
369 | 369 | $tab = array( |
370 | - $abspath . '/includes/config/settings.php', |
|
371 | - $abspath . '/includes/libraries/csrfp/libs/', |
|
372 | - $abspath . '/install/', |
|
373 | - $abspath . '/includes/', |
|
374 | - $abspath . '/includes/config/', |
|
375 | - $abspath . '/includes/avatars/', |
|
376 | - $abspath . '/files/', |
|
377 | - $abspath . '/upload/', |
|
370 | + $abspath.'/includes/config/settings.php', |
|
371 | + $abspath.'/includes/libraries/csrfp/libs/', |
|
372 | + $abspath.'/install/', |
|
373 | + $abspath.'/includes/', |
|
374 | + $abspath.'/includes/config/', |
|
375 | + $abspath.'/includes/avatars/', |
|
376 | + $abspath.'/files/', |
|
377 | + $abspath.'/upload/', |
|
378 | 378 | ); |
379 | 379 | foreach ($tab as $elem) { |
380 | 380 | // try to create it if not existing |
@@ -383,11 +383,11 @@ discard block |
||
383 | 383 | } |
384 | 384 | // check if writable |
385 | 385 | if (is_writable($elem)) { |
386 | - $txt .= '<span>' . |
|
387 | - $elem . '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
|
386 | + $txt .= '<span>'. |
|
387 | + $elem.'<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
|
388 | 388 | } else { |
389 | - $txt .= '<span>' . |
|
390 | - $elem . '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
|
389 | + $txt .= '<span>'. |
|
390 | + $elem.'<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
|
391 | 391 | $okWritable = false; |
392 | 392 | } |
393 | 393 | ++$var_x; |
@@ -395,105 +395,105 @@ discard block |
||
395 | 395 | |
396 | 396 | if (!extension_loaded('openssl')) { |
397 | 397 | //$okExtensions = false; |
398 | - $txt .= '<span>PHP extension \"openssl\"' . |
|
398 | + $txt .= '<span>PHP extension \"openssl\"'. |
|
399 | 399 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
400 | 400 | } else { |
401 | - $txt .= '<span>PHP extension \"openssl\"' . |
|
401 | + $txt .= '<span>PHP extension \"openssl\"'. |
|
402 | 402 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
403 | 403 | } |
404 | 404 | if (!extension_loaded('gd')) { |
405 | 405 | //$okExtensions = false; |
406 | - $txt .= '<span>PHP extension \"gd\"' . |
|
406 | + $txt .= '<span>PHP extension \"gd\"'. |
|
407 | 407 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
408 | 408 | } else { |
409 | - $txt .= '<span>PHP extension \"gd\"' . |
|
409 | + $txt .= '<span>PHP extension \"gd\"'. |
|
410 | 410 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
411 | 411 | } |
412 | 412 | if (!extension_loaded('mbstring')) { |
413 | 413 | //$okExtensions = false; |
414 | - $txt .= '<span>PHP extension \"mbstring\"' . |
|
414 | + $txt .= '<span>PHP extension \"mbstring\"'. |
|
415 | 415 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
416 | 416 | } else { |
417 | - $txt .= '<span>PHP extension \"mbstring\"' . |
|
417 | + $txt .= '<span>PHP extension \"mbstring\"'. |
|
418 | 418 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
419 | 419 | } |
420 | 420 | if (!extension_loaded('bcmath')) { |
421 | 421 | //$okExtensions = false; |
422 | - $txt .= '<span>PHP extension \"bcmath\"' . |
|
422 | + $txt .= '<span>PHP extension \"bcmath\"'. |
|
423 | 423 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
424 | 424 | } else { |
425 | - $txt .= '<span>PHP extension \"bcmath\"' . |
|
425 | + $txt .= '<span>PHP extension \"bcmath\"'. |
|
426 | 426 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
427 | 427 | } |
428 | 428 | if (!extension_loaded('iconv')) { |
429 | 429 | //$okExtensions = false; |
430 | - $txt .= '<span>PHP extension \"iconv\"' . |
|
430 | + $txt .= '<span>PHP extension \"iconv\"'. |
|
431 | 431 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
432 | 432 | } else { |
433 | - $txt .= '<span>PHP extension \"iconv\"' . |
|
433 | + $txt .= '<span>PHP extension \"iconv\"'. |
|
434 | 434 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
435 | 435 | } |
436 | 436 | if (!extension_loaded('xml')) { |
437 | 437 | //$okExtensions = false; |
438 | - $txt .= '<span>PHP extension \"xml\"' . |
|
438 | + $txt .= '<span>PHP extension \"xml\"'. |
|
439 | 439 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
440 | 440 | } else { |
441 | - $txt .= '<span>PHP extension \"xml\"' . |
|
441 | + $txt .= '<span>PHP extension \"xml\"'. |
|
442 | 442 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
443 | 443 | } |
444 | 444 | if (!extension_loaded('curl')) { |
445 | - $txt .= '<span>PHP extension \"curl\"' . |
|
445 | + $txt .= '<span>PHP extension \"curl\"'. |
|
446 | 446 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
447 | 447 | } else { |
448 | - $txt .= '<span>PHP extension \"curl\"' . |
|
448 | + $txt .= '<span>PHP extension \"curl\"'. |
|
449 | 449 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
450 | 450 | } |
451 | 451 | if (!extension_loaded('gmp')) { |
452 | - $txt .= '<span>PHP extension \"gmp\"' . |
|
452 | + $txt .= '<span>PHP extension \"gmp\"'. |
|
453 | 453 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
454 | 454 | } else { |
455 | - $txt .= '<span>PHP extension \"gmp\"' . |
|
455 | + $txt .= '<span>PHP extension \"gmp\"'. |
|
456 | 456 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
457 | 457 | } |
458 | 458 | if (ini_get('max_execution_time') < 30) { |
459 | - $txt .= '<span>PHP \"Maximum ' . |
|
460 | - 'execution time\" is set to ' . ini_get('max_execution_time') . ' seconds.' . |
|
461 | - ' Please try to set to 60s at least until Upgrade is finished. ' . |
|
459 | + $txt .= '<span>PHP \"Maximum '. |
|
460 | + 'execution time\" is set to '.ini_get('max_execution_time').' seconds.'. |
|
461 | + ' Please try to set to 60s at least until Upgrade is finished. '. |
|
462 | 462 | ' <img src=\"images/minus-circle.png\"></span> <br />'; |
463 | 463 | } else { |
464 | - $txt .= '<span>PHP \"Maximum ' . |
|
465 | - 'execution time\" is set to ' . ini_get('max_execution_time') . ' seconds' . |
|
464 | + $txt .= '<span>PHP \"Maximum '. |
|
465 | + 'execution time\" is set to '.ini_get('max_execution_time').' seconds'. |
|
466 | 466 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
467 | 467 | } |
468 | 468 | if (version_compare(phpversion(), MIN_PHP_VERSION, '<')) { |
469 | - $txt .= '<span>PHP version ' . |
|
470 | - phpversion() . ' is not OK (minimum is '.MIN_PHP_VERSION.') ' . |
|
469 | + $txt .= '<span>PHP version '. |
|
470 | + phpversion().' is not OK (minimum is '.MIN_PHP_VERSION.') '. |
|
471 | 471 | '<img src=\"images/minus-circle.png\"></span><br />'; |
472 | 472 | } else { |
473 | - $txt .= '<span>PHP version ' . |
|
474 | - phpversion() . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
473 | + $txt .= '<span>PHP version '. |
|
474 | + phpversion().' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
475 | 475 | '</span><br />'; |
476 | 476 | } |
477 | - $mysqlVersion = version_compare($db_link -> server_version, MIN_MYSQL_VERSION, '<') ; |
|
478 | - $mariadbVersion = version_compare($db_link -> server_version, MIN_MARIADB_VERSION, '<') ; |
|
477 | + $mysqlVersion = version_compare($db_link -> server_version, MIN_MYSQL_VERSION, '<'); |
|
478 | + $mariadbVersion = version_compare($db_link -> server_version, MIN_MARIADB_VERSION, '<'); |
|
479 | 479 | if ($mysqlVersion && $mariadbVersion) { |
480 | 480 | if ($mariadbVersion === '') { |
481 | - $txt .= '<span>MySQL version ' . |
|
482 | - $db_link -> server_version . ' is not OK (minimum is '.MIN_MYSQL_VERSION.') ' . |
|
481 | + $txt .= '<span>MySQL version '. |
|
482 | + $db_link -> server_version.' is not OK (minimum is '.MIN_MYSQL_VERSION.') '. |
|
483 | 483 | '<img src=\"images/minus-circle.png\"></span><br />'; |
484 | 484 | } else { |
485 | - $txt .= '<span>MySQL version ' . |
|
486 | - $db_link -> server_version . ' is not OK (minimum is '.MIN_MARIADB_VERSION.') ' . |
|
485 | + $txt .= '<span>MySQL version '. |
|
486 | + $db_link -> server_version.' is not OK (minimum is '.MIN_MARIADB_VERSION.') '. |
|
487 | 487 | '<img src=\"images/minus-circle.png\"></span><br />'; |
488 | 488 | } |
489 | 489 | } else { |
490 | 490 | if ($mariadbVersion === '') { |
491 | - $txt .= '<span>MySQL version ' . |
|
492 | - $db_link -> server_info . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
491 | + $txt .= '<span>MySQL version '. |
|
492 | + $db_link -> server_info.' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
493 | 493 | '</span><br />'; |
494 | 494 | } else { |
495 | - $txt .= '<span>MySQL version ' . |
|
496 | - $db_link -> server_info . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
495 | + $txt .= '<span>MySQL version '. |
|
496 | + $db_link -> server_info.' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
497 | 497 | '</span><br />'; |
498 | 498 | } |
499 | 499 | |
@@ -503,22 +503,22 @@ discard block |
||
503 | 503 | // check if 2.1.27 already installed |
504 | 504 | if (defined(SECUREPATH) === true) { |
505 | 505 | $okEncryptKey = false; |
506 | - $defuse_file = SECUREPATH . '/teampass-seckey.txt'; |
|
506 | + $defuse_file = SECUREPATH.'/teampass-seckey.txt'; |
|
507 | 507 | if (file_exists($defuse_file)) { |
508 | 508 | $okEncryptKey = true; |
509 | 509 | $superGlobal->put('tp_defuse_installed', true, 'SESSION'); |
510 | - $txt .= '<span>Defuse encryption key is defined<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
510 | + $txt .= '<span>Defuse encryption key is defined<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
511 | 511 | '</span><br />'; |
512 | 512 | } |
513 | 513 | |
514 | 514 | if ($okEncryptKey === false) { |
515 | 515 | $superGlobal->put('tp_defuse_installed', false, 'SESSION'); |
516 | - $txt .= '<span>Encryption Key (SALT) ' . |
|
517 | - ' could not be recovered from ' . $defuse_file . ' ' . |
|
516 | + $txt .= '<span>Encryption Key (SALT) '. |
|
517 | + ' could not be recovered from '.$defuse_file.' '. |
|
518 | 518 | '<img src=\"images/minus-circle.png\"></span><br />'; |
519 | 519 | } else { |
520 | 520 | $okEncryptKey = true; |
521 | - $txt .= '<span>Encryption Key (SALT) is available<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
521 | + $txt .= '<span>Encryption Key (SALT) is available<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
522 | 522 | '</span><br />'; |
523 | 523 | } |
524 | 524 | } else { |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | } |
535 | 535 | |
536 | 536 | echo '[{'. |
537 | - '"error" : "' . $error . '",'. |
|
538 | - '"info" : "' . $txt . '",'. |
|
537 | + '"error" : "'.$error.'",'. |
|
538 | + '"info" : "'.$txt.'",'. |
|
539 | 539 | '"index" : "'.($error === "" ? "" : $nextStep).'",'. |
540 | - '"infos" : "' . $okWritable." ; ".$okExtensions." ; ".$okEncryptKey." ; " . '"'. |
|
540 | + '"infos" : "'.$okWritable." ; ".$okExtensions." ; ".$okEncryptKey." ; ".'"'. |
|
541 | 541 | '}]'; |
542 | 542 | break; |
543 | 543 | |
@@ -562,14 +562,14 @@ discard block |
||
562 | 562 | if (@mysqli_fetch_row( |
563 | 563 | mysqli_query( |
564 | 564 | $db_link, |
565 | - 'SELECT valeur FROM ' . $pre . "misc |
|
565 | + 'SELECT valeur FROM '.$pre."misc |
|
566 | 566 | WHERE type='admin' AND intitule = 'utf8_enabled'" |
567 | 567 | ) |
568 | 568 | )) { |
569 | 569 | $cpmIsUTF8 = mysqli_fetch_row( |
570 | 570 | mysqli_query( |
571 | 571 | $db_link, |
572 | - 'SELECT valeur FROM ' . $pre . "misc |
|
572 | + 'SELECT valeur FROM '.$pre."misc |
|
573 | 573 | WHERE type='admin' AND intitule = 'utf8_enabled'" |
574 | 574 | ) |
575 | 575 | ); |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | // put TP in maintenance mode or not |
580 | 580 | @mysqli_query( |
581 | 581 | $db_link, |
582 | - "UPDATE `" . $pre . "misc` |
|
582 | + "UPDATE `".$pre."misc` |
|
583 | 583 | SET `valeur` = 'maintenance_mode' |
584 | - WHERE type = 'admin' AND intitule = '" . $post_no_maintenance_mode . "'" |
|
584 | + WHERE type = 'admin' AND intitule = '" . $post_no_maintenance_mode."'" |
|
585 | 585 | ); |
586 | 586 | |
587 | 587 | echo '[{'. |
@@ -608,9 +608,9 @@ discard block |
||
608 | 608 | if (isset($post_prefix_before_convert) && $post_prefix_before_convert == 'true') { |
609 | 609 | $tables = mysqli_query($db_link, 'SHOW TABLES'); |
610 | 610 | while ($table = mysqli_fetch_row($tables)) { |
611 | - if (tableExists('old_' . $table[0]) != 1 && substr($table[0], 0, 4) != 'old_') { |
|
612 | - mysqli_query($db_link, 'CREATE TABLE old_' . $table[0] . ' LIKE ' . $table[0]); |
|
613 | - mysqli_query($db_link, 'INSERT INTO old_' . $table[0] . ' SELECT * FROM ' . $table[0]); |
|
611 | + if (tableExists('old_'.$table[0]) != 1 && substr($table[0], 0, 4) != 'old_') { |
|
612 | + mysqli_query($db_link, 'CREATE TABLE old_'.$table[0].' LIKE '.$table[0]); |
|
613 | + mysqli_query($db_link, 'INSERT INTO old_'.$table[0].' SELECT * FROM '.$table[0]); |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | } |
@@ -618,22 +618,22 @@ discard block |
||
618 | 618 | //convert database |
619 | 619 | mysqli_query( |
620 | 620 | $db_link, |
621 | - 'ALTER DATABASE `' . $database . '` |
|
621 | + 'ALTER DATABASE `'.$database.'` |
|
622 | 622 | DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' |
623 | 623 | ); |
624 | 624 | |
625 | 625 | //convert tables |
626 | - $res = mysqli_query($db_link, 'SHOW TABLES FROM `' . $database . '`'); |
|
626 | + $res = mysqli_query($db_link, 'SHOW TABLES FROM `'.$database.'`'); |
|
627 | 627 | while ($table = mysqli_fetch_row($res)) { |
628 | 628 | if (substr($table[0], 0, 4) != 'old_') { |
629 | 629 | mysqli_query( |
630 | 630 | $db_link, |
631 | - 'ALTER TABLE ' . $database . '.`{$table[0]}` |
|
631 | + 'ALTER TABLE '.$database.'.`{$table[0]}` |
|
632 | 632 | CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci' |
633 | 633 | ); |
634 | 634 | mysqli_query( |
635 | 635 | $db_link, |
636 | - 'ALTER TABLE' . $database . '.`{$table[0]}` |
|
636 | + 'ALTER TABLE'.$database.'.`{$table[0]}` |
|
637 | 637 | DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' |
638 | 638 | ); |
639 | 639 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | //Do a copy of the existing file |
671 | 671 | if (!copy( |
672 | 672 | $settingsFile, |
673 | - $settingsFile . '.' . date( |
|
673 | + $settingsFile.'.'.date( |
|
674 | 674 | 'Y_m_d_H_i_s', |
675 | 675 | mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y')) |
676 | 676 | ) |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | // CHeck if old sk.php exists. |
688 | 688 | // If yes then get keys to database and delete it |
689 | 689 | if (empty($post_sk_path) === false || defined('SECUREPATH') === true) { |
690 | - $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH) . '/sk.php'; |
|
690 | + $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH).'/sk.php'; |
|
691 | 691 | if (file_exists($filename)) { |
692 | 692 | include_once $filename; |
693 | 693 | unlink($filename); |
@@ -696,63 +696,63 @@ discard block |
||
696 | 696 | // SKEY |
697 | 697 | $tmp = mysqli_query( |
698 | 698 | $db_link, |
699 | - "SELECT INTO `" . $pre . "misc` |
|
699 | + "SELECT INTO `".$pre."misc` |
|
700 | 700 | WHERE type = 'admin' AND intitule = 'duo_skey'" |
701 | 701 | ); |
702 | 702 | if ($tmp) { |
703 | 703 | mysqli_query( |
704 | 704 | $db_link, |
705 | - "UPDATE `" . $pre . "misc` |
|
706 | - set valeur = '" . SKEY . "', type = 'admin', intitule = 'duo_skey'" |
|
705 | + "UPDATE `".$pre."misc` |
|
706 | + set valeur = '" . SKEY."', type = 'admin', intitule = 'duo_skey'" |
|
707 | 707 | ); |
708 | 708 | } else { |
709 | 709 | mysqli_query( |
710 | 710 | $db_link, |
711 | - "INSERT INTO `" . $pre . "misc` |
|
711 | + "INSERT INTO `".$pre."misc` |
|
712 | 712 | (`valeur`, `type`, `intitule`) |
713 | - VALUES ('" . SKEY . "', 'admin', 'duo_skey')" |
|
713 | + VALUES ('" . SKEY."', 'admin', 'duo_skey')" |
|
714 | 714 | ); |
715 | 715 | } |
716 | 716 | |
717 | 717 | // IKEY |
718 | 718 | $tmp = mysqli_query( |
719 | 719 | $db_link, |
720 | - "SELECT INTO `" . $pre . "misc` |
|
720 | + "SELECT INTO `".$pre."misc` |
|
721 | 721 | WHERE type = 'admin' AND intitule = 'duo_ikey'" |
722 | 722 | ); |
723 | 723 | if ($tmp) { |
724 | 724 | mysqli_query( |
725 | 725 | $db_link, |
726 | - "UPDATE `" . $pre . "misc` |
|
727 | - set valeur = '" . IKEY . "', type = 'admin', intitule = 'duo_ikey'" |
|
726 | + "UPDATE `".$pre."misc` |
|
727 | + set valeur = '" . IKEY."', type = 'admin', intitule = 'duo_ikey'" |
|
728 | 728 | ); |
729 | 729 | } else { |
730 | 730 | mysqli_query( |
731 | 731 | $db_link, |
732 | - "INSERT INTO `" . $pre . "misc` |
|
732 | + "INSERT INTO `".$pre."misc` |
|
733 | 733 | (`valeur`, `type`, `intitule`) |
734 | - VALUES ('" . IKEY . "', 'admin', 'duo_ikey')" |
|
734 | + VALUES ('" . IKEY."', 'admin', 'duo_ikey')" |
|
735 | 735 | ); |
736 | 736 | } |
737 | 737 | |
738 | 738 | // HOST |
739 | 739 | $tmp = mysqli_query( |
740 | 740 | $db_link, |
741 | - "SELECT INTO `" . $pre . "misc` |
|
741 | + "SELECT INTO `".$pre."misc` |
|
742 | 742 | WHERE type = 'admin' AND intitule = 'duo_host'" |
743 | 743 | ); |
744 | 744 | if ($tmp) { |
745 | 745 | mysqli_query( |
746 | 746 | $db_link, |
747 | - "UPDATE `" . $pre . "misc` |
|
748 | - set valeur = '" . HOST . "', type = 'admin', intitule = 'duo_host'" |
|
747 | + "UPDATE `".$pre."misc` |
|
748 | + set valeur = '" . HOST."', type = 'admin', intitule = 'duo_host'" |
|
749 | 749 | ); |
750 | 750 | } else { |
751 | 751 | mysqli_query( |
752 | 752 | $db_link, |
753 | - "INSERT INTO `" . $pre . "misc` |
|
753 | + "INSERT INTO `".$pre."misc` |
|
754 | 754 | (`valeur`, `type`, `intitule`) |
755 | - VALUES ('" . HOST . "', 'admin', 'duo_host')" |
|
755 | + VALUES ('" . HOST."', 'admin', 'duo_host')" |
|
756 | 756 | ); |
757 | 757 | } |
758 | 758 | } |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | utf8_encode( |
772 | 772 | '<?php |
773 | 773 | // DATABASE connexion parameters |
774 | - define("DB_HOST", "' . DB_HOST . '"); |
|
775 | - define("DB_USER", "' . DB_USER . '"); |
|
776 | - define("DB_PASSWD", "' . defuse_return_decrypted(DB_PASSWD) . '"); |
|
777 | - define("DB_NAME", "' . DB_NAME . '"); |
|
778 | - define("DB_PREFIX", "' . DB_PREFIX . '"); |
|
779 | - define("DB_PORT", "' . DB_PORT . '"); |
|
780 | - define("DB_ENCODING", "' . DB_ENCODING . '"); |
|
774 | + define("DB_HOST", "' . DB_HOST.'"); |
|
775 | + define("DB_USER", "' . DB_USER.'"); |
|
776 | + define("DB_PASSWD", "' . defuse_return_decrypted(DB_PASSWD).'"); |
|
777 | + define("DB_NAME", "' . DB_NAME.'"); |
|
778 | + define("DB_PREFIX", "' . DB_PREFIX.'"); |
|
779 | + define("DB_PORT", "' . DB_PORT.'"); |
|
780 | + define("DB_ENCODING", "' . DB_ENCODING.'"); |
|
781 | 781 | define("DB_SSL", false); // if DB over SSL then comment this line |
782 | 782 | // if DB over SSL then uncomment the following lines |
783 | 783 | //define("DB_SSL", array( |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | define("DB_CONNECT_OPTIONS", array( |
791 | 791 | MYSQLI_OPT_CONNECT_TIMEOUT => 10 |
792 | 792 | )); |
793 | - define("SECUREPATH", "' . SECUREPATH. '"); |
|
793 | + define("SECUREPATH", "' . SECUREPATH.'"); |
|
794 | 794 | |
795 | 795 | if (isset($_SESSION[\'settings\'][\'timezone\']) === true) { |
796 | 796 | date_default_timezone_set($_SESSION[\'settings\'][\'timezone\']); |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | if ( |
886 | 886 | copy( |
887 | 887 | $csrfp_file, |
888 | - $csrfp_file . '.' . date( |
|
888 | + $csrfp_file.'.'.date( |
|
889 | 889 | 'Y_m_d_H_i_s', |
890 | 890 | mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y')) |
891 | 891 | ) |
@@ -904,17 +904,17 @@ discard block |
||
904 | 904 | unlink($csrfp_file); // delete existing csrfp.config file |
905 | 905 | copy($csrfp_file_sample, $csrfp_file); // make a copy of csrfp.config.sample file |
906 | 906 | $data = file_get_contents('../includes/libraries/csrfp/libs/csrfp.config.php'); |
907 | - $newdata = str_replace('"CSRFP_TOKEN" => ""', '"CSRFP_TOKEN" => "' . bin2hex(openssl_random_pseudo_bytes(25)) . '"', $data); |
|
907 | + $newdata = str_replace('"CSRFP_TOKEN" => ""', '"CSRFP_TOKEN" => "'.bin2hex(openssl_random_pseudo_bytes(25)).'"', $data); |
|
908 | 908 | $newdata = str_replace('"tokenLength" => "25"', '"tokenLength" => "50"', $newdata); |
909 | - $jsUrl = $post_url_path . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
910 | - $newdata = str_replace('"jsUrl" => ""', '"jsUrl" => "' . $jsUrl . '"', $newdata); |
|
909 | + $jsUrl = $post_url_path.'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
910 | + $newdata = str_replace('"jsUrl" => ""', '"jsUrl" => "'.$jsUrl.'"', $newdata); |
|
911 | 911 | $newdata = str_replace('"verifyGetFor" => array()', '"verifyGetFor" => array("*page=items&type=duo_check*")', $newdata); |
912 | 912 | file_put_contents('../includes/libraries/csrfp/libs/csrfp.config.php', $newdata); |
913 | 913 | |
914 | 914 | // Mark a tag to force Install stuff (folders, files and table) to be cleanup while first login |
915 | 915 | mysqli_query( |
916 | 916 | $db_link, |
917 | - 'INSERT INTO `' . $pre . 'misc` (`type`, `intitule`, `valeur`) VALUES ("install", "clear_install_folder", "true")' |
|
917 | + 'INSERT INTO `'.$pre.'misc` (`type`, `intitule`, `valeur`) VALUES ("install", "clear_install_folder", "true")' |
|
918 | 918 | ); |
919 | 919 | |
920 | 920 | array_push( |
@@ -936,19 +936,19 @@ discard block |
||
936 | 936 | |
937 | 937 | // update with correct version |
938 | 938 | // 1st - check if teampass_version exists |
939 | - $data = mysqli_fetch_row(mysqli_query($db_link, "SELECT COUNT(*) FROM ".$pre . "misc WHERE type = 'admin' AND intitule = 'teampass_version';")); |
|
939 | + $data = mysqli_fetch_row(mysqli_query($db_link, "SELECT COUNT(*) FROM ".$pre."misc WHERE type = 'admin' AND intitule = 'teampass_version';")); |
|
940 | 940 | if ((int) $data[0] === 0) { |
941 | 941 | // change variable name and put version |
942 | 942 | mysqli_query( |
943 | 943 | $db_link, |
944 | - "UPDATE `" . $pre . "misc` |
|
944 | + "UPDATE `".$pre."misc` |
|
945 | 945 | SET `valeur` = '".TP_VERSION."', `intitule` = 'teampass_version' |
946 | 946 | WHERE intitule = 'cpassman_version' AND type = 'admin';" |
947 | 947 | ); |
948 | 948 | } else { |
949 | 949 | mysqli_query( |
950 | 950 | $db_link, |
951 | - "UPDATE `" . $pre . "misc` |
|
951 | + "UPDATE `".$pre."misc` |
|
952 | 952 | SET `valeur` = '".TP_VERSION."' |
953 | 953 | WHERE intitule = 'teampass_version' AND type = 'admin';" |
954 | 954 | ); |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | ->setDayOfMonth('*') |
979 | 979 | ->setMonths('*') |
980 | 980 | ->setDayOfWeek('*') |
981 | - ->setTaskCommandLine($phpLocation['path'] . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php') |
|
981 | + ->setTaskCommandLine($phpLocation['path'].' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php') |
|
982 | 982 | ->setComments('Teampass scheduler'); |
983 | 983 | |
984 | 984 | $crontabRepository->addJob($crontabJob); |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | $mysqli = new mysqli($server, $user, $pass, $database, $port); |
1036 | 1036 | if ($mysqli->connect_error) { |
1037 | - die('Error : (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); |
|
1037 | + die('Error : ('.$mysqli->connect_errno.') '.$mysqli->connect_error); |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | $results = $mysqli->query('SHOW TABLES'); |
@@ -1044,11 +1044,11 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | // Prepare file |
1047 | - $backup_file_name = 'sql-backup-' . date('d-m-Y--h-i-s') . '.sql'; |
|
1048 | - $fp = fopen('../files/' . $backup_file_name, 'a'); |
|
1047 | + $backup_file_name = 'sql-backup-'.date('d-m-Y--h-i-s').'.sql'; |
|
1048 | + $fp = fopen('../files/'.$backup_file_name, 'a'); |
|
1049 | 1049 | |
1050 | 1050 | foreach ($mtables as $table) { |
1051 | - $contents = '-- Table `' . $table . "` --\n"; |
|
1051 | + $contents = '-- Table `'.$table."` --\n"; |
|
1052 | 1052 | if (fwrite($fp, $contents) === false) { |
1053 | 1053 | echo '[{'. |
1054 | 1054 | '"error" : "Backup fails - please do it manually",'. |
@@ -1058,9 +1058,9 @@ discard block |
||
1058 | 1058 | return false; |
1059 | 1059 | } |
1060 | 1060 | |
1061 | - $results = $mysqli->query('SHOW CREATE TABLE ' . $table); |
|
1061 | + $results = $mysqli->query('SHOW CREATE TABLE '.$table); |
|
1062 | 1062 | while ($row = $results->fetch_array()) { |
1063 | - $contents = $row[1] . ";\n\n"; |
|
1063 | + $contents = $row[1].";\n\n"; |
|
1064 | 1064 | if (fwrite($fp, $contents) === false) { |
1065 | 1065 | echo '[{'. |
1066 | 1066 | '"error" : "Backup fails - please do it manually",'. |
@@ -1071,14 +1071,14 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - $results = $mysqli->query('SELECT * FROM ' . $table); |
|
1074 | + $results = $mysqli->query('SELECT * FROM '.$table); |
|
1075 | 1075 | $row_count = $results->num_rows; |
1076 | 1076 | $fields = $results->fetch_fields(); |
1077 | 1077 | $fields_count = count($fields); |
1078 | 1078 | |
1079 | - $insert_head = 'INSERT INTO `' . $table . '` ('; |
|
1079 | + $insert_head = 'INSERT INTO `'.$table.'` ('; |
|
1080 | 1080 | for ($i = 0; $i < $fields_count; ++$i) { |
1081 | - $insert_head .= '`' . $fields[$i]->name . '`'; |
|
1081 | + $insert_head .= '`'.$fields[$i]->name.'`'; |
|
1082 | 1082 | if ($i < $fields_count - 1) { |
1083 | 1083 | $insert_head .= ', '; |
1084 | 1084 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | break; |
1128 | 1128 | default: |
1129 | 1129 | //$contents .= "'".$row_content."'"; |
1130 | - if (fwrite($fp, "'" . $row_content . "'") === false) { |
|
1130 | + if (fwrite($fp, "'".$row_content."'") === false) { |
|
1131 | 1131 | echo '[{'. |
1132 | 1132 | '"error" : "Backup fails - please do it manually",'. |
1133 | 1133 | '"index" : ""'. |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $port |
82 | 82 | ); |
83 | 83 | } else { |
84 | - $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()); |
|
85 | - echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]'; |
|
84 | + $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()); |
|
85 | + echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]'; |
|
86 | 86 | mysqli_close($db_link); |
87 | 87 | exit(); |
88 | 88 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | // OPERATION - 20231017_1 - remove all existing keys |
148 | 148 | // if item is personal and user is not owner |
149 | 149 | |
150 | - installPurgeUnnecessaryKeys(true, 0,$pre); |
|
150 | + installPurgeUnnecessaryKeys(true, 0, $pre); |
|
151 | 151 | } |
152 | 152 | // Return back |
153 | 153 | echo '[{"finish":"'.$finish.'" , "next":"", "error":"", "total":"'.$total.'"}]'; |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | $items = mysqli_query( |
162 | 162 | $db_link, |
163 | 163 | "select i.id as id, ls.date as datetime |
164 | - from `" . $pre . "items` as i |
|
165 | - inner join `" . $pre . "log_items` as ls on ls.id_item = i.id |
|
164 | + from `" . $pre."items` as i |
|
165 | + inner join `" . $pre."log_items` as ls on ls.id_item = i.id |
|
166 | 166 | WHERE ls.action = 'at_creation' AND i.created_at IS NULL |
167 | 167 | LIMIT " . $post_nb.";" |
168 | 168 | ); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // update created_at field |
172 | 172 | mysqli_query( |
173 | 173 | $db_link, |
174 | - "UPDATE `" . $pre . "items` SET created_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
174 | + "UPDATE `".$pre."items` SET created_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
175 | 175 | ); |
176 | 176 | } |
177 | 177 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $remainingItems = mysqli_num_rows( |
181 | 181 | mysqli_query( |
182 | 182 | $db_link, |
183 | - "SELECT * FROM `" . $pre . "items` WHERE created_at IS NULL" |
|
183 | + "SELECT * FROM `".$pre."items` WHERE created_at IS NULL" |
|
184 | 184 | ) |
185 | 185 | ); |
186 | 186 | return $remainingItems > 0 ? 0 : 1; |
@@ -192,15 +192,15 @@ discard block |
||
192 | 192 | // loop on items - updated_at |
193 | 193 | $items = mysqli_query( |
194 | 194 | $db_link, |
195 | - "select i.id as id, (select date from " . $pre . "log_items where action = 'at_modification' and id_item=id order by date DESC limit 1) as datetime |
|
196 | - from `" . $pre . "items` as i;" |
|
195 | + "select i.id as id, (select date from ".$pre."log_items where action = 'at_modification' and id_item=id order by date DESC limit 1) as datetime |
|
196 | + from `" . $pre."items` as i;" |
|
197 | 197 | ); |
198 | 198 | while ($item = mysqli_fetch_assoc($items)) { |
199 | 199 | if (is_null($item['datetime']) === false) { |
200 | 200 | // update updated_at field |
201 | 201 | mysqli_query( |
202 | 202 | $db_link, |
203 | - "UPDATE `" . $pre . "items` SET updated_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
203 | + "UPDATE `".$pre."items` SET updated_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
204 | 204 | ); |
205 | 205 | } |
206 | 206 | } |
@@ -214,15 +214,15 @@ discard block |
||
214 | 214 | // loop on items - deleted_at |
215 | 215 | $items = mysqli_query( |
216 | 216 | $db_link, |
217 | - "select i.id as id, (select date from " . $pre . "log_items where action = 'at_deleted' and id_item=id order by date DESC limit 1) as datetime |
|
218 | - from `" . $pre . "items` as i;" |
|
217 | + "select i.id as id, (select date from ".$pre."log_items where action = 'at_deleted' and id_item=id order by date DESC limit 1) as datetime |
|
218 | + from `" . $pre."items` as i;" |
|
219 | 219 | ); |
220 | 220 | while ($item = mysqli_fetch_assoc($items)) { |
221 | 221 | if (is_null($item['datetime']) === false) { |
222 | 222 | // update updated_at field |
223 | 223 | mysqli_query( |
224 | 224 | $db_link, |
225 | - "UPDATE `" . $pre . "items` SET deleted_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
225 | + "UPDATE `".$pre."items` SET deleted_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
226 | 226 | ); |
227 | 227 | } |
228 | 228 | } |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | * @param integer $user_id |
239 | 239 | * @return void |
240 | 240 | */ |
241 | -function installPurgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0, string $pre) |
|
241 | +function installPurgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0, string $pre) |
|
242 | 242 | { |
243 | 243 | global $db_link; |
244 | 244 | if ($allUsers === true) { |
245 | 245 | $users = mysqli_query( |
246 | 246 | $db_link, |
247 | 247 | 'SELECT id |
248 | - FROM ' . $pre . 'users |
|
248 | + FROM ' . $pre.'users |
|
249 | 249 | WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.') |
250 | 250 | ORDER BY login ASC' |
251 | 251 | ); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @param integer $user_id |
264 | 264 | * @return void |
265 | 265 | */ |
266 | -function installPurgeUnnecessaryKeysForUser(int $user_id=0, string $pre) |
|
266 | +function installPurgeUnnecessaryKeysForUser(int $user_id = 0, string $pre) |
|
267 | 267 | { |
268 | 268 | global $db_link; |
269 | 269 | if ($user_id === 0) { |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | $result = mysqli_query( |
274 | 274 | $db_link, |
275 | 275 | 'SELECT id |
276 | - FROM ' . $pre . 'items AS i |
|
277 | - INNER JOIN ' . $pre . 'log_items AS li ON li.id_item = i.id |
|
276 | + FROM ' . $pre.'items AS i |
|
277 | + INNER JOIN ' . $pre.'log_items AS li ON li.id_item = i.id |
|
278 | 278 | WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN ('.TP_USER_ID.', '.$user_id.')', |
279 | 279 | ); |
280 | 280 | $rowcount = mysqli_num_rows($result); |
@@ -290,25 +290,25 @@ discard block |
||
290 | 290 | // Item keys |
291 | 291 | mysqli_query( |
292 | 292 | $db_link, |
293 | - 'DELETE FROM ' . $pre . 'sharekeys_items |
|
293 | + 'DELETE FROM '.$pre.'sharekeys_items |
|
294 | 294 | WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')' |
295 | 295 | ); |
296 | 296 | // Files keys |
297 | 297 | mysqli_query( |
298 | 298 | $db_link, |
299 | - 'DELETE FROM ' . $pre . 'sharekeys_files |
|
299 | + 'DELETE FROM '.$pre.'sharekeys_files |
|
300 | 300 | WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')' |
301 | 301 | ); |
302 | 302 | // Fields keys |
303 | 303 | mysqli_query( |
304 | 304 | $db_link, |
305 | - 'DELETE FROM ' . $pre . 'sharekeys_fields |
|
305 | + 'DELETE FROM '.$pre.'sharekeys_fields |
|
306 | 306 | WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')' |
307 | 307 | ); |
308 | 308 | // Logs keys |
309 | 309 | mysqli_query( |
310 | 310 | $db_link, |
311 | - 'DELETE FROM ' . $pre . 'sharekeys_logs |
|
311 | + 'DELETE FROM '.$pre.'sharekeys_logs |
|
312 | 312 | WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')' |
313 | 313 | ); |
314 | 314 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | // force full list of folders |
341 | 341 | if (count($folderIds) === 0) { |
342 | 342 | $result = $mysqli2->query('SELECT id |
343 | - FROM ' . $pre . 'nested_tree |
|
343 | + FROM ' . $pre.'nested_tree |
|
344 | 344 | WHERE personal_folder = 0', |
345 | 345 | ); |
346 | 346 | $rowcount = $result->num_rows; |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | $arrCatList = array(); |
362 | 362 | $result = $mysqli2->query('SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory, |
363 | 363 | f.id_category AS category_id |
364 | - FROM ' . $pre . 'categories_folders AS f |
|
365 | - INNER JOIN ' . $pre . 'categories AS c ON (f.id_category = c.parent_id) |
|
364 | + FROM ' . $pre.'categories_folders AS f |
|
365 | + INNER JOIN ' . $pre.'categories AS c ON (f.id_category = c.parent_id) |
|
366 | 366 | WHERE id_folder = '.$folder |
367 | 367 | ); |
368 | 368 | $rowcount = $result->num_rows; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | // Now get complexity |
388 | 388 | $valTemp = ''; |
389 | 389 | $result = $mysqli2->query('SELECT valeur |
390 | - FROM ' . $pre . 'misc |
|
390 | + FROM ' . $pre.'misc |
|
391 | 391 | WHERE type = "complex" AND intitule = '.$folder |
392 | 392 | ); |
393 | 393 | $rowcount = $result->num_rows; |
@@ -404,21 +404,21 @@ discard block |
||
404 | 404 | // Now get Roles |
405 | 405 | $valTemp = ''; |
406 | 406 | $result = $mysqli2->query('SELECT t.title |
407 | - FROM ' . $pre . 'roles_values as v |
|
408 | - INNER JOIN ' . $pre . 'roles_title as t ON (v.role_id = t.id) |
|
407 | + FROM ' . $pre.'roles_values as v |
|
408 | + INNER JOIN ' . $pre.'roles_title as t ON (v.role_id = t.id) |
|
409 | 409 | WHERE v.folder_id = '.$folder.' |
410 | 410 | GROUP BY title' |
411 | 411 | ); |
412 | 412 | $rowcount = $result->num_rows; |
413 | 413 | if ($rowcount > 0) { |
414 | 414 | while ($row = $result->fetch_assoc()) { |
415 | - $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $row['title']; |
|
415 | + $valTemp .= (empty($valTemp) === true ? '' : ' - ').$row['title']; |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | $arr_data['visibilityRoles'] = $valTemp; |
419 | 419 | |
420 | 420 | // now save in DB |
421 | - $mysqli2->query("UPDATE " . $pre . "nested_tree SET categories = '".json_encode($arr_data)."' WHERE id = ".$folder); |
|
421 | + $mysqli2->query("UPDATE ".$pre."nested_tree SET categories = '".json_encode($arr_data)."' WHERE id = ".$folder); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | mysqli_close($mysqli2); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | function installHandleConfigFile($action, $SETTINGS, $field = null, $value = null) |
439 | 439 | { |
440 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
440 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
441 | 441 | $filename = '../includes/config/settings.php'; |
442 | 442 | include_once '../sources/main.functions.php'; |
443 | 443 | $pass = defuse_return_decrypted(DB_PASSWD); |
@@ -452,8 +452,8 @@ discard block |
||
452 | 452 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
453 | 453 | // perform a copy |
454 | 454 | if (file_exists($tp_config_file)) { |
455 | - if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
456 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
455 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
456 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | $data[2] = "\$SETTINGS = array (\n"; |
465 | 465 | |
466 | 466 | $result = $mysqli2->query('SELECT * |
467 | - FROM ' . $pre . 'misc |
|
467 | + FROM ' . $pre.'misc |
|
468 | 468 | WHERE type = "admin"' |
469 | 469 | ); |
470 | 470 | $rowcount = $result->num_rows; |
471 | 471 | if ($rowcount > 0) { |
472 | 472 | while ($row = $result->fetch_assoc()) { |
473 | - array_push($data, " '" . $row['intitule'] . "' => '" . htmlspecialchars_decode($row['valeur'], ENT_COMPAT) . "',\n"); |
|
473 | + array_push($data, " '".$row['intitule']."' => '".htmlspecialchars_decode($row['valeur'], ENT_COMPAT)."',\n"); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | array_push($data, ");\n"); |
@@ -485,15 +485,15 @@ discard block |
||
485 | 485 | break; |
486 | 486 | } |
487 | 487 | |
488 | - if (stristr($line, "'" . $field . "' => '")) { |
|
489 | - $data[$inc] = " '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT) . "',\n"; |
|
488 | + if (stristr($line, "'".$field."' => '")) { |
|
489 | + $data[$inc] = " '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n"; |
|
490 | 490 | $bFound = true; |
491 | 491 | break; |
492 | 492 | } |
493 | 493 | ++$inc; |
494 | 494 | } |
495 | 495 | if ($bFound === false) { |
496 | - $data[$inc] = " '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT). "',\n);\n"; |
|
496 | + $data[$inc] = " '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n);\n"; |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | mysqli_close($mysqli2); |
@@ -41,4 +41,4 @@ |
||
41 | 41 | } else { |
42 | 42 | $finished = 0; |
43 | 43 | } |
44 | -echo '[{"finish":"' . $finished . '", "scriptname":"' . $scripts_list[$post_file_number][0] . '", "parameter":"' . $scripts_list[$post_file_number][1] . '"}]'; |
|
44 | +echo '[{"finish":"'.$finished.'", "scriptname":"'.$scripts_list[$post_file_number][0].'", "parameter":"'.$scripts_list[$post_file_number][1].'"}]'; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $abs_path = rtrim( |
44 | 44 | filter_var($_SERVER['DOCUMENT_ROOT'], FILTER_SANITIZE_FULL_SPECIAL_CHARS), |
45 | 45 | '/' |
46 | - ) . substr( |
|
46 | + ).substr( |
|
47 | 47 | filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_FULL_SPECIAL_CHARS), |
48 | 48 | 0, |
49 | 49 | strlen(filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)) - 20 |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | <div id="top"> |
105 | 105 | <div id="logo" class="lcol"><img src="../includes/images/teampass-logo2-home.png" /></div> |
106 | 106 | <div class="lcol"> |
107 | - <span class="header-title">' . strtoupper(TP_TOOL_NAME) . '</span> |
|
107 | + <span class="header-title">' . strtoupper(TP_TOOL_NAME).'</span> |
|
108 | 108 | </div> |
109 | 109 | |
110 | 110 | <div id="content"> |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | <h5><i class="fas fa-info-circle text-warning mr-2"></i>Welcome to Teampass installation</h5> |
140 | 140 | |
141 | 141 | <p>This seems to be the 1st time Teampass will be installed on this server.<br> |
142 | - It will proceed with installation of release <b>' . TP_VERSION . '</b>.</p> |
|
142 | + It will proceed with installation of release <b>' . TP_VERSION.'</b>.</p> |
|
143 | 143 | </div> |
144 | 144 | |
145 | 145 | <div class="callout callout-info col-12 mt-3"> |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | <div class="card-body"> |
176 | 176 | <div class="form-group"> |
177 | 177 | <label>Absolute path to TeamPass folder</label> |
178 | - <input type="text" class="form-control" name="absolute_path" id="absolute_path" class="ui-widget" value="' . $abs_path . '"> |
|
178 | + <input type="text" class="form-control" name="absolute_path" id="absolute_path" class="ui-widget" value="' . $abs_path.'"> |
|
179 | 179 | </div> |
180 | 180 | <div class="form-group"> |
181 | 181 | <label>Full URL to TeamPass</label> |
182 | - <input type="text" class="form-control" name="url_path" id="url_path" class="ui-widget" value="' . $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8) . '"> |
|
182 | + <input type="text" class="form-control" name="url_path" id="url_path" class="ui-widget" value="' . $protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8).'"> |
|
183 | 183 | </div> |
184 | 184 | </div> |
185 | 185 | </div> |
@@ -400,13 +400,13 @@ discard block |
||
400 | 400 | if (!isset($post_step)) { |
401 | 401 | echo ' |
402 | 402 | <input type="button" class="btn btn-primary" id="but_next" target_id="2" class="button" value="START" /> |
403 | - <input type="button" class="btn btn-primary" id="but_start" onclick="document.location = \'' . $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8) . '\'" class="button" style="display: none;" value="Start" />'; |
|
403 | + <input type="button" class="btn btn-primary" id="but_start" onclick="document.location = \'' . $protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') - 8).'\'" class="button" style="display: none;" value="Start" />'; |
|
404 | 404 | } elseif ($post_step == 7) { |
405 | 405 | // Nothong to do |
406 | 406 | } else { |
407 | 407 | echo ' |
408 | - <input type="button" id="but_launch" onclick="checkPage(\'step' . $post_step . '\')" class="btn btn-primary" value="START" /> |
|
409 | - <input type="button" id="but_next" target_id="' . (intval($post_step) + 1) . '" class="btn btn-primary" value="NEXT" disabled="disabled"> |
|
408 | + <input type="button" id="but_launch" onclick="checkPage(\'step' . $post_step.'\')" class="btn btn-primary" value="START" /> |
|
409 | + <input type="button" id="but_next" target_id="' . (intval($post_step) + 1).'" class="btn btn-primary" value="NEXT" disabled="disabled"> |
|
410 | 410 | <input type="button" class="btn btn-primary" id="but_restart" onclick="document.location = \'install.php\'" class="button" value="RESTART" />'; |
411 | 411 | } |
412 | 412 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | echo ' |
420 | 420 | <div id="footer"> |
421 | 421 | <div style="width:500px; font-size:16px;"> |
422 | - ' . TP_TOOL_NAME . ' ' . TP_VERSION . ' <i class="far fa-copyright"></i> copyright 2009-2019 |
|
422 | + ' . TP_TOOL_NAME.' '.TP_VERSION.' <i class="far fa-copyright"></i> copyright 2009-2019 |
|
423 | 423 | </div> |
424 | 424 | <div style="float:right;margin-top:-15px;"> |
425 | 425 | </div> |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | echo ' |
276 | 276 | <div class="row"> |
277 | 277 | <div class="col-12"> |
278 | - <div class="card card-',$dbSettings === true ? 'primary' : 'warning','"> |
|
278 | + <div class="card card-',$dbSettings === true ? 'primary' : 'warning', '"> |
|
279 | 279 | <div class="card-header"> |
280 | 280 | <h5>DataBase Informations</h5> |
281 | 281 | </div> |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | console.log("> "+step+" - Number: "+number + " - Previous step: "+previousStep); |
803 | 803 | console.log(usersList); |
804 | 804 | var d = new Date(), |
805 | - count_in_loop = <?php echo (int) NUMBER_ITEMS_IN_BATCH;?>, |
|
805 | + count_in_loop = <?php echo (int) NUMBER_ITEMS_IN_BATCH; ?>, |
|
806 | 806 | userSteps = {}; |
807 | 807 | |
808 | 808 |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | |
35 | 35 | $settingsTxt = '<?php |
36 | 36 | // DATABASE connexion parameters |
37 | -define("DB_HOST", "' . DB_HOST . '"); |
|
38 | -define("DB_USER", "' . DB_USER . '"); |
|
39 | -define("DB_PASSWD", "' . DB_PASSWD . '"); |
|
40 | -define("DB_NAME", "' . DB_NAME . '"); |
|
41 | -define("DB_PREFIX", "' . DB_PREFIX . '"); |
|
42 | -define("DB_PORT", "' . DB_PORT . '"); |
|
43 | -define("DB_ENCODING", "' . DB_ENCODING . '");'; |
|
37 | +define("DB_HOST", "' . DB_HOST.'"); |
|
38 | +define("DB_USER", "' . DB_USER.'"); |
|
39 | +define("DB_PASSWD", "' . DB_PASSWD.'"); |
|
40 | +define("DB_NAME", "' . DB_NAME.'"); |
|
41 | +define("DB_PREFIX", "' . DB_PREFIX.'"); |
|
42 | +define("DB_PORT", "' . DB_PORT.'"); |
|
43 | +define("DB_ENCODING", "' . DB_ENCODING.'");'; |
|
44 | 44 | |
45 | 45 | if (isset(DB_SSL['key']) === true && empty(DB_SSL['key']) === false) { |
46 | 46 | $settingsTxt .= ' |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | define("DB_CONNECT_OPTIONS", array( |
71 | 71 | MYSQLI_OPT_CONNECT_TIMEOUT => 10 |
72 | 72 | )); |
73 | -define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '"); |
|
74 | -define("SECUREFILE", "' . SECUREFILE. '");'; |
|
73 | +define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH).'"); |
|
74 | +define("SECUREFILE", "' . SECUREFILE.'");'; |
|
75 | 75 | |
76 | 76 | if (defined('IKEY') === true) $settingsTxt .= ' |
77 | -define("IKEY", "' . IKEY . '");'; |
|
77 | +define("IKEY", "' . IKEY.'");'; |
|
78 | 78 | else $settingsTxt .= ' |
79 | 79 | define("IKEY", "");'; |
80 | 80 | if (defined('SKEY') === true) $settingsTxt .= ' |
81 | -define("SKEY", "' . SKEY . '");'; |
|
81 | +define("SKEY", "' . SKEY.'");'; |
|
82 | 82 | else $settingsTxt .= ' |
83 | 83 | define("SKEY", "");'; |
84 | 84 | if (defined('HOST') === true) $settingsTxt .= ' |
85 | -define("HOST", "' . HOST . '");'; |
|
85 | +define("HOST", "' . HOST.'");'; |
|
86 | 86 | else $settingsTxt .= ' |
87 | 87 | define("HOST", "");'; |
88 | 88 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | global $db_link; |
408 | 408 | |
409 | 409 | // check if column already exists |
410 | - $columns = mysqli_query($db_link, "show columns from `" . $table . "`"); |
|
410 | + $columns = mysqli_query($db_link, "show columns from `".$table."`"); |
|
411 | 411 | while ($col = mysqli_fetch_assoc($columns)) { |
412 | 412 | if ((string) $col['Field'] === $oldName) { |
413 | 413 | // change column name |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | // Essayer de trouver le fichier binaire de PHP dans les chemins de recherche standards |
433 | 433 | $paths = explode(PATH_SEPARATOR, getenv('PATH')); |
434 | 434 | foreach ($paths as $path) { |
435 | - $phpBinary = $path . DIRECTORY_SEPARATOR . 'php'; |
|
435 | + $phpBinary = $path.DIRECTORY_SEPARATOR.'php'; |
|
436 | 436 | if (is_executable($phpBinary)) { |
437 | 437 | $phpPath = $phpBinary; |
438 | 438 | break; |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | function deleteAll(array $folders) |
468 | 468 | { |
469 | 469 | |
470 | - foreach($folders as $folder) { |
|
470 | + foreach ($folders as $folder) { |
|
471 | 471 | deleteAllFolder($folder); |
472 | 472 | } |
473 | 473 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $scan = glob(rtrim($str, '/').'/*'); |
494 | 494 | |
495 | 495 | // Loop through the list of files |
496 | - foreach($scan as $index=>$path) { |
|
496 | + foreach ($scan as $index=>$path) { |
|
497 | 497 | |
498 | 498 | // Call recursive function |
499 | 499 | deleteAllFolder($path); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | //Build tree |
58 | 58 | $tree = new NestedTree( |
59 | - $pre . 'nested_tree', |
|
59 | + $pre.'nested_tree', |
|
60 | 60 | 'id', |
61 | 61 | 'parent_id', |
62 | 62 | 'title' |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | $port |
87 | 87 | ); |
88 | 88 | } else { |
89 | - $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()); |
|
90 | - echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]'; |
|
89 | + $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()); |
|
90 | + echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]'; |
|
91 | 91 | mysqli_close($db_link); |
92 | 92 | exit(); |
93 | 93 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $superGlobal->put('abspath', $abspath, 'SESSION'); |
103 | 103 | |
104 | 104 | // Get POST with user info |
105 | -$post_user_info = json_decode(base64_decode(filter_input(INPUT_POST, 'info', FILTER_SANITIZE_FULL_SPECIAL_CHARS)));//print_r($post_user_info); |
|
105 | +$post_user_info = json_decode(base64_decode(filter_input(INPUT_POST, 'info', FILTER_SANITIZE_FULL_SPECIAL_CHARS))); //print_r($post_user_info); |
|
106 | 106 | $userLogin = $post_user_info[0]; |
107 | 107 | $userPassword = aesctr::decrypt(base64_decode($post_user_info[1]), 'cpm', 128); |
108 | 108 | $userId = $post_user_info[2]; |
@@ -175,60 +175,60 @@ discard block |
||
175 | 175 | |
176 | 176 | // Add field public_key to USERS table |
177 | 177 | $res = addColumnIfNotExist( |
178 | - $pre . 'users', |
|
178 | + $pre.'users', |
|
179 | 179 | 'public_key', |
180 | 180 | "TEXT DEFAULT NULL" |
181 | 181 | ); |
182 | 182 | if ($res === false) { |
183 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field public_key to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
183 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field public_key to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
184 | 184 | mysqli_close($db_link); |
185 | 185 | exit(); |
186 | 186 | } |
187 | 187 | |
188 | 188 | // Add field private_key to USERS table |
189 | 189 | $res = addColumnIfNotExist( |
190 | - $pre . 'users', |
|
190 | + $pre.'users', |
|
191 | 191 | 'private_key', |
192 | 192 | "TEXT DEFAULT NULL" |
193 | 193 | ); |
194 | 194 | if ($res === false) { |
195 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field private_key to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
195 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field private_key to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
196 | 196 | mysqli_close($db_link); |
197 | 197 | exit(); |
198 | 198 | } |
199 | 199 | |
200 | 200 | // Add field special to USERS table |
201 | 201 | $res = addColumnIfNotExist( |
202 | - $pre . 'users', |
|
202 | + $pre.'users', |
|
203 | 203 | 'special', |
204 | 204 | "VARCHAR(250) NOT NULL DEFAULT 'none'" |
205 | 205 | ); |
206 | 206 | if ($res === false) { |
207 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field special to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
207 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field special to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
208 | 208 | mysqli_close($db_link); |
209 | 209 | exit(); |
210 | 210 | } |
211 | 211 | |
212 | 212 | // Add field auth_type to USERS table |
213 | 213 | $res = addColumnIfNotExist( |
214 | - $pre . 'users', |
|
214 | + $pre.'users', |
|
215 | 215 | 'auth_type', |
216 | 216 | "VARCHAR(200) NOT NULL DEFAULT 'local'" |
217 | 217 | ); |
218 | 218 | if ($res === false) { |
219 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field auth_type to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
219 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field auth_type to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
220 | 220 | mysqli_close($db_link); |
221 | 221 | exit(); |
222 | 222 | } |
223 | 223 | |
224 | 224 | // Add field encryption_type to SUGGESTION table |
225 | 225 | $res = addColumnIfNotExist( |
226 | - $pre . 'suggestion', |
|
226 | + $pre.'suggestion', |
|
227 | 227 | 'encryption_type', |
228 | 228 | "VARCHAR(20) NOT NULL DEFAULT 'not_set'" |
229 | 229 | ); |
230 | 230 | if ($res === false) { |
231 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field encryption_type to table SUGGESTION! ' . mysqli_error($db_link) . '!"}]'; |
|
231 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field encryption_type to table SUGGESTION! '.mysqli_error($db_link).'!"}]'; |
|
232 | 232 | mysqli_close($db_link); |
233 | 233 | exit(); |
234 | 234 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | // Add new table SHAREKEYS ITEMS |
237 | 237 | mysqli_query( |
238 | 238 | $db_link, |
239 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'sharekeys_items` ( |
|
239 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'sharekeys_items` ( |
|
240 | 240 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
241 | 241 | `object_id` int(12) NOT NULL, |
242 | 242 | `user_id` int(12) NOT NULL, |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | // Add new table SHAREKEYS LOGS |
249 | 249 | mysqli_query( |
250 | 250 | $db_link, |
251 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'sharekeys_logs` ( |
|
251 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'sharekeys_logs` ( |
|
252 | 252 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
253 | 253 | `object_id` int(12) NOT NULL, |
254 | 254 | `user_id` int(12) NOT NULL, |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | // Add new table SHAREKEYS FIELDS |
261 | 261 | mysqli_query( |
262 | 262 | $db_link, |
263 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'sharekeys_fields` ( |
|
263 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'sharekeys_fields` ( |
|
264 | 264 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
265 | 265 | `object_id` int(12) NOT NULL, |
266 | 266 | `user_id` int(12) NOT NULL, |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | // Add new table SHAREKEYS SUGGESTIONS |
273 | 273 | mysqli_query( |
274 | 274 | $db_link, |
275 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'sharekeys_suggestions` ( |
|
275 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'sharekeys_suggestions` ( |
|
276 | 276 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
277 | 277 | `object_id` int(12) NOT NULL, |
278 | 278 | `user_id` int(12) NOT NULL, |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | // Add new table SHAREKEYS FILES |
285 | 285 | mysqli_query( |
286 | 286 | $db_link, |
287 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'sharekeys_files` ( |
|
287 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'sharekeys_files` ( |
|
288 | 288 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
289 | 289 | `object_id` int(12) NOT NULL, |
290 | 290 | `user_id` int(12) NOT NULL, |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | // Add new table defuse_passwords |
297 | 297 | mysqli_query( |
298 | 298 | $db_link, |
299 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'defuse_passwords` ( |
|
299 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'defuse_passwords` ( |
|
300 | 300 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
301 | 301 | `type` varchar(100) NOT NULL, |
302 | 302 | `object_id` int(12) NOT NULL, |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | // Add new table Notifications |
309 | 309 | mysqli_query( |
310 | 310 | $db_link, |
311 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'notification` ( |
|
311 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'notification` ( |
|
312 | 312 | `increment_id` INT(12) NOT NULL AUTO_INCREMENT, |
313 | 313 | `item_id` INT(12) NOT NULL, |
314 | 314 | `user_id` INT(12) NOT NULL, |
@@ -319,42 +319,42 @@ discard block |
||
319 | 319 | // Alter table FILES |
320 | 320 | mysqli_query( |
321 | 321 | $db_link, |
322 | - 'ALTER TABLE `' . $pre . 'files` CHANGE `name` `name` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;' |
|
322 | + 'ALTER TABLE `'.$pre.'files` CHANGE `name` `name` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;' |
|
323 | 323 | ); |
324 | 324 | |
325 | 325 | // Alter table CACHE |
326 | 326 | mysqli_query( |
327 | 327 | $db_link, |
328 | - 'ALTER TABLE `' . $pre . 'cache` CHANGE `folder` `folder` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;' |
|
328 | + 'ALTER TABLE `'.$pre.'cache` CHANGE `folder` `folder` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;' |
|
329 | 329 | ); |
330 | 330 | |
331 | 331 | // Add field confirmed to FILES table |
332 | 332 | $res = addColumnIfNotExist( |
333 | - $pre . 'files', |
|
333 | + $pre.'files', |
|
334 | 334 | 'confirmed', |
335 | 335 | "INT(1) NOT NULL DEFAULT '0'" |
336 | 336 | ); |
337 | 337 | if ($res === false) { |
338 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field Confirmed to table FILES! ' . mysqli_error($db_link) . '!"}]'; |
|
338 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field Confirmed to table FILES! '.mysqli_error($db_link).'!"}]'; |
|
339 | 339 | mysqli_close($db_link); |
340 | 340 | exit(); |
341 | 341 | } else { |
342 | 342 | // Update all existing entries |
343 | 343 | mysqli_query( |
344 | 344 | $db_link, |
345 | - 'UPDATE ' . $pre . "files |
|
345 | + 'UPDATE '.$pre."files |
|
346 | 346 | SET confirmed = '1'" |
347 | 347 | ); |
348 | 348 | } |
349 | 349 | |
350 | 350 | // Add field encrypted to OTV table |
351 | 351 | $res = addColumnIfNotExist( |
352 | - $pre . 'otv', |
|
352 | + $pre.'otv', |
|
353 | 353 | 'encrypted', |
354 | 354 | "text NOT NULL" |
355 | 355 | ); |
356 | 356 | if ($res === false) { |
357 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field Encrypted to table OTV! ' . mysqli_error($db_link) . '!"}]'; |
|
357 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field Encrypted to table OTV! '.mysqli_error($db_link).'!"}]'; |
|
358 | 358 | mysqli_close($db_link); |
359 | 359 | exit(); |
360 | 360 | } |
@@ -363,89 +363,89 @@ discard block |
||
363 | 363 | // Force attachment encryption 'enable_attachment_encryption' |
364 | 364 | mysqli_query( |
365 | 365 | $db_link, |
366 | - 'UPDATE ' . $pre . "misc |
|
366 | + 'UPDATE '.$pre."misc |
|
367 | 367 | SET valeur = '1' |
368 | 368 | WHERE type = 'admin' AND intitule = 'enable_attachment_encryption'" |
369 | 369 | ); |
370 | 370 | |
371 | 371 | // Add new setting 'password_overview_delay' |
372 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'password_overview_delay'")); |
|
372 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'password_overview_delay'")); |
|
373 | 373 | if (intval($tmp) === 0) { |
374 | 374 | mysqli_query( |
375 | 375 | $db_link, |
376 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'password_overview_delay', '4')" |
|
376 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'password_overview_delay', '4')" |
|
377 | 377 | ); |
378 | 378 | } |
379 | 379 | |
380 | 380 | // Add new setting 'roles_allowed_to_print_select' |
381 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'roles_allowed_to_print_select'")); |
|
381 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'roles_allowed_to_print_select'")); |
|
382 | 382 | if (intval($tmp) === 0) { |
383 | 383 | mysqli_query( |
384 | 384 | $db_link, |
385 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'roles_allowed_to_print_select', '')" |
|
385 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'roles_allowed_to_print_select', '')" |
|
386 | 386 | ); |
387 | 387 | } |
388 | 388 | |
389 | 389 | // Add new setting 'clipboard_life_duration' |
390 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'clipboard_life_duration'")); |
|
390 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'clipboard_life_duration'")); |
|
391 | 391 | if (intval($tmp) === 0) { |
392 | 392 | mysqli_query( |
393 | 393 | $db_link, |
394 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'clipboard_life_duration', '30')" |
|
394 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'clipboard_life_duration', '30')" |
|
395 | 395 | ); |
396 | 396 | } |
397 | 397 | |
398 | 398 | // Add new setting 'mfa_for_roles' |
399 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'mfa_for_roles'")); |
|
399 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'mfa_for_roles'")); |
|
400 | 400 | if (intval($tmp) === 0) { |
401 | 401 | mysqli_query( |
402 | 402 | $db_link, |
403 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'mfa_for_roles', '')" |
|
403 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'mfa_for_roles', '')" |
|
404 | 404 | ); |
405 | 405 | } |
406 | 406 | |
407 | 407 | // Add new setting 'tree_counters' |
408 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'tree_counters'")); |
|
408 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'tree_counters'")); |
|
409 | 409 | if (intval($tmp) === 0) { |
410 | 410 | mysqli_query( |
411 | 411 | $db_link, |
412 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'tree_counters', '0')" |
|
412 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'tree_counters', '0')" |
|
413 | 413 | ); |
414 | 414 | } |
415 | 415 | |
416 | 416 | // Add new setting 'settings_offline_mode' |
417 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'settings_offline_mode'")); |
|
417 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'settings_offline_mode'")); |
|
418 | 418 | if (intval($tmp) === 0) { |
419 | 419 | mysqli_query( |
420 | 420 | $db_link, |
421 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'settings_offline_mode', '0')" |
|
421 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'settings_offline_mode', '0')" |
|
422 | 422 | ); |
423 | 423 | } |
424 | 424 | |
425 | 425 | // Add new setting 'settings_tree_counters' |
426 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'settings_tree_counters'")); |
|
426 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'settings_tree_counters'")); |
|
427 | 427 | if (intval($tmp) === 0) { |
428 | 428 | mysqli_query( |
429 | 429 | $db_link, |
430 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'settings_tree_counters', '0')" |
|
430 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'settings_tree_counters', '0')" |
|
431 | 431 | ); |
432 | 432 | } |
433 | 433 | |
434 | 434 | // Add new setting 'copy_to_clipboard_small_icons' |
435 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'copy_to_clipboard_small_icons'")); |
|
435 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'copy_to_clipboard_small_icons'")); |
|
436 | 436 | if (intval($tmp) === 0) { |
437 | 437 | mysqli_query( |
438 | 438 | $db_link, |
439 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'copy_to_clipboard_small_icons', '0')" |
|
439 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'copy_to_clipboard_small_icons', '0')" |
|
440 | 440 | ); |
441 | 441 | } |
442 | 442 | |
443 | 443 | // Add new setting 'enable_massive_move_delete' |
444 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'enable_massive_move_delete'")); |
|
444 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'enable_massive_move_delete'")); |
|
445 | 445 | if (intval($tmp) === 0) { |
446 | 446 | mysqli_query( |
447 | 447 | $db_link, |
448 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'enable_massive_move_delete', '0')" |
|
448 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'enable_massive_move_delete', '0')" |
|
449 | 449 | ); |
450 | 450 | } |
451 | 451 | |
@@ -453,14 +453,14 @@ discard block |
||
453 | 453 | $roles_allowed_to_print = mysqli_fetch_row(mysqli_query( |
454 | 454 | $db_link, |
455 | 455 | 'SELECT valeur |
456 | - FROM ' . $pre . 'misc |
|
456 | + FROM ' . $pre.'misc |
|
457 | 457 | WHERE type = "admin" AND intitule = "roles_allowed_to_print"' |
458 | 458 | )); |
459 | 459 | if ($roles_allowed_to_print[0] !== null && empty($roles_allowed_to_print[0]) === false) { |
460 | 460 | mysqli_query( |
461 | 461 | $db_link, |
462 | - 'UPDATE ' . $pre . "misc |
|
463 | - SET valeur = '" . json_encode(explode(';', $roles_allowed_to_print[0])) . "' |
|
462 | + 'UPDATE '.$pre."misc |
|
463 | + SET valeur = '" . json_encode(explode(';', $roles_allowed_to_print[0]))."' |
|
464 | 464 | WHERE type = 'admin' AND intitule = 'roles_allowed_to_print'" |
465 | 465 | ); |
466 | 466 | } |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $db_count = mysqli_fetch_row( |
470 | 470 | mysqli_query( |
471 | 471 | $db_link, |
472 | - 'SELECT count(*) FROM ' . $pre . 'defuse_passwords' |
|
472 | + 'SELECT count(*) FROM '.$pre.'defuse_passwords' |
|
473 | 473 | ) |
474 | 474 | ); |
475 | 475 | if ((int) $db_count[0] === 0) { |
@@ -477,19 +477,19 @@ discard block |
||
477 | 477 | $rows = mysqli_query( |
478 | 478 | $db_link, |
479 | 479 | 'SELECT id, pw, encryption_type |
480 | - FROM ' . $pre . 'items |
|
480 | + FROM ' . $pre.'items |
|
481 | 481 | WHERE perso = 0' |
482 | 482 | ); |
483 | 483 | if (!$rows) { |
484 | - echo '[{"finish":"1" , "error":"' . mysqli_error($db_link) . '"}]'; |
|
484 | + echo '[{"finish":"1" , "error":"'.mysqli_error($db_link).'"}]'; |
|
485 | 485 | exit(); |
486 | 486 | } |
487 | 487 | while ($data = mysqli_fetch_array($rows)) { |
488 | 488 | if ($data['encryption_type'] !== 'teampass_aes') { |
489 | 489 | mysqli_query( |
490 | 490 | $db_link, |
491 | - "INSERT INTO `" . $pre . "defuse_passwords` (`increment_id`, `type`, `object_id`, `password`) |
|
492 | - VALUES (NULL, 'item', '" . $data['id'] . "', '" . $data['pw'] . "');" |
|
491 | + "INSERT INTO `".$pre."defuse_passwords` (`increment_id`, `type`, `object_id`, `password`) |
|
492 | + VALUES (NULL, 'item', '" . $data['id']."', '".$data['pw']."');" |
|
493 | 493 | ); |
494 | 494 | } |
495 | 495 | } |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | $rows = mysqli_query( |
499 | 499 | $db_link, |
500 | 500 | 'SELECT id, data, encryption_type |
501 | - FROM ' . $pre . 'categories_items' |
|
501 | + FROM ' . $pre.'categories_items' |
|
502 | 502 | ); |
503 | 503 | if (!$rows) { |
504 | - echo '[{"finish":"1" , "error":"' . mysqli_error($db_link) . '"}]'; |
|
504 | + echo '[{"finish":"1" , "error":"'.mysqli_error($db_link).'"}]'; |
|
505 | 505 | exit(); |
506 | 506 | } |
507 | 507 | |
@@ -509,8 +509,8 @@ discard block |
||
509 | 509 | if ($data['encryption_type'] !== 'teampass_aes') { |
510 | 510 | mysqli_query( |
511 | 511 | $db_link, |
512 | - "INSERT INTO `" . $pre . "defuse_passwords` (`increment_id`, `type`, `object_id`, `password`) |
|
513 | - VALUES (NULL, 'field', '" . $data['id'] . "', '" . $data['data'] . "');" |
|
512 | + "INSERT INTO `".$pre."defuse_passwords` (`increment_id`, `type`, `object_id`, `password`) |
|
513 | + VALUES (NULL, 'field', '" . $data['id']."', '".$data['data']."');" |
|
514 | 514 | ); |
515 | 515 | } |
516 | 516 | } |
@@ -519,11 +519,11 @@ discard block |
||
519 | 519 | $rows = mysqli_query( |
520 | 520 | $db_link, |
521 | 521 | 'SELECT increment_id, raison, encryption_type |
522 | - FROM ' . $pre . "log_items |
|
522 | + FROM ' . $pre."log_items |
|
523 | 523 | WHERE raison LIKE 'at_pw :def%'" |
524 | 524 | ); |
525 | 525 | if (!$rows) { |
526 | - echo '[{"finish":"1" , "error":"' . mysqli_error($db_link) . '"}]'; |
|
526 | + echo '[{"finish":"1" , "error":"'.mysqli_error($db_link).'"}]'; |
|
527 | 527 | exit(); |
528 | 528 | } |
529 | 529 | |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | if ($data['encryption_type'] !== 'teampass_aes') { |
532 | 532 | mysqli_query( |
533 | 533 | $db_link, |
534 | - "INSERT INTO `" . $pre . "defuse_passwords` (`increment_id`, `type`, `object_id`, `password`) |
|
535 | - VALUES (NULL, 'log', '" . $data['increment_id'] . "', '" . explode('pw :', $data['raison'])[1] . "');" |
|
534 | + "INSERT INTO `".$pre."defuse_passwords` (`increment_id`, `type`, `object_id`, `password`) |
|
535 | + VALUES (NULL, 'log', '" . $data['increment_id']."', '".explode('pw :', $data['raison'])[1]."');" |
|
536 | 536 | ); |
537 | 537 | } |
538 | 538 | } |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | $rows = mysqli_query( |
542 | 542 | $db_link, |
543 | 543 | 'SELECT id, pw |
544 | - FROM ' . $pre . 'suggestion' |
|
544 | + FROM ' . $pre.'suggestion' |
|
545 | 545 | ); |
546 | 546 | if (!$rows) { |
547 | - echo '[{"finish":"1" , "error":"' . mysqli_error($db_link) . '"}]'; |
|
547 | + echo '[{"finish":"1" , "error":"'.mysqli_error($db_link).'"}]'; |
|
548 | 548 | exit(); |
549 | 549 | } |
550 | 550 | |
@@ -552,21 +552,21 @@ discard block |
||
552 | 552 | if ($data['encryption_type'] !== 'teampass_aes') { |
553 | 553 | mysqli_query( |
554 | 554 | $db_link, |
555 | - "INSERT INTO `" . $pre . "defuse_passwords` (`increment_id`, `type`, `object_id`, `password`) |
|
556 | - VALUES (NULL, 'suggestion', '" . $data['id'] . "', '" . $data['pw'] . "');" |
|
555 | + "INSERT INTO `".$pre."defuse_passwords` (`increment_id`, `type`, `object_id`, `password`) |
|
556 | + VALUES (NULL, 'suggestion', '" . $data['id']."', '".$data['pw']."');" |
|
557 | 557 | ); |
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | 561 | // Copy all files to "defuse' folder |
562 | - $mydir = $SETTINGS['path_to_upload_folder'] . '/'; |
|
563 | - if (!is_dir($mydir . 'defuse')) { |
|
564 | - mkdir($mydir . 'defuse'); |
|
562 | + $mydir = $SETTINGS['path_to_upload_folder'].'/'; |
|
563 | + if (!is_dir($mydir.'defuse')) { |
|
564 | + mkdir($mydir.'defuse'); |
|
565 | 565 | } |
566 | 566 | // Move all images files |
567 | - $files = glob($mydir . '*'); |
|
567 | + $files = glob($mydir.'*'); |
|
568 | 568 | foreach ($files as $file) { |
569 | - $file_to_go = str_replace($mydir, $mydir . 'defuse/', $file); |
|
569 | + $file_to_go = str_replace($mydir, $mydir.'defuse/', $file); |
|
570 | 570 | copy($file, $file_to_go); |
571 | 571 | } |
572 | 572 | } |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | mysqli_query( |
585 | 585 | $db_link, |
586 | 586 | 'SELECT id, public_key, private_key |
587 | - FROM ' . $pre . "users |
|
588 | - WHERE login='" . $userLogin . "'" |
|
587 | + FROM ' . $pre."users |
|
588 | + WHERE login='" . $userLogin."'" |
|
589 | 589 | ) |
590 | 590 | ); |
591 | 591 | if ( |
@@ -597,8 +597,8 @@ discard block |
||
597 | 597 | // Store in DB |
598 | 598 | mysqli_query( |
599 | 599 | $db_link, |
600 | - 'UPDATE ' . $pre . "users |
|
601 | - SET public_key = '" . $userKeys['public_key'] . "', private_key = '" . $userKeys['private_key'] . "' |
|
600 | + 'UPDATE '.$pre."users |
|
601 | + SET public_key = '" . $userKeys['public_key']."', private_key = '".$userKeys['private_key']."' |
|
602 | 602 | WHERE id = " . $user['id'] |
603 | 603 | ); |
604 | 604 | |
@@ -621,69 +621,69 @@ discard block |
||
621 | 621 | |
622 | 622 | //---> 3.0.0.11 |
623 | 623 | $res = addColumnIfNotExist( |
624 | - $pre . 'nested_tree', |
|
624 | + $pre.'nested_tree', |
|
625 | 625 | 'fa_icon', |
626 | 626 | "VARCHAR(100) NOT NULL DEFAULT 'fas fa-folder'" |
627 | 627 | ); |
628 | 628 | if ($res === false) { |
629 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field fa_icon to table NESTED_TREE! ' . mysqli_error($db_link) . '!"}]'; |
|
629 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field fa_icon to table NESTED_TREE! '.mysqli_error($db_link).'!"}]'; |
|
630 | 630 | mysqli_close($db_link); |
631 | 631 | exit(); |
632 | 632 | } |
633 | 633 | |
634 | 634 | $res = addColumnIfNotExist( |
635 | - $pre . 'nested_tree', |
|
635 | + $pre.'nested_tree', |
|
636 | 636 | 'fa_icon_selected', |
637 | 637 | "VARCHAR(100) NOT NULL DEFAULT 'fas fa-folder-open'" |
638 | 638 | ); |
639 | 639 | if ($res === false) { |
640 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field fa_icon_selected to table NESTED_TREE! ' . mysqli_error($db_link) . '!"}]'; |
|
640 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field fa_icon_selected to table NESTED_TREE! '.mysqli_error($db_link).'!"}]'; |
|
641 | 641 | mysqli_close($db_link); |
642 | 642 | exit(); |
643 | 643 | } |
644 | 644 | |
645 | 645 | $res = addColumnIfNotExist( |
646 | - $pre . 'items', |
|
646 | + $pre.'items', |
|
647 | 647 | 'fa_icon', |
648 | 648 | "VARCHAR(100) DEFAULT NULL" |
649 | 649 | ); |
650 | 650 | if ($res === false) { |
651 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field fa_icon to table ITEMS! ' . mysqli_error($db_link) . '!"}]'; |
|
651 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field fa_icon to table ITEMS! '.mysqli_error($db_link).'!"}]'; |
|
652 | 652 | mysqli_close($db_link); |
653 | 653 | exit(); |
654 | 654 | } |
655 | 655 | |
656 | 656 | // Add new setting 'email_debug_level' |
657 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'email_debug_level'")); |
|
657 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'email_debug_level'")); |
|
658 | 658 | if (intval($tmp) === 0) { |
659 | 659 | mysqli_query( |
660 | 660 | $db_link, |
661 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'email_debug_level', '0')" |
|
661 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'email_debug_level', '0')" |
|
662 | 662 | ); |
663 | 663 | } |
664 | 664 | //---< |
665 | 665 | |
666 | 666 | |
667 | 667 | //---> 3.0.0.13 |
668 | -mysqli_query($db_link, "UPDATE `" . $pre . "nested_tree` SET `fa_icon` = 'fas fa-folder' WHERE fa_icon = 'fa-folder'"); |
|
669 | -mysqli_query($db_link, "UPDATE `" . $pre . "nested_tree` SET `fa_icon_selected` = 'fas fa-folder-open' WHERE fa_icon_selected = 'fa-folder-open'"); |
|
668 | +mysqli_query($db_link, "UPDATE `".$pre."nested_tree` SET `fa_icon` = 'fas fa-folder' WHERE fa_icon = 'fa-folder'"); |
|
669 | +mysqli_query($db_link, "UPDATE `".$pre."nested_tree` SET `fa_icon_selected` = 'fas fa-folder-open' WHERE fa_icon_selected = 'fa-folder-open'"); |
|
670 | 670 | |
671 | 671 | // Alter table nested_tree |
672 | 672 | mysqli_query( |
673 | 673 | $db_link, |
674 | - "ALTER TABLE `" . $pre . "nested_tree` CHANGE `fa_icon` `fa_icon` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'fas fa-folder';" |
|
674 | + "ALTER TABLE `".$pre."nested_tree` CHANGE `fa_icon` `fa_icon` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'fas fa-folder';" |
|
675 | 675 | ); |
676 | 676 | mysqli_query( |
677 | 677 | $db_link, |
678 | - "ALTER TABLE `" . $pre . "nested_tree` CHANGE `fa_icon_selected` `fa_icon_selected` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'fas fa-folder-open';" |
|
678 | + "ALTER TABLE `".$pre."nested_tree` CHANGE `fa_icon_selected` `fa_icon_selected` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'fas fa-folder-open';" |
|
679 | 679 | ); |
680 | 680 | //---< |
681 | 681 | |
682 | 682 | |
683 | 683 | //---> 3.0.0.14 |
684 | -mysqli_query($db_link, "UPDATE `" . $pre . "misc` SET `intitule` = 'ldap_user_dn_attribute' WHERE intitule = 'settings_ldap_user_dn_attribute'"); |
|
685 | -mysqli_query($db_link, "DELETE FROM `" . $pre . "misc` WHERE `intitule` = 'ldap-test-config-username' AND type = 'admin'"); |
|
686 | -mysqli_query($db_link, "DELETE FROM `" . $pre . "misc` WHERE `intitule` = 'ldap-test-config-pwd' AND type = 'admin'"); |
|
684 | +mysqli_query($db_link, "UPDATE `".$pre."misc` SET `intitule` = 'ldap_user_dn_attribute' WHERE intitule = 'settings_ldap_user_dn_attribute'"); |
|
685 | +mysqli_query($db_link, "DELETE FROM `".$pre."misc` WHERE `intitule` = 'ldap-test-config-username' AND type = 'admin'"); |
|
686 | +mysqli_query($db_link, "DELETE FROM `".$pre."misc` WHERE `intitule` = 'ldap-test-config-pwd' AND type = 'admin'"); |
|
687 | 687 | |
688 | 688 | // Manage folder complexity values |
689 | 689 | $rows = mysqli_query( |
@@ -770,94 +770,94 @@ discard block |
||
770 | 770 | //---< |
771 | 771 | |
772 | 772 | //---> 3.0.0.17 |
773 | -mysqli_query($db_link, "UPDATE `" . $pre . "misc` SET `valeur` = '0' WHERE intitule = 'enable_server_password_change'"); |
|
773 | +mysqli_query($db_link, "UPDATE `".$pre."misc` SET `valeur` = '0' WHERE intitule = 'enable_server_password_change'"); |
|
774 | 774 | |
775 | 775 | // Add new setting 'ga_reset_by_user' |
776 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ga_reset_by_user'")); |
|
776 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ga_reset_by_user'")); |
|
777 | 777 | if (intval($tmp) === 0) { |
778 | 778 | mysqli_query( |
779 | 779 | $db_link, |
780 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ga_reset_by_user', '')" |
|
780 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ga_reset_by_user', '')" |
|
781 | 781 | ); |
782 | 782 | } |
783 | 783 | // Add new setting 'onthefly-backup-key' |
784 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'onthefly-backup-key'")); |
|
784 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'onthefly-backup-key'")); |
|
785 | 785 | if (intval($tmp) === 0) { |
786 | 786 | mysqli_query( |
787 | 787 | $db_link, |
788 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'onthefly-backup-key', '')" |
|
788 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'onthefly-backup-key', '')" |
|
789 | 789 | ); |
790 | 790 | } |
791 | 791 | // Add new setting 'onthefly-restore-key' |
792 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'onthefly-restore-key'")); |
|
792 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'onthefly-restore-key'")); |
|
793 | 793 | if (intval($tmp) === 0) { |
794 | 794 | mysqli_query( |
795 | 795 | $db_link, |
796 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'onthefly-restore-key', '')" |
|
796 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'onthefly-restore-key', '')" |
|
797 | 797 | ); |
798 | 798 | } |
799 | 799 | // Add new setting 'ldap_user_dn_attribute' |
800 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ldap_user_dn_attribute'")); |
|
800 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ldap_user_dn_attribute'")); |
|
801 | 801 | if (intval($tmp) === 0) { |
802 | 802 | mysqli_query( |
803 | 803 | $db_link, |
804 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_user_dn_attribute', '')" |
|
804 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_user_dn_attribute', '')" |
|
805 | 805 | ); |
806 | 806 | } |
807 | 807 | // Add new setting 'ldap_dn_additional_user_dn' |
808 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ldap_dn_additional_user_dn'")); |
|
808 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ldap_dn_additional_user_dn'")); |
|
809 | 809 | if (intval($tmp) === 0) { |
810 | 810 | mysqli_query( |
811 | 811 | $db_link, |
812 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_dn_additional_user_dn', '')" |
|
812 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_dn_additional_user_dn', '')" |
|
813 | 813 | ); |
814 | 814 | } |
815 | 815 | // Add new setting 'ldap_user_object_filter' |
816 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ldap_user_object_filter'")); |
|
816 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ldap_user_object_filter'")); |
|
817 | 817 | if (intval($tmp) === 0) { |
818 | 818 | mysqli_query( |
819 | 819 | $db_link, |
820 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_user_object_filter', '')" |
|
820 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_user_object_filter', '')" |
|
821 | 821 | ); |
822 | 822 | } |
823 | 823 | // Add new setting 'ldap_bdn' |
824 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ldap_bdn'")); |
|
824 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ldap_bdn'")); |
|
825 | 825 | if (intval($tmp) === 0) { |
826 | 826 | mysqli_query( |
827 | 827 | $db_link, |
828 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_bdn', '')" |
|
828 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_bdn', '')" |
|
829 | 829 | ); |
830 | 830 | } |
831 | 831 | // Add new setting 'ldap_hosts' |
832 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ldap_hosts'")); |
|
832 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ldap_hosts'")); |
|
833 | 833 | if (intval($tmp) === 0) { |
834 | 834 | mysqli_query( |
835 | 835 | $db_link, |
836 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_hosts', '')" |
|
836 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_hosts', '')" |
|
837 | 837 | ); |
838 | 838 | } |
839 | 839 | // Add new setting 'ldap_password' |
840 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ldap_password'")); |
|
840 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ldap_password'")); |
|
841 | 841 | if (intval($tmp) === 0) { |
842 | 842 | mysqli_query( |
843 | 843 | $db_link, |
844 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_password', '')" |
|
844 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_password', '')" |
|
845 | 845 | ); |
846 | 846 | } |
847 | 847 | // Add new setting 'ldap_username' |
848 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ldap_username'")); |
|
848 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ldap_username'")); |
|
849 | 849 | if (intval($tmp) === 0) { |
850 | 850 | mysqli_query( |
851 | 851 | $db_link, |
852 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_username', '')" |
|
852 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_username', '')" |
|
853 | 853 | ); |
854 | 854 | } |
855 | 855 | // Add new setting 'api_token_duration' |
856 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'api_token_duration'")); |
|
856 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'api_token_duration'")); |
|
857 | 857 | if (intval($tmp) === 0) { |
858 | 858 | mysqli_query( |
859 | 859 | $db_link, |
860 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'api_token_duration', '60')" |
|
860 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'api_token_duration', '60')" |
|
861 | 861 | ); |
862 | 862 | } |
863 | 863 | |
@@ -866,18 +866,18 @@ discard block |
||
866 | 866 | |
867 | 867 | //---> 3.0.0.18 |
868 | 868 | // Add new value 'last_folder_change' in table misc |
869 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'timestamp' AND intitule = 'last_folder_change'")); |
|
869 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'timestamp' AND intitule = 'last_folder_change'")); |
|
870 | 870 | if (intval($tmp) === 0) { |
871 | 871 | mysqli_query( |
872 | 872 | $db_link, |
873 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('timestamp', 'last_folder_change', '')" |
|
873 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('timestamp', 'last_folder_change', '')" |
|
874 | 874 | ); |
875 | 875 | } |
876 | 876 | |
877 | 877 | // Add new table CACHE_TREE |
878 | 878 | mysqli_query( |
879 | 879 | $db_link, |
880 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'cache_tree` ( |
|
880 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'cache_tree` ( |
|
881 | 881 | `increment_id` smallint(32) NOT NULL AUTO_INCREMENT, |
882 | 882 | `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`data`)), |
883 | 883 | `visible_folders` longtext NOT NULL, |
@@ -889,24 +889,24 @@ discard block |
||
889 | 889 | |
890 | 890 | // Add the Primary INDEX CACHE to the cache_tree table |
891 | 891 | $res = checkIndexExist( |
892 | - $pre . 'cache_tree', |
|
892 | + $pre.'cache_tree', |
|
893 | 893 | 'CACHE', |
894 | 894 | "ADD KEY `CACHE` (`increment_id`, `user_id`)" |
895 | 895 | ); |
896 | 896 | if (!$res) { |
897 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX CACHE to the cache_tree table! ' . addslashes(mysqli_error($db_link)) . '!"}]'; |
|
897 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX CACHE to the cache_tree table! '.addslashes(mysqli_error($db_link)).'!"}]'; |
|
898 | 898 | mysqli_close($db_link); |
899 | 899 | exit(); |
900 | 900 | } |
901 | 901 | |
902 | 902 | mysqli_query( |
903 | 903 | $db_link, |
904 | - 'ALTER TABLE `' . $pre . 'cache_tree` MODIFY `increment_id` smallint(32) NOT NULL AUTO_INCREMENT' |
|
904 | + 'ALTER TABLE `'.$pre.'cache_tree` MODIFY `increment_id` smallint(32) NOT NULL AUTO_INCREMENT' |
|
905 | 905 | ); |
906 | 906 | |
907 | 907 | // Add field status to CACHE_TREE table |
908 | 908 | $res = addColumnIfNotExist( |
909 | - $pre . 'cache_tree', |
|
909 | + $pre.'cache_tree', |
|
910 | 910 | 'visible_folders', |
911 | 911 | "longtext NOT NULL" |
912 | 912 | ); |
@@ -914,85 +914,85 @@ discard block |
||
914 | 914 | |
915 | 915 | // Add field status to FILES table |
916 | 916 | $res = addColumnIfNotExist( |
917 | - $pre . 'files', |
|
917 | + $pre.'files', |
|
918 | 918 | 'status', |
919 | 919 | "varchar(50) NOT NULL DEFAULT '0'" |
920 | 920 | ); |
921 | 921 | if ($res === false) { |
922 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field status to table FILES! ' . mysqli_error($db_link) . '!"}]'; |
|
922 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field status to table FILES! '.mysqli_error($db_link).'!"}]'; |
|
923 | 923 | mysqli_close($db_link); |
924 | 924 | exit(); |
925 | 925 | } |
926 | 926 | |
927 | 927 | // Add field content to FILES table |
928 | 928 | $res = addColumnIfNotExist( |
929 | - $pre . 'files', |
|
929 | + $pre.'files', |
|
930 | 930 | 'content', |
931 | 931 | "longblob DEFAULT NULL;" |
932 | 932 | ); |
933 | 933 | if ($res === false) { |
934 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field content to table FILES! ' . mysqli_error($db_link) . '!"}]'; |
|
934 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field content to table FILES! '.mysqli_error($db_link).'!"}]'; |
|
935 | 935 | mysqli_close($db_link); |
936 | 936 | exit(); |
937 | 937 | } |
938 | 938 | |
939 | 939 | // Add new setting 'enable_tasks_manager' |
940 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'enable_tasks_manager'")); |
|
940 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'enable_tasks_manager'")); |
|
941 | 941 | if (intval($tmp) === 0) { |
942 | 942 | mysqli_query( |
943 | 943 | $db_link, |
944 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'enable_tasks_manager', '0')" |
|
944 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'enable_tasks_manager', '0')" |
|
945 | 945 | ); |
946 | 946 | } |
947 | 947 | |
948 | 948 | // Add new setting 'task_maximum_run_time' |
949 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'task_maximum_run_time'")); |
|
949 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'task_maximum_run_time'")); |
|
950 | 950 | if (intval($tmp) === 0) { |
951 | 951 | mysqli_query( |
952 | 952 | $db_link, |
953 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'task_maximum_run_time', '300')" |
|
953 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'task_maximum_run_time', '300')" |
|
954 | 954 | ); |
955 | 955 | } |
956 | 956 | |
957 | 957 | // Add new setting 'maximum_number_of_items_to_treat' |
958 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'maximum_number_of_items_to_treat'")); |
|
958 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'maximum_number_of_items_to_treat'")); |
|
959 | 959 | if (intval($tmp) === 0) { |
960 | 960 | mysqli_query( |
961 | 961 | $db_link, |
962 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'maximum_number_of_items_to_treat', '300')" |
|
962 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'maximum_number_of_items_to_treat', '300')" |
|
963 | 963 | ); |
964 | 964 | } |
965 | 965 | |
966 | 966 | // Add new setting 'tasks_manager_refreshing_period' |
967 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'tasks_manager_refreshing_period'")); |
|
967 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'tasks_manager_refreshing_period'")); |
|
968 | 968 | if (intval($tmp) === 0) { |
969 | 969 | mysqli_query( |
970 | 970 | $db_link, |
971 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'tasks_manager_refreshing_period', '".NUMBER_ITEMS_IN_BATCH."')" |
|
971 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'tasks_manager_refreshing_period', '".NUMBER_ITEMS_IN_BATCH."')" |
|
972 | 972 | ); |
973 | 973 | } |
974 | 974 | |
975 | 975 | // Add field is_ready_for_usage to USERS table |
976 | 976 | $res = addColumnIfNotExist( |
977 | - $pre . 'users', |
|
977 | + $pre.'users', |
|
978 | 978 | 'is_ready_for_usage', |
979 | 979 | "BOOLEAN NOT NULL DEFAULT FALSE;" |
980 | 980 | ); |
981 | 981 | if ($res === false) { |
982 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field is_ready_for_usage to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
982 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field is_ready_for_usage to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
983 | 983 | mysqli_close($db_link); |
984 | 984 | exit(); |
985 | 985 | } |
986 | 986 | |
987 | 987 | mysqli_query( |
988 | 988 | $db_link, |
989 | - 'UPDATE `' . $pre . 'users` SET is_ready_for_usage = 1 WHERE is_ready_for_usage = 0;' |
|
989 | + 'UPDATE `'.$pre.'users` SET is_ready_for_usage = 1 WHERE is_ready_for_usage = 0;' |
|
990 | 990 | ); |
991 | 991 | |
992 | 992 | // Add new table PROCESSES_TASKS |
993 | 993 | mysqli_query( |
994 | 994 | $db_link, |
995 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'processes_tasks` ( |
|
995 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'processes_tasks` ( |
|
996 | 996 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
997 | 997 | `process_id` int(12) NOT NULL, |
998 | 998 | `created_at` varchar(50) NOT NULL, |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | // Add new table PROCESSES |
1010 | 1010 | mysqli_query( |
1011 | 1011 | $db_link, |
1012 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'processes` ( |
|
1012 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'processes` ( |
|
1013 | 1013 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1014 | 1014 | `created_at` varchar(50) NOT NULL, |
1015 | 1015 | `updated_at` varchar(50) DEFAULT NULL, |
@@ -1025,43 +1025,43 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | // Add field masked to CATEGORIES table |
1027 | 1027 | $res = addColumnIfNotExist( |
1028 | - $pre . 'categories', |
|
1028 | + $pre.'categories', |
|
1029 | 1029 | 'masked', |
1030 | 1030 | "tinyint(1) NOT NULL default '0';" |
1031 | 1031 | ); |
1032 | 1032 | if ($res === false) { |
1033 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field masked to table CATEGORIES! ' . mysqli_error($db_link) . '!"}]'; |
|
1033 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field masked to table CATEGORIES! '.mysqli_error($db_link).'!"}]'; |
|
1034 | 1034 | mysqli_close($db_link); |
1035 | 1035 | exit(); |
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | // Add field role_visibility to CATEGORIES table |
1039 | 1039 | $res = addColumnIfNotExist( |
1040 | - $pre . 'categories', |
|
1040 | + $pre.'categories', |
|
1041 | 1041 | 'role_visibility', |
1042 | 1042 | "varchar(255) NOT NULL DEFAULT 'all';" |
1043 | 1043 | ); |
1044 | 1044 | if ($res === false) { |
1045 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field role_visibility to table CATEGORIES! ' . mysqli_error($db_link) . '!"}]'; |
|
1045 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field role_visibility to table CATEGORIES! '.mysqli_error($db_link).'!"}]'; |
|
1046 | 1046 | mysqli_close($db_link); |
1047 | 1047 | exit(); |
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | // Add field is_mandatory to CATEGORIES table |
1051 | 1051 | $res = addColumnIfNotExist( |
1052 | - $pre . 'categories', |
|
1052 | + $pre.'categories', |
|
1053 | 1053 | 'is_mandatory', |
1054 | 1054 | "tinyint(1) NOT NULL default '0';" |
1055 | 1055 | ); |
1056 | 1056 | if ($res === false) { |
1057 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field is_mandatory to table CATEGORIES! ' . mysqli_error($db_link) . '!"}]'; |
|
1057 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field is_mandatory to table CATEGORIES! '.mysqli_error($db_link).'!"}]'; |
|
1058 | 1058 | mysqli_close($db_link); |
1059 | 1059 | exit(); |
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | // Add field categories to NESTED_TREE table |
1063 | 1063 | $res = addColumnIfNotExist( |
1064 | - $pre . 'nested_tree', |
|
1064 | + $pre.'nested_tree', |
|
1065 | 1065 | 'categories', |
1066 | 1066 | "longtext NOT NULL" |
1067 | 1067 | ); |
@@ -1069,36 +1069,36 @@ discard block |
||
1069 | 1069 | // Alter field subject in EMAILS table |
1070 | 1070 | mysqli_query( |
1071 | 1071 | $db_link, |
1072 | - 'ALTER TABLE `' . $pre . 'emails` MODIFY `subject` text NOT NULL' |
|
1072 | + 'ALTER TABLE `'.$pre.'emails` MODIFY `subject` text NOT NULL' |
|
1073 | 1073 | ); |
1074 | 1074 | |
1075 | 1075 | // Alter field receivers in EMAILS table |
1076 | 1076 | mysqli_query( |
1077 | 1077 | $db_link, |
1078 | - 'ALTER TABLE `' . $pre . 'emails` MODIFY `receivers` text NOT NULL' |
|
1078 | + 'ALTER TABLE `'.$pre.'emails` MODIFY `receivers` text NOT NULL' |
|
1079 | 1079 | ); |
1080 | 1080 | |
1081 | 1081 | // Add the Primary INDEX item_id to the automatic_del table |
1082 | 1082 | $res = checkIndexExist( |
1083 | - $pre . 'automatic_del', |
|
1083 | + $pre.'automatic_del', |
|
1084 | 1084 | 'PRIMARY', |
1085 | 1085 | "ADD PRIMARY KEY (`item_id`)" |
1086 | 1086 | ); |
1087 | 1087 | if (!$res) { |
1088 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX item_id to the automatic_del table! ' . mysqli_error($db_link) . '!"}]'; |
|
1088 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX item_id to the automatic_del table! '.mysqli_error($db_link).'!"}]'; |
|
1089 | 1089 | mysqli_close($db_link); |
1090 | 1090 | exit(); |
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | // Add column increment_id to cache table |
1094 | 1094 | $res = addColumnIfNotExist( |
1095 | - $pre . 'cache', |
|
1095 | + $pre.'cache', |
|
1096 | 1096 | 'increment_id', |
1097 | 1097 | "INT(12) NOT NULL AUTO_INCREMENT FIRST, |
1098 | 1098 | ADD PRIMARY KEY (increment_id)" |
1099 | 1099 | ); |
1100 | 1100 | if ($res === false) { |
1101 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table cache! ' . mysqli_error($db_link) . '!"}]'; |
|
1101 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table cache! '.mysqli_error($db_link).'!"}]'; |
|
1102 | 1102 | mysqli_close($db_link); |
1103 | 1103 | exit(); |
1104 | 1104 | } |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | // Alter table cache |
1107 | 1107 | mysqli_query( |
1108 | 1108 | $db_link, |
1109 | - "ALTER TABLE `" . $pre . "cache` |
|
1109 | + "ALTER TABLE `".$pre."cache` |
|
1110 | 1110 | MODIFY COLUMN `id` INT(12) NOT NULL, |
1111 | 1111 | MODIFY COLUMN `label` VARCHAR(500) NOT NULL, |
1112 | 1112 | MODIFY COLUMN `tags` text DEFAULT NULL, |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | // Alter table categories |
1121 | 1121 | mysqli_query( |
1122 | 1122 | $db_link, |
1123 | - "ALTER TABLE `" . $pre . "categories` |
|
1123 | + "ALTER TABLE `".$pre."categories` |
|
1124 | 1124 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1125 | 1125 | MODIFY COLUMN `parent_id` INT(12) NOT NULL, |
1126 | 1126 | MODIFY COLUMN `level` INT(2) NOT NULL, |
@@ -1130,13 +1130,13 @@ discard block |
||
1130 | 1130 | |
1131 | 1131 | // Add column increment_id to categories_folders table |
1132 | 1132 | $res = addColumnIfNotExist( |
1133 | - $pre . 'categories_folders', |
|
1133 | + $pre.'categories_folders', |
|
1134 | 1134 | 'increment_id', |
1135 | 1135 | "INT(12) NOT NULL AUTO_INCREMENT FIRST, |
1136 | 1136 | ADD PRIMARY KEY (increment_id)" |
1137 | 1137 | ); |
1138 | 1138 | if ($res === false) { |
1139 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table categories_folders! ' . mysqli_error($db_link) . '!"}]'; |
|
1139 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table categories_folders! '.mysqli_error($db_link).'!"}]'; |
|
1140 | 1140 | mysqli_close($db_link); |
1141 | 1141 | exit(); |
1142 | 1142 | } |
@@ -1144,19 +1144,19 @@ discard block |
||
1144 | 1144 | // Alter table categories_folders |
1145 | 1145 | mysqli_query( |
1146 | 1146 | $db_link, |
1147 | - "ALTER TABLE `" . $pre . "categories_folders` |
|
1147 | + "ALTER TABLE `".$pre."categories_folders` |
|
1148 | 1148 | MODIFY COLUMN `id_category` INT(12) NOT NULL, |
1149 | 1149 | MODIFY COLUMN `id_folder` INT(12) NOT NULL;" |
1150 | 1150 | ); |
1151 | 1151 | |
1152 | 1152 | // Add column is_mandatory to categories_items table |
1153 | 1153 | $res = addColumnIfNotExist( |
1154 | - $pre . 'categories_items', |
|
1154 | + $pre.'categories_items', |
|
1155 | 1155 | 'is_mandatory', |
1156 | 1156 | "TINYINT(1) NOT NULL DEFAULT 0 AFTER `encryption_type`" |
1157 | 1157 | ); |
1158 | 1158 | if ($res === false) { |
1159 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table categories_items! ' . mysqli_error($db_link) . '!"}]'; |
|
1159 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table categories_items! '.mysqli_error($db_link).'!"}]'; |
|
1160 | 1160 | mysqli_close($db_link); |
1161 | 1161 | exit(); |
1162 | 1162 | } |
@@ -1164,19 +1164,19 @@ discard block |
||
1164 | 1164 | // Alter table categories_items |
1165 | 1165 | mysqli_query( |
1166 | 1166 | $db_link, |
1167 | - "ALTER TABLE `" . $pre . "categories_items` |
|
1167 | + "ALTER TABLE `".$pre."categories_items` |
|
1168 | 1168 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT;" |
1169 | 1169 | ); |
1170 | 1170 | |
1171 | 1171 | // Add column increment_id to emails table |
1172 | 1172 | $res = addColumnIfNotExist( |
1173 | - $pre . 'emails', |
|
1173 | + $pre.'emails', |
|
1174 | 1174 | 'increment_id', |
1175 | 1175 | "INT(12) NOT NULL AUTO_INCREMENT FIRST, |
1176 | 1176 | ADD PRIMARY KEY (increment_id)" |
1177 | 1177 | ); |
1178 | 1178 | if ($res === false) { |
1179 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table emails! ' . mysqli_error($db_link) . '!"}]'; |
|
1179 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table emails! '.mysqli_error($db_link).'!"}]'; |
|
1180 | 1180 | mysqli_close($db_link); |
1181 | 1181 | exit(); |
1182 | 1182 | } |
@@ -1184,26 +1184,26 @@ discard block |
||
1184 | 1184 | // Alter table emails |
1185 | 1185 | mysqli_query( |
1186 | 1186 | $db_link, |
1187 | - "ALTER TABLE `" . $pre . "emails` |
|
1187 | + "ALTER TABLE `".$pre."emails` |
|
1188 | 1188 | MODIFY COLUMN `timestamp` INT(30) NOT NULL;" |
1189 | 1189 | ); |
1190 | 1190 | |
1191 | 1191 | // Add column increment_id to export table |
1192 | 1192 | $res = addColumnIfNotExist( |
1193 | - $pre . 'export', |
|
1193 | + $pre.'export', |
|
1194 | 1194 | 'increment_id', |
1195 | 1195 | "INT(12) NOT NULL AUTO_INCREMENT FIRST, |
1196 | 1196 | ADD PRIMARY KEY (increment_id)" |
1197 | 1197 | ); |
1198 | 1198 | if ($res === false) { |
1199 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table export! ' . mysqli_error($db_link) . '!"}]'; |
|
1199 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table export! '.mysqli_error($db_link).'!"}]'; |
|
1200 | 1200 | mysqli_close($db_link); |
1201 | 1201 | exit(); |
1202 | 1202 | } |
1203 | 1203 | // Alter table export |
1204 | 1204 | mysqli_query( |
1205 | 1205 | $db_link, |
1206 | - "ALTER TABLE `" . $pre . "export` |
|
1206 | + "ALTER TABLE `".$pre."export` |
|
1207 | 1207 | MODIFY COLUMN `label` VARCHAR(500) NOT NULL, |
1208 | 1208 | MODIFY COLUMN `path` VARCHAR(500) NOT NULL;" |
1209 | 1209 | ); |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | // Alter table files |
1212 | 1212 | mysqli_query( |
1213 | 1213 | $db_link, |
1214 | - "ALTER TABLE `" . $pre . "files` |
|
1214 | + "ALTER TABLE `".$pre."files` |
|
1215 | 1215 | MODIFY COLUMN `size` INT(10) NOT NULL, |
1216 | 1216 | MODIFY COLUMN `type` VARCHAR(255) NOT NULL, |
1217 | 1217 | MODIFY COLUMN `content` longblob DEFAULT NULL AFTER `status`;" |
@@ -1220,13 +1220,13 @@ discard block |
||
1220 | 1220 | // Alter table items |
1221 | 1221 | mysqli_query( |
1222 | 1222 | $db_link, |
1223 | - "UPDATE `" . $pre . "items` SET `auto_update_pwd_next_date` = '0' WHERE `auto_update_pwd_next_date` IS NULL;" |
|
1223 | + "UPDATE `".$pre."items` SET `auto_update_pwd_next_date` = '0' WHERE `auto_update_pwd_next_date` IS NULL;" |
|
1224 | 1224 | ); |
1225 | 1225 | |
1226 | 1226 | // Alter table items |
1227 | 1227 | mysqli_query( |
1228 | 1228 | $db_link, |
1229 | - "ALTER TABLE `" . $pre . "items` |
|
1229 | + "ALTER TABLE `".$pre."items` |
|
1230 | 1230 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1231 | 1231 | MODIFY COLUMN `label` VARCHAR(500) NOT NULL, |
1232 | 1232 | MODIFY COLUMN `pw_len` INT(5) NOT NULL DEFAULT 0, |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | // Alter table items_change |
1242 | 1242 | mysqli_query( |
1243 | 1243 | $db_link, |
1244 | - "ALTER TABLE `" . $pre . "items_change` |
|
1244 | + "ALTER TABLE `".$pre."items_change` |
|
1245 | 1245 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1246 | 1246 | MODIFY COLUMN `item_id` INT(12) NOT NULL, |
1247 | 1247 | MODIFY COLUMN `folder_id` tinyint(12) NOT NULL, |
@@ -1250,25 +1250,25 @@ discard block |
||
1250 | 1250 | |
1251 | 1251 | // Add column increment_id to items_edition table |
1252 | 1252 | $res = addColumnIfNotExist( |
1253 | - $pre . 'items_edition', |
|
1253 | + $pre.'items_edition', |
|
1254 | 1254 | 'increment_id', |
1255 | 1255 | "INT(12) NOT NULL AUTO_INCREMENT FIRST, |
1256 | 1256 | ADD PRIMARY KEY (increment_id)" |
1257 | 1257 | ); |
1258 | 1258 | if ($res === false) { |
1259 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table items_edition! ' . mysqli_error($db_link) . '!"}]'; |
|
1259 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table items_edition! '.mysqli_error($db_link).'!"}]'; |
|
1260 | 1260 | mysqli_close($db_link); |
1261 | 1261 | exit(); |
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | // Add the INDEX item_id_idx to the items_edition table |
1265 | 1265 | $res = checkIndexExist( |
1266 | - $pre . 'items_edition', |
|
1266 | + $pre.'items_edition', |
|
1267 | 1267 | 'item_id_idx', |
1268 | 1268 | "ADD KEY `item_id_idx` (`item_id`)" |
1269 | 1269 | ); |
1270 | 1270 | if (!$res) { |
1271 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX role_id_idx to the items_edition table! ' . mysqli_error($db_link) . '!"}]'; |
|
1271 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX role_id_idx to the items_edition table! '.mysqli_error($db_link).'!"}]'; |
|
1272 | 1272 | mysqli_close($db_link); |
1273 | 1273 | exit(); |
1274 | 1274 | } |
@@ -1276,14 +1276,14 @@ discard block |
||
1276 | 1276 | // Alter table items_edition |
1277 | 1277 | mysqli_query( |
1278 | 1278 | $db_link, |
1279 | - "ALTER TABLE `" . $pre . "items_edition` |
|
1279 | + "ALTER TABLE `".$pre."items_edition` |
|
1280 | 1280 | MODIFY COLUMN `user_id` INT(12) NOT NULL;" |
1281 | 1281 | ); |
1282 | 1282 | |
1283 | 1283 | // Alter table kb |
1284 | 1284 | mysqli_query( |
1285 | 1285 | $db_link, |
1286 | - "ALTER TABLE `" . $pre . "kb` |
|
1286 | + "ALTER TABLE `".$pre."kb` |
|
1287 | 1287 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1288 | 1288 | MODIFY COLUMN `category_id` INT(12) NOT NULL, |
1289 | 1289 | MODIFY COLUMN `author_id` INT(12) NOT NULL;" |
@@ -1292,18 +1292,18 @@ discard block |
||
1292 | 1292 | // Alter table kb_categories |
1293 | 1293 | mysqli_query( |
1294 | 1294 | $db_link, |
1295 | - "ALTER TABLE `" . $pre . "kb_categories` MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT;" |
|
1295 | + "ALTER TABLE `".$pre."kb_categories` MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT;" |
|
1296 | 1296 | ); |
1297 | 1297 | |
1298 | 1298 | // Add column increment_id to kb_items table |
1299 | 1299 | $res = addColumnIfNotExist( |
1300 | - $pre . 'kb_items', |
|
1300 | + $pre.'kb_items', |
|
1301 | 1301 | 'increment_id', |
1302 | 1302 | "INT(12) NOT NULL AUTO_INCREMENT FIRST, |
1303 | 1303 | ADD PRIMARY KEY (increment_id)" |
1304 | 1304 | ); |
1305 | 1305 | if ($res === false) { |
1306 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table kb_items! ' . mysqli_error($db_link) . '!"}]'; |
|
1306 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table kb_items! '.mysqli_error($db_link).'!"}]'; |
|
1307 | 1307 | mysqli_close($db_link); |
1308 | 1308 | exit(); |
1309 | 1309 | } |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | // Alter table kb_items |
1312 | 1312 | mysqli_query( |
1313 | 1313 | $db_link, |
1314 | - "ALTER TABLE `" . $pre . "kb_items` |
|
1314 | + "ALTER TABLE `".$pre."kb_items` |
|
1315 | 1315 | MODIFY COLUMN `kb_id` INT(12) NOT NULL, |
1316 | 1316 | MODIFY COLUMN `item_id` INT(12) NOT NULL;" |
1317 | 1317 | ); |
@@ -1319,13 +1319,13 @@ discard block |
||
1319 | 1319 | // Alter table languages |
1320 | 1320 | mysqli_query( |
1321 | 1321 | $db_link, |
1322 | - "ALTER TABLE `" . $pre . "languages` MODIFY COLUMN `id` INT(10) NOT NULL AUTO_INCREMENT;" |
|
1322 | + "ALTER TABLE `".$pre."languages` MODIFY COLUMN `id` INT(10) NOT NULL AUTO_INCREMENT;" |
|
1323 | 1323 | ); |
1324 | 1324 | |
1325 | 1325 | // Alter table log_items |
1326 | 1326 | mysqli_query( |
1327 | 1327 | $db_link, |
1328 | - "ALTER TABLE `" . $pre . "log_items` |
|
1328 | + "ALTER TABLE `".$pre."log_items` |
|
1329 | 1329 | MODIFY COLUMN `increment_id` INT(12) NOT NULL AUTO_INCREMENT, |
1330 | 1330 | MODIFY COLUMN `id_item` INT(8) NOT NULL, |
1331 | 1331 | MODIFY COLUMN `id_user` INT(8) NOT NULL;" |
@@ -1334,42 +1334,42 @@ discard block |
||
1334 | 1334 | // Alter table log_system |
1335 | 1335 | mysqli_query( |
1336 | 1336 | $db_link, |
1337 | - "ALTER TABLE `" . $pre . "log_system` |
|
1337 | + "ALTER TABLE `".$pre."log_system` |
|
1338 | 1338 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1339 | 1339 | MODIFY COLUMN `qui` VARCHAR(255) NOT NULL;" |
1340 | 1340 | ); |
1341 | 1341 | |
1342 | 1342 | // Alter table misc column name if necessary |
1343 | 1343 | $exists = false; |
1344 | -$columns = mysqli_query($db_link, "show columns from `" . $pre . "misc`"); |
|
1344 | +$columns = mysqli_query($db_link, "show columns from `".$pre."misc`"); |
|
1345 | 1345 | while ($col = mysqli_fetch_assoc($columns)) { |
1346 | 1346 | if ($col['Field'] == 'increment_id') { |
1347 | 1347 | $exists = true; |
1348 | 1348 | } |
1349 | 1349 | } |
1350 | 1350 | if (!$exists) { |
1351 | - mysqli_query($db_link, "ALTER TABLE `" . $pre . "misc` CHANGE COLUMN `id` `increment_id` INT(12) NOT NULL AUTO_INCREMENT"); |
|
1351 | + mysqli_query($db_link, "ALTER TABLE `".$pre."misc` CHANGE COLUMN `id` `increment_id` INT(12) NOT NULL AUTO_INCREMENT"); |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | // Alter table misc |
1355 | 1355 | mysqli_query( |
1356 | 1356 | $db_link, |
1357 | - "ALTER TABLE `" . $pre . "misc` |
|
1357 | + "ALTER TABLE `".$pre."misc` |
|
1358 | 1358 | MODIFY COLUMN `valeur` varchar(500) NOT NULL;" |
1359 | 1359 | ); |
1360 | 1360 | |
1361 | 1361 | // Alter table nested_tree |
1362 | 1362 | mysqli_query( |
1363 | 1363 | $db_link, |
1364 | - "ALTER TABLE `" . $pre . "nested_tree` MODIFY COLUMN `renewal_period` int(5) NOT NULL DEFAULT 0;" |
|
1364 | + "ALTER TABLE `".$pre."nested_tree` MODIFY COLUMN `renewal_period` int(5) NOT NULL DEFAULT 0;" |
|
1365 | 1365 | ); |
1366 | 1366 | |
1367 | 1367 | // Remove the INDEX id from the nested_tree table |
1368 | -$mysqli_result = mysqli_query($db_link, "SHOW INDEX FROM `" . $pre . "nested_tree` WHERE key_name LIKE \"id\""); |
|
1369 | -if (mysqli_fetch_row($mysqli_result)){ |
|
1370 | - $res = mysqli_query($db_link, "ALTER TABLE `" . $pre . "nested_tree` DROP INDEX `id`"); |
|
1368 | +$mysqli_result = mysqli_query($db_link, "SHOW INDEX FROM `".$pre."nested_tree` WHERE key_name LIKE \"id\""); |
|
1369 | +if (mysqli_fetch_row($mysqli_result)) { |
|
1370 | + $res = mysqli_query($db_link, "ALTER TABLE `".$pre."nested_tree` DROP INDEX `id`"); |
|
1371 | 1371 | if (!$res) { |
1372 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when removing the INDEX id from the nested_tree table! ' . mysqli_error($db_link) . '!"}]'; |
|
1372 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when removing the INDEX id from the nested_tree table! '.mysqli_error($db_link).'!"}]'; |
|
1373 | 1373 | mysqli_close($db_link); |
1374 | 1374 | exit(); |
1375 | 1375 | } |
@@ -1378,7 +1378,7 @@ discard block |
||
1378 | 1378 | // Alter table otv |
1379 | 1379 | mysqli_query( |
1380 | 1380 | $db_link, |
1381 | - "ALTER TABLE `" . $pre . "otv` |
|
1381 | + "ALTER TABLE `".$pre."otv` |
|
1382 | 1382 | MODIFY COLUMN `id` INT(10) NOT NULL AUTO_INCREMENT, |
1383 | 1383 | MODIFY COLUMN `item_id` INT(12) NOT NULL, |
1384 | 1384 | MODIFY COLUMN `originator` INT(12) NOT NULL;" |
@@ -1386,13 +1386,13 @@ discard block |
||
1386 | 1386 | |
1387 | 1387 | // Add column increment_id to restriction_to_roles table |
1388 | 1388 | $res = addColumnIfNotExist( |
1389 | - $pre . 'restriction_to_roles', |
|
1389 | + $pre.'restriction_to_roles', |
|
1390 | 1390 | 'increment_id', |
1391 | 1391 | "INT(12) NOT NULL AUTO_INCREMENT FIRST, |
1392 | 1392 | ADD PRIMARY KEY (increment_id)" |
1393 | 1393 | ); |
1394 | 1394 | if ($res === false) { |
1395 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table restriction_to_roles! ' . mysqli_error($db_link) . '!"}]'; |
|
1395 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table restriction_to_roles! '.mysqli_error($db_link).'!"}]'; |
|
1396 | 1396 | mysqli_close($db_link); |
1397 | 1397 | exit(); |
1398 | 1398 | } |
@@ -1400,17 +1400,17 @@ discard block |
||
1400 | 1400 | // Alter table restriction_to_roles |
1401 | 1401 | mysqli_query( |
1402 | 1402 | $db_link, |
1403 | - "ALTER TABLE `" . $pre . "restriction_to_roles` |
|
1403 | + "ALTER TABLE `".$pre."restriction_to_roles` |
|
1404 | 1404 | MODIFY COLUMN `role_id` INT(12) NOT NULL, |
1405 | 1405 | MODIFY COLUMN `item_id` INT(12) NOT NULL;" |
1406 | 1406 | ); |
1407 | 1407 | |
1408 | 1408 | // Remove the INDEX role_id_idx from the restriction_to_roles table |
1409 | -$mysqli_result = mysqli_query($db_link, "SHOW INDEX FROM `" . $pre . "restriction_to_roles` WHERE key_name LIKE \"role_id_idx\""); |
|
1410 | -if (mysqli_fetch_row($mysqli_result)){ |
|
1411 | - $res = mysqli_query($db_link, "ALTER TABLE `" . $pre . "restriction_to_roles` DROP INDEX `role_id_idx`"); |
|
1409 | +$mysqli_result = mysqli_query($db_link, "SHOW INDEX FROM `".$pre."restriction_to_roles` WHERE key_name LIKE \"role_id_idx\""); |
|
1410 | +if (mysqli_fetch_row($mysqli_result)) { |
|
1411 | + $res = mysqli_query($db_link, "ALTER TABLE `".$pre."restriction_to_roles` DROP INDEX `role_id_idx`"); |
|
1412 | 1412 | if (!$res) { |
1413 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when removing the INDEX role_id_idx from the restriction_to_roles table! ' . mysqli_error($db_link) . '!"}]'; |
|
1413 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when removing the INDEX role_id_idx from the restriction_to_roles table! '.mysqli_error($db_link).'!"}]'; |
|
1414 | 1414 | mysqli_close($db_link); |
1415 | 1415 | exit(); |
1416 | 1416 | } |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | // Alter table rights |
1420 | 1420 | mysqli_query( |
1421 | 1421 | $db_link, |
1422 | - "ALTER TABLE `" . $pre . "rights` |
|
1422 | + "ALTER TABLE `".$pre."rights` |
|
1423 | 1423 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1424 | 1424 | MODIFY COLUMN `tree_id` INT(12) NOT NULL, |
1425 | 1425 | MODIFY COLUMN `fonction_id` INT(12) NOT NULL;" |
@@ -1428,20 +1428,20 @@ discard block |
||
1428 | 1428 | // Alter table roles_title |
1429 | 1429 | mysqli_query( |
1430 | 1430 | $db_link, |
1431 | - "ALTER TABLE `" . $pre . "roles_title` |
|
1431 | + "ALTER TABLE `".$pre."roles_title` |
|
1432 | 1432 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1433 | 1433 | MODIFY COLUMN `complexity` INT(5) NOT NULL DEFAULT 0;" |
1434 | 1434 | ); |
1435 | 1435 | |
1436 | 1436 | // Add column increment_id to roles_values table |
1437 | 1437 | $res = addColumnIfNotExist( |
1438 | - $pre . 'roles_values', |
|
1438 | + $pre.'roles_values', |
|
1439 | 1439 | 'increment_id', |
1440 | 1440 | "INT(12) NOT NULL AUTO_INCREMENT FIRST, |
1441 | 1441 | ADD PRIMARY KEY (increment_id)" |
1442 | 1442 | ); |
1443 | 1443 | if ($res === false) { |
1444 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table roles_values! ' . mysqli_error($db_link) . '!"}]'; |
|
1444 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field increment_id to table roles_values! '.mysqli_error($db_link).'!"}]'; |
|
1445 | 1445 | mysqli_close($db_link); |
1446 | 1446 | exit(); |
1447 | 1447 | } |
@@ -1449,19 +1449,19 @@ discard block |
||
1449 | 1449 | // Alter table roles_values |
1450 | 1450 | mysqli_query( |
1451 | 1451 | $db_link, |
1452 | - "ALTER TABLE `" . $pre . "roles_values` |
|
1452 | + "ALTER TABLE `".$pre."roles_values` |
|
1453 | 1453 | MODIFY COLUMN `role_id` INT(12) NOT NULL, |
1454 | 1454 | MODIFY COLUMN `folder_id` INT(12) NOT NULL;" |
1455 | 1455 | ); |
1456 | 1456 | |
1457 | 1457 | // Add column suggestion_type to suggestion table (fresh install create this column) |
1458 | 1458 | $res = addColumnIfNotExist( |
1459 | - $pre . 'suggestion', |
|
1459 | + $pre.'suggestion', |
|
1460 | 1460 | 'suggestion_type', |
1461 | 1461 | "VARCHAR(10) NOT NULL DEFAULT 'new'" |
1462 | 1462 | ); |
1463 | 1463 | if ($res === false) { |
1464 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field suggestion_type to table suggestion! ' . mysqli_error($db_link) . '!"}]'; |
|
1464 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field suggestion_type to table suggestion! '.mysqli_error($db_link).'!"}]'; |
|
1465 | 1465 | mysqli_close($db_link); |
1466 | 1466 | exit(); |
1467 | 1467 | } |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | // Alter table suggestion |
1470 | 1470 | mysqli_query( |
1471 | 1471 | $db_link, |
1472 | - "ALTER TABLE `" . $pre . "suggestion` |
|
1472 | + "ALTER TABLE `".$pre."suggestion` |
|
1473 | 1473 | MODIFY COLUMN `id` tinyint(12) NOT NULL AUTO_INCREMENT, |
1474 | 1474 | MODIFY COLUMN `pw_len` INT(5) NOT NULL, |
1475 | 1475 | MODIFY COLUMN `author_id` INT(12) NOT NULL, |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | // Alter table tags |
1480 | 1480 | mysqli_query( |
1481 | 1481 | $db_link, |
1482 | - "ALTER TABLE `" . $pre . "tags` |
|
1482 | + "ALTER TABLE `".$pre."tags` |
|
1483 | 1483 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1484 | 1484 | MODIFY COLUMN `item_id` INT(12) NOT NULL;" |
1485 | 1485 | ); |
1486 | 1486 | |
1487 | 1487 | // Remove the INDEX id from the tags table |
1488 | -$mysqli_result = mysqli_query($db_link, "SHOW INDEX FROM `" . $pre . "tags` WHERE key_name LIKE \"id\""); |
|
1489 | -if (mysqli_fetch_row($mysqli_result)){ |
|
1490 | - $res = mysqli_query($db_link, "ALTER TABLE `" . $pre . "tags` DROP INDEX `id`"); |
|
1488 | +$mysqli_result = mysqli_query($db_link, "SHOW INDEX FROM `".$pre."tags` WHERE key_name LIKE \"id\""); |
|
1489 | +if (mysqli_fetch_row($mysqli_result)) { |
|
1490 | + $res = mysqli_query($db_link, "ALTER TABLE `".$pre."tags` DROP INDEX `id`"); |
|
1491 | 1491 | if (!$res) { |
1492 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when removing the INDEX id from the tags table! ' . mysqli_error($db_link) . '!"}]'; |
|
1492 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when removing the INDEX id from the tags table! '.mysqli_error($db_link).'!"}]'; |
|
1493 | 1493 | mysqli_close($db_link); |
1494 | 1494 | exit(); |
1495 | 1495 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
1498 | 1498 | // Alter table templates |
1499 | 1499 | mysqli_query( |
1500 | 1500 | $db_link, |
1501 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'templates` ( |
|
1501 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'templates` ( |
|
1502 | 1502 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1503 | 1503 | `item_id` int(12) NOT NULL, |
1504 | 1504 | `category_id` int(12) NOT NULL, |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | ); |
1508 | 1508 | mysqli_query( |
1509 | 1509 | $db_link, |
1510 | - "ALTER TABLE `" . $pre . "templates` |
|
1510 | + "ALTER TABLE `".$pre."templates` |
|
1511 | 1511 | MODIFY COLUMN `increment_id` INT(12) NOT NULL AUTO_INCREMENT, |
1512 | 1512 | MODIFY COLUMN `item_id` INT(12) NOT NULL, |
1513 | 1513 | MODIFY COLUMN `category_id` INT(12) NOT NULL;" |
@@ -1516,43 +1516,43 @@ discard block |
||
1516 | 1516 | // Alter table tokens |
1517 | 1517 | mysqli_query( |
1518 | 1518 | $db_link, |
1519 | - "ALTER TABLE `" . $pre . "tokens` |
|
1519 | + "ALTER TABLE `".$pre."tokens` |
|
1520 | 1520 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1521 | 1521 | MODIFY COLUMN `user_id` INT(12) NOT NULL;" |
1522 | 1522 | ); |
1523 | 1523 | |
1524 | 1524 | // Add column user_ip_lastdate to USERS table |
1525 | 1525 | $res = addColumnIfNotExist( |
1526 | - $pre . 'users', |
|
1526 | + $pre.'users', |
|
1527 | 1527 | 'user_ip_lastdate', |
1528 | 1528 | "VARCHAR(50) NULL DEFAULT NULL AFTER `user_ip`" |
1529 | 1529 | ); |
1530 | 1530 | if ($res === false) { |
1531 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field user_ip_lastdate to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
1531 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field user_ip_lastdate to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
1532 | 1532 | mysqli_close($db_link); |
1533 | 1533 | exit(); |
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | // Add column yubico_user_key to USERS table |
1537 | 1537 | $res = addColumnIfNotExist( |
1538 | - $pre . 'users', |
|
1538 | + $pre.'users', |
|
1539 | 1539 | 'yubico_user_key', |
1540 | 1540 | "VARCHAR(100) NOT NULL DEFAULT 'none' AFTER `user_ip_lastdate`" |
1541 | 1541 | ); |
1542 | 1542 | if ($res === false) { |
1543 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field yubico_user_key to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
1543 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field yubico_user_key to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
1544 | 1544 | mysqli_close($db_link); |
1545 | 1545 | exit(); |
1546 | 1546 | } |
1547 | 1547 | |
1548 | 1548 | // Add column yubico_user_id to USERS table |
1549 | 1549 | $res = addColumnIfNotExist( |
1550 | - $pre . 'users', |
|
1550 | + $pre.'users', |
|
1551 | 1551 | 'yubico_user_id', |
1552 | 1552 | "VARCHAR(100) NOT NULL DEFAULT 'none' AFTER `yubico_user_key`" |
1553 | 1553 | ); |
1554 | 1554 | if ($res === false) { |
1555 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field yubico_user_id to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
1555 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field yubico_user_id to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
1556 | 1556 | mysqli_close($db_link); |
1557 | 1557 | exit(); |
1558 | 1558 | } |
@@ -1560,7 +1560,7 @@ discard block |
||
1560 | 1560 | // Alter USERS table |
1561 | 1561 | mysqli_query( |
1562 | 1562 | $db_link, |
1563 | - "ALTER TABLE `" . $pre . "users` |
|
1563 | + "ALTER TABLE `".$pre."users` |
|
1564 | 1564 | MODIFY COLUMN `id` INT(12) NOT NULL AUTO_INCREMENT, |
1565 | 1565 | MODIFY COLUMN `pw` VARCHAR(400) NOT NULL, |
1566 | 1566 | MODIFY COLUMN `groupes_visibles` VARCHAR(1000) NOT NULL, |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | |
1582 | 1582 | // Add field otp_provided to USERS table |
1583 | 1583 | $res = addColumnIfNotExist( |
1584 | - $pre . 'users', |
|
1584 | + $pre.'users', |
|
1585 | 1585 | 'otp_provided', |
1586 | 1586 | "BOOLEAN NOT NULL DEFAULT FALSE" |
1587 | 1587 | ); |
@@ -1589,7 +1589,7 @@ discard block |
||
1589 | 1589 | // Update this new field |
1590 | 1590 | mysqli_query( |
1591 | 1591 | $db_link, |
1592 | - 'UPDATE `' . $pre . 'users` SET otp_provided = 1 WHERE `last_connexion` != "";' |
|
1592 | + 'UPDATE `'.$pre.'users` SET otp_provided = 1 WHERE `last_connexion` != "";' |
|
1593 | 1593 | ); |
1594 | 1594 | |
1595 | 1595 | //---<END 3.0.0.18 |
@@ -1598,11 +1598,11 @@ discard block |
||
1598 | 1598 | //--->BEGIN 3.0.0.20 |
1599 | 1599 | |
1600 | 1600 | // Add new setting 'ldap_tls_certifacte_check' |
1601 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'ldap_tls_certifacte_check'")); |
|
1601 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'ldap_tls_certifacte_check'")); |
|
1602 | 1602 | if (intval($tmp) === 0) { |
1603 | 1603 | mysqli_query( |
1604 | 1604 | $db_link, |
1605 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_tls_certifacte_check', 'LDAP_OPT_X_TLS_NEVER')" |
|
1605 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'ldap_tls_certifacte_check', 'LDAP_OPT_X_TLS_NEVER')" |
|
1606 | 1606 | ); |
1607 | 1607 | } |
1608 | 1608 | |
@@ -1610,39 +1610,39 @@ discard block |
||
1610 | 1610 | try { |
1611 | 1611 | mysqli_query( |
1612 | 1612 | $db_link, |
1613 | - 'ALTER TABLE `' . $pre . 'languages` ADD `code_poeditor` VARCHAR(50) NOT NULL AFTER `flag`' |
|
1613 | + 'ALTER TABLE `'.$pre.'languages` ADD `code_poeditor` VARCHAR(50) NOT NULL AFTER `flag`' |
|
1614 | 1614 | ); |
1615 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`bg` WHERE `name`=`bulgarian`;'); |
|
1616 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`ca` WHERE `name`=`catalan`;'); |
|
1617 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`zh-Hans` WHERE `name`=`chinese`;'); |
|
1618 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`cs` WHERE `name`=`czech`;'); |
|
1619 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`nl` WHERE `name`=`dutch`;'); |
|
1620 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`en` WHERE `name`=`english`;'); |
|
1621 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`et` WHERE `name`=`estonian`;'); |
|
1622 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`fr` WHERE `name`=`french`;'); |
|
1623 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`de` WHERE `name`=`german`;'); |
|
1624 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`el` WHERE `name`=`greek`;'); |
|
1625 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`hu` WHERE `name`=`hungarian`;'); |
|
1626 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`it` WHERE `name`=`italian`;'); |
|
1627 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`ja` WHERE `name`=`japanese`;'); |
|
1628 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`no` WHERE `name`=`norwegian`;'); |
|
1629 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`pl` WHERE `name`=`polish`;'); |
|
1630 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`pt` WHERE `name`=`portuguese`;'); |
|
1631 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`pt-br` WHERE `name`=`portuguese_br`;'); |
|
1632 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`ro` WHERE `name`=`romanian`;'); |
|
1633 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`ru` WHERE `name`=`russian`;'); |
|
1634 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`es` WHERE `name`=`spanish`;'); |
|
1635 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`sv` WHERE `name`=`swedish`;'); |
|
1636 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`tr` WHERE `name`=`turkish`;'); |
|
1637 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`uk` WHERE `name`=`ukrainian`;'); |
|
1638 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'languages` SET `code_poeditor`=`vi` WHERE `name`=`vietnamese`;'); |
|
1615 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`bg` WHERE `name`=`bulgarian`;'); |
|
1616 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`ca` WHERE `name`=`catalan`;'); |
|
1617 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`zh-Hans` WHERE `name`=`chinese`;'); |
|
1618 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`cs` WHERE `name`=`czech`;'); |
|
1619 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`nl` WHERE `name`=`dutch`;'); |
|
1620 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`en` WHERE `name`=`english`;'); |
|
1621 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`et` WHERE `name`=`estonian`;'); |
|
1622 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`fr` WHERE `name`=`french`;'); |
|
1623 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`de` WHERE `name`=`german`;'); |
|
1624 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`el` WHERE `name`=`greek`;'); |
|
1625 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`hu` WHERE `name`=`hungarian`;'); |
|
1626 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`it` WHERE `name`=`italian`;'); |
|
1627 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`ja` WHERE `name`=`japanese`;'); |
|
1628 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`no` WHERE `name`=`norwegian`;'); |
|
1629 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`pl` WHERE `name`=`polish`;'); |
|
1630 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`pt` WHERE `name`=`portuguese`;'); |
|
1631 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`pt-br` WHERE `name`=`portuguese_br`;'); |
|
1632 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`ro` WHERE `name`=`romanian`;'); |
|
1633 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`ru` WHERE `name`=`russian`;'); |
|
1634 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`es` WHERE `name`=`spanish`;'); |
|
1635 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`sv` WHERE `name`=`swedish`;'); |
|
1636 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`tr` WHERE `name`=`turkish`;'); |
|
1637 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`uk` WHERE `name`=`ukrainian`;'); |
|
1638 | + mysqli_query($db_link, 'UPDATE `'.$pre.'languages` SET `code_poeditor`=`vi` WHERE `name`=`vietnamese`;'); |
|
1639 | 1639 | } catch (Exception $e) { |
1640 | 1640 | // Do nothing |
1641 | 1641 | } |
1642 | 1642 | |
1643 | 1643 | // Fix a potential issue in table log_items |
1644 | 1644 | try { |
1645 | - mysqli_query($db_link, 'UPDATE `' . $pre . 'log_items` SET `action` = `at_modification` WHERE `action` = `at_modification2`;'); |
|
1645 | + mysqli_query($db_link, 'UPDATE `'.$pre.'log_items` SET `action` = `at_modification` WHERE `action` = `at_modification2`;'); |
|
1646 | 1646 | } catch (Exception $e) { |
1647 | 1647 | // Do nothing |
1648 | 1648 | } |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | // Change column increment_id to auto increment in cache_tree table |
1657 | 1657 | $columns = mysqli_query($db_link, "SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS |
1658 | 1658 | WHERE TABLE_SCHEMA = '".$database."' |
1659 | - AND TABLE_NAME = '" . $pre . "cache_tree' |
|
1659 | + AND TABLE_NAME = '" . $pre."cache_tree' |
|
1660 | 1660 | AND COLUMN_NAME = 'increment_id' |
1661 | 1661 | AND EXTRA like '%auto_increment%'"); |
1662 | 1662 | |
@@ -1665,19 +1665,19 @@ discard block |
||
1665 | 1665 | // Drop primary key |
1666 | 1666 | mysqli_query( |
1667 | 1667 | $db_link, |
1668 | - 'ALTER TABLE `' . $pre . 'cache_tree` DROP PRIMARY KEY;' |
|
1668 | + 'ALTER TABLE `'.$pre.'cache_tree` DROP PRIMARY KEY;' |
|
1669 | 1669 | ); |
1670 | 1670 | |
1671 | 1671 | // Add auto increment |
1672 | 1672 | mysqli_query( |
1673 | 1673 | $db_link, |
1674 | - 'ALTER TABLE `' . $pre . 'cache_tree` MODIFY column `increment_id` SMALLINT AUTO_INCREMENT;' |
|
1674 | + 'ALTER TABLE `'.$pre.'cache_tree` MODIFY column `increment_id` SMALLINT AUTO_INCREMENT;' |
|
1675 | 1675 | ); |
1676 | 1676 | |
1677 | 1677 | // Add primary keys |
1678 | 1678 | mysqli_query( |
1679 | 1679 | $db_link, |
1680 | - 'ALTER TABLE `' . $pre . 'cache_tree` ADD CONSTRAINT PRIMARY KEY (increment_id);' |
|
1680 | + 'ALTER TABLE `'.$pre.'cache_tree` ADD CONSTRAINT PRIMARY KEY (increment_id);' |
|
1681 | 1681 | ); |
1682 | 1682 | } catch (Exception $e) { |
1683 | 1683 | // Do nothing |
@@ -1688,74 +1688,74 @@ discard block |
||
1688 | 1688 | // Add indexes |
1689 | 1689 | // Add the Primary INDEX OBJECT to the sharekeys_items table |
1690 | 1690 | $res = checkIndexExist( |
1691 | - $pre . 'sharekeys_items', |
|
1691 | + $pre.'sharekeys_items', |
|
1692 | 1692 | 'OBJECT', |
1693 | 1693 | "ADD KEY `OBJECT` (`object_id`)" |
1694 | 1694 | ); |
1695 | 1695 | if (!$res) { |
1696 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX OBJECT to the sharekeys_items table! ' . mysqli_error($db_link) . '!"}]'; |
|
1696 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX OBJECT to the sharekeys_items table! '.mysqli_error($db_link).'!"}]'; |
|
1697 | 1697 | mysqli_close($db_link); |
1698 | 1698 | exit(); |
1699 | 1699 | } |
1700 | 1700 | |
1701 | 1701 | // Add the Primary INDEX USER to the sharekeys_items table |
1702 | 1702 | $res = checkIndexExist( |
1703 | - $pre . 'sharekeys_items', |
|
1703 | + $pre.'sharekeys_items', |
|
1704 | 1704 | 'USER', |
1705 | 1705 | "ADD KEY `USER` (`user_id`)" |
1706 | 1706 | ); |
1707 | 1707 | if (!$res) { |
1708 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX USER to the sharekeys_items table! ' . mysqli_error($db_link) . '!"}]'; |
|
1708 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX USER to the sharekeys_items table! '.mysqli_error($db_link).'!"}]'; |
|
1709 | 1709 | mysqli_close($db_link); |
1710 | 1710 | exit(); |
1711 | 1711 | } |
1712 | 1712 | |
1713 | 1713 | // Add the Primary INDEX OBJECT to the sharekeys_logs table |
1714 | 1714 | $res = checkIndexExist( |
1715 | - $pre . 'sharekeys_logs', |
|
1715 | + $pre.'sharekeys_logs', |
|
1716 | 1716 | 'OBJECT', |
1717 | 1717 | "ADD KEY `OBJECT` (`object_id`)" |
1718 | 1718 | ); |
1719 | 1719 | if (!$res) { |
1720 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX OBJECT to the sharekeys_logs table! ' . mysqli_error($db_link) . '!"}]'; |
|
1720 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX OBJECT to the sharekeys_logs table! '.mysqli_error($db_link).'!"}]'; |
|
1721 | 1721 | mysqli_close($db_link); |
1722 | 1722 | exit(); |
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | // Add the Primary INDEX USER to the sharekeys_logs table |
1726 | 1726 | $res = checkIndexExist( |
1727 | - $pre . 'sharekeys_logs', |
|
1727 | + $pre.'sharekeys_logs', |
|
1728 | 1728 | 'USER', |
1729 | 1729 | "ADD KEY `USER` (`user_id`)" |
1730 | 1730 | ); |
1731 | 1731 | if (!$res) { |
1732 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX USER to the sharekeys_logs table! ' . mysqli_error($db_link) . '!"}]'; |
|
1732 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX USER to the sharekeys_logs table! '.mysqli_error($db_link).'!"}]'; |
|
1733 | 1733 | mysqli_close($db_link); |
1734 | 1734 | exit(); |
1735 | 1735 | } |
1736 | 1736 | |
1737 | 1737 | // Add field nb_items_in_folder to NESTED_TREE table |
1738 | 1738 | $res = addColumnIfNotExist( |
1739 | - $pre . 'nested_tree', |
|
1739 | + $pre.'nested_tree', |
|
1740 | 1740 | 'nb_items_in_folder', |
1741 | 1741 | "int(10) NOT NULL DEFAULT '0'" |
1742 | 1742 | ); |
1743 | 1743 | // Add field nb_subfolders to NESTED_TREE table |
1744 | 1744 | $res = addColumnIfNotExist( |
1745 | - $pre . 'nested_tree', |
|
1745 | + $pre.'nested_tree', |
|
1746 | 1746 | 'nb_subfolders', |
1747 | 1747 | "int(10) NOT NULL DEFAULT '0'" |
1748 | 1748 | ); |
1749 | 1749 | // Add field nb_items_in_subfolders to NESTED_TREE table |
1750 | 1750 | $res = addColumnIfNotExist( |
1751 | - $pre . 'nested_tree', |
|
1751 | + $pre.'nested_tree', |
|
1752 | 1752 | 'nb_items_in_subfolders', |
1753 | 1753 | "int(10) NOT NULL DEFAULT '0'" |
1754 | 1754 | ); |
1755 | 1755 | |
1756 | 1756 | // Add new setting enable_tasks_log |
1757 | 1757 | addNewSetting( |
1758 | - $pre . 'misc', |
|
1758 | + $pre.'misc', |
|
1759 | 1759 | 'admin', |
1760 | 1760 | 'enable_tasks_log', |
1761 | 1761 | '0' |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | |
1764 | 1764 | // remove setting ldap_elusers |
1765 | 1765 | removeSetting( |
1766 | - $pre . 'misc', |
|
1766 | + $pre.'misc', |
|
1767 | 1767 | 'admin', |
1768 | 1768 | 'ldap_elusers' |
1769 | 1769 | ); |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | // Add new table PROCESSES_LOGS |
1772 | 1772 | mysqli_query( |
1773 | 1773 | $db_link, |
1774 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'processes_logs` ( |
|
1774 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'processes_logs` ( |
|
1775 | 1775 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1776 | 1776 | `created_at` varchar(20) NOT NULL, |
1777 | 1777 | `job` varchar(50) NOT NULL, |
@@ -1788,7 +1788,7 @@ discard block |
||
1788 | 1788 | |
1789 | 1789 | // Add field folders to cache_tree table |
1790 | 1790 | $res = addColumnIfNotExist( |
1791 | - $pre . 'cache_tree', |
|
1791 | + $pre.'cache_tree', |
|
1792 | 1792 | 'folders', |
1793 | 1793 | "longtext DEFAULT NULL" |
1794 | 1794 | ); |
@@ -1796,7 +1796,7 @@ discard block |
||
1796 | 1796 | try { |
1797 | 1797 | mysqli_query( |
1798 | 1798 | $db_link, |
1799 | - 'ALTER TABLE `' . $pre . 'cache_tree` MODIFY column `folders` longtext DEFAULT NULL;' |
|
1799 | + 'ALTER TABLE `'.$pre.'cache_tree` MODIFY column `folders` longtext DEFAULT NULL;' |
|
1800 | 1800 | ); |
1801 | 1801 | } catch (Exception $e) { |
1802 | 1802 | // Do nothing |
@@ -1804,19 +1804,19 @@ discard block |
||
1804 | 1804 | |
1805 | 1805 | // Add field folders to nested_tree table |
1806 | 1806 | $res = addColumnIfNotExist( |
1807 | - $pre . 'api', |
|
1807 | + $pre.'api', |
|
1808 | 1808 | 'user_id', |
1809 | 1809 | "INT(12) DEFAULT NULL" |
1810 | 1810 | ); |
1811 | 1811 | |
1812 | 1812 | // Add the Primary INDEX USER to the api table |
1813 | 1813 | $res = checkIndexExist( |
1814 | - $pre . 'api', |
|
1814 | + $pre.'api', |
|
1815 | 1815 | 'USER', |
1816 | 1816 | "ADD KEY `USER` (`user_id`)" |
1817 | 1817 | ); |
1818 | 1818 | if (!$res) { |
1819 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX USER to the api table! ' . mysqli_error($db_link) . '!"}]'; |
|
1819 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX USER to the api table! '.mysqli_error($db_link).'!"}]'; |
|
1820 | 1820 | mysqli_close($db_link); |
1821 | 1821 | exit(); |
1822 | 1822 | } |
@@ -1824,7 +1824,7 @@ discard block |
||
1824 | 1824 | try { |
1825 | 1825 | mysqli_query( |
1826 | 1826 | $db_link, |
1827 | - 'ALTER TABLE `' . $pre . 'api` MODIFY column `value` text DEFAULT NULL;' |
|
1827 | + 'ALTER TABLE `'.$pre.'api` MODIFY column `value` text DEFAULT NULL;' |
|
1828 | 1828 | ); |
1829 | 1829 | } catch (Exception $e) { |
1830 | 1830 | // Do nothing |
@@ -1833,7 +1833,7 @@ discard block |
||
1833 | 1833 | try { |
1834 | 1834 | mysqli_query( |
1835 | 1835 | $db_link, |
1836 | - 'ALTER TABLE `' . $pre . 'api` MODIFY column `label` VARCHAR(255) DEFAULT NULL;' |
|
1836 | + 'ALTER TABLE `'.$pre.'api` MODIFY column `label` VARCHAR(255) DEFAULT NULL;' |
|
1837 | 1837 | ); |
1838 | 1838 | } catch (Exception $e) { |
1839 | 1839 | // Do nothing |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | |
1842 | 1842 | // Alter table api column name if necessary |
1843 | 1843 | changeColumnName( |
1844 | - $pre . 'api', |
|
1844 | + $pre.'api', |
|
1845 | 1845 | 'id', |
1846 | 1846 | 'increment_id', |
1847 | 1847 | "INT(20) NOT NULL AUTO_INCREMENT" |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | // Add new table ldap_groups_roles |
1948 | 1948 | mysqli_query( |
1949 | 1949 | $db_link, |
1950 | - "CREATE TABLE IF NOT EXISTS `" . $pre . "ldap_groups_roles` ( |
|
1950 | + "CREATE TABLE IF NOT EXISTS `".$pre."ldap_groups_roles` ( |
|
1951 | 1951 | `increment_id` INT(12) NOT NULL AUTO_INCREMENT, |
1952 | 1952 | `role_id` INT(12) NOT NULL, |
1953 | 1953 | `ldap_group_id` INT(12) NOT NULL, |
@@ -1959,28 +1959,28 @@ discard block |
||
1959 | 1959 | |
1960 | 1960 | // Add new setting enable_ad_users_with_ad_groups |
1961 | 1961 | addNewSetting( |
1962 | - $pre . 'misc', |
|
1962 | + $pre.'misc', |
|
1963 | 1963 | 'admin', |
1964 | 1964 | 'enable_ad_users_with_ad_groups', |
1965 | 1965 | '0' |
1966 | 1966 | ); |
1967 | 1967 | // Add new setting enable_ad_user_auto_creation |
1968 | 1968 | addNewSetting( |
1969 | - $pre . 'misc', |
|
1969 | + $pre.'misc', |
|
1970 | 1970 | 'admin', |
1971 | 1971 | 'enable_ad_user_auto_creation', |
1972 | 1972 | '0' |
1973 | 1973 | ); |
1974 | 1974 | // Add new setting ldap_group_object_filter |
1975 | 1975 | addNewSetting( |
1976 | - $pre . 'misc', |
|
1976 | + $pre.'misc', |
|
1977 | 1977 | 'admin', |
1978 | 1978 | 'ldap_group_object_filter', |
1979 | 1979 | '' |
1980 | 1980 | ); |
1981 | 1981 | // Add new setting ldap_guid_attibute |
1982 | 1982 | addNewSetting( |
1983 | - $pre . 'misc', |
|
1983 | + $pre.'misc', |
|
1984 | 1984 | 'admin', |
1985 | 1985 | 'ldap_guid_attibute', |
1986 | 1986 | 'objectguid' |
@@ -1988,18 +1988,18 @@ discard block |
||
1988 | 1988 | |
1989 | 1989 | // Add field public_key to USERS table |
1990 | 1990 | $res = addColumnIfNotExist( |
1991 | - $pre . 'users', |
|
1991 | + $pre.'users', |
|
1992 | 1992 | 'roles_from_ad_groups', |
1993 | 1993 | "varchar(1000) NULL" |
1994 | 1994 | ); |
1995 | 1995 | if ($res === false) { |
1996 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field roles_from_ad_groups to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
1996 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field roles_from_ad_groups to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
1997 | 1997 | mysqli_close($db_link); |
1998 | 1998 | exit(); |
1999 | 1999 | } |
2000 | 2000 | |
2001 | 2001 | // Add account TP USER if not exist |
2002 | -$data = mysqli_fetch_row(mysqli_query($db_link, "SELECT COUNT(*) FROM ".$pre . "users WHERE id = '" . TP_USER_ID . "'")); |
|
2002 | +$data = mysqli_fetch_row(mysqli_query($db_link, "SELECT COUNT(*) FROM ".$pre."users WHERE id = '".TP_USER_ID."'")); |
|
2003 | 2003 | if ((int) $data[0] === 0) { |
2004 | 2004 | // generate key for password |
2005 | 2005 | $pwd = GenerateCryptKey(25, true, true, true, true); |
@@ -2015,14 +2015,14 @@ discard block |
||
2015 | 2015 | // add setting |
2016 | 2016 | mysqli_query( |
2017 | 2017 | $db_link, |
2018 | - "INSERT INTO `".$pre."users` (`id`, `login`, `pw`, `groupes_visibles`, `derniers`, `key_tempo`, `last_pw_change`, `last_pw`, `admin`, `fonction_id`, `groupes_interdits`, `last_connexion`, `gestionnaire`, `email`, `favourites`, `latest_items`, `personal_folder`, `public_key`, `private_key`, `encrypted_psk`) VALUES ('" . TP_USER_ID . "', 'TP', '".$encrypted_pwd."', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '".$userKeys['public_key']."', '".$userKeys['private_key']."', NULL)" |
|
2018 | + "INSERT INTO `".$pre."users` (`id`, `login`, `pw`, `groupes_visibles`, `derniers`, `key_tempo`, `last_pw_change`, `last_pw`, `admin`, `fonction_id`, `groupes_interdits`, `last_connexion`, `gestionnaire`, `email`, `favourites`, `latest_items`, `personal_folder`, `public_key`, `private_key`, `encrypted_psk`) VALUES ('".TP_USER_ID."', 'TP', '".$encrypted_pwd."', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '".$userKeys['public_key']."', '".$userKeys['private_key']."', NULL)" |
|
2019 | 2019 | ); |
2020 | 2020 | } |
2021 | 2021 | |
2022 | 2022 | // Force Tasks manager to be enabled |
2023 | 2023 | mysqli_query( |
2024 | 2024 | $db_link, |
2025 | - "UPDATE `" . $pre . "misc` SET `valeur` = '1' WHERE type = 'admin' AND intitule = 'enable_tasks_manager';" |
|
2025 | + "UPDATE `".$pre."misc` SET `valeur` = '1' WHERE type = 'admin' AND intitule = 'enable_tasks_manager';" |
|
2026 | 2026 | ); |
2027 | 2027 | |
2028 | 2028 | //---<END 3.0.0.23 |
@@ -2031,7 +2031,7 @@ discard block |
||
2031 | 2031 | |
2032 | 2032 | // Add field regex to CATEGORIES table |
2033 | 2033 | $res = addColumnIfNotExist( |
2034 | - $pre . 'categories', |
|
2034 | + $pre.'categories', |
|
2035 | 2035 | 'regex', |
2036 | 2036 | "varchar(255) default ''" |
2037 | 2037 | ); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | mysqli_query( |
155 | 155 | $db_link, |
156 | 156 | "UPDATE ".$pre."suggestion |
157 | - SET pw = '". $cryptedStuff['encrypted'] ."', encryption_type = 'teampass_aes' |
|
157 | + SET pw = '". $cryptedStuff['encrypted']."', encryption_type = 'teampass_aes' |
|
158 | 158 | WHERE id = ".$data['id'] |
159 | 159 | ); |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | mysqli_query( |
163 | 163 | $db_link, |
164 | 164 | "INSERT INTO `".$pre."sharekeys_suggestions` (`increment_id`, `object_id`, `user_id`, `share_key`) |
165 | - VALUES (NULL, '". $data['id'] ."', '". $userId ."', '". encryptUserObjectKey($cryptedStuff['objectKey'], $userPublicKey) ."');" |
|
165 | + VALUES (NULL, '". $data['id']."', '".$userId."', '".encryptUserObjectKey($cryptedStuff['objectKey'], $userPublicKey)."');" |
|
166 | 166 | ); |
167 | 167 | } |
168 | 168 | } |