Passed
Pull Request — master (#4551)
by Nils
06:28
created
sources/main.functions.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2226,7 +2226,7 @@
 block discarded – undo
2226 2226
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2227 2227
  *
2228 2228
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2229
-  *
2229
+ *
2230 2230
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2231 2231
  * @param int    $filePerm The permissions any found files should get.
2232 2232
  * @param int    $dirPerm  The permissions any found folder should get.
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2366,7 +2366,9 @@  discard block
 block discarded – undo
2366 2366
 function encryptUserObjectKey(string $key, string $publicKey): string
2367 2367
 {
2368 2368
     // Empty password
2369
-    if (empty($key)) return '';
2369
+    if (empty($key)) {
2370
+        return '';
2371
+    }
2370 2372
 
2371 2373
     // Sanitize
2372 2374
     $antiXss = new AntiXSS();
@@ -2515,7 +2517,9 @@  discard block
 block discarded – undo
2515 2517
         ];
2516 2518
     }
2517 2519
 
2518
-    if (WIP) error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
2520
+    if (WIP) {
2521
+        error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
2522
+    }
2519 2523
 
2520 2524
     // Decrypt file content and return
2521 2525
     return base64_encode($cipher->decrypt($ciphertext));
@@ -2650,7 +2654,9 @@  discard block
 block discarded – undo
