Passed
Branch — remove-tp-config (101a80)
by Nils
11:52
created
sources/utils.queries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 ) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
Please login to merge, or discard this patch.
sources/favourites.queries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 ) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
Please login to merge, or discard this patch.
sources/items.logs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 ) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
Please login to merge, or discard this patch.
pages/utilities.logs.php 1 patch
Spacing   +3 added lines, -3 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('utilities.logs') === 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
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                                             echo $session->has('user-admin') && (int) $session->get('user-admin') && null !== $session->get('user-admin') && (int) $session->get('user-admin') === 1 ? '' : ' hidden';
204 204
                                             ?>">
205 205
                         <div class="form-group">
206
-                            <h5><i class="fas fa-broom mr-2"></i><?php echo $lang->get('purge') . ' ' . $lang->get('date_range'); ?></h5>
206
+                            <h5><i class="fas fa-broom mr-2"></i><?php echo $lang->get('purge').' '.$lang->get('date_range'); ?></h5>
207 207
                             <div class="input-group">
208 208
                                 <div class="input-group-prepend">
209 209
                                     <span class="input-group-text">
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                                     <select class="form-control" id="purge-filter-user">
227 227
                                         <option value="-1"><?php echo $lang->get('all'); ?></option>
228 228
                                     <?php
229
-                                    $rows = DB::query('SELECT id, name, lastname FROM ' . prefixTable('users') . ' WHERE admin = 0');
229
+                                    $rows = DB::query('SELECT id, name, lastname FROM '.prefixTable('users').' WHERE admin = 0');
230 230
 foreach ($rows as $record) {
231 231
     echo '
232 232
                                         <option value="'.$record['id'].'">'.$record['name'].' '.$record['lastname'].'</option>';
Please login to merge, or discard this patch.
error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     // Update table by deleting ID
61 61
     if ($session->has('user-id') && null !== $session->get('user-id')) {
62 62
         DB::update(
63
-            DB_PREFIX . 'users',
63
+            DB_PREFIX.'users',
64 64
             [
65 65
                 'key_tempo' => '',
66 66
             ],
Please login to merge, or discard this patch.
sources/main.functions.php 3 patches
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2226 2226
  *
2227 2227
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2228
-  *
2228
+ *
2229 2229
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2230 2230
  * @param int    $filePerm The permissions any found files should get.
2231 2231
  * @param int    $dirPerm  The permissions any found folder should get.
@@ -3848,7 +3848,6 @@  discard block
 block discarded – undo
3848 3848
  * @param integer $processId
3849 3849
  * @param integer $nbItemsToTreat
3850 3850
  * @return void
3851
- 
3852 3851
  */
3853 3852
 function createUserTasks($processId, $nbItemsToTreat): void
3854 3853
 {
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2621,7 +2621,9 @@  discard block
 block discarded – undo
2621 2621
     $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2622 2622
     $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2623 2623
 
2624
-    if (WIP) error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
2624
+    if (WIP) {
2625
+        error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
2626
+    }
2625 2627
 
2626 2628
     // Decrypt file content and return
2627 2629
     return base64_encode($cipher->decrypt($ciphertext));
@@ -2749,7 +2751,9 @@  discard block
 block discarded – undo
2749 2751
         foreach ($users as $user) {
2750 2752
             // Insert in DB the new object key for this item by user
2751 2753
             if (count($objectKeyArray) === 0) {
2752
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2754
+                if (WIP === true) {
2755
+                    error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2756
+                }
2753 2757
                 DB::insert(
2754 2758
                     $object_name,
2755 2759
                     [
@@ -2763,7 +2767,9 @@  discard block
 block discarded – undo
2763 2767
                 );
2764 2768
             } else {
2765 2769
                 foreach ($objectKeyArray as $object) {
2766
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2770
+                    if (WIP === true) {
2771
+                        error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2772
+                    }
2767 2773
                     DB::insert(
2768 2774
                         $object_name,
2769 2775
                         [
@@ -3608,7 +3614,9 @@  discard block
 block discarded – undo
3608 3614
     );
3609 3615
     
3610 3616
     // if not exists then error
3611
-    if (is_null($val) === true || count($val) === 0 || defined('UPGRADE_MIN_DATE') === false) return true;
3617
+    if (is_null($val) === true || count($val) === 0 || defined('UPGRADE_MIN_DATE') === false) {
3618
+        return true;
3619
+    }
3612 3620
 
3613 3621
     // if empty or too old then error
3614 3622
     if (empty($val['valeur']) === true || (int) $val['valeur'] < (int) UPGRADE_MIN_DATE) {
Please login to merge, or discard this patch.
Spacing   +150 added lines, -153 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
  */
227 227
 function trimElement($chaine, string $element): string
228 228
 {
229
-    if (! empty($chaine)) {
229
+    if (!empty($chaine)) {
230 230
         if (is_array($chaine) === true) {
231 231
             $chaine = implode(';', $chaine);
232 232
         }
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function db_error_handler(array $params): void
276 276
 {
277
-    echo 'Error: ' . $params['error'] . "<br>\n";
278
-    echo 'Query: ' . $params['query'] . "<br>\n";
277
+    echo 'Error: '.$params['error']."<br>\n";
278
+    echo 'Query: '.$params['query']."<br>\n";
279 279
     throw new Exception('Error - Query', 1);
280 280
 }
281 281
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     $globalsVisibleFolders = $session->get('user-accessible_folders');
356 356
     $globalsPersonalVisibleFolders = $session->get('user-personal_visible_folders');
357 357
     // Get list of Folders
358
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
358
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
359 359
     foreach ($rows as $record) {
360 360
         array_push($groupesVisibles, $record['id']);
361 361
     }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     }
375 375
     // Get ID of personal folder
376 376
     $persfld = DB::queryfirstrow(
377
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
377
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
378 378
         $globalsUserId
379 379
     );
380 380
     if (empty($persfld['id']) === false) {
@@ -394,20 +394,20 @@  discard block
 block discarded – undo
394 394
     // get complete list of ROLES
395 395
     $tmp = explode(';', $idFonctions);
396 396
     $rows = DB::query(
397
-        'SELECT * FROM ' . prefixTable('roles_title') . '
397
+        'SELECT * FROM '.prefixTable('roles_title').'
398 398
         ORDER BY title ASC'
399 399
     );
400 400
     foreach ($rows as $record) {
401
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
401
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
402 402
             array_push($tmp, $record['id']);
403 403
         }
404 404
     }
405 405
     $session->set('user-roles', implode(';', $tmp));
406 406
     $session->set('user-admin', 1);
407 407
     // Check if admin has created Folders and Roles
408
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
408
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
409 409
     $session->set('user-nb_folders', DB::count());
410
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
410
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
411 411
     $session->set('user-nb_roles', DB::count());
412 412
 
413 413
     return true;
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     // Does this user is allowed to see other items
491 491
     $inc = 0;
492 492
     $rows = DB::query(
493
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
493
+        'SELECT id, id_tree FROM '.prefixTable('items').'
494 494
             WHERE restricted_to LIKE %ss AND inactif = %s'.
495 495
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
496 496
         $globalsUserId,
@@ -507,8 +507,8 @@  discard block
 block discarded – undo
507 507
     // Check for the users roles if some specific rights exist on items
508 508
     $rows = DB::query(
509 509
         'SELECT i.id_tree, r.item_id
510
-        FROM ' . prefixTable('items') . ' as i
511
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
510
+        FROM ' . prefixTable('items').' as i
511
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
512 512
         WHERE i.id_tree <> "" '.
513 513
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
514 514
         'ORDER BY i.id_tree ASC',
@@ -562,16 +562,16 @@  discard block
 block discarded – undo
562 562
         ), SORT_NUMERIC)
563 563
     );
564 564
     // Folders and Roles numbers
565
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
565
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
566 566
     $session->set('user-nb_folders', DB::count());
567
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
567
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
568 568
     $session->set('user-nb_roles', DB::count());
569 569
     // check if change proposals on User's items
570 570
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
571 571
         $countNewItems = DB::query(
572 572
             'SELECT COUNT(*)
573
-            FROM ' . prefixTable('items_change') . ' AS c
574
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
573
+            FROM ' . prefixTable('items_change').' AS c
574
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
575 575
             WHERE i.action = %s AND i.id_user = %i',
576 576
             'at_creation',
577 577
             $globalsUserId
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 {
599 599
     $rows = DB::query(
600 600
         'SELECT *
601
-        FROM ' . prefixTable('roles_values') . '
601
+        FROM ' . prefixTable('roles_values').'
602 602
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
603 603
         ['W', 'ND', 'NE', 'NDNE', 'R'],
604 604
         $userRoles,
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
     ) {
666 666
         $persoFld = DB::queryfirstrow(
667 667
             'SELECT id
668
-            FROM ' . prefixTable('nested_tree') . '
668
+            FROM ' . prefixTable('nested_tree').'
669 669
             WHERE title = %s AND personal_folder = %i'.
670 670
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
671 671
             $globalsUserId,
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
     }
699 699
     $persoFlds = DB::query(
700 700
         'SELECT id
701
-        FROM ' . prefixTable('nested_tree') . '
701
+        FROM ' . prefixTable('nested_tree').'
702 702
         WHERE %l',
703 703
         $where
704 704
     );
@@ -766,12 +766,12 @@  discard block
 block discarded – undo
766 766
     //Load Tree
767 767
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
768 768
     // truncate table
769
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
769
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
770 770
     // reload date
771 771
     $rows = DB::query(
772 772
         'SELECT *
773
-        FROM ' . prefixTable('items') . ' as i
774
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
773
+        FROM ' . prefixTable('items').' as i
774
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
775 775
         AND l.action = %s
776 776
         AND i.inactif = %i',
777 777
         'at_creation',
@@ -783,18 +783,18 @@  discard block
 block discarded – undo
783 783
             $tags = '';
784 784
             $itemTags = DB::query(
785 785
                 'SELECT tag
786
-                FROM ' . prefixTable('tags') . '
786
+                FROM ' . prefixTable('tags').'
787 787
                 WHERE item_id = %i AND tag != ""',
788 788
                 $record['id']
789 789
             );
790 790
             foreach ($itemTags as $itemTag) {
791
-                $tags .= $itemTag['tag'] . ' ';
791
+                $tags .= $itemTag['tag'].' ';
792 792
             }
793 793
 
794 794
             // Get renewal period
795 795
             $resNT = DB::queryfirstrow(
796 796
                 'SELECT renewal_period
797
-                FROM ' . prefixTable('nested_tree') . '
797
+                FROM ' . prefixTable('nested_tree').'
798 798
                 WHERE id = %i',
799 799
                 $record['id_tree']
800 800
             );
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
                     // Is this a User id?
808 808
                     $user = DB::queryfirstrow(
809 809
                         'SELECT id, login
810
-                        FROM ' . prefixTable('users') . '
810
+                        FROM ' . prefixTable('users').'
811 811
                         WHERE id = %i',
812 812
                         $elem->title
813 813
                     );
@@ -825,11 +825,11 @@  discard block
 block discarded – undo
825 825
                     'id' => $record['id'],
826 826
                     'label' => $record['label'],
827 827
                     'description' => $record['description'] ?? '',
828
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
828
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
829 829
                     'tags' => $tags,
830 830
                     'id_tree' => $record['id_tree'],
831 831
                     'perso' => $record['perso'],
832
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
832
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
833 833
                     'login' => $record['login'] ?? '',
834 834
                     'folder' => implode(' > ', $folder),
835 835
                     'author' => $record['id_user'],
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
     // get new value from db
859 859
     $data = DB::queryfirstrow(
860 860
         'SELECT label, description, id_tree, perso, restricted_to, login, url
861
-        FROM ' . prefixTable('items') . '
861
+        FROM ' . prefixTable('items').'
862 862
         WHERE id=%i',
863 863
         $ident
864 864
     );
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
     $tags = '';
867 867
     $itemTags = DB::query(
868 868
         'SELECT tag
869
-            FROM ' . prefixTable('tags') . '
869
+            FROM ' . prefixTable('tags').'
870 870
             WHERE item_id = %i AND tag != ""',
871 871
         $ident
872 872
     );
873 873
     foreach ($itemTags as $itemTag) {
874
-        $tags .= $itemTag['tag'] . ' ';
874
+        $tags .= $itemTag['tag'].' ';
875 875
     }
876 876
     // form id_tree to full foldername
877 877
     $folder = [];
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
             // Is this a User id?
883 883
             $user = DB::queryfirstrow(
884 884
                 'SELECT id, login
885
-                FROM ' . prefixTable('users') . '
885
+                FROM ' . prefixTable('users').'
886 886
                 WHERE id = %i',
887 887
                 $elem->title
888 888
             );
@@ -900,10 +900,10 @@  discard block
 block discarded – undo
900 900
             'label' => $data['label'],
901 901
             'description' => $data['description'],
902 902
             'tags' => $tags,
903
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
903
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
904 904
             'id_tree' => $data['id_tree'],
905 905
             'perso' => $data['perso'],
906
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
906
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
907 907
             'login' => $data['login'] ?? '',
908 908
             'folder' => implode(' » ', $folder),
909 909
             'author' => $session->get('user-id'),
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
933 933
     // get new value from db
934 934
     $data = DB::queryFirstRow(
935 935
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
936
-        FROM ' . prefixTable('items') . ' as i
937
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
936
+        FROM ' . prefixTable('items').' as i
937
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
938 938
         WHERE i.id = %i
939 939
         AND l.action = %s',
940 940
         $ident,
@@ -944,12 +944,12 @@  discard block
 block discarded – undo
944 944
     $tags = '';
945 945
     $itemTags = DB::query(
946 946
         'SELECT tag
947
-            FROM ' . prefixTable('tags') . '
947
+            FROM ' . prefixTable('tags').'
948 948
             WHERE item_id = %i AND tag != ""',
949 949
         $ident
950 950
     );
951 951
     foreach ($itemTags as $itemTag) {
952
-        $tags .= $itemTag['tag'] . ' ';
952
+        $tags .= $itemTag['tag'].' ';
953 953
     }
954 954
     // form id_tree to full foldername
955 955
     $folder = [];
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
             // Is this a User id?
961 961
             $user = DB::queryfirstrow(
962 962
                 'SELECT id, login
963
-                FROM ' . prefixTable('users') . '
963
+                FROM ' . prefixTable('users').'
964 964
                 WHERE id = %i',
965 965
                 $elem->title
966 966
             );
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
             'label' => $data['label'],
980 980
             'description' => $data['description'],
981 981
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
982
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
982
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
983 983
             'id_tree' => $data['id_tree'],
984 984
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
985 985
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1001,52 +1001,52 @@  discard block
 block discarded – undo
1001 1001
 function getStatisticsData(array $SETTINGS): array
1002 1002
 {
1003 1003
     DB::query(
1004
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1004
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1005 1005
         0
1006 1006
     );
1007 1007
     $counter_folders = DB::count();
1008 1008
     DB::query(
1009
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1009
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1010 1010
         1
1011 1011
     );
1012 1012
     $counter_folders_perso = DB::count();
1013 1013
     DB::query(
1014
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1014
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1015 1015
         0
1016 1016
     );
1017 1017
     $counter_items = DB::count();
1018 1018
         DB::query(
1019
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1019
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1020 1020
         1
1021 1021
     );
1022 1022
     $counter_items_perso = DB::count();
1023 1023
         DB::query(
1024
-        'SELECT id FROM ' . prefixTable('users') . ''
1024
+        'SELECT id FROM '.prefixTable('users').''
1025 1025
     );
1026 1026
     $counter_users = DB::count();
1027 1027
         DB::query(
1028
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1028
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1029 1029
         1
1030 1030
     );
1031 1031
     $admins = DB::count();
1032 1032
     DB::query(
1033
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1033
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1034 1034
         1
1035 1035
     );
1036 1036
     $managers = DB::count();
1037 1037
     DB::query(
1038
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1038
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1039 1039
         1
1040 1040
     );
1041 1041
     $readOnly = DB::count();
1042 1042
     // list the languages
1043 1043
     $usedLang = [];
1044 1044
     $tp_languages = DB::query(
1045
-        'SELECT name FROM ' . prefixTable('languages')
1045
+        'SELECT name FROM '.prefixTable('languages')
1046 1046
     );
1047 1047
     foreach ($tp_languages as $tp_language) {
1048 1048
         DB::query(
1049
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1049
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1050 1050
             $tp_language['name']
1051 1051
         );
1052 1052
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
     // get list of ips
1056 1056
     $usedIp = [];
1057 1057
     $tp_ips = DB::query(
1058
-        'SELECT user_ip FROM ' . prefixTable('users')
1058
+        'SELECT user_ip FROM '.prefixTable('users')
1059 1059
     );
1060 1060
     foreach ($tp_ips as $ip) {
1061 1061
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1062 1062
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1063
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1063
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1064 1064
             $usedIp[$ip['user_ip']] = 1;
1065 1065
         }
1066 1066
     }
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
         <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;">
1154 1154
         <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;">
1155 1155
         <br><div style="float:right;">' .
1156
-        $textMail .
1156
+        $textMail.
1157 1157
         '<br><br></td></tr></table>
1158 1158
     </td></tr></table>
1159 1159
     <br></body></html>';
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 {
1235 1235
     array_walk_recursive(
1236 1236
         $array,
1237
-        static function (&$item): void {
1237
+        static function(&$item): void {
1238 1238
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1239 1239
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1240 1240
             }
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
  */
1328 1328
 function prefixTable(string $table): string
1329 1329
 {
1330
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1330
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1331 1331
     if (empty($safeTable) === false) {
1332 1332
         // sanitize string
1333 1333
         return $safeTable;
@@ -1449,7 +1449,7 @@  discard block
 block discarded – undo
1449 1449
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1450 1450
 {
1451 1451
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1452
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1452
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1453 1453
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1454 1454
     socket_close($sock);
1455 1455
 }
@@ -1496,14 +1496,14 @@  discard block
 block discarded – undo
1496 1496
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1497 1497
         if ($type === 'user_mngt') {
1498 1498
             send_syslog(
1499
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1499
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1500 1500
                 $SETTINGS['syslog_host'],
1501 1501
                 $SETTINGS['syslog_port'],
1502 1502
                 'teampass'
1503 1503
             );
1504 1504
         } else {
1505 1505
             send_syslog(
1506
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1506
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1507 1507
                 $SETTINGS['syslog_host'],
1508 1508
                 $SETTINGS['syslog_port'],
1509 1509
                 'teampass'
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
         if (empty($item_label) === true) {
1579 1579
             $dataItem = DB::queryfirstrow(
1580 1580
                 'SELECT id, id_tree, label
1581
-                FROM ' . prefixTable('items') . '
1581
+                FROM ' . prefixTable('items').'
1582 1582
                 WHERE id = %i',
1583 1583
                 $item_id
1584 1584
             );
@@ -1586,11 +1586,11 @@  discard block
 block discarded – undo
1586 1586
         }
1587 1587
 
1588 1588
         send_syslog(
1589
-            'action=' . str_replace('at_', '', $action) .
1590
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1591
-                ' itemno=' . $item_id .
1592
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1593
-                ' itemname="' . addslashes($item_label) . '"',
1589
+            'action='.str_replace('at_', '', $action).
1590
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1591
+                ' itemno='.$item_id.
1592
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1593
+                ' itemname="'.addslashes($item_label).'"',
1594 1594
             $SETTINGS['syslog_host'],
1595 1595
             $SETTINGS['syslog_port'],
1596 1596
             'teampass'
@@ -1622,8 +1622,8 @@  discard block
 block discarded – undo
1622 1622
     $notification = DB::queryOneColumn(
1623 1623
         'email',
1624 1624
         'SELECT *
1625
-        FROM ' . prefixTable('notification') . ' AS n
1626
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1625
+        FROM ' . prefixTable('notification').' AS n
1626
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1627 1627
         WHERE n.item_id = %i AND n.user_id != %i',
1628 1628
         $item_id,
1629 1629
         $globalsUserId
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
         // Get list of changes
1635 1635
         $htmlChanges = '<ul>';
1636 1636
         foreach ($changes as $change) {
1637
-            $htmlChanges .= '<li>' . $change . '</li>';
1637
+            $htmlChanges .= '<li>'.$change.'</li>';
1638 1638
         }
1639 1639
         $htmlChanges .= '</ul>';
1640 1640
         // send email
@@ -1671,15 +1671,15 @@  discard block
 block discarded – undo
1671 1671
     $path = '';
1672 1672
     foreach ($arbo as $elem) {
1673 1673
         if (empty($path) === true) {
1674
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1674
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1675 1675
         } else {
1676
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1676
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1677 1677
         }
1678 1678
     }
1679 1679
 
1680 1680
     // Build text to show user
1681 1681
     if (empty($label) === false) {
1682
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1682
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1683 1683
     }
1684 1684
     return empty($path) === true ? '' : $path;
1685 1685
 }
@@ -1737,7 +1737,7 @@  discard block
 block discarded – undo
1737 1737
  */
1738 1738
 function handleConfigFile(string $action, array $settings, string $field = null, string $value = null, int $isEncrypted = 0)
1739 1739
 {
1740
-    $configFilePath = $settings['cpassman_dir'] . '/includes/config/tp.config.php';
1740
+    $configFilePath = $settings['cpassman_dir'].'/includes/config/tp.config.php';
1741 1741
 
1742 1742
     // Load class DB
1743 1743
     loadClasses('DB');
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
 {
1766 1766
     // Perform a copy if the file exists
1767 1767
     if (file_exists($configFilePath)) {
1768
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1768
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1769 1769
         if (!copy($configFilePath, $backupFilePath)) {
1770 1770
             return "ERROR: Could not copy file '$configFilePath'";
1771 1771
         }
@@ -1773,10 +1773,10 @@  discard block
 block discarded – undo
1773 1773
 
1774 1774
     // Regenerate the config file
1775 1775
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1776
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1776
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1777 1777
     foreach ($rows as $record) {
1778 1778
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1779
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1779
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1780 1780
     }
1781 1781
     $data[] = ");\n";
1782 1782
     $data = array_unique($data);
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
 
1809 1809
         if (stristr($line, "'$field' => '")) {
1810 1810
             $value = getEncryptedValue($value, $isEncrypted);
1811
-            $data[$index] = "    '$field' => '" . htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1811
+            $data[$index] = "    '$field' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1812 1812
             $lineIndex = $index;
1813 1813
             break;
1814 1814
         }
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
 
1817 1817
     if ($lineIndex === null) {
1818 1818
         $value = getEncryptedValue($value, $isEncrypted);
1819
-        $data[] = "    '$field' => '" . htmlspecialchars_decode($value, ENT_COMPAT) . "',\n);\n";
1819
+        $data[] = "    '$field' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n);\n";
1820 1820
     }
1821 1821
 
1822 1822
     // Update the file
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
 {
1862 1862
     global $SETTINGS;
1863 1863
     /* LOAD CPASSMAN SETTINGS */
1864
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1864
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1865 1865
         $SETTINGS = [];
1866 1866
         $SETTINGS['duplicate_folder'] = 0;
1867 1867
         //by default, this is set to 0;
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
         //by default, this value is set to 5;
1872 1872
         $settings = [];
1873 1873
         $rows = DB::query(
1874
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1874
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1875 1875
             [
1876 1876
                 'type' => 'admin',
1877 1877
                 'type2' => 'settings',
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
     $source_cf = [];
1904 1904
     $rows = DB::QUERY(
1905 1905
         'SELECT id_category
1906
-            FROM ' . prefixTable('categories_folders') . '
1906
+            FROM ' . prefixTable('categories_folders').'
1907 1907
             WHERE id_folder = %i',
1908 1908
         $source_id
1909 1909
     );
@@ -1914,7 +1914,7 @@  discard block
 block discarded – undo
1914 1914
     $target_cf = [];
1915 1915
     $rows = DB::QUERY(
1916 1916
         'SELECT id_category
1917
-            FROM ' . prefixTable('categories_folders') . '
1917
+            FROM ' . prefixTable('categories_folders').'
1918 1918
             WHERE id_folder = %i',
1919 1919
         $target_id
1920 1920
     );
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
 ) {
2134 2134
     // Check if the path exists
2135 2135
     $path = basename($path);
2136
-    if (! file_exists($path)) {
2136
+    if (!file_exists($path)) {
2137 2137
         return false;
2138 2138
     }
2139 2139
 
@@ -2186,7 +2186,7 @@  discard block
 block discarded – undo
2186 2186
     // Load item data
2187 2187
     $data = DB::queryFirstRow(
2188 2188
         'SELECT id_tree
2189
-        FROM ' . prefixTable('items') . '
2189
+        FROM ' . prefixTable('items').'
2190 2190
         WHERE id = %i',
2191 2191
         $item_id
2192 2192
     );
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
         }
2250 2250
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2251 2251
     }
2252
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2252
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2253 2253
     return $email;
2254 2254
 }
2255 2255
 
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
     
2273 2273
     // Insert log in DB
2274 2274
     return DB::query(
2275
-        'SELECT ' . $fields . '
2275
+        'SELECT '.$fields.'
2276 2276
         FROM ' . prefixTable($table)
2277 2277
     );
2278 2278
 }
@@ -2287,11 +2287,11 @@  discard block
 block discarded – undo
2287 2287
 function formatSizeUnits(int $bytes): string
2288 2288
 {
2289 2289
     if ($bytes >= 1073741824) {
2290
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2290
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2291 2291
     } elseif ($bytes >= 1048576) {
2292
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2292
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2293 2293
     } elseif ($bytes >= 1024) {
2294
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2294
+        $bytes = number_format($bytes / 1024, 2).' KB';
2295 2295
     } elseif ($bytes > 1) {
2296 2296
         $bytes .= ' bytes';
2297 2297
     } elseif ($bytes === 1) {
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
     $cipher->enableContinuousBuffer();
2535 2535
 
2536 2536
     // Encrypt the file content
2537
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2537
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2538 2538
     $fileContent = file_get_contents($filePath);
2539 2539
     $plaintext = $fileContent;
2540 2540
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2542,9 +2542,9 @@  discard block
 block discarded – undo
2542 2542
     // Save new file
2543 2543
     // deepcode ignore InsecureHash: is simply used to get a unique name
2544 2544
     $hash = md5($plaintext);
2545
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2545
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2546 2546
     file_put_contents($fileOut, $ciphertext);
2547
-    unlink($fileInPath . '/' . $fileInName);
2547
+    unlink($fileInPath.'/'.$fileInName);
2548 2548
     return [
2549 2549
         'fileHash' => base64_encode($hash),
2550 2550
         'objectKey' => base64_encode($objectKey),
@@ -2562,7 +2562,7 @@  discard block
 block discarded – undo
2562 2562
  */
2563 2563
 function decryptFile(string $fileName, string $filePath, string $key): string
2564 2564
 {
2565
-    if (! defined('FILE_BUFFER_SIZE')) {
2565
+    if (!defined('FILE_BUFFER_SIZE')) {
2566 2566
         define('FILE_BUFFER_SIZE', 128 * 1024);
2567 2567
     }
2568 2568
     
@@ -2579,7 +2579,7 @@  discard block
 block discarded – undo
2579 2579
     $cipher->enableContinuousBuffer();
2580 2580
     $cipher->disablePadding();
2581 2581
     // Get file content
2582
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2582
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2583 2583
     $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2584 2584
 
2585 2585
     if (WIP) error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
@@ -2665,8 +2665,8 @@  discard block
 block discarded – undo
2665 2665
         // Only create the sharekey for a user
2666 2666
         $user = DB::queryFirstRow(
2667 2667
             'SELECT public_key
2668
-            FROM ' . prefixTable('users') . '
2669
-            WHERE id = ' . ($apiUserId === -1 ? (int) $session->get('user-id') : $apiUserId) . '
2668
+            FROM ' . prefixTable('users').'
2669
+            WHERE id = ' . ($apiUserId === -1 ? (int) $session->get('user-id') : $apiUserId).'
2670 2670
             AND public_key != ""'
2671 2671
         );
2672 2672
 
@@ -2703,17 +2703,16 @@  discard block
 block discarded – undo
2703 2703
         //DB::debugmode(true);
2704 2704
         $users = DB::query(
2705 2705
             'SELECT id, public_key
2706
-            FROM ' . prefixTable('users') . '
2706
+            FROM ' . prefixTable('users').'
2707 2707
             WHERE ' . ($onlyForUser === true ? 
2708
-                'id IN ("' . TP_USER_ID . '","' . ($apiUserId === -1 ? (int) $session->get('user-id') : $apiUserId) . '") ' : 
2709
-                'id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '"'.($all_users_except_id === -1 ? '' : ', "'.$all_users_except_id.'"').') ') . '
2708
+                'id IN ("'.TP_USER_ID.'","'.($apiUserId === -1 ? (int) $session->get('user-id') : $apiUserId).'") ' : 'id NOT IN ("'.OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'"'.($all_users_except_id === -1 ? '' : ', "'.$all_users_except_id.'"').') ').'
2710 2709
             AND public_key != ""'
2711 2710
         );
2712 2711
         //DB::debugmode(false);
2713 2712
         foreach ($users as $user) {
2714 2713
             // Insert in DB the new object key for this item by user
2715 2714
             if (count($objectKeyArray) === 0) {
2716
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2715
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2717 2716
                 DB::insert(
2718 2717
                     $object_name,
2719 2718
                     [
@@ -2727,7 +2726,7 @@  discard block
 block discarded – undo
2727 2726
                 );
2728 2727
             } else {
2729 2728
                 foreach ($objectKeyArray as $object) {
2730
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2729
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2731 2730
                     DB::insert(
2732 2731
                         $object_name,
2733 2732
                         [
@@ -2755,7 +2754,7 @@  discard block
 block discarded – undo
2755 2754
 function isBase64(string $str): bool
2756 2755
 {
2757 2756
     $str = (string) trim($str);
2758
-    if (! isset($str[0])) {
2757
+    if (!isset($str[0])) {
2759 2758
         return false;
2760 2759
     }
2761 2760
 
@@ -2829,7 +2828,7 @@  discard block
 block discarded – undo
2829 2828
     } catch (\LdapRecord\Auth\BindException $e) {
2830 2829
         $error = $e->getDetailedError();
2831 2830
         if ($error) {
2832
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2831
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2833 2832
         } else {
2834 2833
             error_log('TEAMPASS Error - LDAP - Code: '.$e->getCode().' - Message: '.$e->getMessage());
2835 2834
         }
@@ -2848,7 +2847,7 @@  discard block
 block discarded – undo
2848 2847
     } catch (\LdapRecord\Auth\BindException $e) {
2849 2848
         $error = $e->getDetailedError();
2850 2849
         if ($error) {
2851
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2850
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2852 2851
         } else {
2853 2852
             error_log('TEAMPASS Error - LDAP - Code: '.$e->getCode().' - Message: '.$e->getMessage());
2854 2853
         }
@@ -2877,7 +2876,7 @@  discard block
 block discarded – undo
2877 2876
     // expect if personal item
2878 2877
     DB::delete(
2879 2878
         prefixTable('sharekeys_items'),
2880
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2879
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2881 2880
         $userId
2882 2881
     );
2883 2882
     // Remove all item sharekeys files
@@ -2885,8 +2884,8 @@  discard block
 block discarded – undo
2885 2884
         prefixTable('sharekeys_files'),
2886 2885
         'user_id = %i AND object_id NOT IN (
2887 2886
             SELECT f.id 
2888
-            FROM ' . prefixTable('items') . ' AS i 
2889
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2887
+            FROM ' . prefixTable('items').' AS i 
2888
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2890 2889
             WHERE i.perso = 1
2891 2890
         )',
2892 2891
         $userId
@@ -2896,8 +2895,8 @@  discard block
 block discarded – undo
2896 2895
         prefixTable('sharekeys_fields'),
2897 2896
         'user_id = %i AND object_id NOT IN (
2898 2897
             SELECT c.id 
2899
-            FROM ' . prefixTable('items') . ' AS i 
2900
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2898
+            FROM ' . prefixTable('items').' AS i 
2899
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2901 2900
             WHERE i.perso = 1
2902 2901
         )',
2903 2902
         $userId
@@ -2905,13 +2904,13 @@  discard block
 block discarded – undo
2905 2904
     // Remove all item sharekeys logs
2906 2905
     DB::delete(
2907 2906
         prefixTable('sharekeys_logs'),
2908
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2907
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2909 2908
         $userId
2910 2909
     );
2911 2910
     // Remove all item sharekeys suggestions
2912 2911
     DB::delete(
2913 2912
         prefixTable('sharekeys_suggestions'),
2914
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2913
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2915 2914
         $userId
2916 2915
     );
2917 2916
     return false;
@@ -2932,7 +2931,7 @@  discard block
 block discarded – undo
2932 2931
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2933 2932
             $now->setTimezone(new DateTimeZone($timezone));
2934 2933
             $offsets[] = $offset = $now->getOffset();
2935
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2934
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2936 2935
         }
2937 2936
 
2938 2937
         array_multisort($offsets, $timezones);
@@ -2952,7 +2951,7 @@  discard block
 block discarded – undo
2952 2951
 {
2953 2952
     $hours = intval($offset / 3600);
2954 2953
     $minutes = abs(intval($offset % 3600 / 60));
2955
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2954
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2956 2955
 }
2957 2956
 
2958 2957
 /**
@@ -3052,8 +3051,7 @@  discard block
 block discarded – undo
3052 3051
 {
3053 3052
     if (isset($array[$key]) === true
3054 3053
         && (is_int($value) === true ?
3055
-            (int) $array[$key] === $value :
3056
-            (string) $array[$key] === $value)
3054
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3057 3055
     ) {
3058 3056
         return true;
3059 3057
     }
@@ -3075,8 +3073,7 @@  discard block
 block discarded – undo
3075 3073
 {
3076 3074
     if (isset($var) === false
3077 3075
         || (is_int($value) === true ?
3078
-            (int) $var === $value :
3079
-            (string) $var === $value)
3076
+            (int) $var === $value : (string) $var === $value)
3080 3077
     ) {
3081 3078
         return true;
3082 3079
     }
@@ -3127,7 +3124,7 @@  discard block
 block discarded – undo
3127 3124
  */
3128 3125
 function isSetArrayOfValues(array $arrayOfValues): bool
3129 3126
 {
3130
-    foreach($arrayOfValues as $value) {
3127
+    foreach ($arrayOfValues as $value) {
3131 3128
         if (isset($value) === false) {
3132 3129
             return false;
3133 3130
         }
@@ -3149,7 +3146,7 @@  discard block
 block discarded – undo
3149 3146
     /*PHP8 - integer|string*/$value
3150 3147
 ) : bool
3151 3148
 {
3152
-    foreach($arrayOfVars as $variable) {
3149
+    foreach ($arrayOfVars as $variable) {
3153 3150
         if ($variable !== $value) {
3154 3151
             return false;
3155 3152
         }
@@ -3169,7 +3166,7 @@  discard block
 block discarded – undo
3169 3166
     /*PHP8 - integer|string*/$value
3170 3167
 ) : bool
3171 3168
 {
3172
-    foreach($arrayOfVars as $variable) {
3169
+    foreach ($arrayOfVars as $variable) {
3173 3170
         if ($variable === $value) {
3174 3171
             return true;
3175 3172
         }
@@ -3238,7 +3235,7 @@  discard block
 block discarded – undo
3238 3235
  * @param array     $filters
3239 3236
  * @return array|string
3240 3237
  */
3241
-function dataSanitizer(array $data, array $filters): array|string
3238
+function dataSanitizer(array $data, array $filters): array | string
3242 3239
 {
3243 3240
     // Load Sanitizer library
3244 3241
     $sanitizer = new Sanitizer($data, $filters);
@@ -3267,7 +3264,7 @@  discard block
 block discarded – undo
3267 3264
     // Exists ?
3268 3265
     $userCacheId = DB::queryfirstrow(
3269 3266
         'SELECT increment_id
3270
-        FROM ' . prefixTable('cache_tree') . '
3267
+        FROM ' . prefixTable('cache_tree').'
3271 3268
         WHERE user_id = %i',
3272 3269
         $user_id
3273 3270
     );
@@ -3318,7 +3315,7 @@  discard block
 block discarded – undo
3318 3315
  */
3319 3316
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3320 3317
 { 
3321
-    $resultat = ($nombre/$total) * $pourcentage;
3318
+    $resultat = ($nombre / $total) * $pourcentage;
3322 3319
     return round($resultat);
3323 3320
 }
3324 3321
 
@@ -3348,7 +3345,7 @@  discard block
 block discarded – undo
3348 3345
 
3349 3346
     // Get last folder update
3350 3347
     $lastFolderChange = DB::queryfirstrow(
3351
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3348
+        'SELECT valeur FROM '.prefixTable('misc').'
3352 3349
         WHERE type = %s AND intitule = %s',
3353 3350
         'timestamp',
3354 3351
         'last_folder_change'
@@ -3379,7 +3376,7 @@  discard block
 block discarded – undo
3379 3376
     // Does this user has a tree cache
3380 3377
     $userCacheTree = DB::queryfirstrow(
3381 3378
         'SELECT '.$fieldName.'
3382
-        FROM ' . prefixTable('cache_tree') . '
3379
+        FROM ' . prefixTable('cache_tree').'
3383 3380
         WHERE user_id = %i',
3384 3381
         $session->get('user-id')
3385 3382
     );
@@ -3422,7 +3419,7 @@  discard block
 block discarded – undo
3422 3419
     if (count($folderIds) === 0) {
3423 3420
         $folderIds = DB::queryFirstColumn(
3424 3421
             'SELECT id
3425
-            FROM ' . prefixTable('nested_tree') . '
3422
+            FROM ' . prefixTable('nested_tree').'
3426 3423
             WHERE personal_folder=%i',
3427 3424
             0
3428 3425
         );
@@ -3439,8 +3436,8 @@  discard block
 block discarded – undo
3439 3436
         $rows_tmp = DB::query(
3440 3437
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3441 3438
             f.id_category AS category_id
3442
-            FROM ' . prefixTable('categories_folders') . ' AS f
3443
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3439
+            FROM ' . prefixTable('categories_folders').' AS f
3440
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3444 3441
             WHERE id_folder=%i',
3445 3442
             $folder
3446 3443
         );
@@ -3466,7 +3463,7 @@  discard block
 block discarded – undo
3466 3463
         $valTemp = '';
3467 3464
         $data = DB::queryFirstRow(
3468 3465
             'SELECT valeur
3469
-            FROM ' . prefixTable('misc') . '
3466
+            FROM ' . prefixTable('misc').'
3470 3467
             WHERE type = %s AND intitule=%i',
3471 3468
             'complex',
3472 3469
             $folder
@@ -3483,14 +3480,14 @@  discard block
 block discarded – undo
3483 3480
         $valTemp = '';
3484 3481
         $rows_tmp = DB::query(
3485 3482
             'SELECT t.title
3486
-            FROM ' . prefixTable('roles_values') . ' as v
3487
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3483
+            FROM ' . prefixTable('roles_values').' as v
3484
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3488 3485
             WHERE v.folder_id = %i
3489 3486
             GROUP BY title',
3490 3487
             $folder
3491 3488
         );
3492 3489
         foreach ($rows_tmp as $record) {
3493
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3490
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3494 3491
         }
3495 3492
         $arr_data['visibilityRoles'] = $valTemp;
3496 3493
 
@@ -3523,7 +3520,7 @@  discard block
 block discarded – undo
3523 3520
         // loop on users and check if user has this role
3524 3521
         $rows = DB::query(
3525 3522
             'SELECT id, fonction_id
3526
-            FROM ' . prefixTable('users') . '
3523
+            FROM ' . prefixTable('users').'
3527 3524
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3528 3525
             $session->get('user-id')
3529 3526
         );
@@ -3555,7 +3552,7 @@  discard block
 block discarded – undo
3555 3552
 
3556 3553
     $val = DB::queryfirstrow(
3557 3554
         'SELECT *
3558
-        FROM ' . prefixTable('users') . '
3555
+        FROM ' . prefixTable('users').'
3559 3556
         WHERE id = %i',
3560 3557
         $userId
3561 3558
     );
@@ -3571,12 +3568,12 @@  discard block
 block discarded – undo
3571 3568
 function upgradeRequired(): bool
3572 3569
 {
3573 3570
     // Get settings.php
3574
-    include_once __DIR__. '/../includes/config/settings.php';
3571
+    include_once __DIR__.'/../includes/config/settings.php';
3575 3572
 
3576 3573
     // Get timestamp in DB
3577 3574
     $val = DB::queryfirstrow(
3578 3575
         'SELECT valeur
3579
-        FROM ' . prefixTable('misc') . '
3576
+        FROM ' . prefixTable('misc').'
3580 3577
         WHERE type = %s AND intitule = %s',
3581 3578
         'admin',
3582 3579
         'upgrade_timestamp'
@@ -3631,7 +3628,7 @@  discard block
 block discarded – undo
3631 3628
     // prepapre background tasks for item keys generation        
3632 3629
     $userTP = DB::queryFirstRow(
3633 3630
         'SELECT pw, public_key, private_key
3634
-        FROM ' . prefixTable('users') . '
3631
+        FROM ' . prefixTable('users').'
3635 3632
         WHERE id = %i',
3636 3633
         TP_USER_ID
3637 3634
     );
@@ -3691,7 +3688,7 @@  discard block
 block discarded – undo
3691 3688
     }
3692 3689
 
3693 3690
     // Generate new keys
3694
-    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3691
+    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3695 3692
         $userKeys = [
3696 3693
             'public_key' => $recovery_public_key,
3697 3694
             'private_key_clear' => $recovery_private_key,
@@ -3731,8 +3728,8 @@  discard block
 block discarded – undo
3731 3728
             'process_type' => 'create_user_keys',
3732 3729
             'arguments' => json_encode([
3733 3730
                 'new_user_id' => (int) $userId,
3734
-                'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3735
-                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3731
+                'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3732
+                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3736 3733
                 'owner_id' => (int) TP_USER_ID,
3737 3734
                 'creator_pwd' => $userTP['pw'],
3738 3735
                 'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -4022,7 +4019,7 @@  discard block
 block discarded – undo
4022 4019
  */
4023 4020
 function createTaskForItem(
4024 4021
     string $processType,
4025
-    string|array $taskName,
4022
+    string | array $taskName,
4026 4023
     int $itemId,
4027 4024
     int $userId,
4028 4025
     string $objectKey,
@@ -4046,7 +4043,7 @@  discard block
 block discarded – undo
4046 4043
                 'object_key' => $objectKey,
4047 4044
                 'author' => (int) $userId,
4048 4045
             ]),
4049
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
4046
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
4050 4047
         )
4051 4048
     );
4052 4049
     $processId = DB::insertId();
@@ -4056,7 +4053,7 @@  discard block
 block discarded – undo
4056 4053
     if (is_array($taskName) === false) {
4057 4054
         $taskName = [$taskName];
4058 4055
     }
4059
-    foreach($taskName as $task) {
4056
+    foreach ($taskName as $task) {
4060 4057
         error_log('createTaskForItem - task: '.$task);
4061 4058
         switch ($task) {
4062 4059
             case 'item_password':
@@ -4153,7 +4150,7 @@  discard block
 block discarded – undo
4153 4150
  * @param integer $user_id
4154 4151
  * @return void
4155 4152
  */
4156
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4153
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4157 4154
 {
4158 4155
     if ($allUsers === true) {
4159 4156
         // Load class DB
@@ -4163,7 +4160,7 @@  discard block
 block discarded – undo
4163 4160
 
4164 4161
         $users = DB::query(
4165 4162
             'SELECT id
4166
-            FROM ' . prefixTable('users') . '
4163
+            FROM ' . prefixTable('users').'
4167 4164
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4168 4165
             ORDER BY login ASC'
4169 4166
         );
@@ -4181,7 +4178,7 @@  discard block
 block discarded – undo
4181 4178
  * @param integer $user_id
4182 4179
  * @return void
4183 4180
  */
4184
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4181
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4185 4182
 {
4186 4183
     if ($user_id === 0) {
4187 4184
         return;
@@ -4192,8 +4189,8 @@  discard block
 block discarded – undo
4192 4189
 
4193 4190
     $personalItems = DB::queryFirstColumn(
4194 4191
         'SELECT id
4195
-        FROM ' . prefixTable('items') . ' AS i
4196
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4192
+        FROM ' . prefixTable('items').' AS i
4193
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4197 4194
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4198 4195
         $user_id
4199 4196
     );
@@ -4242,7 +4239,7 @@  discard block
 block discarded – undo
4242 4239
     // Check if user exists
4243 4240
     $userInfo = DB::queryFirstRow(
4244 4241
         'SELECT pw, public_key, private_key, login, name
4245
-        FROM ' . prefixTable('users') . '
4242
+        FROM ' . prefixTable('users').'
4246 4243
         WHERE id = %i',
4247 4244
         $userId
4248 4245
     );
@@ -4251,7 +4248,7 @@  discard block
 block discarded – undo
4251 4248
         $now = (int) time();
4252 4249
         // Prepare file content
4253 4250
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4254
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4251
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4255 4252
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4256 4253
             "Public Key:\n".$userInfo['public_key']."\n\n".
4257 4254
             "Private Key:\n".decryptPrivateKey($session->get('user-password'), $userInfo['private_key'])."\n\n";
@@ -4274,7 +4271,7 @@  discard block
 block discarded – undo
4274 4271
         return prepareExchangedData(
4275 4272
             array(
4276 4273
                 'error' => false,
4277
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4274
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4278 4275
                 'timestamp' => $now,
4279 4276
                 'content' => base64_encode($export_value),
4280 4277
                 'login' => $userInfo['login'],
@@ -4300,8 +4297,8 @@  discard block
 block discarded – undo
4300 4297
  */
4301 4298
 function loadClasses(string $className = ''): void
4302 4299
 {
4303
-    require_once __DIR__. '/../includes/config/include.php';
4304
-    require_once __DIR__. '/../includes/config/settings.php';
4300
+    require_once __DIR__.'/../includes/config/include.php';
4301
+    require_once __DIR__.'/../includes/config/settings.php';
4305 4302
     require_once __DIR__.'/../vendor/autoload.php';
4306 4303
 
4307 4304
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4462,10 +4459,10 @@  discard block
 block discarded – undo
4462 4459
     }
4463 4460
 
4464 4461
     // Nettoyage des IDs pour éviter les injections SQL
4465
-    $ids = array_map('intval', $ids);  // Assure que chaque ID est un entier
4462
+    $ids = array_map('intval', $ids); // Assure que chaque ID est un entier
4466 4463
 
4467 4464
     // Construction de la requête SQL pour vérifier les IDs dans la table
4468
-    $result = DB::query('SELECT id FROM ' . prefixTable($tableName) . ' WHERE ' . $fieldName . ' IN %li', $ids);
4465
+    $result = DB::query('SELECT id FROM '.prefixTable($tableName).' WHERE '.$fieldName.' IN %li', $ids);
4469 4466
 
4470 4467
     // Extraire les IDs existants de la table
4471 4468
     $existingIds = array_column($result, 'id');
Please login to merge, or discard this patch.
sources/core.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 {
55 55
     // Load AntiXSS
56 56
     $antiXss = new AntiXSS();
57
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
58
-        header('Location: ' . $antiXss->xss_clean($url));
57
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
58
+        header('Location: '.$antiXss->xss_clean($url));
59 59
     }
60 60
 
61 61
     //If headers are sent... do java redirect... if java disabled, do html redirect.
62 62
     echo '<script type="text/javascript">';
63
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
63
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
64 64
     echo '</script>';
65 65
     echo '<noscript>';
66
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
66
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
67 67
     echo '</noscript>';
68 68
 }
69 69
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     && isset($SETTINGS['enable_sts']) === true
90 90
     && (int) $SETTINGS['enable_sts'] === 1
91 91
 ) {
92
-    teampassRedirect('https://' . $server['http_host'] . $server['request_uri']);
92
+    teampassRedirect('https://'.$server['http_host'].$server['request_uri']);
93 93
 }
94 94
 
95 95
 // Load pwComplexity
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 // LOAD CPASSMAN SETTINGS
111 111
 if (
112 112
     isset($SETTINGS['cpassman_dir']) === true
113
-    && is_dir($SETTINGS['cpassman_dir'] . '/install') === true
113
+    && is_dir($SETTINGS['cpassman_dir'].'/install') === true
114 114
 ) {
115 115
     // Should we delete folder INSTALL?
116 116
     $row = DB::queryFirstRow(
117
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s',
117
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s',
118 118
         'install',
119 119
         'clear_install_folder'
120 120
     );
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
             if ($directories !== false) {
133 133
                 $files = array_diff($directories, ['.', '..']);
134 134
                 foreach ($files as $file) {
135
-                    if (is_dir($dir . '/' . $file)) {
136
-                        delTree($dir . '/' . $file);
135
+                    if (is_dir($dir.'/'.$file)) {
136
+                        delTree($dir.'/'.$file);
137 137
                     } else {
138 138
                         try {
139
-                            unlink($dir . '/' . $file);
139
+                            unlink($dir.'/'.$file);
140 140
                         } catch (Exception $e) {
141 141
                             // do nothing... php will ignore and continue
142 142
                         }
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
             return false;
151 151
         }
152 152
 
153
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
153
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
154 154
             // Set the permissions on the install directory and delete
155 155
             // is server Windows or Linux?
156 156
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
157
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
157
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
158 158
             }
159
-            delTree($SETTINGS['cpassman_dir'] . '/install');
159
+            delTree($SETTINGS['cpassman_dir'].'/install');
160 160
         }
161 161
 
162 162
         // Delete temporary install table
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 // Load Languages stuff
175 175
 if (isset($languagesList) === false) {
176 176
     $languagesList = [];
177
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
177
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
178 178
     foreach ($rows as $record) {
179 179
         array_push($languagesList, $record['name']);
180
-        if ($session->get('user-language') === $record['name'] ) {
180
+        if ($session->get('user-language') === $record['name']) {
181 181
             $session->set('user-language_flag', $record['flag']);
182 182
             $session->set('user-language_code', $record['code']);
183 183
             //$session->set('user-language_label', $record['label']);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
235 235
 if (empty($session->get('user-session_duration')) === false) {
236 236
     $dataSession = DB::queryFirstRow(
237
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
237
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
238 238
         $session->get('user-id')
239 239
     );
240 240
 } else {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     && ($session->has('user-admin') && $session->get('user-admin') && null !== $session->get('user-admin') && $session->get('user-admin') === 1)
290 290
 ) {
291 291
     $row = DB::queryFirstRow(
292
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
292
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
293 293
         [
294 294
             'type' => 'admin',
295 295
             'intitule' => 'teampass_version',
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
         syslog(
332 332
             LOG_WARNING,
333
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
333
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
334 334
         );
335 335
         // erase session table
336 336
         $session->invalidate();
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 if ($session->has('user-timezone') && null !== $session->get('user-id') && empty($session->get('user-id')) === false) {
387 387
     // query on user
388 388
     $data = DB::queryfirstrow(
389
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups FROM ' . prefixTable('users') . ' WHERE id=%i',
389
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups FROM '.prefixTable('users').' WHERE id=%i',
390 390
         $session->get('user-id')
391 391
     );
392 392
     //Check if user has been deleted or unlogged
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
             $data['groupes_visibles'],
432 432
             $data['groupes_interdits'],
433 433
             $data['admin'],
434
-            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'] . ';' . $data['roles_from_ad_groups']),
434
+            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'].';'.$data['roles_from_ad_groups']),
435 435
             $SETTINGS
436 436
         );
437 437
         if ($session->has('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') && null !== $session->get('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') === 1) {
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
     $session->set('system-item_fields', []);
467 467
     $rows = DB::query(
468 468
         'SELECT *
469
-            FROM ' . prefixTable('categories') . '
469
+            FROM ' . prefixTable('categories').'
470 470
             WHERE level=%i',
471 471
         '0'
472 472
     );
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
         // get each field
476 476
         $rows2 = DB::query(
477 477
             'SELECT *
478
-            FROM ' . prefixTable('categories') . '
478
+            FROM ' . prefixTable('categories').'
479 479
             WHERE parent_id=%i
480 480
             ORDER BY `order` ASC',
481 481
             $record['id']
@@ -562,5 +562,5 @@  discard block
 block discarded – undo
562 562
 }
563 563
 
564 564
 /* CHECK NUMBER OF USER ONLINE */
565
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
565
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
566 566
 $session->set('system-nb_users_online', DB::count());
Please login to merge, or discard this patch.
sources/expired.datatables.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 ) {
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
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 // Is a date sent?
99 99
 $dateCriteria = $request->query->get('dateCriteria');
100 100
 if ($dateCriteria !== null && !empty($dateCriteria)) {
101
-    $sWhere .= ' AND a.del_value < ' . round(filter_var($dateCriteria, FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
101
+    $sWhere .= ' AND a.del_value < '.round(filter_var($dateCriteria, FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
102 102
 }
103 103
 //echo $sWhere;
104 104
 /* BUILD QUERY */
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 $start = $request->query->getInt('start', 0);
108 108
 $length = $request->query->getInt('length', -1);
109 109
 if ($length !== -1) {
110
-    $sLimit = ' LIMIT ' . $start . ', ' . $length;
110
+    $sLimit = ' LIMIT '.$start.', '.$length;
111 111
 }
112 112
 
113 113
 //Ordering
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $columnIndex = filter_var($order[0]['column'], FILTER_SANITIZE_NUMBER_INT);
121 121
 
122 122
         if (array_key_exists($columnIndex, $aColumns)) {
123
-            $sOrder .= $aColumns[$columnIndex] . ' ' . $order[0]['dir'];
123
+            $sOrder .= $aColumns[$columnIndex].' '.$order[0]['dir'];
124 124
         }
125 125
 
126 126
         // Supprimez la virgule finale si elle existe
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 
145 145
     if ($letter !== '' && $letter !== 'None') {
146 146
         $sWhere .= ' AND ';
147
-        $sWhere .= $aColumns[1] . " LIKE '" . $letter . "%' OR ";
148
-        $sWhere .= $aColumns[2] . " LIKE '" . $letter . "%' OR ";
149
-        $sWhere .= $aColumns[3] . " LIKE '" . $letter . "%' ";
147
+        $sWhere .= $aColumns[1]." LIKE '".$letter."%' OR ";
148
+        $sWhere .= $aColumns[2]." LIKE '".$letter."%' OR ";
149
+        $sWhere .= $aColumns[3]." LIKE '".$letter."%' ";
150 150
     }
151 151
 }
152 152
 
@@ -157,26 +157,26 @@  discard block
 block discarded – undo
157 157
 
158 158
         if ($searchValue !== '') {
159 159
             $sWhere = ' AND ';
160
-            $sWhere .= $aColumns[1] . " LIKE '" . $searchValue . "%' OR ";
161
-            $sWhere .= $aColumns[2] . " LIKE '" . $searchValue . "%' OR ";
162
-            $sWhere .= $aColumns[3] . " LIKE '" . $searchValue . "%' ";
160
+            $sWhere .= $aColumns[1]." LIKE '".$searchValue."%' OR ";
161
+            $sWhere .= $aColumns[2]." LIKE '".$searchValue."%' OR ";
162
+            $sWhere .= $aColumns[3]." LIKE '".$searchValue."%' ";
163 163
         }
164 164
     }
165 165
 }
166 166
 
167 167
 $rows = DB::query(
168 168
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
169
-    FROM ' . prefixTable('automatic_del') . ' AS a
170
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
169
+    FROM ' . prefixTable('automatic_del').' AS a
170
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
171 171
     $sWhere.
172 172
     (string) $sOrder
173 173
 );
174 174
 $iTotal = DB::count();
175 175
 $rows = DB::query(
176 176
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
177
-    FROM ' . prefixTable('automatic_del') . ' AS a
178
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
179
-        $sWhere .
177
+    FROM ' . prefixTable('automatic_del').' AS a
178
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
179
+        $sWhere.
180 180
         $sLimit
181 181
 );
182 182
 $iFilteredTotal = DB::count();
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
     // start the line
195 195
     $sOutput .= '[';
196 196
     // Column 1
197
-    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"' . $record['item_id'] . '\"  data-item-tree-id=\"' . $record['id_tree'] . '\"></i>", ';
197
+    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"'.$record['item_id'].'\"  data-item-tree-id=\"'.$record['id_tree'].'\"></i>", ';
198 198
     // Column 2
199
-    $sOutput .= '"' . $record['label'] . '", ';
199
+    $sOutput .= '"'.$record['label'].'", ';
200 200
     // Column 3
201
-    $sOutput .= '"' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['del_value']) . '", ';
201
+    $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['del_value']).'", ';
202 202
     // Column 4
203 203
     $path = [];
204 204
     $treeDesc = $tree->getPath($record['id_tree'], true);
205 205
     foreach ($treeDesc as $t) {
206 206
         array_push($path, $t->title);
207 207
     }
208
-    $sOutput .= '"' . implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path) . '"],';
208
+    $sOutput .= '"'.implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path).'"],';
209 209
 }
210 210
 
211 211
 if ($iTotal > 0) {
@@ -218,4 +218,4 @@  discard block
 block discarded – undo
218 218
 }
219 219
 
220 220
 // finalize output
221
-echo '{"recordsTotal": ' . (int) $iTotal . ', "recordsFiltered": ' . (int) $iFilteredTotal . ', "data": ' . htmlspecialchars($sOutput);
221
+echo '{"recordsTotal": '.(int) $iTotal.', "recordsFiltered": '.(int) $iFilteredTotal.', "data": '.htmlspecialchars($sOutput);
Please login to merge, or discard this patch.
pages/tasks.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,8 +146,7 @@
 block discarded – undo
146 146
                                             </div>
147 147
         <?php
148 148
     }
149
-}
150
-catch (Exception $e) {
149
+} catch (Exception $e) {
151 150
     error_log('TEAMPASS Error - tasks page - '.$e->getMessage());
152 151
     // deepcode ignore ServerLeak: no critical information is provided
153 152
     echo "An error occurred.";
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('tasks') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                                             $task = isset($SETTINGS['users_personal_folder_task']) === true ? explode(";", $SETTINGS['users_personal_folder_task']) : [];
230 230
                                             ?>
231 231
                                             <input type='text' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'>
232
-                                            <input type='hidden' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'>
232
+                                            <input type='hidden' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'>
233 233
                                         </div>
234 234
                                         <div class='col-2'>
235 235
                                             <button class="btn btn-primary task-define" data-task="users_personal_folder_task">
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                                             $task = isset($SETTINGS['clean_orphan_objects_task']) === true ? explode(";", $SETTINGS['clean_orphan_objects_task']) : [];
258 258
                                             ?>
259 259
                                             <input type='text' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'>
260
-                                            <input type='hidden' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'>
260
+                                            <input type='hidden' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'>
261 261
                                         </div>
262 262
                                         <div class='col-2'>
263 263
                                             <button class="btn btn-primary task-define" data-task="clean_orphan_objects_task">
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                                             $task = isset($SETTINGS['purge_temporary_files_task']) === true ? explode(";", $SETTINGS['purge_temporary_files_task']) : [];
280 280
                                             ?>
281 281
                                             <input type='text' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'>
282
-                                            <input type='hidden' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'>
282
+                                            <input type='hidden' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'>
283 283
                                         </div>
284 284
                                         <div class='col-2'>
285 285
                                             <button class="btn btn-primary task-define" data-task="purge_temporary_files_task">
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                                             $task = isset($SETTINGS['reload_cache_table_task']) === true ? explode(";", $SETTINGS['reload_cache_table_task']) : [];
324 324
                                             ?>
325 325
                                             <input type='text' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'>
326
-                                            <input type='hidden' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'>
326
+                                            <input type='hidden' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'>
327 327
                                         </div>
328 328
                                         <div class='col-2'>
329 329
                                             <button class="btn btn-primary task-define" data-task="reload_cache_table_task">
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                         <h5><?php echo $lang->get('day_of_month'); ?></h5>              
529 529
                         <select class='form-control form-control-sm no-save' id='task-define-modal-parameter-monthly-value' style="width:100%;">
530 530
                             <?php
531
-                            for ($i=1; $i<=31; $i++) {
531
+                            for ($i = 1; $i <= 31; $i++) {
532 532
                                 echo '<option value="'.$i.'">'.$lang->get('day').' '.$i.'</option>';
533 533
                             }
534 534
                             ?>
Please login to merge, or discard this patch.