Passed
Push — master ( e7d28b...261004 )
by Nils
06:20
created
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
     'some_items_not_copied_empty_password' => 'Some items could not be copied because they have empty passwords.',
Please login to merge, or discard this patch.
sources/folders.queries.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1151,7 +1151,7 @@
 block discarded – undo
1151 1151
                             (int) $dataDeleted !== 1
1152 1152
                             || (isset($item_restored['date']) === true && (int) $item_deleted['date'] < (int) $item_restored['date'])
1153 1153
                         ) {
1154
-                             // Get the ITEM object key for the user
1154
+                                // Get the ITEM object key for the user
1155 1155
                             $itemUserTpKey = DB::queryFirstRow(
1156 1156
                                 'SELECT share_key
1157 1157
                                 FROM ' . prefixTable('sharekeys_items') . '
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
                     && $t->personal_folder == 0
138 138
                 ) {
139 139
                     // get $t->parent_id
140
-                    $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id);
140
+                    $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id);
141 141
                     if ($t->nlevel == 1) {
142 142
                         $data['title'] = $lang->get('root');
143 143
                     }
144 144
 
145 145
                     // get rights on this folder
146 146
                     $arrayRights = array();
147
-                    $rows = DB::query('SELECT fonction_id  FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
147
+                    $rows = DB::query('SELECT fonction_id  FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id);
148 148
                     foreach ($rows as $record) {
149 149
                         array_push($arrayRights, $record['fonction_id']);
150 150
                     }
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
                         'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period,
163 163
                         n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification,
164 164
                         n.fa_icon AS fa_icon, n.fa_icon_selected AS fa_icon_selected
165
-                        FROM ' . prefixTable('misc') . ' AS m,
166
-                        ' . prefixTable('nested_tree') . ' AS n
165
+                        FROM ' . prefixTable('misc').' AS m,
166
+                        ' . prefixTable('nested_tree').' AS n
167 167
                         WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i',
168 168
                         'complex',
169 169
                         $t->id
@@ -191,16 +191,16 @@  discard block
 block discarded – undo
191 191
                         $arrayColumns['folderComplexity'] = '';
192 192
                     }
193 193
 
194
-                    if (is_null($node_data)=== false) {
194
+                    if (is_null($node_data) === false) {
195 195
                         $arrayColumns['renewalPeriod'] = (int) $node_data['renewal_period'];
196 196
                     } else {
197
-                        $arrayColumns['renewalPeriod']=0;
197
+                        $arrayColumns['renewalPeriod'] = 0;
198 198
                     }
199 199
 
200 200
                     //col7
201 201
                     $data7 = DB::queryFirstRow(
202 202
                         'SELECT bloquer_creation,bloquer_modification
203
-                        FROM ' . prefixTable('nested_tree') . '
203
+                        FROM ' . prefixTable('nested_tree').'
204 204
                         WHERE id = %i',
205 205
                         intval($t->id)
206 206
                     );
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
             // Get info about this folder
359 359
             $dataFolder = DB::queryFirstRow(
360 360
                 'SELECT *
361
-                FROM ' . prefixTable('nested_tree') . '
361
+                FROM ' . prefixTable('nested_tree').'
362 362
                 WHERE id = %i',
363 363
                 $inputData['id']
364 364
             );
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             //check if parent folder is personal
395 395
             $dataParent = DB::queryFirstRow(
396 396
                 'SELECT personal_folder, bloquer_creation, bloquer_modification
397
-                FROM ' . prefixTable('nested_tree') . '
397
+                FROM ' . prefixTable('nested_tree').'
398 398
                 WHERE id = %i',
399 399
                 $inputData['parentId']
400 400
             );
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
                     // get complexity level for this folder
424 424
                     $data = DB::queryFirstRow(
425 425
                         'SELECT valeur
426
-                        FROM ' . prefixTable('misc') . '
426
+                        FROM ' . prefixTable('misc').'
427 427
                         WHERE intitule = %i AND type = %s',
428 428
                         $inputData['parentId'],
429 429
                         'complex'
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
                             array(
435 435
                                 'error' => true,
436 436
                                 'message' => $lang->get('error_folder_complexity_lower_than_top_folder')
437
-                                    . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]',
437
+                                    . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]',
438 438
                             ),
439 439
                             'encode'
440 440
                         );
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             // Check if parent folder is personal
595 595
             $dataParent = DB::queryFirstRow(
596 596
                 'SELECT personal_folder
597
-                FROM ' . prefixTable('nested_tree') . '
597
+                FROM ' . prefixTable('nested_tree').'
598 598
                 WHERE id = %i',
599 599
                 $inputData['parentId']
600 600
             );
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
             echo prepareExchangedData(
642 642
                 array(
643 643
                     'error' => $creationStatus['error'],
644
-                    'message' => $creationStatus['error'] === true ? $lang->get('error_not_allowed_to') : $lang->get('folder_created') ,
644
+                    'message' => $creationStatus['error'] === true ? $lang->get('error_not_allowed_to') : $lang->get('folder_created'),
645 645
                     'newId' => $creationStatus['newId'],
646 646
                 ),
647 647
                 'encode'
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                 echo prepareExchangedData(
690 690
                     array(
691 691
                         'error' => true,
692
-                        'message' => $lang->get('error_not_allowed_to'). " (You can't delete the root folder)",
692
+                        'message' => $lang->get('error_not_allowed_to')." (You can't delete the root folder)",
693 693
                     ),
694 694
                     'encode'
695 695
                 );
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
             // Ensure that user has access to all folders
700 700
             $foldersAccessible = DB::query(
701 701
                 'SELECT id
702
-                FROM ' . prefixTable('nested_tree') . '
702
+                FROM ' . prefixTable('nested_tree').'
703 703
                 WHERE id IN %li AND id IN %li',
704 704
                 $post_folders,
705 705
                 $session->get('user-accessible_folders')
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                 echo prepareExchangedData(
714 714
                     array(
715 715
                         'error' => true,
716
-                        'message' => $lang->get('error_not_allowed_to') . ' (The following folders are not accessible or do not exist: ' . implode(', ', $missingFolders) . ')',
716
+                        'message' => $lang->get('error_not_allowed_to').' (The following folders are not accessible or do not exist: '.implode(', ', $missingFolders).')',
717 717
                     ),
718 718
                     'encode'
719 719
                 );
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                 // Check if parent folder is personal
731 731
                 $dataParent = DB::queryFirstRow(
732 732
                     'SELECT personal_folder
733
-                    FROM ' . prefixTable('nested_tree') . '
733
+                    FROM ' . prefixTable('nested_tree').'
734 734
                     WHERE id = %i',
735 735
                     $folderId
736 736
                 );
@@ -776,10 +776,10 @@  discard block
 block discarded – undo
776 776
                                 prefixTable('misc'),
777 777
                                 array(
778 778
                                     'type' => 'folder_deleted',
779
-                                    'intitule' => 'f' . $thisSubFolders->id,
780
-                                    'valeur' => $thisSubFolders->id . ', ' . $thisSubFolders->parent_id . ', ' .
781
-                                        $thisSubFolders->title . ', ' . $thisSubFolders->nleft . ', ' . $thisSubFolders->nright . ', ' .
782
-                                        $thisSubFolders->nlevel . ', 0, 0, 0, 0',
779
+                                    'intitule' => 'f'.$thisSubFolders->id,
780
+                                    'valeur' => $thisSubFolders->id.', '.$thisSubFolders->parent_id.', '.
781
+                                        $thisSubFolders->title.', '.$thisSubFolders->nleft.', '.$thisSubFolders->nright.', '.
782
+                                        $thisSubFolders->nlevel.', 0, 0, 0, 0',
783 783
                                     'created_at' => time(),
784 784
                                 )
785 785
                             );
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 
789 789
                             //delete items & logs
790 790
                             $itemsInSubFolder = DB::query(
791
-                                'SELECT id FROM ' . prefixTable('items') . ' 
791
+                                'SELECT id FROM '.prefixTable('items').' 
792 792
                                 WHERE id_tree=%i', 
793 793
                                 $thisSubFolders->id
794 794
                             );
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
                                 }
819 819
 
820 820
                                 //Update CACHE table
821
-                                updateCacheTable('delete_value',(int) $item['id']);
821
+                                updateCacheTable('delete_value', (int) $item['id']);
822 822
                             }
823 823
 
824 824
                             //Actualize the variable
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
             // Check if target parent folder is personal
931 931
             $dataParent = DB::queryFirstRow(
932 932
                 'SELECT personal_folder
933
-                FROM ' . prefixTable('nested_tree') . '
933
+                FROM ' . prefixTable('nested_tree').'
934 934
                 WHERE id = %i',
935 935
                 $post_target_folder_id
936 936
             );
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
                 // get complexity of current node
985 985
                 $nodeComplexity = DB::queryFirstRow(
986 986
                     'SELECT valeur
987
-                    FROM ' . prefixTable('misc') . '
987
+                    FROM ' . prefixTable('misc').'
988 988
                     WHERE intitule = %i AND type= %s',
989 989
                     $nodeInfo->id,
990 990
                     'complex'
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
                 // If it is a subfolder, then give access to it for all roles that allows the parent folder
1065 1065
                 $rows = DB::query(
1066 1066
                     'SELECT role_id, type
1067
-                    FROM ' . prefixTable('roles_values') . '
1067
+                    FROM ' . prefixTable('roles_values').'
1068 1068
                     WHERE folder_id = %i',
1069 1069
                     $parentId
1070 1070
                 );
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
                 // if parent folder has Custom Fields Categories then add to this child one too
1084 1084
                 $rows = DB::query(
1085 1085
                     'SELECT id_category
1086
-                    FROM ' . prefixTable('categories_folders') . '
1086
+                    FROM ' . prefixTable('categories_folders').'
1087 1087
                     WHERE id_folder = %i',
1088 1088
                     $nodeInfo->id
1089 1089
                 );
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
                     // We will use TP_USER in order to decrypt and crypt passwords
1109 1109
                     $userTpInfo = DB::queryFirstRow(
1110 1110
                         'SELECT pw, public_key, private_key, login, name
1111
-                        FROM ' . prefixTable('users') . '
1111
+                        FROM ' . prefixTable('users').'
1112 1112
                         WHERE id = %i',
1113 1113
                         TP_USER_ID
1114 1114
                     );
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
                     $errorItems = [];
1120 1120
                     $rows = DB::query(
1121 1121
                         'SELECT *
1122
-                        FROM ' . prefixTable('items') . '
1122
+                        FROM ' . prefixTable('items').'
1123 1123
                         WHERE id_tree = %i',
1124 1124
                         $nodeInfo->id
1125 1125
                     );
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
                         // if it is then don't copy it
1129 1129
                         $item_deleted = DB::queryFirstRow(
1130 1130
                             'SELECT *
1131
-                            FROM ' . prefixTable('log_items') . '
1131
+                            FROM ' . prefixTable('log_items').'
1132 1132
                             WHERE id_item = %i AND action = %s
1133 1133
                             ORDER BY date DESC
1134 1134
                             LIMIT 0, 1',
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 
1140 1140
                         $item_restored = DB::queryFirstRow(
1141 1141
                             'SELECT *
1142
-                            FROM ' . prefixTable('log_items') . '
1142
+                            FROM ' . prefixTable('log_items').'
1143 1143
                             WHERE id_item = %i AND action = %s
1144 1144
                             ORDER BY date DESC
1145 1145
                             LIMIT 0, 1',
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
                              // Get the ITEM object key for the user
1155 1155
                             $itemUserTpKey = DB::queryFirstRow(
1156 1156
                                 'SELECT share_key
1157
-                                FROM ' . prefixTable('sharekeys_items') . '
1157
+                                FROM ' . prefixTable('sharekeys_items').'
1158 1158
                                 WHERE user_id = %i AND object_id = %i',
1159 1159
                                 TP_USER_ID,
1160 1160
                                 $record['id']
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                     // Get path
1313 1313
                     $text = '';
1314 1314
                     foreach ($tree->getPath($folder->id, false) as $fld) {
1315
-                        $text .= empty($text) === true ? '     [<i>' . $fld->title : ' > ' . $fld->title;
1315
+                        $text .= empty($text) === true ? '     [<i>'.$fld->title : ' > '.$fld->title;
1316 1316
                     }
1317 1317
 
1318 1318
                     // Save array
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
                             'id' => (int) $folder->id,
1323 1323
                             'label' => $folder->title,
1324 1324
                             'level' => $folder->nlevel,
1325
-                            'path' => empty($text) === true ? '' : $text . '</i>]'
1325
+                            'path' => empty($text) === true ? '' : $text.'</i>]'
1326 1326
                         )
1327 1327
                     );
1328 1328
                 }
Please login to merge, or discard this patch.
sources/items.queries.php 1 patch
Spacing   +279 added lines, -280 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
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             // About special settings
366 366
             $dataFolderSettings = DB::queryFirstRow(
367 367
                 'SELECT bloquer_creation, bloquer_modification, personal_folder
368
-                FROM ' . prefixTable('nested_tree') . ' 
368
+                FROM ' . prefixTable('nested_tree').' 
369 369
                 WHERE id = %i',
370 370
                 $inputData['folderId']
371 371
             );
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             // Get folder complexity
383 383
             $folderComplexity = DB::queryFirstRow(
384 384
                 'SELECT valeur
385
-                FROM ' . prefixTable('misc') . '
385
+                FROM ' . prefixTable('misc').'
386 386
                 WHERE type = %s AND intitule = %i',
387 387
                 'complex',
388 388
                 $inputData['folderId']
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             $itemExists = 0;
408 408
             $newID = '';
409 409
             $data = DB::queryFirstRow(
410
-                'SELECT * FROM ' . prefixTable('items') . '
410
+                'SELECT * FROM '.prefixTable('items').'
411 411
                 WHERE label = %s AND inactif = %i',
412 412
                 $inputData['label'],
413 413
                 0
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
                     (int) $post_folder_is_personal,
489 489
                     (int) $newID,
490 490
                     $cryptedStuff['objectKey'],
491
-                    true,   // only for the item creator
492
-                    false,  // no delete all
491
+                    true, // only for the item creator
492
+                    false, // no delete all
493 493
                 );
494 494
 
495 495
                 // update fields
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
                             // should we encrypt the data
503 503
                             $dataTmp = DB::queryFirstRow(
504 504
                                 'SELECT encrypted_data
505
-                                FROM ' . prefixTable('categories') . '
505
+                                FROM ' . prefixTable('categories').'
506 506
                                 WHERE id = %i',
507 507
                                 $field['id']
508 508
                             );
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
                                     (int) $post_folder_is_personal,
532 532
                                     (int) $newObjectId,
533 533
                                     $cryptedStuff['objectKey'],
534
-                                    true,   // only for the item creator
535
-                                    false,  // no delete all
534
+                                    true, // only for the item creator
535
+                                    false, // no delete all
536 536
                                 );
537 537
 
538 538
                                 array_push(
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                 ) {
569 569
                     DB::queryFirstRow(
570 570
                         'SELECT *
571
-                        FROM ' . prefixTable('templates') . '
571
+                        FROM ' . prefixTable('templates').'
572 572
                         WHERE item_id = %i',
573 573
                         $newID
574 574
                     );
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
                 ) {
638 638
                     foreach ($post_restricted_to as $userRest) {
639 639
                         if (empty($userRest) === false) {
640
-                            $dataTmp = DB::queryFirstRow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest);
640
+                            $dataTmp = DB::queryFirstRow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest);
641 641
                             if (empty($listOfRestricted)) {
642 642
                                 $listOfRestricted = $dataTmp['login'];
643 643
                             } else {
644
-                                $listOfRestricted .= ';' . $dataTmp['login'];
644
+                                $listOfRestricted .= ';'.$dataTmp['login'];
645 645
                             }
646 646
                         }
647 647
                     }
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                             if (empty($userRest) === false) {
658 658
                                 $dataTmp = DB::queryFirstRow(
659 659
                                     'SELECT login
660
-                                    FROM ' . prefixTable('users') . '
660
+                                    FROM ' . prefixTable('users').'
661 661
                                     WHERE id= %i',
662 662
                                     $userRest
663 663
                                 );
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                                 if (empty($oldRestrictionList) === true) {
666 666
                                     $oldRestrictionList = $dataTmp['login'];
667 667
                                 } else {
668
-                                    $oldRestrictionList .= ';' . $dataTmp['login'];
668
+                                    $oldRestrictionList .= ';'.$dataTmp['login'];
669 669
                                 }
670 670
                             }
671 671
                         }
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
                 if (empty($post_uploaded_file_id) === false) {
729 729
                     $rows = DB::query(
730 730
                         'SELECT id
731
-                        FROM ' . prefixTable('files') . '
731
+                        FROM ' . prefixTable('files').'
732 732
                         WHERE id_item = %s',
733 733
                         $post_uploaded_file_id
734 734
                     );
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
                                     $lang->get('email_subject_item_updated'),
785 785
                                     str_replace(
786 786
                                         array('#label', '#link'),
787
-                                            array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $lang['email_body3']),
787
+                                            array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$lang['email_body3']),
788 788
                                             $lang->get('new_item_email_body')
789 789
                                     ),
790 790
                                     $emailAddress,
@@ -888,11 +888,11 @@  discard block
 block discarded – undo
888 888
         // Prepare variables
889 889
         $itemInfos = array();
890 890
         $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
891
-        $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
891
+        $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : '';
892 892
         $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : '';
893 893
         $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
894
-        $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : '';
895
-        $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
894
+        $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : '';
895
+        $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : '';
896 896
         $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT);
897 897
         $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
898 898
         $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT);
@@ -923,8 +923,7 @@  discard block
 block discarded – undo
923 923
         $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var(
924 924
                 $dataReceived['to_be_deleted_after_date'],
925 925
                 FILTER_SANITIZE_FULL_SPECIAL_CHARS
926
-            ) :
927
-            '';
926
+            ) : '';
928 927
         $post_fields = (filter_var_array(
929 928
             $dataReceived['fields'],
930 929
             FILTER_SANITIZE_FULL_SPECIAL_CHARS
@@ -984,7 +983,7 @@  discard block
 block discarded – undo
984 983
         // About special settings
985 984
         $dataFolderSettings = DB::queryFirstRow(
986 985
             'SELECT bloquer_creation, bloquer_modification, personal_folder, title
987
-            FROM ' . prefixTable('nested_tree') . ' 
986
+            FROM ' . prefixTable('nested_tree').' 
988 987
             WHERE id = %i',
989 988
             $inputData['folderId']
990 989
         );
@@ -1000,7 +999,7 @@  discard block
 block discarded – undo
1000 999
         // Get folder complexity
1001 1000
         $folderComplexity = DB::queryFirstRow(
1002 1001
             'SELECT valeur
1003
-            FROM ' . prefixTable('misc') . '
1002
+            FROM ' . prefixTable('misc').'
1004 1003
             WHERE type = %s AND intitule = %i',
1005 1004
             'complex',
1006 1005
             $inputData['folderId']
@@ -1045,8 +1044,8 @@  discard block
 block discarded – undo
1045 1044
         // Get all informations for this item
1046 1045
         $dataItem = DB::queryFirstRow(
1047 1046
             'SELECT *
1048
-            FROM ' . prefixTable('items') . ' as i
1049
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1047
+            FROM ' . prefixTable('items').' as i
1048
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1050 1049
             WHERE i.id=%i AND l.action = %s',
1051 1050
             $inputData['itemId'],
1052 1051
             'at_creation'
@@ -1088,7 +1087,7 @@  discard block
 block discarded – undo
1088 1087
         // Does the user has the sharekey for this item?
1089 1088
         DB::query(
1090 1089
             'SELECT *
1091
-            FROM ' . prefixTable('sharekeys_items') . '
1090
+            FROM ' . prefixTable('sharekeys_items').'
1092 1091
             WHERE object_id = %i AND user_id = %s',
1093 1092
             $inputData['itemId'],
1094 1093
             $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
 
@@ -1330,8 +1329,8 @@  discard block
 block discarded – undo
1330 1329
                             'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv,
1331 1330
                             i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data,
1332 1331
                             c.masked AS masked, i.id AS field_item_id
1333
-                            FROM ' . prefixTable('categories_items') . ' AS i
1334
-                            INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
1332
+                            FROM ' . prefixTable('categories_items').' AS i
1333
+                            INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
1335 1334
                             WHERE i.field_id = %i AND i.item_id = %i',
1336 1335
                             $field['id'],
1337 1336
                             $inputData['itemId']
@@ -1347,7 +1346,7 @@  discard block
 block discarded – undo
1347 1346
                             // Perform new query
1348 1347
                             $dataTmpCat = DB::queryFirstRow(
1349 1348
                                 'SELECT id, title, encrypted_data, masked
1350
-                                FROM ' . prefixTable('categories') . '
1349
+                                FROM ' . prefixTable('categories').'
1351 1350
                                 WHERE id = %i',
1352 1351
                                 $field['id']
1353 1352
                             );
@@ -1377,8 +1376,8 @@  discard block
 block discarded – undo
1377 1376
                                     (int) $post_folder_is_personal,
1378 1377
                                     (int) $newId,
1379 1378
                                     $cryptedStuff['objectKey'],
1380
-                                    true,   // only for the item creator
1381
-                                    true,   // delete all
1379
+                                    true, // only for the item creator
1380
+                                    true, // delete all
1382 1381
                                 );
1383 1382
 
1384 1383
                                 // update value
@@ -1428,7 +1427,7 @@  discard block
 block discarded – undo
1428 1427
                                 $session->get('user-id'),
1429 1428
                                 'at_modification',
1430 1429
                                 $session->get('user-login'),
1431
-                                'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value']
1430
+                                'at_field : '.$dataTmpCat['title'].' : '.$field['value']
1432 1431
                             );
1433 1432
                         } else {
1434 1433
                             // Case where the field already exists
@@ -1437,7 +1436,7 @@  discard block
 block discarded – undo
1437 1436
                                 // Get user sharekey for this field
1438 1437
                                 $userKey = DB::queryFirstRow(
1439 1438
                                     'SELECT share_key
1440
-                                    FROM ' . prefixTable('sharekeys_fields') . '
1439
+                                    FROM ' . prefixTable('sharekeys_fields').'
1441 1440
                                     WHERE user_id = %i AND object_id = %i',
1442 1441
                                     $session->get('user-id'),
1443 1442
                                     $dataTmpCat['field_item_id']
@@ -1476,8 +1475,8 @@  discard block
 block discarded – undo
1476 1475
                                         (int) $post_folder_is_personal,
1477 1476
                                         (int) $dataTmpCat['field_item_id'],
1478 1477
                                         $cryptedStuff['objectKey'],
1479
-                                        true,   // only for the item creator
1480
-                                        true,   // delete all
1478
+                                        true, // only for the item creator
1479
+                                        true, // delete all
1481 1480
                                     );
1482 1481
 
1483 1482
                                     if ($encryptedFieldIsChanged === false) {
@@ -1519,7 +1518,7 @@  discard block
 block discarded – undo
1519 1518
                                     $session->get('user-id'),
1520 1519
                                     'at_modification',
1521 1520
                                     $session->get('user-login'),
1522
-                                    'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal
1521
+                                    'at_field : '.$dataTmpCat['title'].' => '.$oldVal
1523 1522
                                 );
1524 1523
                             }
1525 1524
                         }
@@ -1573,7 +1572,7 @@  discard block
 block discarded – undo
1573 1572
             ) {
1574 1573
                 DB::queryFirstRow(
1575 1574
                     'SELECT *
1576
-                    FROM ' . prefixTable('templates') . '
1575
+                    FROM ' . prefixTable('templates').'
1577 1576
                     WHERE item_id = %i',
1578 1577
                     $inputData['itemId']
1579 1578
                 );
@@ -1616,7 +1615,7 @@  discard block
 block discarded – undo
1616 1615
                 // check if elem exists in Table. If not add it or update it.
1617 1616
                 DB::query(
1618 1617
                     'SELECT *
1619
-                    FROM ' . prefixTable('automatic_del') . '
1618
+                    FROM ' . prefixTable('automatic_del').'
1620 1619
                     WHERE item_id = %i',
1621 1620
                     $inputData['itemId']
1622 1621
                 );
@@ -1643,7 +1642,7 @@  discard block
 block discarded – undo
1643 1642
                         // Store updates performed
1644 1643
                         array_push(
1645 1644
                             $arrayOfChanges,
1646
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled')
1645
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled')
1647 1646
                         );
1648 1647
 
1649 1648
                         // update LOG
@@ -1686,7 +1685,7 @@  discard block
 block discarded – undo
1686 1685
                         // Store updates performed
1687 1686
                         array_push(
1688 1687
                             $arrayOfChanges,
1689
-                            $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled')
1688
+                            $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled')
1690 1689
                         );
1691 1690
 
1692 1691
                         // update LOG
@@ -1714,7 +1713,7 @@  discard block
 block discarded – undo
1714 1713
                     if (empty($userId) === false) {
1715 1714
                         $dataTmp = DB::queryFirstRow(
1716 1715
                             'SELECT id, name, lastname
1717
-                            FROM ' . prefixTable('users') . '
1716
+                            FROM ' . prefixTable('users').'
1718 1717
                             WHERE id= %i',
1719 1718
                             $userId
1720 1719
                         );
@@ -1722,7 +1721,7 @@  discard block
 block discarded – undo
1722 1721
                         // Add to array
1723 1722
                         array_push(
1724 1723
                             $arrayOfUsersRestriction,
1725
-                            $dataTmp['name'] . ' ' . $dataTmp['lastname']
1724
+                            $dataTmp['name'].' '.$dataTmp['lastname']
1726 1725
                         );
1727 1726
                         array_push(
1728 1727
                             $arrayOfUsersIdRestriction,
@@ -1753,8 +1752,8 @@  discard block
 block discarded – undo
1753 1752
                 // get values before deleting them
1754 1753
                 $rows = DB::query(
1755 1754
                     'SELECT t.title, t.id AS id
1756
-                    FROM ' . prefixTable('roles_title') . ' as t
1757
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id)
1755
+                    FROM ' . prefixTable('roles_title').' as t
1756
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id)
1758 1757
                     WHERE r.item_id = %i
1759 1758
                     ORDER BY t.title ASC',
1760 1759
                     $inputData['itemId']
@@ -1788,7 +1787,7 @@  discard block
 block discarded – undo
1788 1787
                         );
1789 1788
                         $dataTmp = DB::queryFirstRow(
1790 1789
                             'SELECT title
1791
-                            FROM ' . prefixTable('roles_title') . '
1790
+                            FROM ' . prefixTable('roles_title').'
1792 1791
                             WHERE id = %i',
1793 1792
                             $role
1794 1793
                         );
@@ -1816,7 +1815,7 @@  discard block
 block discarded – undo
1816 1815
             // Get current status
1817 1816
             $otpStatus = DB::queryFirstRow(
1818 1817
                 'SELECT enabled as otp_is_enabled, phone_number, secret
1819
-                FROM ' . prefixTable('items_otp') . '
1818
+                FROM ' . prefixTable('items_otp').'
1820 1819
                 WHERE item_id = %i',
1821 1820
                 $inputData['itemId']
1822 1821
             );
@@ -1830,7 +1829,7 @@  discard block
 block discarded – undo
1830 1829
                     'decrypt'
1831 1830
                 )['string'];
1832 1831
             } else {
1833
-                $currentsecret='';
1832
+                $currentsecret = '';
1834 1833
             }
1835 1834
 
1836 1835
             // If OTP secret provided then encrypt it
@@ -1880,7 +1879,7 @@  discard block
 block discarded – undo
