Passed
Pull Request — master (#4676)
by Nils
05:33
created
pages/import.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     || isset($SETTINGS['allow_import']) === false || (int) $SETTINGS['allow_import'] !== 1) {
72 72
     // Not allowed page
73 73
     $session->set('system-error_code', ERR_NOT_ALLOWED);
74
-    include $SETTINGS['cpassman_dir'] . '/error.php';
74
+    include $SETTINGS['cpassman_dir'].'/error.php';
75 75
     exit;
76 76
 }
77 77
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                                         <?php
184 184
 $complexitySelect = '';
185 185
 foreach (TP_PW_COMPLEXITY as $level) {
186
-    $complexitySelect .= '<option value="' . $level[0] . '">' . $level[1] . '</option>';
186
+    $complexitySelect .= '<option value="'.$level[0].'">'.$level[1].'</option>';
187 187
 }
188 188
 echo $complexitySelect;
189 189
                                         ?>
Please login to merge, or discard this patch.
pages/import.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('import') === false) {
73 73
     // Not allowed page
74 74
     $session->set('system-error_code', ERR_NOT_ALLOWED);
75
-    include $SETTINGS['cpassman_dir'] . '/error.php';
75
+    include $SETTINGS['cpassman_dir'].'/error.php';
76 76
     exit;
77 77
 }
78 78
 ?>
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
                                     // Isolate first item
1044 1044
                                     if (itemsList.length > 0) {
1045 1045
                                         $('#import-feedback-progress-text')
1046
-                                            .html('<i class="fa-solid fa-cog fa-spin ml-4 mr-2"></i><?php echo $lang->get('operation_progress');?> ('+((counter*100)/itemsNumber).toFixed(2)+'%) - <i id="item-title"></i>');
1046
+                                            .html('<i class="fa-solid fa-cog fa-spin ml-4 mr-2"></i><?php echo $lang->get('operation_progress'); ?> ('+((counter*100)/itemsNumber).toFixed(2)+'%) - <i id="item-title"></i>');
1047 1047
 
1048 1048
                                         // XSS Filtering :
1049 1049
                                         $('#import-feedback-progress-text').text(itemsList[0].Title);
Please login to merge, or discard this patch.
includes/language/english.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
  * @see       https://www.teampass.net
29 29
  */
30 30
 
31
- // TO REMOVE
32
- // - selected_items_to_be_imported
31
+    // TO REMOVE
32
+    // - selected_items_to_be_imported
33 33
 
34 34
 return array(
35 35
     'max_parallel_tasks' => 'Maximum number of parallel tasks',
Please login to merge, or discard this patch.
sources/items.queries.php 2 patches
Spacing   +280 added lines, -281 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 ) {
80 80
     // Not allowed page
81 81
     $session->set('system-error_code', ERR_NOT_ALLOWED);
82
-    include $SETTINGS['cpassman_dir'] . '/error.php';
82
+    include $SETTINGS['cpassman_dir'].'/error.php';
83 83
     exit;
84 84
 }
85 85
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     date_default_timezone_set('UTC');
105 105
 }
106 106
 
107
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php';
107
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php';
108 108
 header('Content-type: text/html; charset=utf-8');
109 109
 header('Cache-Control: no-cache, must-revalidate');
110 110
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             // About special settings
365 365
             $dataFolderSettings = DB::queryFirstRow(
366 366
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
367
-                FROM ' . prefixTable('nested_tree') . ' 
367
+                FROM ' . prefixTable('nested_tree').' 
368 368
                 WHERE id = %i',
369 369
                 $inputData['folderId']
370 370
             );
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             // Get folder complexity
382 382
             $folderComplexity = DB::queryfirstrow(
383 383
                 'SELECT valeur
384
-                FROM ' . prefixTable('misc') . '
384
+                FROM ' . prefixTable('misc').'
385 385
                 WHERE type = %s AND intitule = %i',
386 386
                 'complex',
387 387
                 $inputData['folderId']
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $itemExists = 0;
407 407
             $newID = '';
408 408
             $data = DB::queryfirstrow(
409
-                'SELECT * FROM ' . prefixTable('items') . '
409
+                'SELECT * FROM '.prefixTable('items').'
410 410
                 WHERE label = %s AND inactif = %i',
411 411
                 $inputData['label'],
412 412
                 0
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
                     (int) $post_folder_is_personal,
490 490
                     (int) $newID,
491 491
                     $cryptedStuff['objectKey'],
492
-                    true,   // only for the item creator
493
-                    false,  // no delete all
492
+                    true, // only for the item creator
493
+                    false, // no delete all
494 494
                 );
495 495
 
496 496
                 // update fields
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
                             // should we encrypt the data
504 504
                             $dataTmp = DB::queryFirstRow(
505 505
                                 'SELECT encrypted_data
506
-                                FROM ' . prefixTable('categories') . '
506
+                                FROM ' . prefixTable('categories').'
507 507
                                 WHERE id = %i',
508 508
                                 $field['id']
509 509
                             );
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
                                     (int) $post_folder_is_personal,
533 533
                                     (int) $newObjectId,
534 534
                                     $cryptedStuff['objectKey'],
535
-                                    true,   // only for the item creator
536
-                                    false,  // no delete all
535
+                                    true, // only for the item creator
536
+                                    false, // no delete all
537 537
                                 );
538 538
 
539 539
                                 array_push(
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
                 ) {
571 571
                     DB::queryFirstRow(
572 572
                         'SELECT *
573
-                        FROM ' . prefixTable('templates') . '
573
+                        FROM ' . prefixTable('templates').'
574 574
                         WHERE item_id = %i',
575 575
                         $newID
576 576
                     );
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
                 ) {
640 640
                     foreach ($post_restricted_to as $userRest) {
641 641
                         if (empty($userRest) === false) {
642
-                            $dataTmp = DB::queryfirstrow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
642
+                            $dataTmp = DB::queryfirstrow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
643 643
                             if (empty($listOfRestricted)) {
644 644
                                 $listOfRestricted = $dataTmp['login'];
645 645
                             } else {
646
-                                $listOfRestricted .= ';' . $dataTmp['login'];
646
+                                $listOfRestricted .= ';'.$dataTmp['login'];
647 647
                             }
648 648
                         }
649 649
                     }
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
                             if (empty($userRest) === false) {
660 660
                                 $dataTmp = DB::queryfirstrow(
661 661
                                     'SELECT login
662
-                                    FROM ' . prefixTable('users') . '
662
+                                    FROM ' . prefixTable('users').'
663 663
                                     WHERE id= %i',
664 664
                                     $userRest
665 665
                                 );
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
                                 if (empty($oldRestrictionList) === true) {
668 668
                                     $oldRestrictionList = $dataTmp['login'];
669 669
                                 } else {
670
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
670
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
671 671
                                 }
672 672
                             }
673 673
                         }
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                 if (empty($post_uploaded_file_id) === false) {
731 731
                     $rows = DB::query(
732 732
                         'SELECT id
733
-                        FROM ' . prefixTable('files') . '
733
+                        FROM ' . prefixTable('files').'
734 734
                         WHERE id_item = %s',
735 735
                         $post_uploaded_file_id
736 736
                     );
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
                                     $lang->get('email_subject_item_updated'),
787 787
                                     str_replace(
788 788
                                         array('#label', '#link'),
789
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $txt['email_body3']),
789
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$txt['email_body3']),
790 790
                                             $lang->get('new_item_email_body')
791 791
                                     ),
792 792
                                     $emailAddress,
@@ -890,11 +890,11 @@  discard block
 block discarded – undo
890 890
         // Prepare variables
891 891
         $itemInfos = array();
892 892
         $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
893
-        $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
893
+        $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
894 894
         $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : '';
895 895
         $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
896
-        $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : '';
897
-        $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
896
+        $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : '';
897
+        $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
898 898
         $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT);
899 899
         $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
900 900
         $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT);
@@ -925,8 +925,7 @@  discard block
 block discarded – undo
925 925
         $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
926 926
                 $dataReceived['to_be_deleted_after_date'],
927 927
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
928
-            ) :
929
-            '';
928
+            ) : '';
930 929
         $post_fields = (filter_var_array(
931 930
             $dataReceived['fields'],
932 931
             FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -986,7 +985,7 @@  discard block
 block discarded – undo
986 985
         // About special settings
987 986
         $dataFolderSettings = DB::queryFirstRow(
988 987
             'SELECT bloquer_creation, bloquer_modification, personal_folder, title
989
-            FROM ' . prefixTable('nested_tree') . ' 
988
+            FROM ' . prefixTable('nested_tree').' 
990 989
             WHERE id = %i',
991 990
             $inputData['folderId']
992 991
         );
@@ -1002,7 +1001,7 @@  discard block
 block discarded – undo
1002 1001
         // Get folder complexity
1003 1002
         $folderComplexity = DB::queryfirstrow(
1004 1003
             'SELECT valeur
1005
-            FROM ' . prefixTable('misc') . '
1004
+            FROM ' . prefixTable('misc').'
1006 1005
             WHERE type = %s AND intitule = %i',
1007 1006
             'complex',
1008 1007
             $inputData['folderId']
@@ -1047,8 +1046,8 @@  discard block
 block discarded – undo
1047 1046
         // Get all informations for this item
1048 1047
         $dataItem = DB::queryfirstrow(
1049 1048
             'SELECT *
1050
-            FROM ' . prefixTable('items') . ' as i
1051
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1049
+            FROM ' . prefixTable('items').' as i
1050
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1052 1051
             WHERE i.id=%i AND l.action = %s',
1053 1052
             $inputData['itemId'],
1054 1053
             'at_creation'
@@ -1097,7 +1096,7 @@  discard block
 block discarded – undo
1097 1096
         //db::debugmode(true);
1098 1097
         DB::query(
1099 1098
             'SELECT *
1100
-            FROM ' . prefixTable('sharekeys_items') . '
1099
+            FROM ' . prefixTable('sharekeys_items').'
1101 1100
             WHERE object_id = %i AND user_id = %s',
1102 1101
             $inputData['itemId'],
1103 1102
             $session->get('user-id')
@@ -1149,9 +1148,9 @@  discard block
 block discarded – undo
1149 1148
                 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, 
1150 1149
                 i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification,
1151 1150
                 u.login as user_login, u.email as user_email
1152
-                FROM ' . prefixTable('items') . ' as i
1153
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item)
1154
-                INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user)
1151
+                FROM ' . prefixTable('items').' as i
1152
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item)
1153
+                INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user)
1155 1154
                 WHERE i.id=%i',
1156 1155
                 $inputData['itemId']
1157 1156
             );
@@ -1159,7 +1158,7 @@  discard block
 block discarded – undo
1159 1158
             // Should we log a password change?
1160 1159
             $userKey = DB::queryFirstRow(
1161 1160
                 'SELECT share_key
1162
-                FROM ' . prefixTable('sharekeys_items') . '
1161
+                FROM ' . prefixTable('sharekeys_items').'
1163 1162
                 WHERE user_id = %i AND object_id = %i',
1164 1163
                 $session->get('user-id'),
1165 1164
                 $inputData['itemId']
@@ -1223,12 +1222,12 @@  discard block
 block discarded – undo
1223 1222
                     (int) $post_folder_is_personal,
1224 1223
                     (int) $inputData['itemId'],
1225 1224
                     $encrypted_password_key,
1226
-                    true,   // only for the item creator
1227
-                    true,   // delete all
1225
+                    true, // only for the item creator
1226
+                    true, // delete all
1228 1227
                 );
1229 1228
 
1230 1229
                 // Create a task to create sharekeys for users
1231
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1230
+                if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw);
1232 1231
                 $tasksToBePerformed = ['item_password'];
1233 1232
                 $encryptionTaskIsRequested = true;
1234 1233
             } else {
@@ -1239,7 +1238,7 @@  discard block
 block discarded – undo
1239 1238
             // Get list of tags
1240 1239
             $itemTags = DB::queryFirstColumn(
1241 1240
                 'SELECT tag
1242
-                FROM ' . prefixTable('tags') . '
1241
+                FROM ' . prefixTable('tags').'
1243 1242
                 WHERE item_id = %i',
1244 1243
                 $inputData['itemId']
1245 1244
             );
@@ -1285,7 +1284,7 @@  discard block
 block discarded – undo
1285 1284
                     $session->get('user-id'),
1286 1285
                     'at_modification',
1287 1286
                     $session->get('user-login'),
1288
-                    'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags
1287
+                    'at_tag : '.implode(' ', $itemTags).' => '.$post_tags
1289 1288
                 );
1290 1289
             }
1291 1290
 
@@ -1325,8 +1324,8 @@  discard block
 block discarded – undo
1325 1324
                             'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1326 1325
                             i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1327 1326
                             c.masked AS masked, i.id AS field_item_id
1328
-                            FROM ' . prefixTable('categories_items') . ' AS i
1329
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1327
+                            FROM ' . prefixTable('categories_items').' AS i
1328
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1330 1329
                             WHERE i.field_id = %i AND i.item_id = %i',
1331 1330
                             $field['id'],
1332 1331
                             $inputData['itemId']
@@ -1342,7 +1341,7 @@  discard block
 block discarded – undo
1342 1341
                             // Perform new query
1343 1342
                             $dataTmpCat = DB::queryFirstRow(
1344 1343
                                 'SELECT id, title, encrypted_data, masked
1345
-                                FROM ' . prefixTable('categories') . '
1344
+                                FROM ' . prefixTable('categories').'
1346 1345
                                 WHERE id = %i',
1347 1346
                                 $field['id']
1348 1347
                             );
@@ -1372,8 +1371,8 @@  discard block
 block discarded – undo
1372 1371
                                     (int) $post_folder_is_personal,
1373 1372
                                     (int) $newId,
1374 1373
                                     $cryptedStuff['objectKey'],
1375
-                                    true,   // only for the item creator
1376
-                                    true,   // delete all
1374
+                                    true, // only for the item creator
1375
+                                    true, // delete all
1377 1376
                                 );
1378 1377
 
1379 1378
                                 // update value
@@ -1423,7 +1422,7 @@  discard block
 block discarded – undo
1423 1422
                                 $session->get('user-id'),
1424 1423
                                 'at_modification',
1425 1424
                                 $session->get('user-login'),
1426
-                                'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1425
+                                'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1427 1426
                             );
1428 1427
                         } else {
1429 1428
                             // Case where the field already exists
@@ -1432,7 +1431,7 @@  discard block
 block discarded – undo
1432 1431
                                 // Get user sharekey for this field
1433 1432
                                 $userKey = DB::queryFirstRow(
1434 1433
                                     'SELECT share_key
1435
-                                    FROM ' . prefixTable('sharekeys_fields') . '
1434
+                                    FROM ' . prefixTable('sharekeys_fields').'
1436 1435
                                     WHERE user_id = %i AND object_id = %i',
1437 1436
                                     $session->get('user-id'),
1438 1437
                                     $dataTmpCat['field_item_id']
@@ -1471,8 +1470,8 @@  discard block
 block discarded – undo
1471 1470
                                         (int) $post_folder_is_personal,
1472 1471
                                         (int) $dataTmpCat['field_item_id'],
1473 1472
                                         $cryptedStuff['objectKey'],
1474
-                                        true,   // only for the item creator
1475
-                                        true,   // delete all
1473
+                                        true, // only for the item creator
1474
+                                        true, // delete all
1476 1475
                                     );
1477 1476
 
1478 1477
                                     if ($encryptedFieldIsChanged === false) {
@@ -1514,7 +1513,7 @@  discard block
 block discarded – undo
1514 1513
                                     $session->get('user-id'),
1515 1514
                                     'at_modification',
1516 1515
                                     $session->get('user-login'),
1517
-                                    'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1516
+                                    'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1518 1517
                                 );
1519 1518
                             }