2650 2654
         foreach ($users as $user) {
2651 2655
             // Insert in DB the new object key for this item by user
2652 2656
             if (count($objectKeyArray) === 0) {
2653
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2657
+                if (WIP === true) {
2658
+                    error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2659
+                }
2654 2660
                 DB::insert(
2655 2661
                     $object_name,
2656 2662
                     [
@@ -2664,7 +2670,9 @@  discard block
 block discarded – undo
2664 2670
                 );
2665 2671
             } else {
2666 2672
                 foreach ($objectKeyArray as $object) {
2667
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2673
+                    if (WIP === true) {
2674
+                        error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2675
+                    }
2668 2676
                     DB::insert(
2669 2677
                         $object_name,
2670 2678
                         [
@@ -3990,7 +3998,9 @@  discard block
 block discarded – undo
3990 3998
         $taskName = [$taskName];
3991 3999
     }
3992 4000
     foreach($taskName as $task) {
3993
-        if (WIP === true) error_log('createTaskForItem - task: '.$task);
4001
+        if (WIP === true) {
4002
+            error_log('createTaskForItem - task: '.$task);
4003
+        }
3994 4004
         switch ($task) {
3995 4005
             case 'item_password':
3996 4006
                 
@@ -4421,19 +4431,22 @@  discard block
 block discarded – undo
4421 4431
 
4422 4432
             // Organisation name (removed username@ and .tld)
4423 4433
             $domain = explode('.', $emailParts[1]);
4424
-            if (count($domain) > 1)
4425
-                $forbiddenWords[] = $domain[0];
4434
+            if (count($domain) > 1) {
4435
+                            $forbiddenWords[] = $domain[0];
4436
+            }
4426 4437
         }
4427 4438
     }
4428 4439
 
4429 4440
     // Search forbidden words in password
4430 4441
     foreach ($forbiddenWords as $word) {
4431
-        if (empty($word))
4432
-            continue;
4442
+        if (empty($word)) {
4443
+                    continue;
4444
+        }
4433 4445
 
4434 4446
         // Stop if forbidden word found in password
4435
-        if (stripos($password, $word) !== false)
4436
-            return false;
4447
+        if (stripos($password, $word) !== false) {
4448
+                    return false;
4449
+        }
4437 4450
     }
4438 4451
 
4439 4452
     // Get password complexity
Please login to merge, or discard this patch.
Spacing   +150 added lines, -152 removed lines patch added patch discarded remove patch
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
             $text = Crypto::decrypt($message, $key);
135 135
         }
136 136
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
137
-        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: ' . $ex->getMessage());
137
+        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: '.$ex->getMessage());
138 138
         $err = 'wrong_key_or_modified_ciphertext';
139 139
     } catch (CryptoException\BadFormatException $ex) {
140
-        error_log('TEAMPASS-Error-Bad format exception: ' . $ex->getMessage());
140
+        error_log('TEAMPASS-Error-Bad format exception: '.$ex->getMessage());
141 141
         $err = 'bad_format';
142 142
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
143
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
143
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
144 144
         $err = 'environment_error';
145 145
     } catch (CryptoException\IOException $ex) {
146
-        error_log('TEAMPASS-Error-IO: ' . $ex->getMessage());
146
+        error_log('TEAMPASS-Error-IO: '.$ex->getMessage());
147 147
         $err = 'io_error';
148 148
     } catch (Exception $ex) {
149
-        error_log('TEAMPASS-Error-Unexpected exception: ' . $ex->getMessage());
149
+        error_log('TEAMPASS-Error-Unexpected exception: '.$ex->getMessage());
150 150
         $err = 'unexpected_error';
151 151
     }
152 152
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function trimElement($chaine, string $element): string
233 233
 {
234
-    if (! empty($chaine)) {
234
+    if (!empty($chaine)) {
235 235
         if (is_array($chaine) === true) {
236 236
             $chaine = implode(';', $chaine);
237 237
         }
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
  */
280 280
 function db_error_handler(array $params): void
281 281
 {
282
-    echo 'Error: ' . $params['error'] . "<br>\n";
283
-    echo 'Query: ' . $params['query'] . "<br>\n";
282
+    echo 'Error: '.$params['error']."<br>\n";
283
+    echo 'Query: '.$params['query']."<br>\n";
284 284
     throw new Exception('Error - Query', 1);
285 285
 }
286 286
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     $session->set('user-forbiden_personal_folders', []);
359 359
     
360 360
     // Get list of Folders
361
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
361
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
362 362
     foreach ($rows as $record) {
363 363
         array_push($groupesVisibles, $record['id']);
364 364
     }
@@ -368,20 +368,20 @@  discard block
 block discarded – undo
368 368
     // get complete list of ROLES
369 369
     $tmp = explode(';', $idFonctions);
370 370
     $rows = DB::query(
371
-        'SELECT * FROM ' . prefixTable('roles_title') . '
371
+        'SELECT * FROM '.prefixTable('roles_title').'
372 372
         ORDER BY title ASC'
373 373
     );
374 374
     foreach ($rows as $record) {
375
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
375
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
376 376
             array_push($tmp, $record['id']);
377 377
         }
378 378
     }
379 379
     $session->set('user-roles', implode(';', $tmp));
380 380
     $session->set('user-admin', 1);
381 381
     // Check if admin has created Folders and Roles
382
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
382
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
383 383
     $session->set('user-nb_folders', DB::count());
384
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
384
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
385 385
     $session->set('user-nb_roles', DB::count());
386 386
 
387 387
     return true;
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     // Does this user is allowed to see other items
465 465
     $inc = 0;
466 466
     $rows = DB::query(
467
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
467
+        'SELECT id, id_tree FROM '.prefixTable('items').'
468 468
             WHERE restricted_to LIKE %ss AND inactif = %s'.
469 469
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
470 470
         $globalsUserId,
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
     // Check for the users roles if some specific rights exist on items
482 482
     $rows = DB::query(
483 483
         'SELECT i.id_tree, r.item_id
484
-        FROM ' . prefixTable('items') . ' as i
485
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
484
+        FROM ' . prefixTable('items').' as i
485
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
486 486
         WHERE i.id_tree <> "" '.
487 487
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
488 488
         'ORDER BY i.id_tree ASC',
@@ -536,16 +536,16 @@  discard block
 block discarded – undo
536 536
         ), SORT_NUMERIC)
537 537
     );
538 538
     // Folders and Roles numbers
539
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
539
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
540 540
     $session->set('user-nb_folders', DB::count());
541
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
541
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
542 542
     $session->set('user-nb_roles', DB::count());
543 543
     // check if change proposals on User's items
544 544
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
545 545
         $countNewItems = DB::query(
546 546
             'SELECT COUNT(*)
547
-            FROM ' . prefixTable('items_change') . ' AS c
548
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
547
+            FROM ' . prefixTable('items_change').' AS c
548
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
549 549
             WHERE i.action = %s AND i.id_user = %i',
550 550
             'at_creation',
551 551
             $globalsUserId
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 {
573 573
     $rows = DB::query(
574 574
         'SELECT *
575
-        FROM ' . prefixTable('roles_values') . '
575
+        FROM ' . prefixTable('roles_values').'
576 576
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
577 577
         ['W', 'ND', 'NE', 'NDNE', 'R'],
578 578
         $userRoles,
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     ) {
640 640
         $persoFld = DB::queryfirstrow(
641 641
             'SELECT id
642
-            FROM ' . prefixTable('nested_tree') . '
642
+            FROM ' . prefixTable('nested_tree').'
643 643
             WHERE title = %s AND personal_folder = %i'.
644 644
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
645 645
             $globalsUserId,
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
     }
673 673
     $persoFlds = DB::query(
674 674
         'SELECT id
675
-        FROM ' . prefixTable('nested_tree') . '
675
+        FROM ' . prefixTable('nested_tree').'
676 676
         WHERE %l',
677 677
         $where
678 678
     );
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
     //Load Tree
741 741
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
742 742
     // truncate table
743
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
743
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
744 744
     // reload date
745 745
     $rows = DB::query(
746 746
         'SELECT *
747
-        FROM ' . prefixTable('items') . ' as i
748
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
747
+        FROM ' . prefixTable('items').' as i
748
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
749 749
         AND l.action = %s
750 750
         AND i.inactif = %i',
751 751
         'at_creation',
@@ -757,18 +757,18 @@  discard block
 block discarded – undo
757 757
             $tags = '';
758 758
             $itemTags = DB::query(
759 759
                 'SELECT tag
760
-                FROM ' . prefixTable('tags') . '
760
+                FROM ' . prefixTable('tags').'
761 761
                 WHERE item_id = %i AND tag != ""',
762 762
                 $record['id']
763 763
             );
764 764
             foreach ($itemTags as $itemTag) {
765
-                $tags .= $itemTag['tag'] . ' ';
765
+                $tags .= $itemTag['tag'].' ';
766 766
             }
767 767
 
768 768
             // Get renewal period
769 769
             $resNT = DB::queryfirstrow(
770 770
                 'SELECT renewal_period
771
-                FROM ' . prefixTable('nested_tree') . '
771
+                FROM ' . prefixTable('nested_tree').'
772 772
                 WHERE id = %i',
773 773
                 $record['id_tree']
774 774
             );
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
                     // Is this a User id?
782 782
                     $user = DB::queryfirstrow(
783 783
                         'SELECT id, login
784
-                        FROM ' . prefixTable('users') . '
784
+                        FROM ' . prefixTable('users').'
785 785
                         WHERE id = %i',
786 786
                         $elem->title
787 787
                     );
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
                     'id' => $record['id'],
800 800
                     'label' => $record['label'],
801 801
                     'description' => $record['description'] ?? '',
802
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
802
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
803 803
                     'tags' => $tags,
804 804
                     'id_tree' => $record['id_tree'],
805 805
                     'perso' => $record['perso'],
806
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
806
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
807 807
                     'login' => $record['login'] ?? '',
808 808
                     'folder' => implode(' > ', $folder),
809 809
                     'author' => $record['id_user'],
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
     // get new value from db
833 833
     $data = DB::queryfirstrow(
834 834
         'SELECT label, description, id_tree, perso, restricted_to, login, url
835
-        FROM ' . prefixTable('items') . '
835
+        FROM ' . prefixTable('items').'
836 836
         WHERE id=%i',
837 837
         $ident
838 838
     );
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
     $tags = '';
841 841
     $itemTags = DB::query(
842 842
         'SELECT tag
843
-            FROM ' . prefixTable('tags') . '
843
+            FROM ' . prefixTable('tags').'
844 844
             WHERE item_id = %i AND tag != ""',
845 845
         $ident
846 846
     );
847 847
     foreach ($itemTags as $itemTag) {
848
-        $tags .= $itemTag['tag'] . ' ';
848
+        $tags .= $itemTag['tag'].' ';
849 849
     }
850 850
     // form id_tree to full foldername
851 851
     $folder = [];
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
             // Is this a User id?
857 857
             $user = DB::queryfirstrow(
858 858
                 'SELECT id, login
859
-                FROM ' . prefixTable('users') . '
859
+                FROM ' . prefixTable('users').'
860 860
                 WHERE id = %i',
861 861
                 $elem->title
862 862
             );
@@ -874,10 +874,10 @@  discard block
 block discarded – undo
874 874
             'label' => $data['label'],
875 875
             'description' => $data['description'],
876 876
             'tags' => $tags,
877
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
877
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
878 878
             'id_tree' => $data['id_tree'],
879 879
             'perso' => $data['perso'],
880
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
880
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
881 881
             'login' => $data['login'] ?? '',
882 882
             'folder' => implode(' » ', $folder),
883 883
             'author' => $session->get('user-id'),
@@ -907,8 +907,8 @@  discard block
 block discarded – undo
907 907
     // get new value from db
908 908
     $data = DB::queryFirstRow(
909 909
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
910
-        FROM ' . prefixTable('items') . ' as i
911
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
910
+        FROM ' . prefixTable('items').' as i
911
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
912 912
         WHERE i.id = %i
913 913
         AND l.action = %s',
914 914
         $ident,
@@ -918,12 +918,12 @@  discard block
 block discarded – undo
918 918
     $tags = '';
919 919
     $itemTags = DB::query(
920 920
         'SELECT tag
921
-            FROM ' . prefixTable('tags') . '
921
+            FROM ' . prefixTable('tags').'
922 922
             WHERE item_id = %i AND tag != ""',
923 923
         $ident
924 924
     );
925 925
     foreach ($itemTags as $itemTag) {
926
-        $tags .= $itemTag['tag'] . ' ';
926
+        $tags .= $itemTag['tag'].' ';
927 927
     }
928 928
     // form id_tree to full foldername
929 929
     $folder = [];
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
             // Is this a User id?
935 935
             $user = DB::queryfirstrow(
936 936
                 'SELECT id, login
937
-                FROM ' . prefixTable('users') . '
937
+                FROM ' . prefixTable('users').'
938 938
                 WHERE id = %i',
939 939
                 $elem->title
940 940
             );
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
             'label' => $data['label'],
954 954
             'description' => $data['description'],
955 955
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
956
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
956
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
957 957
             'id_tree' => $data['id_tree'],
958 958
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
959 959
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -975,53 +975,53 @@  discard block
 block discarded – undo
975 975
 function getStatisticsData(array $SETTINGS): array
976 976
 {
977 977
     DB::query(
978
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
978
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
979 979
         0
980 980
     );
981 981
     $counter_folders = DB::count();
982 982
     DB::query(
983
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
983
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
984 984
         1
985 985
     );
986 986
     $counter_folders_perso = DB::count();
987 987
     DB::query(
988
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
988
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
989 989
         0
990 990
     );
991 991
     $counter_items = DB::count();
992 992
         DB::query(
993
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
993
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
994 994
         1
995 995
     );
996 996
     $counter_items_perso = DB::count();
997 997
         DB::query(
998
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
998
+        'SELECT id FROM '.prefixTable('users').' WHERE login NOT IN (%s, %s, %s)',
999 999
         'OTV', 'TP', 'API'
1000 1000
     );
1001 1001
     $counter_users = DB::count();
1002 1002
         DB::query(
1003
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1003
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1004 1004
         1
1005 1005
     );
1006 1006
     $admins = DB::count();
1007 1007
     DB::query(
1008
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1008
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1009 1009
         1
1010 1010
     );
1011 1011
     $managers = DB::count();
1012 1012
     DB::query(
1013
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1013
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1014 1014
         1
1015 1015
     );
1016 1016
     $readOnly = DB::count();
1017 1017
     // list the languages
1018 1018
     $usedLang = [];
1019 1019
     $tp_languages = DB::query(
1020
-        'SELECT name FROM ' . prefixTable('languages')
1020
+        'SELECT name FROM '.prefixTable('languages')
1021 1021
     );
1022 1022
     foreach ($tp_languages as $tp_language) {
1023 1023
         DB::query(
1024
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1024
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1025 1025
             $tp_language['name']
1026 1026
         );
1027 1027
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1030,12 +1030,12 @@  discard block
 block discarded – undo
1030 1030
     // get list of ips
1031 1031
     $usedIp = [];
1032 1032
     $tp_ips = DB::query(
1033
-        'SELECT user_ip FROM ' . prefixTable('users')
1033
+        'SELECT user_ip FROM '.prefixTable('users')
1034 1034
     );
1035 1035
     foreach ($tp_ips as $ip) {
1036 1036
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1037 1037
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1038
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1038
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1039 1039
             $usedIp[$ip['user_ip']] = 1;
1040 1040
         }
1041 1041
     }
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
         <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;">
1131 1131
         <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;">
1132 1132
         <br><div style="float:right;">' .
1133
-        $textMail .
1133
+        $textMail.
1134 1134
         '<br><br></td></tr></table>
1135 1135
     </td></tr></table>
1136 1136
     <br></body></html>';
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 {
1212 1212
     array_walk_recursive(
1213 1213
         $array,
1214
-        static function (&$item): void {
1214
+        static function(&$item): void {
1215 1215
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1216 1216
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1217 1217
             }
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
  */
1323 1323
 function prefixTable(string $table): string
1324 1324
 {
1325
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1325
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1326 1326
     if (empty($safeTable) === false) {
1327 1327
         // sanitize string
1328 1328
         return $safeTable;
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1445 1445
 {
1446 1446
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1447
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1447
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1448 1448
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1449 1449
     socket_close($sock);
1450 1450
 }
@@ -1491,14 +1491,14 @@  discard block
 block discarded – undo
1491 1491
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1492 1492
         if ($type === 'user_mngt') {
1493 1493
             send_syslog(
1494
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1494
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1495 1495
                 $SETTINGS['syslog_host'],
1496 1496
                 $SETTINGS['syslog_port'],
1497 1497
                 'teampass'
1498 1498
             );
1499 1499
         } else {
1500 1500
             send_syslog(
1501
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1501
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1502 1502
                 $SETTINGS['syslog_host'],
1503 1503
                 $SETTINGS['syslog_port'],
1504 1504
                 'teampass'
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
         if (empty($item_label) === true) {
1574 1574
             $dataItem = DB::queryfirstrow(
1575 1575
                 'SELECT id, id_tree, label
1576
-                FROM ' . prefixTable('items') . '
1576
+                FROM ' . prefixTable('items').'
1577 1577
                 WHERE id = %i',
1578 1578
                 $item_id
1579 1579
             );
@@ -1581,11 +1581,11 @@  discard block
 block discarded – undo
1581 1581
         }
1582 1582
 
1583 1583
         send_syslog(
1584
-            'action=' . str_replace('at_', '', $action) .
1585
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1586
-                ' itemno=' . $item_id .
1587
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1588
-                ' itemname="' . addslashes($item_label) . '"',
1584
+            'action='.str_replace('at_', '', $action).
1585
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1586
+                ' itemno='.$item_id.
1587
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1588
+                ' itemname="'.addslashes($item_label).'"',
1589 1589
             $SETTINGS['syslog_host'],
1590 1590
             $SETTINGS['syslog_port'],
1591 1591
             'teampass'
@@ -1617,8 +1617,8 @@  discard block
 block discarded – undo
1617 1617
     $notification = DB::queryOneColumn(
1618 1618
         'email',
1619 1619
         'SELECT *
1620
-        FROM ' . prefixTable('notification') . ' AS n
1621
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1620
+        FROM ' . prefixTable('notification').' AS n
1621
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1622 1622
         WHERE n.item_id = %i AND n.user_id != %i',
1623 1623
         $item_id,
1624 1624
         $globalsUserId
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
         // Get list of changes
1630 1630
         $htmlChanges = '<ul>';
1631 1631
         foreach ($changes as $change) {
1632
-            $htmlChanges .= '<li>' . $change . '</li>';
1632
+            $htmlChanges .= '<li>'.$change.'</li>';
1633 1633
         }
1634 1634
         $htmlChanges .= '</ul>';
1635 1635
         // send email
@@ -1666,15 +1666,15 @@  discard block
 block discarded – undo
1666 1666
     $path = '';
1667 1667
     foreach ($arbo as $elem) {
1668 1668
         if (empty($path) === true) {
1669
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1669
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1670 1670
         } else {
1671
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1671
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1672 1672
         }
1673 1673
     }
1674 1674
 
1675 1675
     // Build text to show user
1676 1676
     if (empty($label) === false) {
1677
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1677
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1678 1678
     }
1679 1679
     return empty($path) === true ? '' : $path;
1680 1680
 }
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 {
1731 1731
     // Perform a copy if the file exists
1732 1732
     if (file_exists($configFilePath)) {
1733
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1733
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1734 1734
         if (!copy($configFilePath, $backupFilePath)) {
1735 1735
             return "ERROR: Could not copy file '$configFilePath'";
1736 1736
         }
@@ -1738,10 +1738,10 @@  discard block
 block discarded – undo
1738 1738
 
1739 1739
     // Regenerate the config file
1740 1740
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1741
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1741
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1742 1742
     foreach ($rows as $record) {
1743 1743
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1744
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1744
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1745 1745
     }
1746 1746
     $data[] = ");\n";
1747 1747
     $data = array_unique($data);
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
 {
1787 1787
     global $SETTINGS;
1788 1788
     /* LOAD CPASSMAN SETTINGS */
1789
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1789
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1790 1790
         $SETTINGS = [];
1791 1791
         $SETTINGS['duplicate_folder'] = 0;
1792 1792
         //by default, this is set to 0;
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
         //by default, this value is set to 5;
1797 1797
         $settings = [];
1798 1798
         $rows = DB::query(
1799
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1799
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1800 1800
             [
1801 1801
                 'type' => 'admin',
1802 1802
                 'type2' => 'settings',
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
     $source_cf = [];
1829 1829
     $rows = DB::QUERY(
1830 1830
         'SELECT id_category
1831
-            FROM ' . prefixTable('categories_folders') . '
1831
+            FROM ' . prefixTable('categories_folders').'
1832 1832
             WHERE id_folder = %i',
1833 1833
         $source_id
1834 1834
     );
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
     $target_cf = [];
1840 1840
     $rows = DB::QUERY(
1841 1841
         'SELECT id_category
1842
-            FROM ' . prefixTable('categories_folders') . '
1842
+            FROM ' . prefixTable('categories_folders').'
1843 1843
             WHERE id_folder = %i',
1844 1844
         $target_id
1845 1845
     );
@@ -1934,10 +1934,10 @@  discard block
 block discarded – undo
1934 1934
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1935 1935
         $err = 'wrong_key';
1936 1936
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1937
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1937
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1938 1938
         $err = 'environment_error';
1939 1939
     } catch (CryptoException\IOException $ex) {
1940
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1940
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1941 1941
         $err = 'general_error';
1942 1942
     }
1943 1943
 
@@ -1970,10 +1970,10 @@  discard block
 block discarded – undo
1970 1970
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1971 1971
         $err = 'wrong_key';
1972 1972
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1973
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1973
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1974 1974
         $err = 'environment_error';
1975 1975
     } catch (CryptoException\IOException $ex) {
1976
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1976
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1977 1977
         $err = 'general_error';
1978 1978
     }
1979 1979
 
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
 ) {
2060 2060
     // Check if the path exists
2061 2061
     $path = basename($path);
2062
-    if (! file_exists($path)) {
2062
+    if (!file_exists($path)) {
2063 2063
         return false;
2064 2064
     }
2065 2065
 
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
     // Load item data
2113 2113
     $data = DB::queryFirstRow(
2114 2114
         'SELECT id_tree
2115
-        FROM ' . prefixTable('items') . '
2115
+        FROM ' . prefixTable('items').'
2116 2116
         WHERE id = %i',
2117 2117
         $item_id
2118 2118
     );
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
         }
2176 2176
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2177 2177
     }
2178
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2178
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2179 2179
     return $email;
2180 2180
 }
2181 2181
 
@@ -2206,11 +2206,11 @@  discard block
 block discarded – undo
2206 2206
 function formatSizeUnits(int $bytes): string
2207 2207
 {
2208 2208
     if ($bytes >= 1073741824) {
2209
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2209
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2210 2210
     } elseif ($bytes >= 1048576) {
2211
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2211
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2212 2212
     } elseif ($bytes >= 1024) {
2213
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2213
+        $bytes = number_format($bytes / 1024, 2).' KB';
2214 2214
     } elseif ($bytes > 1) {
2215 2215
         $bytes .= ' bytes';
2216 2216
     } elseif ($bytes === 1) {
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
     $cipher->enableContinuousBuffer();
2460 2460
 
2461 2461
     // Encrypt the file content
2462
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2462
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2463 2463
     $fileContent = file_get_contents($filePath);
2464 2464
     $plaintext = $fileContent;
2465 2465
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2467,9 +2467,9 @@  discard block
 block discarded – undo
2467 2467
     // Save new file
2468 2468
     // deepcode ignore InsecureHash: is simply used to get a unique name
2469 2469
     $hash = uniqid('', true);
2470
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2470
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2471 2471
     file_put_contents($fileOut, $ciphertext);
2472
-    unlink($fileInPath . '/' . $fileInName);
2472
+    unlink($fileInPath.'/'.$fileInName);
2473 2473
     return [
2474 2474
         'fileHash' => base64_encode($hash),
2475 2475
         'objectKey' => base64_encode($objectKey),
@@ -2485,9 +2485,9 @@  discard block
 block discarded – undo
2485 2485
  *
2486 2486
  * @return string|array
2487 2487
  */
2488
-function decryptFile(string $fileName, string $filePath, string $key): string|array
2488
+function decryptFile(string $fileName, string $filePath, string $key): string | array
2489 2489
 {
2490
-    if (! defined('FILE_BUFFER_SIZE')) {
2490
+    if (!defined('FILE_BUFFER_SIZE')) {
2491 2491
         define('FILE_BUFFER_SIZE', 128 * 1024);
2492 2492
     }
2493 2493
     
@@ -2504,7 +2504,7 @@  discard block
 block discarded – undo
2504 2504
     $cipher->enableContinuousBuffer();
2505 2505
     $cipher->disablePadding();
2506 2506
     // Get file content
2507
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2507
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2508 2508
     if ($safeFilePath !== false && file_exists($safeFilePath)) {
2509 2509
         $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2510 2510
     } else {
@@ -2600,7 +2600,7 @@  discard block
 block discarded – undo
2600 2600
         // Only create the sharekey for a user
2601 2601
         $user = DB::queryFirstRow(
2602 2602
             'SELECT public_key
2603
-            FROM ' . prefixTable('users') . '
2603
+            FROM ' . prefixTable('users').'
2604 2604
             WHERE id = %i
2605 2605
             AND public_key != ""',
2606 2606
             $userId
@@ -2641,7 +2641,7 @@  discard block
 block discarded – undo
2641 2641
         }
2642 2642
         $users = DB::query(
2643 2643
             'SELECT id, public_key
2644
-            FROM ' . prefixTable('users') . '
2644
+            FROM ' . prefixTable('users').'
2645 2645
             WHERE id NOT IN %li
2646 2646
             AND public_key != ""',
2647 2647
             $user_ids
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
         foreach ($users as $user) {
2651 2651
             // Insert in DB the new object key for this item by user
2652 2652
             if (count($objectKeyArray) === 0) {
2653
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2653
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2654 2654
                 DB::insert(
2655 2655
                     $object_name,
2656 2656
                     [
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
                 );
2665 2665
             } else {
2666 2666
                 foreach ($objectKeyArray as $object) {
2667
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2667
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2668 2668
                     DB::insert(
2669 2669
                         $object_name,
2670 2670
                         [
@@ -2692,7 +2692,7 @@  discard block
 block discarded – undo
2692 2692
 function isBase64(string $str): bool
2693 2693
 {
2694 2694
     $str = (string) trim($str);
2695
-    if (! isset($str[0])) {
2695
+    if (!isset($str[0])) {
2696 2696
         return false;
2697 2697
     }
2698 2698
 
@@ -2766,7 +2766,7 @@  discard block
 block discarded – undo
2766 2766
     } catch (\LdapRecord\Auth\BindException $e) {
2767 2767
         $error = $e->getDetailedError();
2768 2768
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2769
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2769
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2770 2770
         }
2771 2771
         // deepcode ignore ServerLeak: No important data is sent
2772 2772
         echo 'An error occurred.';
@@ -2783,7 +2783,7 @@  discard block
 block discarded – undo
2783 2783
     } catch (\LdapRecord\Auth\BindException $e) {
2784 2784
         $error = $e->getDetailedError();
2785 2785
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2786
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2786
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2787 2787
         }
2788 2788
         // deepcode ignore ServerLeak: No important data is sent
2789 2789
         echo 'An error occurred.';
@@ -2810,7 +2810,7 @@  discard block
 block discarded – undo
2810 2810
     // expect if personal item
2811 2811
     DB::delete(
2812 2812
         prefixTable('sharekeys_items'),
2813
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2813
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2814 2814
         $userId
2815 2815
     );
2816 2816
     // Remove all item sharekeys files
@@ -2818,8 +2818,8 @@  discard block
 block discarded – undo
2818 2818
         prefixTable('sharekeys_files'),
2819 2819
         'user_id = %i AND object_id NOT IN (
2820 2820
             SELECT f.id 
2821
-            FROM ' . prefixTable('items') . ' AS i 
2822
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2821
+            FROM ' . prefixTable('items').' AS i 
2822
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2823 2823
             WHERE i.perso = 1
2824 2824
         )',
2825 2825
         $userId
@@ -2829,8 +2829,8 @@  discard block
 block discarded – undo
2829 2829
         prefixTable('sharekeys_fields'),
2830 2830
         'user_id = %i AND object_id NOT IN (
2831 2831
             SELECT c.id 
2832
-            FROM ' . prefixTable('items') . ' AS i 
2833
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2832
+            FROM ' . prefixTable('items').' AS i 
2833
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2834 2834
             WHERE i.perso = 1
2835 2835
         )',
2836 2836
         $userId
@@ -2838,13 +2838,13 @@  discard block
 block discarded – undo
2838 2838
     // Remove all item sharekeys logs
2839 2839
     DB::delete(
2840 2840
         prefixTable('sharekeys_logs'),
2841
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2841
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2842 2842
         $userId
2843 2843
     );
2844 2844
     // Remove all item sharekeys suggestions
2845 2845
     DB::delete(
2846 2846
         prefixTable('sharekeys_suggestions'),
2847
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2847
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2848 2848
         $userId
2849 2849
     );
2850 2850
     return false;
@@ -2865,7 +2865,7 @@  discard block
 block discarded – undo
2865 2865
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2866 2866
             $now->setTimezone(new DateTimeZone($timezone));
2867 2867
             $offsets[] = $offset = $now->getOffset();
2868
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2868
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2869 2869
         }
2870 2870
 
2871 2871
         array_multisort($offsets, $timezones);
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
 {
2886 2886
     $hours = intval($offset / 3600);
2887 2887
     $minutes = abs(intval($offset % 3600 / 60));
2888
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2888
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2889 2889
 }
2890 2890
 
2891 2891
 /**
@@ -2985,8 +2985,7 @@  discard block
 block discarded – undo
2985 2985
 {
2986 2986
     if (isset($array[$key]) === true
2987 2987
         && (is_int($value) === true ?
2988
-            (int) $array[$key] === $value :
2989
-            (string) $array[$key] === $value)
2988
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
2990 2989
     ) {
2991 2990
         return true;
2992 2991
     }
@@ -3008,8 +3007,7 @@  discard block
 block discarded – undo
3008 3007
 {
3009 3008
     if (isset($var) === false
3010 3009
         || (is_int($value) === true ?
3011
-            (int) $var === $value :
3012
-            (string) $var === $value)
3010
+            (int) $var === $value : (string) $var === $value)
3013 3011
     ) {
3014 3012
         return true;
3015 3013
     }
@@ -3060,7 +3058,7 @@  discard block
 block discarded – undo
3060 3058
  */
3061 3059
 function isSetArrayOfValues(array $arrayOfValues): bool
3062 3060
 {
3063
-    foreach($arrayOfValues as $value) {
3061
+    foreach ($arrayOfValues as $value) {
3064 3062
         if (isset($value) === false) {
3065 3063
             return false;
3066 3064
         }
@@ -3082,7 +3080,7 @@  discard block
 block discarded – undo
3082 3080
     /*PHP8 - integer|string*/$value
3083 3081
 ) : bool
3084 3082
 {
3085
-    foreach($arrayOfVars as $variable) {
3083
+    foreach ($arrayOfVars as $variable) {
3086 3084
         if ($variable !== $value) {
3087 3085
             return false;
3088 3086
         }
@@ -3102,7 +3100,7 @@  discard block
 block discarded – undo
3102 3100
     /*PHP8 - integer|string*/$value
3103 3101
 ) : bool
3104 3102
 {
3105
-    foreach($arrayOfVars as $variable) {
3103
+    foreach ($arrayOfVars as $variable) {
3106 3104
         if ($variable === $value) {
3107 3105
             return true;
3108 3106
         }
@@ -3171,7 +3169,7 @@  discard block
 block discarded – undo
3171 3169
  * @param array     $filters
3172 3170
  * @return array|string
3173 3171
  */
3174
-function dataSanitizer(array $data, array $filters): array|string
3172
+function dataSanitizer(array $data, array $filters): array | string
3175 3173
 {
3176 3174
     // Load Sanitizer library
3177 3175
     $sanitizer = new Sanitizer($data, $filters);
@@ -3200,7 +3198,7 @@  discard block
 block discarded – undo
3200 3198
     // Exists ?
3201 3199
     $userCacheId = DB::queryfirstrow(
3202 3200
         'SELECT increment_id
3203
-        FROM ' . prefixTable('cache_tree') . '
3201
+        FROM ' . prefixTable('cache_tree').'
3204 3202
         WHERE user_id = %i',
3205 3203
         $user_id
3206 3204
     );
@@ -3251,7 +3249,7 @@  discard block
 block discarded – undo
3251 3249
  */
3252 3250
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3253 3251
 { 
3254
-    $resultat = ($nombre/$total) * $pourcentage;
3252
+    $resultat = ($nombre / $total) * $pourcentage;
3255 3253
     return round($resultat);
3256 3254
 }
3257 3255
 
@@ -3281,7 +3279,7 @@  discard block
 block discarded – undo
3281 3279
 
3282 3280
     // Get last folder update
3283 3281
     $lastFolderChange = DB::queryfirstrow(
3284
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3282
+        'SELECT valeur FROM '.prefixTable('misc').'
3285 3283
         WHERE type = %s AND intitule = %s',
3286 3284
         'timestamp',
3287 3285
         'last_folder_change'
@@ -3312,7 +3310,7 @@  discard block
 block discarded – undo
3312 3310
     // Does this user has a tree cache
3313 3311
     $userCacheTree = DB::queryfirstrow(
3314 3312
         'SELECT '.$fieldName.'
3315
-        FROM ' . prefixTable('cache_tree') . '
3313
+        FROM ' . prefixTable('cache_tree').'
3316 3314
         WHERE user_id = %i',
3317 3315
         $session->get('user-id')
3318 3316
     );
@@ -3355,7 +3353,7 @@  discard block
 block discarded – undo
3355 3353
     if (count($folderIds) === 0) {
3356 3354
         $folderIds = DB::queryFirstColumn(
3357 3355
             'SELECT id
3358
-            FROM ' . prefixTable('nested_tree') . '
3356
+            FROM ' . prefixTable('nested_tree').'
3359 3357
             WHERE personal_folder=%i',
3360 3358
             0
3361 3359
         );
@@ -3372,8 +3370,8 @@  discard block
 block discarded – undo
3372 3370
         $rows_tmp = DB::query(
3373 3371
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3374 3372
             f.id_category AS category_id
3375
-            FROM ' . prefixTable('categories_folders') . ' AS f
3376
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3373
+            FROM ' . prefixTable('categories_folders').' AS f
3374
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3377 3375
             WHERE id_folder=%i',
3378 3376
             $folder
3379 3377
         );
@@ -3399,7 +3397,7 @@  discard block
 block discarded – undo
3399 3397
         $valTemp = '';
3400 3398
         $data = DB::queryFirstRow(
3401 3399
             'SELECT valeur
3402
-            FROM ' . prefixTable('misc') . '
3400
+            FROM ' . prefixTable('misc').'
3403 3401
             WHERE type = %s AND intitule=%i',
3404 3402
             'complex',
3405 3403
             $folder
@@ -3416,14 +3414,14 @@  discard block
 block discarded – undo
3416 3414
         $valTemp = '';
3417 3415
         $rows_tmp = DB::query(
3418 3416
             'SELECT t.title
3419
-            FROM ' . prefixTable('roles_values') . ' as v
3420
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3417
+            FROM ' . prefixTable('roles_values').' as v
3418
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3421 3419
             WHERE v.folder_id = %i
3422 3420
             GROUP BY title',
3423 3421
             $folder
3424 3422
         );
3425 3423
         foreach ($rows_tmp as $record) {
3426
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3424
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3427 3425
         }
3428 3426
         $arr_data['visibilityRoles'] = $valTemp;
3429 3427
 
@@ -3456,7 +3454,7 @@  discard block
 block discarded – undo
3456 3454
         // loop on users and check if user has this role
3457 3455
         $rows = DB::query(
3458 3456
             'SELECT id, fonction_id
3459
-            FROM ' . prefixTable('users') . '
3457
+            FROM ' . prefixTable('users').'
3460 3458
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3461 3459
             $session->get('user-id')
3462 3460
         );
@@ -3488,7 +3486,7 @@  discard block
 block discarded – undo
3488 3486
 
3489 3487
     $val = DB::queryfirstrow(
3490 3488
         'SELECT *
3491
-        FROM ' . prefixTable('users') . '
3489
+        FROM ' . prefixTable('users').'
3492 3490
         WHERE id = %i',
3493 3491
         $userId
3494 3492
     );
@@ -3504,12 +3502,12 @@  discard block
 block discarded – undo
3504 3502
 function upgradeRequired(): bool
3505 3503
 {
3506 3504
     // Get settings.php
3507
-    include_once __DIR__. '/../includes/config/settings.php';
3505
+    include_once __DIR__.'/../includes/config/settings.php';
3508 3506
 
3509 3507
     // Get timestamp in DB
3510 3508
     $val = DB::queryfirstrow(
3511 3509
         'SELECT valeur
3512
-        FROM ' . prefixTable('misc') . '
3510
+        FROM ' . prefixTable('misc').'
3513 3511
         WHERE type = %s AND intitule = %s',
3514 3512
         'admin',
3515 3513
         'upgrade_timestamp'
@@ -3639,7 +3637,7 @@  discard block
 block discarded – undo
3639 3637
         return $decrypted === $random_str;
3640 3638
     } catch (Exception $e) {
3641 3639
         if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
3642
-            error_log('ERROR: ' . $e->getMessage());
3640
+            error_log('ERROR: '.$e->getMessage());
3643 3641
         }
3644 3642
         return false;
3645 3643
     }
@@ -3738,7 +3736,7 @@  discard block
 block discarded – undo
3738 3736
     $lang = new Language($session->get('user-language') ?? 'english');
3739 3737
     $userTP = DB::queryFirstRow(
3740 3738
         'SELECT pw, public_key, private_key
3741
-        FROM ' . prefixTable('users') . '
3739
+        FROM ' . prefixTable('users').'
3742 3740
         WHERE id = %i',
3743 3741
         TP_USER_ID
3744 3742
     );
@@ -4026,7 +4024,7 @@  discard block
 block discarded – undo
4026 4024
  */
4027 4025
 function createTaskForItem(
4028 4026
     string $processType,
4029
-    string|array $taskName,
4027
+    string | array $taskName,
4030 4028
     int $itemId,
4031 4029
     int $userId,
4032 4030
     string $objectKey,
@@ -4050,7 +4048,7 @@  discard block
 block discarded – undo
4050 4048
                 'object_key' => $objectKey,
4051 4049
                 'author' => (int) $userId,
4052 4050
             ]),
4053
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
4051
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
4054 4052
         )
4055 4053
     );
4056 4054
     $processId = DB::insertId();
@@ -4060,7 +4058,7 @@  discard block
 block discarded – undo
4060 4058
     if (is_array($taskName) === false) {
4061 4059
         $taskName = [$taskName];
4062 4060
     }
4063
-    foreach($taskName as $task) {
4061
+    foreach ($taskName as $task) {
4064 4062
         if (WIP === true) error_log('createTaskForItem - task: '.$task);
4065 4063
         switch ($task) {
4066 4064
             case 'item_password':
@@ -4157,7 +4155,7 @@  discard block
 block discarded – undo
4157 4155
  * @param integer $user_id
4158 4156
  * @return void
4159 4157
  */
4160
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4158
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4161 4159
 {
4162 4160
     if ($allUsers === true) {
4163 4161
         // Load class DB
@@ -4167,7 +4165,7 @@  discard block
 block discarded – undo
4167 4165
 
4168 4166
         $users = DB::query(
4169 4167
             'SELECT id
4170
-            FROM ' . prefixTable('users') . '
4168
+            FROM ' . prefixTable('users').'
4171 4169
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4172 4170
             ORDER BY login ASC'
4173 4171
         );
@@ -4185,7 +4183,7 @@  discard block
 block discarded – undo
4185 4183
  * @param integer $user_id
4186 4184
  * @return void
4187 4185
  */
4188
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4186
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4189 4187
 {
4190 4188
     if ($user_id === 0) {
4191 4189
         return;
@@ -4196,8 +4194,8 @@  discard block
 block discarded – undo
4196 4194
 
4197 4195
     $personalItems = DB::queryFirstColumn(
4198 4196
         'SELECT id
4199
-        FROM ' . prefixTable('items') . ' AS i
4200
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4197
+        FROM ' . prefixTable('items').' AS i
4198
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4201 4199
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4202 4200
         $user_id
4203 4201
     );
@@ -4246,7 +4244,7 @@  discard block
 block discarded – undo
4246 4244
     // Check if user exists
4247 4245
     $userInfo = DB::queryFirstRow(
4248 4246
         'SELECT login
4249
-        FROM ' . prefixTable('users') . '
4247
+        FROM ' . prefixTable('users').'
4250 4248
         WHERE id = %i',
4251 4249
         $userId
4252 4250
     );
@@ -4255,7 +4253,7 @@  discard block
 block discarded – undo
4255 4253
         $now = (int) time();
4256 4254
         // Prepare file content
4257 4255
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4258
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4256
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4259 4257
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4260 4258
             "Public Key:\n".$session->get('user-public_key')."\n\n".
4261 4259
             "Private Key:\n".$session->get('user-private_key')."\n\n";
@@ -4278,7 +4276,7 @@  discard block
 block discarded – undo
4278 4276
         return prepareExchangedData(
4279 4277
             array(
4280 4278
                 'error' => false,
4281
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4279
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4282 4280
                 'timestamp' => $now,
4283 4281
                 'content' => base64_encode($export_value),
4284 4282
                 'login' => $userInfo['login'],
@@ -4304,8 +4302,8 @@  discard block
 block discarded – undo
4304 4302
  */
4305 4303
 function loadClasses(string $className = ''): void
4306 4304
 {
4307
-    require_once __DIR__. '/../includes/config/include.php';
4308
-    require_once __DIR__. '/../includes/config/settings.php';
4305
+    require_once __DIR__.'/../includes/config/include.php';
4306
+    require_once __DIR__.'/../includes/config/settings.php';
4309 4307
     require_once __DIR__.'/../vendor/autoload.php';
4310 4308
 
4311 4309
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4516,7 +4514,7 @@  discard block
 block discarded – undo
4516 4514
 
4517 4515
     // Get current user hash
4518 4516
     $userHash = DB::queryFirstRow(
4519
-        "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
4517
+        "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
4520 4518
         $session->get('user-id')
4521 4519
     )['pw'];
4522 4520
 
Please login to merge, or discard this patch.
api/Model/Operation.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
                 "error" => '',
39 39
             );
40 40
     
41
-        }catch (Exception $e) {    
41
+        } catch (Exception $e) {    
42 42
             return false;
43 43
         }
44 44
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
                 "error" => '',
41 41
             );
42 42
     
43
-        }catch (Exception $e) {    
43
+        } catch (Exception $e) {    
44 44
             return false;
45 45
         }
46 46
     }
Please login to merge, or discard this patch.
api/Model/FolderModel.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $ret = [];
35 35
 
36 36
         foreach ($rows as $row) {
37
-			$isVisible = in_array((int) $row['id'], $foldersId);
37
+            $isVisible = in_array((int) $row['id'], $foldersId);
38 38
             $childrens = $this->getFoldersChildren($row['id'], $foldersId);
39 39
 
40 40
             if ($isVisible || count($childrens) > 0) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                     [
44 44
                         'id' => (int) $row['id'],
45 45
                         'title' => $row['title'],
46
-						'isVisible' => $isVisible,
46
+                        'isVisible' => $isVisible,
47 47
                         'childrens' => $childrens
48 48
                     ]
49 49
                 );
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         if ( count($childrens) > 0) {
65 65
             foreach ($childrens as $children) {
66
-				$isVisible = in_array((int) $children['id'], $foldersId);
66
+                $isVisible = in_array((int) $children['id'], $foldersId);
67 67
                 $childs = $this->getFoldersChildren($children['id'], $foldersId);
68 68
 
69 69
                 if (in_array((int) $children['id'], $foldersId) || count($childs) > 0) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                         [
73 73
                             'id' => (int) $children['id'],
74 74
                             'title' => $children['title'],
75
-							'isVisible' => $isVisible,
75
+                            'isVisible' => $isVisible,
76 76
                             'childrens' => $childs
77 77
                         ]
78 78
                     );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         // Get folders
38 38
         $rows = DB::query(
39 39
             'SELECT id, title
40
-            FROM ' . prefixTable('nested_tree') . '
40
+            FROM ' . prefixTable('nested_tree').'
41 41
             WHERE nlevel = %i',
42 42
             1
43 43
         );
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
         $ret = [];
70 70
         $childrens = DB::query(
71 71
             'SELECT id, title
72
-            FROM ' . prefixTable('nested_tree') . '
72
+            FROM ' . prefixTable('nested_tree').'
73 73
             WHERE parent_id = %i',
74 74
             $parentId
75 75
         );
76 76
 
77
-        if ( count($childrens) > 0) {
77
+        if (count($childrens) > 0) {
78 78
             foreach ($childrens as $children) {
79 79
 				$isVisible = in_array((int) $children['id'], $foldersId);
80 80
                 $childs = $this->getFoldersChildren($children['id'], $foldersId);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     ): array
117 117
     {
118 118
         // Validate inputs
119
-        include_once API_ROOT_PATH . '/../sources/main.functions.php';
119
+        include_once API_ROOT_PATH.'/../sources/main.functions.php';
120 120
         $data = [
121 121
             'title' => $title,
122 122
             'parent_id' => $parent_id,
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                 'error' => true,
182 182
                 'error_header' => 'HTTP/1.1 422 Unprocessable Entity',
183 183
                 'error_message' => 'Invalid parameters'
184
-            ];}
184
+            ]; }
185 185
 
186 186
         // Create folder
187 187
         require_once TEAMPASS_ROOT_PATH.'/sources/folders.class.php';
Please login to merge, or discard this patch.
sources/users.queries.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2603,7 +2603,9 @@
 block discarded – undo
2603 2603
             }
2604 2604
             
2605 2605
             foreach ($results as $adUser) {
2606
-                if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue;
2606
+                if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) {
2607
+                    continue;
2608
+                }
2607 2609
                 // Build the list of all groups in AD
2608 2610
                 if (isset($adUser['memberof']) === true) {
2609 2611
                     foreach($adUser['memberof'] as $j => $adUserGroup) {
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         // Get info about user to modify
146 146
         $targetUserInfos = DB::queryfirstrow(
147
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
147
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
148 148
             WHERE id = %i',
149 149
             (int) $dataReceived['user_id']
150 150
         );
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             // Check if user already exists
265 265
             $data = DB::query(
266 266
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
267
-                FROM ' . prefixTable('users') . '
267
+                FROM ' . prefixTable('users').'
268 268
                 WHERE login = %s
269 269
                 AND deleted_at IS NULL',
270 270
                 $login
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 
484 484
             // Get info about user to delete
485 485
             $data_user = DB::queryfirstrow(
486
-                'SELECT login, admin, isAdministratedByRole FROM ' . prefixTable('users') . '
486
+                'SELECT login, admin, isAdministratedByRole FROM '.prefixTable('users').'
487 487
                 WHERE id = %i',
488 488
                 $post_id
489 489
             );
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                 );
518 518
                 // delete personal folder and subfolders
519 519
                 $data = DB::queryfirstrow(
520
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
520
+                    'SELECT id FROM '.prefixTable('nested_tree').'
521 521
                     WHERE title = %s AND personal_folder = %i',
522 522
                     $post_id,
523 523
                     '1'
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
531 531
                         // delete items & logs
532 532
                         $items = DB::query(
533
-                            'SELECT id FROM ' . prefixTable('items') . '
533
+                            'SELECT id FROM '.prefixTable('items').'
534 534
                             WHERE id_tree=%i AND perso = %i',
535 535
                             $folder->id,
536 536
                             '1'
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                 // Delete any process related to user
555 555
                 $processes = DB::query(
556 556
                     'SELECT increment_id
557
-                    FROM ' . prefixTable('background_tasks') . '
557
+                    FROM ' . prefixTable('background_tasks').'
558 558
                     WHERE JSON_EXTRACT(arguments, "$.new_user_id") = %i',
559 559
                     $post_id
560 560
                 );
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
             $return = array();
608 608
             // Check if folder exists
609 609
             $data = DB::query(
610
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
610
+                'SELECT * FROM '.prefixTable('nested_tree').'
611 611
                 WHERE title = %s AND parent_id = %i',
612 612
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
613 613
                 '0'
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
             }
621 621
             // Check if role exists
622 622
             $data = DB::query(
623
-                'SELECT * FROM ' . prefixTable('roles_title') . '
623
+                'SELECT * FROM '.prefixTable('roles_title').'
624 624
                 WHERE title = %s',
625 625
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
626 626
             );
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
             // Get info about user to delete
650 650
             $data_user = DB::queryfirstrow(
651 651
                 'SELECT admin, isAdministratedByRole, gestionnaire
652
-                FROM ' . prefixTable('users') . '
652
+                FROM ' . prefixTable('users').'
653 653
                 WHERE id = %i',
654 654
                 $post_user_id
655 655
             );
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
             // Get info about user
706 706
             $rowUser = DB::queryfirstrow(
707 707
                 'SELECT *
708
-                FROM ' . prefixTable('users') . '
708
+                FROM ' . prefixTable('users').'
709 709
                 WHERE id = %i',
710 710
                 $post_id
711 711
             );
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
                 $selected = '';
731 731
                 $users_functions = array_filter(array_unique(explode(';', empty($rowUser['fonction_id'].';'.$rowUser['roles_from_ad_groups']) === true ? '' : $rowUser['fonction_id'].';'.$rowUser['roles_from_ad_groups'])));
732 732
 
733
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
733
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
734 734
                 foreach ($rows as $record) {
735 735
                     if (
736 736
                         (int) $session->get('user-admin') === 1
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
                 $rolesList = array();
766 766
                 $managedBy = array();
767 767
                 $selected = '';
768
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
768
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
769 769
                 foreach ($rows as $reccord) {
770 770
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
771 771
                 }
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
                         array_push(
797 797
                             $managedBy,
798 798
                             array(
799
-                                'title' => $lang->get('managers_of') . ' ' . $fonction['title'],
799
+                                'title' => $lang->get('managers_of').' '.$fonction['title'],
800 800
                                 'id' => $fonction['id'],
801 801
                                 'selected' => $selected,
802 802
                             )
@@ -878,9 +878,9 @@  discard block
 block discarded – undo
878 878
 
879 879
                 // get USER STATUS
880 880
                 if ($rowUser['disabled'] == 1) {
881
-                    $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>';
881
+                    $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>';
882 882
                 } else {
883
-                    $arrData['info'] = $lang->get('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . $lang->get('user_info_lock_question');
883
+                    $arrData['info'] = $lang->get('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.$lang->get('user_info_lock_question');
884 884
                 }
885 885
 
886 886
                 $arrData['error'] = false;
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 
968 968
             // Get info about user to modify
969 969
             $data_user = DB::queryfirstrow(
970
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
970
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
971 971
                 WHERE id = %i',
972 972
                 $post_id
973 973
             );
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
                 // count number of admins
979 979
                 $users = DB::query(
980 980
                     'SELECT id
981
-                    FROM ' . prefixTable('users') . '
981
+                    FROM ' . prefixTable('users').'
982 982
                     WHERE admin = 1 AND email != "" AND pw != "" AND id != %i',
983 983
                     $post_id
984 984
                 );
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
             // Exclude roles from AD - PR #3635
1002 1002
             $adRoles = DB::query(
1003 1003
                 'SELECT roles_from_ad_groups
1004
-                FROM ' . prefixTable('users') . '
1004
+                FROM ' . prefixTable('users').'
1005 1005
                 WHERE id = %i',
1006 1006
                 $post_id
1007 1007
             )[0]['roles_from_ad_groups'];
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
                     );
1106 1106
                     // delete personal folder and subfolders
1107 1107
                     $data = DB::queryfirstrow(
1108
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1108
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1109 1109
                         WHERE title = %s AND personal_folder = %i',
1110 1110
                         $post_id,
1111 1111
                         '1'
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1119 1119
                             // delete items & logs
1120 1120
                             $items = DB::query(
1121
-                                'SELECT id FROM ' . prefixTable('items') . '
1121
+                                'SELECT id FROM '.prefixTable('items').'
1122 1122
                                 WHERE id_tree=%i AND perso = %i',
1123 1123
                                 $folder->id,
1124 1124
                                 '1'
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
                 } else {
1140 1140
                     // Get old data about user
1141 1141
                     $oldData = DB::queryfirstrow(
1142
-                        'SELECT * FROM ' . prefixTable('users') . '
1142
+                        'SELECT * FROM '.prefixTable('users').'
1143 1143
                         WHERE id = %i',
1144 1144
                         $post_id
1145 1145
                     );
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
                     // update LOG
1178 1178
                     if ($oldData['email'] !== $post_email) {
1179
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id);
1179
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $session->get('user-id'), $session->get('user-login'), $post_id);
1180 1180
                     }
1181 1181
                 }
1182 1182
                 echo prepareExchangedData(
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
             }
1225 1225
 
1226 1226
             DB::queryfirstrow(
1227
-                'SELECT * FROM ' . prefixTable('users') . '
1227
+                'SELECT * FROM '.prefixTable('users').'
1228 1228
                 WHERE login = %s
1229 1229
                 AND deleted_at IS NULL',
1230 1230
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
             // get User info
1277 1277
             $rowUser = DB::queryFirstRow(
1278 1278
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb, roles_from_ad_groups
1279
-                FROM ' . prefixTable('users') . '
1279
+                FROM ' . prefixTable('users').'
1280 1280
                 WHERE id = %i',
1281 1281
                 $post_id
1282 1282
             );
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
             $html = '';
1287 1287
 
1288 1288
             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) {
1289
-                $rowUser['fonction_id'] = empty($rowUser['fonction_id'])  === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id']. ';' . $rowUser['roles_from_ad_groups'];
1289
+                $rowUser['fonction_id'] = empty($rowUser['fonction_id']) === true ? $rowUser['roles_from_ad_groups'] : $rowUser['fonction_id'].';'.$rowUser['roles_from_ad_groups'];
1290 1290
             }
1291 1291
             $arrData['functions'] = array_filter(explode(';', $rowUser['fonction_id']));
1292 1292
             $arrData['allowed_folders'] = array_filter(explode(';', $rowUser['groupes_visibles']));
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
                 // refine folders based upon roles
1298 1298
                 $rows = DB::query(
1299 1299
                     'SELECT folder_id, type
1300
-                    FROM ' . prefixTable('roles_values') . '
1300
+                    FROM ' . prefixTable('roles_values').'
1301 1301
                     WHERE role_id IN %ls
1302 1302
                     ORDER BY folder_id ASC',
1303 1303
                     $arrData['functions']
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
                 }
1321 1321
 
1322 1322
                 // add allowed folders
1323
-                foreach($arrData['allowed_folders'] as $Fld) {
1323
+                foreach ($arrData['allowed_folders'] as $Fld) {
1324 1324
                     array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true));
1325 1325
                 }
1326 1326
                 
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
                             // get folder name
1332 1332
                             $row = DB::queryFirstRow(
1333 1333
                                 'SELECT title, nlevel, id
1334
-                                FROM ' . prefixTable('nested_tree') . '
1334
+                                FROM ' . prefixTable('nested_tree').'
1335 1335
                                 WHERE id = %i',
1336 1336
                                 $fld['id']
1337 1337
                             );
@@ -1344,38 +1344,38 @@  discard block
 block discarded – undo
1344 1344
 
1345 1345
                             // manage right icon
1346 1346
                             if ($fld['type'] == 'W') {
1347
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . $lang->get('write') . '"></i>' .
1348
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' .
1349
-                                    '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>';
1347
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.$lang->get('write').'"></i>'.
1348
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'.
1349
+                                    '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>';
1350 1350
                             } elseif ($fld['type'] == 'ND') {
1351
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1352
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . $lang->get('edit') . '"></i>' .
1353
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>';
1351
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1352
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.$lang->get('edit').'"></i>'.
1353
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>';
1354 1354
                             } elseif ($fld['type'] == 'NE') {
1355
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1356
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' .
1357
-                                    '<i class="fas fa-eraser infotip text-success" title="' . $lang->get('delete') . '"></i>';
1355
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1356
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'.
1357
+                                    '<i class="fas fa-eraser infotip text-success" title="'.$lang->get('delete').'"></i>';
1358 1358
                             } elseif ($fld['type'] == 'NDNE') {
1359
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . $lang->get('write') . '"></i>' .
1360
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . $lang->get('no_edit') . '"></i>' .
1361
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . $lang->get('no_delete') . '"></i>';
1359
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.$lang->get('write').'"></i>'.
1360
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.$lang->get('no_edit').'"></i>'.
1361
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.$lang->get('no_delete').'"></i>';
1362 1362
                             } elseif ($fld['type'] == '') {
1363
-                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="' . $lang->get('no_access') . '"></i>';
1363
+                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="'.$lang->get('no_access').'"></i>';
1364 1364
                             } else {
1365
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . $lang->get('read') . '"></i>';
1365
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.$lang->get('read').'"></i>';
1366 1366
                             }
1367 1367
 
1368
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1369
-                                ' <small class="text-info">[' . $row['id'] . ']</small>'.
1370
-                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . $lang->get('user_specific_right') . '"></i>' : '').
1371
-                                '</td><td>' . $label . '</td></tr>';
1368
+                            $html .= '<tr><td>'.$ident.$row['title'].
1369
+                                ' <small class="text-info">['.$row['id'].']</small>'.
1370
+                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.$lang->get('user_specific_right').'"></i>' : '').
1371
+                                '</td><td>'.$label.'</td></tr>';
1372 1372
                             break;
1373 1373
                         }
1374 1374
                     }
1375 1375
                 }
1376 1376
 
1377
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1378
-                    $html . '</tbody></table>';
1377
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1378
+                    $html.'</tbody></table>';
1379 1379
             } else {
1380 1380
                 $html_full = '';
1381 1381
             }
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
             if ((int) $session->get('user-admin') === 0 && (int) $session->get('user-can_manage_all_users') === 0) {
1422 1422
                 $rows = DB::query(
1423 1423
                     'SELECT *
1424
-                    FROM ' . prefixTable('users') . '
1424
+                    FROM ' . prefixTable('users').'
1425 1425
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1426 1426
                     '0',
1427 1427
                     array_filter($session->get('user-roles_array'))
@@ -1429,7 +1429,7 @@  discard block
 block discarded – undo
1429 1429
             } else {
1430 1430
                 $rows = DB::query(
1431 1431
                     'SELECT *
1432
-                    FROM ' . prefixTable('users') . '
1432
+                    FROM ' . prefixTable('users').'
1433 1433
                     WHERE admin = %i',
1434 1434
                     '0'
1435 1435
                 );
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
                 $groupIds = [];
1442 1442
                 foreach (explode(';', $record['fonction_id']) as $group) {
1443 1443
                     $tmp = DB::queryfirstrow(
1444
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1444
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1445 1445
                         WHERE id = %i',
1446 1446
                         $group
1447 1447
                     );
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 
1454 1454
                 // Get managed_by
1455 1455
                 $managedBy = DB::queryfirstrow(
1456
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1456
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1457 1457
                     WHERE id = %i',
1458 1458
                     $record['isAdministratedByRole']
1459 1459
                 );
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
                 $foldersAllowedIds = [];
1464 1464
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1465 1465
                     $tmp = DB::queryfirstrow(
1466
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1466
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1467 1467
                         WHERE id = %i',
1468 1468
                         $role
1469 1469
                     );
@@ -1476,7 +1476,7 @@  discard block
 block discarded – undo
1476 1476
                 $foldersForbiddenIds = [];
1477 1477
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1478 1478
                     $tmp = DB::queryfirstrow(
1479
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1479
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1480 1480
                         WHERE id = %i',
1481 1481
                         $role
1482 1482
                     );
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
                         'login' => $record['login'],
1495 1495
                         'groups' => implode(', ', $groups),
1496 1496
                         'groupIds' => $groupIds,
1497
-                        'managedBy' => $managedBy=== null ? $lang->get('administrator') : $managedBy['title'],
1497
+                        'managedBy' => $managedBy === null ? $lang->get('administrator') : $managedBy['title'],
1498 1498
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
1499 1499
                         'foldersAllowed' => implode(', ', $foldersAllowed),
1500 1500
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 
1596 1596
             // Get info about user
1597 1597
             $data_user = DB::queryfirstrow(
1598
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1598
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1599 1599
                 WHERE id = %i',
1600 1600
                 $inputData['source_id']
1601 1601
             );
@@ -1797,14 +1797,14 @@  discard block
 block discarded – undo
1797 1797
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
1798 1798
                 $data_user = DB::queryfirstrow(
1799 1799
                     'SELECT fonction_id, public_key
1800
-                    FROM ' . prefixTable('users') . '
1800
+                    FROM ' . prefixTable('users').'
1801 1801
                     WHERE id = %i',
1802 1802
                     $post_user_id
1803 1803
                 );
1804 1804
 
1805 1805
                 if ($data_user) {
1806 1806
                     // Ensure array is unique
1807
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
1807
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
1808 1808
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
1809 1809
                 } else {
1810 1810
                     // User not found
@@ -1820,14 +1820,14 @@  discard block
 block discarded – undo
1820 1820
             }
1821 1821
 
1822 1822
             // Manage specific case of api key
1823
-            if($post_field === 'user_api_key') {
1823
+            if ($post_field === 'user_api_key') {
1824 1824
                 $encrypted_key = encryptUserObjectKey(base64_encode($post_new_value), $session->get('user-public_key'));
1825 1825
                 $session->set('user-api_key', $post_new_value);
1826 1826
 
1827 1827
                 // test if user has an api key
1828 1828
                 $data_user = DB::queryfirstrow(
1829 1829
                     'SELECT value
1830
-                    FROM ' . prefixTable('api') . '
1830
+                    FROM ' . prefixTable('api').'
1831 1831
                     WHERE user_id = %i',
1832 1832
                     $post_user_id
1833 1833
                 );
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
             } catch (\LdapRecord\Auth\BindException $e) {
1948 1948
                 $error = $e->getDetailedError();
1949 1949
                 if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
1950
-                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
1950
+                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
1951 1951
                 }
1952 1952
                 // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending
1953 1953
                 echo prepareExchangedData(
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
             } catch (\LdapRecord\Auth\BindException $e) {
1978 1978
                 $error = $e->getDetailedError();
1979 1979
                 if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
1980
-                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
1980
+                    error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
1981 1981
                 }
1982 1982
                 // deepcode ignore ServerLeak: No important data is sent and it is encrypted before sending
1983 1983
                 echo prepareExchangedData(
@@ -1994,7 +1994,7 @@  discard block
 block discarded – undo
1994 1994
                 if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue;
1995 1995
                 // Build the list of all groups in AD
1996 1996
                 if (isset($adUser['memberof']) === true) {
1997
-                    foreach($adUser['memberof'] as $j => $adUserGroup) {
1997
+                    foreach ($adUser['memberof'] as $j => $adUserGroup) {
1998 1998
                         if (empty($adUserGroup) === false && $j !== "count") {
1999 1999
                             $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2000 2000
                             if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
                     // Get his ID
2011 2011
                     $userInfo = DB::queryfirstrow(
2012 2012
                         'SELECT id, login, fonction_id, auth_type
2013
-                        FROM ' . prefixTable('users') . '
2013
+                        FROM ' . prefixTable('users').'
2014 2014
                         WHERE login = %s',
2015 2015
                         $userLogin
2016 2016
                     );
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 
2047 2047
             // Get all groups in Teampass
2048 2048
             $teampassRoles = array();
2049
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2049
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2050 2050
             foreach ($rows as $record) {
2051 2051
                 array_push(
2052 2052
                     $teampassRoles,
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
             // Check if user already exists
2111 2111
             $data = DB::query(
2112 2112
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2113
-                FROM ' . prefixTable('users') . '
2113
+                FROM ' . prefixTable('users').'
2114 2114
                 WHERE login = %s',
2115 2115
                 $post_login
2116 2116
             );
@@ -2287,7 +2287,7 @@  discard block
 block discarded – undo
2287 2287
             // Check if user already exists
2288 2288
             DB::query(
2289 2289
                 'SELECT id
2290
-                FROM ' . prefixTable('users') . '
2290
+                FROM ' . prefixTable('users').'
2291 2291
                 WHERE id = %i',
2292 2292
                 $post_id
2293 2293
             );
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
             // Check if user already exists
2374 2374
             DB::query(
2375 2375
                 'SELECT id
2376
-                FROM ' . prefixTable('users') . '
2376
+                FROM ' . prefixTable('users').'
2377 2377
                 WHERE id = %i',
2378 2378
                 $post_id
2379 2379
             );
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
             // Search TP_USER in db        
2441 2441
             $userTP = DB::queryFirstRow(
2442 2442
                 'SELECT pw
2443
-                FROM ' . prefixTable('users') . '
2443
+                FROM ' . prefixTable('users').'
2444 2444
                 WHERE id = %i',
2445 2445
                 TP_USER_ID
2446 2446
             );
@@ -2462,8 +2462,8 @@  discard block
 block discarded – undo
2462 2462
                     'process_type' => 'create_user_keys',
2463 2463
                     'arguments' => json_encode([
2464 2464
                         'new_user_id' => (int) $post_user_id,
2465
-                        'new_user_pwd' => empty($post_user_pwd) === true ? '' : cryption($post_user_pwd, '','encrypt', $SETTINGS)['string'],
2466
-                        'new_user_code' => cryption($post_user_code, '','encrypt', $SETTINGS)['string'],
2465
+                        'new_user_pwd' => empty($post_user_pwd) === true ? '' : cryption($post_user_pwd, '', 'encrypt', $SETTINGS)['string'],
2466
+                        'new_user_code' => cryption($post_user_code, '', 'encrypt', $SETTINGS)['string'],
2467 2467
                         'owner_id' => (int) TP_USER_ID,
2468 2468
                         'creator_pwd' => $userTP['pw'],
2469 2469
                         'email_body' => $lang->get('email_body_user_config_5'),
@@ -2638,8 +2638,8 @@  discard block
 block discarded – undo
2638 2638
             // get user info
2639 2639
             $processesProgress = DB::query(
2640 2640
                 'SELECT u.ongoing_process_id, pt.task, pt.updated_at, pt.finished_at, pt.is_in_progress
2641
-                FROM ' . prefixTable('users') . ' AS u
2642
-                INNER JOIN ' . prefixTable('background_subtasks') . ' AS pt ON (pt.task_id = u.ongoing_process_id)
2641
+                FROM ' . prefixTable('users').' AS u
2642
+                INNER JOIN ' . prefixTable('background_subtasks').' AS pt ON (pt.task_id = u.ongoing_process_id)
2643 2643
                 WHERE u.id = %i',
2644 2644
                 $user_id
2645 2645
             );
@@ -2647,9 +2647,9 @@  discard block
 block discarded – undo
2647 2647
             //print_r($processesProgress);
2648 2648
             $finished_steps = 0;
2649 2649
             $nb_steps = count($processesProgress);
2650
-            foreach($processesProgress as $process) {
2650
+            foreach ($processesProgress as $process) {
2651 2651
                 if ((int) $process['is_in_progress'] === -1) {
2652
-                    $finished_steps ++;
2652
+                    $finished_steps++;
2653 2653
                 }
2654 2654
             }
2655 2655
 
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
                     'error' => false,
2659 2659
                     'message' => '',
2660 2660
                     'user_id' => $user_id,
2661
-                    'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps/$nb_steps*100, 0).'%',
2661
+                    'status' => $finished_steps === $nb_steps ? 'finished' : number_format($finished_steps / $nb_steps * 100, 0).'%',
2662 2662
                     'debug' => $finished_steps.",".$nb_steps,
2663 2663
                 ),
2664 2664
                 'encode'
@@ -2722,7 +2722,7 @@  discard block
 block discarded – undo
2722 2722
 
2723 2723
     // Get info about user
2724 2724
     $data_user = DB::queryfirstrow(
2725
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2725
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2726 2726
         WHERE id = %i',
2727 2727
         $value[1]
2728 2728
     );
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
             logEvents(
2757 2757
                 $SETTINGS,
2758 2758
                 'user_mngt',
2759
-                'at_user_new_' . $value[0] . ':' . $value[1],
2759
+                'at_user_new_'.$value[0].':'.$value[1],
2760 2760
                 (string) $session->get('user-id'),
2761 2761
                 $session->get('user-login'),
2762 2762
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
@@ -2790,7 +2790,7 @@  discard block
 block discarded – undo
2790 2790
 
2791 2791
     // Get info about user
2792 2792
     $data_user = DB::queryfirstrow(
2793
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2793
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2794 2794
         WHERE id = %i',
2795 2795
         $value[1]
2796 2796
     );
Please login to merge, or discard this patch.
api/Controller/Api/AuthController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $arrQueryStringParams = $this->getQueryStringParams();
40 40
 
41 41
         if (strtoupper($requestMethod) === 'POST') {
42
-            require API_ROOT_PATH . "/Model/AuthModel.php";
42
+            require API_ROOT_PATH."/Model/AuthModel.php";
43 43
             try {
44 44
                 $authModel = new AuthModel();
45 45
                 $arrUser = $authModel->getUserAuth(
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                 if (array_key_exists("token", $arrUser)) {
51 51
                     $responseData = json_encode($arrUser);
52 52
                 } else {
53
-                    $strErrorDesc = $arrUser['error'] . " (" . $arrUser['info'] . ")";
53
+                    $strErrorDesc = $arrUser['error']." (".$arrUser['info'].")";
54 54
                     $strErrorHeader = 'HTTP/1.1 401 Unauthorized';
55 55
                 }
56 56
             } catch (Error $e) {
Please login to merge, or discard this patch.
pages/statistics.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('statistics') === false) {
66 66
     // Not allowed page
67 67
     $session->set('system-error_code', ERR_NOT_ALLOWED);
68
-    include $SETTINGS['cpassman_dir'] . '/error.php';
68
+    include $SETTINGS['cpassman_dir'].'/error.php';
69 69
     exit;
70 70
 }
71 71
 
Please login to merge, or discard this patch.
pages/folders.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('folders') === false) {
67 67
     // Not allowed page
68 68
     $session->set('system-error_code', ERR_NOT_ALLOWED);
69
-    include $SETTINGS['cpassman_dir'] . '/error.php';
69
+    include $SETTINGS['cpassman_dir'].'/error.php';
70 70
     exit;
71 71
 }
72 72
 
@@ -99,28 +99,28 @@  discard block
 block discarded – undo
99 99
 $complexityHtml = '<div id="hidden-select-complexity" class="hidden"><select id="select-complexity" class="form-control form-item-control save-me">';
100 100
 $complexitySelect = '';
101 101
 foreach (TP_PW_COMPLEXITY as $level) {
102
-    $complexitySelect .= '<option value="' . $level[0] . '">' . $level[1] . '</option>';
102
+    $complexitySelect .= '<option value="'.$level[0].'">'.$level[1].'</option>';
103 103
 }
104
-$complexityHtml .= $complexitySelect . '</select></div>';
104
+$complexityHtml .= $complexitySelect.'</select></div>';
105 105
 
106 106
 /* Get full tree structure */
107 107
 $tst = $tree->getDescendants();
108 108
 // prepare options list
109
-$droplist = '<option value="na">---' . $lang->get('select') . '---</option>';
109
+$droplist = '<option value="na">---'.$lang->get('select').'---</option>';
110 110
 if ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1 || (int) $session->get('user-can_create_root_folder') === 1) {
111
-    $droplist .= '<option value="0">' . $lang->get('root') . '</option>';
111
+    $droplist .= '<option value="0">'.$lang->get('root').'</option>';
112 112
 }
113 113
 foreach ($tst as $t) {
114 114
     if (
115 115
         in_array($t->id, $session->get('user-accessible_folders')) === true
116 116
         && in_array($t->id, $session->get('user-personal_visible_folders')) === false
117 117
     ) {
118
-        $droplist .= '<option value="' . $t->id . '">' . addslashes($t->title);
118
+        $droplist .= '<option value="'.$t->id.'">'.addslashes($t->title);
119 119
         $text = '';
120 120
         foreach ($tree->getPath($t->id, false) as $fld) {
121
-            $text .= empty($text) === true ? '     [' . $fld->title : ' > ' . $fld->title;
121
+            $text .= empty($text) === true ? '     ['.$fld->title : ' > '.$fld->title;
122 122
         }
123
-        $droplist .= (empty($text) === true ? '' : $text . '</i>]') . '</option>';
123
+        $droplist .= (empty($text) === true ? '' : $text.'</i>]').'</option>';
124 124
     }
125 125
 }
126 126
 
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
                                     <label><?php echo $lang->get('icon'); ?></label>
200 200
                                     <input type="text" class="form-control form-folder-control purify" id="new-folder-add-icon" data-field="icon">
201 201
                                     <small class='form-text text-muted'>
202
-                                        <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fas fa-external-link-alt ml-1"></i></a>
202
+                                        <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fas fa-external-link-alt ml-1"></i></a>
203 203
                                     </small>
204 204
                                 </div>
205 205
                                 <div class="form-group">
206 206
                                     <label><?php echo $lang->get('icon_on_selection'); ?></label>
207 207
                                     <input type="text" class="form-control form-folder-control purify" id="new-folder-add-icon-selected" data-field="iconSelected">
208 208
                                     <small class='form-text text-muted'>
209
-                                        <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fas fa-external-link-alt ml-1"></i></a>
209
+                                        <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fas fa-external-link-alt ml-1"></i></a>
210 210
                                     </small>
211 211
                                 </div>
212 212
                                 <div class="form-group">
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                                 <th scope="col" min-width="200px"><?php echo $lang->get('group'); ?></th>
298 298
                                 <th scope="col" min-width="200px"><?php echo $lang->get('group_parent'); ?></th>
299 299
                                 <th scope="col" width="50px"><i class="fas fa-gavel fa-lg infotip" title="<?php echo $lang->get('password_strength'); ?>"></i></th>
300
-                                <th scope="col" width="50px"><i class="fas fa-recycle fa-lg infotip" title="<?php echo $lang->get('group_pw_duration') . ' ' . $lang->get('group_pw_duration_tip'); ?>"></i></th>
300
+                                <th scope="col" width="50px"><i class="fas fa-recycle fa-lg infotip" title="<?php echo $lang->get('group_pw_duration').' '.$lang->get('group_pw_duration_tip'); ?>"></i></th>
301 301
                                 <th scope="col" width="50px"><i class="fas fa-pen fa-lg infotip" title="<?php echo $lang->get('auth_creation_without_complexity'); ?>"></i></th>
302 302
                                 <th scope="col" width="50px"><i class="fas fa-edit fa-lg infotip" title="<?php echo $lang->get('auth_modification_without_complexity'); ?>"></i></th>
303 303
                                 <th scope="col" width="50px"><i class="fas fa-folder fa-lg infotip" title="<?php echo $lang->get('icon'); ?>"></i></th>
Please login to merge, or discard this patch.
pages/users.js.php 1 patch
Spacing   +10 added lines, -10 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('users') === 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
 ?>
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
         if (store.get('teampassApplication').formUserAction === "add_new_user") {
303 303
             var data = {
304 304
                 'receipt': $('#form-email').val(),
305
-                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code');?>',
306
-                'body': '<?php echo $lang->get('email_body_new_user');?>',
305
+                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code'); ?>',
306
+                'body': '<?php echo $lang->get('email_body_new_user'); ?>',
307 307
                 'pre_replace' : {
308 308
                     '#code#' : store.get('teampassUser').admin_new_user_temporary_encryption_code,
309 309
                     '#login#' : store.get('teampassUser').admin_new_user_login,
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
         } else {
314 314
             var data = {
315 315
                 'receipt': $('#form-email').val(),
316
-                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code');?>',
317
-                'body': '<?php echo $lang->get('email_body_temporary_encryption_code');?>',
316
+                'subject': 'TEAMPASS - <?php echo $lang->get('temporary_encryption_code'); ?>',
317
+                'body': '<?php echo $lang->get('email_body_temporary_encryption_code'); ?>',
318 318
                 'pre_replace' : {
319 319
                     '#enc_code#' : store.get('teampassUser').admin_new_user_temporary_encryption_code,
320 320
                 }
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
             }
568 568
             // Inform user
569 569
             $("#warningModalBody").html('<b><?php echo $lang->get('encryption_keys'); ?> - ' +
570
-                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH;?>) + ']<span id="warningModalBody_extra">' + $nbItemsToConvert + '</span> ' +
570
+                stepText + '</b> [' + start + ' - ' + (parseInt(start) + <?php echo NUMBER_ITEMS_IN_BATCH; ?>) + ']<span id="warningModalBody_extra">' + $nbItemsToConvert + '</span> ' +
571 571
                 '... <?php echo $lang->get('please_wait'); ?><i class="fas fa-spinner fa-pulse ml-3 text-primary"></i>');
572 572
 
573 573
             // If expected, show the OPT to the admin
574 574
             if (constVisibleOTP === true) {
575 575
                 toastr.info(
576
-                    '<?php echo $lang->get('show_encryption_code_to_admin');?> <div><input class="form-control form-item-control flex-nowrap" value="' + userTemporaryCode + '" readonly></div>'
577
-                    + '<br /><button type="button" class="btn clear"><?php echo $lang->get('close');?></button>',
576
+                    '<?php echo $lang->get('show_encryption_code_to_admin'); ?> <div><input class="form-control form-item-control flex-nowrap" value="' + userTemporaryCode + '" readonly></div>'
577
+                    + '<br /><button type="button" class="btn clear"><?php echo $lang->get('close'); ?></button>',
578 578
                     '<?php echo $lang->get('information'); ?>',
579 579
                     {
580 580
                         extendedTimeOut: 0,
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
             var data = {
594 594
                 action: step,
595 595
                 start: start,
596
-                length: <?php echo NUMBER_ITEMS_IN_BATCH;?>,
596
+                length: <?php echo NUMBER_ITEMS_IN_BATCH; ?>,
597 597
                 user_id: userId,
598 598
             }
599 599
             if (debugJavascript === true) {
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
                         } else {
1402 1402
                             // Show icon or not
1403 1403
                             if ($('#user-disabled').prop('checked') === true) {
1404
-                                $('#user-login-'+userID).before('<i class="fas fa-user-slash infotip text-danger mr-2" title="<?php echo $lang->get('account_is_locked');?>" id="user-disable-'+userID+'"></i>');
1404
+                                $('#user-login-'+userID).before('<i class="fas fa-user-slash infotip text-danger mr-2" title="<?php echo $lang->get('account_is_locked'); ?>" id="user-disable-'+userID+'"></i>');
1405 1405
                             } else {
1406 1406
                                 $('#user-disable-'+userID).remove();
1407 1407
                             }
Please login to merge, or discard this patch.
pages/uploads.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('uploads') === false) {
63 63
     // Not allowed page
64 64
     $session->set('system-error_code', ERR_NOT_ALLOWED);
65
-    include $SETTINGS['cpassman_dir'] . '/error.php';
65
+    include $SETTINGS['cpassman_dir'].'/error.php';
66 66
     exit;
67 67
 }
68 68
 ?>
Please login to merge, or discard this patch.