1880 1879
                         $session->get('user-id'),
1881 1880
                         'at_modification',
1882 1881
                         $session->get('user-login'),
1883
-                        'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1882
+                        'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled')
1884 1883
                     );
1885 1884
                 }
1886 1885
                 if ($otpStatus['phone_number'] !== $post_otp_phone_number) {
@@ -1891,7 +1890,7 @@  discard block
 block discarded – undo
1891 1890
                         $session->get('user-id'),
1892 1891
                         'at_modification',
1893 1892
                         $session->get('user-login'),
1894
-                        'at_phone_number:' . $otpStatus['phone_number'] . ' => ' . $post_otp_phone_number
1893
+                        'at_phone_number:'.$otpStatus['phone_number'].' => '.$post_otp_phone_number
1895 1894
                     );
1896 1895
                 }
1897 1896
                 if ($currentsecret !== $post_otp_secret) {
@@ -1940,8 +1939,8 @@  discard block
 block discarded – undo
1940 1939
                     $session->get('user-id'),
1941 1940
                     'at_modification',
1942 1941
                     $session->get('user-login'),
1943
-                    'at_restriction : ' . (count($diffUsersRestiction) > 0 ?
1944
-                        implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1942
+                    'at_restriction : '.(count($diffUsersRestiction) > 0 ?
1943
+                        implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '')
1945 1944
                 );
1946 1945
             }
1947 1946
 
@@ -1961,7 +1960,7 @@  discard block
 block discarded – undo
1961 1960
                     $session->get('user-id'),
1962 1961
                     'at_modification',
1963 1962
                     $session->get('user-login'),
1964
-                    'at_label : ' . $data['label'] . ' => ' . $inputData['label']
1963
+                    'at_label : '.$data['label'].' => '.$inputData['label']
1965 1964
                 );
1966 1965
             }
1967 1966
             // LOGIN
@@ -1980,7 +1979,7 @@  discard block
 block discarded – undo
1980 1979
                     $session->get('user-id'),
1981 1980
                     'at_modification',
1982 1981
                     $session->get('user-login'),
1983
-                    'at_login : ' . $data['login'] . ' => ' . $post_login
1982
+                    'at_login : '.$data['login'].' => '.$post_login
1984 1983
                 );
1985 1984
             }
1986 1985
             // EMAIL
@@ -1999,7 +1998,7 @@  discard block
 block discarded – undo
1999 1998
                     $session->get('user-id'),
2000 1999
                     'at_modification',
2001 2000
                     $session->get('user-login'),
2002
-                    'at_email : ' . $data['email'] . ' => ' . $post_email
2001
+                    'at_email : '.$data['email'].' => '.$post_email
2003 2002
                 );
2004 2003
             }
2005 2004
             // URL
@@ -2018,7 +2017,7 @@  discard block
 block discarded – undo
2018 2017
                     $session->get('user-id'),
2019 2018
                     'at_modification',
2020 2019
                     $session->get('user-login'),
2021
-                    'at_url : ' . $data['url'] . ' => ' . $post_url
2020
+                    'at_url : '.$data['url'].' => '.$post_url
2022 2021
                 );
2023 2022
             }
2024 2023
             // DESCRIPTION
@@ -2044,7 +2043,7 @@  discard block
 block discarded – undo
2044 2043
             // FOLDER
2045 2044
             if ((int) $data['id_tree'] !== (int) $inputData['folderId']) {
2046 2045
                 // Get name of folders
2047
-                $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
2046
+                $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId']));
2048 2047
 
2049 2048
                 // Store updates performed
2050 2049
                 array_push(
@@ -2060,7 +2059,7 @@  discard block
 block discarded – undo
2060 2059
                     $session->get('user-id'),
2061 2060
                     'at_modification',
2062 2061
                     $session->get('user-login'),
2063
-                    'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title']
2062
+                    'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title']
2064 2063
                 );
2065 2064
             }
2066 2065
             // ANYONE_CAN_MODIFY
@@ -2068,7 +2067,7 @@  discard block
 block discarded – undo
2068 2067
                 // Store updates performed
2069 2068
                 array_push(
2070 2069
                     $arrayOfChanges,
2071
-                    $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2070
+                    $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled'))
2072 2071
                 );
2073 2072
 
2074 2073
                 // Log
@@ -2079,15 +2078,15 @@  discard block
 block discarded – undo
2079 2078
                     $session->get('user-id'),
2080 2079
                     'at_modification',
2081 2080
                     $session->get('user-login'),
2082
-                    'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2081
+                    'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled')
2083 2082
                 );
2084 2083
             }
2085 2084
 
2086 2085
             // Reload new values
2087 2086
             $dataItem = DB::queryFirstRow(
2088 2087
                 'SELECT *
2089
-                FROM ' . prefixTable('items') . ' as i
2090
-                INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2088
+                FROM ' . prefixTable('items').' as i
2089
+                INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2091 2090
                 WHERE i.id = %i AND l.action = %s',
2092 2091
                 $inputData['itemId'],
2093 2092
                 'at_creation'
@@ -2096,8 +2095,8 @@  discard block
 block discarded – undo
2096 2095
             $history = '';
2097 2096
             $rows = DB::query(
2098 2097
                 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login
2099
-                FROM ' . prefixTable('log_items') . ' as l
2100
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
2098
+                FROM ' . prefixTable('log_items').' as l
2099
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
2101 2100
                 WHERE l.action <> %s AND id_item=%s',
2102 2101
                 'at_shown',
2103 2102
                 $inputData['itemId']
@@ -2106,14 +2105,14 @@  discard block
 block discarded – undo
2106 2105
                 if ($record['raison'] === NULL) continue;
2107 2106
                 $reason = explode(':', $record['raison']);
2108 2107
                 if (count($reason) > 0) {
2109
-                    $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
2110
-                        . $record['login'] . ' - ' . $lang->get($record['action']) . ' - '
2111
-                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1]
2108
+                    $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '
2109
+                        . $record['login'].' - '.$lang->get($record['action']).' - '
2110
+                        . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1]
2112 2111
                             : $lang->get(trim($reason[0]))) : '');
2113 2112
                     if (empty($history)) {
2114 2113
                         $history = $sentence;
2115 2114
                     } else {
2116
-                        $history .= '<br />' . $sentence;
2115
+                        $history .= '<br />'.$sentence;
2117 2116
                     }
2118 2117
                 }
2119 2118
             }
@@ -2251,7 +2250,7 @@  discard block
 block discarded – undo
2251 2250
         ) {
2252 2251
             // load the original record into an array
2253 2252
             $originalRecord = DB::queryFirstRow(
2254
-                'SELECT * FROM ' . prefixTable('items') . '
2253
+                'SELECT * FROM '.prefixTable('items').'
2255 2254
                 WHERE id = %i',
2256 2255
                 $inputData['itemId']
2257 2256
             );
@@ -2270,7 +2269,7 @@  discard block
 block discarded – undo
2270 2269
 
2271 2270
             // Load the destination folder record into an array
2272 2271
             $dataDestination = DB::queryFirstRow(
2273
-                'SELECT personal_folder FROM ' . prefixTable('nested_tree') . '
2272
+                'SELECT personal_folder FROM '.prefixTable('nested_tree').'
2274 2273
                 WHERE id = %i',
2275 2274
                 $post_dest_id
2276 2275
             );
@@ -2278,7 +2277,7 @@  discard block
 block discarded – undo
2278 2277
             // Get the ITEM object key for the user
2279 2278
             $userKey = DB::queryFirstRow(
2280 2279
                 'SELECT share_key
2281
-                FROM ' . prefixTable('sharekeys_items') . '
2280
+                FROM ' . prefixTable('sharekeys_items').'
2282 2281
                 WHERE user_id = %i AND object_id = %i',
2283 2282
                 $session->get('user-id'),
2284 2283
                 $inputData['itemId']
@@ -2355,8 +2354,8 @@  discard block
 block discarded – undo
2355 2354
             // Manage Custom Fields
2356 2355
             $rows = DB::query(
2357 2356
                 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data
2358
-                FROM ' . prefixTable('categories_items') . ' AS ci
2359
-                INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id)
2357
+                FROM ' . prefixTable('categories_items').' AS ci
2358
+                INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id)
2360 2359
                 WHERE ci.item_id = %i',
2361 2360
                 $inputData['itemId']
2362 2361
             );
@@ -2368,7 +2367,7 @@  discard block
 block discarded – undo
2368 2367
                     // Get user key
2369 2368
                     $userKey = DB::queryFirstRow(
2370 2369
                         'SELECT share_key
2371
-                        FROM ' . prefixTable('sharekeys_fields') . '
2370
+                        FROM ' . prefixTable('sharekeys_fields').'
2372 2371
                         WHERE user_id = %i AND object_id = %i',
2373 2372
                         $session->get('user-id'),
2374 2373
                         $field['id']
@@ -2435,15 +2434,15 @@  discard block
 block discarded – undo
2435 2434
             $rows = DB::query(
2436 2435
                 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension,
2437 2436
                 f.size AS size, f.type AS type, s.share_key AS share_key
2438
-                FROM ' . prefixTable('files') . ' AS f
2439
-                INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
2437
+                FROM ' . prefixTable('files').' AS f
2438
+                INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
2440 2439
                 WHERE s.user_id = %i AND f.id_item = %i',
2441 2440
                 $session->get('user-id'),
2442 2441
                 $inputData['itemId']
2443 2442
             );
2444 2443
             foreach ($rows as $record) {
2445 2444
                 // Check if file still exists
2446
-                if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) {
2445
+                if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) {
2447 2446
                     // Step1 - decrypt the file
2448 2447
                     // deepcode ignore PT: path is sanitized inside decryptFile()
2449 2448
                     $fileContent = decryptFile(
@@ -2454,8 +2453,8 @@  discard block
 block discarded – undo
2454 2453
 
2455 2454
                     // Step2 - create file
2456 2455
                     // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database
2457
-                    $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension'];
2458
-                    $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab');
2456
+                    $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension'];
2457
+                    $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab');
2459 2458
                     if ($outstream === false) {
2460 2459
                         echo prepareExchangedData(
2461 2460
                             array(
@@ -2528,7 +2527,7 @@  discard block
 block discarded – undo
2528 2527
 
2529 2528
             // -------------------------
2530 2529
             // Add specific restrictions
2531
-            $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']);
2530
+            $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']);
2532 2531
             foreach ($rows as $record) {
2533 2532
                 DB::insert(
2534 2533
                     prefixTable('restriction_to_roles'),
@@ -2540,7 +2539,7 @@  discard block
 block discarded – undo
2540 2539
             }
2541 2540
 
2542 2541
             // Add Tags
2543
-            $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']);
2542
+            $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']);
2544 2543
             foreach ($rows as $record) {
2545 2544
                 DB::insert(
2546 2545
                     prefixTable('tags'),
@@ -2642,7 +2641,7 @@  discard block
 block discarded – undo
2642 2641
         // then we can show it
2643 2642
         $item_deleted = DB::queryFirstRow(
2644 2643
             'SELECT *
2645
-            FROM ' . prefixTable('log_items') . '
2644
+            FROM ' . prefixTable('log_items').'
2646 2645
             WHERE id_item = %i AND action = %s
2647 2646
             ORDER BY date DESC
2648 2647
             LIMIT 0, 1',
@@ -2653,7 +2652,7 @@  discard block
 block discarded – undo
2653 2652
 
2654 2653
         $item_restored = DB::queryFirstRow(
2655 2654
             'SELECT *
2656
-            FROM ' . prefixTable('log_items') . '
2655
+            FROM ' . prefixTable('log_items').'
2657 2656
             WHERE id_item = %i AND action = %s
2658 2657
             ORDER BY date DESC
2659 2658
             LIMIT 0, 1',
@@ -2677,8 +2676,8 @@  discard block
 block discarded – undo
2677 2676
         // Get all informations for this item
2678 2677
         $dataItem = DB::queryFirstRow(
2679 2678
             'SELECT *
2680
-            FROM ' . prefixTable('items') . ' as i
2681
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
2679
+            FROM ' . prefixTable('items').' as i
2680
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
2682 2681
             WHERE i.id = %i AND l.action = %s',
2683 2682
             $inputData['id'],
2684 2683
             'at_creation'
@@ -2687,7 +2686,7 @@  discard block
 block discarded – undo
2687 2686
         // Notification
2688 2687
         DB::queryFirstRow(
2689 2688
             'SELECT *
2690
-            FROM ' . prefixTable('notification') . '
2689
+            FROM ' . prefixTable('notification').'
2691 2690
             WHERE item_id = %i AND user_id = %i',
2692 2691
             $inputData['id'],
2693 2692
             $session->get('user-id')
@@ -2706,7 +2705,7 @@  discard block
 block discarded – undo
2706 2705
 
2707 2706
         // manage case of API user
2708 2707
         if ($dataItem['id_user'] === API_USER_ID) {
2709
-            $arrData['author'] = 'API [' . $dataItem['description'] . ']';
2708
+            $arrData['author'] = 'API ['.$dataItem['description'].']';
2710 2709
             $arrData['id_user'] = API_USER_ID;
2711 2710
             $arrData['author_email'] = '';
2712 2711
             $arrData['notification_status'] = false;
@@ -2716,7 +2715,7 @@  discard block
 block discarded – undo
2716 2715
         $tags = array();
2717 2716
         $rows = DB::query(
2718 2717
             'SELECT tag
2719
-            FROM ' . prefixTable('tags') . '
2718
+            FROM ' . prefixTable('tags').'
2720 2719
             WHERE item_id = %i',
2721 2720
             $inputData['id']
2722 2721
         );
@@ -2740,7 +2739,7 @@  discard block
 block discarded – undo
2740 2739
         // Check if user has a role that is accepted
2741 2740
         $rows_tmp = DB::query(
2742 2741
             'SELECT role_id
2743
-            FROM ' . prefixTable('restriction_to_roles') . '
2742
+            FROM ' . prefixTable('restriction_to_roles').'
2744 2743
             WHERE item_id=%i',
2745 2744
             $inputData['id']
2746 2745
         );
@@ -2754,7 +2753,7 @@  discard block
 block discarded – undo
2754 2753
         // Get the object key for the user
2755 2754
         $userKeys = DB::query(
2756 2755
             'SELECT share_key
2757
-            FROM ' . prefixTable('sharekeys_items') . '
2756
+            FROM ' . prefixTable('sharekeys_items').'
2758 2757
             WHERE user_id = %i AND object_id = %i',
2759 2758
             $session->get('user-id'),
2760 2759
             $inputData['id']
@@ -2867,8 +2866,8 @@  discard block
 block discarded – undo
2867 2866
                 // Add restriction if item is restricted to roles
2868 2867
                 $rows = DB::query(
2869 2868
                     'SELECT t.title, t.id
2870
-                    FROM ' . prefixTable('roles_title') . ' AS t
2871
-                    INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id)
2869
+                    FROM ' . prefixTable('roles_title').' AS t
2870
+                    INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id)
2872 2871
                     WHERE r.item_id = %i
2873 2872
                     ORDER BY t.title ASC',
2874 2873
                     $inputData['id']
@@ -2884,8 +2883,8 @@  discard block
 block discarded – undo
2884 2883
                 $tmp = array();
2885 2884
                 $rows = DB::query(
2886 2885
                     'SELECT k.label, k.id
2887
-                    FROM ' . prefixTable('kb_items') . ' as i
2888
-                    INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id)
2886
+                    FROM ' . prefixTable('kb_items').' as i
2887
+                    INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id)
2889 2888
                     WHERE i.item_id = %i
2890 2889
                     ORDER BY k.label ASC',
2891 2890
                     $inputData['id']
@@ -2968,7 +2967,7 @@  discard block
 block discarded – undo
2968 2967
                 $arrCatList = array();
2969 2968
                 $rows_tmp = DB::query(
2970 2969
                     'SELECT id_category
2971
-                    FROM ' . prefixTable('categories_folders') . '
2970
+                    FROM ' . prefixTable('categories_folders').'
2972 2971
                     WHERE id_folder=%i',
2973 2972
                     $inputData['folderId']
2974 2973
                 );
@@ -2983,8 +2982,8 @@  discard block
 block discarded – undo
2983 2982
                         'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id,
2984 2983
                         i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id,
2985 2984
                         c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility
2986
-                        FROM ' . prefixTable('categories_items') . ' AS i
2987
-                        INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id)
2985
+                        FROM ' . prefixTable('categories_items').' AS i
2986
+                        INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id)
2988 2987
                         WHERE i.item_id=%i AND c.parent_id IN %ls',
2989 2988
                         $inputData['id'],
2990 2989
                         $arrCatList
@@ -2995,7 +2994,7 @@  discard block
 block discarded – undo
2995 2994
                         //db::debugmode(true);
2996 2995
                         $userKey = DB::queryFirstRow(
2997 2996
                             'SELECT share_key
2998
-                            FROM ' . prefixTable('sharekeys_fields') . '
2997
+                            FROM ' . prefixTable('sharekeys_fields').'
2999 2998
                             WHERE user_id = %i AND object_id = %i',
3000 2999
                             $session->get('user-id'),
3001 3000
                             $row['id']
@@ -3013,7 +3012,7 @@  discard block
 block discarded – undo
3013 3012
                         } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) {
3014 3013
                             // Data is not encrypted in DB
3015 3014
                             $fieldText = [
3016
-                                'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
3015
+                                'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : 
3017 3016
                                 'encrypted' => false,
3018 3017
                                 'error' => false,
3019 3018
                             ];
@@ -3058,7 +3057,7 @@  discard block
 block discarded – undo
3058 3057
             if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) {
3059 3058
                 $rows_tmp = DB::queryFirstRow(
3060 3059
                     'SELECT category_id
3061
-                    FROM ' . prefixTable('templates') . '
3060
+                    FROM ' . prefixTable('templates').'
3062 3061
                     WHERE item_id = %i',
3063 3062
                     $inputData['id']
3064 3063
                 );
@@ -3075,7 +3074,7 @@  discard block
 block discarded – undo
3075 3074
             // Evaluate if item is ready for all users
3076 3075
             $rows_tmp = DB::queryFirstRow(
3077 3076
                 'SELECT finished_at
3078
-                FROM ' . prefixTable('background_tasks') . '
3077
+                FROM ' . prefixTable('background_tasks').'
3079 3078
                 WHERE item_id = %i',
3080 3079
                 $inputData['id']
3081 3080
             );
@@ -3092,7 +3091,7 @@  discard block
 block discarded – undo
3092 3091
                 // Is the Item to be deleted?
3093 3092
                 $dataDelete = DB::queryFirstRow(
3094 3093
                     'SELECT * 
3095
-                    FROM ' . prefixTable('automatic_del') . '
3094
+                    FROM ' . prefixTable('automatic_del').'
3096 3095
                     WHERE item_id = %i',
3097 3096
                     $inputData['id']
3098 3097
                 );
@@ -3173,14 +3172,14 @@  discard block
 block discarded – undo
3173 3172
                     if (empty($userRest) === false) {
3174 3173
                         $dataTmp = DB::queryFirstRow(
3175 3174
                             'SELECT login
3176
-                            FROM ' . prefixTable('users') . '
3175
+                            FROM ' . prefixTable('users').'
3177 3176
                             WHERE id= %i',
3178 3177
                             $userRest
3179 3178
                         );
3180 3179
                         if (empty($listOfRestricted)) {
3181 3180
                             $listOfRestricted = $dataTmp['login'];
3182 3181
                         } else {
3183
-                            $listOfRestricted .= ';' . $dataTmp['login'];
3182
+                            $listOfRestricted .= ';'.$dataTmp['login'];
3184 3183
                         }
3185 3184
                     }
3186 3185
                 }
@@ -3254,9 +3253,9 @@  discard block
 block discarded – undo
3254 3253
         // Load item data
3255 3254
         $dataItem = DB::queryFirstRow(
3256 3255
             '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
3257
-            FROM ' . prefixTable('items') . ' AS i
3258
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
3259
-            LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id)
3256
+            FROM ' . prefixTable('items').' AS i
3257
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
3258
+            LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id)
3260 3259
             WHERE i.id = %i',
3261 3260
             $inputData['id']
3262 3261
         );
@@ -3278,7 +3277,7 @@  discard block
 block discarded – undo
3278 3277
         // Check if user has a role that is accepted
3279 3278
         $rows_tmp = DB::query(
3280 3279
             'SELECT role_id
3281
-            FROM ' . prefixTable('restriction_to_roles') . '
3280
+            FROM ' . prefixTable('restriction_to_roles').'
3282 3281
             WHERE item_id=%i',
3283 3282
             $inputData['id']
3284 3283
         );
@@ -3310,12 +3309,12 @@  discard block
 block discarded – undo
3310 3309
             // launch query
3311 3310
             $rows = DB::query(
3312 3311
                 'SELECT id, name, file, extension, size
3313
-                FROM ' . prefixTable('files') . '
3312
+                FROM ' . prefixTable('files').'
3314 3313
                 WHERE id_item = %i AND confirmed = 1',
3315 3314
                 $inputData['id']
3316 3315
             );
3317 3316
             foreach ($rows as $record) {
3318
-                $filename = basename($record['name'], '.' . $record['extension']);
3317
+                $filename = basename($record['name'], '.'.$record['extension']);
3319 3318
                 $filename = isBase64($filename) === true ? base64_decode($filename) : $filename;
3320 3319
 
3321 3320
                 array_push(
@@ -3328,7 +3327,7 @@  discard block
 block discarded – undo
3328 3327
                         'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0,
3329 3328
                         'id' => $record['id'],
3330 3329
                         'key' => $session->get('user-key_tmp'),
3331
-                        'internalFilename' => basename($record['name'], '.' . $record['extension']),
3330
+                        'internalFilename' => basename($record['name'], '.'.$record['extension']),
3332 3331
                     )
3333 3332
                 );
3334 3333
             }
@@ -3366,7 +3365,7 @@  discard block
 block discarded – undo
3366 3365
                     array(
3367 3366
                         'latest_items' => implode(';', $session->get('user-latest_items')),
3368 3367
                     ),
3369
-                    'id=' . $session->get('user-id')
3368
+                    'id='.$session->get('user-id')
3370 3369
                 );
3371 3370
             }
3372 3371
 
@@ -3375,8 +3374,8 @@  discard block
 block discarded – undo
3375 3374
             $listOptionsForRoles = array();
3376 3375
             $rows = DB::query(
3377 3376
                 'SELECT r.role_id AS role_id, t.title AS title
3378
-                FROM ' . prefixTable('roles_values') . ' AS r
3379
-                INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
3377
+                FROM ' . prefixTable('roles_values').' AS r
3378
+                INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
3380 3379
                 WHERE r.folder_id = %i',
3381 3380
                 $dataItem['id_tree']
3382 3381
             );
@@ -3390,9 +3389,9 @@  discard block
 block discarded – undo
3390 3389
                 );
3391 3390
                 $rows2 = DB::query(
3392 3391
                     'SELECT id, login, fonction_id, email, name, lastname
3393
-                    FROM ' . prefixTable('users') . '
3392
+                    FROM ' . prefixTable('users').'
3394 3393
                     WHERE fonction_id LIKE %s',
3395
-                    '%' . $record['role_id'] . '%'
3394
+                    '%'.$record['role_id'].'%'
3396 3395
                 );
3397 3396
                 foreach ($rows2 as $record2) {
3398 3397
                     foreach (explode(';', $record2['fonction_id']) as $role) {
@@ -3405,7 +3404,7 @@  discard block
 block discarded – undo
3405 3404
                                 array(
3406 3405
                                     'id' => (int) $record2['id'],
3407 3406
                                     'login' => $record2['login'],
3408
-                                    'name' => $record2['name'] . ' ' . $record2['lastname'],
3407
+                                    'name' => $record2['name'].' '.$record2['lastname'],
3409 3408
                                     'email' => $record2['email'],
3410 3409
                                 )
3411 3410
                             );
@@ -3424,16 +3423,16 @@  discard block
 block discarded – undo
3424 3423
                 $path = '';
3425 3424
                 foreach ($arbo as $elem) {
3426 3425
                     if (empty($path) === true) {
3427
-                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
3426
+                        $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
3428 3427
                     } else {
3429
-                        $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3428
+                        $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
3430 3429
                     }
3431 3430
                 }
3432 3431
                 // Build text to show user
3433 3432
                 if (empty($path) === true) {
3434 3433
                     $path = addslashes($dataItem['label']);
3435 3434
                 } else {
3436
-                    $path = addslashes($dataItem['label']) . ' (' . $path . ')';
3435
+                    $path = addslashes($dataItem['label']).' ('.$path.')';
3437 3436
                 }
3438 3437
 
3439 3438
                 // Add Admins to notification list if expected
@@ -3456,7 +3455,7 @@  discard block
 block discarded – undo
3456 3455
                         array(
3457 3456
                             addslashes($session->get('user-login')),
3458 3457
                             $path,
3459
-                            $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'],
3458
+                            $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'],
3460 3459
                         ),
3461 3460
                         $lang->get('email_on_open_notification_mail')
3462 3461
                     ),
@@ -3466,7 +3465,7 @@  discard block
 block discarded – undo
3466 3465
             }
3467 3466
 
3468 3467
             // has this item a change proposal
3469
-            DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']);
3468
+            DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']);
3470 3469
             $returnArray['has_change_proposal'] = DB::count();
3471 3470
 
3472 3471
             // Setting
@@ -3477,7 +3476,7 @@  discard block
 block discarded – undo
3477 3476
             if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) {
3478 3477
                 DB::query(
3479 3478
                     'SELECT *
3480
-                    FROM ' . prefixTable('otv') . '
3479
+                    FROM ' . prefixTable('otv').'
3481 3480
                     WHERE item_id = %i
3482 3481
                     AND time_limit > %i',
3483 3482
                     $inputData['id'],
@@ -3576,7 +3575,7 @@  discard block
 block discarded – undo
3576 3575
         // Load item data
3577 3576
         $data = DB::queryFirstRow(
3578 3577
             'SELECT id_tree, id, label
3579
-            FROM ' . prefixTable('items') . '
3578
+            FROM ' . prefixTable('items').'
3580 3579
             WHERE id = %i OR item_key = %s',
3581 3580
             $inputData['itemId'],
3582 3581
             $inputData['itemKey']
@@ -3667,7 +3666,7 @@  discard block
 block discarded – undo
3667 3666
         // Load item data
3668 3667
         $dataItem = DB::queryFirstRow(
3669 3668
             'SELECT secret, enabled
3670
-            FROM ' . prefixTable('items_otp') . '
3669
+            FROM ' . prefixTable('items_otp').'
3671 3670
             WHERE item_id = %i',
3672 3671
             $inputData['id']
3673 3672
         );
@@ -3749,13 +3748,13 @@  discard block
 block discarded – undo
3749 3748
 
3750 3749
         // Check if user is allowed to access this folder
3751 3750
         if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) {
3752
-            echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]';
3751
+            echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]';
3753 3752
             break;
3754 3753
         }
3755 3754
 
3756 3755
         // Check if title doesn't contains html codes
3757 3756
         if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) {
3758
-            echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]';
3757
+            echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]';
3759 3758
             break;
3760 3759
         }
3761 3760
         // check that title is not numeric
@@ -3766,9 +3765,9 @@  discard block
 block discarded – undo
3766 3765
 
3767 3766
         // Check if duplicate folders name are allowed
3768 3767
         if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') {
3769
-            $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title);
3768
+            $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title);
3770 3769
             if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) {
3771
-                echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]';
3770
+                echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]';
3772 3771
                 break;