1520 1519
                         }
@@ -1569,7 +1568,7 @@  discard block
 block discarded – undo
1569 1568
             ) {
1570 1569
                 DB::queryFirstRow(
1571 1570
                     'SELECT *
1572
-                    FROM ' . prefixTable('templates') . '
1571
+                    FROM ' . prefixTable('templates').'
1573 1572
                     WHERE item_id = %i',
1574 1573
                     $inputData['itemId']
1575 1574
                 );
@@ -1612,7 +1611,7 @@  discard block
 block discarded – undo
1612 1611
                 // check if elem exists in Table. If not add it or update it.
1613 1612
                 DB::query(
1614 1613
                     'SELECT *
1615
-                    FROM ' . prefixTable('automatic_del') . '
1614
+                    FROM ' . prefixTable('automatic_del').'
1616 1615
                     WHERE item_id = %i',
1617 1616
                     $inputData['itemId']
1618 1617
                 );
@@ -1639,7 +1638,7 @@  discard block
 block discarded – undo
1639 1638
                         // Store updates performed
1640 1639
                         array_push(
1641 1640
                             $arrayOfChanges,
1642
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled')
1641
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled')
1643 1642
                         );
1644 1643
 
1645 1644
                         // update LOG
@@ -1682,7 +1681,7 @@  discard block
 block discarded – undo
1682 1681
                         // Store updates performed
1683 1682
                         array_push(
1684 1683
                             $arrayOfChanges,
1685
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled')
1684
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled')
1686 1685
                         );
1687 1686
 
1688 1687
                         // update LOG
@@ -1715,7 +1714,7 @@  discard block
 block discarded – undo
1715 1714
                     if (empty($userId) === false) {
1716 1715
                         $dataTmp = DB::queryfirstrow(
1717 1716
                             'SELECT id, name, lastname
1718
-                            FROM ' . prefixTable('users') . '
1717
+                            FROM ' . prefixTable('users').'
1719 1718
                             WHERE id= %i',
1720 1719
                             $userId
1721 1720
                         );
@@ -1723,7 +1722,7 @@  discard block
 block discarded – undo
1723 1722
                         // Add to array
1724 1723
                         array_push(
1725 1724
                             $arrayOfUsersRestriction,
1726
-                            $dataTmp['name'] . ' ' . $dataTmp['lastname']
1725
+                            $dataTmp['name'].' '.$dataTmp['lastname']
1727 1726
                         );
1728 1727
                         array_push(
1729 1728
                             $arrayOfUsersIdRestriction,
@@ -1754,8 +1753,8 @@  discard block
 block discarded – undo
1754 1753
                 // get values before deleting them
1755 1754
                 $rows = DB::query(
1756 1755
                     'SELECT t.title, t.id AS id
1757
-                    FROM ' . prefixTable('roles_title') . ' as t
1758
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1756
+                    FROM ' . prefixTable('roles_title').' as t
1757
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1759 1758
                     WHERE r.item_id = %i
1760 1759
                     ORDER BY t.title ASC',
1761 1760
                     $inputData['itemId']
@@ -1789,7 +1788,7 @@  discard block
 block discarded – undo
1789 1788
                         );
1790 1789
                         $dataTmp = DB::queryfirstrow(
1791 1790
                             'SELECT title
1792
-                            FROM ' . prefixTable('roles_title') . '
1791
+                            FROM ' . prefixTable('roles_title').'
1793 1792
                             WHERE id = %i',
1794 1793
                             $role
1795 1794
                         );
@@ -1817,7 +1816,7 @@  discard block
 block discarded – undo
1817 1816
             // Get current status
1818 1817
             $otpStatus = DB::queryFirstRow(
1819 1818
                 'SELECT enabled as otp_is_enabled
1820
-                FROM ' . prefixTable('items_otp') . '
1819
+                FROM ' . prefixTable('items_otp').'
1821 1820
                 WHERE item_id = %i',
1822 1821
                 $inputData['itemId']
1823 1822
             );
@@ -1848,7 +1847,7 @@  discard block
 block discarded – undo
1848 1847
                     $session->get('user-id'),
1849 1848
                     'at_modification',
1850 1849
                     $session->get('user-login'),
1851
-                    'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1850
+                    'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1852 1851
                 );
1853 1852
             } elseif (DB::count() === 0 && empty($post_otp_secret) === false) {
1854 1853
                 // Create the entry in items_otp table
@@ -1892,8 +1891,8 @@  discard block
 block discarded – undo
1892 1891
                     $session->get('user-id'),
1893 1892
                     'at_modification',
1894 1893
                     $session->get('user-login'),
1895
-                    'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1896
-                        implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1894
+                    'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1895
+                        implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1897 1896
                 );
1898 1897
             }
1899 1898
 
@@ -1913,7 +1912,7 @@  discard block
 block discarded – undo
1913 1912
                     $session->get('user-id'),
1914 1913
                     'at_modification',
1915 1914
                     $session->get('user-login'),
1916
-                    'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1915
+                    'at_label : '.$data['label'].' => '.$inputData['label']
1917 1916
                 );
1918 1917
             }
1919 1918
             // LOGIN
@@ -1932,7 +1931,7 @@  discard block
 block discarded – undo
1932 1931
                     $session->get('user-id'),
1933 1932
                     'at_modification',
1934 1933
                     $session->get('user-login'),
1935
-                    'at_login : ' . $data['login'] . ' => ' . $post_login
1934
+                    'at_login : '.$data['login'].' => '.$post_login
1936 1935
                 );
1937 1936
             }
1938 1937
             // EMAIL
@@ -1951,7 +1950,7 @@  discard block
 block discarded – undo
1951 1950
                     $session->get('user-id'),
1952 1951
                     'at_modification',
1953 1952
                     $session->get('user-login'),
1954
-                    'at_email : ' . $data['email'] . ' => ' . $post_email
1953
+                    'at_email : '.$data['email'].' => '.$post_email
1955 1954
                 );
1956 1955
             }
1957 1956
             // URL
@@ -1970,7 +1969,7 @@  discard block
 block discarded – undo
1970 1969
                     $session->get('user-id'),
1971 1970
                     'at_modification',
1972 1971
                     $session->get('user-login'),
1973
-                    'at_url : ' . $data['url'] . ' => ' . $post_url
1972
+                    'at_url : '.$data['url'].' => '.$post_url
1974 1973
                 );
1975 1974
             }
1976 1975
             // DESCRIPTION
@@ -1996,7 +1995,7 @@  discard block
 block discarded – undo
1996 1995
             // FOLDER
1997 1996
             if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
1998 1997
                 // Get name of folders
1999
-                $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
1998
+                $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
2000 1999
 
2001 2000
                 // Store updates performed
2002 2001
                 array_push(
@@ -2012,7 +2011,7 @@  discard block
 block discarded – undo
2012 2011
                     $session->get('user-id'),
2013 2012
                     'at_modification',
2014 2013
                     $session->get('user-login'),
2015
-                    'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
2014
+                    'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
2016 2015
                 );
2017 2016
             }
2018 2017
             // ANYONE_CAN_MODIFY
@@ -2020,7 +2019,7 @@  discard block
 block discarded – undo
2020 2019
                 // Store updates performed
2021 2020
                 array_push(
2022 2021
                     $arrayOfChanges,
2023
-                    $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2022
+                    $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2024 2023
                 );
2025 2024
 
2026 2025
                 // Log
@@ -2031,15 +2030,15 @@  discard block
 block discarded – undo
2031 2030
                     $session->get('user-id'),
2032 2031
                     'at_modification',
2033 2032
                     $session->get('user-login'),
2034
-                    'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2033
+                    'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2035 2034
                 );
2036 2035
             }
2037 2036
 
2038 2037
             // Reload new values
2039 2038
             $dataItem = DB::queryfirstrow(
2040 2039
                 'SELECT *
2041
-                FROM ' . prefixTable('items') . ' as i
2042
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2040
+                FROM ' . prefixTable('items').' as i
2041
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2043 2042
                 WHERE i.id = %i AND l.action = %s',
2044 2043
                 $inputData['itemId'],
2045 2044
                 'at_creation'
@@ -2048,8 +2047,8 @@  discard block
 block discarded – undo
2048 2047
             $history = '';
2049 2048
             $rows = DB::query(
2050 2049
                 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
2051
-                FROM ' . prefixTable('log_items') . ' as l
2052
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
2050
+                FROM ' . prefixTable('log_items').' as l
2051
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
2053 2052
                 WHERE l.action <> %s AND id_item=%s',
2054 2053
                 'at_shown',
2055 2054
                 $inputData['itemId']
@@ -2058,14 +2057,14 @@  discard block
 block discarded – undo
2058 2057
                 if ($record['raison'] === NULL) continue;
2059 2058
                 $reason = explode(':', $record['raison']);
2060 2059
                 if (count($reason) > 0) {
2061
-                    $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
2062
-                        . $record['login'] . ' - ' . $lang->get($record['action']) . ' - '
2063
-                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1]
2060
+                    $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
2061
+                        . $record['login'].' - '.$lang->get($record['action']).' - '
2062
+                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1]
2064 2063
                             : $lang->get(trim($reason[0]))) : '');
2065 2064
                     if (empty($history)) {
2066 2065
                         $history = $sentence;
2067 2066
                     } else {
2068
-                        $history .= '<br />' . $sentence;
2067
+                        $history .= '<br />'.$sentence;
2069 2068
                     }
2070 2069
                 }
2071 2070
             }
@@ -2203,7 +2202,7 @@  discard block
 block discarded – undo
2203 2202
         ) {
2204 2203
             // load the original record into an array
2205 2204
             $originalRecord = DB::queryfirstrow(
2206
-                'SELECT * FROM ' . prefixTable('items') . '
2205
+                'SELECT * FROM '.prefixTable('items').'
2207 2206
                 WHERE id = %i',
2208 2207
                 $inputData['itemId']
2209 2208
             );
@@ -2222,7 +2221,7 @@  discard block
 block discarded – undo
2222 2221
 
2223 2222
             // Load the destination folder record into an array
2224 2223
             $dataDestination = DB::queryfirstrow(
2225
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2224
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2226 2225
                 WHERE id = %i',
2227 2226
                 $post_dest_id
2228 2227
             );
@@ -2230,7 +2229,7 @@  discard block
 block discarded – undo
2230 2229
             // Get the ITEM object key for the user
2231 2230
             $userKey = DB::queryFirstRow(
2232 2231
                 'SELECT share_key
2233
-                FROM ' . prefixTable('sharekeys_items') . '
2232
+                FROM ' . prefixTable('sharekeys_items').'
2234 2233
                 WHERE user_id = %i AND object_id = %i',
2235 2234
                 $session->get('user-id'),
2236 2235
                 $inputData['itemId']
@@ -2307,8 +2306,8 @@  discard block
 block discarded – undo
2307 2306
             // Manage Custom Fields
2308 2307
             $rows = DB::query(
2309 2308
                 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data
2310
-                FROM ' . prefixTable('categories_items') . ' AS ci
2311
-                INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id)
2309
+                FROM ' . prefixTable('categories_items').' AS ci
2310
+                INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id)
2312 2311
                 WHERE ci.item_id = %i',
2313 2312
                 $inputData['itemId']
2314 2313
             );
@@ -2320,7 +2319,7 @@  discard block
 block discarded – undo
2320 2319
                     // Get user key
