@@ -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); |
@@ -73,18 +73,27 @@ |
||
73 | 73 | define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '"); |
74 | 74 | define("SECUREFILE", "' . SECUREFILE. '");'; |
75 | 75 | |
76 | - if (defined('IKEY') === true) $settingsTxt .= ' |
|
76 | + if (defined('IKEY') === true) { |
|
77 | + $settingsTxt .= ' |
|
77 | 78 | define("IKEY", "' . IKEY . '");'; |
78 | - else $settingsTxt .= ' |
|
79 | + } else { |
|
80 | + $settingsTxt .= ' |
|
79 | 81 | define("IKEY", "");'; |
80 | - if (defined('SKEY') === true) $settingsTxt .= ' |
|
82 | + } |
|
83 | + if (defined('SKEY') === true) { |
|
84 | + $settingsTxt .= ' |
|
81 | 85 | define("SKEY", "' . SKEY . '");'; |
82 | - else $settingsTxt .= ' |
|
86 | + } else { |
|
87 | + $settingsTxt .= ' |
|
83 | 88 | define("SKEY", "");'; |
84 | - if (defined('HOST') === true) $settingsTxt .= ' |
|
89 | + } |
|
90 | + if (defined('HOST') === true) { |
|
91 | + $settingsTxt .= ' |
|
85 | 92 | define("HOST", "' . HOST . '");'; |
86 | - else $settingsTxt .= ' |
|
93 | + } else { |
|
94 | + $settingsTxt .= ' |
|
87 | 95 | define("HOST", "");'; |
96 | + } |
|
88 | 97 | |
89 | 98 | |
90 | 99 | $settingsTxt .= ' |
@@ -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 | ); |
@@ -130,7 +130,9 @@ discard block |
||
130 | 130 | $TPIsBranch3 === true ? '' : array('admin', 'ldap_mode', 0, 1), // only disable if migrating from branch 2 |
131 | 131 | ); |
132 | 132 | foreach ($val as $elem) { |
133 | - if ($elem === '') continue; |
|
133 | + if ($elem === '') { |
|
134 | + continue; |
|
135 | + } |
|
134 | 136 | //Check if exists before inserting |
135 | 137 | $queryRes = mysqli_query( |
136 | 138 | $db_link, |
@@ -700,24 +702,21 @@ discard block |
||
700 | 702 | SET valeur = '".TP_PW_STRENGTH_2."' |
701 | 703 | WHERE increment_id = ".$data['increment_id'] |
702 | 704 | ); |
703 | - } |
|
704 | - elseif ((int) $data['valeur'] > TP_PW_STRENGTH_2 && (int) $data['valeur'] <= TP_PW_STRENGTH_3) { |
|
705 | + } elseif ((int) $data['valeur'] > TP_PW_STRENGTH_2 && (int) $data['valeur'] <= TP_PW_STRENGTH_3) { |
|
705 | 706 | mysqli_query( |
706 | 707 | $db_link, |
707 | 708 | "UPDATE ".$pre."misc |
708 | 709 | SET valeur = '".TP_PW_STRENGTH_3."' |
709 | 710 | WHERE increment_id = ".$data['increment_id'] |
710 | 711 | ); |
711 | - } |
|
712 | - elseif ((int) $data['valeur'] > TP_PW_STRENGTH_3 && (int) $data['valeur'] <= TP_PW_STRENGTH_4) { |
|
712 | + } elseif ((int) $data['valeur'] > TP_PW_STRENGTH_3 && (int) $data['valeur'] <= TP_PW_STRENGTH_4) { |
|
713 | 713 | mysqli_query( |
714 | 714 | $db_link, |
715 | 715 | "UPDATE ".$pre."misc |
716 | 716 | SET valeur = '".TP_PW_STRENGTH_4."' |
717 | 717 | WHERE increment_id = ".$data['increment_id'] |
718 | 718 | ); |
719 | - } |
|
720 | - elseif ((int) $data['valeur'] > TP_PW_STRENGTH_4) { |
|
719 | + } elseif ((int) $data['valeur'] > TP_PW_STRENGTH_4) { |
|
721 | 720 | mysqli_query( |
722 | 721 | $db_link, |
723 | 722 | "UPDATE ".$pre."misc |
@@ -741,24 +740,21 @@ discard block |
||
741 | 740 | SET complexity = '".TP_PW_STRENGTH_2."' |
742 | 741 | WHERE id = ".$data['id'] |
743 | 742 | ); |
744 | - } |
|
745 | - elseif ((int) $data['complexity'] > TP_PW_STRENGTH_2 && (int) $data['complexity'] <= TP_PW_STRENGTH_3) { |
|
743 | + } elseif ((int) $data['complexity'] > TP_PW_STRENGTH_2 && (int) $data['complexity'] <= TP_PW_STRENGTH_3) { |
|
746 | 744 | mysqli_query( |
747 | 745 | $db_link, |
748 | 746 | "UPDATE ".$pre."roles_title |
749 | 747 | SET complexity = '".TP_PW_STRENGTH_3."' |
750 | 748 | WHERE id = ".$data['id'] |
751 | 749 | ); |
752 | - } |
|
753 | - elseif ((int) $data['complexity'] > TP_PW_STRENGTH_3 && (int) $data['complexity'] <= TP_PW_STRENGTH_4) { |
|
750 | + } elseif ((int) $data['complexity'] > TP_PW_STRENGTH_3 && (int) $data['complexity'] <= TP_PW_STRENGTH_4) { |
|
754 | 751 | mysqli_query( |
755 | 752 | $db_link, |
756 | 753 | "UPDATE ".$pre."roles_title |
757 | 754 | SET complexity = '".TP_PW_STRENGTH_4."' |
758 | 755 | WHERE id = ".$data['id'] |
759 | 756 | ); |
760 | - } |
|
761 | - elseif ((int) $data['complexity'] > TP_PW_STRENGTH_4) { |
|
757 | + } elseif ((int) $data['complexity'] > TP_PW_STRENGTH_4) { |
|
762 | 758 | mysqli_query( |
763 | 759 | $db_link, |
764 | 760 | "UPDATE ".$pre."roles_title |
@@ -79,7 +79,7 @@ |
||
79 | 79 | $database, |
80 | 80 | $port |
81 | 81 | ); |
82 | - $db_link->set_charset(DB_ENCODING); |
|
82 | + $db_link->set_charset(DB_ENCODING); |
|
83 | 83 | } else { |
84 | 84 | $res = "Impossible to get connected to server. Error is: ".addslashes(mysqli_connect_error()); |
85 | 85 | echo '[{"finish":"1", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]'; |
@@ -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 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $settings_sample = 'includes/config/settings.sample.php'; |
33 | 33 | $settings = 'includes/config/settings.php'; |
34 | 34 | if (copy('../'.$settings_sample, '../'.$settings) === false) { |
35 | - echo '[{"error" : "File <i>' . $settings . '</i> could not be copied from <i>'.$settings_sample.'</i>.<br>Please do it on your own or change folder rights, and click START button!", "index" : "99", "multiple" : "' . $post_multiple . '"}]'; |
|
35 | + echo '[{"error" : "File <i>'.$settings.'</i> could not be copied from <i>'.$settings_sample.'</i>.<br>Please do it on your own or change folder rights, and click START button!", "index" : "99", "multiple" : "'.$post_multiple.'"}]'; |
|
36 | 36 | exit(); |
37 | 37 | } |
38 | 38 | } |
@@ -160,47 +160,47 @@ discard block |
||
160 | 160 | $session_url_path = $data['url_path']; |
161 | 161 | |
162 | 162 | if (isset($data['activity']) && $data['activity'] === 'folder') { |
163 | - $targetPath = $abspath . '/' . $data['task'] . '/'; |
|
163 | + $targetPath = $abspath.'/'.$data['task'].'/'; |
|
164 | 164 | if (is_writable($targetPath) === true) { |
165 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
165 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
166 | 166 | } else { |
167 | - echo '[{"error" : " Path ' . $targetPath . ' is not writable!", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
167 | + echo '[{"error" : " Path '.$targetPath.' is not writable!", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
168 | 168 | } |
169 | 169 | break; |
170 | 170 | } |
171 | 171 | |
172 | 172 | if (isset($data['activity']) && $data['activity'] === 'extension') { |
173 | 173 | if (extension_loaded($data['task'])) { |
174 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
174 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
175 | 175 | } else { |
176 | - echo '[{"error" : " Extension ' . $data['task'] . ' is not loaded!", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
176 | + echo '[{"error" : " Extension '.$data['task'].' is not loaded!", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
177 | 177 | } |
178 | 178 | break; |
179 | 179 | } |
180 | 180 | |
181 | 181 | if (isset($data['activity']) && $data['activity'] === 'function') { |
182 | 182 | if (function_exists($data['task'])) { |
183 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
183 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
184 | 184 | } else { |
185 | - echo '[{"error" : " Function ' . $data['task'] . ' is not available!", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
185 | + echo '[{"error" : " Function '.$data['task'].' is not available!", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
186 | 186 | } |
187 | 187 | break; |
188 | 188 | } |
189 | 189 | |
190 | 190 | if (isset($data['activity']) && $data['activity'] === 'version') { |
191 | 191 | if (version_compare(phpversion(), MIN_PHP_VERSION, '>=')) { |
192 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
192 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
193 | 193 | } else { |
194 | - echo '[{"error" : "PHP version ' . phpversion() . ' is not OK (minimum is '.MIN_PHP_VERSION.')", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
194 | + echo '[{"error" : "PHP version '.phpversion().' is not OK (minimum is '.MIN_PHP_VERSION.')", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
195 | 195 | } |
196 | 196 | break; |
197 | 197 | } |
198 | 198 | |
199 | 199 | if (isset($data['activity']) && $data['activity'] === 'ini') { |
200 | 200 | if (ini_get($data['task']) >= 30) { |
201 | - echo '[{"error" : "", "index" : "' . $post_index . '"}]'; |
|
201 | + echo '[{"error" : "", "index" : "'.$post_index.'"}]'; |
|
202 | 202 | } else { |
203 | - echo '[{"error" : "PHP \"Maximum execution time\" is set to ' . ini_get('max_execution_time') . ' seconds. Please try to set to 30s at least during installation.", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
203 | + echo '[{"error" : "PHP \"Maximum execution time\" is set to '.ini_get('max_execution_time').' seconds. Please try to set to 30s at least during installation.", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
204 | 204 | } |
205 | 205 | break; |
206 | 206 | } |
@@ -243,29 +243,29 @@ discard block |
||
243 | 243 | // store values |
244 | 244 | foreach ($data as $key => $value) { |
245 | 245 | $superGlobal->put($key, $value, 'SESSION'); |
246 | - $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `_install` WHERE `key` = '" . $key . "'")); |
|
246 | + $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `_install` WHERE `key` = '".$key."'")); |
|
247 | 247 | if (intval($tmp) === 0) { |
248 | - mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('" . $key . "', '" . $value . "');"); |
|
248 | + mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('".$key."', '".$value."');"); |
|
249 | 249 | } else { |
250 | - mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '" . $value . "' WHERE `key` = '" . $key . "';"); |
|
250 | + mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '".$value."' WHERE `key` = '".$key."';"); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `_install` WHERE `key` = 'url_path'")); |
254 | 254 | if (intval($tmp) === 0) { |
255 | - mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('url_path', '" . empty($post_urlpath) ? $db['url_path'] : $post_urlpath . "');"); |
|
255 | + mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('url_path', '".empty($post_urlpath) ? $db['url_path'] : $post_urlpath."');"); |
|
256 | 256 | }/* else { |
257 | 257 | mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '". empty($session_url_path) ? $data['url_path'] : $session_url_path. "' WHERE `key` = 'url_path';"); |
258 | 258 | }*/ |
259 | 259 | $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `_install` WHERE `key` = 'absolute_path'")); |
260 | 260 | if (intval($tmp) === 0) { |
261 | - mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('absolute_path', '" . empty($post_abspath) ? $data['absolute_path'] : $post_abspath . "');"); |
|
261 | + mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('absolute_path', '".empty($post_abspath) ? $data['absolute_path'] : $post_abspath."');"); |
|
262 | 262 | }/* else { |
263 | 263 | mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '" . empty($session_abspath) ? $data['absolute_path'] : $session_abspath . "' WHERE `key` = 'absolute_path';"); |
264 | 264 | }*/ |
265 | 265 | |
266 | 266 | echo '[{"error" : "", "result" : "Connection is successful", "multiple" : ""}]'; |
267 | 267 | } else { |
268 | - echo '[{"error" : "' . addslashes(str_replace(array("'", "\n", "\r"), array('"', '', ''), mysqli_connect_error())) . '", "result" : "Failed", "multiple" : ""}]'; |
|
268 | + echo '[{"error" : "'.addslashes(str_replace(array("'", "\n", "\r"), array('"', '', ''), mysqli_connect_error())).'", "result" : "Failed", "multiple" : ""}]'; |
|
269 | 269 | } |
270 | 270 | mysqli_close($dbTmp); |
271 | 271 | break; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | // check skpath |
289 | 289 | if (empty($data['sk_path'])) { |
290 | - $data['sk_path'] = $session_abspath . '/includes'; |
|
290 | + $data['sk_path'] = $session_abspath.'/includes'; |
|
291 | 291 | } else { |
292 | 292 | $data['sk_path'] = str_replace('\', '/', $data['sk_path']); |
293 | 293 | } |
@@ -299,11 +299,11 @@ discard block |
||
299 | 299 | // store all variables in SESSION |
300 | 300 | foreach ($data as $key => $value) { |
301 | 301 | $superGlobal->put($key, $value, 'SESSION'); |
302 | - $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `_install` WHERE `key` = '" . $key . "'")); |
|
302 | + $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `_install` WHERE `key` = '".$key."'")); |
|
303 | 303 | if (intval($tmp) === 0) { |
304 | - mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('" . $key . "', '" . $value . "');"); |
|
304 | + mysqli_query($dbTmp, "INSERT INTO `_install` (`key`, `value`) VALUES ('".$key."', '".$value."');"); |
|
305 | 305 | } else { |
306 | - mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '" . $value . "' WHERE `key` = '" . $key . "';"); |
|
306 | + mysqli_query($dbTmp, "UPDATE `_install` SET `value` = '".$value."' WHERE `key` = '".$key."';"); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | echo '[{"error" : "", "result" : "Information stored", "multiple" : ""}]'; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | echo '[{"error" : "The Directory must be writable!", "result" : "Information stored", "multiple" : ""}]'; |
312 | 312 | } |
313 | 313 | } else { |
314 | - echo '[{"error" : "' . $data['sk_path'] . ' is not a Directory!", "result" : "Information stored", "multiple" : ""}]'; |
|
314 | + echo '[{"error" : "'.$data['sk_path'].' is not a Directory!", "result" : "Information stored", "multiple" : ""}]'; |
|
315 | 315 | } |
316 | 316 | mysqli_close($dbTmp); |
317 | 317 | break; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | if ($activity === 'table') { |
340 | 340 | if ($task === 'utf8') { |
341 | 341 | //FORCE UTF8 DATABASE |
342 | - mysqli_query($dbTmp, 'ALTER DATABASE `' . $dbBdd . '` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'); |
|
342 | + mysqli_query($dbTmp, 'ALTER DATABASE `'.$dbBdd.'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'); |
|
343 | 343 | } elseif ($task === 'defuse_passwords') { |
344 | 344 | $mysqli_result = mysqli_query( |
345 | 345 | $dbTmp, |
346 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'defuse_passwords` ( |
|
346 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'defuse_passwords` ( |
|
347 | 347 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
348 | 348 | `type` varchar(100) NOT NULL, |
349 | 349 | `object_id` int(12) NOT NULL, |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | } elseif ($task === 'notification') { |
355 | 355 | $mysqli_result = mysqli_query( |
356 | 356 | $dbTmp, |
357 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'notification` ( |
|
357 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'notification` ( |
|
358 | 358 | `increment_id` INT(12) NOT NULL AUTO_INCREMENT, |
359 | 359 | `item_id` INT(12) NOT NULL, |
360 | 360 | `user_id` INT(12) NOT NULL, |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | } elseif ($task === 'sharekeys_items') { |
365 | 365 | $mysqli_result = mysqli_query( |
366 | 366 | $dbTmp, |
367 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'sharekeys_items` ( |
|
367 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'sharekeys_items` ( |
|
368 | 368 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
369 | 369 | `object_id` int(12) NOT NULL, |
370 | 370 | `user_id` int(12) NOT NULL, |
@@ -374,14 +374,14 @@ discard block |
||
374 | 374 | ); |
375 | 375 | $mysqli_result = mysqli_query( |
376 | 376 | $dbTmp, |
377 | - 'ALTER TABLE `' . $var['tbl_prefix'] . 'sharekeys_items` |
|
377 | + 'ALTER TABLE `'.$var['tbl_prefix'].'sharekeys_items` |
|
378 | 378 | ADD KEY `object_id_idx` (`object_id`), |
379 | 379 | ADD KEY `user_id_idx` (`user_id`);' |
380 | 380 | ); |
381 | 381 | } elseif ($task === 'sharekeys_logs') { |
382 | 382 | $mysqli_result = mysqli_query( |
383 | 383 | $dbTmp, |
384 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'sharekeys_logs` ( |
|
384 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'sharekeys_logs` ( |
|
385 | 385 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
386 | 386 | `object_id` int(12) NOT NULL, |
387 | 387 | `user_id` int(12) NOT NULL, |
@@ -391,14 +391,14 @@ discard block |
||
391 | 391 | ); |
392 | 392 | $mysqli_result = mysqli_query( |
393 | 393 | $dbTmp, |
394 | - 'ALTER TABLE `' . $var['tbl_prefix'] . 'sharekeys_logs` |
|
394 | + 'ALTER TABLE `'.$var['tbl_prefix'].'sharekeys_logs` |
|
395 | 395 | ADD KEY `object_id_idx` (`object_id`), |
396 | 396 | ADD KEY `user_id_idx` (`user_id`);' |
397 | 397 | ); |
398 | 398 | } elseif ($task === 'sharekeys_fields') { |
399 | 399 | $mysqli_result = mysqli_query( |
400 | 400 | $dbTmp, |
401 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'sharekeys_fields` ( |
|
401 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'sharekeys_fields` ( |
|
402 | 402 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
403 | 403 | `object_id` int(12) NOT NULL, |
404 | 404 | `user_id` int(12) NOT NULL, |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | } elseif ($task === 'sharekeys_suggestions') { |
410 | 410 | $mysqli_result = mysqli_query( |
411 | 411 | $dbTmp, |
412 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'sharekeys_suggestions` ( |
|
412 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'sharekeys_suggestions` ( |
|
413 | 413 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
414 | 414 | `object_id` int(12) NOT NULL, |
415 | 415 | `user_id` int(12) NOT NULL, |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | } elseif ($task === 'sharekeys_files') { |
421 | 421 | $mysqli_result = mysqli_query( |
422 | 422 | $dbTmp, |
423 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'sharekeys_files` ( |
|
423 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'sharekeys_files` ( |
|
424 | 424 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
425 | 425 | `object_id` int(12) NOT NULL, |
426 | 426 | `user_id` int(12) NOT NULL, |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | } elseif ($task === 'items') { |
432 | 432 | $mysqli_result = mysqli_query( |
433 | 433 | $dbTmp, |
434 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "items` ( |
|
434 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."items` ( |
|
435 | 435 | `id` int(12) NOT null AUTO_INCREMENT, |
436 | 436 | `label` varchar(500) NOT NULL, |
437 | 437 | `description` text DEFAULT NULL, |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | } elseif ($task === 'log_items') { |
465 | 465 | $mysqli_result = mysqli_query( |
466 | 466 | $dbTmp, |
467 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "log_items` ( |
|
467 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."log_items` ( |
|
468 | 468 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
469 | 469 | `id_item` int(8) NOT NULL, |
470 | 470 | `date` varchar(50) NOT NULL, |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | // create index |
480 | 480 | mysqli_query( |
481 | 481 | $dbTmp, |
482 | - 'CREATE INDEX teampass_log_items_id_item_IDX ON ' . $var['tbl_prefix'] . 'log_items (id_item,date);' |
|
482 | + 'CREATE INDEX teampass_log_items_id_item_IDX ON '.$var['tbl_prefix'].'log_items (id_item,date);' |
|
483 | 483 | ); |
484 | 484 | } elseif ($task === 'misc') { |
485 | 485 | $mysqli_result = mysqli_query( |
486 | 486 | $dbTmp, |
487 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'misc` ( |
|
487 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'misc` ( |
|
488 | 488 | `increment_id` int(12) NOT null AUTO_INCREMENT, |
489 | 489 | `type` varchar(50) NOT NULL, |
490 | 490 | `intitule` varchar(100) NOT NULL, |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | // prepare config file |
500 | 500 | $tp_config_file = '../includes/config/tp.config.php'; |
501 | 501 | if (file_exists($tp_config_file)) { |
502 | - if (!copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) { |
|
503 | - echo '[{"error" : "includes/config/tp.config.php file already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
502 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) { |
|
503 | + echo '[{"error" : "includes/config/tp.config.php file already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
504 | 504 | break; |
505 | 505 | } else { |
506 | 506 | unlink($tp_config_file); |
@@ -528,10 +528,10 @@ discard block |
||
528 | 528 | array('admin', 'manager_edit', '1'), |
529 | 529 | array('admin', 'cpassman_dir', $var['absolute_path']), |
530 | 530 | array('admin', 'cpassman_url', $var['url_path']), |
531 | - array('admin', 'favicon', $var['url_path'] . '/favicon.ico'), |
|
532 | - array('admin', 'path_to_upload_folder', $var['absolute_path'] . '/upload'), |
|
533 | - array('admin', 'path_to_files_folder', $var['absolute_path'] . '/files'), |
|
534 | - array('admin', 'url_to_files_folder', $var['url_path'] . '/files'), |
|
531 | + array('admin', 'favicon', $var['url_path'].'/favicon.ico'), |
|
532 | + array('admin', 'path_to_upload_folder', $var['absolute_path'].'/upload'), |
|
533 | + array('admin', 'path_to_files_folder', $var['absolute_path'].'/files'), |
|
534 | + array('admin', 'url_to_files_folder', $var['url_path'].'/files'), |
|
535 | 535 | array('admin', 'activate_expiration', '0'), |
536 | 536 | array('admin', 'pw_life_duration', '0'), |
537 | 537 | array('admin', 'maintenance_mode', '1'), |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | array('admin', 'duo', '0'), |
613 | 613 | array('admin', 'enable_server_password_change', '0'), |
614 | 614 | array('admin', 'ldap_object_class', '0'), |
615 | - array('admin', 'bck_script_path', $var['absolute_path'] . '/backups'), |
|
615 | + array('admin', 'bck_script_path', $var['absolute_path'].'/backups'), |
|
616 | 616 | array('admin', 'bck_script_filename', 'bck_teampass'), |
617 | 617 | array('admin', 'syslog_enable', '0'), |
618 | 618 | array('admin', 'syslog_host', 'localhost'), |
@@ -692,30 +692,30 @@ discard block |
||
692 | 692 | $tmp = mysqli_num_rows( |
693 | 693 | mysqli_query( |
694 | 694 | $dbTmp, |
695 | - "SELECT * FROM `" . $var['tbl_prefix'] . "misc` |
|
696 | - WHERE type='" . $elem[0] . "' AND intitule='" . $elem[1] . "'" |
|
695 | + "SELECT * FROM `".$var['tbl_prefix']."misc` |
|
696 | + WHERE type='" . $elem[0]."' AND intitule='".$elem[1]."'" |
|
697 | 697 | ) |
698 | 698 | ); |
699 | 699 | if (intval($tmp) === 0) { |
700 | 700 | $queryRes = mysqli_query( |
701 | 701 | $dbTmp, |
702 | - "INSERT INTO `" . $var['tbl_prefix'] . "misc` |
|
702 | + "INSERT INTO `".$var['tbl_prefix']."misc` |
|
703 | 703 | (`type`, `intitule`, `valeur`) VALUES |
704 | - ('" . $elem[0] . "', '" . $elem[1] . "', '" . |
|
705 | - str_replace("'", '', $elem[2]) . "');" |
|
704 | + ('" . $elem[0]."', '".$elem[1]."', '". |
|
705 | + str_replace("'", '', $elem[2])."');" |
|
706 | 706 | ); // or die(mysqli_error($dbTmp)) |
707 | 707 | } |
708 | 708 | |
709 | 709 | // append new setting in config file |
710 | 710 | $config_text .= " |
711 | - '" . $elem[1] . "' => '" . str_replace("'", '', $elem[2]) . "',"; |
|
711 | + '" . $elem[1]."' => '".str_replace("'", '', $elem[2])."',"; |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | // write to config file |
715 | 715 | $result = fwrite( |
716 | 716 | $file_handler, |
717 | 717 | utf8_encode( |
718 | - $config_text . ' |
|
718 | + $config_text.' |
|
719 | 719 | );' |
720 | 720 | ) |
721 | 721 | ); |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | } elseif ($task === 'nested_tree') { |
726 | 726 | $mysqli_result = mysqli_query( |
727 | 727 | $dbTmp, |
728 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "nested_tree` ( |
|
728 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."nested_tree` ( |
|
729 | 729 | `id` bigint(20) unsigned NOT null AUTO_INCREMENT, |
730 | 730 | `parent_id` int(11) NOT NULL, |
731 | 731 | `title` varchar(255) NOT NULL, |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | } elseif ($task === 'rights') { |
754 | 754 | $mysqli_result = mysqli_query( |
755 | 755 | $dbTmp, |
756 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "rights` ( |
|
756 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."rights` ( |
|
757 | 757 | `id` int(12) NOT null AUTO_INCREMENT, |
758 | 758 | `tree_id` int(12) NOT NULL, |
759 | 759 | `fonction_id` int(12) NOT NULL, |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | } elseif ($task === 'users') { |
765 | 765 | $mysqli_result = mysqli_query( |
766 | 766 | $dbTmp, |
767 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "users` ( |
|
767 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."users` ( |
|
768 | 768 | `id` int(12) NOT null AUTO_INCREMENT, |
769 | 769 | `login` varchar(500) NOT NULL, |
770 | 770 | `pw` varchar(400) NOT NULL, |
@@ -828,37 +828,37 @@ discard block |
||
828 | 828 | |
829 | 829 | require_once '../includes/config/include.php'; |
830 | 830 | // check that admin accounts doesn't exist |
831 | - $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `" . $var['tbl_prefix'] . "users` WHERE login = 'admin'")); |
|
831 | + $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `".$var['tbl_prefix']."users` WHERE login = 'admin'")); |
|
832 | 832 | if ($tmp === 0) { |
833 | 833 | $mysqli_result = mysqli_query( |
834 | 834 | $dbTmp, |
835 | - "INSERT INTO `" . $var['tbl_prefix'] . "users` (`id`, `login`, `pw`, `admin`, `gestionnaire`, `personal_folder`, `groupes_visibles`, `email`, `encrypted_psk`, `last_pw_change`, `name`, `lastname`, `can_create_root_folder`, `public_key`, `private_key`, `is_ready_for_usage`, `otp_provided`) VALUES ('1', 'admin', '" . bCrypt($var['admin_pwd'], '13') . "', '1', '0', '0', '0', '" . $var['admin_email'] . "', '', '" . time() . "', 'Change me', 'Change me', '1', 'none', 'none', '1', '1')" |
|
835 | + "INSERT INTO `".$var['tbl_prefix']."users` (`id`, `login`, `pw`, `admin`, `gestionnaire`, `personal_folder`, `groupes_visibles`, `email`, `encrypted_psk`, `last_pw_change`, `name`, `lastname`, `can_create_root_folder`, `public_key`, `private_key`, `is_ready_for_usage`, `otp_provided`) VALUES ('1', 'admin', '".bCrypt($var['admin_pwd'], '13')."', '1', '0', '0', '0', '".$var['admin_email']."', '', '".time()."', 'Change me', 'Change me', '1', 'none', 'none', '1', '1')" |
|
836 | 836 | ); |
837 | 837 | } else { |
838 | - $mysqli_result = mysqli_query($dbTmp, 'UPDATE `' . $var['tbl_prefix'] . "users` SET `pw` = '" . bCrypt($var['admin_pwd'], '13') . "' WHERE login = 'admin' AND id = '1'"); |
|
838 | + $mysqli_result = mysqli_query($dbTmp, 'UPDATE `'.$var['tbl_prefix']."users` SET `pw` = '".bCrypt($var['admin_pwd'], '13')."' WHERE login = 'admin' AND id = '1'"); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | // check that API doesn't exist |
842 | - $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `" . $var['tbl_prefix'] . "users` WHERE id = '" . API_USER_ID . "'")); |
|
842 | + $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `".$var['tbl_prefix']."users` WHERE id = '".API_USER_ID."'")); |
|
843 | 843 | if ($tmp === 0) { |
844 | 844 | $mysqli_result = mysqli_query( |
845 | 845 | $dbTmp, |
846 | - "INSERT INTO `" . $var['tbl_prefix'] . "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`, `is_ready_for_usage`, `otp_provided`) VALUES ('" . API_USER_ID . "', 'API', '', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '0', '1')" |
|
846 | + "INSERT INTO `".$var['tbl_prefix']."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`, `is_ready_for_usage`, `otp_provided`) VALUES ('".API_USER_ID."', 'API', '', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '0', '1')" |
|
847 | 847 | ); |
848 | 848 | } |
849 | 849 | |
850 | 850 | // check that OTV doesn't exist |
851 | - $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `" . $var['tbl_prefix'] . "users` WHERE id = '" . OTV_USER_ID . "'")); |
|
851 | + $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `".$var['tbl_prefix']."users` WHERE id = '".OTV_USER_ID."'")); |
|
852 | 852 | if ($tmp === 0) { |
853 | 853 | $mysqli_result = mysqli_query( |
854 | 854 | $dbTmp, |
855 | - "INSERT INTO `" . $var['tbl_prefix'] . "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`, `is_ready_for_usage`, `otp_provided`) VALUES ('" . OTV_USER_ID . "', 'OTV', '', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '0', '1')" |
|
855 | + "INSERT INTO `".$var['tbl_prefix']."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`, `is_ready_for_usage`, `otp_provided`) VALUES ('".OTV_USER_ID."', 'OTV', '', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '0', '1')" |
|
856 | 856 | ); |
857 | 857 | } |
858 | 858 | } elseif ($task === 'tags') { |
859 | 859 | $mysqli_result = mysqli_query( |
860 | 860 | $dbTmp, |
861 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'tags` ( |
|
861 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'tags` ( |
|
862 | 862 | `id` int(12) NOT null AUTO_INCREMENT, |
863 | 863 | `tag` varchar(30) NOT NULL, |
864 | 864 | `item_id` int(12) NOT NULL, |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | } elseif ($task === 'log_system') { |
869 | 869 | $mysqli_result = mysqli_query( |
870 | 870 | $dbTmp, |
871 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'log_system` ( |
|
871 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'log_system` ( |
|
872 | 872 | `id` int(12) NOT null AUTO_INCREMENT, |
873 | 873 | `type` varchar(20) NOT NULL, |
874 | 874 | `date` varchar(30) NOT NULL, |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | } elseif ($task === 'files') { |
882 | 882 | $mysqli_result = mysqli_query( |
883 | 883 | $dbTmp, |
884 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "files` ( |
|
884 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."files` ( |
|
885 | 885 | `id` int(11) NOT null AUTO_INCREMENT, |
886 | 886 | `id_item` int(11) NOT NULL, |
887 | 887 | `name` TEXT NOT NULL, |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | } elseif ($task === 'cache') { |
899 | 899 | $mysqli_result = mysqli_query( |
900 | 900 | $dbTmp, |
901 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "cache` ( |
|
901 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."cache` ( |
|
902 | 902 | `increment_id`INT(12) NOT NULL AUTO_INCREMENT, |
903 | 903 | `id` int(12) NOT NULL, |
904 | 904 | `label` varchar(500) NOT NULL, |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | } elseif ($task === 'roles_title') { |
921 | 921 | $mysqli_result = mysqli_query( |
922 | 922 | $dbTmp, |
923 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "roles_title` ( |
|
923 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."roles_title` ( |
|
924 | 924 | `id` int(12) NOT null AUTO_INCREMENT, |
925 | 925 | `title` varchar(50) NOT NULL, |
926 | 926 | `allow_pw_change` TINYINT(1) NOT null DEFAULT '0', |
@@ -931,17 +931,17 @@ discard block |
||
931 | 931 | ); |
932 | 932 | |
933 | 933 | // create Default role |
934 | - $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `" . $var['tbl_prefix'] . "roles_title` WHERE id = '0'")); |
|
934 | + $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `".$var['tbl_prefix']."roles_title` WHERE id = '0'")); |
|
935 | 935 | if ($tmp === 0) { |
936 | 936 | $mysqli_result = mysqli_query( |
937 | 937 | $dbTmp, |
938 | - "INSERT INTO `" . $var['tbl_prefix'] . "roles_title` (`id`, `title`, `allow_pw_change`, `complexity`, `creator_id`) VALUES (NULL, 'Default', '0', '48', '0')" |
|
938 | + "INSERT INTO `".$var['tbl_prefix']."roles_title` (`id`, `title`, `allow_pw_change`, `complexity`, `creator_id`) VALUES (NULL, 'Default', '0', '48', '0')" |
|
939 | 939 | ); |
940 | 940 | } |
941 | 941 | } elseif ($task === 'roles_values') { |
942 | 942 | $mysqli_result = mysqli_query( |
943 | 943 | $dbTmp, |
944 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "roles_values` ( |
|
944 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."roles_values` ( |
|
945 | 945 | `increment_id` int(12) NOT NULL AUTO_INCREMENT PRIMARY KEY, |
946 | 946 | `role_id` int(12) NOT NULL, |
947 | 947 | `folder_id` int(12) NOT NULL, |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | } elseif ($task === 'kb') { |
953 | 953 | $mysqli_result = mysqli_query( |
954 | 954 | $dbTmp, |
955 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "kb` ( |
|
955 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."kb` ( |
|
956 | 956 | `id` int(12) NOT null AUTO_INCREMENT, |
957 | 957 | `category_id` int(12) NOT NULL, |
958 | 958 | `label` varchar(200) NOT NULL, |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | } elseif ($task === 'kb_categories') { |
966 | 966 | $mysqli_result = mysqli_query( |
967 | 967 | $dbTmp, |
968 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'kb_categories` ( |
|
968 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'kb_categories` ( |
|
969 | 969 | `id` int(12) NOT null AUTO_INCREMENT, |
970 | 970 | `category` varchar(50) NOT NULL, |
971 | 971 | PRIMARY KEY (`id`) |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | } elseif ($task === 'kb_items') { |
975 | 975 | $mysqli_result = mysqli_query( |
976 | 976 | $dbTmp, |
977 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'kb_items` ( |
|
977 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'kb_items` ( |
|
978 | 978 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
979 | 979 | `kb_id` int(12) NOT NULL, |
980 | 980 | `item_id` int(12) NOT NULL, |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | } elseif ($task == 'restriction_to_roles') { |
985 | 985 | $mysqli_result = mysqli_query( |
986 | 986 | $dbTmp, |
987 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'restriction_to_roles` ( |
|
987 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'restriction_to_roles` ( |
|
988 | 988 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
989 | 989 | `role_id` int(12) NOT NULL, |
990 | 990 | `item_id` int(12) NOT NULL, |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | } elseif ($task === 'languages') { |
995 | 995 | $mysqli_result = mysqli_query( |
996 | 996 | $dbTmp, |
997 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'languages` ( |
|
997 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'languages` ( |
|
998 | 998 | `id` INT(10) NOT null AUTO_INCREMENT, |
999 | 999 | `name` VARCHAR(50) NOT null , |
1000 | 1000 | `label` VARCHAR(50) NOT null , |
@@ -1006,11 +1006,11 @@ discard block |
||
1006 | 1006 | ); |
1007 | 1007 | |
1008 | 1008 | // add lanaguages |
1009 | - $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `" . $var['tbl_prefix'] . "languages` WHERE name = 'french'")); |
|
1009 | + $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `".$var['tbl_prefix']."languages` WHERE name = 'french'")); |
|
1010 | 1010 | if ($tmp === 0) { |
1011 | 1011 | $mysql_result = mysqli_query( |
1012 | 1012 | $dbTmp, |
1013 | - "INSERT INTO `" . $var['tbl_prefix'] . "languages` (`id`, `name`, `label`, `code`, `flag`, `code_poeditor`) VALUES |
|
1013 | + "INSERT INTO `".$var['tbl_prefix']."languages` (`id`, `name`, `label`, `code`, `flag`, `code_poeditor`) VALUES |
|
1014 | 1014 | (1, 'french', 'French', 'fr', 'fr.png', 'fr'), |
1015 | 1015 | (2, 'english', 'English', 'us', 'us.png', 'en'), |
1016 | 1016 | (3, 'spanish', 'Spanish', 'es', 'es.png', 'es'), |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | } elseif ($task === 'emails') { |
1041 | 1041 | $mysqli_result = mysqli_query( |
1042 | 1042 | $dbTmp, |
1043 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'emails` ( |
|
1043 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'emails` ( |
|
1044 | 1044 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1045 | 1045 | `timestamp` INT(30) NOT null , |
1046 | 1046 | `subject` TEXT NOT null , |
@@ -1053,7 +1053,7 @@ discard block |
||
1053 | 1053 | } elseif ($task === 'automatic_del') { |
1054 | 1054 | $mysqli_result = mysqli_query( |
1055 | 1055 | $dbTmp, |
1056 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'automatic_del` ( |
|
1056 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'automatic_del` ( |
|
1057 | 1057 | `item_id` int(11) NOT NULL, |
1058 | 1058 | `del_enabled` tinyint(1) NOT NULL, |
1059 | 1059 | `del_type` tinyint(1) NOT NULL, |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | } elseif ($task === 'items_edition') { |
1065 | 1065 | $mysqli_result = mysqli_query( |
1066 | 1066 | $dbTmp, |
1067 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'items_edition` ( |
|
1067 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'items_edition` ( |
|
1068 | 1068 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1069 | 1069 | `item_id` int(11) NOT NULL, |
1070 | 1070 | `user_id` int(12) NOT NULL, |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | } elseif ($task === 'categories') { |
1077 | 1077 | $mysqli_result = mysqli_query( |
1078 | 1078 | $dbTmp, |
1079 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "categories` ( |
|
1079 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."categories` ( |
|
1080 | 1080 | `id` int(12) NOT NULL AUTO_INCREMENT, |
1081 | 1081 | `parent_id` int(12) NOT NULL, |
1082 | 1082 | `title` varchar(255) NOT NULL, |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | } elseif ($task === 'categories_items') { |
1096 | 1096 | $mysqli_result = mysqli_query( |
1097 | 1097 | $dbTmp, |
1098 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "categories_items` ( |
|
1098 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."categories_items` ( |
|
1099 | 1099 | `id` int(12) NOT NULL AUTO_INCREMENT, |
1100 | 1100 | `field_id` int(11) NOT NULL, |
1101 | 1101 | `item_id` int(11) NOT NULL, |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | } elseif ($task === 'categories_folders') { |
1110 | 1110 | $mysqli_result = mysqli_query( |
1111 | 1111 | $dbTmp, |
1112 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'categories_folders` ( |
|
1112 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'categories_folders` ( |
|
1113 | 1113 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1114 | 1114 | `id_category` int(12) NOT NULL, |
1115 | 1115 | `id_folder` int(12) NOT NULL, |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | } elseif ($task === 'api') { |
1120 | 1120 | $mysqli_result = mysqli_query( |
1121 | 1121 | $dbTmp, |
1122 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'api` ( |
|
1122 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'api` ( |
|
1123 | 1123 | `increment_id` int(20) NOT NULL AUTO_INCREMENT, |
1124 | 1124 | `type` varchar(15) NOT NULL, |
1125 | 1125 | `label` varchar(255) DEFAULT NULL, |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | } elseif ($task === 'otv') { |
1134 | 1134 | $mysqli_result = mysqli_query( |
1135 | 1135 | $dbTmp, |
1136 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "otv` ( |
|
1136 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."otv` ( |
|
1137 | 1137 | `id` int(10) NOT NULL AUTO_INCREMENT, |
1138 | 1138 | `timestamp` text NOT NULL, |
1139 | 1139 | `code` varchar(100) NOT NULL, |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | } elseif ($task === 'suggestion') { |
1151 | 1151 | $mysqli_result = mysqli_query( |
1152 | 1152 | $dbTmp, |
1153 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "suggestion` ( |
|
1153 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."suggestion` ( |
|
1154 | 1154 | `id` tinyint(12) NOT NULL AUTO_INCREMENT, |
1155 | 1155 | `label` varchar(255) NOT NULL, |
1156 | 1156 | `pw` text NOT NULL, |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | |
1169 | 1169 | $mysqli_result = mysqli_query( |
1170 | 1170 | $dbTmp, |
1171 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "export` ( |
|
1171 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."export` ( |
|
1172 | 1172 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1173 | 1173 | `export_tag` varchar(20) NOT NULL, |
1174 | 1174 | `item_id` int(12) NOT NULL, |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | } elseif ($task === 'tokens') { |
1191 | 1191 | $mysqli_result = mysqli_query( |
1192 | 1192 | $dbTmp, |
1193 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'tokens` ( |
|
1193 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'tokens` ( |
|
1194 | 1194 | `id` int(12) NOT NULL AUTO_INCREMENT, |
1195 | 1195 | `user_id` int(12) NOT NULL, |
1196 | 1196 | `token` varchar(255) NOT NULL, |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | } elseif ($task === 'items_change') { |
1204 | 1204 | $mysqli_result = mysqli_query( |
1205 | 1205 | $dbTmp, |
1206 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "items_change` ( |
|
1206 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."items_change` ( |
|
1207 | 1207 | `id` int(12) NOT NULL AUTO_INCREMENT, |
1208 | 1208 | `item_id` int(12) NOT NULL, |
1209 | 1209 | `label` varchar(255) NOT NULL DEFAULT 'none', |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | } elseif ($task === 'templates') { |
1223 | 1223 | $mysqli_result = mysqli_query( |
1224 | 1224 | $dbTmp, |
1225 | - 'CREATE TABLE IF NOT EXISTS `' . $var['tbl_prefix'] . 'templates` ( |
|
1225 | + 'CREATE TABLE IF NOT EXISTS `'.$var['tbl_prefix'].'templates` ( |
|
1226 | 1226 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1227 | 1227 | `item_id` int(12) NOT NULL, |
1228 | 1228 | `category_id` int(12) NOT NULL, |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | } elseif ($task === 'cache_tree') { |
1233 | 1233 | $mysqli_result = mysqli_query( |
1234 | 1234 | $dbTmp, |
1235 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "cache_tree` ( |
|
1235 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."cache_tree` ( |
|
1236 | 1236 | `increment_id` smallint(32) NOT NULL AUTO_INCREMENT, |
1237 | 1237 | `data` longtext DEFAULT NULL CHECK (json_valid(`data`)), |
1238 | 1238 | `visible_folders` longtext NOT NULL, |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | } else if ($task === 'processes_tasks') { |
1246 | 1246 | $mysqli_result = mysqli_query( |
1247 | 1247 | $dbTmp, |
1248 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "processes_tasks` ( |
|
1248 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."processes_tasks` ( |
|
1249 | 1249 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1250 | 1250 | `process_id` int(12) NOT NULL, |
1251 | 1251 | `created_at` varchar(50) NOT NULL, |
@@ -1260,13 +1260,13 @@ discard block |
||
1260 | 1260 | ); |
1261 | 1261 | $mysqli_result = mysqli_query( |
1262 | 1262 | $dbTmp, |
1263 | - 'ALTER TABLE `' . $var['tbl_prefix'] . 'processes_tasks` |
|
1263 | + 'ALTER TABLE `'.$var['tbl_prefix'].'processes_tasks` |
|
1264 | 1264 | ADD KEY `process_id_idx` (`process_id`);' |
1265 | 1265 | ); |
1266 | 1266 | } else if ($task === 'processes') { |
1267 | 1267 | $mysqli_result = mysqli_query( |
1268 | 1268 | $dbTmp, |
1269 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "processes` ( |
|
1269 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."processes` ( |
|
1270 | 1270 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1271 | 1271 | `created_at` varchar(50) NOT NULL, |
1272 | 1272 | `started_at` varchar(50) DEFAULT NULL, |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | } else if ($task === 'processes_logs') { |
1285 | 1285 | $mysqli_result = mysqli_query( |
1286 | 1286 | $dbTmp, |
1287 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "processes_logs` ( |
|
1287 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."processes_logs` ( |
|
1288 | 1288 | `increment_id` int(12) NOT NULL AUTO_INCREMENT, |
1289 | 1289 | `created_at` varchar(20) NOT NULL, |
1290 | 1290 | `job` varchar(50) NOT NULL, |
@@ -1298,7 +1298,7 @@ discard block |
||
1298 | 1298 | } else if ($task === 'ldap_groups_roles') { |
1299 | 1299 | $mysqli_result = mysqli_query( |
1300 | 1300 | $dbTmp, |
1301 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "ldap_groups_roles` ( |
|
1301 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."ldap_groups_roles` ( |
|
1302 | 1302 | `increment_id` INT(12) NOT NULL AUTO_INCREMENT, |
1303 | 1303 | `role_id` INT(12) NOT NULL, |
1304 | 1304 | `ldap_group_id` VARCHAR(500) NOT NULL, |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | } else if ($task === 'items_otp') { |
1311 | 1311 | $mysqli_result = mysqli_query( |
1312 | 1312 | $dbTmp, |
1313 | - "CREATE TABLE IF NOT EXISTS `" . $var['tbl_prefix'] . "items_otp` ( |
|
1313 | + "CREATE TABLE IF NOT EXISTS `".$var['tbl_prefix']."items_otp` ( |
|
1314 | 1314 | `increment_id` int(12) NOT NULL, |
1315 | 1315 | `item_id` int(12) NOT NULL, |
1316 | 1316 | `secret` text NOT NULL, |
@@ -1328,12 +1328,12 @@ discard block |
||
1328 | 1328 | } |
1329 | 1329 | // answer back |
1330 | 1330 | if ($mysqli_result) { |
1331 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '", "task" : "' . $task . '", "activity" : "' . $activity . '"}]'; |
|
1331 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'", "task" : "'.$task.'", "activity" : "'.$activity.'"}]'; |
|
1332 | 1332 | } else { |
1333 | - echo '[{"error" : "' . addslashes(str_replace(array("'", "\n", "\r"), array('"', '', ''), mysqli_error($dbTmp))) . '", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '", "table" : "' . $task . '"}]'; |
|
1333 | + echo '[{"error" : "'.addslashes(str_replace(array("'", "\n", "\r"), array('"', '', ''), mysqli_error($dbTmp))).'", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'", "table" : "'.$task.'"}]'; |
|
1334 | 1334 | } |
1335 | 1335 | } else { |
1336 | - echo '[{"error" : "' . addslashes(str_replace(array("'", "\n", "\r"), array('"', '', ''), mysqli_connect_error())) . '", "result" : "Failed", "multiple" : ""}]'; |
|
1336 | + echo '[{"error" : "'.addslashes(str_replace(array("'", "\n", "\r"), array('"', '', ''), mysqli_connect_error())).'", "result" : "Failed", "multiple" : ""}]'; |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | mysqli_close($dbTmp); |
@@ -1383,11 +1383,11 @@ discard block |
||
1383 | 1383 | // 0- check if exists |
1384 | 1384 | $filesecure = generateRandomKey(); |
1385 | 1385 | define('SECUREFILE', $filesecure); |
1386 | - $filename_seckey = $securePath . '/' . $filesecure; |
|
1386 | + $filename_seckey = $securePath.'/'.$filesecure; |
|
1387 | 1387 | |
1388 | 1388 | if (file_exists($filename_seckey)) { |
1389 | - if (!copy($filename_seckey, $filename_seckey . '.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) { |
|
1390 | - echo '[{"error" : "File `'.$filename_seckey.'` already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1389 | + if (!copy($filename_seckey, $filename_seckey.'.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) { |
|
1390 | + echo '[{"error" : "File `'.$filename_seckey.'` already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1391 | 1391 | break; |
1392 | 1392 | } else { |
1393 | 1393 | unlink($filename); |
@@ -1408,8 +1408,8 @@ discard block |
||
1408 | 1408 | $filename = '../includes/config/settings.php'; |
1409 | 1409 | |
1410 | 1410 | if (file_exists($filename)) { |
1411 | - if (!copy($filename, $filename . '.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) { |
|
1412 | - echo '[{"error" : "Setting.php file already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1411 | + if (!copy($filename, $filename.'.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) { |
|
1412 | + echo '[{"error" : "Setting.php file already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1413 | 1413 | break; |
1414 | 1414 | } else { |
1415 | 1415 | unlink($filename); |
@@ -1429,13 +1429,13 @@ discard block |
||
1429 | 1429 | utf8_encode( |
1430 | 1430 | '<?php |
1431 | 1431 | // DATABASE connexion parameters |
1432 | -define("DB_HOST", "' . $db['db_host'] . '"); |
|
1433 | -define("DB_USER", "' . $db['db_login'] . '"); |
|
1434 | -define("DB_PASSWD", "' . str_replace('$', '\$', $encrypted_text) . '"); |
|
1435 | -define("DB_NAME", "' . $db['db_bdd'] . '"); |
|
1436 | -define("DB_PREFIX", "' . $var['tbl_prefix'] . '"); |
|
1437 | -define("DB_PORT", "' . $db['db_port'] . '"); |
|
1438 | -define("DB_ENCODING", "' . $session_db_encoding . '"); |
|
1432 | +define("DB_HOST", "' . $db['db_host'].'"); |
|
1433 | +define("DB_USER", "' . $db['db_login'].'"); |
|
1434 | +define("DB_PASSWD", "' . str_replace('$', '\$', $encrypted_text).'"); |
|
1435 | +define("DB_NAME", "' . $db['db_bdd'].'"); |
|
1436 | +define("DB_PREFIX", "' . $var['tbl_prefix'].'"); |
|
1437 | +define("DB_PORT", "' . $db['db_port'].'"); |
|
1438 | +define("DB_ENCODING", "' . $session_db_encoding.'"); |
|
1439 | 1439 | define("DB_SSL", false); // if DB over SSL then comment this line |
1440 | 1440 | // if DB over SSL then uncomment the following lines |
1441 | 1441 | //define("DB_SSL", array( |
@@ -1448,8 +1448,8 @@ discard block |
||
1448 | 1448 | define("DB_CONNECT_OPTIONS", array( |
1449 | 1449 | MYSQLI_OPT_CONNECT_TIMEOUT => 10 |
1450 | 1450 | )); |
1451 | -define("SECUREPATH", "' . $securePath . '"); |
|
1452 | -define("SECUREFILE", "' . $filesecure. '"); |
|
1451 | +define("SECUREPATH", "' . $securePath.'"); |
|
1452 | +define("SECUREFILE", "' . $filesecure.'"); |
|
1453 | 1453 | |
1454 | 1454 | if (isset($_SESSION[\'settings\'][\'timezone\']) === true) { |
1455 | 1455 | date_default_timezone_set($_SESSION[\'settings\'][\'timezone\']); |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | |
1462 | 1462 | // Create TP USER |
1463 | 1463 | require_once '../includes/config/include.php'; |
1464 | - $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `" . $var['tbl_prefix'] . "users` WHERE id = '" . TP_USER_ID . "'")); |
|
1464 | + $tmp = mysqli_num_rows(mysqli_query($dbTmp, "SELECT * FROM `".$var['tbl_prefix']."users` WHERE id = '".TP_USER_ID."'")); |
|
1465 | 1465 | if ($tmp === 0) { |
1466 | 1466 | // generate key for password |
1467 | 1467 | $pwd = GenerateCryptKey(25, true, true, true, true); |
@@ -1476,14 +1476,14 @@ discard block |
||
1476 | 1476 | |
1477 | 1477 | $mysqli_result = mysqli_query( |
1478 | 1478 | $dbTmp, |
1479 | - "INSERT INTO `" . $var['tbl_prefix'] . "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`, `is_ready_for_usage`, `otp_provided`) VALUES ('" . TP_USER_ID . "', 'TP', '".$encrypted_pwd."', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '".$userKeys['public_key']."', '".$userKeys['private_key']."', '1', '1')" |
|
1479 | + "INSERT INTO `".$var['tbl_prefix']."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`, `is_ready_for_usage`, `otp_provided`) VALUES ('".TP_USER_ID."', 'TP', '".$encrypted_pwd."', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '".$userKeys['public_key']."', '".$userKeys['private_key']."', '1', '1')" |
|
1480 | 1480 | ); |
1481 | 1481 | } |
1482 | 1482 | |
1483 | 1483 | if ($result === false) { |
1484 | - echo '[{"error" : "Setting.php file could not be created. Please check the path and the rights", "result":"", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1484 | + echo '[{"error" : "Setting.php file could not be created. Please check the path and the rights", "result":"", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1485 | 1485 | } else { |
1486 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1486 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1487 | 1487 | } |
1488 | 1488 | } elseif ($task === 'security') { |
1489 | 1489 | // Sort out the file permissions |
@@ -1494,26 +1494,26 @@ discard block |
||
1494 | 1494 | if (is_null($session_abspath) === false) { |
1495 | 1495 | $result = recursiveChmod($session_abspath, 0770, 0740); |
1496 | 1496 | if ($result) { |
1497 | - $result = recursiveChmod($session_abspath . '/files', 0770, 0770); |
|
1497 | + $result = recursiveChmod($session_abspath.'/files', 0770, 0770); |
|
1498 | 1498 | } |
1499 | 1499 | if ($result) { |
1500 | - $result = recursiveChmod($session_abspath . '/upload', 0770, 0770); |
|
1500 | + $result = recursiveChmod($session_abspath.'/upload', 0770, 0770); |
|
1501 | 1501 | } |
1502 | 1502 | } |
1503 | 1503 | } |
1504 | 1504 | $result = true; |
1505 | 1505 | if ($result === false) { |
1506 | - echo '[{"error" : "Cannot change directory permissions - please fix manually", "result":"", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1506 | + echo '[{"error" : "Cannot change directory permissions - please fix manually", "result":"", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1507 | 1507 | } else { |
1508 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1508 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1509 | 1509 | } |
1510 | 1510 | } elseif ($task === 'csrfp-token') { |
1511 | 1511 | // update CSRFP TOKEN |
1512 | 1512 | $csrfp_file_sample = '../includes/libraries/csrfp/libs/csrfp.config.sample.php'; |
1513 | 1513 | $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php'; |
1514 | 1514 | if (file_exists($csrfp_file)) { |
1515 | - if (!copy($csrfp_file, $csrfp_file . '.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) { |
|
1516 | - echo '[{"error" : "csrfp.config.php file already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1515 | + if (!copy($csrfp_file, $csrfp_file.'.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))))) { |
|
1516 | + echo '[{"error" : "csrfp.config.php file already exists and cannot be renamed. Please do it by yourself and click on button Launch.", "result":"", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1517 | 1517 | break; |
1518 | 1518 | } else { |
1519 | 1519 | $events .= "The file $csrfp_file already exist. A copy has been created.<br />"; |
@@ -1522,21 +1522,21 @@ discard block |
||
1522 | 1522 | unlink($csrfp_file); // delete existing csrfp.config file |
1523 | 1523 | copy($csrfp_file_sample, $csrfp_file); // make a copy of csrfp.config.sample file |
1524 | 1524 | $data = file_get_contents($csrfp_file); |
1525 | - $newdata = str_replace('"CSRFP_TOKEN" => ""', '"CSRFP_TOKEN" => "' . bin2hex(openssl_random_pseudo_bytes(25)) . '"', $data); |
|
1526 | - $jsUrl = $data_sent['url_path'] . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
1527 | - $newdata = str_replace('"jsUrl" => ""', '"jsUrl" => "' . $jsUrl . '"', $newdata); |
|
1525 | + $newdata = str_replace('"CSRFP_TOKEN" => ""', '"CSRFP_TOKEN" => "'.bin2hex(openssl_random_pseudo_bytes(25)).'"', $data); |
|
1526 | + $jsUrl = $data_sent['url_path'].'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
1527 | + $newdata = str_replace('"jsUrl" => ""', '"jsUrl" => "'.$jsUrl.'"', $newdata); |
|
1528 | 1528 | file_put_contents('../includes/libraries/csrfp/libs/csrfp.config.php', $newdata); |
1529 | 1529 | |
1530 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1530 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1531 | 1531 | } |
1532 | 1532 | } elseif ($activity === 'install') { |
1533 | 1533 | if ($task === 'cleanup') { |
1534 | 1534 | // Mark a tag to force Install stuff (folders, files and table) to be cleanup while first login |
1535 | - mysqli_query($dbTmp, "INSERT INTO `" . $var['tbl_prefix'] . "misc` (`type`, `intitule`, `valeur`) VALUES ('install', 'clear_install_folder', 'true')"); |
|
1535 | + mysqli_query($dbTmp, "INSERT INTO `".$var['tbl_prefix']."misc` (`type`, `intitule`, `valeur`) VALUES ('install', 'clear_install_folder', 'true')"); |
|
1536 | 1536 | |
1537 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1537 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1538 | 1538 | } elseif ($task === 'init') { |
1539 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1539 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1540 | 1540 | } elseif ($task === 'cronJob') { |
1541 | 1541 | // Create cronjob |
1542 | 1542 | // get php location |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | ->setDayOfMonth('*') |
1557 | 1557 | ->setMonths('*') |
1558 | 1558 | ->setDayOfWeek('*') |
1559 | - ->setTaskCommandLine($phpLocation . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php') |
|
1559 | + ->setTaskCommandLine($phpLocation.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php') |
|
1560 | 1560 | ->setComments('Teampass scheduler'); |
1561 | 1561 | |
1562 | 1562 | $crontabRepository->addJob($crontabJob); |
@@ -1566,9 +1566,9 @@ discard block |
||
1566 | 1566 | // do nothing |
1567 | 1567 | } |
1568 | 1568 | } else { |
1569 | - echo '[{"error" : "Cannot find PHP binary location. Please add a cronjob manually (see documentation).", "result":"", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1569 | + echo '[{"error" : "Cannot find PHP binary location. Please add a cronjob manually (see documentation).", "result":"", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1570 | 1570 | } |
1571 | - echo '[{"error" : "", "index" : "' . $post_index . '", "multiple" : "' . $post_multiple . '"}]'; |
|
1571 | + echo '[{"error" : "", "index" : "'.$post_index.'", "multiple" : "'.$post_multiple.'"}]'; |
|
1572 | 1572 | } |
1573 | 1573 | } |
1574 | 1574 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ) { |
69 | 69 | // Not allowed page |
70 | 70 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
71 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
71 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
72 | 72 | exit; |
73 | 73 | } |
74 | 74 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $antiXss = new AntiXSS(); |
91 | 91 | |
92 | 92 | // User's language loading |
93 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php'; |
|
93 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php'; |
|
94 | 94 | |
95 | 95 | // Prepare POST variables |
96 | 96 | $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT); |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | 'SELECT i.id as id, i.id_tree as id_tree, i.restricted_to as restricted_to, i.perso as perso, |
142 | 142 | i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url, |
143 | 143 | i.email as email,l.date as date, i.pw_iv as pw_iv,n.renewal_period as renewal_period |
144 | - FROM ' . prefixTable('items') . ' as i |
|
145 | - INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id) |
|
146 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item) |
|
144 | + FROM ' . prefixTable('items').' as i |
|
145 | + INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id) |
|
146 | + INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item) |
|
147 | 147 | WHERE i.inactif = %i |
148 | 148 | AND i.id_tree= %i |
149 | 149 | AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s)) |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | // Run query |
167 | 167 | $dataItem = DB::queryfirstrow( |
168 | 168 | 'SELECT i.pw AS pw, s.share_key AS share_key |
169 | - FROM ' . prefixTable('items') . ' AS i |
|
170 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
169 | + FROM ' . prefixTable('items').' AS i |
|
170 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
171 | 171 | WHERE user_id = %i AND i.id = %i', |
172 | 172 | $session->get('user-id'), |
173 | 173 | $record['id'] |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | $arr_kbs = []; |
192 | 192 | $rows_kb = DB::query( |
193 | 193 | 'SELECT b.label, b.id |
194 | - FROM ' . prefixTable('kb_items') . ' AS a |
|
195 | - INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id) |
|
194 | + FROM ' . prefixTable('kb_items').' AS a |
|
195 | + INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id) |
|
196 | 196 | WHERE a.item_id = %i', |
197 | 197 | $record['id'] |
198 | 198 | ); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $arr_tags = []; |
205 | 205 | $rows_tag = DB::query( |
206 | 206 | 'SELECT tag |
207 | - FROM ' . prefixTable('tags') . ' |
|
207 | + FROM ' . prefixTable('tags').' |
|
208 | 208 | WHERE item_id = %i', |
209 | 209 | $record['id'] |
210 | 210 | ); |
@@ -216,18 +216,18 @@ discard block |
||
216 | 216 | $arr_trees = []; |
217 | 217 | $rows_child_tree = DB::query( |
218 | 218 | 'SELECT t.id, t.title |
219 | - FROM ' . prefixTable('nested_tree') . ' AS t |
|
220 | - INNER JOIN ' . prefixTable('items') . ' AS i ON (t.id = i.id_tree) |
|
219 | + FROM ' . prefixTable('nested_tree').' AS t |
|
220 | + INNER JOIN ' . prefixTable('items').' AS i ON (t.id = i.id_tree) |
|
221 | 221 | WHERE i.id = %i', |
222 | 222 | $record['id'] |
223 | 223 | ); |
224 | 224 | foreach ($rows_child_tree as $rec_child_tree) { |
225 | 225 | $stack = array(); |
226 | 226 | $parent = $rec_child_tree['id']; |
227 | - while($parent != 0){ |
|
227 | + while ($parent != 0) { |
|
228 | 228 | $rows_parent_tree = DB::query( |
229 | 229 | 'SELECT parent_id, title |
230 | - FROM ' . prefixTable('nested_tree') . ' |
|
230 | + FROM ' . prefixTable('nested_tree').' |
|
231 | 231 | WHERE id = %i', |
232 | 232 | $parent |
233 | 233 | ); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | // Prepare variables |
315 | 315 | $post_export_tag = filter_var($dataReceived['export_tag'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
316 | 316 | if (empty($post_export_tag) === false) { |
317 | - DB::query('DELETE FROM ' . prefixTable('export') . ' WHERE export_tag = %s', $post_export_tag); |
|
317 | + DB::query('DELETE FROM '.prefixTable('export').' WHERE export_tag = %s', $post_export_tag); |
|
318 | 318 | } |
319 | 319 | break; |
320 | 320 | |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | l.date as date, i.pw_iv as pw_iv, |
365 | 365 | n.renewal_period as renewal_period, |
366 | 366 | i.id_tree as tree_id |
367 | - FROM ' . prefixTable('items') . ' as i |
|
368 | - INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id) |
|
369 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item) |
|
367 | + FROM ' . prefixTable('items').' as i |
|
368 | + INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id) |
|
369 | + INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item) |
|
370 | 370 | WHERE i.inactif = %i |
371 | 371 | AND i.id_tree= %i |
372 | 372 | AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s)) |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | // Run query |
393 | 393 | $dataItem = DB::queryfirstrow( |
394 | 394 | 'SELECT i.pw AS pw, s.share_key AS share_key |
395 | - FROM ' . prefixTable('items') . ' AS i |
|
396 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
395 | + FROM ' . prefixTable('items').' AS i |
|
396 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
397 | 397 | WHERE user_id = %i AND i.id = %i', |
398 | 398 | $session->get('user-id'), |
399 | 399 | $record['id'] |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | $arr_kbs = ''; |
418 | 418 | $rows_kb = DB::query( |
419 | 419 | 'SELECT b.label, b.id |
420 | - FROM ' . prefixTable('kb_items') . ' AS a |
|
421 | - INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id) |
|
420 | + FROM ' . prefixTable('kb_items').' AS a |
|
421 | + INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id) |
|
422 | 422 | WHERE a.item_id = %i', |
423 | 423 | $record['id'] |
424 | 424 | ); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | if (empty($arr_kbs)) { |
427 | 427 | $arr_kbs = $rec_kb['label']; |
428 | 428 | } else { |
429 | - $arr_kbs .= ' | ' . $rec_kb['label']; |
|
429 | + $arr_kbs .= ' | '.$rec_kb['label']; |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $arr_tags = ''; |
435 | 435 | $rows_tag = DB::query( |
436 | 436 | 'SELECT tag |
437 | - FROM ' . prefixTable('tags') . ' |
|
437 | + FROM ' . prefixTable('tags').' |
|
438 | 438 | WHERE item_id = %i', |
439 | 439 | $record['id'] |
440 | 440 | ); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | if (empty($arr_tags)) { |
443 | 443 | $arr_tags = $rec_tag['tag']; |
444 | 444 | } else { |
445 | - $arr_tags .= ' ' . $rec_tag['tag']; |
|
445 | + $arr_tags .= ' '.$rec_tag['tag']; |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | // query |
521 | 521 | $rows = DB::query( |
522 | 522 | 'SELECT * |
523 | - FROM ' . prefixTable('export') . ' |
|
523 | + FROM ' . prefixTable('export').' |
|
524 | 524 | WHERE export_tag = %s', |
525 | 525 | $dataReceived['export_tag'] |
526 | 526 | ); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $prev_path = ''; |
533 | 533 | |
534 | 534 | //Prepare the PDF file |
535 | - include $SETTINGS['cpassman_dir'] . '/vendor/tecnickcom/tcpdf/tcpdf.php'; |
|
535 | + include $SETTINGS['cpassman_dir'].'/vendor/tecnickcom/tcpdf/tcpdf.php'; |
|
536 | 536 | |
537 | 537 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); |
538 | 538 | $pdf->SetProtection(array('print'), $dataReceived['pdf_password'], null); |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | // set default header data |
546 | 546 | $pdf->SetHeaderData( |
547 | - $SETTINGS['cpassman_dir'] . '/includes/images/teampass-logo2-home.png', |
|
547 | + $SETTINGS['cpassman_dir'].'/includes/images/teampass-logo2-home.png', |
|
548 | 548 | PDF_HEADER_LOGO_WIDTH, |
549 | 549 | 'Teampass export', |
550 | 550 | $session->get('user-lastname')." ".$session->get('user-name').' @ '.date($SETTINGS['date_format']." ".$SETTINGS['time_format'], (int) time()) |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | logEvents($SETTINGS, 'pdf_export', '', (string) $session->get('user-id'), $session->get('user-login')); |
655 | 655 | |
656 | 656 | //clean table |
657 | - DB::query('TRUNCATE TABLE ' . prefixTable('export')); |
|
657 | + DB::query('TRUNCATE TABLE '.prefixTable('export')); |
|
658 | 658 | |
659 | 659 | // Clean any content of the output buffer |
660 | 660 | ob_end_clean(); |
@@ -692,13 +692,13 @@ discard block |
||
692 | 692 | // step 1: |
693 | 693 | // - prepare export file |
694 | 694 | // - get full list of objects id to export |
695 | - include $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
695 | + include $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
696 | 696 | $idsList = array(); |
697 | 697 | |
698 | 698 | // query |
699 | 699 | $rows = DB::query( |
700 | 700 | 'SELECT * |
701 | - FROM ' . prefixTable('export') . ' |
|
701 | + FROM ' . prefixTable('export').' |
|
702 | 702 | WHERE export_tag = %s', |
703 | 703 | $inputData['export_tag'] |
704 | 704 | ); |
@@ -735,13 +735,13 @@ discard block |
||
735 | 735 | } |
736 | 736 | // prepare export file |
737 | 737 | //save the file |
738 | - $outstream = fopen($SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], 'w'); |
|
738 | + $outstream = fopen($SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], 'w'); |
|
739 | 739 | if ($outstream === false) { |
740 | 740 | echo (string) prepareExchangedData( |
741 | 741 | [ |
742 | 742 | 'error' => true, |
743 | 743 | 'message' => $lang->get('error_while_creating_file'), |
744 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
744 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
745 | 745 | ], |
746 | 746 | 'encode' |
747 | 747 | ); |
@@ -767,12 +767,12 @@ discard block |
||
767 | 767 | </style> |
768 | 768 | </head> |
769 | 769 | <body> |
770 | - <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']) . '" /> |
|
770 | + <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $inputData['password']).'" /> |
|
771 | 771 | <div id="header"> |
772 | - ' . TP_TOOL_NAME . ' - Off Line mode |
|
772 | + ' . TP_TOOL_NAME.' - Off Line mode |
|
773 | 773 | </div> |
774 | 774 | <div style="margin:10px; font-size:9px;"> |
775 | - <i>This page was generated by <b>' . $session->get('user-name') . ' ' . $session->get('user-lastname') . '</b>, the ' . date('Y/m/d H:i:s') . '.</i> |
|
775 | + <i>This page was generated by <b>' . $session->get('user-name').' '.$session->get('user-lastname').'</b>, the '.date('Y/m/d H:i:s').'.</i> |
|
776 | 776 | <span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span> |
777 | 777 | </div> |
778 | 778 | <div id="information"></div> |
@@ -783,11 +783,11 @@ discard block |
||
783 | 783 | <div> |
784 | 784 | <table id="itemsTable"> |
785 | 785 | <thead><tr> |
786 | - <th style="width:15%;">' . $lang->get('label') . '</th> |
|
787 | - <th style="width:10%;">' . $lang->get('pw') . '</th> |
|
788 | - <th style="width:30%;">' . $lang->get('description') . '</th> |
|
789 | - <th style="width:5%;">' . $lang->get('user_login') . '</th> |
|
790 | - <th style="width:20%;">' . $lang->get('url') . '</th> |
|
786 | + <th style="width:15%;">' . $lang->get('label').'</th> |
|
787 | + <th style="width:10%;">' . $lang->get('pw').'</th> |
|
788 | + <th style="width:30%;">' . $lang->get('description').'</th> |
|
789 | + <th style="width:5%;">' . $lang->get('user_login').'</th> |
|
790 | + <th style="width:20%;">' . $lang->get('url').'</th> |
|
791 | 791 | </tr></thead> |
792 | 792 | <tbody id="itemsTable_tbody">' |
793 | 793 | ); |
@@ -801,8 +801,8 @@ discard block |
||
801 | 801 | 'loop' => true, |
802 | 802 | 'ids_list' => json_encode($idsList), |
803 | 803 | 'ids_count' => count($idsList), |
804 | - 'file_path' => $SETTINGS['path_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], |
|
805 | - 'file_link' => $SETTINGS['url_to_files_folder'] . (substr($SETTINGS['path_to_files_folder'] , -1) === '/' ? '' : '/') . $inputData['filename'], |
|
804 | + 'file_path' => $SETTINGS['path_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], |
|
805 | + 'file_link' => $SETTINGS['url_to_files_folder'].(substr($SETTINGS['path_to_files_folder'], -1) === '/' ? '' : '/').$inputData['filename'], |
|
806 | 806 | 'export_tag' => $inputData['export_tag'], |
807 | 807 | ], |
808 | 808 | 'encode' |
@@ -842,12 +842,12 @@ discard block |
||
842 | 842 | |
843 | 843 | $full_listing = array(); |
844 | 844 | $items_id_list = array(); |
845 | - include $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
845 | + include $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
846 | 846 | |
847 | 847 | // query |
848 | 848 | $rows = DB::query( |
849 | 849 | 'SELECT * |
850 | - FROM ' . prefixTable('export') . ' |
|
850 | + FROM ' . prefixTable('export').' |
|
851 | 851 | WHERE export_tag = %s AND item_id IN %ls', |
852 | 852 | $inputData['export_tag'], |
853 | 853 | $inputData['idsList'] |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | [ |
862 | 862 | 'error' => true, |
863 | 863 | 'message' => $lang->get('error_while_creating_file'), |
864 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
864 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
865 | 865 | ], |
866 | 866 | 'encode' |
867 | 867 | ); |
@@ -903,13 +903,13 @@ discard block |
||
903 | 903 | if (empty($arboHtml)) { |
904 | 904 | $arboHtml = $arboHtml_tmp; |
905 | 905 | } else { |
906 | - $arboHtml .= ' » ' . $arboHtml_tmp; |
|
906 | + $arboHtml .= ' » '.$arboHtml_tmp; |
|
907 | 907 | } |
908 | 908 | } |
909 | 909 | fputs( |
910 | 910 | $outstream, |
911 | 911 | ' |
912 | - <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>' |
|
912 | + <tr class="path"><td colspan="5">' . $arboHtml.'</td></tr>' |
|
913 | 913 | ); |
914 | 914 | $idTree = $record['folder_id']; |
915 | 915 | |
@@ -917,12 +917,12 @@ discard block |
||
917 | 917 | fputs( |
918 | 918 | $outstream, |
919 | 919 | ' |
920 | - <tr class="' . $lineType . '"> |
|
921 | - <td>' . addslashes($record['label']) . '</td> |
|
922 | - <td align="center"><span class="span_pw" id="span_' . $record['item_id'] . '"><a href="#" onclick="decryptme(' . $record['item_id'] . ', \'' . $encPw . '\');return false;">Decrypt </a></span><input type="hidden" id="hide_' . $record['item_id'] . '" value="' . $encPw . '" /></td> |
|
923 | - <td>' . (empty($record['description']) === true ? ' ' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(mb_convert_encoding($record['description'], 'ISO-8859-1', 'UTF-8'))))) . '</td> |
|
924 | - <td align="center">' . (empty($record['login']) === true ? ' ' : addslashes($record['login'])) . '</td> |
|
925 | - <td align="center">' . (empty($record['url']) === true ? ' ' : addslashes($record['url'])) . '</td> |
|
920 | + <tr class="' . $lineType.'"> |
|
921 | + <td>' . addslashes($record['label']).'</td> |
|
922 | + <td align="center"><span class="span_pw" id="span_' . $record['item_id'].'"><a href="#" onclick="decryptme('.$record['item_id'].', \''.$encPw.'\');return false;">Decrypt </a></span><input type="hidden" id="hide_'.$record['item_id'].'" value="'.$encPw.'" /></td> |
|
923 | + <td>' . (empty($record['description']) === true ? ' ' : addslashes(str_replace(array(';', '<br />'), array('|', "\n\r"), stripslashes(mb_convert_encoding($record['description'], 'ISO-8859-1', 'UTF-8'))))).'</td> |
|
924 | + <td align="center">' . (empty($record['login']) === true ? ' ' : addslashes($record['login'])).'</td> |
|
925 | + <td align="center">' . (empty($record['url']) === true ? ' ' : addslashes($record['url'])).'</td> |
|
926 | 926 | </tr>' |
927 | 927 | ); |
928 | 928 | } |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | $inputData['password'] = (string) filter_var($dataReceived['password'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
972 | 972 | |
973 | 973 | // Load includes |
974 | - include $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
974 | + include $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
975 | 975 | |
976 | 976 | // read the content of the temporary file |
977 | 977 | $handle = fopen($inputData['filename'].'.txt', 'r'); |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | [ |
981 | 981 | 'error' => true, |
982 | 982 | 'message' => $lang->get('error_while_creating_file'), |
983 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
983 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
984 | 984 | ], |
985 | 985 | 'encode' |
986 | 986 | ); |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | [ |
993 | 993 | 'error' => true, |
994 | 994 | 'message' => $lang->get('error_while_creating_file'), |
995 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
995 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
996 | 996 | ], |
997 | 997 | 'encode' |
998 | 998 | ); |
@@ -1008,9 +1008,9 @@ discard block |
||
1008 | 1008 | $chunks = explode('|#|#|', chunk_split($contents, 10000, '|#|#|')); |
1009 | 1009 | foreach ($chunks as $chunk) { |
1010 | 1010 | if (empty($encrypted_text) === true) { |
1011 | - $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] ); |
|
1011 | + $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']); |
|
1012 | 1012 | } else { |
1013 | - $encrypted_text .= '|#|#|' . GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password'] ); |
|
1013 | + $encrypted_text .= '|#|#|'.GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $inputData['password']); |
|
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | [ |
1022 | 1022 | 'error' => true, |
1023 | 1023 | 'message' => $lang->get('error_while_creating_file'), |
1024 | - 'detail' => $SETTINGS['path_to_files_folder'] . $inputData['filename'], |
|
1024 | + 'detail' => $SETTINGS['path_to_files_folder'].$inputData['filename'], |
|
1025 | 1025 | ], |
1026 | 1026 | 'encode' |
1027 | 1027 | ); |
@@ -1034,9 +1034,9 @@ discard block |
||
1034 | 1034 | </table></div> |
1035 | 1035 | <input type="button" value="Hide all" onclick="hideAll()" /> |
1036 | 1036 | <div id="footer" style="text-align:center;"> |
1037 | - <a href="https://teampass.net/about/" target="_blank">' . TP_TOOL_NAME . ' ' . TP_VERSION . ' ' . TP_COPYRIGHT . '</a> |
|
1037 | + <a href="https://teampass.net/about/" target="_blank">' . TP_TOOL_NAME.' '.TP_VERSION.' '.TP_COPYRIGHT.'</a> |
|
1038 | 1038 | </div> |
1039 | - <div id="enc_html" style="display:none;">' . $encrypted_text . '</div> |
|
1039 | + <div id="enc_html" style="display:none;">' . $encrypted_text.'</div> |
|
1040 | 1040 | </body> |
1041 | 1041 | </html> |
1042 | 1042 | <script type="text/javascript"> |
@@ -1139,12 +1139,12 @@ discard block |
||
1139 | 1139 | fclose($outstream); |
1140 | 1140 | |
1141 | 1141 | //clean table |
1142 | - DB::query('TRUNCATE TABLE ' . prefixTable('export')); |
|
1142 | + DB::query('TRUNCATE TABLE '.prefixTable('export')); |
|
1143 | 1143 | |
1144 | 1144 | echo (string) prepareExchangedData( |
1145 | 1145 | [ |
1146 | 1146 | 'error' => false, |
1147 | - 'filelink' => $inputData['file_link'] , |
|
1147 | + 'filelink' => $inputData['file_link'], |
|
1148 | 1148 | ], |
1149 | 1149 | 'encode' |
1150 | 1150 | ); |
@@ -69,7 +69,7 @@ |
||
69 | 69 | ) { |
70 | 70 | // Not allowed page |
71 | 71 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
72 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
72 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
73 | 73 | exit; |
74 | 74 | } |
75 | 75 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | ) { |
70 | 70 | // Not allowed page |
71 | 71 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
72 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
72 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
73 | 73 | exit; |
74 | 74 | } |
75 | 75 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | ) { |
70 | 70 | // Not allowed page |
71 | 71 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
72 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
72 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
73 | 73 | exit; |
74 | 74 | } |
75 | 75 |