3773 3772
             }
3774 3773
         }
@@ -3776,7 +3775,7 @@  discard block
 block discarded – undo
3776 3775
         // query on folder
3777 3776
         $data = DB::queryFirstRow(
3778 3777
             'SELECT parent_id, personal_folder
3779
-            FROM ' . prefixTable('nested_tree') . '
3778
+            FROM ' . prefixTable('nested_tree').'
3780 3779
             WHERE id = %i',
3781 3780
             $inputData['folderId']
3782 3781
         );
@@ -3786,20 +3785,20 @@  discard block
 block discarded – undo
3786 3785
         if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') {
3787 3786
             $data = DB::queryFirstRow(
3788 3787
                 'SELECT valeur
3789
-                FROM ' . prefixTable('misc') . '
3788
+                FROM ' . prefixTable('misc').'
3790 3789
                 WHERE intitule = %i AND type = %s',
3791 3790
                 $data['parent_id'],
3792 3791
                 'complex'
3793 3792
             );
3794 3793
             if (intval($dataReceived['complexity']) < intval($data['valeur'])) {
3795
-                echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]';
3794
+                echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]';
3796 3795
                 break;
3797 3796
             }
3798 3797
         }
3799 3798
 
3800 3799
         // update Folders table
3801 3800
         $tmp = DB::queryFirstRow(
3802
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
3801
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
3803 3802
             $dataReceived['folder']
3804 3803
         );
3805 3804
         if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) {
@@ -3913,7 +3912,7 @@  discard block
 block discarded – undo
3913 3912
             $uniqueLoadData['path'] = $arr_arbo;
3914 3913
 
3915 3914
             // store last folder accessed in cookie
3916
-            $arr_cookie_options = array (
3915
+            $arr_cookie_options = array(
3917 3916
                 'expires' => time() + TP_ONE_DAY_SECONDS * 5,
3918 3917
                 'path' => '/', 
3919 3918
                 'secure' => true,
@@ -3928,7 +3927,7 @@  discard block
 block discarded – undo
3928 3927
             foreach ($session->get('user-roles_array') as $role) {
3929 3928
                 $roleQ = DB::queryFirstRow(
3930 3929
                     'SELECT allow_pw_change
3931
-                    FROM ' . prefixTable('roles_title') . '
3930
+                    FROM ' . prefixTable('roles_title').'
3932 3931
                     WHERE id = %i',
3933 3932
                     $role
3934 3933
                 );
@@ -3959,11 +3958,11 @@  discard block
 block discarded – undo
3959 3958
                 
3960 3959
                 foreach ($session->get('user-roles_array') as $role) {
3961 3960
                     $access = DB::queryFirstRow(
3962
-                        'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i',
3961
+                        'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i',
3963 3962
                         $role,
3964 3963
                         $inputData['id']
3965 3964
                     );
3966
-                    if (DB::count()>0) {
3965
+                    if (DB::count() > 0) {
3967 3966
                         if ($access['type'] === 'R') {
3968 3967
                             array_push($arrTmp, 10);
3969 3968
                         } elseif ($access['type'] === 'W') {
@@ -4028,7 +4027,7 @@  discard block
 block discarded – undo
4028 4027
             } else {
4029 4028
                 DB::query(
4030 4029
                     'SELECT *
4031
-                    FROM ' . prefixTable('items') . '
4030
+                    FROM ' . prefixTable('items').'
4032 4031
                     WHERE inactif = %i',
4033 4032
                     0
4034 4033
                 );
@@ -4038,7 +4037,7 @@  discard block
 block discarded – undo
4038 4037
 
4039 4038
             // Get folder complexity
4040 4039
             $folderComplexity = DB::queryFirstRow(
4041
-                'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i',
4040
+                'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i',
4042 4041
                 'complex',
4043 4042
                 $inputData['id']
4044 4043
             );
@@ -4050,7 +4049,7 @@  discard block
 block discarded – undo
4050 4049
             if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) {
4051 4050
                 $folderRow = DB::query(
4052 4051
                     'SELECT id_category
4053
-                    FROM ' . prefixTable('categories_folders') . '
4052
+                    FROM ' . prefixTable('categories_folders').'
4054 4053
                     WHERE id_folder = %i',
4055 4054
                     $inputData['id']
4056 4055
                 );
@@ -4106,8 +4105,8 @@  discard block
 block discarded – undo
4106 4105
                 $where->add('i.inactif=%i', 0);
4107 4106
                 $where->add('i.deleted_at IS NULL');
4108 4107
 
4109
-                $query_limit = ' LIMIT ' .
4110
-                    $start . ',' .
4108
+                $query_limit = ' LIMIT '.
4109
+                    $start.','.
4111 4110
                     $post_nb_items_to_display_once;
4112 4111
                     
4113 4112
                 $rows = DB::query(
@@ -4115,8 +4114,8 @@  discard block
 block discarded – undo
4115 4114
                     i.label, i.description, i.pw, i.login,
4116 4115
                     i.anyone_can_modify, i.id_tree AS tree_id, i.fa_icon,
4117 4116
                     n.renewal_period, i.url AS link, i.email
4118
-                    FROM ' . prefixTable('items') . ' AS i
4119
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4117
+                    FROM ' . prefixTable('items').' AS i
4118
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4120 4119
                     WHERE %l
4121 4120
                     ORDER BY i.label ASC' . $query_limit,
4122 4121
                     $where
@@ -4130,8 +4129,8 @@  discard block
 block discarded – undo
4130 4129
                     i.label, i.description, i.pw, i.login,
4131 4130
                     i.anyone_can_modify, i.id_tree AS tree_id, i.fa_icon,
4132 4131
                     n.renewal_period, i.url AS link, i.email
4133
-                    FROM ' . prefixTable('items') . ' AS i
4134
-                    INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id)
4132
+                    FROM ' . prefixTable('items').' AS i
4133
+                    INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id)
4135 4134
                     WHERE %l
4136 4135
                     ORDER BY i.label ASC',
4137 4136
                     $where
@@ -4161,7 +4160,7 @@  discard block
 block discarded – undo
4161 4160
                     $item_is_restricted_to_role = false;
4162 4161
                     DB::queryFirstRow(
4163 4162
                         'SELECT role_id
4164
-                        FROM ' . prefixTable('restriction_to_roles') . '
4163
+                        FROM ' . prefixTable('restriction_to_roles').'
4165 4164
                         WHERE item_id = %i',
4166 4165
                         $record['id']
4167 4166
                     );
@@ -4173,7 +4172,7 @@  discard block
 block discarded – undo
4173 4172
                     $user_is_included_in_role = false;
4174 4173
                     DB::query(
4175 4174
                         'SELECT role_id
4176
-                        FROM ' . prefixTable('restriction_to_roles') . '
4175
+                        FROM ' . prefixTable('restriction_to_roles').'
4177 4176
                         WHERE item_id = %i AND role_id IN %ls',
4178 4177
                         $record['id'],
4179 4178
                         $session->get('user-roles_array')
@@ -4383,8 +4382,8 @@  discard block
 block discarded – undo
4383 4382
         if ((int) $start === 0) {
4384 4383
             DB::query(
4385 4384
                 'SELECT i.id
4386
-                FROM ' . prefixTable('items') . ' as i
4387
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
4385
+                FROM ' . prefixTable('items').' as i
4386
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
4388 4387
                 WHERE %l',
4389 4388
                 $where
4390 4389
             );
@@ -4444,8 +4443,8 @@  discard block
 block discarded – undo
4444 4443
         $dataItem = DB::queryFirstRow(
4445 4444
             'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id,
4446 4445
                     i.label AS label, i.id_tree AS id_tree
4447
-            FROM ' . prefixTable('items') . ' AS i
4448
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
4446
+            FROM ' . prefixTable('items').' AS i
4447
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
4449 4448
             WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)',
4450 4449
             $session->get('user-id'),
4451 4450
             $inputData['itemKey'] ?? '',
@@ -4557,7 +4556,7 @@  discard block
 block discarded – undo
4557 4556
         // do query on this folder
4558 4557
         $data_this_folder = DB::queryFirstRow(
4559 4558
             'SELECT id, personal_folder, title
4560
-            FROM ' . prefixTable('nested_tree') . '
4559
+            FROM ' . prefixTable('nested_tree').'
4561 4560
             WHERE id = %s',
4562 4561
             $inputData['folderId']
4563 4562
         );
@@ -4597,8 +4596,8 @@  discard block
 block discarded – undo
4597 4596
         $visibilite = '';
4598 4597
         $data = DB::queryFirstRow(
4599 4598
             'SELECT m.valeur, n.personal_folder
4600
-            FROM ' . prefixTable('misc') . ' AS m
4601
-            INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id)
4599
+            FROM ' . prefixTable('misc').' AS m
4600
+            INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id)
4602 4601
             WHERE type=%s AND intitule = %s',
4603 4602
             'complex',
4604 4603
             $inputData['folderId']
@@ -4611,8 +4610,8 @@  discard block
 block discarded – undo
4611 4610
             // Prepare Item actual visibility (what Users/Roles can see it)
4612 4611
             $rows = DB::query(
4613 4612
                 'SELECT t.title
4614
-                FROM ' . prefixTable('roles_values') . ' as v
4615
-                INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
4613
+                FROM ' . prefixTable('roles_values').' as v
4614
+                INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
4616 4615
                 WHERE v.folder_id = %i
4617 4616
                 GROUP BY title',
4618 4617
                 $inputData['folderId']
@@ -4621,7 +4620,7 @@  discard block
 block discarded – undo
4621 4620
                 if (empty($visibilite)) {
4622 4621
                     $visibilite = $record['title'];
4623 4622
                 } else {
4624
-                    $visibilite .= ' - ' . $record['title'];
4623
+                    $visibilite .= ' - '.$record['title'];
4625 4624
                 }
4626 4625
             }
4627 4626
         } else {
@@ -4631,14 +4630,14 @@  discard block
 block discarded – undo
4631 4630
             // do new query to know if current folder is pf
4632 4631
             $data_pf = DB::queryFirstRow(
4633 4632
                 'SELECT personal_folder
4634
-                FROM ' . prefixTable('nested_tree') . '
4633
+                FROM ' . prefixTable('nested_tree').'
4635 4634
                 WHERE id = %s',
4636 4635
                 $inputData['folderId']
4637 4636
             );
4638 4637
             
4639 4638
             $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0;
4640 4639
             
4641
-            $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')';
4640
+            $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')';
4642 4641
         }
4643 4642
 
4644 4643
         recupDroitCreationSansComplexite($inputData['folderId']);
@@ -4648,8 +4647,8 @@  discard block
 block discarded – undo
4648 4647
         $listOptionsForRoles = array();
4649 4648
         $rows = DB::query(
4650 4649
             'SELECT r.role_id AS role_id, t.title AS title
4651
-            FROM ' . prefixTable('roles_values') . ' AS r
4652
-            INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id)
4650
+            FROM ' . prefixTable('roles_values').' AS r
4651
+            INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id)
4653 4652
             WHERE r.folder_id = %i',
4654 4653
             $inputData['folderId']
4655 4654
         );
@@ -4663,7 +4662,7 @@  discard block
 block discarded – undo
4663 4662
             );
4664 4663
             $rows2 = DB::query(
4665 4664
                 'SELECT id, login, fonction_id, email, name, lastname
4666
-                FROM ' . prefixTable('users') . '
4665
+                FROM ' . prefixTable('users').'
4667 4666
                 WHERE admin = 0 AND fonction_id is not null'
4668 4667
             );
4669 4668
             foreach ($rows2 as $record2) {
@@ -4677,7 +4676,7 @@  discard block
 block discarded – undo
4677 4676
                             array(
4678 4677
                                 'id' => $record2['id'],
4679 4678
                                 'login' => $record2['login'],
4680
-                                'name' => $record2['name'] . ' ' . $record2['lastname'],
4679
+                                'name' => $record2['name'].' '.$record2['lastname'],
4681 4680
                                 'email' => $record2['email'],
4682 4681
                             )
4683 4682
                         );
@@ -4694,12 +4693,12 @@  discard block
 block discarded – undo
4694 4693
             foreach ($session->get('user-roles_array') as $role) {
4695 4694
                 $access = DB::queryFirstRow(
4696 4695
                     'SELECT type
4697
-                    FROM ' . prefixTable('roles_values') . '
4696
+                    FROM ' . prefixTable('roles_values').'
4698 4697
                     WHERE role_id = %i AND folder_id = %i',
4699 4698
                     $role,
4700 4699
                     $inputData['folderId']
4701 4700
                 );
4702
-                if (DB::count()>0) {
4701
+                if (DB::count() > 0) {
4703 4702
                     if ($access['type'] === 'R') {
4704 4703
                         array_push($arrTmp, 10);
4705 4704
                     } elseif ($access['type'] === 'W') {
@@ -4727,7 +4726,7 @@  discard block
 block discarded – undo
4727 4726
             // Check if personal folder is owned by user
4728 4727
             $folder = DB::queryFirstRow(
4729 4728
                 'SELECT id
4730
-                FROM ' . prefixTable('nested_tree') . '
4729
+                FROM ' . prefixTable('nested_tree').'
4731 4730
                 WHERE title = %s',
4732 4731
                 $session->get('user-id'),
4733 4732
             );
@@ -4832,7 +4831,7 @@  discard block
 block discarded – undo
4832 4831
         // Get some info before deleting
4833 4832
         $data = DB::queryFirstRow(
4834 4833
             'SELECT name, id_item, file
4835
-            FROM ' . prefixTable('files') . '
4834
+            FROM ' . prefixTable('files').'
4836 4835
             WHERE id = %i',
4837 4836
             $fileId
4838 4837
         );
@@ -4840,7 +4839,7 @@  discard block
 block discarded – undo
4840 4839
         // Load item data
4841 4840
         $data_item = DB::queryFirstRow(
4842 4841
             'SELECT id_tree
4843
-            FROM ' . prefixTable('items') . '
4842
+            FROM ' . prefixTable('items').'
4844 4843
             WHERE id = %i',
4845 4844
             $data['id_item']
4846 4845
         );
@@ -4870,7 +4869,7 @@  discard block
 block discarded – undo
4870 4869
                 $session->get('user-id'),
4871 4870
                 'at_modification',
4872 4871
                 $session->get('user-login'),
4873
-                'at_del_file : ' . $data['name']
4872
+                'at_del_file : '.$data['name']
4874 4873
             );
4875 4874
 
4876 4875
             // DElete sharekeys
@@ -4881,7 +4880,7 @@  discard block
 block discarded – undo
4881 4880
             );
4882 4881
 
4883 4882
             // Delete file from server
4884
-            $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']);
4883
+            $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']);
4885 4884
             $fileToDelete = realpath($fileToDelete);
4886 4885
             if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) {
4887 4886
                 fileDelete($fileToDelete, $SETTINGS);
@@ -4935,7 +4934,7 @@  discard block
 block discarded – undo
4935 4934
             // Update SESSION with this new favourite
4936 4935
             $data = DB::queryFirstRow(
4937 4936
                 'SELECT label,id_tree
4938
-                FROM ' . prefixTable('items') . '
4937
+                FROM ' . prefixTable('items').'
4939 4938
                 WHERE id = %i',
4940 4939
                 $inputData['itemId']
4941 4940
             );
@@ -4944,7 +4943,7 @@  discard block
 block discarded – undo
4944 4943
                 [
4945 4944
                     $inputData['itemId'] => [
4946 4945
                         'label' => $data['label'],
4947
-                        'url' => 'index.php?page=items&amp;group=' . $data['id_tree'] . '&amp;id=' . $inputData['itemId'],
4946
+                        'url' => 'index.php?page=items&amp;group='.$data['id_tree'].'&amp;id='.$inputData['itemId'],
4948 4947
                     ],
4949 4948
                 ],
4950 4949
                 'add'
@@ -5013,8 +5012,8 @@  discard block
 block discarded – undo
5013 5012
         // get data about item
5014 5013
         $dataSource = DB::queryFirstRow(
5015 5014
             'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5016
-            FROM ' . prefixTable('items') . ' as i
5017
-            INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5015
+            FROM ' . prefixTable('items').' as i
5016
+            INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5018 5017
             WHERE i.id=%i',
5019 5018
             $inputData['itemId']
5020 5019
         );
@@ -5058,7 +5057,7 @@  discard block
 block discarded – undo
5058 5057
         // get data about new folder
5059 5058
         $dataDestination = DB::queryFirstRow(
5060 5059
             'SELECT personal_folder, title
5061
-            FROM ' . prefixTable('nested_tree') . '
5060
+            FROM ' . prefixTable('nested_tree').'
5062 5061
             WHERE id = %i',
5063 5062
             $inputData['folderId']
5064 5063
         );
@@ -5104,14 +5103,14 @@  discard block
 block discarded – undo
5104 5103
                 prefixTable('sharekeys_items'),
5105 5104
                 'object_id = %i AND user_id NOT IN %ls',
5106 5105
                 $inputData['itemId'],
5107
-                [$session->get('user-id'), TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
5106
+                [$session->get('user-id'), TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
5108 5107
             );
5109 5108
 
5110 5109
             // Remove all item sharekeys fields
5111 5110
             // Get fields for this Item
5112 5111
             $rows = DB::query(
5113 5112
                 'SELECT id
5114
-                FROM ' . prefixTable('categories_items') . '
5113
+                FROM ' . prefixTable('categories_items').'
5115 5114
                 WHERE item_id = %i',
5116 5115
                 $inputData['itemId']
5117 5116
             );
@@ -5128,7 +5127,7 @@  discard block
 block discarded – undo
5128 5127
             // Get FILES for this Item
5129 5128
             $rows = DB::query(
5130 5129
                 'SELECT id
5131
-                FROM ' . prefixTable('files') . '
5130
+                FROM ' . prefixTable('files').'
5132 5131
                 WHERE id_item = %i',
5133 5132
                 $inputData['itemId']
5134 5133
             );
@@ -5175,7 +5174,7 @@  discard block
 block discarded – undo
5175 5174
             // Get the ITEM object key for the user
5176 5175
             $userKey = DB::queryFirstRow(
5177 5176
                 'SELECT share_key
5178
-                FROM ' . prefixTable('sharekeys_items') . '
5177
+                FROM ' . prefixTable('sharekeys_items').'
5179 5178
                 WHERE user_id = %i AND object_id = %i',
5180 5179
                 $session->get('user-id'),
5181 5180
                 $inputData['itemId']
@@ -5186,7 +5185,7 @@  discard block
 block discarded – undo
5186 5185
                 // This is a public object
5187 5186
                 $users = DB::query(
5188 5187
                     'SELECT id, public_key
5189
-                    FROM ' . prefixTable('users') . '
5188
+                    FROM ' . prefixTable('users').'
5190 5189
                     WHERE id NOT IN %li
5191 5190
                     AND public_key != ""',
5192 5191
                     $tpUsersIDs
@@ -5209,14 +5208,14 @@  discard block
 block discarded – undo
5209 5208
             // Get fields for this Item
5210 5209
             $rows = DB::query(
5211 5210
                 'SELECT id
5212
-                FROM ' . prefixTable('categories_items') . '
5211
+                FROM ' . prefixTable('categories_items').'
5213 5212
                 WHERE item_id = %i',
5214 5213
                 $inputData['itemId']
5215 5214
             );
5216 5215
             foreach ($rows as $field) {
5217 5216
                 $userKey = DB::queryFirstRow(
5218 5217
                     'SELECT share_key
5219
-                    FROM ' . prefixTable('sharekeys_fields') . '
5218
+                    FROM ' . prefixTable('sharekeys_fields').'
5220 5219
                     WHERE user_id = %i AND object_id = %i',
5221 5220
                     $session->get('user-id'),
5222 5221
                     $field['id']
@@ -5227,7 +5226,7 @@  discard block
 block discarded – undo
5227 5226
                     // This is a public object
5228 5227
                     $users = DB::query(
5229 5228
                         'SELECT id, public_key
5230
-                        FROM ' . prefixTable('users') . '
5229
+                        FROM ' . prefixTable('users').'
5231 5230
                         WHERE id NOT IN %li
5232 5231
                         AND public_key != ""',
5233 5232
                         $tpUsersIDs
@@ -5250,14 +5249,14 @@  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
             );
5257 5256
             foreach ($rows as $attachment) {
5258 5257
                 $userKey = DB::queryFirstRow(
5259 5258
                     'SELECT share_key
5260
-                    FROM ' . prefixTable('sharekeys_files') . '
5259
+                    FROM ' . prefixTable('sharekeys_files').'
5261 5260
                     WHERE user_id = %i AND object_id = %i',
5262 5261
                     $session->get('user-id'),
5263 5262
                     $attachment['id']
@@ -5268,7 +5267,7 @@  discard block
 block discarded – undo
5268 5267
                     // This is a public object
5269 5268
                     $users = DB::query(
5270 5269
                         'SELECT id, public_key
5271
-                        FROM ' . prefixTable('users') . '
5270
+                        FROM ' . prefixTable('users').'
5272 5271
                         WHERE id NOT IN %li
5273 5272
                         AND public_key != ""',
5274 5273
                         $tpUsersIDs
@@ -5309,7 +5308,7 @@  discard block
 block discarded – undo
5309 5308
             $session->get('user-id'),
5310 5309
             'at_modification',
5311 5310
             $session->get('user-login'),
5312
-            'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5311
+            'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5313 5312
         );
5314 5313
 
5315 5314
         // Update cache table
@@ -5368,8 +5367,8 @@  discard block
 block discarded – undo
5368 5367
                 // get data about item
5369 5368
                 $dataSource = DB::queryFirstRow(
5370 5369
                     'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label
5371
-                    FROM ' . prefixTable('items') . ' as i
5372
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id)
5370
+                    FROM ' . prefixTable('items').' as i
5371
+                    INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id)
5373 5372
                     WHERE i.id=%i',
5374 5373
                     $item_id
5375 5374
                 );
@@ -5391,7 +5390,7 @@  discard block
 block discarded – undo
5391 5390
 
5392 5391
                 // get data about new folder
5393 5392
                 $dataDestination = DB::queryFirstRow(
5394
-                    'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
5393
+                    'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i',
5395 5394
                     $inputData['folderId']
5396 5395
                 );
5397 5396
 
@@ -5425,14 +5424,14 @@  discard block
 block discarded – undo
5425 5424
                         prefixTable('sharekeys_items'),
5426 5425
                         'object_id = %i AND user_id NOT IN %ls',
5427 5426
                         $item_id,
5428
-                        [$session->get('user-id'), TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
5427
+                        [$session->get('user-id'), TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
5429 5428
                     );
5430 5429
 
5431 5430
                     // Remove all item sharekeys fields
5432 5431
                     // Get fields for this Item
5433 5432
                     $rows = DB::query(
5434 5433
                         'SELECT id
5435
-                        FROM ' . prefixTable('categories_items') . '
5434
+                        FROM ' . prefixTable('categories_items').'
5436 5435
                         WHERE item_id = %i',
5437 5436
                         $item_id
5438 5437
                     );
@@ -5449,7 +5448,7 @@  discard block
 block discarded – undo
5449 5448
                     // Get FILES for this Item
5450 5449
                     $rows = DB::query(
5451 5450
                         'SELECT id
5452
-                        FROM ' . prefixTable('files') . '
5451
+                        FROM ' . prefixTable('files').'
5453 5452
                         WHERE id_item = %i',
5454 5453
                         $item_id
5455 5454
                     );
@@ -5504,7 +5503,7 @@  discard block
 block discarded – undo
5504 5503
                     // Get the ITEM object key for the user
5505 5504
                     $userKey = DB::queryFirstRow(
5506 5505
                         'SELECT share_key
5507
-                        FROM ' . prefixTable('sharekeys_items') . '
5506
+                        FROM ' . prefixTable('sharekeys_items').'
5508 5507
                         WHERE user_id = %i AND object_id = %i',
5509 5508
                         $session->get('user-id'),
5510 5509
                         $item_id
@@ -5515,7 +5514,7 @@  discard block
 block discarded – undo
5515 5514
                         // This is a public object
5516 5515
                         $users = DB::query(
5517 5516
                             'SELECT id, public_key
5518
-                            FROM ' . prefixTable('users') . '
5517
+                            FROM ' . prefixTable('users').'
5519 5518
                             WHERE id NOT IN %li
5520 5519
                             AND public_key != ""',
5521 5520
                             $tpUsersIDs
@@ -5538,14 +5537,14 @@  discard block
 block discarded – undo
5538 5537
                     // Get fields for this Item
5539 5538
                     $rows = DB::query(
5540 5539
                         'SELECT id
5541
-                        FROM ' . prefixTable('categories_items') . '
5540
+                        FROM ' . prefixTable('categories_items').'
5542 5541
                         WHERE item_id = %i',
5543 5542
                         $item_id
5544 5543
                     );
5545 5544
                     foreach ($rows as $field) {
5546 5545
                         $userKey = DB::queryFirstRow(
5547 5546
                             'SELECT share_key
5548
-                            FROM ' . prefixTable('sharekeys_fields') . '
5547
+                            FROM ' . prefixTable('sharekeys_fields').'
5549 5548
                             WHERE user_id = %i AND object_id = %i',
5550 5549
                             $session->get('user-id'),
5551 5550
                             $field['id']
@@ -5556,7 +5555,7 @@  discard block
 block discarded – undo
5556 5555
                             // This is a public object
5557 5556
                             $users = DB::query(
5558 5557
                                 'SELECT id, public_key
5559
-                                FROM ' . prefixTable('users') . '
5558
+                                FROM ' . prefixTable('users').'
5560 5559
                                 WHERE id NOT IN %li
5561 5560
                                 AND public_key != ""',
5562 5561
                                 $tpUsersIDs
@@ -5580,14 +5579,14 @@  discard block
 block discarded – undo
5580 5579
                     // Get FILES for this Item
5581 5580
                     $rows = DB::query(
5582 5581
                         'SELECT id
5583
-                        FROM ' . prefixTable('files') . '
5582
+                        FROM ' . prefixTable('files').'
5584 5583
                         WHERE id_item = %i',
5585 5584
                         $item_id
5586 5585
                     );
5587 5586
                     foreach ($rows as $attachment) {
5588 5587
                         $userKey = DB::queryFirstRow(
5589 5588
                             'SELECT share_key
5590
-                            FROM ' . prefixTable('sharekeys_files') . '
5589
+                            FROM ' . prefixTable('sharekeys_files').'
5591 5590
                             WHERE user_id = %i AND object_id = %i',
5592 5591
                             $session->get('user-id'),
5593 5592
                             $attachment['id']
@@ -5598,7 +5597,7 @@  discard block
 block discarded – undo
5598 5597
                             // This is a public object
5599 5598
                             $users = DB::query(
5600 5599
                                 'SELECT id, public_key
5601
-                                FROM ' . prefixTable('users') . '
5600
+                                FROM ' . prefixTable('users').'
5602 5601
                                 WHERE id NOT IN %li
5603 5602
                                 AND public_key != ""',
5604 5603
                                 $tpUsersIDs
@@ -5638,13 +5637,13 @@  discard block
 block discarded – undo
5638 5637
                     $session->get('user-id'),
5639 5638
                     'at_modification',
5640 5639
                     $session->get('user-login'),
5641
-                    'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title']
5640
+                    'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title']
5642 5641
                 );
5643 5642
             }
5644 5643
         }
5645 5644
 
5646 5645
         // reload cache table
5647
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
5646
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
5648 5647
         updateCacheTable('reload', null);
5649 5648
 
5650 5649
         echo (string) prepareExchangedData(
@@ -5708,7 +5707,7 @@  discard block
 block discarded – undo
5708 5707
                 // get info
5709 5708
                 $dataSource = DB::queryFirstRow(
5710 5709
                     'SELECT label, id_tree
5711
-                    FROM ' . prefixTable('items') . '
5710
+                    FROM ' . prefixTable('items').'
5712 5711
                     WHERE id=%i',
5713 5712
                     $item_id
5714 5713
                 );
@@ -5809,14 +5808,14 @@  discard block
 block discarded – undo
5809 5808
             // Variables
5810 5809
             $dataAuthor = DB::queryFirstRow(
5811 5810
                 'SELECT email,login
5812
-                FROM ' . prefixTable('users') . '
5811
+                FROM ' . prefixTable('users').'
5813 5812
                 WHERE id = %i',
5814 5813
                 $post_content[1]
5815 5814
             );
5816 5815
 
5817 5816
             $dataItem = DB::queryFirstRow(
5818 5817
                 'SELECT label, id_tree
5819
-                FROM ' . prefixTable('items') . '
5818
+                FROM ' . prefixTable('items').'
5820 5819
                 WHERE id = %i',
5821 5820
                 $post_content[0]
5822 5821
             );
@@ -5833,7 +5832,7 @@  discard block
 block discarded – undo
5833 5832
                 $lang->get('email_request_access_subject'),
5834 5833
                 str_replace(
5835 5834
                     array('#tp_item_author#', '#tp_user#', '#tp_item#'),
5836
-                    array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5835
+                    array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path),
5837 5836
                     $lang->get('email_request_access_mail')
5838 5837
                 ),
5839 5838
                 $dataAuthor['email'],
@@ -5842,7 +5841,7 @@  discard block
 block discarded – undo
5842 5841
         } elseif ($inputData['cat'] === 'share_this_item') {
5843 5842
             $dataItem = DB::queryFirstRow(
5844 5843
                 'SELECT label,id_tree
5845
-                FROM ' . prefixTable('items') . '
5844
+                FROM ' . prefixTable('items').'
5846 5845
                 WHERE id= %i',
5847 5846
                 $inputData['id']
5848 5847
             );
@@ -5865,7 +5864,7 @@  discard block
 block discarded – undo
5865 5864
                     ),
5866 5865
                     array(
5867 5866
                         empty($SETTINGS['email_server_url']) === false ?
5868
-                            $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'],
5867
+                            $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'],
5869 5868
                         addslashes($session->get('user-login')),
5870 5869
                         addslashes($path),
5871 5870
                     ),
@@ -5914,8 +5913,8 @@  discard block
 block discarded – undo
5914 5913
         // Get all informations for this item
5915 5914
         $dataItem = DB::queryFirstRow(
5916 5915
             'SELECT *
5917
-            FROM ' . prefixTable('items') . ' as i
5918
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
5916
+            FROM ' . prefixTable('items').' as i
5917
+            INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
5919 5918
             WHERE i.id=%i AND l.action = %s',
5920 5919
             $item_id,
5921 5920
             'at_creation'
@@ -5944,18 +5943,18 @@  discard block
 block discarded – undo
5944 5943
                 $session->get('user-login'),
5945 5944
                 htmlspecialchars_decode($label, ENT_QUOTES),
5946 5945
                 null,
5947
-                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'])
5946
+                (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format'])
5948 5947
             );
5949 5948
             // Prepare new line
5950 5949
             $data = DB::queryFirstRow(
5951
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC',
5950
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC',
5952 5951
                 $item_id
5953 5952
             );
5954
-            $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison'];
5953
+            $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison'];
5955 5954
             // send back
5956 5955
             $data = array(
5957 5956
                 'error' => '',
5958
-                'new_line' => '<br>' . addslashes($historic),
5957
+                'new_line' => '<br>'.addslashes($historic),
5959 5958
             );
5960 5959
             echo (string) prepareExchangedData(
5961 5960
                 $data,
@@ -6030,8 +6029,8 @@  discard block
 block discarded – undo
6030 6029
         // Should we log a password change?
6031 6030
         $itemQ = DB::queryFirstRow(
6032 6031
             'SELECT s.share_key, i.pw
6033
-            FROM ' . prefixTable('items') . ' AS i
6034
-            INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id)
6032
+            FROM ' . prefixTable('items').' AS i
6033
+            INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id)
6035 6034
             WHERE s.user_id = %i AND s.object_id = %i',
6036 6035
             $session->get('user-id'),
6037 6036
             $dataReceived['id']
@@ -6086,7 +6085,7 @@  discard block
 block discarded – undo
6086 6085
         if (isset($SETTINGS['otv_expiration_period']) === false) {
6087 6086
             $SETTINGS['otv_expiration_period'] = 7;
6088 6087
         }
6089
-        $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session);
6088
+        $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6090 6089
 
6091 6090
         echo json_encode(
6092 6091
             array(
@@ -6117,7 +6116,7 @@  discard block
 block discarded – undo
6117 6116
         // get parameters from original link
6118 6117
         $url = $dataReceived['original_link'];
6119 6118
         $parts = parse_url($url);
6120
-        if(isset($parts['query'])){
6119
+        if (isset($parts['query'])) {
6121 6120
             parse_str($parts['query'], $orignal_link_parameters);
6122 6121
         } else {
6123 6122
             $orignal_link_parameters = array();
@@ -6148,13 +6147,13 @@  discard block
 block discarded – undo
6148 6147
             $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME);
6149 6148
             $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST);
6150 6149
             if (str_contains($domain_host, 'www.') === true) {
6151
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4);
6150
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4);
6152 6151
             } else {
6153
-                $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host;
6152
+                $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host;
6154 6153
             }
6155
-            $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session);
6154
+            $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session);
6156 6155
         } else {
6157
-            $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session);
6156
+            $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session);
6158 6157
         }
6159 6158
 
6160 6159
         echo (string) prepareExchangedData(
@@ -6189,8 +6188,8 @@  discard block
 block discarded – undo
6189 6188
             'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status,
6190 6189
             f.extension AS extension, f.type AS type,
6191 6190
             s.share_key AS share_key
6192
-            FROM ' . prefixTable('files') . ' AS f
6193
-            INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id)
6191
+            FROM ' . prefixTable('files').' AS f
6192
+            INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id)
6194 6193
             WHERE s.user_id = %i AND s.object_id = %i',
6195 6194
             $session->get('user-id'),
6196 6195
             $inputData['id']
@@ -6211,7 +6210,7 @@  discard block
 block discarded – undo
6211 6210
         //$fileName = basename($file_info['name'], '.'.$file_info['extension']);
6212 6211
 
6213 6212
         // prepare image info
6214
-        $post_title = basename($file_info['name'], '.' . $file_info['extension']);
6213
+        $post_title = basename($file_info['name'], '.'.$file_info['extension']);
6215 6214
         $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title;
6216 6215
         
6217 6216
         // Get image content
@@ -6238,7 +6237,7 @@  discard block
 block discarded – undo
6238 6237
         echo (string) prepareExchangedData(
6239 6238
             array(
6240 6239
                 'error' => false,
6241
-                'filename' => $post_title . '.' . $file_info['extension'],
6240
+                'filename' => $post_title.'.'.$file_info['extension'],
6242 6241
                 'file_type' => $file_info['type'],
6243 6242
                 'file_content' => $fileContent,
6244 6243
             ),
@@ -6350,7 +6349,7 @@  discard block
 block discarded – undo
6350 6349
                     $arbo = $tree->getPath($folder->id, false);
6351 6350
                     $path = '';
6352 6351
                     foreach ($arbo as $elem) {
6353
-                        $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6352
+                        $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
6354 6353
                     }
6355 6354
 
6356 6355
                     // Build array
@@ -6417,7 +6416,7 @@  discard block
 block discarded – undo
6417 6416
         if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') {
6418 6417
             $rows = DB::query(
6419 6418
                 'SELECT id, categories
6420
-                FROM ' . prefixTable('nested_tree') . '
6419
+                FROM ' . prefixTable('nested_tree').'
6421 6420
                 WHERE id IN (%l)',
6422 6421
                 implode(',', $foldersArray)
6423 6422
             );
@@ -6435,7 +6434,7 @@  discard block
 block discarded – undo
6435 6434
             if (count($ids) > 0) {
6436 6435
                 $subfolders = DB::queryFirstColumn(
6437 6436
                     'SELECT title
6438
-                    FROM ' . prefixTable('nested_tree') . '
6437
+                    FROM ' . prefixTable('nested_tree').'
6439 6438
                     WHERE id IN %li',
6440 6439
                     $ids
6441 6440
                 );
@@ -6471,7 +6470,7 @@  discard block
 block discarded – undo
6471 6470
         // get item info
6472 6471
         $dataItem = DB::queryFirstRow(
6473 6472
             'SELECT *
6474
-            FROM ' . prefixTable('items') . '
6473
+            FROM ' . prefixTable('items').'
6475 6474
             WHERE id=%i',
6476 6475
             $inputData['itemId']
6477 6476
         );
@@ -6483,8 +6482,8 @@  discard block
 block discarded – undo
6483 6482
             'SELECT l.date as date, l.action as action, l.raison as raison,
6484 6483
                 u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname,
6485 6484
                 l.old_value as old_value
6486
-            FROM ' . prefixTable('log_items') . ' as l
6487
-            INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
6485
+            FROM ' . prefixTable('log_items').' as l
6486
+            INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
6488 6487
             WHERE id_item=%i AND l.action NOT IN (%l)
6489 6488
             ORDER BY date DESC',
6490 6489
             $inputData['itemId'],
@@ -6499,18 +6498,18 @@  discard block
 block discarded – undo
6499 6498
             
6500 6499
             // imported via API
6501 6500
             if (empty($record['login']) === true) {
6502
-                $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']';
6501
+                $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']';
6503 6502
             }
6504 6503
             
6505 6504
             // Prepare avatar
6506 6505
             if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) {
6507
-                if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) {
6508
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'];
6506
+                if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) {
6507
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb'];
6509 6508
                 } else {
6510
-                    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6509
+                    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6511 6510
                 }
6512 6511
             } else {
6513
-                $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
6512
+                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
6514 6513
             }
6515 6514
 
6516 6515
             // Prepare action
@@ -6530,7 +6529,7 @@  discard block
 block discarded – undo
6530 6529
                         $previous_passwords, 
6531 6530
                         [
6532 6531
                             'password' => htmlentities($previous_pwd['string']),
6533
-                            'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6532
+                            'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6534 6533
                         ]
6535 6534
                     );
6536 6535
                 }
@@ -6543,19 +6542,19 @@  discard block
 block discarded – undo
6543 6542
                 $action = $lang->get($reason[0]);
6544 6543
                 if ($reason[0] === 'at_moved') {
6545 6544
                     $tmp = explode(' -> ', $reason[1]);
6546
-                    $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>';
6545
+                    $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>';
6547 6546
                 } elseif ($reason[0] === 'at_field') {
6548 6547
                     $tmp = explode(' => ', $reason[1]);
6549 6548
                     if (count($tmp) > 1) {
6550
-                        $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') .
6551
-                            ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>';
6549
+                        $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value').
6550
+                            ': <span class="font-weight-light">'.trim($tmp[1]).'</span>';
6552 6551
                     } else {
6553 6552
                         $detail = trim($reason[1]);
6554 6553
                     }
6555 6554
                 } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) {
6556 6555
                     $tmp = explode(' => ', $reason[1]);
6557 6556
                     $detail = empty(trim($tmp[0])) === true ?
6558
-                        $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>';
6557
+                        $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>';
6559 6558
                 } elseif ($reason[0] === 'at_automatic_del') {
6560 6559
                     $detail = $lang->get($reason[1]);
6561 6560
                 } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status' || $reason[0] === 'at_otp_secret' || $reason[0] === 'at_phone_number') {
@@ -6564,7 +6563,7 @@  discard block
 block discarded – undo
6564 6563
                     $tmp = explode(':', $reason[1]);
6565 6564
                     $tmp = explode('.', $tmp[0]);
6566 6565
                     $detail = isBase64($tmp[0]) === true ?
6567
-                        base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0];
6566
+                        base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0];
6568 6567
                 } elseif ($reason[0] === 'at_import') {
6569 6568
                     $detail = '';
6570 6569
                 } elseif (in_array($reason[0], array('csv', 'pdf')) === true) {
@@ -6583,8 +6582,8 @@  discard block
 block discarded – undo
6583 6582
                 array(
6584 6583
                     'avatar' => $avatar,
6585 6584
                     'login' => $record['login'],
6586
-                    'name' => $record['name'] . ' ' . $record['lastname'],
6587
-                    'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']),
6585
+                    'name' => $record['name'].' '.$record['lastname'],
6586
+                    'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']),
6588 6587
                     'action' => $action,