2321 2320
                     $userKey = DB::queryFirstRow(
2322 2321
                         'SELECT share_key
2323
-                        FROM ' . prefixTable('sharekeys_fields') . '
2322
+                        FROM ' . prefixTable('sharekeys_fields').'
2324 2323
                         WHERE user_id = %i AND object_id = %i',
2325 2324
                         $session->get('user-id'),
2326 2325
                         $field['id']
@@ -2387,15 +2386,15 @@  discard block
 block discarded – undo
2387 2386
             $rows = DB::query(
2388 2387
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2389 2388
                 f.size AS size, f.type AS type, s.share_key AS share_key
2390
-                FROM ' . prefixTable('files') . ' AS f
2391
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2389
+                FROM ' . prefixTable('files').' AS f
2390
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2392 2391
                 WHERE s.user_id = %i AND f.id_item = %i',
2393 2392
                 $session->get('user-id'),
2394 2393
                 $inputData['itemId']
2395 2394
             );
2396 2395
             foreach ($rows as $record) {
2397 2396
                 // Check if file still exists
2398
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2397
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2399 2398
                     // Step1 - decrypt the file
2400 2399
                     // deepcode ignore PT: path is sanitized inside decryptFile()
2401 2400
                     $fileContent = decryptFile(
@@ -2406,8 +2405,8 @@  discard block
 block discarded – undo
2406 2405
 
2407 2406
                     // Step2 - create file
2408 2407
                     // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database
2409
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2410
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2408
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2409
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2411 2410
                     if ($outstream === false) {
2412 2411
                         echo prepareExchangedData(
2413 2412
                             array(
@@ -2480,7 +2479,7 @@  discard block
 block discarded – undo
2480 2479
 
2481 2480
             // -------------------------
2482 2481
             // Add specific restrictions
2483
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2482
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2484 2483
             foreach ($rows as $record) {
2485 2484
                 DB::insert(
2486 2485
                     prefixTable('restriction_to_roles'),
@@ -2492,7 +2491,7 @@  discard block
 block discarded – undo
2492 2491
             }
2493 2492
 
2494 2493
             // Add Tags
2495
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2494
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2496 2495
             foreach ($rows as $record) {
2497 2496
                 DB::insert(
2498 2497
                     prefixTable('tags'),
@@ -2593,7 +2592,7 @@  discard block
 block discarded – undo
2593 2592
         // then we can show it
2594 2593
         $item_deleted = DB::queryFirstRow(
2595 2594
             'SELECT *
2596
-            FROM ' . prefixTable('log_items') . '
2595
+            FROM ' . prefixTable('log_items').'
2597 2596
             WHERE id_item = %i AND action = %s
2598 2597
             ORDER BY date DESC
2599 2598
             LIMIT 0, 1',
@@ -2604,7 +2603,7 @@  discard block
 block discarded – undo
2604 2603
 
2605 2604
         $item_restored = DB::queryFirstRow(
2606 2605
             'SELECT *
2607
-            FROM ' . prefixTable('log_items') . '
2606
+            FROM ' . prefixTable('log_items').'
2608 2607
             WHERE id_item = %i AND action = %s
2609 2608
             ORDER BY date DESC
2610 2609
             LIMIT 0, 1',
@@ -2628,8 +2627,8 @@  discard block
 block discarded – undo
2628 2627
         // Get all informations for this item
2629 2628
         $dataItem = DB::queryfirstrow(
2630 2629
             'SELECT *
2631
-            FROM ' . prefixTable('items') . ' as i
2632
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2630
+            FROM ' . prefixTable('items').' as i
2631
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2633 2632
             WHERE i.id = %i AND l.action = %s',
2634 2633
             $inputData['id'],
2635 2634
             'at_creation'
@@ -2638,7 +2637,7 @@  discard block
 block discarded – undo
2638 2637
         // Notification
2639 2638
         DB::queryfirstrow(
2640 2639
             'SELECT *
2641
-            FROM ' . prefixTable('notification') . '
2640
+            FROM ' . prefixTable('notification').'
2642 2641
             WHERE item_id = %i AND user_id = %i',
2643 2642
             $inputData['id'],
2644 2643
             $session->get('user-id')
@@ -2657,7 +2656,7 @@  discard block
 block discarded – undo
2657 2656
 
2658 2657
         // manage case of API user
2659 2658
         if ($dataItem['id_user'] === API_USER_ID) {
2660
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2659
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2661 2660
             $arrData['id_user'] = API_USER_ID;
2662 2661
             $arrData['author_email'] = '';
2663 2662
             $arrData['notification_status'] = false;
@@ -2667,7 +2666,7 @@  discard block
 block discarded – undo
2667 2666
         $tags = array();
2668 2667
         $rows = DB::query(
2669 2668
             'SELECT tag
2670
-            FROM ' . prefixTable('tags') . '
2669
+            FROM ' . prefixTable('tags').'
2671 2670
             WHERE item_id = %i',
2672 2671
             $inputData['id']
2673 2672
         );
@@ -2692,7 +2691,7 @@  discard block
 block discarded – undo
2692 2691
         // Check if user has a role that is accepted
2693 2692
         $rows_tmp = DB::query(
2694 2693
             'SELECT role_id
2695
-            FROM ' . prefixTable('restriction_to_roles') . '
2694
+            FROM ' . prefixTable('restriction_to_roles').'
2696 2695
             WHERE item_id=%i',
2697 2696
             $inputData['id']
2698 2697
         );
@@ -2706,7 +2705,7 @@  discard block
 block discarded – undo
2706 2705
         // Get the object key for the user
2707 2706
         $userKey = DB::queryFirstRow(
2708 2707
             'SELECT share_key
2709
-            FROM ' . prefixTable('sharekeys_items') . '
2708
+            FROM ' . prefixTable('sharekeys_items').'
2710 2709
             WHERE user_id = %i AND object_id = %i',
2711 2710
             $session->get('user-id'),
2712 2711
             $inputData['id']
@@ -2803,8 +2802,8 @@  discard block
 block discarded – undo
2803 2802
                 // Add restriction if item is restricted to roles
2804 2803
                 $rows = DB::query(
2805 2804
                     'SELECT t.title, t.id
2806
-                    FROM ' . prefixTable('roles_title') . ' AS t
2807
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2805
+                    FROM ' . prefixTable('roles_title').' AS t
2806
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2808 2807
                     WHERE r.item_id = %i
2809 2808
                     ORDER BY t.title ASC',
2810 2809
                     $inputData['id']
@@ -2820,8 +2819,8 @@  discard block
 block discarded – undo
2820 2819
                 $tmp = array();
2821 2820
                 $rows = DB::query(
2822 2821
                     'SELECT k.label, k.id
2823
-                    FROM ' . prefixTable('kb_items') . ' as i
2824
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2822
+                    FROM ' . prefixTable('kb_items').' as i
2823
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2825 2824
                     WHERE i.item_id = %i
2826 2825
                     ORDER BY k.label ASC',
2827 2826
                     $inputData['id']
@@ -2904,7 +2903,7 @@  discard block
 block discarded – undo
2904 2903
                 $arrCatList = array();
2905 2904
                 $rows_tmp = DB::query(
2906 2905
                     'SELECT id_category
2907
-                    FROM ' . prefixTable('categories_folders') . '
2906
+                    FROM ' . prefixTable('categories_folders').'
2908 2907
                     WHERE id_folder=%i',
2909 2908
                     $inputData['folderId']
2910 2909
                 );
@@ -2919,8 +2918,8 @@  discard block
 block discarded – undo
2919 2918
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2920 2919
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2921 2920
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2922
-                        FROM ' . prefixTable('categories_items') . ' AS i
2923
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2921
+                        FROM ' . prefixTable('categories_items').' AS i
2922
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2924 2923
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2925 2924
                         $inputData['id'],
2926 2925
                         $arrCatList
@@ -2931,7 +2930,7 @@  discard block
 block discarded – undo
2931 2930
                         //db::debugmode(true);
2932 2931
                         $userKey = DB::queryFirstRow(
2933 2932
                             'SELECT share_key
2934
-                            FROM ' . prefixTable('sharekeys_fields') . '
2933
+                            FROM ' . prefixTable('sharekeys_fields').'
2935 2934
                             WHERE user_id = %i AND object_id = %i',
2936 2935
                             $session->get('user-id'),
2937 2936
                             $row['id']
@@ -2949,7 +2948,7 @@  discard block
 block discarded – undo
2949 2948
                         } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) {
2950 2949
                             // Data is not encrypted in DB
2951 2950
                             $fieldText = [
2952
-                                'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2951
+                                'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
2953 2952
                                 'encrypted' => false,
2954 2953
                                 'error' => false,
2955 2954
                             ];
@@ -2994,7 +2993,7 @@  discard block
 block discarded – undo
2994 2993
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
2995 2994
                 $rows_tmp = DB::queryfirstrow(
2996 2995
                     'SELECT category_id
2997
-                    FROM ' . prefixTable('templates') . '
2996
+                    FROM ' . prefixTable('templates').'
2998 2997
                     WHERE item_id = %i',
2999 2998
                     $inputData['id']
3000 2999
                 );
@@ -3011,7 +3010,7 @@  discard block
 block discarded – undo
3011 3010
             // Evaluate if item is ready for all users
3012 3011
             $rows_tmp = DB::queryfirstrow(
3013 3012
                 'SELECT finished_at
3014
-                FROM ' . prefixTable('background_tasks') . '
3013
+                FROM ' . prefixTable('background_tasks').'
3015 3014
                 WHERE item_id = %i',
3016 3015
                 $inputData['id']
3017 3016
             );
@@ -3028,7 +3027,7 @@  discard block
 block discarded – undo
3028 3027
                 // Is the Item to be deleted?
3029 3028
                 $dataDelete = DB::queryfirstrow(
3030 3029
                     'SELECT * 
3031
-                    FROM ' . prefixTable('automatic_del') . '
3030
+                    FROM ' . prefixTable('automatic_del').'
3032 3031
                     WHERE item_id = %i',
3033 3032
                     $inputData['id']
3034 3033
                 );
@@ -3109,14 +3108,14 @@  discard block
 block discarded – undo
3109 3108
                     if (empty($userRest) === false) {
3110 3109
                         $dataTmp = DB::queryfirstrow(
3111 3110
                             'SELECT login
3112
-                            FROM ' . prefixTable('users') . '
3111
+                            FROM ' . prefixTable('users').'
3113 3112
                             WHERE id= %i',
3114 3113
                             $userRest
3115 3114
                         );
3116 3115
                         if (empty($listOfRestricted)) {
3117 3116
                             $listOfRestricted = $dataTmp['login'];
3118 3117
                         } else {
3119
-                            $listOfRestricted .= ';' . $dataTmp['login'];
3118
+                            $listOfRestricted .= ';'.$dataTmp['login'];
3120 3119
                         }
3121 3120
                     }
3122 3121
                 }
@@ -3190,9 +3189,9 @@  discard block
 block discarded – undo
3190 3189
         // Load item data
3191 3190
         $dataItem = DB::queryFirstRow(
3192 3191
             'SELECT i.*, n.title AS folder_title, o.enabled AS otp_for_item_enabled, o.phone_number AS otp_phone_number, o.secret AS otp_secret
3193
-            FROM ' . prefixTable('items') . ' AS i
3194
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3195
-            LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id)
3192
+            FROM ' . prefixTable('items').' AS i
3193
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3194
+            LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id)
3196 3195
             WHERE i.id = %i',
3197 3196
             $inputData['id']
3198 3197
         );
@@ -3214,7 +3213,7 @@  discard block
 block discarded – undo
3214 3213
         // Check if user has a role that is accepted
3215 3214
         $rows_tmp = DB::query(
3216 3215
             'SELECT role_id
3217
-            FROM ' . prefixTable('restriction_to_roles') . '
3216
+            FROM ' . prefixTable('restriction_to_roles').'
3218 3217
             WHERE item_id=%i',
3219 3218
             $inputData['id']
3220 3219
         );
@@ -3246,12 +3245,12 @@  discard block
 block discarded – undo
3246 3245
             // launch query
3247 3246
             $rows = DB::query(
3248 3247
                 'SELECT id, name, file, extension, size
3249
-                FROM ' . prefixTable('files') . '
3248
+                FROM ' . prefixTable('files').'
3250 3249
                 WHERE id_item = %i AND confirmed = 1',
3251 3250
                 $inputData['id']
3252 3251
             );
3253 3252
             foreach ($rows as $record) {
3254
-                $filename = basename($record['name'], '.' . $record['extension']);
3253
+                $filename = basename($record['name'], '.'.$record['extension']);
3255 3254
                 $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
3256 3255
 
3257 3256
                 array_push(
@@ -3264,7 +3263,7 @@  discard block
 block discarded – undo
3264 3263
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
3265 3264
                         'id' => $record['id'],
3266 3265
                         'key' => $session->get('user-key_tmp'),
3267
-                        'internalFilename' => basename($record['name'], '.' . $record['extension']),
3266
+                        'internalFilename' => basename($record['name'], '.'.$record['extension']),
3268 3267
                     )
3269 3268
                 );
3270 3269
             }
@@ -3302,7 +3301,7 @@  discard block
 block discarded – undo
3302 3301
                     array(
3303 3302
                         'latest_items' => implode(';', $session->get('user-latest_items')),
3304 3303
                     ),
3305
-                    'id=' . $session->get('user-id')
3304
+                    'id='.$session->get('user-id')
3306 3305
                 );
3307 3306
             }
3308 3307
 
@@ -3311,8 +3310,8 @@  discard block
 block discarded – undo
3311 3310
             $listOptionsForRoles = array();
3312 3311
             $rows = DB::query(
3313 3312
                 'SELECT r.role_id AS role_id, t.title AS title
3314
-                FROM ' . prefixTable('roles_values') . ' AS r
3315
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3313
+                FROM ' . prefixTable('roles_values').' AS r
3314
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3316 3315
                 WHERE r.folder_id = %i',
3317 3316
                 $dataItem['id_tree']
3318 3317
             );
@@ -3326,9 +3325,9 @@  discard block
 block discarded – undo
3326 3325
                 );
3327 3326
                 $rows2 = DB::query(
3328 3327
                     'SELECT id, login, fonction_id, email, name, lastname
3329
-                    FROM ' . prefixTable('users') . '
3328
+                    FROM ' . prefixTable('users').'
3330 3329
                     WHERE fonction_id LIKE %s',
3331
-                    '%' . $record['role_id'] . '%'
3330
+                    '%'.$record['role_id'].'%'
3332 3331
                 );
3333 3332
                 foreach ($rows2 as $record2) {
3334 3333
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3341,7 +3340,7 @@  discard block
 block discarded – undo
3341 3340
                                 array(
3342 3341
                                     'id' => (int) $record2['id'],
3343 3342
                                     'login' => $record2['login'],
3344
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3343
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3345 3344
                                     'email' => $record2['email'],
3346 3345
                                 )
3347 3346
                             );
@@ -3360,16 +3359,16 @@  discard block
 block discarded – undo
3360 3359
                 $path = '';
3361 3360
                 foreach ($arbo as $elem) {
3362 3361
                     if (empty($path) === true) {
3363
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3362
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3364 3363
                     } else {
3365
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3364
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3366 3365
                     }
3367 3366
                 }
3368 3367
                 // Build text to show user
3369 3368
                 if (empty($path) === true) {
3370 3369
                     $path = addslashes($dataItem['label']);
3371 3370
                 } else {
3372
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3371
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3373 3372
                 }
3374 3373
 
3375 3374
                 // Add Admins to notification list if expected
@@ -3392,7 +3391,7 @@  discard block
 block discarded – undo
3392 3391
                         array(
3393 3392
                             addslashes($session->get('user-login')),
3394 3393
                             $path,
3395
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3394
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3396 3395
                         ),
3397 3396
                         $lang->get('email_on_open_notification_mail')
3398 3397
                     ),
@@ -3402,7 +3401,7 @@  discard block
 block discarded – undo
3402 3401
             }
3403 3402
 
3404 3403
             // has this item a change proposal
3405
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3404
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3406 3405
             $returnArray['has_change_proposal'] = DB::count();
3407 3406
 
3408 3407
             // Setting
@@ -3413,7 +3412,7 @@  discard block
 block discarded – undo
3413 3412
             if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) {
3414 3413
                 DB::query(
3415 3414
                     'SELECT *
3416
-                    FROM ' . prefixTable('otv') . '
3415
+                    FROM ' . prefixTable('otv').'
3417 3416
                     WHERE item_id = %i
3418 3417
                     AND time_limit > %i',
3419 3418
                     $inputData['id'],
@@ -3513,7 +3512,7 @@  discard block
 block discarded – undo
3513 3512
         // Load item data
3514 3513
         $data = DB::queryFirstRow(
3515 3514
             'SELECT id_tree, id, label
3516
-            FROM ' . prefixTable('items') . '
3515
+            FROM ' . prefixTable('items').'
3517 3516
             WHERE id = %i OR item_key = %s',
3518 3517
             $inputData['itemId'],
3519 3518
             $inputData['itemKey']
@@ -3604,7 +3603,7 @@  discard block
 block discarded – undo
3604 3603
         // Load item data
3605 3604
         $dataItem = DB::queryFirstRow(
3606 3605
             'SELECT secret, enabled
3607
-            FROM ' . prefixTable('items_otp') . '
3606
+            FROM ' . prefixTable('items_otp').'
3608 3607
             WHERE item_id = %i',
3609 3608
             $inputData['id']
3610 3609
         );
@@ -3686,13 +3685,13 @@  discard block
 block discarded – undo
3686 3685
 
3687 3686
         // Check if user is allowed to access this folder
3688 3687
         if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) {
3689
-            echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3688
+            echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3690 3689
             break;
3691 3690
         }
3692 3691
 
3693 3692
         // Check if title doesn't contains html codes
3694 3693
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3695
-            echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]';
3694
+            echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]';
3696 3695
             break;
3697 3696
         }
3698 3697
         // check that title is not numeric
@@ -3703,9 +3702,9 @@  discard block
 block discarded – undo
3703 3702
 
3704 3703
         // Check if duplicate folders name are allowed
3705 3704
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3706
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3705
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3707 3706
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3708
-                echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]';
3707
+                echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]';
3709 3708
                 break;
3710 3709
             }
3711 3710
         }
@@ -3713,7 +3712,7 @@  discard block
 block discarded – undo
3713 3712
         // query on folder
3714 3713
         $data = DB::queryfirstrow(
3715 3714
             'SELECT parent_id, personal_folder
3716
-            FROM ' . prefixTable('nested_tree') . '
3715
+            FROM ' . prefixTable('nested_tree').'
3717 3716
             WHERE id = %i',
3718 3717
             $inputData['folderId']
3719 3718
         );
@@ -3723,20 +3722,20 @@  discard block
 block discarded – undo
3723 3722
         if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') {
3724 3723
             $data = DB::queryfirstrow(
3725 3724
                 'SELECT valeur
3726
-                FROM ' . prefixTable('misc') . '
3725
+                FROM ' . prefixTable('misc').'
3727 3726
                 WHERE intitule = %i AND type = %s',
3728 3727
                 $data['parent_id'],
3729 3728
                 'complex'
3730 3729
             );
3731 3730
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3732
-                echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3731
+                echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3733 3732
                 break;
3734 3733
             }
3735 3734
         }