6589 6588
                     'detail' => $detail,
6590 6589
                 )
@@ -6672,11 +6671,11 @@  discard block
 block discarded – undo
6672 6671
 
6673 6672
         // get some info to add to the notification email
6674 6673
         $resp_user = DB::queryFirstRow(
6675
-            'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
6674
+            'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
6676 6675
             $session->get('user-id')
6677 6676
         );
6678 6677
         $resp_folder = DB::queryFirstRow(
6679
-            'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
6678
+            'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i',
6680 6679
             $folder
6681 6680
         );
6682 6681
 
@@ -6685,7 +6684,7 @@  discard block
 block discarded – undo
6685 6684
         $emailService = new EmailService();
6686 6685
         $rows = DB::query(
6687 6686
             'SELECT email
6688
-            FROM ' . prefixTable('users') . '
6687
+            FROM ' . prefixTable('users').'
6689 6688
             WHERE `gestionnaire` = %i AND `email` IS NOT NULL',
6690 6689
             1
6691 6690
         );
@@ -6731,7 +6730,7 @@  discard block
 block discarded – undo
6731 6730
         // Send email
6732 6731
         $dataItem = DB::queryFirstRow(
6733 6732
             'SELECT label, id_tree
6734
-            FROM ' . prefixTable('items') . '
6733
+            FROM ' . prefixTable('items').'
6735 6734
             WHERE id = %i',
6736 6735
             $inputData['itemId']
6737 6736
         );
@@ -6785,7 +6784,7 @@  discard block
 block discarded – undo
6785 6784
 
6786 6785
         DB::query(
6787 6786
             'SELECT *
6788
-            FROM ' . prefixTable('notification') . '
6787
+            FROM ' . prefixTable('notification').'
6789 6788
             WHERE item_id = %i AND user_id = %i',
6790 6789
             $inputData['itemId'],
6791 6790
             $session->get('user-id')
@@ -6857,7 +6856,7 @@  discard block
 block discarded – undo
6857 6856
         // And related logs
6858 6857
         $rows = DB::query(
6859 6858
             'SELECT id, file AS filename
6860
-            FROM ' . prefixTable('files') . '
6859
+            FROM ' . prefixTable('files').'
6861 6860
             WHERE id_item = %i AND confirmed = %i',
6862 6861
             $inputData['itemId'],
6863 6862
             0
@@ -6871,12 +6870,12 @@  discard block
 block discarded – undo
6871 6870
             );
6872 6871
 
6873 6872
             // Delete file on server
6874
-            unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename']));
6873
+            unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename']));
6875 6874
 
6876 6875
             // Delete related logs
6877 6876
             $logFile = DB::query(
6878 6877
                 'SELECT increment_id, raison
6879
-                FROM ' . prefixTable('log_items') . '
6878
+                FROM ' . prefixTable('log_items').'
6880 6879
                 WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"',
6881 6880
                 $inputData['itemId'],
6882 6881
                 $session->get('user-id'),
@@ -6935,7 +6934,7 @@  discard block
 block discarded – undo
6935 6934
         // Confirm attachments
6936 6935
         $rows = DB::query(
6937 6936
             'SELECT id, file AS filename
6938
-            FROM ' . prefixTable('files') . '
6937
+            FROM ' . prefixTable('files').'
6939 6938
             WHERE id_item = %i AND confirmed = %i',
6940 6939
             $inputData['itemId'],
6941 6940
             0
@@ -7051,7 +7050,7 @@  discard block
 block discarded – undo
7051 7050
             $successfulDeletions = array();
7052 7051
             $failedDeletions = array();
7053 7052
 
7054
-            foreach( $selectedItemIds as $itemId) {
7053
+            foreach ($selectedItemIds as $itemId) {
7055 7054
                 // Check that user can access this item
7056 7055
                 $granted = accessToItemIsGranted((int) $itemId, $SETTINGS);
7057 7056
                 if ($granted !== true) {
@@ -7062,7 +7061,7 @@  discard block
 block discarded – undo
7062 7061
                 // Load item data
7063 7062
                 $data = DB::queryFirstRow(
7064 7063
                     'SELECT id_tree, id, label
7065
-                    FROM ' . prefixTable('items') . '
7064
+                    FROM ' . prefixTable('items').'
7066 7065
                     WHERE id = %i',
7067 7066
                     $itemId
7068 7067
                 );
@@ -7145,15 +7144,15 @@  discard block
 block discarded – undo
7145 7144
         case 'autocomplete_tags':
7146 7145
             // Get a list off all existing TAGS
7147 7146
             $listOfTags = '';
7148
-            $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7147
+            $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']);
7149 7148
             foreach ($rows as $record) {
7150 7149
                 if (empty($listOfTags)) {
7151
-                    $listOfTags = '"' . $record['tag'] . '"';
7150
+                    $listOfTags = '"'.$record['tag'].'"';
7152 7151
                 } else {
7153
-                    $listOfTags .= ', "' . $record['tag'] . '"';
7152
+                    $listOfTags .= ', "'.$record['tag'].'"';
7154 7153
                 }
7155 7154
             }
7156
-            echo '[' . $listOfTags . ']';
7155
+            echo '['.$listOfTags.']';
7157 7156
             break;
7158 7157
     }
7159 7158
 }
@@ -7169,7 +7168,7 @@  discard block
 block discarded – undo
7169 7168
 {
7170 7169
     $data = DB::queryFirstRow(
7171 7170
         'SELECT bloquer_creation, bloquer_modification, personal_folder
7172
-        FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
7171
+        FROM ' . prefixTable('nested_tree').' WHERE id = %i',
7173 7172
         $groupe
7174 7173
     );
7175 7174
     // Check if it's in a personal folder. If yes, then force complexity overhead.
@@ -7289,7 +7288,7 @@  discard block
 block discarded – undo
7289 7288
     // Get item date
7290 7289
     $itemRestrictedUsersList = DB::queryFirstRow(
7291 7290
         'SELECT restricted_to
7292
-         FROM ' . prefixTable('items') . '
7291
+         FROM ' . prefixTable('items').'
7293 7292
          WHERE id = %i',
7294 7293
         $itemId
7295 7294
     );
@@ -7322,7 +7321,7 @@  discard block
 block discarded – undo
7322 7321
     $now = time();
7323 7322
     $editionLocks = DB::query(
7324 7323
         'SELECT timestamp, user_id, increment_id
7325
-         FROM ' . prefixTable('items_edition') . '
7324
+         FROM ' . prefixTable('items_edition').'
7326 7325
          WHERE item_id = %i 
7327 7326
          ORDER BY increment_id DESC',
7328 7327
         $itemId
@@ -7368,7 +7367,7 @@  discard block
 block discarded – undo
7368 7367
 
7369 7368
         // Delete related background tasks if any
7370 7369
         $task = DB::queryFirstRow(
7371
-            'SELECT increment_id FROM ' . prefixTable('background_tasks') . '
7370
+            'SELECT increment_id FROM '.prefixTable('background_tasks').'
7372 7371
              WHERE item_id = %i AND finished_at = ""',
7373 7372
             $itemId
7374 7373
         );
@@ -7381,7 +7380,7 @@  discard block
 block discarded – undo
7381 7380
         // Check if encryption process is still running
7382 7381
         DB::queryFirstRow(
7383 7382
             'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id
7384
-             FROM ' . prefixTable('background_tasks') . '
7383
+             FROM ' . prefixTable('background_tasks').'
7385 7384
              WHERE item_id = %i AND finished_at = ""
7386 7385
              ORDER BY increment_id DESC',
7387 7386
             $itemId
@@ -7402,7 +7401,7 @@  discard block
 block discarded – undo
7402 7401
         }
7403 7402
 
7404 7403
         return [
7405
-            'status' => true,   // Encryption in progress
7404
+            'status' => true, // Encryption in progress
7406 7405
             'delay' => $delay - $elapsed, // Time remaining before the lock expires
7407 7406
         ];
7408 7407
     }
@@ -7447,7 +7446,7 @@  discard block
 block discarded – undo
7447 7446
 {
7448 7447
     // Check if there's an ongoing background encryption process for the item
7449 7448
     $ongoingProcess = DB::queryFirstRow(
7450
-        'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7449
+        'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', 
7451 7450
         $itemId
7452 7451
     );
7453 7452
 
@@ -7465,7 +7464,7 @@  discard block
 block discarded – undo
7465 7464
 function getUserVisibleFolders(int $userId): array
7466 7465
 {
7467 7466
     // Query to retrieve visible folders for the user
7468
-    $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId);
7467
+    $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId);
7469 7468
     
7470 7469
     // Decode JSON data into an array; return an empty array if the data is invalid
7471 7470
     return json_decode($data['visible_folders'], true) ?? [];
@@ -7489,7 +7488,7 @@  discard block
 block discarded – undo
7489 7488
 
7490 7489
     // Query the access rights for the given roles and folder
7491 7490
     $accessTypes = DB::queryFirstColumn(
7492
-        'SELECT DISTINCT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', 
7491
+        'SELECT DISTINCT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', 
7493 7492
         $roles, 
7494 7493
         $treeId
7495 7494
     );
Please login to merge, or discard this patch.
sources/identify.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     $sessionPwdAttempts = $session->get('pwd_attempts');
148 148
     $sessionUrl = $session->get('user-initial_url');
149 149
     $server = [];
150
-    $server['PHP_AUTH_USER'] =  $request->getUser();
150
+    $server['PHP_AUTH_USER'] = $request->getUser();
151 151
     $server['PHP_AUTH_PW'] = $request->getPassword();
152 152
     
153 153
     // decrypt and retreive data in JSON format
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
     }
168 168
 
169 169
     // Check if Duo auth is in progress and pass the pw and login back to the standard login process
170
-    if(
170
+    if (
171 171
         isKeyExistingAndEqual('duo', 1, $SETTINGS) === true
172 172
         && $dataReceived['user_2fa_selection'] === 'duo'
173 173
         && $session->get('user-duo_status') === 'IN_PROGRESS'
174 174
         && !empty($dataReceived['duo_state'])
175
-    ){
175
+    ) {
176 176
         $key = hash('sha256', $dataReceived['duo_state']);
177 177
         $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16);
178 178
         $duo_data_dec = openssl_decrypt(base64_decode($session->get('user-duo_data')), 'AES-256-CBC', $key, 0, $iv);
179 179
         // Clear the data from the Duo process to continue clean with the standard login process
180
-        $session->set('user-duo_data','');
181
-        if($duo_data_dec === false) {
180
+        $session->set('user-duo_data', '');
181
+        if ($duo_data_dec === false) {
182 182
             // Add failed authentication log
183 183
             addFailedAuthentication(filter_var($dataReceived['login'], FILTER_SANITIZE_FULL_SPECIAL_CHARS), getClientIpServer());
184 184
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $dataReceived['login'] = $duo_data['duo_login'];
197 197
     }
198 198
 
199
-    if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
199
+    if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) {
200 200
         echo json_encode([
201 201
             'data' => prepareExchangedData(
202 202
                 [
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         }
560 560
         // Append with roles from AD groups
561 561
         if (is_null($userInfo['roles_from_ad_groups']) === false) {
562
-            $userInfo['fonction_id'] = empty($userInfo['fonction_id'])  === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups'];
562
+            $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups'];
563 563
         }
564 564
         // store
565 565
         $session->set('user-roles', $userInfo['fonction_id']);
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         if (count($session->get('user-roles_array')) > 0) {
572 572
             $rolesList = DB::query(
573 573
                 'SELECT id, title, complexity
574
-                FROM ' . prefixTable('roles_title') . '
574
+                FROM ' . prefixTable('roles_title').'
575 575
                 WHERE id IN %li',
576 576
                 $session->get('user-roles_array')
577 577
             );
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
             if ($adjustPermissions) {
618 618
                 $session->set('user-admin', (int) $userInfo['admin']);
619 619
                 $session->set('user-manager', (int) $userInfo['gestionnaire']);
620
-                $session->set('user-can_manage_all_users',(int)  $userInfo['can_manage_all_users']);
620
+                $session->set('user-can_manage_all_users', (int) $userInfo['can_manage_all_users']);
621 621
                 $session->set('user-read_only', (int) $userInfo['read_only']);
622 622
                 DB::update(
623 623
                     prefixTable('users'),
@@ -686,10 +686,10 @@  discard block
 block discarded – undo
686 686
         // Get last seen items
687 687
         $session->set('user-nb_roles', 0);
688 688
         foreach ($session->get('user-latest_items') as $item) {
689
-            if (! empty($item)) {
689
+            if (!empty($item)) {
690 690
                 $dataLastItems = DB::queryFirstRow(
691 691
                     'SELECT id,label,id_tree
692
-                    FROM ' . prefixTable('items') . '
692
+                    FROM ' . prefixTable('items').'
693 693
                     WHERE id=%i',
694 694
                     $item
695 695
                 );
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
         // Get cahce tree info
700 700
         $cacheTreeData = DB::queryFirstRow(
701 701
             'SELECT visible_folders
702
-            FROM ' . prefixTable('cache_tree') . '
702
+            FROM ' . prefixTable('cache_tree').'
703 703
             WHERE user_id=%i',
704 704
             (int) $session->get('user-id')
705 705
         );
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
             && (int) $sessionAdmin !== 1
732 732
         ) {
733 733
             // get all Admin users
734
-            $val = DB::queryFirstRow('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1);
734
+            $val = DB::queryFirstRow('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1);
735 735
             if (DB::count() > 0) {
736 736
                 // Add email to table
737 737
                 prepareSendingEmail(
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
                             '#tp_time#',
744 744
                         ],
745 745
                         [
746
-                            ' ' . $session->get('user-login') . ' (IP: ' . getClientIpServer() . ')',
746
+                            ' '.$session->get('user-login').' (IP: '.getClientIpServer().')',
747 747
                             date($SETTINGS['date_format'], (int) $session->get('user-last_connection')),
748 748
                             date($SETTINGS['time_format'], (int) $session->get('user-last_connection')),
749 749
                         ],
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 {
856 856
     $rows = DB::query(
857 857
         'SELECT date
858
-        FROM ' . prefixTable('log_system') . "
858
+        FROM ' . prefixTable('log_system')."
859 859
         WHERE field_1 = %s
860 860
         AND type = 'failed_auth'
861 861
         AND label = 'password_is_not_correct'
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
         foreach ($rows as $record) {
870 870
             array_push(
871 871
                 $arrAttempts,
872
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date'])
872
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date'])
873 873
             );
874 874
         }
875 875
     }
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
     $ldapConnection
905 905
 ) : bool
906 906
 {
907
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
907
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
908 908
 
909 909
     if ((int) $userInfoDisabled === 1) {
910 910
         return false;
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
         // If user has seed but no backup, create it on first successful login
993 993
         if (!empty($userInfo['user_derivation_seed']) && empty($userInfo['private_key_backup'])) {
994 994
             if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
995
-                error_log('TEAMPASS Transparent Recovery - Creating backup for user ' . ($userInfo['login'] ?? 'unknown'));
995
+                error_log('TEAMPASS Transparent Recovery - Creating backup for user '.($userInfo['login'] ?? 'unknown'));
996 996
             }
997 997
 
998 998
             $derivedKey = deriveBackupKey($userInfo['user_derivation_seed'], $userInfo['public_key'], $SETTINGS);
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
     } catch (Exception $e) {
1164 1164
         return [
1165 1165
             'error' => true,
1166
-            'message' => "Error: " . $e->getMessage(),
1166
+            'message' => "Error: ".$e->getMessage(),
1167 1167
         ];
1168 1168
     }
1169 1169
 }
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
                 'type' => 'OpenLDAP'
1195 1195
             ];
1196 1196
         default:
1197
-            throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
1197
+            throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
1198 1198
     }
1199 1199
 }
1200 1200
 
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
         );
1332 1332
     }
1333 1333
     
1334
-    throw new Exception("Unsupported LDAP type: " . $ldapHandler['type']);
1334
+    throw new Exception("Unsupported LDAP type: ".$ldapHandler['type']);
1335 1335
 }
1336 1336
 
1337 1337
 /**
@@ -1348,12 +1348,12 @@  discard block
 block discarded – undo
1348 1348
     if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1349 1349
         // Get user groups from AD
1350 1350
         $user_ad_groups = [];
1351
-        foreach($groups as $group) {
1351
+        foreach ($groups as $group) {
1352 1352
             //print_r($group);
1353 1353
             // get relation role id for AD group
1354 1354
             $role = DB::queryFirstRow(
1355 1355
                 'SELECT lgr.role_id
1356
-                FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr
1356
+                FROM ' . prefixTable('ldap_groups_roles').' AS lgr
1357 1357
                 WHERE lgr.ldap_group_id = %s',
1358 1358
                 $group
1359 1359
             );
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
     $passwordManager = new PasswordManager();
1417 1417
     
1418 1418
     // Migrate password if needed
1419
-    $result  = $passwordManager->migratePassword(
1419
+    $result = $passwordManager->migratePassword(
1420 1420
         $userInfo['pw'],
1421 1421
         $passwordClear,
1422 1422
         (int) $userInfo['id']
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
             // Check if exists in DB
1491 1491
             $groupData = DB::queryFirstRow(
1492 1492
                 'SELECT id
1493
-                FROM ' . prefixTable('roles_title') . '
1493
+                FROM ' . prefixTable('roles_title').'
1494 1494
                 WHERE title = %s',
1495 1495
                 $group["displayName"]
1496 1496
             );
@@ -1639,7 +1639,7 @@  discard block
 block discarded – undo
1639 1639
             
1640 1640
             // generate new QR
1641 1641
             $new_2fa_qr = $tfa->getQRCodeImageAsDataUri(
1642
-                'Teampass - ' . $username,
1642
+                'Teampass - '.$username,
1643 1643
                 $userInfo['ga']
1644 1644
             );
1645 1645
             // clear temporary code from DB
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
                 $userInfo['id']
1653 1653
             );
1654 1654
             $firstTime = [
1655
-                'value' => '<img src="' . $new_2fa_qr . '">',
1655
+                'value' => '<img src="'.$new_2fa_qr.'">',
1656 1656
                 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '',
1657 1657
                 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '',
1658 1658
                 'pwd_attempts' => (int) $sessionPwdAttempts,
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
         }*/
1809 1809
         return [
1810 1810
             'error' => true,
1811
-            'message' => $duo_error . $lang->get('duo_error_check_config'),
1811
+            'message' => $duo_error.$lang->get('duo_error_check_config'),
1812 1812
             'pwd_attempts' => (int) $sessionPwdAttempts,
1813 1813
             'debug_message' => $e->getMessage(),
1814 1814
             'proceedIdentification' => false,
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
         } catch (DuoException $e) {
1825 1825
             return [
1826 1826
                 'error' => true,
1827
-                'message' => $duo_error . $lang->get('duo_error_url'),
1827
+                'message' => $duo_error.$lang->get('duo_error_url'),
1828 1828
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1829 1829
                 'debug_message' => $e->getMessage(),
1830 1830
                 'proceedIdentification' => false,
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
         }
1833 1833
         
1834 1834
         // Somethimes Duo return success but fail to return a URL, double check if the URL has been created
1835
-        if (!empty($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) {
1835
+        if (!empty($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) {
1836 1836
             // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt
1837 1837
             $key = hash('sha256', $duo_state);
1838 1838
             $iv = substr(hash('sha256', $duo_state), 0, 16);
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
         } else {
1861 1861
             return [
1862 1862
                 'error' => true,
1863
-                'message' => $duo_error . $lang->get('duo_error_url'),
1863
+                'message' => $duo_error.$lang->get('duo_error_url'),
1864 1864
                 'pwd_attempts' => (int) $sessionPwdAttempts,
1865 1865
                 'proceedIdentification' => false,
1866 1866
             ];
@@ -1881,8 +1881,8 @@  discard block
 block discarded – undo
1881 1881
         // return the response (which should be the user name)
1882 1882
         if ($decoded_token['preferred_username'] === $username) {
1883 1883
             $session->set('user-duo_status', 'COMPLET');
1884
-            $session->set('user-duo_state','');
1885
-            $session->set('user-duo_data','');
1884
+            $session->set('user-duo_state', '');
1885
+            $session->set('user-duo_data', '');
1886 1886
             $session->set('user-login', $username);
1887 1887
 
1888 1888
             return [
@@ -1893,9 +1893,9 @@  discard block
 block discarded – undo
1893 1893
             ];
1894 1894
         } else {
1895 1895
             // Something wrong, username from the original Duo request is different than the one received now
1896
-            $session->set('user-duo_status','');
1897
-            $session->set('user-duo_state','');
1898
-            $session->set('user-duo_data','');
1896
+            $session->set('user-duo_status', '');
1897
+            $session->set('user-duo_state', '');
1898
+            $session->set('user-duo_data', '');
1899 1899
 
1900 1900
             return [
1901 1901
                 'error' => true,
@@ -1906,9 +1906,9 @@  discard block
 block discarded – undo
1906 1906
         }
1907 1907
     }
1908 1908
     // If we are here something wrong
1909
-    $session->set('user-duo_status','');
1910
-    $session->set('user-duo_state','');
1911
-    $session->set('user-duo_data','');
1909
+    $session->set('user-duo_status', '');
1910
+    $session->set('user-duo_state', '');
1911
+    $session->set('user-duo_data', '');
1912 1912
     return [
1913 1913
         'error' => true,
1914 1914
         'message' => $lang->get('duo_login_mismatch'),
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
         // Check for existing lock
2028 2028
         $unlock_at = DB::queryFirstField(
2029 2029
             'SELECT MAX(unlock_at)
2030
-             FROM ' . prefixTable('auth_failures') . '
2030
+             FROM ' . prefixTable('auth_failures').'
2031 2031
              WHERE unlock_at > %s
2032 2032
              AND ((source = %s AND value = %s) OR (source = %s AND value = %s))',
2033 2033
             date('Y-m-d H:i:s', time()),
@@ -2049,8 +2049,8 @@  discard block
 block discarded – undo
2049 2049
         // Get user info from DB
2050 2050
         $data = DB::queryFirstRow(
2051 2051
             'SELECT u.*, a.value AS api_key
2052
-            FROM ' . prefixTable('users') . ' AS u
2053
-            LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id)
2052
+            FROM ' . prefixTable('users').' AS u
2053
+            LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id)
2054 2054
             WHERE login = %s AND deleted_at IS NULL',
2055 2055
             $login
2056 2056
         );
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
             'array' => [
2169 2169
                 'value' => 'bruteforce_wait',
2170 2170
                 'error' => true,
2171
-                'message' => $lang->get('bruteforce_wait') . (string) $e->getMessage(),
2171
+                'message' => $lang->get('bruteforce_wait').(string) $e->getMessage(),
2172 2172
             ]
2173 2173
         ];
2174 2174
     }
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
     // Clean previous failed attempts
2274 2274
     $failedTasks = DB::query(
2275 2275
         'SELECT increment_id
2276
-        FROM ' . prefixTable('background_tasks') . '
2276
+        FROM ' . prefixTable('background_tasks').'
2277 2277
         WHERE process_type = %s
2278 2278
         AND JSON_EXTRACT(arguments, "$.new_user_id") = %i
2279 2279
         AND status = %s',
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
                         $userKeys['public_key']
2391 2391
                     );
2392 2392
                 }*/
2393
-                    error_log('Switch user ' . $username . ' auth_type to oauth2');
2393
+                    error_log('Switch user '.$username.' auth_type to oauth2');
2394 2394
                 // Update user in database:
2395 2395
                 DB::update(
2396 2396
                     prefixTable('users'),
@@ -2614,12 +2614,12 @@  discard block
 block discarded – undo
2614 2614
 {
2615 2615
     // Find the latest "create_user_keys" task for the given user_id
2616 2616
     $latestTask = DB::queryFirstRow(
2617
-        'SELECT arguments, status FROM ' . prefixTable('background_tasks') . '
2617
+        'SELECT arguments, status FROM '.prefixTable('background_tasks').'
2618 2618
         WHERE process_type = %s
2619 2619
         AND arguments LIKE %s
2620 2620
         ORDER BY increment_id DESC
2621 2621
         LIMIT 1',
2622
-        'create_user_keys', '%"new_user_id":' . $userId . '%'
2622
+        'create_user_keys', '%"new_user_id":'.$userId.'%'
2623 2623
     );
2624 2624
 
2625 2625
     // If a failed task is found, return an error message
@@ -2831,15 +2831,15 @@  discard block
 block discarded – undo
2831 2831
 
2832 2832
             if ($ret['error'] !== false) {
2833 2833
                 logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username));
2834
-                $session->set('user-duo_status','');
2835
-                $session->set('user-duo_state','');
2836
-                $session->set('user-duo_data','');
2834
+                $session->set('user-duo_status', '');
2835
+                $session->set('user-duo_state', '');
2836
+                $session->set('user-duo_data', '');
2837 2837
                 return [
2838 2838
                     'error' => true,
2839 2839
                     'mfaData' => $ret,
2840 2840
                     'mfaQRCodeInfos' => false,
2841 2841
                 ];
2842
-            } else if ($ret['duo_url_ready'] === true){
2842
+            } else if ($ret['duo_url_ready'] === true) {
2843 2843
                 return [
2844 2844
                     'error' => false,
2845 2845
                     'mfaData' => $ret,
@@ -2903,7 +2903,7 @@  discard block
 block discarded – undo
2903 2903
     // Count failed attempts from this source
2904 2904
     $count = DB::queryFirstField(
2905 2905
         'SELECT COUNT(*)
2906
-        FROM ' . prefixTable('auth_failures') . '
2906
+        FROM ' . prefixTable('auth_failures').'
2907 2907
         WHERE source = %s AND value = %s',
2908 2908
         $source,
2909 2909
         $value
Please login to merge, or discard this patch.
sources/tools.queries.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('tools') === false) {
71 71
     // Not allowed page
72 72
     $session->set('system-error_code', ERR_NOT_ALLOWED);
73
-    include $SETTINGS['cpassman_dir'] . '/error.php';
73
+    include $SETTINGS['cpassman_dir'].'/error.php';
74 74
     exit;
75 75
 }
76 76
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         // Get TP_USER info
336 336
         $userInfo = DB::queryFirstRow(
337 337
             'SELECT pw, public_key, private_key, login, name
338
-            FROM ' . prefixTable('users') . '
338
+            FROM ' . prefixTable('users').'
339 339
             WHERE id = %i',
340 340
             TP_USER_ID
341 341
         );
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
         // Get one itemKey from current user
373 373
         $currentUserKey = DB::queryFirstRow(
374 374
             'SELECT ski.share_key, ski.increment_id AS increment_id, l.id_user
375
-            FROM ' . prefixTable('sharekeys_items') . ' AS ski
376
-            INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
375
+            FROM ' . prefixTable('sharekeys_items').' AS ski
376
+            INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
377 377
             WHERE ski.user_id = %i
378 378
             ORDER BY RAND()
379 379
             LIMIT 1',
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                 echo  prepareExchangedData(
393 393
                     array(
394 394
                         'error' => true,
395
-                        'message' => 'No issue found, normal process should work. This process is now finished. (item id : ' . $currentUserKey['increment_id'] . ')',
395
+                        'message' => 'No issue found, normal process should work. This process is now finished. (item id : '.$currentUserKey['increment_id'].')',
396 396
                     ),
397 397
                     'encode'
398 398
                 );
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
         // Get user info
453 453
         $userInfo = DB::queryFirstRow(
454 454
             'SELECT public_key, private_key
455
-            FROM ' . prefixTable('users') . '
455
+            FROM ' . prefixTable('users').'
456 456
             WHERE id = %i',
457 457
             $userId
458 458
         );
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
         // Get one itemKey from current user
476 476
         $currentUserKey = DB::queryFirstRow(
477 477
             'SELECT ski.share_key, ski.increment_id AS increment_id, l.id_user
478
-            FROM ' . prefixTable('sharekeys_items') . ' AS ski
479
-            INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
478
+            FROM ' . prefixTable('sharekeys_items').' AS ski
479
+            INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
480 480
             WHERE ski.user_id = %i
481 481
             ORDER BY RAND()
482 482
             LIMIT 1',
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
                 // Get number of users to treat
515 515
                 DB::query(
516 516
                     'SELECT i.id 
517
-                    FROM ' . prefixTable('items') . ' AS i
518
-                    INNER JOIN ' . prefixTable('sharekeys_items') . ' AS si ON i.id = si.object_id
517
+                    FROM ' . prefixTable('items').' AS i
518
+                    INNER JOIN ' . prefixTable('sharekeys_items').' AS si ON i.id = si.object_id
519 519
                     WHERE i.perso = %i AND si.user_id = %i;',
520 520
                     0,
521 521
                     $userId
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
             // Loop on items
598 598
             $rows = DB::query(
599 599
                 'SELECT si.object_id AS object_id, si.share_key AS share_key, i.pw AS pw, si.increment_id as increment_id
600
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
601
-                INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = si.object_id)
600
+                FROM ' . prefixTable('sharekeys_items').' AS si
601
+                INNER JOIN ' . prefixTable('items').' AS i ON (i.id = si.object_id)
602 602
                 WHERE si.user_id = %i
603 603
                 ORDER BY si.increment_id ASC
604
-                LIMIT ' . $startIndex . ', ' . $limit,
604
+                LIMIT ' . $startIndex.', '.$limit,
605 605
                 $userId
606 606
             );        
607 607
             
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
                     // It will be updated if already exists
626 626
                     $currentTPUserKey = DB::queryFirstRow(
627 627
                         'SELECT increment_id, user_id, share_key
628
-                        FROM ' . prefixTable('sharekeys_items') . '
628
+                        FROM ' . prefixTable('sharekeys_items').'
629 629
                         WHERE object_id = %i AND user_id = %i',
630 630
                         $record['object_id'],
631 631
                         TP_USER_ID
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
             DB::commit();
662 662
         } catch (Exception $e) {
663 663
             DB::rollback();
664
-            error_log("Teampass - Error: Keys treatment: " . $e->getMessage());
664
+            error_log("Teampass - Error: Keys treatment: ".$e->getMessage());
665 665
         }
666 666
 
667 667
         $nextIndex = (int) $startIndex + (int) $limit;
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
             // Get PT_USER info
718 718
             DB::queryFirstRow(
719 719
                 'SELECT operation_code
720
-                FROM ' . prefixTable('sharekeys_backup') . '
720
+                FROM ' . prefixTable('sharekeys_backup').'
721 721
                 WHERE operation_code = %s',
722 722
                 $operationCode
723 723
             );
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
                 // using increment_id_value in order to update the correct record
728 728
                 $rows = DB::query(
729 729
                     'SELECT *
730
-                    FROM ' . prefixTable('sharekeys_backup') . '
730
+                    FROM ' . prefixTable('sharekeys_backup').'
731 731
                     WHERE operation_code = %s',
732 732
                     $operationCode
733 733
                 );
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 
747 747
                 // Delete all sharekeys for this operation
748 748
                 DB::query(
749
-                    'DELETE FROM ' . prefixTable('sharekeys_backup') . '
749
+                    'DELETE FROM '.prefixTable('sharekeys_backup').'
750 750
                     WHERE operation_code = %i',
751 751
                     $operationCode
752 752
                 );
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
             // Get operation info
810 810
             DB::query(
811 811
                 'SELECT operation_code
812
-                FROM ' . prefixTable('sharekeys_backup') . '
812
+                FROM ' . prefixTable('sharekeys_backup').'
813 813
                 WHERE operation_code = %s',
814 814
                 $operationCode
815 815
             );
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
             if ($nbKeys > 0) {
819 819
                 // Delete all sharekeys for this operation
820 820
                 DB::query(
821
-                    'DELETE FROM ' . prefixTable('sharekeys_backup') . '
821
+                    'DELETE FROM '.prefixTable('sharekeys_backup').'
822 822
                     WHERE operation_code = %s',
823 823
                     $operationCode
824 824
                 );
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +196 added lines, -198 removed lines patch added patch discarded remove patch
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
             $text = Crypto::decrypt($message, $key);
100 100
         }
101 101
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
102
-        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: ' . $ex->getMessage());
102
+        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: '.$ex->getMessage());
103 103
         $err = 'wrong_key_or_modified_ciphertext';
104 104
     } catch (CryptoException\BadFormatException $ex) {
105
-        error_log('TEAMPASS-Error-Bad format exception: ' . $ex->getMessage());
105
+        error_log('TEAMPASS-Error-Bad format exception: '.$ex->getMessage());
106 106
         $err = 'bad_format';
107 107
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
108
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
108
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
109 109
         $err = 'environment_error';
110 110
     } catch (CryptoException\IOException $ex) {
111
-        error_log('TEAMPASS-Error-IO: ' . $ex->getMessage());
111
+        error_log('TEAMPASS-Error-IO: '.$ex->getMessage());
112 112
         $err = 'io_error';
113 113
     } catch (Exception $ex) {
114
-        error_log('TEAMPASS-Error-Unexpected exception: ' . $ex->getMessage());
114
+        error_log('TEAMPASS-Error-Unexpected exception: '.$ex->getMessage());
115 115
         $err = 'unexpected_error';
116 116
     }
117 117
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function trimElement($chaine, string $element): string
198 198
 {
199
-    if (! empty($chaine)) {
199
+    if (!empty($chaine)) {
200 200
         if (is_array($chaine) === true) {
201 201
             $chaine = implode(';', $chaine);
202 202
         }
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
  */
245 245
 function db_error_handler(array $params): void
246 246
 {
247
-    echo 'Error: ' . $params['error'] . "<br>\n";
248
-    echo 'Query: ' . $params['query'] . "<br>\n";
247
+    echo 'Error: '.$params['error']."<br>\n";
248
+    echo 'Query: '.$params['query']."<br>\n";
249 249
     throw new Exception('Error - Query', 1);
250 250
 }
251 251
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     $session->set('user-forbiden_personal_folders', []);
324 324
     
325 325
     // Get list of Folders
326
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
326
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
327 327
     foreach ($rows as $record) {
328 328
         array_push($groupesVisibles, $record['id']);
329 329
     }
@@ -332,20 +332,20 @@  discard block
 block discarded – undo
332 332
     // get complete list of ROLES
333 333
     $tmp = explode(';', $idFonctions);
334 334
     $rows = DB::query(
335
-        'SELECT * FROM ' . prefixTable('roles_title') . '
335
+        'SELECT * FROM '.prefixTable('roles_title').'
336 336
         ORDER BY title ASC'
337 337
     );
338 338
     foreach ($rows as $record) {
339
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
339
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
340 340
             array_push($tmp, $record['id']);
341 341
         }
342 342
     }
343 343
     $session->set('user-roles', implode(';', $tmp));
344 344
     $session->set('user-admin', 1);
345 345
     // Check if admin has created Folders and Roles
346
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
346
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
347 347
     $session->set('user-nb_folders', DB::count());
348
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
348
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
349 349
     $session->set('user-nb_roles', DB::count());
350 350
 
351 351
     return true;
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
     // Does this user is allowed to see other items
429 429
     $inc = 0;
430 430
     $rows = DB::query(
431
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
431
+        'SELECT id, id_tree FROM '.prefixTable('items').'
432 432
             WHERE restricted_to LIKE %ss AND inactif = %s'.
433 433
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
434 434
         $globalsUserId,
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
     // Check for the users roles if some specific rights exist on items
446 446
     $rows = DB::query(
447 447
         'SELECT i.id_tree, r.item_id
448
-        FROM ' . prefixTable('items') . ' as i
449
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
448
+        FROM ' . prefixTable('items').' as i
449
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
450 450
         WHERE i.id_tree <> "" '.
451 451
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
452 452
         'ORDER BY i.id_tree ASC',
@@ -490,18 +490,18 @@  discard block
 block discarded – undo
490 490
     $session->set('system-list_restricted_folders_for_items', $restrictedFoldersForItems);
491 491
     $session->set('user-forbiden_personal_folders', $noAccessPersonalFolders);
492 492
     // Folders and Roles numbers
493
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('nested_tree') . '');
494
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('nested_tree') . '');
493
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
494
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('nested_tree').'');
495 495
     $session->set('user-nb_folders', DB::count());
496
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
497
-    DB::queryFirstRow('SELECT id FROM ' . prefixTable('roles_title'));
496
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
497
+    DB::queryFirstRow('SELECT id FROM '.prefixTable('roles_title'));
498 498
     $session->set('user-nb_roles', DB::count());
499 499
     // check if change proposals on User's items
500 500
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
501 501
         $countNewItems = DB::query(
502 502
             'SELECT COUNT(*)
503
-            FROM ' . prefixTable('items_change') . ' AS c
504
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
503
+            FROM ' . prefixTable('items_change').' AS c
504
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
505 505
             WHERE i.action = %s AND i.id_user = %i',
506 506
             'at_creation',
507 507
             $globalsUserId
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 {
529 529
     $rows = DB::query(
530 530
         'SELECT *
531
-        FROM ' . prefixTable('roles_values') . '
531
+        FROM ' . prefixTable('roles_values').'
532 532
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
533 533
         ['W', 'ND', 'NE', 'NDNE', 'R'],
534 534
         $userRoles,
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
     ) {
596 596
         $persoFld = DB::queryFirstRow(
597 597
             'SELECT id
598
-            FROM ' . prefixTable('nested_tree') . '
598
+            FROM ' . prefixTable('nested_tree').'
599 599
             WHERE title = %s AND personal_folder = %i'.
600 600
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
601 601
             $globalsUserId,
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
     }
629 629
     $persoFlds = DB::query(
630 630
         'SELECT id
631
-        FROM ' . prefixTable('nested_tree') . '
631
+        FROM ' . prefixTable('nested_tree').'
632 632
         WHERE %l',
633 633
         $where
634 634
     );
@@ -696,12 +696,12 @@  discard block
 block discarded – undo
696 696
     //Load Tree
697 697
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
698 698
     // truncate table
699
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
699
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
700 700
     // reload date
701 701
     $rows = DB::query(
702 702
         'SELECT *
703
-        FROM ' . prefixTable('items') . ' as i
704
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
703
+        FROM ' . prefixTable('items').' as i
704
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
705 705
         AND l.action = %s
706 706
         AND i.inactif = %i',
707 707
         'at_creation',
@@ -713,18 +713,18 @@  discard block
 block discarded – undo
713 713
             $tags = '';
714 714
             $itemTags = DB::query(
715 715
                 'SELECT tag
716
-                FROM ' . prefixTable('tags') . '
716
+                FROM ' . prefixTable('tags').'
717 717
                 WHERE item_id = %i AND tag != ""',
718 718
                 $record['id']
719 719
             );
720 720
             foreach ($itemTags as $itemTag) {
721
-                $tags .= $itemTag['tag'] . ' ';
721
+                $tags .= $itemTag['tag'].' ';
722 722
             }
723 723
 
724 724
             // Get renewal period
725 725
             $resNT = DB::queryFirstRow(
726 726
                 'SELECT renewal_period
727
-                FROM ' . prefixTable('nested_tree') . '
727
+                FROM ' . prefixTable('nested_tree').'
728 728
                 WHERE id = %i',
729 729
                 $record['id_tree']
730 730
             );
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
                     // Is this a User id?
738 738
                     $user = DB::queryFirstRow(
739 739
                         'SELECT id, login
740
-                        FROM ' . prefixTable('users') . '
740
+                        FROM ' . prefixTable('users').'
741 741
                         WHERE id = %i',
742 742
                         $elem->title
743 743
                     );
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
                     'id' => $record['id'],
756 756
                     'label' => $record['label'],
757 757
                     'description' => $record['description'] ?? '',
758
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
758
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
759 759
                     'tags' => $tags,
760 760
                     'id_tree' => $record['id_tree'],
761 761
                     'perso' => $record['perso'],
762
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
762
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
763 763
                     'login' => $record['login'] ?? '',
764 764
                     'folder' => implode(' » ', $folder),
765 765
                     'author' => $record['id_user'],
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
     // get new value from db
789 789
     $data = DB::queryFirstRow(
790 790
         'SELECT label, description, id_tree, perso, restricted_to, login, url
791
-        FROM ' . prefixTable('items') . '
791
+        FROM ' . prefixTable('items').'
792 792
         WHERE id=%i',
793 793
         $ident
794 794
     );
@@ -796,12 +796,12 @@  discard block
 block discarded – undo
796 796
     $tags = '';
797 797
     $itemTags = DB::query(
798 798
         'SELECT tag
799
-            FROM ' . prefixTable('tags') . '
799
+            FROM ' . prefixTable('tags').'
800 800
             WHERE item_id = %i AND tag != ""',
801 801
         $ident
802 802
     );
803 803
     foreach ($itemTags as $itemTag) {
804
-        $tags .= $itemTag['tag'] . ' ';
804
+        $tags .= $itemTag['tag'].' ';
805 805
     }
806 806
     // form id_tree to full foldername
807 807
     $folder = [];
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             // Is this a User id?
813 813
             $user = DB::queryFirstRow(
814 814
                 'SELECT id, login
815
-                FROM ' . prefixTable('users') . '
815
+                FROM ' . prefixTable('users').'
816 816
                 WHERE id = %i',
817 817
                 $elem->title
818 818
             );
@@ -830,10 +830,10 @@  discard block
 block discarded – undo
830 830
             'label' => $data['label'],
831 831
             'description' => $data['description'],
832 832
             'tags' => $tags,
833
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
833
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
834 834
             'id_tree' => $data['id_tree'],
835 835
             'perso' => $data['perso'],
836
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
836
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
837 837
             'login' => $data['login'] ?? '',
838 838
             'folder' => implode(' » ', $folder),
839 839
             'author' => $session->get('user-id'),
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
     // get new value from db
864 864
     $data = DB::queryFirstRow(
865 865
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
866
-        FROM ' . prefixTable('items') . ' as i
867
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
866
+        FROM ' . prefixTable('items').' as i
867
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
868 868
         WHERE i.id = %i
869 869
         AND l.action = %s',
870 870
         $ident,
@@ -874,12 +874,12 @@  discard block
 block discarded – undo
874 874
     $tags = '';
875 875
     $itemTags = DB::query(
876 876
         'SELECT tag
877
-            FROM ' . prefixTable('tags') . '
877
+            FROM ' . prefixTable('tags').'
878 878
             WHERE item_id = %i AND tag != ""',
879 879
         $ident
880 880
     );
881 881
     foreach ($itemTags as $itemTag) {
882
-        $tags .= $itemTag['tag'] . ' ';
882
+        $tags .= $itemTag['tag'].' ';
883 883
     }
884 884
     // form id_tree to full foldername
885 885
     $folder = [];
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
             // Is this a User id?
891 891
             $user = DB::queryFirstRow(
892 892
                 'SELECT id, login
893
-                FROM ' . prefixTable('users') . '
893
+                FROM ' . prefixTable('users').'
894 894
                 WHERE id = %i',
895 895
                 $elem->title
896 896
             );
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
             'label' => $data['label'],
910 910
             'description' => $data['description'],
911 911
             'tags' => empty($tags) === false ? $tags : 'None',
912
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
912
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
913 913
             'id_tree' => $data['id_tree'],
914 914
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
915 915
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -931,53 +931,53 @@  discard block
 block discarded – undo
931 931
 function getStatisticsData(array $SETTINGS): array
932 932
 {
933 933
     DB::query(
934
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
934
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
935 935
         0
936 936
     );
937 937
     $counter_folders = DB::count();
938 938
     DB::query(
939
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
939
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
940 940
         1
941 941
     );
942 942
     $counter_folders_perso = DB::count();
943 943
     DB::query(
944
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
944
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
945 945
         0
946 946
     );
947 947
     $counter_items = DB::count();
948 948
         DB::query(
949
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
949
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
950 950
         1
951 951
     );
952 952
     $counter_items_perso = DB::count();
953 953
         DB::query(
954
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
954
+        'SELECT id FROM '.prefixTable('users').' WHERE login NOT IN (%s, %s, %s)',
955 955
         'OTV', 'TP', 'API'
956 956
     );
957 957
     $counter_users = DB::count();
958 958
         DB::query(
959
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
959
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
960 960
         1
961 961
     );
962 962
     $admins = DB::count();
963 963
     DB::query(
964
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
964
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
965 965
         1
966 966
     );
967 967
     $managers = DB::count();
968 968
     DB::query(
969
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
969
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
970 970
         1
971 971
     );
972 972
     $readOnly = DB::count();
973 973
     // list the languages
974 974
     $usedLang = [];
975 975
     $tp_languages = DB::query(
976
-        'SELECT name FROM ' . prefixTable('languages')
976
+        'SELECT name FROM '.prefixTable('languages')
977 977
     );
978 978
     foreach ($tp_languages as $tp_language) {
979 979
         DB::query(
980
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
980
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
981 981
             $tp_language['name']
982 982
         );
983 983
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
     // get list of ips
987 987
     $usedIp = [];
988 988
     $tp_ips = DB::query(
989
-        'SELECT user_ip FROM ' . prefixTable('users')
989
+        'SELECT user_ip FROM '.prefixTable('users')
990 990
     );
991 991
     foreach ($tp_ips as $ip) {
992 992
         if (array_key_exists($ip['user_ip'], $usedIp)) {
993 993
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
994
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
994
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
995 995
             $usedIp[$ip['user_ip']] = 1;
996 996
         }
997 997
     }
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1087 1087
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1088 1088
         <br><div style="float:right;">' .
1089
-        $textMail .
1089
+        $textMail.
1090 1090
         '<br><br></td></tr></table>
1091 1091
     </td></tr></table>
1092 1092
     <br></body></html>';
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 {
1168 1168
     array_walk_recursive(
1169 1169
         $array,
1170
-        static function (&$item): void {
1170
+        static function(&$item): void {
1171 1171
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1172 1172
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1173 1173
             }
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
  */
1279 1279
 function prefixTable(string $table): string
1280 1280
 {
1281
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1281
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1282 1282
     return $safeTable;
1283 1283
 }
1284 1284
 
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1396 1396
 {
1397 1397
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1398
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1398
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1399 1399
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1400 1400
     socket_close($sock);
1401 1401
 }
@@ -1442,14 +1442,14 @@  discard block
 block discarded – undo
1442 1442
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1443 1443
         if ($type === 'user_mngt') {
1444 1444
             send_syslog(
1445
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1445
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1446 1446
                 $SETTINGS['syslog_host'],
1447 1447
                 $SETTINGS['syslog_port'],
1448 1448
                 'teampass'
1449 1449
             );
1450 1450
         } else {
1451 1451
             send_syslog(
1452
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1452
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1453 1453
                 $SETTINGS['syslog_host'],
1454 1454
                 $SETTINGS['syslog_port'],
1455 1455
                 'teampass'
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
         if (empty($item_label) === true) {
1525 1525
             $dataItem = DB::queryFirstRow(
1526 1526
                 'SELECT id, id_tree, label
1527
-                FROM ' . prefixTable('items') . '
1527
+                FROM ' . prefixTable('items').'
1528 1528
                 WHERE id = %i',
1529 1529
                 $item_id
1530 1530
             );
@@ -1532,11 +1532,11 @@  discard block
 block discarded – undo
1532 1532
         }
1533 1533
 
1534 1534
         send_syslog(
1535
-            'action=' . str_replace('at_', '', $action) .
1536
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1537
-                ' itemno=' . $item_id .
1538
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1539
-                ' itemname="' . addslashes($item_label) . '"',
1535
+            'action='.str_replace('at_', '', $action).
1536
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1537
+                ' itemno='.$item_id.
1538
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1539
+                ' itemname="'.addslashes($item_label).'"',
1540 1540
             $SETTINGS['syslog_host'],
1541 1541
             $SETTINGS['syslog_port'],
1542 1542
             'teampass'
@@ -1567,8 +1567,8 @@  discard block
 block discarded – undo
1567 1567
     // send email to user that what to be notified
1568 1568
     $notification = DB::queryFirstField(
1569 1569
         'SELECT email
1570
-        FROM ' . prefixTable('notification') . ' AS n
1571
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1570
+        FROM ' . prefixTable('notification').' AS n
1571
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1572 1572
         WHERE n.item_id = %i AND n.user_id != %i',
1573 1573
         $item_id,
1574 1574
         $globalsUserId
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
         // Get list of changes
1580 1580
         $htmlChanges = '<ul>';
1581 1581
         foreach ($changes as $change) {
1582
-            $htmlChanges .= '<li>' . $change . '</li>';
1582
+            $htmlChanges .= '<li>'.$change.'</li>';
1583 1583
         }
1584 1584
         $htmlChanges .= '</ul>';
1585 1585
         // send email
@@ -1616,15 +1616,15 @@  discard block
 block discarded – undo
1616 1616
     $path = '';
1617 1617
     foreach ($arbo as $elem) {
1618 1618
         if (empty($path) === true) {
1619
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1619
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1620 1620
         } else {
1621
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1621
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1622 1622
         }
1623 1623
     }
1624 1624
 
1625 1625
     // Build text to show user
1626 1626
     if (empty($label) === false) {
1627
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1627
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1628 1628
     }
1629 1629
     return empty($path) === true ? '' : $path;
1630 1630
 }
@@ -1680,7 +1680,7 @@  discard block
 block discarded – undo
1680 1680
 {
1681 1681
     // Perform a copy if the file exists
1682 1682
     if (file_exists($configFilePath)) {
1683
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1683
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1684 1684
         if (!copy($configFilePath, $backupFilePath)) {
1685 1685
             return "ERROR: Could not copy file '$configFilePath'";
1686 1686
         }
@@ -1688,10 +1688,10 @@  discard block
 block discarded – undo
1688 1688
 
1689 1689
     // Regenerate the config file
1690 1690
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1691
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1691
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1692 1692
     foreach ($rows as $record) {
1693 1693
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1694
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1694
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1695 1695
     }
1696 1696
     $data[] = ");\n";
1697 1697
     $data = array_unique($data);
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 {
1737 1737
     global $SETTINGS;
1738 1738
     /* LOAD CPASSMAN SETTINGS */
1739
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1739
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1740 1740
         $SETTINGS = [];
1741 1741
         $SETTINGS['duplicate_folder'] = 0;
1742 1742
         //by default, this is set to 0;
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
         //by default, this value is set to 5;
1747 1747
         $settings = [];
1748 1748
         $rows = DB::query(
1749
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1749
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1750 1750
             [
1751 1751
                 'type' => 'admin',
1752 1752
                 'type2' => 'settings',
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
     $source_cf = [];
1779 1779
     $rows = DB::query(
1780 1780
         'SELECT id_category
1781
-            FROM ' . prefixTable('categories_folders') . '
1781
+            FROM ' . prefixTable('categories_folders').'
1782 1782
             WHERE id_folder = %i',
1783 1783
         $source_id
1784 1784
     );
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
     $target_cf = [];
1790 1790
     $rows = DB::query(
1791 1791
         'SELECT id_category
1792
-            FROM ' . prefixTable('categories_folders') . '
1792
+            FROM ' . prefixTable('categories_folders').'
1793 1793
             WHERE id_folder = %i',
1794 1794
         $target_id
1795 1795
     );
@@ -1884,10 +1884,10 @@  discard block
 block discarded – undo
1884 1884
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1885 1885
         $err = 'wrong_key';
1886 1886
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1887
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1887
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1888 1888
         $err = 'environment_error';
1889 1889
     } catch (CryptoException\IOException $ex) {
1890
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1890
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1891 1891
         $err = 'general_error';
1892 1892
     }
1893 1893
 
@@ -1919,10 +1919,10 @@  discard block
 block discarded – undo
1919 1919
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1920 1920
         $err = 'wrong_key';
1921 1921
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1922
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1922
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1923 1923
         $err = 'environment_error';
1924 1924
     } catch (CryptoException\IOException $ex) {
1925
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1925
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1926 1926
         $err = 'general_error';
1927 1927
     }
1928 1928
 
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
 ) {
2009 2009
     // Check if the path exists
2010 2010
     $path = basename($path);
2011
-    if (! file_exists($path)) {
2011
+    if (!file_exists($path)) {
2012 2012
         return false;
2013 2013
     }
2014 2014
 
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
     // Load item data
2062 2062
     $data = DB::queryFirstRow(
2063 2063
         'SELECT id_tree
2064
-        FROM ' . prefixTable('items') . '
2064
+        FROM ' . prefixTable('items').'
2065 2065
         WHERE id = %i',
2066 2066
         $item_id
2067 2067
     );
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
         }
2125 2125
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2126 2126
     }
2127
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2127
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2128 2128
     return $email;
2129 2129
 }
2130 2130
 
@@ -2155,11 +2155,11 @@  discard block
 block discarded – undo
2155 2155
 function formatSizeUnits(int $bytes): string
2156 2156
 {
2157 2157
     if ($bytes >= 1073741824) {
2158
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2158
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2159 2159
     } elseif ($bytes >= 1048576) {
2160
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2160
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2161 2161
     } elseif ($bytes >= 1024) {
2162
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2162
+        $bytes = number_format($bytes / 1024, 2).' KB';
2163 2163
     } elseif ($bytes > 1) {
2164 2164
         $bytes .= ' bytes';
2165 2165
     } elseif ($bytes === 1) {
@@ -2329,7 +2329,7 @@  discard block
 block discarded – undo
2329 2329
  */
2330 2330
 function generateKeyIntegrityHash(string $userSeed, string $publicKey, string $serverSecret): string
2331 2331
 {
2332
-    return hash_hmac('sha256', $userSeed . $publicKey, $serverSecret);
2332
+    return hash_hmac('sha256', $userSeed.$publicKey, $serverSecret);
2333 2333
 }
2334 2334
 
2335 2335
 /**
@@ -2404,7 +2404,7 @@  discard block
 block discarded – undo
2404 2404
                 'security_alert',
2405 2405
                 'key_integrity_check_failed',
2406 2406
                 (string) $userInfo['id'],
2407
-                'User: ' . $userInfo['login']
2407
+                'User: '.$userInfo['login']
2408 2408
             );
2409 2409
             return [
2410 2410
                 'success' => false,
@@ -2451,7 +2451,7 @@  discard block
 block discarded – undo
2451 2451
             'user_connection',
2452 2452
             'auto_reencryption_success',
2453 2453
             (string) $userInfo['id'],
2454
-            'User: ' . $userInfo['login']
2454
+            'User: '.$userInfo['login']
2455 2455
         );
2456 2456
 
2457 2457
         // Store in session for immediate use
@@ -2470,12 +2470,12 @@  discard block
 block discarded – undo
2470 2470
             'security_alert',
2471 2471
             'auto_reencryption_failed',
2472 2472
             (string) $userInfo['id'],
2473
-            'User: ' . $userInfo['login'] . ' - Error: ' . $e->getMessage()
2473
+            'User: '.$userInfo['login'].' - Error: '.$e->getMessage()
2474 2474
         );
2475 2475
 
2476 2476
         return [
2477 2477
             'success' => false,
2478
-            'error' => 'decryption_failed: ' . $e->getMessage(),
2478
+            'error' => 'decryption_failed: '.$e->getMessage(),
2479 2479
             'private_key_clear' => '',
2480 2480
         ];
2481 2481
     }
@@ -2542,7 +2542,7 @@  discard block
 block discarded – undo
2542 2542
         'security_alert',
2543 2543
         'auto_reencryption_critical_failure',
2544 2544
         (string) $userId,
2545
-        'User: ' . $userInfo['login'] . ' - disabled due to key recovery failure'
2545
+        'User: '.$userInfo['login'].' - disabled due to key recovery failure'
2546 2546
     );
2547 2547
 
2548 2548
     return false;
@@ -2700,7 +2700,7 @@  discard block
 block discarded – undo
2700 2700
     $cipher->enableContinuousBuffer();
2701 2701
 
2702 2702
     // Encrypt the file content
2703
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2703
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2704 2704
     $fileContent = file_get_contents($filePath);
2705 2705
     $plaintext = $fileContent;
2706 2706
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2708,9 +2708,9 @@  discard block
 block discarded – undo
2708 2708
     // Save new file
2709 2709
     // deepcode ignore InsecureHash: is simply used to get a unique name
2710 2710
     $hash = uniqid('', true);
2711
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2711
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2712 2712
     file_put_contents($fileOut, $ciphertext);
2713
-    unlink($fileInPath . '/' . $fileInName);
2713
+    unlink($fileInPath.'/'.$fileInName);
2714 2714
     return [
2715 2715
         'fileHash' => base64_encode($hash),
2716 2716
         'objectKey' => base64_encode($objectKey),
@@ -2726,9 +2726,9 @@  discard block
 block discarded – undo
2726 2726
  *
2727 2727
  * @return string|array
2728 2728
  */
2729
-function decryptFile(string $fileName, string $filePath, string $key): string|array
2729
+function decryptFile(string $fileName, string $filePath, string $key): string | array
2730 2730
 {
2731
-    if (! defined('FILE_BUFFER_SIZE')) {
2731
+    if (!defined('FILE_BUFFER_SIZE')) {
2732 2732
         define('FILE_BUFFER_SIZE', 128 * 1024);
2733 2733
     }
2734 2734
     
@@ -2745,7 +2745,7 @@  discard block
 block discarded – undo
2745 2745
     $cipher->enableContinuousBuffer();
2746 2746
     $cipher->disablePadding();
2747 2747
     // Get file content
2748
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2748
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2749 2749
     if ($safeFilePath !== false && file_exists($safeFilePath)) {
2750 2750
         $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2751 2751
     } else {
@@ -2841,7 +2841,7 @@  discard block
 block discarded – undo
2841 2841
         // Only create the sharekey for a user
2842 2842
         $user = DB::queryFirstRow(
2843 2843
             'SELECT public_key
2844
-            FROM ' . prefixTable('users') . '
2844
+            FROM ' . prefixTable('users').'
2845 2845
             WHERE id = %i
2846 2846
             AND public_key != ""',
2847 2847
             $userId
@@ -2882,7 +2882,7 @@  discard block
 block discarded – undo
2882 2882
         }
2883 2883
         $users = DB::query(
2884 2884
             'SELECT id, public_key
2885
-            FROM ' . prefixTable('users') . '
2885
+            FROM ' . prefixTable('users').'
2886 2886
             WHERE id NOT IN %li
2887 2887
             AND public_key != ""',
2888 2888
             $user_ids
@@ -2891,7 +2891,7 @@  discard block
 block discarded – undo
2891 2891
         foreach ($users as $user) {
2892 2892
             // Insert in DB the new object key for this item by user
2893 2893
             if (count($objectKeyArray) === 0) {
2894
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2894
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2895 2895
                 DB::insert(
2896 2896
                     $object_name,
2897 2897
                     [
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
                 );
2906 2906
             } else {
2907 2907
                 foreach ($objectKeyArray as $object) {
2908
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2908
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2909 2909
                     DB::insert(
2910 2910
                         $object_name,
2911 2911
                         [
@@ -2933,7 +2933,7 @@  discard block
 block discarded – undo
2933 2933
 function isBase64(string $str): bool
2934 2934
 {
2935 2935
     $str = (string) trim($str);
2936
-    if (! isset($str[0])) {
2936
+    if (!isset($str[0])) {
2937 2937
         return false;
2938 2938
     }
2939 2939
 
@@ -3007,7 +3007,7 @@  discard block
 block discarded – undo
3007 3007
     } catch (\LdapRecord\Auth\BindException $e) {
3008 3008
         $error = $e->getDetailedError();
3009 3009
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
3010
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
3010
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
3011 3011
         }
3012 3012
         // deepcode ignore ServerLeak: No important data is sent
3013 3013
         echo 'An error occurred.';
@@ -3024,7 +3024,7 @@  discard block
 block discarded – undo
3024 3024
     } catch (\LdapRecord\Auth\BindException $e) {
3025 3025
         $error = $e->getDetailedError();
3026 3026
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
3027
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
3027
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
3028 3028
         }
3029 3029
         // deepcode ignore ServerLeak: No important data is sent
3030 3030
         echo 'An error occurred.';
@@ -3060,7 +3060,7 @@  discard block
 block discarded – undo
3060 3060
     // expect if personal item
3061 3061
     DB::delete(
3062 3062
         prefixTable('sharekeys_items'),
3063
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
3063
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
3064 3064
         $userId
3065 3065
     );
3066 3066
     // Remove all item sharekeys files
@@ -3068,8 +3068,8 @@  discard block
 block discarded – undo
3068 3068
         prefixTable('sharekeys_files'),
3069 3069
         'user_id = %i AND object_id NOT IN (
3070 3070
             SELECT f.id 
3071
-            FROM ' . prefixTable('items') . ' AS i 
3072
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
3071
+            FROM ' . prefixTable('items').' AS i 
3072
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
3073 3073
             WHERE i.perso = 1
3074 3074
         )',
3075 3075
         $userId
@@ -3079,8 +3079,8 @@  discard block
 block discarded – undo
3079 3079
         prefixTable('sharekeys_fields'),
3080 3080
         'user_id = %i AND object_id NOT IN (
3081 3081
             SELECT c.id 
3082
-            FROM ' . prefixTable('items') . ' AS i 
3083
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
3082
+            FROM ' . prefixTable('items').' AS i 
3083
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
3084 3084
             WHERE i.perso = 1
3085 3085
         )',
3086 3086
         $userId
@@ -3088,13 +3088,13 @@  discard block
 block discarded – undo
3088 3088
     // Remove all item sharekeys logs
3089 3089
     DB::delete(
3090 3090
         prefixTable('sharekeys_logs'),
3091
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
3091
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
3092 3092
         $userId
3093 3093
     );
3094 3094
     // Remove all item sharekeys suggestions
3095 3095
     DB::delete(
3096 3096
         prefixTable('sharekeys_suggestions'),
3097
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
3097
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
3098 3098
         $userId
3099 3099
     );
3100 3100
     return false;
@@ -3115,7 +3115,7 @@  discard block
 block discarded – undo
3115 3115
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3116 3116
             $now->setTimezone(new DateTimeZone($timezone));
3117 3117
             $offsets[] = $offset = $now->getOffset();
3118
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3118
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3119 3119
         }
3120 3120
 
3121 3121
         array_multisort($offsets, $timezones);
@@ -3135,7 +3135,7 @@  discard block
 block discarded – undo
3135 3135
 {
3136 3136
     $hours = intval($offset / 3600);
3137 3137
     $minutes = abs(intval($offset % 3600 / 60));
3138
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3138
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3139 3139
 }
3140 3140
 
3141 3141
 /**
@@ -3234,8 +3234,7 @@  discard block
 block discarded – undo
3234 3234
 {
3235 3235
     if (isset($array[$key]) === true
3236 3236
         && (is_int($value) === true ?
3237
-            (int) $array[$key] === $value :
3238
-            (string) $array[$key] === $value)
3237
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3239 3238
     ) {
3240 3239
         return true;
3241 3240
     }
@@ -3257,8 +3256,7 @@  discard block
 block discarded – undo
3257 3256
 {
3258 3257
     if (isset($var) === false
3259 3258
         || (is_int($value) === true ?
3260
-            (int) $var === $value :
3261
-            (string) $var === $value)
3259
+            (int) $var === $value : (string) $var === $value)
3262 3260
     ) {
3263 3261
         return true;
3264 3262
     }
@@ -3309,7 +3307,7 @@  discard block
 block discarded – undo
3309 3307
  */
3310 3308
 function isSetArrayOfValues(array $arrayOfValues): bool
3311 3309
 {
3312
-    foreach($arrayOfValues as $value) {
3310
+    foreach ($arrayOfValues as $value) {
3313 3311
         if (isset($value) === false) {
3314 3312
             return false;
3315 3313
         }
@@ -3331,7 +3329,7 @@  discard block
 block discarded – undo
3331 3329
     /*PHP8 - integer|string*/$value
3332 3330
 ) : bool
3333 3331
 {
3334
-    foreach($arrayOfVars as $variable) {
3332
+    foreach ($arrayOfVars as $variable) {
3335 3333
         if ($variable !== $value) {
3336 3334
             return false;
3337 3335
         }
@@ -3351,7 +3349,7 @@  discard block
 block discarded – undo
3351 3349
     /*PHP8 - integer|string*/$value
3352 3350
 ) : bool
3353 3351
 {
3354
-    foreach($arrayOfVars as $variable) {
3352
+    foreach ($arrayOfVars as $variable) {
3355 3353
         if ($variable === $value) {
3356 3354
             return true;
3357 3355
         }
@@ -3365,7 +3363,7 @@  discard block
 block discarded – undo
3365 3363
  * @param string|int|null $value
3366 3364
  * @return boolean
3367 3365
  */
3368
-function isValueSetNullEmpty(string|int|null $value) : bool
3366
+function isValueSetNullEmpty(string | int | null $value) : bool
3369 3367
 {
3370 3368
     if (is_null($value) === true || empty($value) === true) {
3371 3369
         return true;
@@ -3420,7 +3418,7 @@  discard block
 block discarded – undo
3420 3418
  * @param array     $filters
3421 3419
  * @return array|string
3422 3420
  */
3423
-function dataSanitizer(array $data, array $filters): array|string
3421
+function dataSanitizer(array $data, array $filters): array | string
3424 3422
 {
3425 3423
     // Load Sanitizer library
3426 3424
     $sanitizer = new Sanitizer($data, $filters);
@@ -3449,7 +3447,7 @@  discard block
 block discarded – undo
3449 3447
     // Exists ?
3450 3448
     $userCacheId = DB::queryFirstRow(
3451 3449
         'SELECT increment_id
3452
-        FROM ' . prefixTable('cache_tree') . '
3450
+        FROM ' . prefixTable('cache_tree').'
3453 3451
         WHERE user_id = %i',
3454 3452
         $user_id
3455 3453
     );
@@ -3500,7 +3498,7 @@  discard block
 block discarded – undo
3500 3498
  */
3501 3499
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3502 3500
 { 
3503
-    $resultat = ($nombre/$total) * $pourcentage;
3501
+    $resultat = ($nombre / $total) * $pourcentage;
3504 3502
     return round($resultat);
3505 3503
 }
3506 3504
 
@@ -3530,7 +3528,7 @@  discard block
 block discarded – undo
3530 3528
 
3531 3529
     // Get last folder update
3532 3530
     $lastFolderChange = DB::queryFirstRow(
3533
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3531
+        'SELECT valeur FROM '.prefixTable('misc').'
3534 3532
         WHERE type = %s AND intitule = %s',
3535 3533
         'timestamp',
3536 3534
         'last_folder_change'
@@ -3551,7 +3549,7 @@  discard block
 block discarded – undo
3551 3549
     // Does this user has a tree cache
3552 3550
     $userCacheTree = DB::queryFirstRow(
3553 3551
         'SELECT '.$fieldName.'
3554
-        FROM ' . prefixTable('cache_tree') . '
3552
+        FROM ' . prefixTable('cache_tree').'
3555 3553
         WHERE user_id = %i',
3556 3554
         $session->get('user-id')
3557 3555
     );
@@ -3589,7 +3587,7 @@  discard block
 block discarded – undo
3589 3587
     if (count($folderIds) === 0) {
3590 3588
         $folderIds = DB::queryFirstColumn(
3591 3589
             'SELECT id
3592
-            FROM ' . prefixTable('nested_tree') . '
3590
+            FROM ' . prefixTable('nested_tree').'
3593 3591
             WHERE personal_folder=%i',
3594 3592
             0
3595 3593
         );
@@ -3606,8 +3604,8 @@  discard block
 block discarded – undo
3606 3604
         $rows_tmp = DB::query(
3607 3605
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3608 3606
             f.id_category AS category_id
3609
-            FROM ' . prefixTable('categories_folders') . ' AS f
3610
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3607
+            FROM ' . prefixTable('categories_folders').' AS f
3608
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3611 3609
             WHERE id_folder=%i',
3612 3610
             $folder
3613 3611
         );
@@ -3633,7 +3631,7 @@  discard block
 block discarded – undo
3633 3631
         $valTemp = '';
3634 3632
         $data = DB::queryFirstRow(
3635 3633
             'SELECT valeur
3636
-            FROM ' . prefixTable('misc') . '
3634
+            FROM ' . prefixTable('misc').'
3637 3635
             WHERE type = %s AND intitule=%i',
3638 3636
             'complex',
3639 3637
             $folder
@@ -3650,14 +3648,14 @@  discard block
 block discarded – undo
3650 3648
         $valTemp = '';
3651 3649
         $rows_tmp = DB::query(
3652 3650
             'SELECT t.title
3653
-            FROM ' . prefixTable('roles_values') . ' as v
3654
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3651
+            FROM ' . prefixTable('roles_values').' as v
3652
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3655 3653
             WHERE v.folder_id = %i
3656 3654
             GROUP BY title',
3657 3655
             $folder
3658 3656
         );
3659 3657
         foreach ($rows_tmp as $record) {
3660
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3658
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3661 3659
         }
3662 3660
         $arr_data['visibilityRoles'] = $valTemp;
3663 3661
 
@@ -3690,7 +3688,7 @@  discard block
 block discarded – undo
3690 3688
         // loop on users and check if user has this role
3691 3689
         $rows = DB::query(
3692 3690
             'SELECT id, fonction_id
3693
-            FROM ' . prefixTable('users') . '
3691
+            FROM ' . prefixTable('users').'
3694 3692
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3695 3693
             $session->get('user-id')
3696 3694
         );
@@ -3722,7 +3720,7 @@  discard block
 block discarded – undo
3722 3720
 
3723 3721
     $val = DB::queryFirstRow(
3724 3722
         'SELECT *
3725
-        FROM ' . prefixTable('users') . '
3723
+        FROM ' . prefixTable('users').'
3726 3724
         WHERE id = %i',
3727 3725
         $userId
3728 3726
     );
@@ -3738,12 +3736,12 @@  discard block
 block discarded – undo
3738 3736
 function upgradeRequired(): bool
3739 3737
 {
3740 3738
     // Get settings.php
3741
-    include_once __DIR__. '/../includes/config/settings.php';
3739
+    include_once __DIR__.'/../includes/config/settings.php';
3742 3740
 
3743 3741
     // Get timestamp in DB
3744 3742
     $val = DB::queryFirstRow(
3745 3743
         'SELECT valeur
3746
-        FROM ' . prefixTable('misc') . '
3744
+        FROM ' . prefixTable('misc').'
3747 3745
         WHERE type = %s AND intitule = %s',
3748 3746
         'admin',
3749 3747
         'upgrade_timestamp'
@@ -3796,7 +3794,7 @@  discard block
 block discarded – undo
3796 3794
     // prepapre background tasks for item keys generation        
3797 3795
     $userTP = DB::queryFirstRow(
3798 3796
         'SELECT pw, public_key, private_key
3799
-        FROM ' . prefixTable('users') . '
3797
+        FROM ' . prefixTable('users').'
3800 3798
         WHERE id = %i',
3801 3799
         TP_USER_ID
3802 3800
     );
@@ -3857,7 +3855,7 @@  discard block
 block discarded – undo
3857 3855
     }
3858 3856
 
3859 3857
     // Generate new keys
3860
-    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3858
+    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3861 3859
         $userKeys = [
3862 3860
             'public_key' => $recovery_public_key,
3863 3861
             'private_key_clear' => $recovery_private_key,
@@ -3908,8 +3906,8 @@  discard block
 block discarded – undo
3908 3906
             'process_type' => 'create_user_keys',
3909 3907
             'arguments' => json_encode([
3910 3908
                 'new_user_id' => (int) $userId,
3911
-                'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3912
-                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3909
+                'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3910
+                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3913 3911
                 'owner_id' => (int) TP_USER_ID,
3914 3912
                 'creator_pwd' => $userTP['pw'],
3915 3913
                 'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -3981,19 +3979,19 @@  discard block
 block discarded – undo
3981 3979
 
3982 3980
     // Prepare the subtask queries
3983 3981
     $queries = [
3984
-        'step20' => 'SELECT * FROM ' . prefixTable('items'),
3982
+        'step20' => 'SELECT * FROM '.prefixTable('items'),
3985 3983
 
3986
-        'step30' => 'SELECT * FROM ' . prefixTable('log_items') . 
3984
+        'step30' => 'SELECT * FROM '.prefixTable('log_items'). 
3987 3985
                     ' WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"',
3988 3986
 
3989
-        'step40' => 'SELECT * FROM ' . prefixTable('categories_items') . 
3987
+        'step40' => 'SELECT * FROM '.prefixTable('categories_items'). 
3990 3988
                     ' WHERE encryption_type = "teampass_aes"',
3991 3989
 
3992
-        'step50' => 'SELECT * FROM ' . prefixTable('suggestion'),
3990
+        'step50' => 'SELECT * FROM '.prefixTable('suggestion'),
3993 3991
 
3994
-        'step60' => 'SELECT * FROM ' . prefixTable('files') . ' AS f
3995
-                        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
3996
-                        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"'
3992
+        'step60' => 'SELECT * FROM '.prefixTable('files').' AS f
3993
+                        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
3994
+                        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"'
3997 3995
     ];
3998 3996
 
3999 3997
     // Perform loop on $queries to create sub-tasks
@@ -4183,7 +4181,7 @@  discard block
 block discarded – undo
4183 4181
  */
4184 4182
 function createTaskForItem(
4185 4183
     string $processType,
4186
-    string|array $taskName,
4184
+    string | array $taskName,
4187 4185
     int $itemId,
4188 4186
     int $userId,
4189 4187
     string $objectKey,
@@ -4207,7 +4205,7 @@  discard block
 block discarded – undo
4207 4205
                 'object_key' => $objectKey,
4208 4206
                 'author' => (int) $userId,
4209 4207
             ]),
4210
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
4208
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
4211 4209
         )
4212 4210
     );
4213 4211
     $processId = DB::insertId();
@@ -4217,7 +4215,7 @@  discard block
 block discarded – undo
4217 4215
     if (is_array($taskName) === false) {
4218 4216
         $taskName = [$taskName];
4219 4217
     }
4220
-    foreach($taskName as $task) {
4218
+    foreach ($taskName as $task) {
4221 4219
         if (WIP === true) error_log('createTaskForItem - task: '.$task);
4222 4220
         switch ($task) {
4223 4221
             case 'item_password':
@@ -4314,7 +4312,7 @@  discard block
 block discarded – undo
4314 4312
  * @param integer $user_id
4315 4313
  * @return void
4316 4314
  */
4317
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4315
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4318 4316
 {
4319 4317
     if ($allUsers === true) {
4320 4318
         // Load class DB
@@ -4324,7 +4322,7 @@  discard block
 block discarded – undo
4324 4322
 
4325 4323
         $users = DB::query(
4326 4324
             'SELECT id
4327
-            FROM ' . prefixTable('users') . '
4325
+            FROM ' . prefixTable('users').'
4328 4326
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4329 4327
             ORDER BY login ASC'
4330 4328
         );
@@ -4342,7 +4340,7 @@  discard block
 block discarded – undo
4342 4340
  * @param integer $user_id
4343 4341
  * @return void
4344 4342
  */
4345
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4343
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4346 4344
 {
4347 4345
     if ($user_id === 0) {
4348 4346
         return;
@@ -4353,8 +4351,8 @@  discard block
 block discarded – undo
4353 4351
 
4354 4352
     $personalItems = DB::queryFirstColumn(
4355 4353
         'SELECT id
4356
-        FROM ' . prefixTable('items') . ' AS i
4357
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4354
+        FROM ' . prefixTable('items').' AS i
4355
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4358 4356
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4359 4357
         $user_id
4360 4358
     );
@@ -4364,28 +4362,28 @@  discard block
 block discarded – undo
4364 4362
             prefixTable('sharekeys_items'),
4365 4363
             'object_id IN %li AND user_id NOT IN %ls',
4366 4364
             $personalItems,
4367
-            [$user_id, TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
4365
+            [$user_id, TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
4368 4366
         );
4369 4367
         // Files keys
4370 4368
         DB::delete(
4371 4369
             prefixTable('sharekeys_files'),
4372 4370
             'object_id IN %li AND user_id NOT IN %ls',
4373 4371
             $personalItems,
4374
-            [$user_id, TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
4372
+            [$user_id, TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
4375 4373
         );
4376 4374
         // Fields keys
4377 4375
         DB::delete(
4378 4376
             prefixTable('sharekeys_fields'),
4379 4377
             'object_id IN %li AND user_id NOT IN %ls',
4380 4378
             $personalItems,
4381
-            [$user_id, TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
4379
+            [$user_id, TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
4382 4380
         );
4383 4381
         // Logs keys
4384 4382
         DB::delete(
4385 4383
             prefixTable('sharekeys_logs'),
4386 4384
             'object_id IN %li AND user_id NOT IN %ls',
4387 4385
             $personalItems,
4388
-            [$user_id, TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
4386
+            [$user_id, TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
4389 4387
         );
4390 4388
     }
4391 4389
 }
@@ -4403,7 +4401,7 @@  discard block
 block discarded – undo
4403 4401
     // Check if user exists
4404 4402
     $userInfo = DB::queryFirstRow(
4405 4403
         'SELECT login
4406
-        FROM ' . prefixTable('users') . '
4404
+        FROM ' . prefixTable('users').'
4407 4405
         WHERE id = %i',
4408 4406
         $userId
4409 4407
     );
@@ -4412,7 +4410,7 @@  discard block
 block discarded – undo
4412 4410
         $now = (int) time();
4413 4411
         // Prepare file content
4414 4412
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4415
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4413
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4416 4414
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4417 4415
             "Public Key:\n".$session->get('user-public_key')."\n\n".
4418 4416
             "Private Key:\n".$session->get('user-private_key')."\n\n";
@@ -4435,7 +4433,7 @@  discard block
 block discarded – undo
4435 4433
         return prepareExchangedData(
4436 4434
             array(
4437 4435
                 'error' => false,
4438
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4436
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4439 4437
                 'timestamp' => $now,
4440 4438
                 'content' => base64_encode($export_value),
4441 4439
                 'login' => $userInfo['login'],
@@ -4461,8 +4459,8 @@  discard block
 block discarded – undo
4461 4459
  */
4462 4460
 function loadClasses(string $className = ''): void
4463 4461
 {
4464
-    require_once __DIR__. '/../includes/config/include.php';
4465
-    require_once __DIR__. '/../includes/config/settings.php';
4462
+    require_once __DIR__.'/../includes/config/include.php';
4463
+    require_once __DIR__.'/../includes/config/settings.php';
4466 4464
     require_once __DIR__.'/../vendor/autoload.php';
4467 4465
 
4468 4466
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4675,7 +4673,7 @@  discard block
 block discarded – undo
4675 4673
 
4676 4674
     // Get current user hash
4677 4675
     $userHash = DB::queryFirstRow(
4678
-        "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
4676
+        "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
4679 4677
         $session->get('user-id')
4680 4678
     )['pw'];
4681 4679
 
@@ -4723,11 +4721,11 @@  discard block
 block discarded – undo
4723 4721
         }
4724 4722
         
4725 4723
         // Alternative: serialize ou json selon le contexte
4726
-        return get_class($value) . (method_exists($value, 'getId') ? '#' . $value->getId() : '');
4724
+        return get_class($value).(method_exists($value, 'getId') ? '#'.$value->getId() : '');
4727 4725
     }
4728 4726
     
4729 4727
     if (is_resource($value)) {
4730
-        return 'Resource#' . get_resource_id($value) . ' of type ' . get_resource_type($value);
4728
+        return 'Resource#'.get_resource_id($value).' of type '.get_resource_type($value);
4731 4729
     }
4732 4730
     
4733 4731
     // Cas par défaut
@@ -4747,7 +4745,7 @@  discard block
 block discarded – undo
4747 4745
     // Refuse access if user does not exist and/or is admin
4748 4746
     $user = DB::queryFirstRow(
4749 4747
         'SELECT admin
4750
-        FROM ' . prefixTable('users') . '
4748
+        FROM ' . prefixTable('users').'
4751 4749
         WHERE id = %i',
4752 4750
         $userId
4753 4751
     );
@@ -4758,8 +4756,8 @@  discard block
 block discarded – undo
4758 4756
     // Get file info
4759 4757
     $file = DB::queryFirstRow(
4760 4758
         'SELECT f.id_item, i.id_tree
4761
-        FROM ' . prefixTable('files') . ' as f
4762
-        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
4759
+        FROM ' . prefixTable('files').' as f
4760
+        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
4763 4761
         WHERE f.id = %i',
4764 4762
         $fileId
4765 4763
     );
@@ -4768,7 +4766,7 @@  discard block
 block discarded – undo
4768 4766
     }
4769 4767
 
4770 4768
     // Check if user has access to the item
4771
-    include_once __DIR__. '/items.queries.php';
4769
+    include_once __DIR__.'/items.queries.php';
4772 4770
     $itemAccess = getCurrentAccessRights(
4773 4771
         (int) filter_var($userId, FILTER_SANITIZE_NUMBER_INT),
4774 4772
         (int) filter_var($file['id_item'], FILTER_SANITIZE_NUMBER_INT),
@@ -4801,7 +4799,7 @@  discard block
 block discarded – undo
4801 4799
     // Refuse access if user does not exist and/or is not admin
4802 4800
     $user = DB::queryFirstRow(
4803 4801
         'SELECT admin
4804
-        FROM ' . prefixTable('users') . '
4802
+        FROM ' . prefixTable('users').'
4805 4803
         WHERE id = %i',
4806 4804
         $userId
4807 4805
     );
@@ -4812,7 +4810,7 @@  discard block
 block discarded – undo
4812 4810
     // Ensure that user has performed the backup
4813 4811
     DB::queryFirstRow(
4814 4812
         'SELECT f.id
4815
-        FROM ' . prefixTable('log_system') . ' as f
4813
+        FROM ' . prefixTable('log_system').' as f
4816 4814
         WHERE f.type = %s AND f.label = %s AND f.qui = %i AND f.field_1 = %s',
4817 4815
         'admin_action',
4818 4816
         'dataBase backup',
@@ -4839,7 +4837,7 @@  discard block
 block discarded – undo
4839 4837
     // Refuse access if user does not exist and/or is admin
4840 4838
     $user = DB::queryFirstRow(
4841 4839
         'SELECT admin
4842
-        FROM ' . prefixTable('users') . '
4840
+        FROM ' . prefixTable('users').'
4843 4841
         WHERE id = %i',
4844 4842
         $userId
4845 4843
     );
@@ -4850,7 +4848,7 @@  discard block
 block discarded – undo
4850 4848
     // Get item info
4851 4849
     $item = DB::queryFirstRow(
4852 4850
         'SELECT i.perso, i.id_tree
4853
-        FROM ' . prefixTable('items') . ' as i
4851
+        FROM ' . prefixTable('items').' as i
4854 4852
         WHERE i.id = %i',
4855 4853
         $itemId
4856 4854
     );
@@ -4861,7 +4859,7 @@  discard block
 block discarded – undo
4861 4859
     // Get item owner
4862 4860
     $itemOwner = DB::queryFirstRow(
4863 4861
         'SELECT li.id_user
4864
-        FROM ' . prefixTable('log_items') . ' as li
4862
+        FROM ' . prefixTable('log_items').' as li
4865 4863
         WHERE li.id_item = %i AND li.action = %s',
4866 4864
         $itemId,
4867 4865
         'at_creation'
@@ -4875,25 +4873,25 @@  discard block
 block discarded – undo
4875 4873
         prefixTable('sharekeys_items'),
4876 4874
         'object_id = %i AND user_id NOT IN %ls',
4877 4875
         $itemId,
4878
-        [$userId, TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
4876
+        [$userId, TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
4879 4877
     );
4880 4878
     DB::delete(
4881 4879
         prefixTable('sharekeys_files'),
4882 4880
         'object_id IN (SELECT id FROM '.prefixTable('files').' WHERE id_item = %i) AND user_id NOT IN %ls',
4883 4881
         $itemId,
4884
-        [$userId, TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
4882
+        [$userId, TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
4885 4883
     );
4886 4884
     DB::delete(
4887 4885
         prefixTable('sharekeys_fields'),
4888 4886
         'object_id IN (SELECT id FROM '.prefixTable('fields').' WHERE id_item = %i) AND user_id NOT IN %ls',
4889 4887
         $itemId,
4890
-        [$userId, TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
4888
+        [$userId, TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
4891 4889
     );
4892 4890
     DB::delete(
4893 4891
         prefixTable('sharekeys_logs'),
4894 4892
         'object_id IN (SELECT id FROM '.prefixTable('log_items').' WHERE id_item = %i) AND user_id NOT IN %ls',
4895 4893
         $itemId,
4896
-        [$userId, TP_USER_ID, API_USER_ID, OTV_USER_ID,SSH_USER_ID]
4894
+        [$userId, TP_USER_ID, API_USER_ID, OTV_USER_ID, SSH_USER_ID]
4897 4895
     );
4898 4896
 
4899 4897
     return true;
@@ -4949,7 +4947,7 @@  discard block
 block discarded – undo
4949 4947
 {
4950 4948
     // Count auto-recoveries in last 24h
4951 4949
     $autoRecoveriesLast24h = DB::queryFirstField(
4952
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
4950
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
4953 4951
          WHERE label = %s
4954 4952
          AND date > %i',
4955 4953
         'auto_reencryption_success',
@@ -4958,21 +4956,21 @@  discard block
 block discarded – undo
4958 4956
 
4959 4957
     // Count failed recoveries (all time)
4960 4958
     $failedRecoveries = DB::queryFirstField(
4961
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
4959
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
4962 4960
          WHERE label = %s',
4963 4961
         'auto_reencryption_failed'
4964 4962
     );
4965 4963
 
4966 4964
     // Count critical failures (all time)
4967 4965
     $criticalFailures = DB::queryFirstField(
4968
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
4966
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
4969 4967
          WHERE label = %s',
4970 4968
         'auto_reencryption_critical_failure'
4971 4969
     );
4972 4970
 
4973 4971
     // Count users with transparent recovery enabled (have seed and backup)
4974 4972
     $usersMigrated = DB::queryFirstField(
4975
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . '
4973
+        'SELECT COUNT(*) FROM '.prefixTable('users').'
4976 4974
          WHERE user_derivation_seed IS NOT NULL
4977 4975
          AND private_key_backup IS NOT NULL
4978 4976
          AND disabled = 0'
@@ -4980,7 +4978,7 @@  discard block
 block discarded – undo
4980 4978
 
4981 4979
     // Count total active users
4982 4980
     $totalUsers = DB::queryFirstField(
4983
-        'SELECT COUNT(*) FROM ' . prefixTable('users') . '
4981
+        'SELECT COUNT(*) FROM '.prefixTable('users').'
4984 4982
          WHERE disabled = 0
4985 4983
          AND private_key IS NOT NULL
4986 4984
          AND private_key != "none"'
@@ -4989,8 +4987,8 @@  discard block
 block discarded – undo
4989 4987
     // Get recent recovery events (last 10)
4990 4988
     $recentEvents = DB::query(
4991 4989
         'SELECT l.date, l.label, l.qui, u.login
4992
-         FROM ' . prefixTable('log_system') . ' AS l
4993
-         INNER JOIN ' . prefixTable('users') . ' AS u ON u.id = l.qui
4990
+         FROM ' . prefixTable('log_system').' AS l
4991
+         INNER JOIN ' . prefixTable('users').' AS u ON u.id = l.qui
4994 4992
          WHERE l.label IN %ls
4995 4993
          ORDER BY l.date DESC
4996 4994
          LIMIT 10',
@@ -5002,7 +5000,7 @@  discard block
 block discarded – undo
5002 5000
 
5003 5001
     // Calculate failure rate (last 30 days)
5004 5002
     $totalAttempts30d = DB::queryFirstField(
5005
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
5003
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
5006 5004
          WHERE label IN %ls
5007 5005
          AND date > %i',
5008 5006
         ['auto_reencryption_success', 'auto_reencryption_failed'],
@@ -5010,7 +5008,7 @@  discard block
 block discarded – undo
5010 5008
     );
5011 5009
 
5012 5010
     $failures30d = DB::queryFirstField(
5013
-        'SELECT COUNT(*) FROM ' . prefixTable('log_system') . '
5011
+        'SELECT COUNT(*) FROM '.prefixTable('log_system').'
5014 5012
          WHERE label = %s
5015 5013
          AND date > %i',
5016 5014
         'auto_reencryption_failed',
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) {
75 75
     // Not allowed page
76 76
     $session->set('system-error_code', ERR_NOT_ALLOWED);
77
-    include $SETTINGS['cpassman_dir'] . '/error.php';
77
+    include $SETTINGS['cpassman_dir'].'/error.php';
78 78
     exit;
79 79
 }
80 80
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
         // Get info about user to modify
147 147
         $targetUserInfos = DB::queryFirstRow(
148
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
148
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
149 149
             WHERE id = %i',
150 150
             (int) $dataReceived['user_id']
151 151
         );
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             // Check if user already exists
278 278
             $data = DB::query(
279 279
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
280
-                FROM ' . prefixTable('users') . '
280
+                FROM ' . prefixTable('users').'
281 281
                 WHERE login = %s
282 282
                 AND deleted_at IS NULL',
283 283
                 $login
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
             }
493 493
 
494 494
             // Prepare variables
495
-            $userId  = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
495
+            $userId = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
496 496
 
497 497
             if (empty($userId)) {
498 498
                 echo prepareExchangedData(
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
             // Get info about user to delete
509 509
             $data_user = DB::queryFirstRow(
510
-                'SELECT login, admin, isAdministratedByRole FROM ' . prefixTable('users') . '
510
+                'SELECT login, admin, isAdministratedByRole FROM '.prefixTable('users').'
511 511
                 WHERE id = %i',
512 512
                 $userId 
513 513
             );        
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
                     || ((int) $session->get('user-can_manage_all_users') === 1 && (int) $data_user['admin'] !== 1)
525 525
                 ) {
526 526
                     $timestamp = time();
527
-                    $deletedSuffix = '_deleted_' . $timestamp;
527
+                    $deletedSuffix = '_deleted_'.$timestamp;
528 528
 
529 529
                     // delete user in database
530 530
                     DB::update(
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
                 echo prepareExchangedData(
663 663
                     [
664 664
                         'error' => true,
665
-                        'message' => $lang->get('error') . ': ' . $e->getMessage(),
665
+                        'message' => $lang->get('error').': '.$e->getMessage(),
666 666
                     ],
667 667
                     'encode'
668 668
                 );
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
             $return = array();
677 677
             // Check if folder exists
678 678
             $data = DB::query(
679
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
679
+                'SELECT * FROM '.prefixTable('nested_tree').'
680 680
                 WHERE title = %s AND parent_id = %i',
681 681
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
682 682
                 '0'
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
             }
690 690
             // Check if role exists
691 691
             $data = DB::query(
692
-                'SELECT * FROM ' . prefixTable('roles_title') . '
692
+                'SELECT * FROM '.prefixTable('roles_title').'
693 693
                 WHERE title = %s',
694 694
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
695 695
             );
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
             // Get info about user to delete
719 719
             $data_user = DB::queryFirstRow(
720 720
                 'SELECT admin, isAdministratedByRole, gestionnaire
721
-                FROM ' . prefixTable('users') . '
721
+                FROM ' . prefixTable('users').'
722 722
                 WHERE id = %i',
723 723
                 $post_user_id
724 724
             );
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
             // Get info about user
775 775
             $rowUser = DB::queryFirstRow(
776 776
                 'SELECT *
777
-                FROM ' . prefixTable('users') . '
777
+                FROM ' . prefixTable('users').'
778 778
                 WHERE id = %i',
779 779
                 $post_id
780 780
             );
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
                 $session->set('user-roles_array', explode(';', $session->get('user-roles')));
803 803
                 $rows = DB::query('
804 804
                     SELECT id,title,creator_id 
805
-                    FROM ' . prefixTable('roles_title') .'
805
+                    FROM ' . prefixTable('roles_title').'
806 806
                     WHERE id IN %li',
807 807
                     $session->get('user-roles_array')
808 808
                 );
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
                 $rolesList = array();
841 841
                 $managedBy = array();
842 842
                 $selected = '';
843
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
843
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
844 844
                 foreach ($rows as $reccord) {
845 845
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
846 846
                 }
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
                         array_push(
872 872
                             $managedBy,
873 873
                             array(
874
-                                'title' => $lang->get('managers_of') . ' ' . $fonction['title'],
874
+                                'title' => $lang->get('managers_of').' '.$fonction['title'],
875 875
                                 'id' => $fonction['id'],
876 876
                                 'selected' => $selected,
877 877
                             )
@@ -953,9 +953,9 @@  discard block
 block discarded – undo
953 953
 
954 954
                 // get USER STATUS
955 955
                 if ($rowUser['disabled'] == 1) {
956
-                    $arrData['info'] = $lang->get('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . $lang->get('user_info_unlock_question') . '</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . $lang->get('user_info_delete_question') . '</label>';
956
+                    $arrData['info'] = $lang->get('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.$lang->get('user_info_unlock_question').'</label><br><input type="checkbox"  value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.$lang->get('user_info_delete_question').'</label>';
957 957
                 } else {
958
-                    $arrData['info'] = $lang->get('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . $lang->get('user_info_lock_question');
958
+                    $arrData['info'] = $lang->get('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.$lang->get('user_info_lock_question');
959 959
                 }
960 960
 
961 961
                 $arrData['error'] = false;
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 
1043 1043
             // Get info about user to modify
1044 1044
             $data_user = DB::queryFirstRow(
1045
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
1045
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
1046 1046
                 WHERE id = %i',
1047 1047
                 $post_id
1048 1048
             );
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
                 // count number of admins
1054 1054
                 $users = DB::query(
1055 1055
                     'SELECT id
1056
-                    FROM ' . prefixTable('users') . '
1056
+                    FROM ' . prefixTable('users').'
1057 1057
                     WHERE admin = 1 AND email != "" AND pw != "" AND id != %i',
1058 1058
                     $post_id
1059 1059
                 );
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
             // Exclude roles from AD - PR #3635
1077 1077
             $adRoles = DB::query(
1078 1078
                 'SELECT roles_from_ad_groups
1079
-                FROM ' . prefixTable('users') . '
1079
+                FROM ' . prefixTable('users').'
1080 1080
                 WHERE id = %i',
1081 1081
                 $post_id
1082 1082
             )[0]['roles_from_ad_groups'];
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
                     );
1179 1179
                     // delete personal folder and subfolders
1180 1180
                     $data = DB::queryFirstRow(
1181
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1181
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1182 1182
                         WHERE title = %s AND personal_folder = %i',
1183 1183
                         $post_id,
1184 1184
                         '1'
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1192 1192
                             // delete items & logs
1193 1193
                             $items = DB::query(
1194
-                                'SELECT id FROM ' . prefixTable('items') . '
1194
+                                'SELECT id FROM '.prefixTable('items').'
1195 1195
                                 WHERE id_tree=%i AND perso = %i',
1196 1196
                                 $folder->id,
1197 1197
                                 '1'
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
                 } else {
1213 1213
                     // Get old data about user
1214 1214
                     $oldData = DB::queryFirstRow(
1215
-                        'SELECT * FROM ' . prefixTable('users') . '
1215
+                        'SELECT * FROM '.prefixTable('users').'
1216 1216
                         WHERE id = %i',
1217 1217
                         $post_id
1218 1218
                     );
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 
1250 1250
                     // update LOG
1251 1251
                     if ($oldData['email'] !== $post_email) {
1252
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id);
1252
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id);
1253 1253
                     }
1254 1254
                 }
1255 1255
                 echo prepareExchangedData(
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
             }
1298 1298
 
1299 1299
             DB::queryFirstRow(
1300
-                'SELECT * FROM ' . prefixTable('users') . '
1300
+                'SELECT * FROM '.prefixTable('users').'
1301 1301
                 WHERE login = %s
1302 1302
                 AND deleted_at IS NULL',
1303 1303
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
             // get User info
1350 1350
             $rowUser = DB::queryFirstRow(
1351 1351
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb, roles_from_ad_groups
1352
-                FROM ' . prefixTable('users') . '
1352
+                FROM ' . prefixTable('users').'
1353 1353
                 WHERE id = %i',
1354 1354
                 $post_id
1355 1355
             );
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
             $html = '';
1360 1360
 
1361 1361
             if (isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) {
1362
-                $rowUser['fonction_id'] = empty($rowUser['fonction_id'])  === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id']. ';' . $rowUser['roles_from_ad_groups'];
1362
+                $rowUser['fonction_id'] = empty($rowUser['fonction_id']) === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id'].';'.$rowUser['roles_from_ad_groups'];
1363 1363
             }
1364 1364
             $arrData['functions'] = array_filter(explode(';', $rowUser['fonction_id']));
1365 1365
             $arrData['allowed_folders'] = array_filter(explode(';', $rowUser['groupes_visibles']));
@@ -1370,8 +1370,8 @@  discard block
 block discarded – undo
1370 1370
                 // refine folders based upon roles
1371 1371
                 $rows = DB::query(
1372 1372
                     'SELECT rv.folder_id, rv.type
1373
-                    FROM ' . prefixTable('roles_values') . ' as rv
1374
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as nt ON rv.folder_id = nt.id
1373
+                    FROM ' . prefixTable('roles_values').' as rv
1374
+                    INNER JOIN ' . prefixTable('nested_tree').' as nt ON rv.folder_id = nt.id
1375 1375
                     WHERE rv.role_id IN %ls AND nt.personal_folder = 0
1376 1376
                     ORDER BY rv.folder_id ASC',
1377 1377
                     $arrData['functions']
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
                 }
1395 1395
 
1396 1396
                 // add allowed folders
1397
-                foreach($arrData['allowed_folders'] as $Fld) {
1397
+                foreach ($arrData['allowed_folders'] as $Fld) {
1398 1398
                     array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true));
1399 1399
                 }
1400 1400
                 
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
                             // get folder name
1406 1406
                             $row = DB::queryFirstRow(
1407 1407
                                 'SELECT title, nlevel, id
1408
-                                FROM ' . prefixTable('nested_tree') . '
1408
+                                FROM ' . prefixTable('nested_tree').'
1409 1409
                                 WHERE id = %i',
1410 1410
                                 $fld['id']
1411 1411
                             );
@@ -1418,38 +1418,38 @@  discard block
 block discarded – undo
1418 1418
 
1419 1419
                             // manage right icon
1420 1420
                             if ($fld['type'] == 'W') {
1421
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . $lang->get('write') . '"></i>' .
1422
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' .
1423
-                                    '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>';
1421
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.$lang->get('write').'"></i>'.
1422
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'.
1423
+                                    '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>';
1424 1424
                             } elseif ($fld['type'] == 'ND') {
1425
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1426
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' .
1427
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>';
1425
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1426
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'.
1427
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>';
1428 1428
                             } elseif ($fld['type'] == 'NE') {
1429
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1430
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' .
1431
-                                    '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>';
1429
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1430
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'.
1431
+                                    '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>';
1432 1432
                             } elseif ($fld['type'] == 'NDNE') {
1433
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1434
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' .
1435
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>';
1433
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1434
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'.
1435
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>';
1436 1436
                             } elseif ($fld['type'] == '') {
1437
-                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="' . $lang->get('no_access') . '"></i>';
1437
+                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="'.$lang->get('no_access').'"></i>';
1438 1438
                             } else {
1439
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . $lang->get('read') . '"></i>';
1439
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.$lang->get('read').'"></i>';
1440 1440
                             }
1441 1441
 
1442
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1443
-                                ' <small class="text-info">[' . $row['id'] . ']</small>'.
1444
-                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . $lang->get('user_specific_right') . '"></i>' : '').
1445
-                                '</td><td>' . $label . '</td></tr>';
1442
+                            $html .= '<tr><td>'.$ident.$row['title'].
1443
+                                ' <small class="text-info">['.$row['id'].']</small>'.
1444
+                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.$lang->get('user_specific_right').'"></i>' : '').
1445
+                                '</td><td>'.$label.'</td></tr>';
1446 1446
                             break;
1447 1447
                         }
1448 1448
                     }
1449 1449
                 }
1450 1450
 
1451
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1452
-                    $html . '</tbody></table>';
1451
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1452
+                    $html.'</tbody></table>';
1453 1453
             } else {
1454 1454
                 $html_full = '';
1455 1455
             }
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
             if ((int) $session->get('user-admin') === 0 && (int) $session->get('user-can_manage_all_users') === 0) {
1496 1496
                 $rows = DB::query(
1497 1497
                     'SELECT *
1498
-                    FROM ' . prefixTable('users') . '
1498
+                    FROM ' . prefixTable('users').'
1499 1499
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1500 1500
                     '0',
1501 1501
                     array_filter($session->get('user-roles_array'))
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
             } else {
1504 1504
                 $rows = DB::query(
1505 1505
                     'SELECT *
1506
-                    FROM ' . prefixTable('users') . '
1506
+                    FROM ' . prefixTable('users').'
1507 1507
                     WHERE admin = %i',
1508 1508
                     '0'
1509 1509
                 );
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
                 $groupIds = [];
1516 1516
                 foreach (explode(';', $record['fonction_id']) as $group) {
1517 1517
                     $tmp = DB::queryFirstRow(
1518
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1518
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1519 1519
                         WHERE id = %i',
1520 1520
                         $group
1521 1521
                     );
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
                 // Get managed_by
1529 1529
                 $managedBy = DB::queryFirstRow(
1530
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1530
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1531 1531
                     WHERE id = %i',
1532 1532
                     $record['isAdministratedByRole']
1533 1533
                 );
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
                 $foldersAllowedIds = [];
1538 1538
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1539 1539
                     $tmp = DB::queryFirstRow(
1540
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1540
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1541 1541
                         WHERE id = %i',
1542 1542
                         $role
1543 1543
                     );
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
                 $foldersForbiddenIds = [];
1551 1551
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1552 1552
                     $tmp = DB::queryFirstRow(
1553
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1553
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1554 1554
                         WHERE id = %i',
1555 1555
                         $role
1556 1556
                     );
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
                         'login' => $record['login'],
1569 1569
                         'groups' => implode(', ', $groups),
1570 1570
                         'groupIds' => $groupIds,
1571
-                        'managedBy' => $managedBy=== null ? $lang->get('administrator') : $managedBy['title'],
1571
+                        'managedBy' => $managedBy === null ? $lang->get('administrator') : $managedBy['title'],
1572 1572
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1573 1573
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1574 1574
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
 
1670 1670
             // Get info about user
1671 1671
             $data_user = DB::queryFirstRow(
1672
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1672
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1673 1673
                 WHERE id = %i',
1674 1674
                 $inputData['source_id']
1675 1675
             );
@@ -1901,14 +1901,14 @@  discard block
 block discarded – undo
1901 1901
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
1902 1902
                 $data_user = DB::queryFirstRow(
1903 1903
                     'SELECT fonction_id, public_key
1904
-                    FROM ' . prefixTable('users') . '
1904
+                    FROM ' . prefixTable('users').'
1905 1905
                     WHERE id = %i',
1906 1906
                     $post_user_id
1907 1907
                 );
1908 1908
 
1909 1909
                 if ($data_user) {
1910 1910
                     // Ensure array is unique
1911
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
1911
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
1912 1912
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
1913 1913
                 } else {
1914 1914
                     // User not found
@@ -1924,14 +1924,14 @@  discard block
 block discarded – undo
1924 1924
             }
1925 1925
 
1926 1926
             // Manage specific case of api key
1927
-            if($post_field === 'user_api_key') {
1927
+            if ($post_field === 'user_api_key') {
1928 1928
                 $encrypted_key = encryptUserObjectKey(base64_encode($post_new_value), $session->get('user-public_key'));
1929 1929
                 $session->set('user-api_key', $post_new_value);
1930 1930
 
1931 1931
                 // test if user has an api key
1932 1932
                 $data_user = DB::queryFirstRow(
1933 1933
                     'SELECT value
1934
-                    FROM ' . prefixTable('api') . '
1934
+                    FROM ' . prefixTable('api').'
1935 1935
                     WHERE user_id = %i',
1936 1936
                     $post_user_id
1937 1937
                 );
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
             } catch (\LdapRecord\Auth\BindException $e) {
2052 2052
                 $error = $e->getDetailedError();
2053 2053
                 if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2054
-                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2054
+                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2055 2055
                 }
2056 2056
                 // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending
2057 2057
                 echo prepareExchangedData(
@@ -2081,7 +2081,7 @@  discard block
 block discarded – undo
2081 2081
             } catch (\LdapRecord\Auth\BindException $e) {
2082 2082
                 $error = $e->getDetailedError();
2083 2083
                 if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2084
-                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2084
+                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2085 2085
                 }
2086 2086
                 // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending
2087 2087
                 echo prepareExchangedData(
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
                 if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue;
2099 2099
                 // Build the list of all groups in AD
2100 2100
                 if (isset($adUser['memberof']) === true) {
2101
-                    foreach($adUser['memberof'] as $j => $adUserGroup) {
2101
+                    foreach ($adUser['memberof'] as $j => $adUserGroup) {
2102 2102
                         if (empty($adUserGroup) === false && $j !== "count") {
2103 2103
                             $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2104 2104
                             if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
                     // Get his ID
2115 2115
                     $userInfo = DB::queryFirstRow(
2116 2116
                         'SELECT id, login, fonction_id, auth_type
2117
-                        FROM ' . prefixTable('users') . '
2117
+                        FROM ' . prefixTable('users').'
2118 2118
                         WHERE login = %s',
2119 2119
                         $userLogin
2120 2120
                     );
@@ -2150,7 +2150,7 @@  discard block
 block discarded – undo
2150 2150
 
2151 2151
             // Get all groups in Teampass
2152 2152
             $teampassRoles = array();
2153
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2153
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2154 2154
             foreach ($rows as $record) {
2155 2155
                 array_push(
2156 2156
                     $teampassRoles,
@@ -2215,7 +2215,7 @@  discard block
 block discarded – undo
2215 2215
             // Check if user already exists
2216 2216
             $data = DB::query(
2217 2217
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2218
-                FROM ' . prefixTable('users') . '
2218
+                FROM ' . prefixTable('users').'
2219 2219
                 WHERE login = %s',
2220 2220
                 $post_login
2221 2221
             );
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
             // Check if user already exists
2404 2404
             DB::query(
2405 2405
                 'SELECT id
2406
-                FROM ' . prefixTable('users') . '
2406
+                FROM ' . prefixTable('users').'
2407 2407
                 WHERE id = %i',
2408 2408
                 $post_id
2409 2409
             );
@@ -2465,7 +2465,7 @@  discard block
 block discarded – undo
2465 2465
             // Get all groups in Teampass
2466 2466
             $teampassRoles = array();
2467 2467
             $titleToIdMap = [];
2468
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2468
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2469 2469
             foreach ($rows as $record) {
2470 2470
                 array_push(
2471 2471
                     $teampassRoles,
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
                     // Get his ID
2512 2512
                     $userInfo = DB::queryFirstRow(
2513 2513
                         'SELECT id, login, fonction_id, auth_type
2514
-                        FROM ' . prefixTable('users') . '
2514
+                        FROM ' . prefixTable('users').'
2515 2515
                         WHERE login = %s',
2516 2516
                         $userLogin
2517 2517
                     );
@@ -2618,7 +2618,7 @@  discard block
 block discarded – undo
2618 2618
             // Check if user already exists
2619 2619
             DB::query(
2620 2620
                 'SELECT id
2621
-                FROM ' . prefixTable('users') . '
2621
+                FROM ' . prefixTable('users').'
2622 2622
                 WHERE id = %i',
2623 2623
                 $post_id
2624 2624
             );
@@ -2684,7 +2684,7 @@  discard block
 block discarded – undo
2684 2684
             // Search TP_USER in db        
2685 2685
             $userTP = DB::queryFirstRow(
2686 2686
                 'SELECT pw
2687
-                FROM ' . prefixTable('users') . '
2687
+                FROM ' . prefixTable('users').'
2688 2688
                 WHERE id = %i',
2689 2689
                 TP_USER_ID
2690 2690
             );
@@ -2707,7 +2707,7 @@  discard block
 block discarded – undo
2707 2707
                     'arguments' => json_encode([
2708 2708
                         'new_user_id' => (int) $post_user_id,
2709 2709
                         'new_user_pwd' => '',
2710
-                        'new_user_code' => cryption($post_user_code, '','encrypt', $SETTINGS)['string'],
2710
+                        'new_user_code' => cryption($post_user_code, '', 'encrypt', $SETTINGS)['string'],
2711 2711
                         'owner_id' => (int) TP_USER_ID,
2712 2712
                         'creator_pwd' => $userTP['pw'],
2713 2713
                         'email_body' => $lang->get('email_body_user_config_5'),
@@ -2814,17 +2814,17 @@  discard block
 block discarded – undo
2814 2814
             // get user info
2815 2815
             $processesProgress = DB::query(
2816 2816
                 'SELECT u.ongoing_process_id, pt.task, pt.updated_at, pt.finished_at, pt.is_in_progress
2817
-                FROM ' . prefixTable('users') . ' AS u
2818
-                INNER JOIN ' . prefixTable('background_subtasks') . ' AS pt ON (pt.task_id = u.ongoing_process_id)
2817
+                FROM ' . prefixTable('users').' AS u
2818
+                INNER JOIN ' . prefixTable('background_subtasks').' AS pt ON (pt.task_id = u.ongoing_process_id)
2819 2819
                 WHERE u.id = %i',
2820 2820
                 $user_id
2821 2821
             );
2822 2822
 
2823 2823
             $finished_steps = 0;
2824 2824
             $nb_steps = count($processesProgress);
2825
-            foreach($processesProgress as $process) {
2825
+            foreach ($processesProgress as $process) {
2826 2826
                 if ((int) $process['is_in_progress'] === -1) {
2827
-                    $finished_steps ++;
2827
+                    $finished_steps++;
2828 2828
                 }
2829 2829
             }
2830 2830
 
@@ -2833,7 +2833,7 @@  discard block
 block discarded – undo
2833 2833
                     'error' => false,
2834 2834
                     'message' => '',
2835 2835
                     'user_id' => $user_id,
2836
-                    'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps/$nb_steps*100, 0).'%',
2836
+                    'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps / $nb_steps * 100, 0).'%',
2837 2837
                     'debug' => $finished_steps.",".$nb_steps,
2838 2838
                 ),
2839 2839
                 'encode'
@@ -3001,13 +3001,13 @@  discard block
 block discarded – undo
3001 3001
 
3002 3002
             // Prepare variables
3003 3003
             $daysRetention = filter_var($dataReceived['days_retention'], FILTER_SANITIZE_NUMBER_INT);
3004
-            $daysRetention = empty($daysRetention) ? 90 : (int)$daysRetention;
3004
+            $daysRetention = empty($daysRetention) ? 90 : (int) $daysRetention;
3005 3005
             $cutoffTimestamp = time() - ($daysRetention * 86400);
3006 3006
             
3007 3007
             try {
3008 3008
                 // Get list of users to delete
3009 3009
                 $users = DB::query(
3010
-                    "SELECT id FROM " . prefixTable("users") . " 
3010
+                    "SELECT id FROM ".prefixTable("users")." 
3011 3011
                     WHERE deleted_at IS NOT NULL 
3012 3012
                     AND deleted_at > 0
3013 3013
                     AND deleted_at < %i
@@ -3031,7 +3031,7 @@  discard block
 block discarded – undo
3031 3031
                 echo prepareExchangedData(
3032 3032
                     [
3033 3033
                         'error' => true,
3034
-                        'message' => $lang->get('error') . ': ' . $e->getMessage(),
3034
+                        'message' => $lang->get('error').': '.$e->getMessage(),
3035 3035
                     ],
3036 3036
                     'encode'
3037 3037
                 );
@@ -3085,10 +3085,10 @@  discard block
 block discarded – undo
3085 3085
             
3086 3086
             $purgedCount = 0;
3087 3087
             $errors = [];
3088
-            $cutoffTimestamp = time() - ((int)$daysRetention * 86400);        
3088
+            $cutoffTimestamp = time() - ((int) $daysRetention * 86400);        
3089 3089
                         
3090 3090
             foreach ($userIds as $userId) {
3091
-                $userId = (int)$userId;
3091
+                $userId = (int) $userId;
3092 3092
                 
3093 3093
                 try {
3094 3094
                     $result = purgeDeletedUserById($userId);
@@ -3096,7 +3096,7 @@  discard block
 block discarded – undo
3096 3096
                     
3097 3097
                 } catch (Exception $e) {
3098 3098
                     DB::rollback();
3099
-                    $errors[] = "User ID $userId: " . $e->getMessage();
3099
+                    $errors[] = "User ID $userId: ".$e->getMessage();
3100 3100
                 }
3101 3101
             }
3102 3102
             
@@ -3106,7 +3106,7 @@  discard block
 block discarded – undo
3106 3106
                     'purged_count' => $purgedCount,
3107 3107
                     'total_in_batch' => count($userIds),
3108 3108
                     'errors' => $errors,
3109
-                    'message' => $purgedCount . ' user(s) purged in this batch'
3109
+                    'message' => $purgedCount.' user(s) purged in this batch'
3110 3110
                 ],
3111 3111
                 'encode'
3112 3112
             );
@@ -3140,7 +3140,7 @@  discard block
 block discarded – undo
3140 3140
             
3141 3141
             // Get info about user
3142 3142
             $data_user = DB::queryFirstRow(
3143
-                'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i',
3143
+                'SELECT login FROM '.prefixTable('users').' WHERE id = %i',
3144 3144
                 $userId
3145 3145
             );
3146 3146
             
@@ -3153,7 +3153,7 @@  discard block
 block discarded – undo
3153 3153
             }
3154 3154
             
3155 3155
             // Remove user suffix "_deleted_timestamp"
3156
-            $deletedSuffix = '_deleted_' . substr($data_user['login'], strrpos($data_user['login'], '_deleted_') + 9);
3156
+            $deletedSuffix = '_deleted_'.substr($data_user['login'], strrpos($data_user['login'], '_deleted_') + 9);
3157 3157
             $originalLogin = str_replace($deletedSuffix, '', $data_user['login']);
3158 3158
             
3159 3159
             // Restore user
@@ -3182,7 +3182,7 @@  discard block
 block discarded – undo
3182 3182
 
3183 3183
     // Get info about user
3184 3184
     $data_user = DB::queryFirstRow(
3185
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3185
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3186 3186
         WHERE id = %i',
3187 3187
         $value[1]
3188 3188
     );
@@ -3216,7 +3216,7 @@  discard block
 block discarded – undo
3216 3216
             logEvents(
3217 3217
                 $SETTINGS,
3218 3218
                 'user_mngt',
3219
-                'at_user_new_' . $value[0] . ':' . $value[1],
3219
+                'at_user_new_'.$value[0].':'.$value[1],
3220 3220
                 (string) $session->get('user-id'),
3221 3221
                 $session->get('user-login'),
3222 3222
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
@@ -3251,7 +3251,7 @@  discard block
 block discarded – undo
3251 3251
 
3252 3252
     // Get info about user
3253 3253
     $data_user = DB::queryFirstRow(
3254
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3254
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3255 3255
         WHERE id = %i',
3256 3256
         $id[1]
3257 3257
     );
@@ -3290,7 +3290,7 @@  discard block
 block discarded – undo
3290 3290
     $users = DB::query(
3291 3291
         "SELECT id, login, email, deleted_at, 
3292 3292
                 DATEDIFF(NOW(), FROM_UNIXTIME(deleted_at)) as days_since_deletion
3293
-         FROM " . prefixTable("users") . " 
3293
+         FROM " . prefixTable("users")." 
3294 3294
          WHERE deleted_at IS NOT NULL 
3295 3295
          AND deleted_at > 0
3296 3296
          ORDER BY deleted_at DESC"
@@ -3316,7 +3316,7 @@  discard block
 block discarded – undo
3316 3316
     
3317 3317
     // Vérifier que l'utilisateur est bien marqué deleted
3318 3318
     $user = DB::queryFirstRow(
3319
-        "SELECT id, login, deleted_at FROM " . prefixTable("users") . " 
3319
+        "SELECT id, login, deleted_at FROM ".prefixTable("users")." 
3320 3320
          WHERE id = %i 
3321 3321
          AND deleted_at IS NOT NULL 
3322 3322
          AND deleted_at > 0",
@@ -3356,7 +3356,7 @@  discard block
 block discarded – undo
3356 3356
 
3357 3357
         // delete personal folder and subfolders
3358 3358
         $data = DB::queryFirstRow(
3359
-            'SELECT id FROM ' . prefixTable('nested_tree') . '
3359
+            'SELECT id FROM '.prefixTable('nested_tree').'
3360 3360
             WHERE title = %s AND personal_folder = %i',
3361 3361
             $userId,
3362 3362
             '1'
@@ -3378,7 +3378,7 @@  discard block
 block discarded – undo
3378 3378
                 DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
3379 3379
                 // delete items & logs
3380 3380
                 $items = DB::query(
3381
-                    'SELECT id FROM ' . prefixTable('items') . '
3381
+                    'SELECT id FROM '.prefixTable('items').'
3382 3382
                     WHERE id_tree=%i AND perso = %i',
3383 3383
                     $folder->id,
3384 3384
                     '1'
@@ -3408,7 +3408,7 @@  discard block
 block discarded – undo
3408 3408
         // Delete any process related to user
3409 3409
         $processes = DB::query(
3410 3410
             'SELECT increment_id
3411
-            FROM ' . prefixTable('background_tasks') . '
3411
+            FROM ' . prefixTable('background_tasks').'
3412 3412
             WHERE JSON_EXTRACT(arguments, "$.new_user_id") = %i',
3413 3413
             $userId
3414 3414
         );
Please login to merge, or discard this patch.
pages/users.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('users') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 // If administrator then all roles are shown
93 93
 // else only the Roles the users is associated to.
94 94
 if ((int) $session->get('user-admin') === 1) {
95
-    $optionsManagedBy .= '<option value="0">' . $lang->get('administrators_only') . '</option>';
95
+    $optionsManagedBy .= '<option value="0">'.$lang->get('administrators_only').'</option>';
96 96
 }
97 97
 
98 98
 $rows = DB::query(
99 99
     'SELECT id, title, creator_id
100
-    FROM ' . prefixTable('roles_title') . '
100
+    FROM ' . prefixTable('roles_title').'
101 101
     ORDER BY title ASC'
102 102
 );
103 103
 foreach ($rows as $record) {
104 104
     if ((int) $session->get('user-admin') === 1 || in_array($record['id'], $session->get('user-roles_array')) === true) {
105
-        $optionsManagedBy .= '<option value="' . $record['id'] . '">' . $lang->get('managers_of') . ' ' . addslashes($record['title']) . '</option>';
105
+        $optionsManagedBy .= '<option value="'.$record['id'].'">'.$lang->get('managers_of').' '.addslashes($record['title']).'</option>';
106 106
     }
107 107
     if (
108 108
         (int) $session->get('user-admin') === 1
109 109
         || (((int) $session->get('user-manager') === 1 || (int) $session->get('user-can_manage_all_users') === 1)
110 110
             && (in_array($record['id'], $userRoles) === true) || (int) $record['creator_id'] === (int) $session->get('user-id'))
111 111
     ) {
112
-        $optionsRoles .= '<option value="' . $record['id'] . '">' . addslashes($record['title']) . '</option>';
112
+        $optionsRoles .= '<option value="'.$record['id'].'">'.addslashes($record['title']).'</option>';
113 113
     }
114 114
 }
115 115
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         for ($y = 1; $y < $t->nlevel; ++$y) {
125 125
             $ident .= '&nbsp;&nbsp;';
126 126
         }
127
-        $foldersList .= '<option value="' . $t->id . '">' . $ident . htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8') . '</option>';
127
+        $foldersList .= '<option value="'.$t->id.'">'.$ident.htmlspecialchars($t->title, ENT_COMPAT, 'UTF-8').'</option>';
128 128
     }
129 129
 }
130 130
 
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
                         </button><?php
162 162
                                     echo isset($SETTINGS['ldap_mode']) === true && (int) $SETTINGS['ldap_mode'] === 1 && (int) $session->get('user-admin') === 1 ?
163 163
                                         '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="ldap-sync">
164
-                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization') . '
164
+                            <i class="fa-solid fa-address-card mr-2"></i>' . $lang->get('ldap_synchronization').'
165 165
                         </button>' : '';
166 166
                                     ?>
167 167
                         </button><?php
168 168
                                     echo isset($SETTINGS['oauth2_enabled']) === true && (int) $SETTINGS['oauth2_enabled'] === 1 && (int) $session->get('user-admin') === 1 ?
169 169
                                         '<button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="oauth2-sync">
170
-                            <i class="fa-solid fa-plug mr-2"></i>' . $lang->get('oauth2_synchronization') . '
170
+                            <i class="fa-solid fa-plug mr-2"></i>' . $lang->get('oauth2_synchronization').'
171 171
                         </button>' : '';
172 172
                                     ?>
173 173
                         <button type="button" class="btn btn-primary btn-sm tp-action mr-2" data-action="deleted-users">
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
                 <!-- /.card-header -->
179 179
                 <div class="card-body form user-content" id="users-list" data-content="refresh">
180
-                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons');?></span></label>
180
+                    <label><input type="checkbox" id="warnings_display" class="tp-action pointer" data-action="refresh"><span class="ml-2 pointer"><?php echo $lang->get('display_warning_icons'); ?></span></label>
181 181
                     <table id="table-users" class="table table-striped nowrap table-responsive-sm">
182 182
                         <thead>
183 183
                             <tr>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                                             <?php
242 242
                                             foreach (TP_PW_COMPLEXITY as $entry) {
243 243
                                                 echo '
244
-                                            <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
244
+                                            <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
245 245
                                             }
246 246
                                             ?>
247 247
                                         </select>
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
                                             <?php
319 319
                                             foreach (TP_PW_COMPLEXITY as $entry) {
320 320
                                                 echo '
321
-                                            <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
321
+                                            <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
322 322
                                             }
323 323
                                             ?>
324 324
                                         </select>
Please login to merge, or discard this patch.
pages/admin.js.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
69 69
     // Not allowed page
70 70
     $session->set('system-error_code', ERR_NOT_ALLOWED);
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                     // error
154 154
                     toastr.remove();
155 155
                     toastr.error(
156
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
156
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
157 157
                         '', {
158 158
                             closeButton: true,
159 159
                             positionClass: 'toast-bottom-right'
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                     // error
276 276
                     toastr.remove();
277 277
                     toastr.error(
278
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
278
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
279 279
                         '', {
280 280
                             closeButton: true,
281 281
                             positionClass: 'toast-bottom-right'
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             // error
341 341
             toastr.remove();
342 342
             toastr.error(
343
-                '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
343
+                '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
344 344
                 '', {
345 345
                     closeButton: true,
346 346
                     positionClass: 'toast-bottom-right'
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                     // error
552 552
                     toastr.remove();
553 553
                     toastr.error(
554
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
554
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
555 555
                         '', {
556 556
                             closeButton: true,
557 557
                             positionClass: 'toast-bottom-right'
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
                     // error
651 651
                     toastr.remove();
652 652
                     toastr.error(
653
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
653
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
654 654
                         '', {
655 655
                             closeButton: true,
656 656
                             positionClass: 'toast-bottom-right'
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
                     
680 680
                     //const className = result.success ? 'success' : 'error';
681 681
                     const icon = result.success ? '<i class="fa-solid fa-check text-success mr-1"></i>' : '<i class="fa-solid fa-xmark text-danger mr-1"></i>';
682
-                    const message = result.success ? '<?php echo $lang->get('server_returned_data');?>' : 'Error: ' + result.error;
682
+                    const message = result.success ? '<?php echo $lang->get('server_returned_data'); ?>' : 'Error: ' + result.error;
683 683
                     
684 684
                     output += '<li>' + icon + '<b>' + file + '</b><br/>' + message + '</li>';
685 685
                 });
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
                     // error
711 711
                     toastr.remove();
712 712
                     toastr.error(
713
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
713
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
714 714
                         '', {
715 715
                             closeButton: true,
716 716
                             positionClass: 'toast-bottom-right'
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
                     // error
775 775
                     toastr.remove();
776 776
                     toastr.error(
777
-                        '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + data.error,
777
+                        '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + data.error,
778 778
                         '', {
779 779
                             closeButton: true,
780 780
                             positionClass: 'toast-bottom-right'
Please login to merge, or discard this patch.