3736 3735
 
3737 3736
         // update Folders table
3738 3737
         $tmp = DB::queryFirstRow(
3739
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3738
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3740 3739
             $dataReceived['folder']
3741 3740
         );
3742 3741
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) {
@@ -3850,7 +3849,7 @@  discard block
 block discarded – undo
3850 3849
             $uniqueLoadData['path'] = $arr_arbo;
3851 3850
 
3852 3851
             // store last folder accessed in cookie
3853
-            $arr_cookie_options = array (
3852
+            $arr_cookie_options = array(
3854 3853
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3855 3854
                 'path' => '/', 
3856 3855
                 'secure' => true,
@@ -3865,7 +3864,7 @@  discard block
 block discarded – undo
3865 3864
             foreach ($session->get('user-roles_array') as $role) {
3866 3865
                 $roleQ = DB::queryfirstrow(
3867 3866
                     'SELECT allow_pw_change
3868
-                    FROM ' . prefixTable('roles_title') . '
3867
+                    FROM ' . prefixTable('roles_title').'
3869 3868
                     WHERE id = %i',
3870 3869
                     $role
3871 3870
                 );
@@ -3896,11 +3895,11 @@  discard block
 block discarded – undo
3896 3895
                 
3897 3896
                 foreach ($session->get('user-roles_array') as $role) {
3898 3897
                     $access = DB::queryFirstRow(
3899
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3898
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3900 3899
                         $role,
3901 3900
                         $inputData['id']
3902 3901
                     );
3903
-                    if (DB::count()>0) {
3902
+                    if (DB::count() > 0) {
3904 3903
                         if ($access['type'] === 'R') {
3905 3904
                             array_push($arrTmp, 10);
3906 3905
                         } elseif ($access['type'] === 'W') {
@@ -3965,7 +3964,7 @@  discard block
 block discarded – undo
3965 3964
             } else {
3966 3965
                 DB::query(
3967 3966
                     'SELECT *
3968
-                    FROM ' . prefixTable('items') . '
3967
+                    FROM ' . prefixTable('items').'
3969 3968
                     WHERE inactif = %i',
3970 3969
                     0
3971 3970
                 );
@@ -3975,7 +3974,7 @@  discard block
 block discarded – undo
3975 3974
 
3976 3975
             // Get folder complexity
3977 3976
             $folderComplexity = DB::queryFirstRow(
3978
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
3977
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
3979 3978
                 'complex',
3980 3979
                 $inputData['id']
3981 3980
             );
@@ -3987,7 +3986,7 @@  discard block
 block discarded – undo
3987 3986
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
3988 3987
                 $folderRow = DB::query(
3989 3988
                     'SELECT id_category
3990
-                    FROM ' . prefixTable('categories_folders') . '
3989
+                    FROM ' . prefixTable('categories_folders').'
3991 3990
                     WHERE id_folder = %i',
3992 3991
                     $inputData['id']
3993 3992
                 );
@@ -4102,9 +4101,9 @@  discard block
 block discarded – undo
4102 4101
             // List all ITEMS
4103 4102
             if ($folderIsPf === false) {
4104 4103
                 $where->add('i.inactif=%i', 0);
4105
-                $sql_e='(SELECT date FROM ' . prefixTable('log_items') 
4104
+                $sql_e = '(SELECT date FROM '.prefixTable('log_items') 
4106 4105
                     . " WHERE action = 'at_creation' AND id_item=i.id " 
4107
-                    . 'union all SELECT date FROM '. prefixTable('log_items') 
4106
+                    . 'union all SELECT date FROM '.prefixTable('log_items') 
4108 4107
                     . " WHERE action = 'at_modification' AND raison = 'at_pw'
4109 4108
                     AND id_item=i.id ORDER BY date DESC LIMIT 1)";
4110 4109
                 $where->add('l.date=%l', $sql_e);
@@ -4112,8 +4111,8 @@  discard block
 block discarded – undo
4112 4111
                     $where->add('i.id IN %ls', explode(',', $limited_to_items));
4113 4112
                 }
4114 4113
 
4115
-                $query_limit = ' LIMIT ' .
4116
-                    $start . ',' .
4114
+                $query_limit = ' LIMIT '.
4115
+                    $start.','.
4117 4116
                     $post_nb_items_to_display_once;
4118 4117
                 //db::debugmode(true);
4119 4118
                 $rows = DB::query(
@@ -4125,9 +4124,9 @@  discard block
 block discarded – undo
4125 4124
                     l.id_user AS log_user,
4126 4125
                     i.url AS link,
4127 4126
                     i.email AS email
4128
-                    FROM ' . prefixTable('items') . ' AS i
4129
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4130
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4127
+                    FROM ' . prefixTable('items').' AS i
4128
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4129
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4131 4130
                     WHERE %l
4132 4131
                     GROUP BY i.id, l.date, l.id_user, l.action
4133 4132
                     ORDER BY i.label ASC, l.date DESC' . $query_limit,
@@ -4147,9 +4146,9 @@  discard block
 block discarded – undo
4147 4146
                     l.id_user AS log_user,
4148 4147
                     i.url AS link,
4149 4148
                     i.email AS email
4150
-                    FROM ' . prefixTable('items') . ' AS i
4151
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4152
-                    INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item)
4149
+                    FROM ' . prefixTable('items').' AS i
4150
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4151
+                    INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item)
4153 4152
                     WHERE %l
4154 4153
                     GROUP BY i.id, l.date, l.id_user, l.action
4155 4154
                     ORDER BY i.label ASC, l.date DESC',
@@ -4180,7 +4179,7 @@  discard block
 block discarded – undo
4180 4179
                     $item_is_restricted_to_role = false;
4181 4180
                     DB::queryfirstrow(
4182 4181
                         'SELECT role_id
4183
-                        FROM ' . prefixTable('restriction_to_roles') . '
4182
+                        FROM ' . prefixTable('restriction_to_roles').'
4184 4183
                         WHERE item_id = %i',
4185 4184
                         $record['id']
4186 4185
                     );
@@ -4192,7 +4191,7 @@  discard block
 block discarded – undo
4192 4191
                     $user_is_included_in_role = false;
4193 4192
                     DB::query(
4194 4193
                         'SELECT role_id
4195
-                        FROM ' . prefixTable('restriction_to_roles') . '
4194
+                        FROM ' . prefixTable('restriction_to_roles').'
4196 4195
                         WHERE item_id = %i AND role_id IN %ls',
4197 4196
                         $record['id'],
4198 4197
                         $session->get('user-roles_array')
@@ -4402,9 +4401,9 @@  discard block
 block discarded – undo
4402 4401
         if ((int) $start === 0) {
4403 4402
             DB::query(
4404 4403
                 'SELECT i.id
4405
-                FROM ' . prefixTable('items') . ' as i
4406
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4407
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
4404
+                FROM ' . prefixTable('items').' as i
4405
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4406
+                INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
4408 4407
                 WHERE %l
4409 4408
                 ORDER BY i.label ASC, l.date DESC',
4410 4409
                 $where
@@ -4469,8 +4468,8 @@  discard block
 block discarded – undo
4469 4468
         $dataItem = DB::queryfirstrow(
4470 4469
             'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id,
4471 4470
                     i.label AS label, i.id_tree AS id_tree
4472
-            FROM ' . prefixTable('items') . ' AS i
4473
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4471
+            FROM ' . prefixTable('items').' AS i
4472
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4474 4473
             WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)',
4475 4474
             $session->get('user-id'),
4476 4475
             $inputData['itemKey'] ?? '',
@@ -4565,7 +4564,7 @@  discard block
 block discarded – undo
4565 4564
             // get if existing edition lock
4566 4565
             $dataItemEditionLocks = DB::query(
4567 4566
                 'SELECT timestamp, user_id
4568
-                FROM ' . prefixTable('items_edition') . '
4567
+                FROM ' . prefixTable('items_edition').'
4569 4568
                 WHERE item_id = %i 
4570 4569
                 ORDER BY increment_id DESC',
4571 4570
                 $inputData['itemId']
@@ -4574,7 +4573,7 @@  discard block
 block discarded – undo
4574 4573
             if (WIP === true) error_log('Existing edition locks: '.DB::count());
4575 4574
 
4576 4575
             // Check if item has no edition lock
4577
-            if ((int) DB::count() > 0 ) {
4576
+            if ((int) DB::count() > 0) {
4578 4577
                 // get last edition lock
4579 4578
                 $dataLastItemEditionLock = $dataItemEditionLocks[0];
4580 4579
 
@@ -4584,10 +4583,10 @@  discard block
 block discarded – undo
4584 4583
                 } else {
4585 4584
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4586 4585
                 }
4587
-                if (WIP === true) error_log('delay: ' . $delay);
4586
+                if (WIP === true) error_log('delay: '.$delay);
4588 4587
 
4589 4588
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4590
-                if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
4589
+                if (round(abs(time() - $dataTmp['timestamp']), 0) > $delay) {
4591 4590
                     // Case where time is expired
4592 4591
                     // In this case, delete edition lock and possible ongoing processes
4593 4592
                     // and continue editing this time
@@ -4604,7 +4603,7 @@  discard block
 block discarded – undo
4604 4603
                         // Get process Id
4605 4604
                         $processDetail = DB::queryFirstRow(
4606 4605
                             'SELECT increment_id
4607
-                            FROM ' . prefixTable('background_tasks') . '
4606
+                            FROM ' . prefixTable('background_tasks').'
4608 4607
                             WHERE item_id = %i AND finished_at = ""',
4609 4608
                             $inputData['itemId']
4610 4609
                         );
@@ -4622,7 +4621,7 @@  discard block
 block discarded – undo
4622 4621
                     // get if existing process ongoing for this item
4623 4622
                     $dataItemProcessOngoing = DB::queryFirstRow(
4624 4623
                         'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id
4625
-                        FROM ' . prefixTable('background_tasks') . '
4624
+                        FROM ' . prefixTable('background_tasks').'
4626 4625
                         WHERE item_id = %i AND finished_at = ""
4627 4626
                         ORDER BY increment_id DESC',
4628 4627
                         $inputData['itemId']
@@ -4649,7 +4648,7 @@  discard block
 block discarded – undo
4649 4648
                         );
4650 4649
                         break;
4651 4650
                     }
4652
-                } elseif (round(abs(time() - $dataTmp['timestamp']),0) <= $delay) {
4651
+                } elseif (round(abs(time() - $dataTmp['timestamp']), 0) <= $delay) {
4653 4652
                     // Case where edition lock is already taken by another user
4654 4653
                     // Then no edition is possible
4655 4654
                     $returnValues = array(
@@ -4678,7 +4677,7 @@  discard block
 block discarded – undo
4678 4677
         // do query on this folder
4679 4678
         $data_this_folder = DB::queryFirstRow(
4680 4679
             'SELECT id, personal_folder, title
4681
-            FROM ' . prefixTable('nested_tree') . '
4680
+            FROM ' . prefixTable('nested_tree').'
4682 4681
             WHERE id = %s',
4683 4682
             $inputData['folderId']
4684 4683
         );
@@ -4718,8 +4717,8 @@  discard block
 block discarded – undo
4718 4717
         $visibilite = '';
4719 4718
         $data = DB::queryFirstRow(
4720 4719
             'SELECT m.valeur, n.personal_folder
4721
-            FROM ' . prefixTable('misc') . ' AS m
4722
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4720
+            FROM ' . prefixTable('misc').' AS m
4721
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4723 4722
             WHERE type=%s AND intitule = %s',
4724 4723
             'complex',
4725 4724
             $inputData['folderId']
@@ -4732,8 +4731,8 @@  discard block
 block discarded – undo
4732 4731
             // Prepare Item actual visibility (what Users/Roles can see it)
4733 4732
             $rows = DB::query(
4734 4733
                 'SELECT t.title
4735
-                FROM ' . prefixTable('roles_values') . ' as v
4736
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4734
+                FROM ' . prefixTable('roles_values').' as v
4735
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4737 4736
                 WHERE v.folder_id = %i
4738 4737
                 GROUP BY title',
4739 4738
                 $inputData['folderId']
@@ -4742,7 +4741,7 @@  discard block
 block discarded – undo
4742 4741
                 if (empty($visibilite)) {
4743 4742
                     $visibilite = $record['title'];
4744 4743
                 } else {
4745
-                    $visibilite .= ' - ' . $record['title'];
4744
+                    $visibilite .= ' - '.$record['title'];
4746 4745
                 }
4747 4746
             }
4748 4747
         } else {
@@ -4752,14 +4751,14 @@  discard block
 block discarded – undo
4752 4751
             // do new query to know if current folder is pf
4753 4752
             $data_pf = DB::queryFirstRow(
4754 4753
                 'SELECT personal_folder
4755
-                FROM ' . prefixTable('nested_tree') . '
4754
+                FROM ' . prefixTable('nested_tree').'
4756 4755
                 WHERE id = %s',
4757 4756
                 $inputData['folderId']
4758 4757
             );
4759 4758
             
4760 4759
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4761 4760
             
4762
-            $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')';
4761
+            $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')';
4763 4762
         }
4764 4763
 
4765 4764
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4769,8 +4768,8 @@  discard block
 block discarded – undo
4769 4768
         $listOptionsForRoles = array();
4770 4769
         $rows = DB::query(
4771 4770
             'SELECT r.role_id AS role_id, t.title AS title
4772
-            FROM ' . prefixTable('roles_values') . ' AS r
4773
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4771
+            FROM ' . prefixTable('roles_values').' AS r
4772
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4774 4773
             WHERE r.folder_id = %i',
4775 4774
             $inputData['folderId']
4776 4775
         );
@@ -4784,7 +4783,7 @@  discard block
 block discarded – undo
4784 4783
             );
4785 4784
             $rows2 = DB::query(
4786 4785
                 'SELECT id, login, fonction_id, email, name, lastname
4787
-                FROM ' . prefixTable('users') . '
4786
+                FROM ' . prefixTable('users').'
4788 4787
                 WHERE admin = 0 AND fonction_id is not null'
4789 4788
             );
4790 4789
             foreach ($rows2 as $record2) {
@@ -4798,7 +4797,7 @@  discard block
 block discarded – undo
4798 4797
                             array(
4799 4798
                                 'id' => $record2['id'],
4800 4799
                                 'login' => $record2['login'],
4801
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4800
+                                'name' => $record2['name'].' '.$record2['lastname'],
4802 4801
                                 'email' => $record2['email'],
4803 4802
                             )
4804 4803
                         );
@@ -4815,13 +4814,13 @@  discard block
 block discarded – undo
4815 4814
                 //db::debugmode(true);
4816 4815
                 $access = DB::queryFirstRow(
4817 4816
                     'SELECT type
4818
-                    FROM ' . prefixTable('roles_values') . '
4817
+                    FROM ' . prefixTable('roles_values').'
4819 4818
                     WHERE role_id = %i AND folder_id = %i',
4820 4819
                     $role,
4821 4820
                     $inputData['folderId']
4822 4821
                 );
4823 4822
                 //db::debugmode(false);
4824
-                if (DB::count()>0) {
4823
+                if (DB::count() > 0) {
4825 4824
                     if ($access['type'] === 'R') {
4826 4825
                         array_push($arrTmp, 10);
4827 4826
                     } elseif ($access['type'] === 'W') {
@@ -4849,7 +4848,7 @@  discard block
 block discarded – undo
4849 4848
             // Check if personal folder is owned by user
4850 4849
             $folder = DB::queryFirstRow(
4851 4850
                 'SELECT id
4852
-                FROM ' . prefixTable('nested_tree') . '
4851
+                FROM ' . prefixTable('nested_tree').'
4853 4852
                 WHERE title = %s',
4854 4853
                 $session->get('user-id'),
4855 4854
             );
@@ -4954,7 +4953,7 @@  discard block
 block discarded – undo
4954 4953
         // Get some info before deleting
4955 4954
         $data = DB::queryFirstRow(
4956 4955
             'SELECT name, id_item, file
4957
-            FROM ' . prefixTable('files') . '
4956
+            FROM ' . prefixTable('files').'
4958 4957
             WHERE id = %i',
4959 4958
             $fileId
4960 4959
         );
@@ -4962,7 +4961,7 @@  discard block
 block discarded – undo
4962 4961
         // Load item data
4963 4962
         $data_item = DB::queryFirstRow(
4964 4963
             'SELECT id_tree
4965
-            FROM ' . prefixTable('items') . '
4964
+            FROM ' . prefixTable('items').'
4966 4965
             WHERE id = %i',
4967 4966
             $data['id_item']
4968 4967
         );
@@ -4992,7 +4991,7 @@  discard block
 block discarded – undo
4992 4991
                 $session->get('user-id'),
4993 4992
                 'at_modification',
4994 4993
                 $session->get('user-login'),
4995
-                'at_del_file : ' . $data['name']
4994
+                'at_del_file : '.$data['name']
4996 4995
             );
4997 4996
 
4998 4997
             // DElete sharekeys
@@ -5003,7 +5002,7 @@  discard block
 block discarded – undo
5003 5002
             );
5004 5003
 
5005 5004
             // Delete file from server
5006
-            $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']);
5005
+            $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']);
5007 5006
             $fileToDelete = realpath($fileToDelete);
5008 5007
             if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) {
5009 5008
                 fileDelete($fileToDelete, $SETTINGS);
@@ -5057,7 +5056,7 @@  discard block
 block discarded – undo
5057 5056
             // Update SESSION with this new favourite
5058 5057
             $data = DB::queryfirstrow(
5059 5058
                 'SELECT label,id_tree
5060
-                FROM ' . prefixTable('items') . '
5059
+                FROM ' . prefixTable('items').'
5061 5060
                 WHERE id = %i',
5062 5061
                 $inputData['itemId']
5063 5062
             );
@@ -5066,7 +5065,7 @@  discard block
 block discarded – undo
5066 5065
                 [
5067 5066
                     $inputData['itemId'] => [
5068 5067
                         'label' => $data['label'],
5069
-                        'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
5068
+                        'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
5070 5069
                     ],
5071 5070
                 ],
5072 5071
                 'add'
@@ -5135,8 +5134,8 @@  discard block
 block discarded – undo
5135 5134
         // get data about item
5136 5135
         $dataSource = DB::queryfirstrow(
5137 5136
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5138
-            FROM ' . prefixTable('items') . ' as i
5139
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5137
+            FROM ' . prefixTable('items').' as i
5138
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5140 5139
             WHERE i.id=%i',
5141 5140
             $inputData['itemId']
5142 5141
         );
@@ -5180,7 +5179,7 @@  discard block
 block discarded – undo
5180 5179
         // get data about new folder
5181 5180
         $dataDestination = DB::queryfirstrow(
5182 5181
             'SELECT personal_folder, title
5183
-            FROM ' . prefixTable('nested_tree') . '
5182
+            FROM ' . prefixTable('nested_tree').'
5184 5183
             WHERE id = %i',
5185 5184
             $inputData['folderId']
5186 5185
         );
@@ -5233,7 +5232,7 @@  discard block
 block discarded – undo
5233 5232
             // Get fields for this Item
5234 5233
             $rows = DB::query(
5235 5234
                 'SELECT id
5236
-                FROM ' . prefixTable('categories_items') . '
5235
+                FROM ' . prefixTable('categories_items').'
5237 5236
                 WHERE item_id = %i',
5238 5237
                 $inputData['itemId']
5239 5238
             );
@@ -5250,7 +5249,7 @@  discard block
 block discarded – undo
5250 5249
             // Get FILES for this Item
5251 5250
             $rows = DB::query(
5252 5251
                 'SELECT id
5253
-                FROM ' . prefixTable('files') . '
5252
+                FROM ' . prefixTable('files').'
5254 5253
                 WHERE id_item = %i',
5255 5254
                 $inputData['itemId']
5256 5255
             );
@@ -5297,7 +5296,7 @@  discard block
 block discarded – undo
5297 5296
             // Get the ITEM object key for the user
5298 5297
             $userKey = DB::queryFirstRow(
5299 5298
                 'SELECT share_key
5300
-                FROM ' . prefixTable('sharekeys_items') . '
5299
+                FROM ' . prefixTable('sharekeys_items').'
5301 5300
                 WHERE user_id = %i AND object_id = %i',
5302 5301
                 $session->get('user-id'),
5303 5302
                 $inputData['itemId']
@@ -5308,7 +5307,7 @@  discard block
 block discarded – undo
5308 5307
                 // This is a public object
5309 5308
                 $users = DB::query(
5310 5309
                     'SELECT id, public_key
5311
-                    FROM ' . prefixTable('users') . '
5310
+                    FROM ' . prefixTable('users').'
5312 5311
                     WHERE id NOT IN %li
5313 5312
                     AND public_key != ""',
5314 5313
                     $tpUsersIDs
@@ -5331,14 +5330,14 @@  discard block
 block discarded – undo
5331 5330
             // Get fields for this Item
5332 5331
             $rows = DB::query(
5333 5332
                 'SELECT id
5334
-                FROM ' . prefixTable('categories_items') . '
5333
+                FROM ' . prefixTable('categories_items').'
5335 5334
                 WHERE item_id = %i',
5336 5335
                 $inputData['itemId']
5337 5336
             );
5338 5337
             foreach ($rows as $field) {
5339 5338
                 $userKey = DB::queryFirstRow(
5340 5339
                     'SELECT share_key
5341
-                    FROM ' . prefixTable('sharekeys_fields') . '
5340
+                    FROM ' . prefixTable('sharekeys_fields').'
5342 5341
                     WHERE user_id = %i AND object_id = %i',
5343 5342
                     $session->get('user-id'),
5344 5343
                     $field['id']
@@ -5349,7 +5348,7 @@  discard block
 block discarded – undo
5349 5348
                     // This is a public object
5350 5349
                     $users = DB::query(
5351 5350
                         'SELECT id, public_key
5352
-                        FROM ' . prefixTable('users') . '
5351
+                        FROM ' . prefixTable('users').'
5353 5352
                         WHERE id NOT IN %li
5354 5353
                         AND public_key != ""',
5355 5354
                         $tpUsersIDs
@@ -5372,14 +5371,14 @@  discard block
 block discarded – undo
5372 5371
             // Get FILES for this Item
5373 5372
             $rows = DB::query(
5374 5373
                 'SELECT id
5375
-                FROM ' . prefixTable('files') . '
5374
+                FROM ' . prefixTable('files').'
5376 5375
                 WHERE id_item = %i',
5377 5376
                 $inputData['itemId']
5378 5377
             );
5379 5378
             foreach ($rows as $attachment) {
5380 5379
                 $userKey = DB::queryFirstRow(
5381 5380
                     'SELECT share_key
5382
-                    FROM ' . prefixTable('sharekeys_files') . '
5381
+                    FROM ' . prefixTable('sharekeys_files').'
5383 5382
                     WHERE user_id = %i AND object_id = %i',
5384 5383
                     $session->get('user-id'),
5385 5384
                     $attachment['id']
@@ -5390,7 +5389,7 @@  discard block
 block discarded – undo
5390 5389
                     // This is a public object
5391 5390
                     $users = DB::query(
5392 5391
                         'SELECT id, public_key
5393
-                        FROM ' . prefixTable('users') . '
5392
+                        FROM ' . prefixTable('users').'
5394 5393
                         WHERE id NOT IN %li
5395 5394
                         AND public_key != ""',
5396 5395
                         $tpUsersIDs
@@ -5431,7 +5430,7 @@  discard block
 block discarded – undo
5431 5430
             $session->get('user-id'),
5432 5431
             'at_modification',
5433 5432
             $session->get('user-login'),
5434
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5433
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5435 5434
         );
5436 5435
 
5437 5436
         // Update cache table
@@ -5490,8 +5489,8 @@  discard block
 block discarded – undo
5490 5489
                 // get data about item
5491 5490
                 $dataSource = DB::queryfirstrow(
5492 5491
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5493
-                    FROM ' . prefixTable('items') . ' as i
5494
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5492
+                    FROM ' . prefixTable('items').' as i
5493
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5495 5494
                     WHERE i.id=%i',
5496 5495
                     $item_id
5497 5496
                 );
@@ -5513,7 +5512,7 @@  discard block
 block discarded – undo
5513 5512
 
5514 5513
                 // get data about new folder
5515 5514
                 $dataDestination = DB::queryfirstrow(
5516
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5515
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5517 5516
                     $inputData['folderId']
5518 5517
                 );
5519 5518
 
@@ -5555,7 +5554,7 @@  discard block
 block discarded – undo
5555 5554
                     // Get fields for this Item
5556 5555
                     $rows = DB::query(
5557 5556
                         'SELECT id
5558
-                        FROM ' . prefixTable('categories_items') . '
5557
+                        FROM ' . prefixTable('categories_items').'
5559 5558
                         WHERE item_id = %i',
5560 5559
                         $item_id
5561 5560
                     );
@@ -5572,7 +5571,7 @@  discard block
 block discarded – undo
5572 5571
                     // Get FILES for this Item
5573 5572
                     $rows = DB::query(
5574 5573
                         'SELECT id
5575
-                        FROM ' . prefixTable('files') . '
5574
+                        FROM ' . prefixTable('files').'
5576 5575
                         WHERE id_item = %i',
5577 5576
                         $item_id
5578 5577
                     );
@@ -5627,7 +5626,7 @@  discard block
 block discarded – undo
5627 5626
                     // Get the ITEM object key for the user
5628 5627
                     $userKey = DB::queryFirstRow(
5629 5628
                         'SELECT share_key
5630
-                        FROM ' . prefixTable('sharekeys_items') . '
5629
+                        FROM ' . prefixTable('sharekeys_items').'
5631 5630
                         WHERE user_id = %i AND object_id = %i',
5632 5631
                         $session->get('user-id'),
5633 5632
                         $item_id
@@ -5638,7 +5637,7 @@  discard block
 block discarded – undo
5638 5637
                         // This is a public object
5639 5638
                         $users = DB::query(
5640 5639
                             'SELECT id, public_key
5641
-                            FROM ' . prefixTable('users') . '
5640
+                            FROM ' . prefixTable('users').'
5642 5641
                             WHERE id NOT IN %li
5643 5642
                             AND public_key != ""',
5644 5643
                             $tpUsersIDs
@@ -5661,14 +5660,14 @@  discard block
 block discarded – undo
5661 5660
                     // Get fields for this Item
5662 5661
                     $rows = DB::query(
5663 5662
                         'SELECT id
5664
-                        FROM ' . prefixTable('categories_items') . '
5663
+                        FROM ' . prefixTable('categories_items').'
5665 5664
                         WHERE item_id = %i',
5666 5665
                         $item_id
5667 5666
                     );
5668 5667
                     foreach ($rows as $field) {
5669 5668
                         $userKey = DB::queryFirstRow(
5670 5669
                             'SELECT share_key
5671
-                            FROM ' . prefixTable('sharekeys_fields') . '
5670
+                            FROM ' . prefixTable('sharekeys_fields').'
5672 5671
                             WHERE user_id = %i AND object_id = %i',
5673 5672
                             $session->get('user-id'),
5674 5673
                             $field['id']
@@ -5679,7 +5678,7 @@  discard block
 block discarded – undo
5679 5678
                             // This is a public object
5680 5679
                             $users = DB::query(
5681 5680
                                 'SELECT id, public_key
5682
-                                FROM ' . prefixTable('users') . '
5681
+                                FROM ' . prefixTable('users').'
5683 5682
                                 WHERE id NOT IN %li
5684 5683
                                 AND public_key != ""',
5685 5684
                                 $tpUsersIDs
@@ -5703,14 +5702,14 @@  discard block
 block discarded – undo
5703 5702
                     // Get FILES for this Item
5704 5703
                     $rows = DB::query(
5705 5704
                         'SELECT id
5706
-                        FROM ' . prefixTable('files') . '
5705
+                        FROM ' . prefixTable('files').'
5707 5706
                         WHERE id_item = %i',
5708 5707
                         $item_id
5709 5708
                     );
5710 5709
                     foreach ($rows as $attachment) {
5711 5710
                         $userKey = DB::queryFirstRow(
5712 5711
                             'SELECT share_key
5713
-                            FROM ' . prefixTable('sharekeys_files') . '
5712
+                            FROM ' . prefixTable('sharekeys_files').'
5714 5713
                             WHERE user_id = %i AND object_id = %i',
5715 5714
                             $session->get('user-id'),
5716 5715
                             $attachment['id']
@@ -5721,7 +5720,7 @@  discard block
 block discarded – undo
5721 5720
                             // This is a public object
5722 5721
                             $users = DB::query(
5723 5722
                                 'SELECT id, public_key
5724
-                                FROM ' . prefixTable('users') . '
5723
+                                FROM ' . prefixTable('users').'
5725 5724
                                 WHERE id NOT IN %li
5726 5725
                                 AND public_key != ""',
5727 5726
                                 $tpUsersIDs
@@ -5761,13 +5760,13 @@  discard block
 block discarded – undo
5761 5760
                     $session->get('user-id'),
5762 5761
                     'at_modification',
5763 5762
                     $session->get('user-login'),
5764
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5763
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5765 5764
                 );
5766 5765
             }
5767 5766
         }
5768 5767
 
5769 5768
         // reload cache table
5770
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5769
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5771 5770
         updateCacheTable('reload', null);
5772 5771
 
5773 5772
         echo (string) prepareExchangedData(
@@ -5831,7 +5830,7 @@  discard block
 block discarded – undo
5831 5830
                 // get info
5832 5831
                 $dataSource = DB::queryfirstrow(
5833 5832
                     'SELECT label, id_tree
5834
-                    FROM ' . prefixTable('items') . '
5833
+                    FROM ' . prefixTable('items').'
5835 5834
                     WHERE id=%i',
5836 5835
                     $item_id
5837 5836
                 );
@@ -5932,14 +5931,14 @@  discard block
 block discarded – undo
5932 5931
             // Variables
5933 5932
             $dataAuthor = DB::queryfirstrow(
5934 5933
                 'SELECT email,login
5935
-                FROM ' . prefixTable('users') . '
5934
+                FROM ' . prefixTable('users').'
5936 5935
                 WHERE id = %i',
5937 5936
                 $post_content[1]
5938 5937
             );
5939 5938
 
5940 5939
             $dataItem = DB::queryfirstrow(
5941 5940
                 'SELECT label, id_tree
5942
-                FROM ' . prefixTable('items') . '
5941
+                FROM ' . prefixTable('items').'
5943 5942
                 WHERE id = %i',
5944 5943
                 $post_content[0]
5945 5944
             );
@@ -5956,7 +5955,7 @@  discard block
 block discarded – undo
5956 5955
                 $lang->get('email_request_access_subject'),
5957 5956
                 str_replace(
5958 5957
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5959
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5958
+                    array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5960 5959
                     $lang->get('email_request_access_mail')
5961 5960
                 ),
5962 5961
                 $dataAuthor['email'],
@@ -5965,7 +5964,7 @@  discard block
 block discarded – undo
5965 5964
         } elseif ($inputData['cat'] === 'share_this_item') {
5966 5965
             $dataItem = DB::queryfirstrow(
5967 5966
                 'SELECT label,id_tree
5968
-                FROM ' . prefixTable('items') . '
5967
+                FROM ' . prefixTable('items').'
5969 5968
                 WHERE id= %i',
5970 5969
                 $inputData['id']
5971 5970
             );
@@ -5988,7 +5987,7 @@  discard block
 block discarded – undo
5988 5987
                     ),
5989 5988
                     array(
5990 5989
                         empty($SETTINGS['email_server_url']) === false ?
5991
-                            $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'],
5990
+                            $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'],
5992 5991
                         addslashes($session->get('user-login')),
5993 5992
                         addslashes($path),
5994 5993
                     ),
@@ -6037,8 +6036,8 @@  discard block
 block discarded – undo
6037 6036
         // Get all informations for this item
6038 6037
         $dataItem = DB::queryfirstrow(
6039 6038
             'SELECT *
6040
-            FROM ' . prefixTable('items') . ' as i
6041
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
6039
+            FROM ' . prefixTable('items').' as i
6040
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
6042 6041
             WHERE i.id=%i AND l.action = %s',
6043 6042
             $item_id,
6044 6043
             'at_creation'
@@ -6067,18 +6066,18 @@  discard block
 block discarded – undo
6067 6066
                 $session->get('user-login'),
6068 6067
                 htmlspecialchars_decode($label, ENT_QUOTES),
6069 6068
                 null,
6070
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
6069
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
6071 6070
             );
6072 6071
             // Prepare new line
6073 6072
             $data = DB::queryfirstrow(
6074
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
6073
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
6075 6074
                 $item_id
6076 6075
             );
6077
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison'];
6076
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison'];
6078 6077
             // send back
6079 6078
             $data = array(
6080 6079
                 'error' => '',
6081
-                'new_line' => '<br>' . addslashes($historic),
6080
+                'new_line' => '<br>'.addslashes($historic),
6082 6081
             );
6083 6082
             echo (string) prepareExchangedData(
6084 6083
                 $data,
@@ -6153,8 +6152,8 @@  discard block
 block discarded – undo
6153 6152
         // Should we log a password change?
6154 6153
         $itemQ = DB::queryFirstRow(
6155 6154
             'SELECT s.share_key, i.pw
6156
-            FROM ' . prefixTable('items') . ' AS i
6157
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
6155
+            FROM ' . prefixTable('items').' AS i
6156
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
6158 6157
             WHERE s.user_id = %i AND s.object_id = %i',
6159 6158
             $session->get('user-id'),
6160 6159
             $dataReceived['id']
@@ -6209,7 +6208,7 @@  discard block
 block discarded – undo
6209 6208
         if (isset($SETTINGS['otv_expiration_period']) === false) {
6210 6209
             $SETTINGS['otv_expiration_period'] = 7;
6211 6210
         }
6212
-        $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session);
6211
+        $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6213 6212
 
6214 6213
         echo json_encode(
6215 6214
             array(
@@ -6240,7 +6239,7 @@  discard block
 block discarded – undo
6240 6239
         // get parameters from original link
6241 6240
         $url = $dataReceived['original_link'];
6242 6241
         $parts = parse_url($url);
6243
-        if(isset($parts['query'])){
6242
+        if (isset($parts['query'])) {
6244 6243
             parse_str($parts['query'], $orignal_link_parameters);
6245 6244
         } else {
6246 6245
             $orignal_link_parameters = array();
@@ -6271,13 +6270,13 @@  discard block
 block discarded – undo
6271 6270
             $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME);
6272 6271
             $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST);
6273 6272
             if (str_contains($domain_host, 'www.') === true) {
6274
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4);
6273
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4);
6275 6274
             } else {
6276
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host;
6275
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host;
6277 6276
             }
6278
-            $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session);
6277
+            $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session);
6279 6278
         } else {
6280
-            $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session);
6279
+            $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6281 6280
         }
6282 6281
 
6283 6282
         echo (string) prepareExchangedData(
@@ -6312,8 +6311,8 @@  discard block
 block discarded – undo
6312 6311
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
6313 6312
             f.extension AS extension, f.type AS type,
6314 6313
             s.share_key AS share_key
6315
-            FROM ' . prefixTable('files') . ' AS f
6316
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
6314
+            FROM ' . prefixTable('files').' AS f
6315
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
6317 6316
             WHERE s.user_id = %i AND s.object_id = %i',
6318 6317
             $session->get('user-id'),
6319 6318
             $inputData['id']
@@ -6334,7 +6333,7 @@  discard block
 block discarded – undo
6334 6333
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
6335 6334
 
6336 6335
         // prepare image info
6337
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
6336
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
6338 6337
         $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title;
6339 6338
         
6340 6339
         // Get image content
@@ -6361,7 +6360,7 @@  discard block
 block discarded – undo
6361 6360
         echo (string) prepareExchangedData(
6362 6361
             array(
6363 6362
                 'error' => false,
6364
-                'filename' => $post_title . '.' . $file_info['extension'],
6363
+                'filename' => $post_title.'.'.$file_info['extension'],
6365 6364
                 'file_type' => $file_info['type'],
6366 6365
                 'file_content' => $fileContent,
6367 6366
             ),
@@ -6475,7 +6474,7 @@  discard block
 block discarded – undo
6475 6474
                     $arbo = $tree->getPath($folder->id, false);
6476 6475
                     $path = '';
6477 6476
                     foreach ($arbo as $elem) {
6478
-                        $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6477
+                        $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6479 6478
                     }
6480 6479
 
6481 6480
                     // Build array
@@ -6544,7 +6543,7 @@  discard block
 block discarded – undo
6544 6543
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6545 6544
             $rows = DB::query(
6546 6545
                 'SELECT id, categories
6547
-                FROM ' . prefixTable('nested_tree') . '
6546
+                FROM ' . prefixTable('nested_tree').'
6548 6547
                 WHERE id IN (%l)',
6549 6548
                 implode(',', $foldersArray)
6550 6549
             );
@@ -6586,7 +6585,7 @@  discard block
 block discarded – undo
6586 6585
         // get item info
6587 6586
         $dataItem = DB::queryFirstRow(
6588 6587
             'SELECT *
6589
-            FROM ' . prefixTable('items') . '
6588
+            FROM ' . prefixTable('items').'
6590 6589
             WHERE id=%i',
6591 6590
             $inputData['itemId']
6592 6591
         );
@@ -6598,8 +6597,8 @@  discard block
 block discarded – undo
6598 6597
             'SELECT l.date as date, l.action as action, l.raison as raison,
6599 6598
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6600 6599
                 l.old_value as old_value
6601
-            FROM ' . prefixTable('log_items') . ' as l
6602
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6600
+            FROM ' . prefixTable('log_items').' as l
6601
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6603 6602
             WHERE id_item=%i AND l.action NOT IN (%l)
6604 6603
             ORDER BY date DESC',
6605 6604
             $inputData['itemId'],
@@ -6614,18 +6613,18 @@  discard block
 block discarded – undo
6614 6613
             
6615 6614
             // imported via API
6616 6615
             if (empty($record['login']) === true) {
6617
-                $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']';
6616
+                $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']';
6618 6617
             }
6619 6618
             
6620 6619
             // Prepare avatar
6621 6620
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6622
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6623
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6621
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6622
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6624 6623
                 } else {
6625
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6624
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6626 6625
                 }
6627 6626
             } else {
6628
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6627
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6629 6628
             }
6630 6629
 
6631 6630
             // Prepare action
@@ -6645,7 +6644,7 @@  discard block
 block discarded – undo
6645 6644
                         $previous_passwords, 
6646 6645
                         [
6647 6646
                             'password' => htmlentities($previous_pwd['string']),
6648
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6647
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6649 6648
                         ]
6650 6649
                     );
6651 6650
                 }
@@ -6658,19 +6657,19 @@  discard block
 block discarded – undo
6658 6657
                 $action = $lang->get($reason[0]);
6659 6658
                 if ($reason[0] === 'at_moved') {
6660 6659
                     $tmp = explode(' -> ', $reason[1]);
6661
-                    $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6660
+                    $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6662 6661
                 } elseif ($reason[0] === 'at_field') {
6663 6662
                     $tmp = explode(' => ', $reason[1]);
6664 6663
                     if (count($tmp) > 1) {
6665
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') .
6666
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6664
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value').
6665
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6667 6666
                     } else {
6668 6667
                         $detail = trim($reason[1]);
6669 6668
                     }
6670 6669
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6671 6670
                     $tmp = explode(' => ', $reason[1]);
6672 6671
                     $detail = empty(trim($tmp[0])) === true ?
6673
-                        $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6672
+                        $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6674 6673
                 } elseif ($reason[0] === 'at_automatic_del') {
6675 6674
                     $detail = $lang->get($reason[1]);
6676 6675
                 } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status') {
@@ -6679,7 +6678,7 @@  discard block
 block discarded – undo
6679 6678
                     $tmp = explode(':', $reason[1]);
6680 6679
                     $tmp = explode('.', $tmp[0]);
6681 6680
                     $detail = isBase64($tmp[0]) === true ?
6682
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6681
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6683 6682
                 } elseif ($reason[0] === 'at_import') {
6684 6683
                     $detail = '';
6685 6684
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6698,8 +6697,8 @@  discard block
 block discarded – undo
6698 6697
                 array(
6699 6698
                     'avatar' => $avatar,
6700 6699
                     'login' => $record['login'],
6701
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6702
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6700
+                    'name' => $record['name'].' '.$record['lastname'],
6701
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6703 6702
                     'action' => $action,
6704 6703
                     'detail' => $detail,
6705 6704
                 )
@@ -6787,11 +6786,11 @@  discard block
 block discarded – undo
6787 6786
 
6788 6787
         // get some info to add to the notification email
6789 6788
         $resp_user = DB::queryfirstrow(
6790
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6789
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6791 6790
             $session->get('user-id')
6792 6791
         );
6793 6792
         $resp_folder = DB::queryfirstrow(
6794
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6793
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6795 6794
             $folder
6796 6795
         );
6797 6796
 
@@ -6800,7 +6799,7 @@  discard block
 block discarded – undo
6800 6799
         $emailService = new EmailService();
6801 6800
         $rows = DB::query(
6802 6801
             'SELECT email
6803
-            FROM ' . prefixTable('users') . '
6802
+            FROM ' . prefixTable('users').'
6804 6803
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6805 6804
             1
6806 6805
         );
@@ -6846,7 +6845,7 @@  discard block
 block discarded – undo
6846 6845
         // Send email
6847 6846
         $dataItem = DB::queryfirstrow(
6848 6847
             'SELECT label, id_tree
6849
-            FROM ' . prefixTable('items') . '
6848
+            FROM ' . prefixTable('items').'
6850 6849
             WHERE id = %i',
6851 6850
             $inputData['itemId']
6852 6851
         );
@@ -6900,7 +6899,7 @@  discard block
 block discarded – undo
6900 6899
 
6901 6900
         DB::query(
6902 6901
             'SELECT *
6903
-            FROM ' . prefixTable('notification') . '
6902
+            FROM ' . prefixTable('notification').'
6904 6903
             WHERE item_id = %i AND user_id = %i',
6905 6904
             $inputData['itemId'],
6906 6905
             $session->get('user-id')
@@ -6972,7 +6971,7 @@  discard block
 block discarded – undo
6972 6971
         // And related logs
6973 6972
         $rows = DB::query(
6974 6973
             'SELECT id, file AS filename
6975
-            FROM ' . prefixTable('files') . '
6974
+            FROM ' . prefixTable('files').'
6976 6975
             WHERE id_item = %i AND confirmed = %i',
6977 6976
             $inputData['itemId'],
6978 6977
             0
@@ -6986,12 +6985,12 @@  discard block
 block discarded – undo
6986 6985
             );
6987 6986
 
6988 6987
             // Delete file on server
6989
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6988
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6990 6989
 
6991 6990
             // Delete related logs
6992 6991
             $logFile = DB::query(
6993 6992
                 'SELECT increment_id, raison
6994
-                FROM ' . prefixTable('log_items') . '
6993
+                FROM ' . prefixTable('log_items').'
6995 6994
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6996 6995
                 $inputData['itemId'],
6997 6996
                 $session->get('user-id'),
@@ -7050,7 +7049,7 @@  discard block
 block discarded – undo
7050 7049
         // Confirm attachments
7051 7050
         $rows = DB::query(
7052 7051
             'SELECT id, file AS filename
7053
-            FROM ' . prefixTable('files') . '
7052
+            FROM ' . prefixTable('files').'
7054 7053
             WHERE id_item = %i AND confirmed = %i',
7055 7054
             $inputData['itemId'],
7056 7055
             0
@@ -7136,15 +7135,15 @@  discard block
 block discarded – undo
7136 7135
         case 'autocomplete_tags':
7137 7136
             // Get a list off all existing TAGS
7138 7137
             $listOfTags = '';
7139
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7138
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7140 7139
             foreach ($rows as $record) {
7141 7140
                 if (empty($listOfTags)) {
7142
-                    $listOfTags = '"' . $record['tag'] . '"';
7141
+                    $listOfTags = '"'.$record['tag'].'"';
7143 7142
                 } else {
7144
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7143
+                    $listOfTags .= ', "'.$record['tag'].'"';
7145 7144
                 }
7146 7145
             }
7147
-            echo '[' . $listOfTags . ']';
7146
+            echo '['.$listOfTags.']';
7148 7147
             break;
7149 7148
     }
7150 7149
 }
@@ -7160,7 +7159,7 @@  discard block
 block discarded – undo
7160 7159
 {
7161 7160
     $data = DB::queryFirstRow(
7162 7161
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7163
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7162
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7164 7163
         $groupe
7165 7164
     );
7166 7165
     // Check if it's in a personal folder. If yes, then force complexity overhead.
@@ -7264,7 +7263,7 @@  discard block
 block discarded – undo
7264 7263
     global $SETTINGS;
7265 7264
 
7266 7265
     // Retrieve the current lock information for the item
7267
-    $itemLockInfo = DB::queryFirstRow('SELECT timestamp, user_id FROM ' . prefixTable('items_edition') . ' WHERE item_id = %i', $itemId);
7266
+    $itemLockInfo = DB::queryFirstRow('SELECT timestamp, user_id FROM '.prefixTable('items_edition').' WHERE item_id = %i', $itemId);
7268 7267
 
7269 7268
     // Check if the item is locked by another user
7270 7269
     if ($itemLockInfo && $itemLockInfo['user_id'] !== $userId) {
@@ -7283,7 +7282,7 @@  discard block
 block discarded – undo
7283 7282
     
7284 7283
     // Check if there's an ongoing background encryption process for the item
7285 7284
     $ongoingProcess = DB::queryFirstRow(
7286
-        'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7285
+        'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7287 7286
         $itemId
7288 7287
     );
7289 7288
 
@@ -7301,7 +7300,7 @@  discard block
 block discarded – undo
7301 7300
 function getUserVisibleFolders(int $userId): array
7302 7301
 {
7303 7302
     // Query to retrieve visible folders for the user
7304
-    $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId);
7303
+    $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId);
7305 7304
     
7306 7305
     // Decode JSON data into an array; return an empty array if the data is invalid
7307 7306
     return json_decode($data['visible_folders'], true) ?? [];
@@ -7325,7 +7324,7 @@  discard block
 block discarded – undo
7325 7324
 
7326 7325
     // Query the access rights for the given roles and folder
7327 7326
     $accessTypes = DB::queryFirstColumn(
7328
-        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', 
7327
+        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', 
7329 7328
         $roles, 
7330 7329
         $treeId
7331 7330
     );
Please login to merge, or discard this patch.
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1228,7 +1228,9 @@  discard block
 block discarded – undo
1228 1228
                 );
1229 1229
 
1230 1230
                 // Create a task to create sharekeys for users
1231
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1231
+                if (WIP=== true) {
1232
+                    error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1233
+                }
1232 1234
                 $tasksToBePerformed = ['item_password'];
1233 1235
                 $encryptionTaskIsRequested = true;
1234 1236
             } else {
@@ -1548,7 +1550,9 @@  discard block
 block discarded – undo
1548 1550
 
1549 1551
             // create a task for all fields updated
1550 1552
             if ($encryptionTaskIsRequested === true) {
1551
-                if (WIP === true) error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1553
+                if (WIP === true) {
1554
+                    error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1555
+                }
1552 1556
                 createTaskForItem(
1553 1557
                     'item_update_create_keys',
1554 1558
                     array_unique($tasksToBePerformed),
@@ -2055,7 +2059,9 @@  discard block
 block discarded – undo
2055 2059
                 $inputData['itemId']
2056 2060
             );
2057 2061
             foreach ($rows as $record) {
2058
-                if ($record['raison'] === NULL) continue;
2062
+                if ($record['raison'] === NULL) {
2063
+                    continue;
2064
+                }
2059 2065
                 $reason = explode(':', $record['raison']);
2060 2066
                 if (count($reason) > 0) {
2061 2067
                     $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
@@ -4571,7 +4577,9 @@  discard block
 block discarded – undo
4571 4577
                 $inputData['itemId']
4572 4578
             );
4573 4579
             
4574
-            if (WIP === true) error_log('Existing edition locks: '.DB::count());
4580
+            if (WIP === true) {
4581
+                error_log('Existing edition locks: '.DB::count());
4582
+            }
4575 4583
 
4576 4584
             // Check if item has no edition lock
4577 4585
             if ((int) DB::count() > 0 ) {
@@ -4584,7 +4592,9 @@  discard block
 block discarded – undo
4584 4592
                 } else {
4585 4593
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4586 4594
                 }
4587
-                if (WIP === true) error_log('delay: ' . $delay);
4595
+                if (WIP === true) {
4596
+                    error_log('delay: ' . $delay);
4597
+                }
4588 4598
 
4589 4599
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4590 4600
                 if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
@@ -4592,7 +4602,9 @@  discard block
 block discarded – undo
4592 4602
                     // In this case, delete edition lock and possible ongoing processes
4593 4603
                     // and continue editing this time
4594 4604
                     // We coonsidere if the most recent item is still locked then all other locks can be removed
4595
-                    if (WIP === true)  error_log('Delay is expired, removing old locks');
4605
+                    if (WIP === true) {
4606
+                        error_log('Delay is expired, removing old locks');
4607
+                    }
4596 4608
                     foreach ($dataItemEditionLocks as $itemEditionLock) {
4597 4609
                         // delete lock
4598 4610
                         DB::delete(
@@ -4859,8 +4871,9 @@  discard block
 block discarded – undo
4859 4871
                 $ids = $tree->getDescendants($folder['id'], true, false, true);
4860 4872
 
4861 4873
                 // This folder is owned by user
4862
-                if (in_array($inputData['folderId'], $ids))
4863
-                    $accessLevel = 30;
4874
+                if (in_array($inputData['folderId'], $ids)) {
4875
+                                    $accessLevel = 30;
4876
+                }
4864 4877
             }
4865 4878
         }
4866 4879
 
Please login to merge, or discard this patch.
_things/delete_background_tasks___sending_emails.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 $emailService = new EmailService();
71 71
 $rows = DB::query(
72 72
     'SELECT *
73
-    FROM ' . prefixTable('background_tasks') . '
73
+    FROM ' . prefixTable('background_tasks').'
74 74
     WHERE is_in_progress = %i AND process_type = %s
75 75
     ORDER BY increment_id ASC LIMIT 0,10',
76 76
     0,
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     
139 139
     //if ((int) $SETTINGS['enable_backlog_mail'] === 1) {
140 140
         $row = DB::queryFirstRow(
141
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
141
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
142 142
             'cron',
143 143
             'sending_emails'
144 144
         );
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
147 147
             $rows = DB::query(
148 148
                 'SELECT *
149
-                FROM ' . prefixTable('emails') .
149
+                FROM ' . prefixTable('emails').
150 150
                 ' WHERE status != %s',
151 151
                 'sent'
152 152
             );
Please login to merge, or discard this patch.
_things/delete_background_tasks___userKeysCreation_subtaskHdl.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 DB::update(
123 123
     prefixTable('background_subtasks'),
124 124
     array(
125
-        'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
125
+        'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
126 126
         'is_in_progress' => 0,
127 127
         'finished_at' => time(),
128 128
         'updated_at' => time(),
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // Check if user exists
159 159
         $userInfo = DB::queryFirstRow(
160 160
             'SELECT public_key, private_key
161
-            FROM ' . prefixTable('users') . '
161
+            FROM ' . prefixTable('users').'
162 162
             WHERE id = %i',
163 163
             $post_user_id
164 164
         );
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 {
272 272
     $userInfo = DB::queryFirstRow(
273 273
         'SELECT pw, public_key, private_key, login, name
274
-        FROM ' . prefixTable('users') . '
274
+        FROM ' . prefixTable('users').'
275 275
         WHERE id = %i',
276 276
         $owner_id
277 277
     );
278 278
     
279 279
     // decrypt owner password
280
-    $pwd = cryption($owner_pwd, '','decrypt', $SETTINGS)['string'];
280
+    $pwd = cryption($owner_pwd, '', 'decrypt', $SETTINGS)['string'];
281 281
     // decrypt private key and send back
282 282
     return [
283 283
         'private_key' => decryptPrivateKey($pwd, $userInfo['private_key']),
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
     // Loop on items
318 318
     $rows = DB::query(
319 319
         'SELECT id, pw, perso
320
-        FROM ' . prefixTable('items') . '
320
+        FROM ' . prefixTable('items').'
321 321
         WHERE perso =  %i
322 322
         ORDER BY id ASC
323
-        LIMIT ' . $post_start . ', ' . $post_length,
323
+        LIMIT ' . $post_start.', '.$post_length,
324 324
         ($extra_arguments['only_personal_items'] ?? 0) === 1 ? 1 : 0
325 325
     );
326 326
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         // Get itemKey from current user
329 329
         $currentUserKey = DB::queryFirstRow(
330 330
             'SELECT share_key, increment_id
331
-            FROM ' . prefixTable('sharekeys_items') . '
331
+            FROM ' . prefixTable('sharekeys_items').'
332 332
             WHERE object_id = %i AND user_id = %i',
333 333
             $record['id'],
334 334
             (int) $record['perso'] === 0 ? $extra_arguments['owner_id'] : $extra_arguments['new_user_id']
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         
356 356
         $currentUserKey = DB::queryFirstRow(
357 357
             'SELECT increment_id
358
-            FROM ' . prefixTable('sharekeys_items') . '
358
+            FROM ' . prefixTable('sharekeys_items').'
359 359
             WHERE object_id = %i AND user_id = %i',
360 360
             $record['id'],
361 361
             $post_user_id
@@ -429,15 +429,15 @@  discard block
 block discarded – undo
429 429
     // Loop on logs
430 430
     $rows = DB::query(
431 431
         'SELECT increment_id
432
-        FROM ' . prefixTable('log_items') . '
432
+        FROM ' . prefixTable('log_items').'
433 433
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
434
-        LIMIT ' . $post_start . ', ' . $post_length
434
+        LIMIT ' . $post_start.', '.$post_length
435 435
     );
436 436
     foreach ($rows as $record) {
437 437
         // Get itemKey from current user
438 438
         $currentUserKey = DB::queryFirstRow(
439 439
             'SELECT share_key
440
-            FROM ' . prefixTable('sharekeys_logs') . '
440
+            FROM ' . prefixTable('sharekeys_logs').'
441 441
             WHERE object_id = %i AND user_id = %i',
442 442
             $record['increment_id'],
443 443
             $extra_arguments['owner_id']
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
470 470
                 $currentUserKey = DB::queryFirstRow(
471 471
                     'SELECT increment_id
472
-                    FROM ' . prefixTable('sharekeys_items') . '
472
+                    FROM ' . prefixTable('sharekeys_items').'
473 473
                     WHERE object_id = %i AND user_id = %i',
474 474
                     $record['id'],
475 475
                     $post_user_id
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     // SHould we change step?
492 492
     DB::query(
493 493
         'SELECT increment_id
494
-        FROM ' . prefixTable('log_items') . '
494
+        FROM ' . prefixTable('log_items').'
495 495
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
496 496
     );
497 497
 
@@ -531,15 +531,15 @@  discard block
 block discarded – undo
531 531
     // Loop on fields
532 532
     $rows = DB::query(
533 533
         'SELECT id
534
-        FROM ' . prefixTable('categories_items') . '
534
+        FROM ' . prefixTable('categories_items').'
535 535
         WHERE encryption_type = "teampass_aes"
536
-        LIMIT ' . $post_start . ', ' . $post_length
536
+        LIMIT ' . $post_start.', '.$post_length
537 537
     );
538 538
     foreach ($rows as $record) {
539 539
         // Get itemKey from current user
540 540
         $currentUserKey = DB::queryFirstRow(
541 541
             'SELECT share_key
542
-            FROM ' . prefixTable('sharekeys_fields') . '
542
+            FROM ' . prefixTable('sharekeys_fields').'
543 543
             WHERE object_id = %i AND user_id = %i',
544 544
             $record['id'],
545 545
             $extra_arguments['owner_id']
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                 if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
568 568
                     $currentUserKey = DB::queryFirstRow(
569 569
                         'SELECT increment_id
570
-                        FROM ' . prefixTable('sharekeys_items') . '
570
+                        FROM ' . prefixTable('sharekeys_items').'
571 571
                         WHERE object_id = %i AND user_id = %i',
572 572
                         $record['id'],
573 573
                         $post_user_id
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     // SHould we change step?
591 591
     DB::query(
592 592
         'SELECT *
593
-        FROM ' . prefixTable('categories_items') . '
593
+        FROM ' . prefixTable('categories_items').'
594 594
         WHERE encryption_type = "teampass_aes"'
595 595
     );
596 596
 
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
     // Loop on suggestions
631 631
     $rows = DB::query(
632 632
         'SELECT id
633
-        FROM ' . prefixTable('suggestion') . '
634
-        LIMIT ' . $post_start . ', ' . $post_length
633
+        FROM ' . prefixTable('suggestion').'
634
+        LIMIT ' . $post_start.', '.$post_length
635 635
     );
636 636
     foreach ($rows as $record) {
637 637
         // Get itemKey from current user
638 638
         $currentUserKey = DB::queryFirstRow(
639 639
             'SELECT share_key
640
-            FROM ' . prefixTable('sharekeys_suggestions') . '
640
+            FROM ' . prefixTable('sharekeys_suggestions').'
641 641
             WHERE object_id = %i AND user_id = %i',
642 642
             $record['id'],
643 643
             $extra_arguments['owner_id']
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
670 670
                 $currentUserKey = DB::queryFirstRow(
671 671
                     'SELECT increment_id
672
-                    FROM ' . prefixTable('sharekeys_items') . '
672
+                    FROM ' . prefixTable('sharekeys_items').'
673 673
                     WHERE object_id = %i AND user_id = %i',
674 674
                     $record['id'],
675 675
                     $post_user_id
@@ -729,16 +729,16 @@  discard block
 block discarded – undo
729 729
     // Loop on files
730 730
     $rows = DB::query(
731 731
         'SELECT f.id AS id, i.perso AS perso
732
-        FROM ' . prefixTable('files') . ' AS f
733
-        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
734
-        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"
735
-        LIMIT ' . $post_start . ', ' . $post_length
732
+        FROM ' . prefixTable('files').' AS f
733
+        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
734
+        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"
735
+        LIMIT ' . $post_start.', '.$post_length
736 736
     ); //aes_encryption
737 737
     foreach ($rows as $record) {
738 738
         // Get itemKey from current user
739 739
         $currentUserKey = DB::queryFirstRow(
740 740
             'SELECT share_key, increment_id
741
-            FROM ' . prefixTable('sharekeys_files') . '
741
+            FROM ' . prefixTable('sharekeys_files').'
742 742
             WHERE object_id = %i AND user_id = %i',
743 743
             $record['id'],
744 744
             (int) $record['perso'] === 0 ? $extra_arguments['owner_id'] : $extra_arguments['new_user_id']
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
         $currentUserKey = DB::queryFirstRow(
768 768
             'SELECT increment_id
769
-            FROM ' . prefixTable('sharekeys_files') . '
769
+            FROM ' . prefixTable('sharekeys_files').'
770 770
             WHERE object_id = %i AND user_id = %i',
771 771
             $record['id'],
772 772
             $post_user_id
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
     // SHould we change step? Finished ?
798 798
     DB::query(
799 799
         'SELECT *
800
-        FROM ' . prefixTable('files') . '
801
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
800
+        FROM ' . prefixTable('files').'
801
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
802 802
     );
803 803
     $counter = DB::count();
804 804
     $next_start = (int) $post_start + (int) $post_length;
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
     // get user info
865 865
     $userInfo = DB::queryFirstRow(
866 866
         'SELECT email, login, auth_type, special, lastname, name
867
-        FROM ' . prefixTable('users') . '
867
+        FROM ' . prefixTable('users').'
868 868
         WHERE id = %i',
869 869
         $extra_arguments['new_user_id']
870 870
     );
@@ -879,10 +879,10 @@  discard block
 block discarded – undo
879 879
             filter_var($userInfo['email'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
880 880
             // @scrutinizer ignore-type
881 881
             empty($extra_arguments['email_body']) === false ? $extra_arguments['email_body'] : $lang->get('email_body_user_config_1'),
882
-            'TEAMPASS - ' . $lang->get('login_credentials'),
882
+            'TEAMPASS - '.$lang->get('login_credentials'),
883 883
             (array) filter_var_array(
884 884
                 [
885
-                    '#code#' => cryption($extra_arguments['new_user_code'], '','decrypt', $SETTINGS)['string'],
885
+                    '#code#' => cryption($extra_arguments['new_user_code'], '', 'decrypt', $SETTINGS)['string'],
886 886
                     '#lastname#' => isset($userInfo['name']) === true ? $userInfo['name'] : '',
887 887
                     '#login#' => isset($userInfo['login']) === true ? $userInfo['login'] : '',
888 888
                 ],
Please login to merge, or discard this patch.
_things/delete_background_tasks___items_handler.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 DB::debugmode(false);
76 76
 $process_to_perform = DB::queryFirstRow(
77 77
     'SELECT *
78
-    FROM ' . prefixTable('background_tasks') . '
78
+    FROM ' . prefixTable('background_tasks').'
79 79
     WHERE is_in_progress = %i AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
80 80
     ORDER BY increment_id ASC',
81 81
     1
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     // search for next process to handle
94 94
     $process_to_perform = DB::queryFirstRow(
95 95
         'SELECT *
96
-        FROM ' . prefixTable('background_tasks') . '
96
+        FROM ' . prefixTable('background_tasks').'
97 97
         WHERE is_in_progress = %i AND (finished_at = "" OR finished_at IS NULL) AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
98 98
         ORDER BY increment_id ASC',
99 99
         0
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             $process_to_perform['increment_id']
112 112
         );
113 113
 
114
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
114
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
115 115
         handleTask(
116 116
             $process_to_perform['increment_id'],
117 117
             json_decode($process_to_perform['arguments'], true),
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         // Search if there are remaining tasks
147 147
         $process_to_perform = DB::queryFirstField(
148 148
             'SELECT 1
149
-            FROM ' . prefixTable('background_tasks') . '
149
+            FROM ' . prefixTable('background_tasks').'
150 150
             WHERE is_in_progress = %i AND process_type IN (
151 151
                 "item_copy",
152 152
                 "new_item",
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
  */
186 186
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS, int $itemId = null): bool
187 187
 {
188
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
188
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
189 189
     $task_to_perform = DB::queryFirstRow(
190 190
         'SELECT *
191
-        FROM ' . prefixTable('background_subtasks') . '
191
+        FROM ' . prefixTable('background_subtasks').'
192 192
         WHERE task_id = %i AND finished_at IS NULL
193 193
         ORDER BY increment_id ASC',
194 194
         $processId
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
         // if sub_task_in_progress === 1 then exit
203 203
         if ((int) $task_to_perform['sub_task_in_progress'] !== 0) {
204 204
             // Task is currently being in progress by another server process
205
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
205
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
206 206
             return false;
207 207
         }
208 208
 
209 209
         // handle next task
210 210
         $args = json_decode($task_to_perform['task'], true);
211
-        provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
211
+        provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
212 212
 
213 213
         // flag as in progress
214 214
         DB::update(
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         DB::update(
251 251
             prefixTable('background_subtasks'),
252 252
             array(
253
-                'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
253
+                'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
254 254
                 'task' => json_encode(["status" => "Done"]),
255 255
                 'is_in_progress' => -1,
256 256
                 'finished_at' => time(),
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         // are all tasks done?
266 266
         DB::query(
267 267
             'SELECT *
268
-            FROM ' . prefixTable('background_subtasks') . '
268
+            FROM ' . prefixTable('background_subtasks').'
269 269
             WHERE task_id = %i AND finished_at IS NULL',
270 270
             $processId
271 271
         );
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         // Loop on all files for this item
338 338
         // and encrypt them for each user
339 339
         if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
340
-        foreach($args['files_keys'] as $file) {
340
+        foreach ($args['files_keys'] as $file) {
341 341
             storeUsersShareKey(
342 342
                 prefixTable('sharekeys_items'),
343 343
                 0,
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
         // Loop on all encrypted fields for this item
354 354
         // and encrypt them for each user
355 355
         if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
356
-        foreach($args['fields_keys'] as $field) {
356
+        foreach ($args['fields_keys'] as $field) {
357 357
             storeUsersShareKey(
358 358
                 prefixTable('sharekeys_fields'),
359 359
                 0,
@@ -405,6 +405,6 @@  discard block
 block discarded – undo
405 405
     DB::query(
406 406
         'DELETE FROM '.prefixTable('items_edition').'
407 407
         WHERE timestamp < %i',
408
-        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition']*60) : time() - EDITION_LOCK_PERIOD
408
+        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition'] * 60) : time() - EDITION_LOCK_PERIOD
409 409
     );
410 410
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
 if (DB::count() > 0) {
85 85
     // handle tasks inside this process
86
-    if (WIP === true) error_log("Process in progress: ".$process_to_perform['increment_id']);
86
+    if (WIP === true) {
87
+        error_log("Process in progress: ".$process_to_perform['increment_id']);
88
+    }
87 89
     handleTask(
88 90
         $process_to_perform['increment_id'],
89 91
         json_decode($process_to_perform['arguments'], true),
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
     );
101 103
     
102 104
     if (DB::count() > 0) {
103
-        if (WIP === true) error_log("New process ta start: ".$process_to_perform['increment_id']);
105
+        if (WIP === true) {
106
+            error_log("New process ta start: ".$process_to_perform['increment_id']);
107
+        }
104 108
         // update DB - started_at
105 109
         DB::update(
106 110
             prefixTable('background_tasks'),
@@ -153,8 +157,9 @@  discard block
 block discarded – undo
153 157
         );
154 158
 
155 159
         // No more tasks, exit
156
-        if ($process_to_perform !== 1)
157
-            break;
160
+        if ($process_to_perform !== 1) {
161
+                    break;
162
+        }
158 163
 
159 164
         // Run next task
160 165
         $process = new Symfony\Component\Process\Process([
@@ -331,7 +336,9 @@  discard block
 block discarded – undo
331 336
     if ($args['step'] === 'create_users_files_key') {
332 337
         // Loop on all files for this item
333 338
         // and encrypt them for each user
334
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
339
+        if (WIP === true) {
340
+            provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
341
+        }
335 342
         foreach($args['files_keys'] as $file) {
336 343
             storeUsersShareKey(
337 344
                 prefixTable('sharekeys_items'),
@@ -347,7 +354,9 @@  discard block
 block discarded – undo
347 354
     } elseif ($args['step'] === 'create_users_fields_key') {
348 355
         // Loop on all encrypted fields for this item
349 356
         // and encrypt them for each user
350
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
357
+        if (WIP === true) {
358
+            provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
359
+        }
351 360
         foreach($args['fields_keys'] as $field) {
352 361
             storeUsersShareKey(
353 362
                 prefixTable('sharekeys_fields'),
Please login to merge, or discard this patch.
_things/delete_background_tasks___userKeysCreation.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 $processToPerform = DB::queryfirstrow(
69 69
     'SELECT *
70
-    FROM ' . prefixTable('background_tasks') . '
70
+    FROM ' . prefixTable('background_tasks').'
71 71
     WHERE (finished_at IS NULL OR finished_at = "") AND process_type = %s
72 72
     ORDER BY increment_id ASC',
73 73
     'create_user_keys'
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     // Check if subtasks are still running
85 85
     // This in order to prevent the script from running multiple times on same objects
86 86
     while (DB::queryFirstField(
87
-        'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' 
87
+        'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' 
88 88
         WHERE is_in_progress = 1'
89 89
     ) > 0) {
90 90
         sleep(10); // Wait 10 seconds before continuing
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $subTaskParams = json_decode($subTask['task'], true);
118 118
 
119 119
             if (WIP === true) {
120
-                error_log('Subtask in progress: '.$subTask['increment_id']." (".$taskId.") - "./** @scrutinizer ignore-type */ print_r($subTaskParams,true));
120
+                error_log('Subtask in progress: '.$subTask['increment_id']." (".$taskId.") - "./** @scrutinizer ignore-type */ print_r($subTaskParams, true));
121 121
             }
122 122
             
123 123
             // Build all subtasks if first one
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                     // Get total number of items
127 127
                     DB::query(
128 128
                         'SELECT *
129
-                        FROM ' . prefixTable('items') . '
129
+                        FROM ' . prefixTable('items').'
130 130
                         '.(isset($taskArgumentsArray['only_personal_items']) === true && $taskArgumentsArray['only_personal_items'] === 1 ? 'WHERE perso = 1' : '')
131 131
                     );
132 132
                     createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                     // Get total number of items
136 136
                     DB::query(
137 137
                         'SELECT *
138
-                        FROM ' . prefixTable('log_items') . '
138
+                        FROM ' . prefixTable('log_items').'
139 139
                         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
140 140
                     );
141 141
                     createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                     // Get total number of items
145 145
                     DB::query(
146 146
                         'SELECT *
147
-                        FROM ' . prefixTable('categories_items') . '
147
+                        FROM ' . prefixTable('categories_items').'
148 148
                         WHERE encryption_type = "teampass_aes"'
149 149
                     );
150 150
                     createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId);
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
                     // Get total number of items
162 162
                     DB::query(
163 163
                         'SELECT *
164
-                        FROM ' . prefixTable('files') . ' AS f
165
-                        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
166
-                        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"'
164
+                        FROM ' . prefixTable('files').' AS f
165
+                        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
166
+                        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"'
167 167
                     );
168 168
                     createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId);
169 169
                 }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     // Check if subtasks have to be created
191 191
     DB::query(
192 192
         'SELECT *
193
-        FROM ' . prefixTable('background_subtasks') . '
193
+        FROM ' . prefixTable('background_subtasks').'
194 194
         WHERE task_id = %i AND task LIKE %ss',
195 195
         $taskId,
196 196
         $action
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 function countActiveSymfonyProcesses() {
219 219
     // Count the number of active processes
220 220
     return DB::queryFirstField(
221
-        'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . 
221
+        'SELECT COUNT(*) FROM '.prefixTable('background_subtasks'). 
222 222
         ' WHERE process_id IS NOT NULL AND finished_at IS NULL'
223 223
     );
224 224
 }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 function getSubTasks($taskId) {
230 230
     $task_to_perform = DB::query(
231 231
         'SELECT *
232
-        FROM ' . prefixTable('background_subtasks') . '
232
+        FROM ' . prefixTable('background_subtasks').'
233 233
         WHERE task_id = %i AND finished_at IS NULL
234 234
         ORDER BY increment_id ASC',
235 235
         $taskId
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 function reloadSubTask($subTaskId) {
279 279
     // Retrieve subtask information from the database
280 280
     $subTask = DB::queryFirstRow(
281
-        'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE increment_id = %i', 
281
+        'SELECT * FROM '.prefixTable('background_subtasks').' WHERE increment_id = %i', 
282 282
         $subTaskId
283 283
     );
284 284
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     // Get all processes
324 324
     $subtasks = DB::query(
325 325
         'SELECT *
326
-        FROM ' . prefixTable('background_subtasks') . '
326
+        FROM ' . prefixTable('background_subtasks').'
327 327
         WHERE process_id IS NOT NULL AND finished_at IS NULL'
328 328
     );
329 329
 
Please login to merge, or discard this patch.
_things/delete_bck_tasks___supervisor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     private function cleanStaleProcesses() {
28 28
         // Marquer les processus bloqués depuis plus de 30 minutes
29 29
         $this->db->query(
30
-            'UPDATE ' . prefixTable('background_tasks') . ' 
30
+            'UPDATE '.prefixTable('background_tasks').' 
31 31
             SET is_in_progress = -1, 
32 32
                 status = "stale"
33 33
             WHERE is_in_progress = 1 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         // Relancer les tâches marquées comme "stale"
41 41
         $staleTasks = $this->db->query(
42 42
             'SELECT increment_id, process_type, arguments 
43
-            FROM ' . prefixTable('background_tasks') . '
43
+            FROM ' . prefixTable('background_tasks').'
44 44
             WHERE status = "stale"
45 45
             LIMIT 10'  // Limiter à 10 pour éviter une surcharge
46 46
         );
@@ -62,24 +62,24 @@  discard block
 block discarded – undo
62 62
     private function logTaskStatistics() {
63 63
         $stats = [
64 64
             'total_tasks' => $this->db->queryFirstField(
65
-                'SELECT COUNT(*) FROM ' . prefixTable('background_tasks')
65
+                'SELECT COUNT(*) FROM '.prefixTable('background_tasks')
66 66
             ),
67 67
             'pending_tasks' => $this->db->queryFirstField(
68
-                'SELECT COUNT(*) FROM ' . prefixTable('background_tasks') . ' WHERE is_in_progress = 0'
68
+                'SELECT COUNT(*) FROM '.prefixTable('background_tasks').' WHERE is_in_progress = 0'
69 69
             ),
70 70
             'running_tasks' => $this->db->queryFirstField(
71
-                'SELECT COUNT(*) FROM ' . prefixTable('background_tasks') . ' WHERE is_in_progress = 1'
71
+                'SELECT COUNT(*) FROM '.prefixTable('background_tasks').' WHERE is_in_progress = 1'
72 72
             ),
73 73
             'completed_tasks' => $this->db->queryFirstField(
74
-                'SELECT COUNT(*) FROM ' . prefixTable('background_tasks') . ' WHERE is_in_progress = -1 AND status = "completed"'
74
+                'SELECT COUNT(*) FROM '.prefixTable('background_tasks').' WHERE is_in_progress = -1 AND status = "completed"'
75 75
             ),
76 76
             'failed_tasks' => $this->db->queryFirstField(
77
-                'SELECT COUNT(*) FROM ' . prefixTable('background_tasks') . ' WHERE is_in_progress = -1 AND status = "failed"'
77
+                'SELECT COUNT(*) FROM '.prefixTable('background_tasks').' WHERE is_in_progress = -1 AND status = "failed"'
78 78
             )
79 79
         ];
80 80
 
81 81
         // Log ou stocker ces statistiques selon votre configuration
82
-        error_log('Teampass Task Statistics: ' . json_encode($stats));
82
+        error_log('Teampass Task Statistics: '.json_encode($stats));
83 83
     }
84 84
 }
85 85
 
Please login to merge, or discard this patch.