Passed
Push — master ( 3b3500...0bff11 )
by Nils
04:16
created
scripts/background_tasks___sending_emails.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 DB::debugmode(false);
61 61
 $rows = DB::query(
62 62
     'SELECT *
63
-    FROM ' . prefixTable('processes') . '
63
+    FROM ' . prefixTable('processes').'
64 64
     WHERE is_in_progress = %i AND process_type = %s
65 65
     ORDER BY increment_id ASC LIMIT 0,10',
66 66
     0,
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 {
113 113
     if ((int) $SETTINGS['enable_send_email_on_user_login'] === 1) {
114 114
         $row = DB::queryFirstRow(
115
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
115
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
116 116
             'cron',
117 117
             'sending_emails'
118 118
         );
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
121 121
             $rows = DB::query(
122 122
                 'SELECT *
123
-                FROM ' . prefixTable('emails') .
123
+                FROM ' . prefixTable('emails').
124 124
                 ' WHERE status != %s',
125 125
                 'sent'
126 126
             );
Please login to merge, or discard this patch.
scripts/background_tasks___user_keys_creation.php 1 patch
Spacing   +45 added lines, -46 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 DB::debugmode(false);
61 61
 $process_to_perform = DB::queryfirstrow(
62 62
     'SELECT *
63
-    FROM ' . prefixTable('processes') . '
63
+    FROM ' . prefixTable('processes').'
64 64
     WHERE is_in_progress = %i AND process_type = %s
65 65
     ORDER BY increment_id ASC',
66 66
     1,
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     // search for next process to handle
80 80
     $process_to_perform = DB::queryfirstrow(
81 81
         'SELECT *
82
-        FROM ' . prefixTable('processes') . '
82
+        FROM ' . prefixTable('processes').'
83 83
         WHERE is_in_progress = %i AND finished_at = "" AND process_type = %s
84 84
         ORDER BY increment_id ASC',
85 85
         0,
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     );
88 88
     //print_r($process_to_perform);
89 89
     if (DB::count() > 0) {
90
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
90
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
91 91
         handleTask(
92 92
             $process_to_perform['increment_id'],
93 93
             json_decode($process_to_perform['arguments'], true),
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 
104 104
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS)
105 105
 {
106
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
106
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
107 107
     //DB::debugmode(false);
108 108
     $task_to_perform = DB::queryfirstrow(
109 109
         'SELECT *
110
-        FROM ' . prefixTable('processes_tasks') . '
110
+        FROM ' . prefixTable('processes_tasks').'
111 111
         WHERE process_id = %i AND finished_at IS NULL
112 112
         ORDER BY increment_id ASC',
113 113
         $processId
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         // check if a linux process is not currently on going
119 119
         // if sub_task_in_progress === 1 then exit
120 120
         if ((int) $task_to_perform['sub_task_in_progress'] === 0) {
121
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]', $SETTINGS);
121
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]', $SETTINGS);
122 122
 
123 123
             // handle next task
124 124
             $args = json_decode($task_to_perform['task'], true);
@@ -171,10 +171,9 @@  discard block
 block discarded – undo
171 171
             DB::update(
172 172
                 prefixTable('processes_tasks'),
173 173
                 array(
174
-                    'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
174
+                    'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
175 175
                     'task' => $taskStatus['new_action'] !== $args['step'] ? 
176
-                    json_encode(["status" => "Done"]) :
177
-                    json_encode([
176
+                    json_encode(["status" => "Done"]) : json_encode([
178 177
                         "step" => $taskStatus['new_action'],
179 178
                         "index" => $taskStatus['new_index'],
180 179
                         "nb" => $args['nb'],
@@ -210,7 +209,7 @@  discard block
 block discarded – undo
210 209
 
211 210
         } else {
212 211
             // Task is currently being in progress by another server process
213
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
212
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
214 213
             return false;
215 214
         }
216 215
     }
@@ -242,7 +241,7 @@  discard block
 block discarded – undo
242 241
         // Check if user exists
243 242
         $userInfo = DB::queryFirstRow(
244 243
             'SELECT public_key, private_key
245
-            FROM ' . prefixTable('users') . '
244
+            FROM ' . prefixTable('users').'
246 245
             WHERE id = %i',
247 246
             $post_user_id
248 247
         );
@@ -371,13 +370,13 @@  discard block
 block discarded – undo
371 370
 {
372 371
     $userInfo = DB::queryFirstRow(
373 372
         'SELECT public_key, private_key
374
-        FROM ' . prefixTable('users') . '
373
+        FROM ' . prefixTable('users').'
375 374
         WHERE id = %i',
376 375
         $owner_id
377 376
     );
378 377
     
379 378
     // decrypt owner password
380
-    $owner_pwd = cryption($owner_pwd, '','decrypt', $SETTINGS)['string'];
379
+    $owner_pwd = cryption($owner_pwd, '', 'decrypt', $SETTINGS)['string'];
381 380
     provideLog('[USER][INFO]', $SETTINGS);
382 381
     provideLog('[DEBUG] '.$owner_pwd." -- ", $SETTINGS);
383 382
     // decrypt private key and send back
@@ -415,16 +414,16 @@  discard block
 block discarded – undo
415 414
     // Loop on items
416 415
     $rows = DB::query(
417 416
         'SELECT id, pw
418
-        FROM ' . prefixTable('items') . '
417
+        FROM ' . prefixTable('items').'
419 418
         WHERE perso = 0
420 419
         ORDER BY id ASC
421
-        LIMIT ' . $post_start . ', ' . $post_length
420
+        LIMIT ' . $post_start.', '.$post_length
422 421
     );
423 422
     foreach ($rows as $record) {
424 423
         // Get itemKey from current user
425 424
         $currentUserKey = DB::queryFirstRow(
426 425
             'SELECT share_key, increment_id
427
-            FROM ' . prefixTable('sharekeys_items') . '
426
+            FROM ' . prefixTable('sharekeys_items').'
428 427
             WHERE object_id = %i AND user_id = %i',
429 428
             $record['id'],
430 429
             $extra_arguments['owner_id']
@@ -452,7 +451,7 @@  discard block
 block discarded – undo
452 451
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
453 452
                 $currentUserKey = DB::queryFirstRow(
454 453
                     'SELECT increment_id
455
-                    FROM ' . prefixTable('sharekeys_items') . '
454
+                    FROM ' . prefixTable('sharekeys_items').'
456 455
                     WHERE object_id = %i AND user_id = %i',
457 456
                     $record['id'],
458 457
                     $post_user_id
@@ -485,7 +484,7 @@  discard block
 block discarded – undo
485 484
     // SHould we change step?
486 485
     DB::query(
487 486
         'SELECT *
488
-        FROM ' . prefixTable('items') . '
487
+        FROM ' . prefixTable('items').'
489 488
         WHERE perso = 0'
490 489
     );
491 490
 
@@ -525,15 +524,15 @@  discard block
 block discarded – undo
525 524
     // Loop on logs
526 525
     $rows = DB::query(
527 526
         'SELECT increment_id
528
-        FROM ' . prefixTable('log_items') . '
527
+        FROM ' . prefixTable('log_items').'
529 528
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
530
-        LIMIT ' . $post_start . ', ' . $post_length
529
+        LIMIT ' . $post_start.', '.$post_length
531 530
     );
532 531
     foreach ($rows as $record) {
533 532
         // Get itemKey from current user
534 533
         $currentUserKey = DB::queryFirstRow(
535 534
             'SELECT share_key
536
-            FROM ' . prefixTable('sharekeys_logs') . '
535
+            FROM ' . prefixTable('sharekeys_logs').'
537 536
             WHERE object_id = %i AND user_id = %i',
538 537
             $record['increment_id'],
539 538
             $extra_arguments['owner_id']
@@ -560,7 +559,7 @@  discard block
 block discarded – undo
560 559
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
561 560
                 $currentUserKey = DB::queryFirstRow(
562 561
                     'SELECT increment_id
563
-                    FROM ' . prefixTable('sharekeys_items') . '
562
+                    FROM ' . prefixTable('sharekeys_items').'
564 563
                     WHERE object_id = %i AND user_id = %i',
565 564
                     $record['id'],
566 565
                     $post_user_id
@@ -582,7 +581,7 @@  discard block
 block discarded – undo
582 581
     // SHould we change step?
583 582
     DB::query(
584 583
         'SELECT increment_id
585
-        FROM ' . prefixTable('log_items') . '
584
+        FROM ' . prefixTable('log_items').'
586 585
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
587 586
     );
588 587
 
@@ -622,15 +621,15 @@  discard block
 block discarded – undo
622 621
     // Loop on fields
623 622
     $rows = DB::query(
624 623
         'SELECT id
625
-        FROM ' . prefixTable('categories_items') . '
624
+        FROM ' . prefixTable('categories_items').'
626 625
         WHERE encryption_type = "teampass_aes"
627
-        LIMIT ' . $post_start . ', ' . $post_length
626
+        LIMIT ' . $post_start.', '.$post_length
628 627
     );
629 628
     foreach ($rows as $record) {
630 629
         // Get itemKey from current user
631 630
         $currentUserKey = DB::queryFirstRow(
632 631
             'SELECT share_key
633
-            FROM ' . prefixTable('sharekeys_fields') . '
632
+            FROM ' . prefixTable('sharekeys_fields').'
634 633
             WHERE object_id = %i AND user_id = %i',
635 634
             $record['id'],
636 635
             $extra_arguments['owner_id']
@@ -658,7 +657,7 @@  discard block
 block discarded – undo
658 657
                 if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
659 658
                     $currentUserKey = DB::queryFirstRow(
660 659
                         'SELECT increment_id
661
-                        FROM ' . prefixTable('sharekeys_items') . '
660
+                        FROM ' . prefixTable('sharekeys_items').'
662 661
                         WHERE object_id = %i AND user_id = %i',
663 662
                         $record['id'],
664 663
                         $post_user_id
@@ -681,7 +680,7 @@  discard block
 block discarded – undo
681 680
     // SHould we change step?
682 681
     DB::query(
683 682
         'SELECT *
684
-        FROM ' . prefixTable('categories_items') . '
683
+        FROM ' . prefixTable('categories_items').'
685 684
         WHERE encryption_type = "teampass_aes"'
686 685
     );
687 686
 
@@ -721,14 +720,14 @@  discard block
 block discarded – undo
721 720
     // Loop on suggestions
722 721
     $rows = DB::query(
723 722
         'SELECT id
724
-        FROM ' . prefixTable('suggestion') . '
725
-        LIMIT ' . $post_start . ', ' . $post_length
723
+        FROM ' . prefixTable('suggestion').'
724
+        LIMIT ' . $post_start.', '.$post_length
726 725
     );
727 726
     foreach ($rows as $record) {
728 727
         // Get itemKey from current user
729 728
         $currentUserKey = DB::queryFirstRow(
730 729
             'SELECT share_key
731
-            FROM ' . prefixTable('sharekeys_suggestions') . '
730
+            FROM ' . prefixTable('sharekeys_suggestions').'
732 731
             WHERE object_id = %i AND user_id = %i',
733 732
             $record['id'],
734 733
             $extra_arguments['owner_id']
@@ -755,7 +754,7 @@  discard block
 block discarded – undo
755 754
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
756 755
                 $currentUserKey = DB::queryFirstRow(
757 756
                     'SELECT increment_id
758
-                    FROM ' . prefixTable('sharekeys_items') . '
757
+                    FROM ' . prefixTable('sharekeys_items').'
759 758
                     WHERE object_id = %i AND user_id = %i',
760 759
                     $record['id'],
761 760
                     $post_user_id
@@ -816,15 +815,15 @@  discard block
 block discarded – undo
816 815
     // Loop on files
817 816
     $rows = DB::query(
818 817
         'SELECT id
819
-        FROM ' . prefixTable('files') . '
820
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
821
-        LIMIT ' . $post_start . ', ' . $post_length
818
+        FROM ' . prefixTable('files').'
819
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
820
+        LIMIT ' . $post_start.', '.$post_length
822 821
     ); //aes_encryption
823 822
     foreach ($rows as $record) {
824 823
         // Get itemKey from current user
825 824
         $currentUserKey = DB::queryFirstRow(
826 825
             'SELECT share_key
827
-            FROM ' . prefixTable('sharekeys_files') . '
826
+            FROM ' . prefixTable('sharekeys_files').'
828 827
             WHERE object_id = %i AND user_id = %i',
829 828
             $record['id'],
830 829
             $extra_arguments['owner_id']
@@ -851,7 +850,7 @@  discard block
 block discarded – undo
851 850
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
852 851
                 $currentUserKey = DB::queryFirstRow(
853 852
                     'SELECT increment_id
854
-                    FROM ' . prefixTable('sharekeys_items') . '
853
+                    FROM ' . prefixTable('sharekeys_items').'
855 854
                     WHERE object_id = %i AND user_id = %i',
856 855
                     $record['id'],
857 856
                     $post_user_id
@@ -873,8 +872,8 @@  discard block
 block discarded – undo
873 872
     // SHould we change step?
874 873
     DB::query(
875 874
         'SELECT *
876
-        FROM ' . prefixTable('files') . '
877
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
875
+        FROM ' . prefixTable('files').'
876
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
878 877
     );
879 878
 
880 879
     $next_start = (int) $post_start + (int) $post_length;
@@ -914,7 +913,7 @@  discard block
 block discarded – undo
914 913
     // get user info
915 914
     $userInfo = DB::queryFirstRow(
916 915
         'SELECT email, login, auth_type
917
-        FROM ' . prefixTable('users') . '
916
+        FROM ' . prefixTable('users').'
918 917
         WHERE id = %i',
919 918
         $extra_arguments['new_user_id']
920 919
     );
@@ -923,12 +922,12 @@  discard block
 block discarded – undo
923 922
         sendMailToUser(
924 923
             filter_var($userInfo['email'], FILTER_SANITIZE_STRING),
925 924
             langHdl('email_body_new_user'),
926
-            'TEAMPASS - ' . langHdl('temporary_encryption_code'),
925
+            'TEAMPASS - '.langHdl('temporary_encryption_code'),
927 926
             (array) filter_var_array(
928 927
                 [
929
-                    '#code#' => cryption($extra_arguments['new_user_code'], '','decrypt', $SETTINGS)['string'],
928
+                    '#code#' => cryption($extra_arguments['new_user_code'], '', 'decrypt', $SETTINGS)['string'],
930 929
                     '#login#' => $userInfo['login'],
931
-                    '#password#' => cryption($extra_arguments['new_user_pwd'], '','decrypt', $SETTINGS)['string'],
930
+                    '#password#' => cryption($extra_arguments['new_user_pwd'], '', 'decrypt', $SETTINGS)['string'],
932 931
                 ],
933 932
                 FILTER_SANITIZE_STRING
934 933
             ),
@@ -938,10 +937,10 @@  discard block
 block discarded – undo
938 937
         sendMailToUser(
939 938
             filter_var($userInfo['email'], FILTER_SANITIZE_STRING),
940 939
             langHdl('email_body_user_added_from_ldap_encryption_code'),
941
-            'TEAMPASS - ' . langHdl('temporary_encryption_code'),
940
+            'TEAMPASS - '.langHdl('temporary_encryption_code'),
942 941
             (array) filter_var_array(
943 942
                 [
944
-                    '#enc_code#' => cryption($extra_arguments['new_user_code'], '','decrypt', $SETTINGS)['string'],
943
+                    '#enc_code#' => cryption($extra_arguments['new_user_code'], '', 'decrypt', $SETTINGS)['string'],
945 944
                 ],
946 945
                 FILTER_SANITIZE_STRING
947 946
             ),
@@ -1003,5 +1002,5 @@  discard block
 block discarded – undo
1003 1002
 
1004 1003
 function provideLog(string $message, array $SETTINGS)
1005 1004
 {
1006
-    echo '\n' . (string) date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) . ' - '.$message . '\n';
1005
+    echo '\n'.(string) date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).' - '.$message.'\n';
1007 1006
 }
1008 1007
\ No newline at end of file
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 /* do checks */
51
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
52
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
51
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
52
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
53 53
 // Prepare post variables
54 54
 $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
55 55
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
@@ -62,21 +62,21 @@  discard block
 block discarded – undo
62 62
     (checkUser($_SESSION['user_id'], $_SESSION['key'], 'users', $SETTINGS) === false)
63 63
     && (checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false 
64 64
         && (null === $isprofileupdate || $isprofileupdate === false)
65
-        && !in_array($post_type, ['user_profile_update','save_user_change'], true))
65
+        && !in_array($post_type, ['user_profile_update', 'save_user_change'], true))
66 66
 ) {
67 67
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
68
-    include $SETTINGS['cpassman_dir'] . '/error.php';
68
+    include $SETTINGS['cpassman_dir'].'/error.php';
69 69
     exit();
70 70
 }
71 71
 
72
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
72
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
73 73
 header('Content-type: text/html; charset=utf-8');
74
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
75
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
76
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
74
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
75
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
76
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
77 77
 
78 78
 // Connect to mysql server
79
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
79
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
80 80
 if (defined('DB_PASSWD_CLEAR') === false) {
81 81
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
82 82
 }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             // Prepare variables
126 126
             $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING);
127 127
             $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL);
128
-            $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
128
+            $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING);
129 129
             $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING);
130 130
             $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING);
131 131
             $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             // Check if user already exists
156 156
             $data = DB::query(
157 157
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
158
-                FROM ' . prefixTable('users') . '
158
+                FROM ' . prefixTable('users').'
159 159
                 WHERE login = %s',
160 160
                 $login
161 161
             );
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
 
375 375
             // decrypt and retrieve data in JSON format
376 376
             $dataReceived = prepareExchangedData(
377
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
377
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
378 378
 
379 379
             // Prepare variables
380 380
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
381 381
 
382 382
             // Get info about user to delete
383 383
             $data_user = DB::queryfirstrow(
384
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
384
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
385 385
                 WHERE id = %i',
386 386
                 $post_id
387 387
             );
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
                 );
401 401
                 // delete personal folder and subfolders
402 402
                 $data = DB::queryfirstrow(
403
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
403
+                    'SELECT id FROM '.prefixTable('nested_tree').'
404 404
                     WHERE title = %s AND personal_folder = %i',
405 405
                     $post_id,
406 406
                     '1'
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
414 414
                         // delete items & logs
415 415
                         $items = DB::query(
416
-                            'SELECT id FROM ' . prefixTable('items') . '
416
+                            'SELECT id FROM '.prefixTable('items').'
417 417
                             WHERE id_tree=%i AND perso = %i',
418 418
                             $folder->id,
419 419
                             '1'
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
                 // Delete any process related to user
438 438
                 $processes = DB::query(
439 439
                     'SELECT increment_id
440
-                    FROM ' . prefixTable('processes') . '
440
+                    FROM ' . prefixTable('processes').'
441 441
                     WHERE JSON_EXTRACT(arguments, "$.new_user_id") = %i',
442 442
                     $post_id
443 443
                 );
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
             // Check KEY
494 494
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
495 495
                 echo prepareExchangedData(
496
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
496
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
497 497
                 break;
498 498
             }
499 499
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 
502 502
             // Get info about user to delete
503 503
             $data_user = DB::queryfirstrow(
504
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
504
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
505 505
                 WHERE id = %i',
506 506
                 $post_id
507 507
             );
@@ -521,10 +521,10 @@  discard block
 block discarded – undo
521 521
                     $post_id
522 522
                 );
523 523
                 echo prepareExchangedData(
524
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
524
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
525 525
             } else {
526 526
                 echo prepareExchangedData(
527
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
527
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
528 528
             }
529 529
             break;
530 530
             /*
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                 || $_SESSION['is_admin'] !== '1'
538 538
             ) {
539 539
                 echo prepareExchangedData(
540
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
540
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
541 541
                 exit();
542 542
             }
543 543
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 
547 547
             // Get info about user to delete
548 548
             $data_user = DB::queryfirstrow(
549
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
549
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
550 550
                 WHERE id = %i',
551 551
                 $post_id
552 552
             );
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
                 );
570 570
 
571 571
                 echo prepareExchangedData(
572
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
572
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
573 573
             } else {
574 574
                 echo prepareExchangedData(
575
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
575
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
576 576
             }
577 577
             break;
578 578
             /*
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
             // Check KEY
583 583
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
584 584
                 echo prepareExchangedData(
585
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
585
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
586 586
                 break;
587 587
             }
588 588
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
             // Get info about user to delete
593 593
             $data_user = DB::queryfirstrow(
594 594
                 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire
595
-                FROM ' . prefixTable('users') . '
595
+                FROM ' . prefixTable('users').'
596 596
                 WHERE id = %i',
597 597
                 $post_id
598 598
             );
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
                     $post_id
618 618
                 );
619 619
                 echo prepareExchangedData(
620
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
620
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
621 621
             } else {
622 622
                 echo prepareExchangedData(
623
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
623
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
624 624
             }
625 625
             break;
626 626
             /*
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
             // Check KEY
631 631
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
632 632
                 echo prepareExchangedData(
633
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
633
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
634 634
                 break;
635 635
             }
636 636
 
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 
640 640
             // Get info about user to delete
641 641
             $data_user = DB::queryfirstrow(
642
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
642
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
643 643
                 WHERE id = %i',
644 644
                 $post_id
645 645
             );
@@ -661,10 +661,10 @@  discard block
 block discarded – undo
661 661
                     $post_id
662 662
                 );
663 663
                 echo prepareExchangedData(
664
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
664
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
665 665
             } else {
666 666
                 echo prepareExchangedData(
667
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
667
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
668 668
             }
669 669
             break;
670 670
             /*
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
             // Check KEY
676 676
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
677 677
                 echo prepareExchangedData(
678
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
678
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
679 679
                 break;
680 680
             }
681 681
 
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
             // Get info about user to delete
686 686
             $data_user = DB::queryfirstrow(
687 687
                 'SELECT admin, isAdministratedByRole, gestionnaire
688
-                FROM ' . prefixTable('users') . '
688
+                FROM ' . prefixTable('users').'
689 689
                 WHERE id = %i',
690 690
                 $post_id
691 691
             );
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
                     $post_id
709 709
                 );
710 710
                 echo prepareExchangedData(
711
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
711
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
712 712
             } else {
713 713
                 echo prepareExchangedData(
714
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
714
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
715 715
             }
716 716
             break;
717 717
             /*
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
             // Check KEY
722 722
             if (filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING) !== filter_var($_SESSION['key'], FILTER_SANITIZE_STRING)) {
723 723
                 echo prepareExchangedData(
724
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
724
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed', 'error_text' => langHdl('error_not_allowed_to')), 'encode');
725 725
                 break;
726 726
             }
727 727
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
             // Get info about user to delete
732 732
             $data_user = DB::queryfirstrow(
733 733
                 'SELECT admin, isAdministratedByRole, gestionnaire
734
-                FROM ' . prefixTable('users') . '
734
+                FROM ' . prefixTable('users').'
735 735
                 WHERE id = %i',
736 736
                 $post_id
737 737
             );
@@ -751,10 +751,10 @@  discard block
 block discarded – undo
751 751
                     $post_id
752 752
                 );
753 753
                 echo prepareExchangedData(
754
-                    $SETTINGS['cpassman_dir'],array('error' => ''), 'encode');
754
+                    $SETTINGS['cpassman_dir'], array('error' => ''), 'encode');
755 755
             } else {
756 756
                 echo prepareExchangedData(
757
-                    $SETTINGS['cpassman_dir'],array('error' => 'not_allowed'), 'encode');
757
+                    $SETTINGS['cpassman_dir'], array('error' => 'not_allowed'), 'encode');
758 758
             }
759 759
             break;
760 760
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
             // Get info about user to delete
774 774
             $data_user = DB::queryfirstrow(
775 775
                 'SELECT admin, isAdministratedByRole, gestionnaire
776
-                FROM ' . prefixTable('users') . '
776
+                FROM ' . prefixTable('users').'
777 777
                 WHERE id = %i',
778 778
                 $post_id
779 779
             );
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             $return = array();
813 813
             // Check if folder exists
814 814
             $data = DB::query(
815
-                'SELECT * FROM ' . prefixTable('nested_tree') . '
815
+                'SELECT * FROM '.prefixTable('nested_tree').'
816 816
                 WHERE title = %s AND parent_id = %i',
817 817
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING),
818 818
                 '0'
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
             }
826 826
             // Check if role exists
827 827
             $data = DB::query(
828
-                'SELECT * FROM ' . prefixTable('roles_title') . '
828
+                'SELECT * FROM '.prefixTable('roles_title').'
829 829
                 WHERE title = %s',
830 830
                 filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING)
831 831
             );
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
         case 'user_log_items':
846 846
             $nb_pages = 1;
847 847
             $logs = $sql_filter = '';
848
-            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . '&nbsp;:&nbsp;</td>';
848
+            $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').'&nbsp;:&nbsp;</td>';
849 849
 
850 850
             // Prepare POST variables
851 851
             $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT);
@@ -857,14 +857,14 @@  discard block
 block discarded – undo
857 857
                     && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING))
858 858
                     && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all'
859 859
                 ) {
860
-                    $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'";
860
+                    $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'";
861 861
                 }
862 862
                 // get number of pages
863 863
                 DB::query(
864 864
                     'SELECT *
865
-                    FROM ' . prefixTable('log_items') . ' as l
866
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
867
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
865
+                    FROM ' . prefixTable('log_items').' as l
866
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
867
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
868 868
                     WHERE l.id_user = %i ' . $sql_filter,
869 869
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
870 870
                 );
@@ -882,19 +882,19 @@  discard block
 block discarded – undo
882 882
                 // launch query
883 883
                 $rows = DB::query(
884 884
                     'SELECT l.date as date, u.login as login, i.label as label, l.action as action
885
-                    FROM ' . prefixTable('log_items') . ' as l
886
-                    INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
887
-                    INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
888
-                    WHERE l.id_user = %i ' . $sql_filter . '
885
+                    FROM ' . prefixTable('log_items').' as l
886
+                    INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
887
+                    INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
888
+                    WHERE l.id_user = %i ' . $sql_filter.'
889 889
                     ORDER BY date DESC
890
-                    LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page),
890
+                    LIMIT ' . intval($start).','.intval($post_nb_items_by_page),
891 891
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
892 892
                 );
893 893
             } else {
894 894
                 // get number of pages
895 895
                 DB::query(
896 896
                     'SELECT *
897
-                    FROM ' . prefixTable('log_system') . '
897
+                    FROM ' . prefixTable('log_system').'
898 898
                     WHERE type = %s AND field_1=%i',
899 899
                     'user_mngt',
900 900
                     filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT)
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
                 // launch query
914 914
                 $rows = DB::query(
915 915
                     'SELECT *
916
-                    FROM ' . prefixTable('log_system') . '
916
+                    FROM ' . prefixTable('log_system').'
917 917
                     WHERE type = %s AND field_1 = %i
918 918
                     ORDER BY date DESC
919 919
                     LIMIT %i, %i',
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
             if (isset($counter) && $counter != 0) {
928 928
                 $nb_pages = ceil($counter / intval($post_nb_items_by_page));
929 929
                 for ($i = 1; $i <= $nb_pages; ++$i) {
930
-                    $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>';
930
+                    $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>';
931 931
                 }
932 932
             }
933 933
             $pages .= '</tr></table>';
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
                     if ($post_scope === 'user_mngt') {
937 937
                         $user = DB::queryfirstrow(
938 938
                             'SELECT login
939
-                            from ' . prefixTable('users') . '
939
+                            from ' . prefixTable('users').'
940 940
                             WHERE id=%i',
941 941
                             $record['qui']
942 942
                         );
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
                         if ($tmp[0] == 'at_user_initial_pwd_changed') {
947 947
                             $label = langHdl('log_user_initial_pwd_changed');
948 948
                         } elseif ($tmp[0] == 'at_user_email_changed') {
949
-                            $label = langHdl('log_user_email_changed') . $tmp[1];
949
+                            $label = langHdl('log_user_email_changed').$tmp[1];
950 950
                         } elseif ($tmp[0] == 'at_user_added') {
951 951
                             $label = langHdl('log_user_created');
952 952
                         } elseif ($tmp[0] == 'at_user_locked') {
@@ -957,14 +957,14 @@  discard block
 block discarded – undo
957 957
                             $label = langHdl('log_user_pwd_changed');
958 958
                         }
959 959
                         // prepare log
960
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>';
960
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>';
961 961
                     } else {
962
-                        $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>';
962
+                        $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>';
963 963
                     }
964 964
                 }
965 965
             }
966 966
 
967
-            echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]';
967
+            echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]';
968 968
             break;
969 969
 
970 970
             /*
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
             } else {
991 991
                 // Get folder id for Admin
992 992
                 $admin_folder = DB::queryFirstRow(
993
-                    'SELECT id FROM ' . prefixTable('nested_tree') . '
993
+                    'SELECT id FROM '.prefixTable('nested_tree').'
994 994
                     WHERE title = %i AND personal_folder = %i',
995 995
                     intval($_SESSION['user_id']),
996 996
                     '1'
@@ -1001,15 +1001,15 @@  discard block
 block discarded – undo
1001 1001
                     // Get each Items in PF
1002 1002
                     $rows = DB::query(
1003 1003
                         'SELECT i.pw, i.label, l.id_user
1004
-                        FROM ' . prefixTable('items') . ' as i
1005
-                        LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id)
1004
+                        FROM ' . prefixTable('items').' as i
1005
+                        LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id)
1006 1006
                         WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i',
1007 1007
                         'at_creation',
1008 1008
                         '1',
1009 1009
                         intval($folder->id)
1010 1010
                     );
1011 1011
                     foreach ($rows as $record) {
1012
-                        echo $record['label'] . ' - ';
1012
+                        echo $record['label'].' - ';
1013 1013
                         // Change user
1014 1014
                         DB::update(
1015 1015
                             prefixTable('log_items'),
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
             // Get info about user to delete
1045 1045
             $data_user = DB::queryfirstrow(
1046 1046
                 'SELECT admin, isAdministratedByRole, gestionnaire
1047
-                FROM ' . prefixTable('users') . '
1047
+                FROM ' . prefixTable('users').'
1048 1048
                 WHERE id = %i',
1049 1049
                 $post_user_id
1050 1050
             );
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 
1082 1082
             // Do
1083 1083
             $rows = DB::query(
1084
-                'SELECT id FROM ' . prefixTable('users') . '
1084
+                'SELECT id FROM '.prefixTable('users').'
1085 1085
                 WHERE timestamp != %s AND admin != %i',
1086 1086
                 '',
1087 1087
                 '1'
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
                 // Get info about user to delete
1091 1091
                 $data_user = DB::queryfirstrow(
1092 1092
                     'SELECT admin, isAdministratedByRole, gestionnaire
1093
-                    FROM ' . prefixTable('users') . '
1093
+                    FROM ' . prefixTable('users').'
1094 1094
                     WHERE id = %i',
1095 1095
                     $record['id']
1096 1096
                 );
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 
1144 1144
             // decrypt and retrieve data in JSON format
1145 1145
             $dataReceived = prepareExchangedData(
1146
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1146
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1147 1147
             
1148 1148
             // Prepare variables
1149 1149
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
             // Get info about user
1152 1152
             $rowUser = DB::queryfirstrow(
1153 1153
                 'SELECT *
1154
-                FROM ' . prefixTable('users') . '
1154
+                FROM ' . prefixTable('users').'
1155 1155
                 WHERE id = %i',
1156 1156
                 $post_id
1157 1157
             );
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
                 $arrFldAllowed = array();
1170 1170
 
1171 1171
                 //Build tree
1172
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1172
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1173 1173
                 $tree->register();
1174 1174
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1175 1175
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
                 // array of roles for actual user
1181 1181
                 $my_functions = explode(';', $_SESSION['fonction_id']);
1182 1182
 
1183
-                $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title'));
1183
+                $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title'));
1184 1184
                 foreach ($rows as $record) {
1185 1185
                     if (
1186 1186
                         (int) $_SESSION['is_admin'] === 1
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
                 $rolesList = array();
1217 1217
                 $managedBy = array();
1218 1218
                 $selected = '';
1219
-                $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
1219
+                $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
1220 1220
                 foreach ($rows as $reccord) {
1221 1221
                     $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']);
1222 1222
                 }
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
                         array_push(
1248 1248
                             $managedBy,
1249 1249
                             array(
1250
-                                'title' => langHdl('managers_of') . ' ' . $fonction['title'],
1250
+                                'title' => langHdl('managers_of').' '.$fonction['title'],
1251 1251
                                 'id' => $fonction['id'],
1252 1252
                                 'selected' => $selected,
1253 1253
                             )
@@ -1329,9 +1329,9 @@  discard block
 block discarded – undo
1329 1329
 
1330 1330
                 // get USER STATUS
1331 1331
                 if ($rowUser['disabled'] == 1) {
1332
-                    $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">' . langHdl('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">' . langHdl('user_info_delete_question') . '</label>';
1332
+                    $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk">&nbsp;<label for="1">'.langHdl('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">'.langHdl('user_info_delete_question').'</label>';
1333 1333
                 } else {
1334
-                    $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk">&nbsp;' . langHdl('user_info_lock_question');
1334
+                    $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk">&nbsp;'.langHdl('user_info_lock_question');
1335 1335
                 }
1336 1336
 
1337 1337
                 $arrData['error'] = false;
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
             // decrypt and retrieve data in JSON format
1405 1405
             $dataReceived = prepareExchangedData(
1406
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1406
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1407 1407
 
1408 1408
             // Prepare variables
1409 1409
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_STRING);
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
                 // count number of admins
1429 1429
                 $users = DB::query(
1430 1430
                     'SELECT id
1431
-                    FROM ' . prefixTable('users') . '
1431
+                    FROM ' . prefixTable('users').'
1432 1432
                     WHERE admin = 1 AND email != "" AND pw != ""'
1433 1433
                 );
1434 1434
                 if (DB::count() === 1) {
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
 
1518 1518
             // Get info about user to delete
1519 1519
             $data_user = DB::queryfirstrow(
1520
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1520
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1521 1521
                 WHERE id = %i',
1522 1522
                 $post_id
1523 1523
             );
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
                     );
1539 1539
                     // delete personal folder and subfolders
1540 1540
                     $data = DB::queryfirstrow(
1541
-                        'SELECT id FROM ' . prefixTable('nested_tree') . '
1541
+                        'SELECT id FROM '.prefixTable('nested_tree').'
1542 1542
                         WHERE title = %s AND personal_folder = %i',
1543 1543
                         $post_id,
1544 1544
                         '1'
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
                             DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1');
1552 1552
                             // delete items & logs
1553 1553
                             $items = DB::query(
1554
-                                'SELECT id FROM ' . prefixTable('items') . '
1554
+                                'SELECT id FROM '.prefixTable('items').'
1555 1555
                                 WHERE id_tree=%i AND perso = %i',
1556 1556
                                 $folder->id,
1557 1557
                                 '1'
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
                 } else {
1573 1573
                     // Get old data about user
1574 1574
                     $oldData = DB::queryfirstrow(
1575
-                        'SELECT * FROM ' . prefixTable('users') . '
1575
+                        'SELECT * FROM '.prefixTable('users').'
1576 1576
                         WHERE id = %i',
1577 1577
                         $post_id
1578 1578
                     );
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
 
1610 1610
                     // update LOG
1611 1611
                     if ($oldData['email'] !== $post_email) {
1612
-                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1612
+                        logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], (string) $_SESSION['user_id'], $_SESSION['login'], $post_id);
1613 1613
                     }
1614 1614
                 }
1615 1615
                 echo prepareExchangedData(
@@ -1662,14 +1662,14 @@  discard block
 block discarded – undo
1662 1662
 
1663 1663
             // decrypt and retrieve data in JSON format
1664 1664
             $dataReceived = prepareExchangedData(
1665
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
1665
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
1666 1666
 
1667 1667
             // Prepare variables
1668 1668
             $post_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
1669 1669
 
1670 1670
             // Get info about user to delete
1671 1671
             $data_user = DB::queryfirstrow(
1672
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
1672
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
1673 1673
                 WHERE id = %i',
1674 1674
                 $post_id
1675 1675
             );
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
             }
1722 1722
 
1723 1723
             DB::queryfirstrow(
1724
-                'SELECT * FROM ' . prefixTable('users') . '
1724
+                'SELECT * FROM '.prefixTable('users').'
1725 1725
                 WHERE login = %s',
1726 1726
                 filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING)
1727 1727
             );
@@ -1770,14 +1770,14 @@  discard block
 block discarded – undo
1770 1770
             $arrData = array();
1771 1771
 
1772 1772
             //Build tree
1773
-            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1773
+            $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
1774 1774
             $tree->register();
1775 1775
             $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
1776 1776
 
1777 1777
             // get User info
1778 1778
             $rowUser = DB::queryFirstRow(
1779 1779
                 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb
1780
-                FROM ' . prefixTable('users') . '
1780
+                FROM ' . prefixTable('users').'
1781 1781
                 WHERE id = %i',
1782 1782
                 $post_id
1783 1783
             );
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
                 // refine folders based upon roles
1796 1796
                 $rows = DB::query(
1797 1797
                     'SELECT folder_id, type
1798
-                    FROM ' . prefixTable('roles_values') . '
1798
+                    FROM ' . prefixTable('roles_values').'
1799 1799
                     WHERE role_id IN %ls
1800 1800
                     ORDER BY folder_id ASC',
1801 1801
                     $arrData['functions']
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
                 }
1819 1819
 
1820 1820
                 // add allowed folders
1821
-                foreach($arrData['allowed_folders'] as $Fld) {
1821
+                foreach ($arrData['allowed_folders'] as $Fld) {
1822 1822
                     array_push($arrFolders, array('id' => $Fld, 'type' => 'W', 'special' => true));
1823 1823
                 }
1824 1824
                 
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
                             // get folder name
1830 1830
                             $row = DB::queryFirstRow(
1831 1831
                                 'SELECT title, nlevel, id
1832
-                                FROM ' . prefixTable('nested_tree') . '
1832
+                                FROM ' . prefixTable('nested_tree').'
1833 1833
                                 WHERE id = %i',
1834 1834
                                 $fld['id']
1835 1835
                             );
@@ -1842,38 +1842,38 @@  discard block
 block discarded – undo
1842 1842
 
1843 1843
                             // manage right icon
1844 1844
                             if ($fld['type'] == 'W') {
1845
-                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' .
1846
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1847
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1845
+                                $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'.
1846
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1847
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1848 1848
                             } elseif ($fld['type'] == 'ND') {
1849
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1850
-                                    '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' .
1851
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1849
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1850
+                                    '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'.
1851
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1852 1852
                             } elseif ($fld['type'] == 'NE') {
1853
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1854
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1855
-                                    '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>';
1853
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1854
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1855
+                                    '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>';
1856 1856
                             } elseif ($fld['type'] == 'NDNE') {
1857
-                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' .
1858
-                                    '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' .
1859
-                                    '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>';
1857
+                                $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'.
1858
+                                    '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'.
1859
+                                    '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>';
1860 1860
                             } elseif ($fld['type'] == '') {
1861
-                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="' . langHdl('no_access') . '"></i>';
1861
+                                $label = '<i class="fas fa-eye-slash infotip text-danger mr-2" title="'.langHdl('no_access').'"></i>';
1862 1862
                             } else {
1863
-                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>';
1863
+                                $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>';
1864 1864
                             }
1865 1865
 
1866
-                            $html .= '<tr><td>' . $ident . $row['title'] .
1867
-                                ' <small class="text-info">[' . $row['id'] . ']</small>'.
1868
-                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="' . langHdl('user_specific_right') . '"></i>' : '').
1869
-                                '</td><td>' . $label . '</td></tr>';
1866
+                            $html .= '<tr><td>'.$ident.$row['title'].
1867
+                                ' <small class="text-info">['.$row['id'].']</small>'.
1868
+                                ($fld['special'] === true ? '<i class="fas fa-user-tag infotip text-primary ml-5" title="'.langHdl('user_specific_right').'"></i>' : '').
1869
+                                '</td><td>'.$label.'</td></tr>';
1870 1870
                             break;
1871 1871
                         }
1872 1872
                     }
1873 1873
                 }
1874 1874
 
1875
-                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' .
1876
-                    $html . '</tbody></table>';
1875
+                $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'.
1876
+                    $html.'</tbody></table>';
1877 1877
             } else {
1878 1878
                 $html_full = '';
1879 1879
             }
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
             if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) {
1923 1923
                 $rows = DB::query(
1924 1924
                     'SELECT *
1925
-                    FROM ' . prefixTable('users') . '
1925
+                    FROM ' . prefixTable('users').'
1926 1926
                     WHERE admin = %i AND isAdministratedByRole IN %ls',
1927 1927
                     '0',
1928 1928
                     array_filter($_SESSION['user_roles'])
@@ -1930,7 +1930,7 @@  discard block
 block discarded – undo
1930 1930
             } else {
1931 1931
                 $rows = DB::query(
1932 1932
                     'SELECT *
1933
-                    FROM ' . prefixTable('users') . '
1933
+                    FROM ' . prefixTable('users').'
1934 1934
                     WHERE admin = %i',
1935 1935
                     '0'
1936 1936
                 );
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
                 $groupIds = [];
1943 1943
                 foreach (explode(';', $record['fonction_id']) as $group) {
1944 1944
                     $tmp = DB::queryfirstrow(
1945
-                        'SELECT id, title FROM ' . prefixTable('roles_title') . '
1945
+                        'SELECT id, title FROM '.prefixTable('roles_title').'
1946 1946
                         WHERE id = %i',
1947 1947
                         $group
1948 1948
                     );
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 
1955 1955
                 // Get managed_by
1956 1956
                 $managedBy = DB::queryfirstrow(
1957
-                    'SELECT id, title FROM ' . prefixTable('roles_title') . '
1957
+                    'SELECT id, title FROM '.prefixTable('roles_title').'
1958 1958
                     WHERE id = %i',
1959 1959
                     $record['isAdministratedByRole']
1960 1960
                 );
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
                 $foldersAllowedIds = [];
1965 1965
                 foreach (explode(';', $record['groupes_visibles']) as $role) {
1966 1966
                     $tmp = DB::queryfirstrow(
1967
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1967
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1968 1968
                         WHERE id = %i',
1969 1969
                         $role
1970 1970
                     );
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
                 $foldersForbiddenIds = [];
1978 1978
                 foreach (explode(';', $record['groupes_interdits']) as $role) {
1979 1979
                     $tmp = DB::queryfirstrow(
1980
-                        'SELECT id, title FROM ' . prefixTable('nested_tree') . '
1980
+                        'SELECT id, title FROM '.prefixTable('nested_tree').'
1981 1981
                         WHERE id = %i',
1982 1982
                         $role
1983 1983
                     );
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
                         'login' => $record['login'],
1996 1996
                         'groups' => implode(', ', $groups),
1997 1997
                         'groupIds' => $groupIds,
1998
-                        'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'],
1998
+                        'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'],
1999 1999
                         'managedById' => $managedBy === null ? 0 : $managedBy['id'],
2000 2000
                         'foldersAllowed' => implode(', ', $foldersAllowed),
2001 2001
                         'foldersAllowedIds' => $foldersAllowedIds,
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
 
2052 2052
             // decrypt and retreive data in JSON format
2053 2053
             $dataReceived = prepareExchangedData(
2054
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2054
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2055 2055
 
2056 2056
             $post_source_id = filter_var(htmlspecialchars_decode($dataReceived['source_id']), FILTER_SANITIZE_NUMBER_INT);
2057 2057
             $post_destination_ids = filter_var_array($dataReceived['destination_ids'], FILTER_SANITIZE_NUMBER_INT);
@@ -2077,7 +2077,7 @@  discard block
 block discarded – undo
2077 2077
 
2078 2078
             // Get info about user
2079 2079
             $data_user = DB::queryfirstrow(
2080
-                'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
2080
+                'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
2081 2081
                 WHERE id = %i',
2082 2082
                 $post_source_id
2083 2083
             );
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 
2234 2234
             // decrypt and retrieve data in JSON format
2235 2235
             $dataReceived = prepareExchangedData(
2236
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2236
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2237 2237
 
2238 2238
             // prepare variables
2239 2239
             $post_user_id = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -2245,14 +2245,14 @@  discard block
 block discarded – undo
2245 2245
             if (empty($post_context) === false && $post_context === 'add_one_role_to_user') {
2246 2246
                 $data_user = DB::queryfirstrow(
2247 2247
                     'SELECT fonction_id
2248
-                    FROM ' . prefixTable('users') . '
2248
+                    FROM ' . prefixTable('users').'
2249 2249
                     WHERE id = %i',
2250 2250
                     $post_user_id
2251 2251
                 );
2252 2252
 
2253 2253
                 if ($data_user) {
2254 2254
                     // Ensure array is unique
2255
-                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value;
2255
+                    $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value;
2256 2256
                     $post_new_value = implode(';', array_unique(explode(';', $post_new_value)));
2257 2257
                 } else {
2258 2258
                     // User not found
@@ -2287,7 +2287,7 @@  discard block
 block discarded – undo
2287 2287
                     'id = %i',
2288 2288
                     $post_user_id
2289 2289
                 );
2290
-            } else if($post_field === 'user_api_key') {
2290
+            } else if ($post_field === 'user_api_key') {
2291 2291
                 $_SESSION['user']['api-key'] = $post_new_value;
2292 2292
             }
2293 2293
 
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
             if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') {
2325 2325
                 $record = DB::queryFirstRow(
2326 2326
                     'SELECT user_ip_lastdate
2327
-                    FROM ' . prefixTable('users') . '
2327
+                    FROM ' . prefixTable('users').'
2328 2328
                     WHERE id = %i',
2329 2329
                     $_SESSION['user_id']
2330 2330
                 );
@@ -2393,38 +2393,38 @@  discard block
 block discarded – undo
2393 2393
             }
2394 2394
 
2395 2395
             // Load expected libraries
2396
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2397
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
2398
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2399
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php';
2400
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php';
2401
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php';
2402
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php';
2403
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php';
2404
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2405
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php';
2406
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php';
2407
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php';
2408
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php';
2409
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php';
2410
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php';
2411
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php';
2412
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php';
2413
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php';
2414
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php';
2415
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php';
2416
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php';
2417
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php';
2418
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php';
2419
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php';
2420
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php';
2421
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php';
2422
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php';
2423
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
2424
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
2425
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
2426
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php';
2427
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
2396
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
2397
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
2398
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php';
2399
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php';
2400
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php';
2401
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php';
2402
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php';
2403
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php';
2404
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php';
2405
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php';
2406
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php';
2407
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php';
2408
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php';
2409
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php';
2410
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php';
2411
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php';
2412
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php';
2413
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php';
2414
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php';
2415
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php';
2416
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php';
2417
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php';
2418
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php';
2419
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php';
2420
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php';
2421
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php';
2422
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php';
2423
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
2424
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
2425
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
2426
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php';
2427
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
2428 2428
 
2429 2429
             // Build ldap configuration array
2430 2430
             $config = [
@@ -2464,7 +2464,7 @@  discard block
 block discarded – undo
2464 2464
                     $SETTINGS['cpassman_dir'],
2465 2465
                     array(
2466 2466
                         'error' => true,
2467
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
2467
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
2468 2468
                     ),
2469 2469
                     'encode'
2470 2470
                 );
@@ -2485,12 +2485,12 @@  discard block
 block discarded – undo
2485 2485
                 ->whereHas($SETTINGS['ldap_user_attribute'])
2486 2486
                 ->get();
2487 2487
             
2488
-            foreach($users as $i => $adUser) {
2488
+            foreach ($users as $i => $adUser) {
2489 2489
                 if (isset($adUser[$SETTINGS['ldap_user_attribute']]) === false) continue;
2490 2490
                 
2491 2491
                 // Build the list of all groups in AD
2492 2492
                 if (isset($adUser['memberof']) === true) {
2493
-                    foreach($adUser['memberof'] as $j => $adUserGroup) {
2493
+                    foreach ($adUser['memberof'] as $j => $adUserGroup) {
2494 2494
                         if (empty($adUserGroup) === false && $j !== "count") {
2495 2495
                             $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3);
2496 2496
                             if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) {
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
                     // Get his ID
2507 2507
                     $userInfo = DB::queryfirstrow(
2508 2508
                         'SELECT id, login, fonction_id, auth_type
2509
-                        FROM ' . prefixTable('users') . '
2509
+                        FROM ' . prefixTable('users').'
2510 2510
                         WHERE login = %s',
2511 2511
                         $userLogin
2512 2512
                     );
@@ -2541,7 +2541,7 @@  discard block
 block discarded – undo
2541 2541
             }
2542 2542
 
2543 2543
             // Get all groups in Teampass
2544
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
2544
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
2545 2545
             foreach ($rows as $record) {
2546 2546
                 array_push(
2547 2547
                     $teampassRoles,
@@ -2615,7 +2615,7 @@  discard block
 block discarded – undo
2615 2615
             // Check if user already exists
2616 2616
             $data = DB::query(
2617 2617
                 'SELECT id, fonction_id, groupes_interdits, groupes_visibles
2618
-                FROM ' . prefixTable('users') . '
2618
+                FROM ' . prefixTable('users').'
2619 2619
                 WHERE login = %s',
2620 2620
                 $post_login
2621 2621
             );
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
                 );
2727 2727
 
2728 2728
                 // Rebuild tree
2729
-                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
2729
+                $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
2730 2730
                 $tree->register();
2731 2731
                 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
2732 2732
                 $tree->rebuild();
@@ -2803,12 +2803,12 @@  discard block
 block discarded – undo
2803 2803
             // Send mail to user with new OTP
2804 2804
             $userInfo = DB::queryFirstRow(
2805 2805
                 'SELECT email
2806
-                FROM ' . prefixTable('users') . '
2806
+                FROM ' . prefixTable('users').'
2807 2807
                 WHERE id = %i',
2808 2808
                 $post_userId
2809 2809
             );
2810 2810
             sendEmail(
2811
-                'TEAMPASS - ' . langHdl('temporary_encryption_code'),
2811
+                'TEAMPASS - '.langHdl('temporary_encryption_code'),
2812 2812
                 str_replace(
2813 2813
                     array('#enc_code#'),
2814 2814
                     array($post_otp),
@@ -2874,7 +2874,7 @@  discard block
 block discarded – undo
2874 2874
             // Check if user already exists
2875 2875
             DB::query(
2876 2876
                 'SELECT id
2877
-                FROM ' . prefixTable('users') . '
2877
+                FROM ' . prefixTable('users').'
2878 2878
                 WHERE id = %i',
2879 2879
                 $post_id
2880 2880
             );
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
 
2932 2932
             // decrypt and retrieve data in JSON format
2933 2933
             $dataReceived = prepareExchangedData(
2934
-                    $SETTINGS['cpassman_dir'],$post_data, 'decode');
2934
+                    $SETTINGS['cpassman_dir'], $post_data, 'decode');
2935 2935
 
2936 2936
             // Prepare variables
2937 2937
             $post_userid = filter_var($dataReceived['user_id'], FILTER_SANITIZE_NUMBER_INT);
@@ -2955,7 +2955,7 @@  discard block
 block discarded – undo
2955 2955
             // Check if user already exists
2956 2956
             $userInfo = DB::queryfirstrow(
2957 2957
                 'SELECT id, private_key, public_key
2958
-                FROM ' . prefixTable('users') . '
2958
+                FROM ' . prefixTable('users').'
2959 2959
                 WHERE id = %i',
2960 2960
                 $post_userid
2961 2961
             );
@@ -3004,7 +3004,7 @@  discard block
 block discarded – undo
3004 3004
             if (count($_SESSION['personal_folders']) > 0) {
3005 3005
                 DB::query(
3006 3006
                     'SELECT id
3007
-                    FROM ' . prefixTable('items') . '
3007
+                    FROM ' . prefixTable('items').'
3008 3008
                     WHERE id_tree IN %ls',
3009 3009
                     $_SESSION['personal_folders']
3010 3010
                 );
@@ -3089,7 +3089,7 @@  discard block
 block discarded – undo
3089 3089
             // Check if user already exists
3090 3090
             DB::query(
3091 3091
                 'SELECT id
3092
-                FROM ' . prefixTable('users') . '
3092
+                FROM ' . prefixTable('users').'
3093 3093
                 WHERE id = %i',
3094 3094
                 $post_id
3095 3095
             );
@@ -3216,10 +3216,10 @@  discard block
 block discarded – undo
3216 3216
                     'process_type' => 'create_user_keys',
3217 3217
                     'arguments' => json_encode([
3218 3218
                         'new_user_id' => (int) $post_user_id,
3219
-                        'new_user_pwd' => cryption($post_user_pwd, '','encrypt', $SETTINGS)['string'],
3220
-                        'new_user_code' => cryption($post_user_code, '','encrypt', $SETTINGS)['string'],
3219
+                        'new_user_pwd' => cryption($post_user_pwd, '', 'encrypt', $SETTINGS)['string'],
3220
+                        'new_user_code' => cryption($post_user_code, '', 'encrypt', $SETTINGS)['string'],
3221 3221
                         'owner_id' => (int) $_SESSION['user_id'],
3222
-                        'creator_pwd' => cryption($_SESSION['user_pwd'], '','encrypt', $SETTINGS)['string'],
3222
+                        'creator_pwd' => cryption($_SESSION['user_pwd'], '', 'encrypt', $SETTINGS)['string'],
3223 3223
                     ]),
3224 3224
                     'updated_at' => '',
3225 3225
                     'finished_at' => '',
@@ -3381,7 +3381,7 @@  discard block
 block discarded – undo
3381 3381
             // get user info
3382 3382
             $userInfo = DB::queryFirstRow(
3383 3383
                 'SELECT *
3384
-                FROM ' . prefixTable('users') . '
3384
+                FROM ' . prefixTable('users').'
3385 3385
                 WHERE id = %i',
3386 3386
                 $user_id
3387 3387
             );
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
 
3438 3438
     // Get info about user
3439 3439
     $data_user = DB::queryfirstrow(
3440
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3440
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3441 3441
         WHERE id = %i',
3442 3442
         $value[1]
3443 3443
     );
@@ -3470,7 +3470,7 @@  discard block
 block discarded – undo
3470 3470
             logEvents(
3471 3471
                 $SETTINGS,
3472 3472
                 'user_mngt',
3473
-                'at_user_new_' . $value[0] . ':' . $value[1],
3473
+                'at_user_new_'.$value[0].':'.$value[1],
3474 3474
                 (string) $_SESSION['user_id'],
3475 3475
                 $_SESSION['login'],
3476 3476
                 filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING)
@@ -3501,7 +3501,7 @@  discard block
 block discarded – undo
3501 3501
 
3502 3502
     // Get info about user
3503 3503
     $data_user = DB::queryfirstrow(
3504
-        'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . '
3504
+        'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').'
3505 3505
         WHERE id = %i',
3506 3506
         $value[1]
3507 3507
     );
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 date_default_timezone_set(isset($SETTINGS['timezone']) === true ? $SETTINGS['timezone'] : 'UTC');
49 49
 
50 50
 // DO CHECKS
51
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
52
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
51
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
52
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
53 53
 $post_type = filter_input(INPUT_POST, 'type', FILTER_SANITIZE_STRING);
54 54
 if (
55 55
     isset($post_type) === true
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     && checkUser($_SESSION['user_id'], $_SESSION['key'], 'home', $SETTINGS) === false
66 66
 ) {
67 67
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
68
-    include $SETTINGS['cpassman_dir'] . '/error.php';
68
+    include $SETTINGS['cpassman_dir'].'/error.php';
69 69
     exit();
70 70
 } elseif ((isset($_SESSION['user_id']) === true
71 71
         && isset($_SESSION['key'])) === true
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     mainQuery($SETTINGS);
78 78
 } else {
79 79
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit();
82 82
 }
83 83
 
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
     // Includes
95
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
96
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
97
-    include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
98
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
95
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
96
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
97
+    include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
98
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
99 99
 
100 100
     // Connect to mysql server
101
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
101
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
102 102
 
103 103
     DB::$host = DB_HOST;
104 104
     DB::$user = DB_USER;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     DB::$connect_options = DB_CONNECT_OPTIONS;
111 111
 
112 112
     // User's language loading
113
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user']['user_language'] . '.php';
113
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user']['user_language'].'.php';
114 114
 
115 115
     // Prepare post variables
116 116
     $post_key = filter_input(INPUT_POST, 'key', FILTER_SANITIZE_STRING);
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             $pwdlib = new PasswordLib\PasswordLib();
504 504
             // generate key
505 505
             $key = $pwdlib->getRandomToken(filter_input(INPUT_POST, 'size', FILTER_SANITIZE_NUMBER_INT));
506
-            return '[{"key" : "' . htmlentities($key, ENT_QUOTES) . '"}]';
506
+            return '[{"key" : "'.htmlentities($key, ENT_QUOTES).'"}]';
507 507
 
508 508
         /*
509 509
         * Default case
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
                 )
632 632
             );
633 633
 
634
-            return '[{"token" : "' . $token . '"}]';
634
+            return '[{"token" : "'.$token.'"}]';
635 635
 
636 636
         /*
637 637
         * Default case
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
     // get number of items
693 693
     DB::queryFirstRow(
694 694
         'SELECT increment_id
695
-        FROM ' . prefixTable('sharekeys_items') .
695
+        FROM ' . prefixTable('sharekeys_items').
696 696
         ' WHERE user_id = %i',
697 697
         $userId
698 698
     );
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
         // check if expected security level is reached
749 749
         $dataUser = DB::queryfirstrow(
750 750
             'SELECT *
751
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
751
+            FROM ' . prefixTable('users').' WHERE id = %i',
752 752
             $post_user_id
753 753
         );
754 754
 
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
         if (empty($dataUser['fonction_id']) === false) {
770 770
             $data = DB::queryFirstRow(
771 771
                 'SELECT complexity
772
-                FROM ' . prefixTable('roles_title') . '
773
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
772
+                FROM ' . prefixTable('roles_title').'
773
+                WHERE id IN (' . $dataUser['fonction_id'].')
774 774
                 ORDER BY complexity DESC'
775 775
             );
776 776
         } else {
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
                 $SETTINGS['cpassman_dir'],
785 785
                 array(
786 786
                     'error' => true,
787
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . langHdl('complexity_level_not_reached') . '.<br>' .
788
-                        langHdl('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
787
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.langHdl('complexity_level_not_reached').'.<br>'.
788
+                        langHdl('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
789 789
                 ),
790 790
                 'encode'
791 791
             );
@@ -891,14 +891,14 @@  discard block
 block discarded – undo
891 891
         // Get data about user
892 892
         $data = DB::queryfirstrow(
893 893
             'SELECT id, email, pw
894
-            FROM ' . prefixTable('users') . '
894
+            FROM ' . prefixTable('users').'
895 895
             WHERE login = %s',
896 896
             $post_login
897 897
         );
898 898
     } else {
899 899
         $data = DB::queryfirstrow(
900 900
             'SELECT id, login, email, pw
901
-            FROM ' . prefixTable('users') . '
901
+            FROM ' . prefixTable('users').'
902 902
             WHERE id = %i',
903 903
             $post_id
904 904
         );
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
     $counter = DB::count();
909 909
 
910 910
     // load passwordLib library
911
-    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
911
+    $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
912 912
     $pwdlib->register();
913 913
     $pwdlib = new PasswordLib\PasswordLib();
914 914
 
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
     }
958 958
     
959 959
     // generate new GA user code
960
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
960
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php';
961 961
     $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']);
962 962
     $gaSecretKey = $tfa->createSecret();
963 963
     $gaTemporaryCode = GenerateCryptKey(12, false, true, true, false, true, $SETTINGS);
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
                 'email' => $data['email'],
998 998
                 'email_result' => str_replace(
999 999
                     '#email#',
1000
-                    '<b>' . obfuscateEmail($data['email']) . '</b>',
1000
+                    '<b>'.obfuscateEmail($data['email']).'</b>',
1001 1001
                     addslashes(langHdl('admin_email_result_ok'))
1002 1002
                 ),
1003 1003
             ),
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
             'email' => $data['email'],
1015 1015
             'email_result' => str_replace(
1016 1016
                 '#email#',
1017
-                '<b>' . obfuscateEmail($data['email']) . '</b>',
1017
+                '<b>'.obfuscateEmail($data['email']).'</b>',
1018 1018
                 addslashes(langHdl('admin_email_result_ok'))
1019 1019
             ),
1020 1020
         ),
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 {
1029 1029
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
1030 1030
         $row = DB::queryFirstRow(
1031
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1031
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1032 1032
             'cron',
1033 1033
             'sending_emails'
1034 1034
         );
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1037 1037
             $rows = DB::query(
1038 1038
                 'SELECT *
1039
-                FROM ' . prefixTable('emails') .
1039
+                FROM ' . prefixTable('emails').
1040 1040
                 ' WHERE status != %s',
1041 1041
                 'sent'
1042 1042
             );
@@ -1141,8 +1141,8 @@  discard block
 block discarded – undo
1141 1141
     $arr_html = array();
1142 1142
     $rows = DB::query(
1143 1143
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
1144
-        FROM ' . prefixTable('log_items') . ' AS l
1145
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1144
+        FROM ' . prefixTable('log_items').' AS l
1145
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1146 1146
         WHERE l.action = %s AND l.id_user = %i
1147 1147
         ORDER BY l.date DESC
1148 1148
         LIMIT 0, 100',
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1175 1175
         && ((int) $_SESSION['user_admin'] === 1 || (int) $_SESSION['user_manager'] === 1)
1176 1176
     ) {
1177
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1177
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1178 1178
         $nb_suggestions_waiting = DB::count();
1179 1179
     }
1180 1180
 
@@ -1208,13 +1208,13 @@  discard block
 block discarded – undo
1208 1208
             if ($data === 'stat_languages') {
1209 1209
                 $tmp = '';
1210 1210
                 foreach ($stats_data[$data] as $key => $value) {
1211
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1211
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1212 1212
                 }
1213 1213
                 $statsToSend[$data] = $tmp;
1214 1214
             } elseif ($data === 'stat_country') {
1215 1215
                 $tmp = '';
1216 1216
                 foreach ($stats_data[$data] as $key => $value) {
1217
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1217
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1218 1218
                 }
1219 1219
                 $statsToSend[$data] = $tmp;
1220 1220
             } else {
@@ -1300,8 +1300,8 @@  discard block
 block discarded – undo
1300 1300
                 $url_found = substr($line, 19, strlen($line) - 22);
1301 1301
                 if (empty($url_found) === false) {
1302 1302
                     $tmp = parse_url($url_found);
1303
-                    $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : '');
1304
-                    $line = "'cpassman_url' => '" . $anonym_url . "\n";
1303
+                    $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : '');
1304
+                    $line = "'cpassman_url' => '".$anonym_url."\n";
1305 1305
                 } else {
1306 1306
                     $line = "'cpassman_url' => \n";
1307 1307
                 }
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
     $teampass_errors = '';
1332 1332
     $rows = DB::query(
1333 1333
         'SELECT label, date AS error_date
1334
-        FROM ' . prefixTable('log_system') . "
1334
+        FROM ' . prefixTable('log_system')."
1335 1335
         WHERE `type` LIKE 'error'
1336 1336
         ORDER BY `date` DESC
1337 1337
         LIMIT 0, 10"
@@ -1339,9 +1339,9 @@  discard block
 block discarded – undo
1339 1339
     if (DB::count() > 0) {
1340 1340
         foreach ($rows as $record) {
1341 1341
             if (empty($teampass_errors) === true) {
1342
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1342
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1343 1343
             } else {
1344
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1344
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1345 1345
             }
1346 1346
         }
1347 1347
     }
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 
1351 1351
     // Now prepare text
1352 1352
     $txt = '### Page on which it happened
1353
-' . $data['current_page'] . '
1353
+' . $data['current_page'].'
1354 1354
 
1355 1355
 ### Steps to reproduce
1356 1356
 1.
@@ -1365,39 +1365,39 @@  discard block
 block discarded – undo
1365 1365
 Tell us what happens instead
1366 1366
 
1367 1367
 ### Server configuration
1368
-**Operating system**: ' . php_uname() . '
1368
+**Operating system**: ' . php_uname().'
1369 1369
 
1370
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1370
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1371 1371
 
1372
-**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)) . '
1372
+**Database:** ' . ($link === false ? langHdl('undefined') : mysqli_get_server_info($link)).'
1373 1373
 
1374
-**PHP version:** ' . PHP_VERSION . '
1374
+**PHP version:** ' . PHP_VERSION.'
1375 1375
 
1376
-**Teampass version:** ' . TP_VERSION_FULL . '
1376
+**Teampass version:** ' . TP_VERSION_FULL.'
1377 1377
 
1378 1378
 **Teampass configuration file:**
1379 1379
 ```
1380
-' . $list_of_options . '
1380
+' . $list_of_options.'
1381 1381
 ```
1382 1382
 
1383 1383
 **Updated from an older Teampass or fresh install:**
1384 1384
 
1385 1385
 ### Client configuration
1386 1386
 
1387
-**Browser:** ' . $data['browser_name'] . ' - ' . $data['browser_version'] . '
1387
+**Browser:** ' . $data['browser_name'].' - '.$data['browser_version'].'
1388 1388
 
1389
-**Operating system:** ' . $data['os'] . ' - ' . $data['os_archi'] . 'bits
1389
+**Operating system:** ' . $data['os'].' - '.$data['os_archi'].'bits
1390 1390
 
1391 1391
 ### Logs
1392 1392
 
1393 1393
 #### Web server error log
1394 1394
 ```
1395
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1395
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1396 1396
 ```
1397 1397
 
1398 1398
 #### Teampass 10 last system errors
1399 1399
 ```
1400
-' . $teampass_errors . '
1400
+' . $teampass_errors.'
1401 1401
 ```
1402 1402
 
1403 1403
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
         // Check if user exists
1435 1435
         $userInfo = DB::queryFirstRow(
1436 1436
             'SELECT public_key, private_key, pw, auth_type
1437
-            FROM ' . prefixTable('users') . '
1437
+            FROM ' . prefixTable('users').'
1438 1438
             WHERE id = %i',
1439 1439
             $post_user_id
1440 1440
         );
@@ -1443,9 +1443,9 @@  discard block
 block discarded – undo
1443 1443
             // Get one item
1444 1444
             $currentUserKey = DB::queryFirstRow(
1445 1445
                 'SELECT object_id, share_key, increment_id
1446
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
1447
-                INNER JOIN ' . prefixTable('items') . ' AS i ON  (i.id = si.object_id)
1448
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON  (i.id_tree = nt.id)
1446
+                FROM ' . prefixTable('sharekeys_items').' AS si
1447
+                INNER JOIN ' . prefixTable('items').' AS i ON  (i.id = si.object_id)
1448
+                INNER JOIN ' . prefixTable('nested_tree').' AS nt ON  (i.id_tree = nt.id)
1449 1449
                 WHERE user_id = %i AND nt.personal_folder = %i',
1450 1450
                 $post_user_id,
1451 1451
                 0
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
             
1490 1490
             // Use the password check
1491 1491
             // load passwordLib library
1492
-            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1492
+            $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries');
1493 1493
             $pwdlib->register();
1494 1494
             $pwdlib = new PasswordLib\PasswordLib();
1495 1495
             
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
         // Get user info
1551 1551
         $userData = DB::queryFirstRow(
1552 1552
             'SELECT private_key
1553
-            FROM ' . prefixTable('users') . '
1553
+            FROM ' . prefixTable('users').'
1554 1554
             WHERE id = %i',
1555 1555
             $post_user_id
1556 1556
         );
@@ -1577,7 +1577,7 @@  discard block
 block discarded – undo
1577 1577
             );
1578 1578
 
1579 1579
             // Load superGlobals
1580
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1580
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1581 1581
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
1582 1582
 
1583 1583
             $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
         // Get user info
1618 1618
         $userData = DB::queryFirstRow(
1619 1619
             'SELECT email, auth_type, login
1620
-            FROM ' . prefixTable('users') . '
1620
+            FROM ' . prefixTable('users').'
1621 1621
             WHERE id = %i',
1622 1622
             $post_user_id
1623 1623
         );
@@ -1767,7 +1767,7 @@  discard block
 block discarded – undo
1767 1767
         // Get user info
1768 1768
         $userData = DB::queryFirstRow(
1769 1769
             'SELECT email, auth_type, login
1770
-            FROM ' . prefixTable('users') . '
1770
+            FROM ' . prefixTable('users').'
1771 1771
             WHERE id = %i',
1772 1772
             $post_user_id
1773 1773
         );
@@ -1832,13 +1832,13 @@  discard block
 block discarded – undo
1832 1832
         // Check if user exists
1833 1833
         DB::queryFirstRow(
1834 1834
             'SELECT *
1835
-            FROM ' . prefixTable('users') . '
1835
+            FROM ' . prefixTable('users').'
1836 1836
             WHERE id = %i',
1837 1837
             $post_user_id
1838 1838
         );
1839 1839
         if (DB::count() > 0) {
1840 1840
             // Include libraries
1841
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1841
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1842 1842
 
1843 1843
             // CLear old sharekeys
1844 1844
             if ($post_self_change === false) {
@@ -1904,13 +1904,13 @@  discard block
 block discarded – undo
1904 1904
         // Check if user exists
1905 1905
         $userInfo = DB::queryFirstRow(
1906 1906
             'SELECT public_key
1907
-            FROM ' . prefixTable('users') . '
1907
+            FROM ' . prefixTable('users').'
1908 1908
             WHERE id = %i',
1909 1909
             $post_user_id
1910 1910
         );
1911 1911
         if (isset($userInfo['public_key']) === true) {
1912 1912
             // Include libraries
1913
-            include_once $SETTINGS['cpassman_dir'] . '/sources/aes.functions.php';
1913
+            include_once $SETTINGS['cpassman_dir'].'/sources/aes.functions.php';
1914 1914
             $return = [];
1915 1915
 
1916 1916
             // WHAT STEP TO PERFORM?
@@ -2056,15 +2056,15 @@  discard block
 block discarded – undo
2056 2056
     // Loop on items
2057 2057
     $rows = DB::query(
2058 2058
         'SELECT id, pw
2059
-        FROM ' . prefixTable('items') . '
2059
+        FROM ' . prefixTable('items').'
2060 2060
         WHERE perso = 0
2061
-        LIMIT ' . $post_start . ', ' . $post_length
2061
+        LIMIT ' . $post_start.', '.$post_length
2062 2062
     );
2063 2063
     foreach ($rows as $record) {
2064 2064
         // Get itemKey from current user
2065 2065
         $currentUserKey = DB::queryFirstRow(
2066 2066
             'SELECT share_key, increment_id
2067
-            FROM ' . prefixTable('sharekeys_items') . '
2067
+            FROM ' . prefixTable('sharekeys_items').'
2068 2068
             WHERE object_id = %i AND user_id = %i',
2069 2069
             $record['id'],
2070 2070
             $_SESSION['user_id']
@@ -2092,7 +2092,7 @@  discard block
 block discarded – undo
2092 2092
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2093 2093
                 $currentUserKey = DB::queryFirstRow(
2094 2094
                     'SELECT increment_id
2095
-                    FROM ' . prefixTable('sharekeys_items') . '
2095
+                    FROM ' . prefixTable('sharekeys_items').'
2096 2096
                     WHERE object_id = %i AND user_id = %i',
2097 2097
                     $record['id'],
2098 2098
                     $post_user_id
@@ -2125,7 +2125,7 @@  discard block
 block discarded – undo
2125 2125
     // SHould we change step?
2126 2126
     DB::query(
2127 2127
         'SELECT *
2128
-        FROM ' . prefixTable('items') . '
2128
+        FROM ' . prefixTable('items').'
2129 2129
         WHERE perso = 0'
2130 2130
     );
2131 2131
 
@@ -2149,15 +2149,15 @@  discard block
 block discarded – undo
2149 2149
     // Loop on logs
2150 2150
     $rows = DB::query(
2151 2151
         'SELECT increment_id
2152
-        FROM ' . prefixTable('log_items') . '
2152
+        FROM ' . prefixTable('log_items').'
2153 2153
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2154
-        LIMIT ' . $post_start . ', ' . $post_length
2154
+        LIMIT ' . $post_start.', '.$post_length
2155 2155
     );
2156 2156
     foreach ($rows as $record) {
2157 2157
         // Get itemKey from current user
2158 2158
         $currentUserKey = DB::queryFirstRow(
2159 2159
             'SELECT share_key
2160
-            FROM ' . prefixTable('sharekeys_logs') . '
2160
+            FROM ' . prefixTable('sharekeys_logs').'
2161 2161
             WHERE object_id = %i AND user_id = %i',
2162 2162
             $record['increment_id'],
2163 2163
             $_SESSION['user_id']
@@ -2184,7 +2184,7 @@  discard block
 block discarded – undo
2184 2184
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2185 2185
                 $currentUserKey = DB::queryFirstRow(
2186 2186
                     'SELECT increment_id
2187
-                    FROM ' . prefixTable('sharekeys_items') . '
2187
+                    FROM ' . prefixTable('sharekeys_items').'
2188 2188
                     WHERE object_id = %i AND user_id = %i',
2189 2189
                     $record['id'],
2190 2190
                     $post_user_id
@@ -2206,7 +2206,7 @@  discard block
 block discarded – undo
2206 2206
     // SHould we change step?
2207 2207
     DB::query(
2208 2208
         'SELECT increment_id
2209
-        FROM ' . prefixTable('log_items') . '
2209
+        FROM ' . prefixTable('log_items').'
2210 2210
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2211 2211
     );
2212 2212
 
@@ -2230,15 +2230,15 @@  discard block
 block discarded – undo
2230 2230
     // Loop on fields
2231 2231
     $rows = DB::query(
2232 2232
         'SELECT id
2233
-        FROM ' . prefixTable('categories_items') . '
2233
+        FROM ' . prefixTable('categories_items').'
2234 2234
         WHERE encryption_type = "teampass_aes"
2235
-        LIMIT ' . $post_start . ', ' . $post_length
2235
+        LIMIT ' . $post_start.', '.$post_length
2236 2236
     );
2237 2237
     foreach ($rows as $record) {
2238 2238
         // Get itemKey from current user
2239 2239
         $currentUserKey = DB::queryFirstRow(
2240 2240
             'SELECT share_key
2241
-            FROM ' . prefixTable('sharekeys_fields') . '
2241
+            FROM ' . prefixTable('sharekeys_fields').'
2242 2242
             WHERE object_id = %i AND user_id = %i',
2243 2243
             $record['id'],
2244 2244
             $_SESSION['user_id']
@@ -2265,7 +2265,7 @@  discard block
 block discarded – undo
2265 2265
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2266 2266
                 $currentUserKey = DB::queryFirstRow(
2267 2267
                     'SELECT increment_id
2268
-                    FROM ' . prefixTable('sharekeys_items') . '
2268
+                    FROM ' . prefixTable('sharekeys_items').'
2269 2269
                     WHERE object_id = %i AND user_id = %i',
2270 2270
                     $record['id'],
2271 2271
                     $post_user_id
@@ -2287,7 +2287,7 @@  discard block
 block discarded – undo
2287 2287
     // SHould we change step?
2288 2288
     DB::query(
2289 2289
         'SELECT *
2290
-        FROM ' . prefixTable('categories_items') . '
2290
+        FROM ' . prefixTable('categories_items').'
2291 2291
         WHERE encryption_type = "teampass_aes"'
2292 2292
     );
2293 2293
 
@@ -2311,14 +2311,14 @@  discard block
 block discarded – undo
2311 2311
     // Loop on suggestions
2312 2312
     $rows = DB::query(
2313 2313
         'SELECT id
2314
-        FROM ' . prefixTable('suggestion') . '
2315
-        LIMIT ' . $post_start . ', ' . $post_length
2314
+        FROM ' . prefixTable('suggestion').'
2315
+        LIMIT ' . $post_start.', '.$post_length
2316 2316
     );
2317 2317
     foreach ($rows as $record) {
2318 2318
         // Get itemKey from current user
2319 2319
         $currentUserKey = DB::queryFirstRow(
2320 2320
             'SELECT share_key
2321
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2321
+            FROM ' . prefixTable('sharekeys_suggestions').'
2322 2322
             WHERE object_id = %i AND user_id = %i',
2323 2323
             $record['id'],
2324 2324
             $_SESSION['user_id']
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2346 2346
                 $currentUserKey = DB::queryFirstRow(
2347 2347
                     'SELECT increment_id
2348
-                    FROM ' . prefixTable('sharekeys_items') . '
2348
+                    FROM ' . prefixTable('sharekeys_items').'
2349 2349
                     WHERE object_id = %i AND user_id = %i',
2350 2350
                     $record['id'],
2351 2351
                     $post_user_id
@@ -2390,15 +2390,15 @@  discard block
 block discarded – undo
2390 2390
     // Loop on files
2391 2391
     $rows = DB::query(
2392 2392
         'SELECT id
2393
-        FROM ' . prefixTable('files') . '
2394
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2395
-        LIMIT ' . $post_start . ', ' . $post_length
2393
+        FROM ' . prefixTable('files').'
2394
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2395
+        LIMIT ' . $post_start.', '.$post_length
2396 2396
     ); //aes_encryption
2397 2397
     foreach ($rows as $record) {
2398 2398
         // Get itemKey from current user
2399 2399
         $currentUserKey = DB::queryFirstRow(
2400 2400
             'SELECT share_key
2401
-            FROM ' . prefixTable('sharekeys_files') . '
2401
+            FROM ' . prefixTable('sharekeys_files').'
2402 2402
             WHERE object_id = %i AND user_id = %i',
2403 2403
             $record['id'],
2404 2404
             $_SESSION['user_id']
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
             if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2426 2426
                 $currentUserKey = DB::queryFirstRow(
2427 2427
                     'SELECT increment_id
2428
-                    FROM ' . prefixTable('sharekeys_items') . '
2428
+                    FROM ' . prefixTable('sharekeys_items').'
2429 2429
                     WHERE object_id = %i AND user_id = %i',
2430 2430
                     $record['id'],
2431 2431
                     $post_user_id
@@ -2447,8 +2447,8 @@  discard block
 block discarded – undo
2447 2447
     // SHould we change step?
2448 2448
     DB::query(
2449 2449
         'SELECT *
2450
-        FROM ' . prefixTable('files') . '
2451
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2450
+        FROM ' . prefixTable('files').'
2451
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2452 2452
     );
2453 2453
 
2454 2454
     $next_start = (int) $post_start + (int) $post_length;
@@ -2480,16 +2480,16 @@  discard block
 block discarded – undo
2480 2480
     if (count($_SESSION['personal_folders']) > 0) {
2481 2481
         $rows = DB::query(
2482 2482
             'SELECT id, pw
2483
-            FROM ' . prefixTable('items') . '
2483
+            FROM ' . prefixTable('items').'
2484 2484
             WHERE perso = 1 AND id_tree IN %ls
2485
-            LIMIT ' . $post_start . ', ' . $post_length,
2485
+            LIMIT ' . $post_start.', '.$post_length,
2486 2486
             $_SESSION['personal_folders']
2487 2487
         );
2488 2488
         foreach ($rows as $record) {
2489 2489
             // Get itemKey from current user
2490 2490
             $currentUserKey = DB::queryFirstRow(
2491 2491
                 'SELECT share_key, increment_id
2492
-                FROM ' . prefixTable('sharekeys_items') . '
2492
+                FROM ' . prefixTable('sharekeys_items').'
2493 2493
                 WHERE object_id = %i AND user_id = %i',
2494 2494
                 $record['id'],
2495 2495
                 $_SESSION['user_id']
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
                 if ((int) $post_user_id !== (int) $_SESSION['user_id']) {
2517 2517
                     $currentUserKey = DB::queryFirstRow(
2518 2518
                         'SELECT increment_id
2519
-                        FROM ' . prefixTable('sharekeys_items') . '
2519
+                        FROM ' . prefixTable('sharekeys_items').'
2520 2520
                         WHERE object_id = %i AND user_id = %i',
2521 2521
                         $record['id'],
2522 2522
                         $post_user_id
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
     // SHould we change step?
2540 2540
     DB::query(
2541 2541
         'SELECT *
2542
-        FROM ' . prefixTable('items') . '
2542
+        FROM ' . prefixTable('items').'
2543 2543
         WHERE perso = 0'
2544 2544
     );
2545 2545
 
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
         // Check if user exists
2564 2564
         $userInfo = DB::queryFirstRow(
2565 2565
             'SELECT public_key, encrypted_psk
2566
-            FROM ' . prefixTable('users') . '
2566
+            FROM ' . prefixTable('users').'
2567 2567
             WHERE id = %i',
2568 2568
             $post_user_id
2569 2569
         );
@@ -2589,9 +2589,9 @@  discard block
 block discarded – undo
2589 2589
                 // Loop on persoanl items
2590 2590
                 $rows = DB::query(
2591 2591
                     'SELECT id, pw
2592
-                    FROM ' . prefixTable('items') . '
2592
+                    FROM ' . prefixTable('items').'
2593 2593
                     WHERE perso = 1 AND id_tree IN %ls
2594
-                    LIMIT ' . $post_start . ', ' . $post_length,
2594
+                    LIMIT ' . $post_start.', '.$post_length,
2595 2595
                     $_SESSION['personal_folders']
2596 2596
                 );
2597 2597
                 $countUserPersonalItems = DB::count();
@@ -2634,7 +2634,7 @@  discard block
 block discarded – undo
2634 2634
                         // Loop on files
2635 2635
                         $rows = DB::query(
2636 2636
                             'SELECT id, file
2637
-                            FROM ' . prefixTable('files') . '
2637
+                            FROM ' . prefixTable('files').'
2638 2638
                             WHERE status != %s
2639 2639
                             AND id_item = %i',
2640 2640
                             TP_ENCRYPTION_NAME,
@@ -2645,14 +2645,14 @@  discard block
 block discarded – undo
2645 2645
                             // Now decrypt the file
2646 2646
                             prepareFileWithDefuse(
2647 2647
                                 'decrypt',
2648
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2649
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2648
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2649
+                                $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2650 2650
                                 $SETTINGS,
2651 2651
                                 $post_user_psk
2652 2652
                             );
2653 2653
 
2654 2654
                             // Encrypt the file
2655
-                            $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2655
+                            $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2656 2656
 
2657 2657
                             DB::update(
2658 2658
                                 prefixTable('files'),
@@ -2675,7 +2675,7 @@  discard block
 block discarded – undo
2675 2675
                             );
2676 2676
 
2677 2677
                             // Unlink original file
2678
-                            unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2678
+                            unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2679 2679
                         }
2680 2680
                     }
2681 2681
                 }
@@ -2747,7 +2747,7 @@  discard block
 block discarded – undo
2747 2747
         // Get user info
2748 2748
         $userData = DB::queryFirstRow(
2749 2749
             'SELECT '.$post_fields.'
2750
-            FROM ' . prefixTable('users') . '
2750
+            FROM ' . prefixTable('users').'
2751 2751
             WHERE id = %i',
2752 2752
             $post_user_id
2753 2753
         );
@@ -2793,7 +2793,7 @@  discard block
 block discarded – undo
2793 2793
         // Get user info
2794 2794
         $userData = DB::queryFirstRow(
2795 2795
             'SELECT auth_type, login, private_key
2796
-            FROM ' . prefixTable('users') . '
2796
+            FROM ' . prefixTable('users').'
2797 2797
             WHERE id = %i',
2798 2798
             $post_user_id
2799 2799
         );
@@ -2815,7 +2815,7 @@  discard block
 block discarded – undo
2815 2815
             }
2816 2816
 
2817 2817
             // Load superGlobals
2818
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2818
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2819 2819
             $superGlobal = new protect\SuperGlobal\SuperGlobal();
2820 2820
 
2821 2821
             if ($superGlobal->get('private_key', 'SESSION', 'user') === $privateKey) {
@@ -2849,7 +2849,7 @@  discard block
 block discarded – undo
2849 2849
                     $SETTINGS['cpassman_dir'],
2850 2850
                     array(
2851 2851
                         'error' => false,
2852
-                        'message' => langHdl('done'),'',
2852
+                        'message' => langHdl('done'), '',
2853 2853
                     ),
2854 2854
                     'encode'
2855 2855
                 );
@@ -2889,7 +2889,7 @@  discard block
 block discarded – undo
2889 2889
         // Get user info
2890 2890
         $userData = DB::queryFirstRow(
2891 2891
             'SELECT auth_type, login, private_key, special
2892
-            FROM ' . prefixTable('users') . '
2892
+            FROM ' . prefixTable('users').'
2893 2893
             WHERE id = %i',
2894 2894
             $post_user_id
2895 2895
         );
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
                 );
2920 2920
 
2921 2921
                 // Load superGlobals
2922
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2922
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2923 2923
                 $superGlobal = new protect\SuperGlobal\SuperGlobal();
2924 2924
                 $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2925 2925
 
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
                     $SETTINGS['cpassman_dir'],
2928 2928
                     array(
2929 2929
                         'error' => false,
2930
-                        'message' => langHdl('done'),'',
2930
+                        'message' => langHdl('done'), '',
2931 2931
                     ),
2932 2932
                     'encode'
2933 2933
                 );
@@ -2952,14 +2952,14 @@  discard block
 block discarded – undo
2952 2952
             // Get one item
2953 2953
             $record = DB::queryFirstRow(
2954 2954
                 'SELECT id, pw
2955
-                FROM ' . prefixTable('items') . '
2955
+                FROM ' . prefixTable('items').'
2956 2956
                 WHERE perso = 0'
2957 2957
             );
2958 2958
 
2959 2959
             // Get itemKey from current user
2960 2960
             $currentUserKey = DB::queryFirstRow(
2961 2961
                 'SELECT share_key, increment_id
2962
-                FROM ' . prefixTable('sharekeys_items') . '
2962
+                FROM ' . prefixTable('sharekeys_items').'
2963 2963
                 WHERE object_id = %i AND user_id = %i',
2964 2964
                 $record['id'],
2965 2965
                 $post_user_id
@@ -2987,7 +2987,7 @@  discard block
 block discarded – undo
2987 2987
                     );
2988 2988
                     
2989 2989
                     // Load superGlobals
2990
-                    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2990
+                    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2991 2991
                     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2992 2992
                     $superGlobal->put('private_key', $privateKey, 'SESSION', 'user');
2993 2993
 
@@ -3044,7 +3044,7 @@  discard block
 block discarded – undo
3044 3044
             $_SESSION['user_id']
3045 3045
         );
3046 3046
         // Return data
3047
-        return '[{"new_value":"' . $_SESSION['sessionDuration'] . '"}]';
3047
+        return '[{"new_value":"'.$_SESSION['sessionDuration'].'"}]';
3048 3048
     }
3049 3049
     
3050 3050
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Spacing   +274 added lines, -276 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 // Load config if $SETTINGS not defined
36 36
 if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) {
37
-    include_once __DIR__ . '/../includes/config/tp.config.php';
37
+    include_once __DIR__.'/../includes/config/tp.config.php';
38 38
 }
39 39
 
40 40
 header('Content-type: text/html; charset=utf-8');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             and improve performance by avoiding to include the file for every missing strings.
73 73
         */
74 74
         if (isset($_SESSION['teampass']) === false || isset($_SESSION['teampass']['en_lang'][trim($string)]) === false) {
75
-            $_SESSION['teampass']['en_lang'] = include_once __DIR__. '/../includes/language/english.php';
75
+            $_SESSION['teampass']['en_lang'] = include_once __DIR__.'/../includes/language/english.php';
76 76
             $session_language = isset($_SESSION['teampass']['en_lang'][trim($string)]) === false ? '' : $_SESSION['teampass']['en_lang'][trim($string)];
77 77
         } else {
78 78
             $session_language = $_SESSION['teampass']['en_lang'][trim($string)];
@@ -125,25 +125,25 @@  discard block
 block discarded – undo
125 125
  */
126 126
 function cryption(string $message, string $ascii_key, string $type, ?array $SETTINGS = []): array
127 127
 {
128
-    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key;
128
+    $ascii_key = empty($ascii_key) === true ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key;
129 129
     $err = false;
130 130
     
131 131
     $path = __DIR__.'/../includes/libraries/Encryption/Encryption/';
132 132
 
133
-    include_once $path . 'Exception/CryptoException.php';
134
-    include_once $path . 'Exception/BadFormatException.php';
135
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
136
-    include_once $path . 'Exception/IOException.php';
137
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
138
-    include_once $path . 'Crypto.php';
139
-    include_once $path . 'Encoding.php';
140
-    include_once $path . 'DerivedKeys.php';
141
-    include_once $path . 'Key.php';
142
-    include_once $path . 'KeyOrPassword.php';
143
-    include_once $path . 'File.php';
144
-    include_once $path . 'RuntimeTests.php';
145
-    include_once $path . 'KeyProtectedByPassword.php';
146
-    include_once $path . 'Core.php';
133
+    include_once $path.'Exception/CryptoException.php';
134
+    include_once $path.'Exception/BadFormatException.php';
135
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
136
+    include_once $path.'Exception/IOException.php';
137
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
138
+    include_once $path.'Crypto.php';
139
+    include_once $path.'Encoding.php';
140
+    include_once $path.'DerivedKeys.php';
141
+    include_once $path.'Key.php';
142
+    include_once $path.'KeyOrPassword.php';
143
+    include_once $path.'File.php';
144
+    include_once $path.'RuntimeTests.php';
145
+    include_once $path.'KeyProtectedByPassword.php';
146
+    include_once $path.'Core.php';
147 147
     
148 148
     // convert KEY
149 149
     $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
         $path = '../includes/libraries/Encryption/Encryption/';
189 189
     }
190 190
 
191
-    include_once $path . 'Exception/CryptoException.php';
192
-    include_once $path . 'Exception/BadFormatException.php';
193
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
194
-    include_once $path . 'Exception/IOException.php';
195
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
196
-    include_once $path . 'Crypto.php';
197
-    include_once $path . 'Encoding.php';
198
-    include_once $path . 'DerivedKeys.php';
199
-    include_once $path . 'Key.php';
200
-    include_once $path . 'KeyOrPassword.php';
201
-    include_once $path . 'File.php';
202
-    include_once $path . 'RuntimeTests.php';
203
-    include_once $path . 'KeyProtectedByPassword.php';
204
-    include_once $path . 'Core.php';
191
+    include_once $path.'Exception/CryptoException.php';
192
+    include_once $path.'Exception/BadFormatException.php';
193
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
194
+    include_once $path.'Exception/IOException.php';
195
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
196
+    include_once $path.'Crypto.php';
197
+    include_once $path.'Encoding.php';
198
+    include_once $path.'DerivedKeys.php';
199
+    include_once $path.'Key.php';
200
+    include_once $path.'KeyOrPassword.php';
201
+    include_once $path.'File.php';
202
+    include_once $path.'RuntimeTests.php';
203
+    include_once $path.'KeyProtectedByPassword.php';
204
+    include_once $path.'Core.php';
205 205
 
206 206
     $key = \Defuse\Crypto\Key::createNewRandomKey();
207 207
     $key = $key->saveToAsciiSafeString();
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
         $path = '../includes/libraries/Encryption/Encryption/';
227 227
     }
228 228
 
229
-    include_once $path . 'Exception/CryptoException.php';
230
-    include_once $path . 'Exception/BadFormatException.php';
231
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
232
-    include_once $path . 'Exception/IOException.php';
233
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
234
-    include_once $path . 'Crypto.php';
235
-    include_once $path . 'Encoding.php';
236
-    include_once $path . 'DerivedKeys.php';
237
-    include_once $path . 'Key.php';
238
-    include_once $path . 'KeyOrPassword.php';
239
-    include_once $path . 'File.php';
240
-    include_once $path . 'RuntimeTests.php';
241
-    include_once $path . 'KeyProtectedByPassword.php';
242
-    include_once $path . 'Core.php';
229
+    include_once $path.'Exception/CryptoException.php';
230
+    include_once $path.'Exception/BadFormatException.php';
231
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
232
+    include_once $path.'Exception/IOException.php';
233
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
234
+    include_once $path.'Crypto.php';
235
+    include_once $path.'Encoding.php';
236
+    include_once $path.'DerivedKeys.php';
237
+    include_once $path.'Key.php';
238
+    include_once $path.'KeyOrPassword.php';
239
+    include_once $path.'File.php';
240
+    include_once $path.'RuntimeTests.php';
241
+    include_once $path.'KeyProtectedByPassword.php';
242
+    include_once $path.'Core.php';
243 243
     
244 244
     $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk);
245 245
     return $protected_key->saveToAsciiSafeString(); // save this in user table
@@ -264,20 +264,20 @@  discard block
 block discarded – undo
264 264
         $path = '../includes/libraries/Encryption/Encryption/';
265 265
     }
266 266
 
267
-    include_once $path . 'Exception/CryptoException.php';
268
-    include_once $path . 'Exception/BadFormatException.php';
269
-    include_once $path . 'Exception/EnvironmentIsBrokenException.php';
270
-    include_once $path . 'Exception/IOException.php';
271
-    include_once $path . 'Exception/WrongKeyOrModifiedCiphertextException.php';
272
-    include_once $path . 'Crypto.php';
273
-    include_once $path . 'Encoding.php';
274
-    include_once $path . 'DerivedKeys.php';
275
-    include_once $path . 'Key.php';
276
-    include_once $path . 'KeyOrPassword.php';
277
-    include_once $path . 'File.php';
278
-    include_once $path . 'RuntimeTests.php';
279
-    include_once $path . 'KeyProtectedByPassword.php';
280
-    include_once $path . 'Core.php';
267
+    include_once $path.'Exception/CryptoException.php';
268
+    include_once $path.'Exception/BadFormatException.php';
269
+    include_once $path.'Exception/EnvironmentIsBrokenException.php';
270
+    include_once $path.'Exception/IOException.php';
271
+    include_once $path.'Exception/WrongKeyOrModifiedCiphertextException.php';
272
+    include_once $path.'Crypto.php';
273
+    include_once $path.'Encoding.php';
274
+    include_once $path.'DerivedKeys.php';
275
+    include_once $path.'Key.php';
276
+    include_once $path.'KeyOrPassword.php';
277
+    include_once $path.'File.php';
278
+    include_once $path.'RuntimeTests.php';
279
+    include_once $path.'KeyProtectedByPassword.php';
280
+    include_once $path.'Core.php';
281 281
 
282 282
     try {
283 283
         $protected_key_encoded = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
  */
320 320
 function trimElement($chaine, string $element): string
321 321
 {
322
-    if (! empty($chaine)) {
322
+    if (!empty($chaine)) {
323 323
         if (is_array($chaine) === true) {
324 324
             $chaine = implode(';', $chaine);
325 325
         }
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
  */
368 368
 function db_error_handler(array $params): void
369 369
 {
370
-    echo 'Error: ' . $params['error'] . "<br>\n";
371
-    echo 'Query: ' . $params['query'] . "<br>\n";
370
+    echo 'Error: '.$params['error']."<br>\n";
371
+    echo 'Query: '.$params['query']."<br>\n";
372 372
     throw new Exception('Error - Query', 1);
373 373
 }
374 374
 
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
     $SETTINGS
391 391
 ) {
392 392
     //load ClassLoader
393
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
393
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
394 394
     // Load superglobal
395
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
395
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
396 396
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
397 397
     //Connect to DB
398
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
398
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
399 399
     if (defined('DB_PASSWD_CLEAR') === false) {
400 400
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
401 401
     }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     DB::$ssl = DB_SSL;
409 409
     DB::$connect_options = DB_CONNECT_OPTIONS;
410 410
     //Build tree
411
-    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
411
+    $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
412 412
     $tree->register();
413 413
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
414 414
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 function identAdmin($idFonctions, $SETTINGS, $tree)
454 454
 {
455 455
     // Load superglobal
456
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
456
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
457 457
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
458 458
     // Init
459 459
     $groupesVisibles = [];
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
     $globalsVisibleFolders = $superGlobal->get('groupes_visibles', 'SESSION');
473 473
     $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION');
474 474
     // Get list of Folders
475
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
475
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
476 476
     foreach ($rows as $record) {
477 477
         array_push($groupesVisibles, $record['id']);
478 478
     }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     }
492 492
     // Get ID of personal folder
493 493
     $persfld = DB::queryfirstrow(
494
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s',
494
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s',
495 495
         $globalsUserId
496 496
     );
497 497
     if (empty($persfld['id']) === false) {
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
     // get complete list of ROLES
513 513
     $tmp = explode(';', $idFonctions);
514 514
     $rows = DB::query(
515
-        'SELECT * FROM ' . prefixTable('roles_title') . '
515
+        'SELECT * FROM '.prefixTable('roles_title').'
516 516
         ORDER BY title ASC'
517 517
     );
518 518
     foreach ($rows as $record) {
519
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
519
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
520 520
             array_push($tmp, $record['id']);
521 521
         }
522 522
     }
523 523
     $superGlobal->put('fonction_id', implode(';', $tmp), 'SESSION');
524 524
     $superGlobal->put('is_admin', 1, 'SESSION');
525 525
     // Check if admin has created Folders and Roles
526
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
526
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
527 527
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
528
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
528
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
529 529
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
530 530
 
531 531
     return true;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
     object $tree
572 572
 ) {
573 573
     // Load superglobal
574
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
574
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
575 575
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
576 576
     // Init
577 577
     $superGlobal->put('groupes_visibles', [], 'SESSION');
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
     // Does this user is allowed to see other items
611 611
     $inc = 0;
612 612
     $rows = DB::query(
613
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
613
+        'SELECT id, id_tree FROM '.prefixTable('items').'
614 614
             WHERE restricted_to LIKE %ss AND inactif = %s'.
615 615
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
616
-        $globalsUserId . ';',
616
+        $globalsUserId.';',
617 617
         '0'
618 618
     );
619 619
     foreach ($rows as $record) {
@@ -627,8 +627,8 @@  discard block
 block discarded – undo
627 627
     // Check for the users roles if some specific rights exist on items
628 628
     $rows = DB::query(
629 629
         'SELECT i.id_tree, r.item_id
630
-        FROM ' . prefixTable('items') . ' as i
631
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
630
+        FROM ' . prefixTable('items').' as i
631
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
632 632
         WHERE r.role_id IN %li AND i.id_tree <> ""
633 633
         ORDER BY i.id_tree ASC',
634 634
         $userRoles
@@ -682,16 +682,16 @@  discard block
 block discarded – undo
682 682
         'SESSION'
683 683
     );
684 684
     // Folders and Roles numbers
685
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
685
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
686 686
     $superGlobal->put('nb_folders', DB::count(), 'SESSION');
687
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
687
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
688 688
     $superGlobal->put('nb_roles', DB::count(), 'SESSION');
689 689
     // check if change proposals on User's items
690 690
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
691 691
         $countNewItems = DB::query(
692 692
             'SELECT COUNT(*)
693
-            FROM ' . prefixTable('items_change') . ' AS c
694
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
693
+            FROM ' . prefixTable('items_change').' AS c
694
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
695 695
             WHERE i.action = %s AND i.id_user = %i',
696 696
             'at_creation',
697 697
             $globalsUserId
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 {
719 719
     $rows = DB::query(
720 720
         'SELECT *
721
-        FROM ' . prefixTable('roles_values') . '
721
+        FROM ' . prefixTable('roles_values').'
722 722
         WHERE role_id IN %li AND type IN %ls',
723 723
         $userRoles,
724 724
         ['W', 'ND', 'NE', 'NDNE', 'R']
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
     ) {
786 786
         $persoFld = DB::queryfirstrow(
787 787
             'SELECT id
788
-            FROM ' . prefixTable('nested_tree') . '
788
+            FROM ' . prefixTable('nested_tree').'
789 789
             WHERE title = %s AND personal_folder = %i'.
790 790
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
791 791
             $globalsUserId,
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
     }
819 819
     $persoFlds = DB::query(
820 820
         'SELECT id
821
-        FROM ' . prefixTable('nested_tree') . '
821
+        FROM ' . prefixTable('nested_tree').'
822 822
         WHERE %l',
823 823
         $where
824 824
     );
@@ -882,9 +882,9 @@  discard block
 block discarded – undo
882 882
  */
883 883
 function cacheTableRefresh(array $SETTINGS): void
884 884
 {
885
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
885
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
886 886
     //Connect to DB
887
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
887
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
888 888
     if (defined('DB_PASSWD_CLEAR') === false) {
889 889
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
890 890
     }
@@ -901,12 +901,12 @@  discard block
 block discarded – undo
901 901
     $tree->register();
902 902
     $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
903 903
     // truncate table
904
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
904
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
905 905
     // reload date
906 906
     $rows = DB::query(
907 907
         'SELECT *
908
-        FROM ' . prefixTable('items') . ' as i
909
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
908
+        FROM ' . prefixTable('items').' as i
909
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
910 910
         AND l.action = %s
911 911
         AND i.inactif = %i',
912 912
         'at_creation',
@@ -918,18 +918,18 @@  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
                 $record['id']
924 924
             );
925 925
             foreach ($itemTags as $itemTag) {
926
-                $tags .= $itemTag['tag'] . ' ';
926
+                $tags .= $itemTag['tag'].' ';
927 927
             }
928 928
 
929 929
             // Get renewal period
930 930
             $resNT = DB::queryfirstrow(
931 931
                 'SELECT renewal_period
932
-                FROM ' . prefixTable('nested_tree') . '
932
+                FROM ' . prefixTable('nested_tree').'
933 933
                 WHERE id = %i',
934 934
                 $record['id_tree']
935 935
             );
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
                     // Is this a User id?
943 943
                     $user = DB::queryfirstrow(
944 944
                         'SELECT id, login
945
-                        FROM ' . prefixTable('users') . '
945
+                        FROM ' . prefixTable('users').'
946 946
                         WHERE id = %i',
947 947
                         $elem->title
948 948
                     );
@@ -960,11 +960,11 @@  discard block
 block discarded – undo
960 960
                     'id' => $record['id'],
961 961
                     'label' => $record['label'],
962 962
                     'description' => $record['description'] ?? '',
963
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
963
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
964 964
                     'tags' => $tags,
965 965
                     'id_tree' => $record['id_tree'],
966 966
                     'perso' => $record['perso'],
967
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
967
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
968 968
                     'login' => $record['login'] ?? '',
969 969
                     'folder' => implode(' > ', $folder),
970 970
                     'author' => $record['id_user'],
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
  */
987 987
 function cacheTableUpdate(array $SETTINGS, ?int $ident = null): void
988 988
 {
989
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
989
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
990 990
     // Load superglobal
991
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
991
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
992 992
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
993 993
     //Connect to DB
994
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
994
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
995 995
     if (defined('DB_PASSWD_CLEAR') === false) {
996 996
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
997 997
     }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
     // get new value from db
1011 1011
     $data = DB::queryfirstrow(
1012 1012
         'SELECT label, description, id_tree, perso, restricted_to, login, url
1013
-        FROM ' . prefixTable('items') . '
1013
+        FROM ' . prefixTable('items').'
1014 1014
         WHERE id=%i',
1015 1015
         $ident
1016 1016
     );
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
     $tags = '';
1019 1019
     $itemTags = DB::query(
1020 1020
         'SELECT tag
1021
-            FROM ' . prefixTable('tags') . '
1021
+            FROM ' . prefixTable('tags').'
1022 1022
             WHERE item_id = %i AND tag != ""',
1023 1023
         $ident
1024 1024
     );
1025 1025
     foreach ($itemTags as $itemTag) {
1026
-        $tags .= $itemTag['tag'] . ' ';
1026
+        $tags .= $itemTag['tag'].' ';
1027 1027
     }
1028 1028
     // form id_tree to full foldername
1029 1029
     $folder = [];
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
             // Is this a User id?
1035 1035
             $user = DB::queryfirstrow(
1036 1036
                 'SELECT id, login
1037
-                FROM ' . prefixTable('users') . '
1037
+                FROM ' . prefixTable('users').'
1038 1038
                 WHERE id = %i',
1039 1039
                 $elem->title
1040 1040
             );
@@ -1052,10 +1052,10 @@  discard block
 block discarded – undo
1052 1052
             'label' => $data['label'],
1053 1053
             'description' => $data['description'],
1054 1054
             'tags' => $tags,
1055
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1055
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1056 1056
             'id_tree' => $data['id_tree'],
1057 1057
             'perso' => $data['perso'],
1058
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1058
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
1059 1059
             'login' => $data['login'] ?? '',
1060 1060
             'folder' => implode(' » ', $folder),
1061 1061
             'author' => $superGlobal->get('user_id', 'SESSION'),
@@ -1075,14 +1075,14 @@  discard block
 block discarded – undo
1075 1075
  */
1076 1076
 function cacheTableAdd(array $SETTINGS, ?int $ident = null): void
1077 1077
 {
1078
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1078
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1079 1079
     // Load superglobal
1080
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1080
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1081 1081
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1082 1082
     // Get superglobals
1083 1083
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
1084 1084
     //Connect to DB
1085
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1085
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1086 1086
     if (defined('DB_PASSWD_CLEAR') === false) {
1087 1087
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1088 1088
     }
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
     // get new value from db
1102 1102
     $data = DB::queryFirstRow(
1103 1103
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
1104
-        FROM ' . prefixTable('items') . ' as i
1105
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
1104
+        FROM ' . prefixTable('items').' as i
1105
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
1106 1106
         WHERE i.id = %i
1107 1107
         AND l.action = %s',
1108 1108
         $ident,
@@ -1112,12 +1112,12 @@  discard block
 block discarded – undo
1112 1112
     $tags = '';
1113 1113
     $itemTags = DB::query(
1114 1114
         'SELECT tag
1115
-            FROM ' . prefixTable('tags') . '
1115
+            FROM ' . prefixTable('tags').'
1116 1116
             WHERE item_id = %i AND tag != ""',
1117 1117
         $ident
1118 1118
     );
1119 1119
     foreach ($itemTags as $itemTag) {
1120
-        $tags .= $itemTag['tag'] . ' ';
1120
+        $tags .= $itemTag['tag'].' ';
1121 1121
     }
1122 1122
     // form id_tree to full foldername
1123 1123
     $folder = [];
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
             // Is this a User id?
1129 1129
             $user = DB::queryfirstrow(
1130 1130
                 'SELECT id, login
1131
-                FROM ' . prefixTable('users') . '
1131
+                FROM ' . prefixTable('users').'
1132 1132
                 WHERE id = %i',
1133 1133
                 $elem->title
1134 1134
             );
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
             'label' => $data['label'],
1148 1148
             'description' => $data['description'],
1149 1149
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
1150
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
1150
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
1151 1151
             'id_tree' => $data['id_tree'],
1152 1152
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
1153 1153
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -1169,52 +1169,52 @@  discard block
 block discarded – undo
1169 1169
 function getStatisticsData(array $SETTINGS): array
1170 1170
 {
1171 1171
     DB::query(
1172
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1172
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1173 1173
         0
1174 1174
     );
1175 1175
     $counter_folders = DB::count();
1176 1176
     DB::query(
1177
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
1177
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
1178 1178
         1
1179 1179
     );
1180 1180
     $counter_folders_perso = DB::count();
1181 1181
     DB::query(
1182
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1182
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1183 1183
         0
1184 1184
     );
1185 1185
     $counter_items = DB::count();
1186 1186
         DB::query(
1187
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
1187
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
1188 1188
         1
1189 1189
     );
1190 1190
     $counter_items_perso = DB::count();
1191 1191
         DB::query(
1192
-        'SELECT id FROM ' . prefixTable('users') . ''
1192
+        'SELECT id FROM '.prefixTable('users').''
1193 1193
     );
1194 1194
     $counter_users = DB::count();
1195 1195
         DB::query(
1196
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1196
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1197 1197
         1
1198 1198
     );
1199 1199
     $admins = DB::count();
1200 1200
     DB::query(
1201
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1201
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1202 1202
         1
1203 1203
     );
1204 1204
     $managers = DB::count();
1205 1205
     DB::query(
1206
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1206
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1207 1207
         1
1208 1208
     );
1209 1209
     $readOnly = DB::count();
1210 1210
     // list the languages
1211 1211
     $usedLang = [];
1212 1212
     $tp_languages = DB::query(
1213
-        'SELECT name FROM ' . prefixTable('languages')
1213
+        'SELECT name FROM '.prefixTable('languages')
1214 1214
     );
1215 1215
     foreach ($tp_languages as $tp_language) {
1216 1216
         DB::query(
1217
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1217
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1218 1218
             $tp_language['name']
1219 1219
         );
1220 1220
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1223,12 +1223,12 @@  discard block
 block discarded – undo
1223 1223
     // get list of ips
1224 1224
     $usedIp = [];
1225 1225
     $tp_ips = DB::query(
1226
-        'SELECT user_ip FROM ' . prefixTable('users')
1226
+        'SELECT user_ip FROM '.prefixTable('users')
1227 1227
     );
1228 1228
     foreach ($tp_ips as $ip) {
1229 1229
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1230 1230
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1231
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1231
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1232 1232
             $usedIp[$ip['user_ip']] = 1;
1233 1233
         }
1234 1234
     }
@@ -1391,19 +1391,19 @@  discard block
 block discarded – undo
1391 1391
     // Load settings
1392 1392
     //include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1393 1393
     // Load superglobal
1394
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1394
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1395 1395
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1396 1396
     // Get user language
1397
-    include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . (null !== $superGlobal->get('user_language', 'SESSION', 'user') ? $superGlobal->get('user_language', 'SESSION', 'user') : 'english') . '.php';
1397
+    include_once $SETTINGS['cpassman_dir'].'/includes/language/'.(null !== $superGlobal->get('user_language', 'SESSION', 'user') ? $superGlobal->get('user_language', 'SESSION', 'user') : 'english').'.php';
1398 1398
     // Load library
1399
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1399
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1400 1400
     // load PHPMailer
1401
-    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1401
+    $mail = new SplClassLoader('PHPMailer\PHPMailer', $SETTINGS['cpassman_dir'].'/includes/libraries');
1402 1402
     $mail->register();
1403 1403
     $mail = new PHPMailer\PHPMailer\PHPMailer(true);
1404 1404
 
1405 1405
     // send to user
1406
-    $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/');
1406
+    $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/');
1407 1407
     $mail->SMTPDebug = isset($SETTINGS['email_debug_level']) === true && $cron === false && $silent === false ? $SETTINGS['email_debug_level'] : 0;
1408 1408
     $mail->Port = (int) $SETTINGS['email_port'];
1409 1409
     //COULD BE USED
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
         <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;">
1494 1494
         <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;">
1495 1495
         <br><div style="float:right;">' .
1496
-        $textMail .
1496
+        $textMail.
1497 1497
         '<br><br></td></tr></table>
1498 1498
     </td></tr></table>
1499 1499
     <br></body></html>';
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
  */
1507 1507
 function generateKey(): string
1508 1508
 {
1509
-    return substr(md5(rand() . rand()), 0, 15);
1509
+    return substr(md5(rand().rand()), 0, 15);
1510 1510
 }
1511 1511
 
1512 1512
 /**
@@ -1577,7 +1577,7 @@  discard block
 block discarded – undo
1577 1577
 {
1578 1578
     array_walk_recursive(
1579 1579
         $array,
1580
-        static function (&$item): void {
1580
+        static function(&$item): void {
1581 1581
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1582 1582
                 $item = utf8_encode($item);
1583 1583
             }
@@ -1598,9 +1598,9 @@  discard block
 block discarded – undo
1598 1598
  */
1599 1599
 function prepareExchangedData($teampassDir, $data, string $type, ?string $key = null)
1600 1600
 {
1601
-    $teampassDir = __DIR__ . '/..';
1601
+    $teampassDir = __DIR__.'/..';
1602 1602
     // Load superglobal
1603
-    include_once $teampassDir . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1603
+    include_once $teampassDir.'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1604 1604
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1605 1605
     // Get superglobals
1606 1606
     if ($key !== null) {
@@ -1611,10 +1611,10 @@  discard block
 block discarded – undo
1611 1611
     }
1612 1612
 
1613 1613
     //load Encoding
1614
-    include_once $teampassDir . '/includes/libraries/ForceUTF8/Encoding.php';
1614
+    include_once $teampassDir.'/includes/libraries/ForceUTF8/Encoding.php';
1615 1615
     
1616 1616
     //Load CRYPTOJS
1617
-    include_once $teampassDir . '/includes/libraries/Encryption/CryptoJs/Encryption.php';
1617
+    include_once $teampassDir.'/includes/libraries/Encryption/CryptoJs/Encryption.php';
1618 1618
 
1619 1619
     // Perform
1620 1620
     if ($type === 'encode' && is_array($data) === true) {
@@ -1686,8 +1686,8 @@  discard block
 block discarded – undo
1686 1686
  */
1687 1687
 function prefixTable(string $table): string
1688 1688
 {
1689
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1690
-    if (! empty($safeTable)) {
1689
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1690
+    if (!empty($safeTable)) {
1691 1691
         // sanitize string
1692 1692
         return $safeTable;
1693 1693
     }
@@ -1717,13 +1717,13 @@  discard block
 block discarded – undo
1717 1717
     bool $lowercase = false,
1718 1718
     array $SETTINGS = []
1719 1719
 ): string {
1720
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
1721
-    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1720
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
1721
+    $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1722 1722
     $generator->register();
1723 1723
     $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator();
1724 1724
     // Is PHP7 being used?
1725 1725
     if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
1726
-        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries');
1726
+        $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries');
1727 1727
         $php7generator->register();
1728 1728
         $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator());
1729 1729
     }
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1759 1759
 {
1760 1760
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1761
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1761
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1762 1762
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1763 1763
     socket_close($sock);
1764 1764
 }
@@ -1782,7 +1782,7 @@  discard block
 block discarded – undo
1782 1782
     }
1783 1783
 
1784 1784
     // include librairies & connect to DB
1785
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1785
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1786 1786
     if (defined('DB_PASSWD_CLEAR') === false) {
1787 1787
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1788 1788
     }
@@ -1808,14 +1808,14 @@  discard block
 block discarded – undo
1808 1808
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1809 1809
         if ($type === 'user_mngt') {
1810 1810
             send_syslog(
1811
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1811
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1812 1812
                 $SETTINGS['syslog_host'],
1813 1813
                 $SETTINGS['syslog_port'],
1814 1814
                 'teampass'
1815 1815
             );
1816 1816
         } else {
1817 1817
             send_syslog(
1818
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1818
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1819 1819
                 $SETTINGS['syslog_host'],
1820 1820
                 $SETTINGS['syslog_port'],
1821 1821
                 'teampass'
@@ -1849,7 +1849,7 @@  discard block
 block discarded – undo
1849 1849
     ?string $encryption_type = null
1850 1850
 ): void {
1851 1851
     // include librairies & connect to DB
1852
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
1852
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
1853 1853
     if (defined('DB_PASSWD_CLEAR') === false) {
1854 1854
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
1855 1855
     }
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
         if (empty($item_label) === true) {
1896 1896
             $dataItem = DB::queryfirstrow(
1897 1897
                 'SELECT id, id_tree, label
1898
-                FROM ' . prefixTable('items') . '
1898
+                FROM ' . prefixTable('items').'
1899 1899
                 WHERE id = %i',
1900 1900
                 $item_id
1901 1901
             );
@@ -1903,11 +1903,11 @@  discard block
 block discarded – undo
1903 1903
         }
1904 1904
 
1905 1905
         send_syslog(
1906
-            'action=' . str_replace('at_', '', $action) .
1907
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1908
-                ' itemno=' . $item_id .
1909
-                ' user=' . is_null($login) === true ? '' : addslashes((string) $login) .
1910
-                ' itemname="' . addslashes($item_label) . '"',
1906
+            'action='.str_replace('at_', '', $action).
1907
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1908
+                ' itemno='.$item_id.
1909
+                ' user='.is_null($login) === true ? '' : addslashes((string) $login).
1910
+                ' itemname="'.addslashes($item_label).'"',
1911 1911
             $SETTINGS['syslog_host'],
1912 1912
             $SETTINGS['syslog_port'],
1913 1913
             'teampass'
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
 function notifyChangesToSubscribers(int $item_id, string $label, array $changes, array $SETTINGS): void
1987 1987
 {
1988 1988
     // Load superglobal
1989
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1989
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
1990 1990
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
1991 1991
     // Get superglobals
1992 1992
     $globalsUserId = $superGlobal->get('user_id', 'SESSION');
@@ -1996,8 +1996,8 @@  discard block
 block discarded – undo
1996 1996
     $notification = DB::queryOneColumn(
1997 1997
         'email',
1998 1998
         'SELECT *
1999
-        FROM ' . prefixTable('notification') . ' AS n
2000
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1999
+        FROM ' . prefixTable('notification').' AS n
2000
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
2001 2001
         WHERE n.item_id = %i AND n.user_id != %i',
2002 2002
         $item_id,
2003 2003
         $globalsUserId
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
         // Get list of changes
2009 2009
         $htmlChanges = '<ul>';
2010 2010
         foreach ($changes as $change) {
2011
-            $htmlChanges .= '<li>' . $change . '</li>';
2011
+            $htmlChanges .= '<li>'.$change.'</li>';
2012 2012
         }
2013 2013
         $htmlChanges .= '</ul>';
2014 2014
         // send email
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
 function geItemReadablePath(int $id_tree, string $label, array $SETTINGS): string
2042 2042
 {
2043 2043
     // Class loader
2044
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
2044
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
2045 2045
     //Load Tree
2046 2046
     $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries');
2047 2047
     $tree->register();
@@ -2050,15 +2050,15 @@  discard block
 block discarded – undo
2050 2050
     $path = '';
2051 2051
     foreach ($arbo as $elem) {
2052 2052
         if (empty($path) === true) {
2053
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
2053
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
2054 2054
         } else {
2055
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2055
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
2056 2056
         }
2057 2057
     }
2058 2058
 
2059 2059
     // Build text to show user
2060 2060
     if (empty($label) === false) {
2061
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
2061
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
2062 2062
     }
2063 2063
     return empty($path) === true ? '' : $path;
2064 2064
 }
@@ -2115,9 +2115,9 @@  discard block
 block discarded – undo
2115 2115
  */
2116 2116
 function handleConfigFile($action, $SETTINGS, $field = null, $value = null)
2117 2117
 {
2118
-    $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
2118
+    $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
2119 2119
     // include librairies & connect to DB
2120
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2120
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2121 2121
     if (defined('DB_PASSWD_CLEAR') === false) {
2122 2122
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2123 2123
     }
@@ -2132,8 +2132,8 @@  discard block
 block discarded – undo
2132 2132
     if (file_exists($tp_config_file) === false || $action === 'rebuild') {
2133 2133
         // perform a copy
2134 2134
         if (file_exists($tp_config_file)) {
2135
-            if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) {
2136
-                return "ERROR: Could not copy file '" . $tp_config_file . "'";
2135
+            if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) {
2136
+                return "ERROR: Could not copy file '".$tp_config_file."'";
2137 2137
             }
2138 2138
         }
2139 2139
 
@@ -2143,11 +2143,11 @@  discard block
 block discarded – undo
2143 2143
         $data[1] = "global \$SETTINGS;\n";
2144 2144
         $data[2] = "\$SETTINGS = array (\n";
2145 2145
         $rows = DB::query(
2146
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s',
2146
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s',
2147 2147
             'admin'
2148 2148
         );
2149 2149
         foreach ($rows as $record) {
2150
-            array_push($data, "    '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n");
2150
+            array_push($data, "    '".$record['intitule']."' => '".$record['valeur']."',\n");
2151 2151
         }
2152 2152
         array_push($data, ");\n");
2153 2153
         $data = array_unique($data);
@@ -2161,15 +2161,15 @@  discard block
 block discarded – undo
2161 2161
                 break;
2162 2162
             }
2163 2163
 
2164
-            if (stristr($line, "'" . $field . "' => '")) {
2165
-                $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n";
2164
+            if (stristr($line, "'".$field."' => '")) {
2165
+                $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n";
2166 2166
                 $bFound = true;
2167 2167
                 break;
2168 2168
             }
2169 2169
             ++$inc;
2170 2170
         }
2171 2171
         if ($bFound === false) {
2172
-            $data[$inc] = "    '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n";
2172
+            $data[$inc] = "    '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n";
2173 2173
         }
2174 2174
     }
2175 2175
 
@@ -2199,7 +2199,7 @@  discard block
 block discarded – undo
2199 2199
 {
2200 2200
     global $SETTINGS;
2201 2201
     /* LOAD CPASSMAN SETTINGS */
2202
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2202
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
2203 2203
         $SETTINGS = [];
2204 2204
         $SETTINGS['duplicate_folder'] = 0;
2205 2205
         //by default, this is set to 0;
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
         //by default, this value is set to 5;
2210 2210
         $settings = [];
2211 2211
         $rows = DB::query(
2212
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
2212
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
2213 2213
             [
2214 2214
                 'type' => 'admin',
2215 2215
                 'type2' => 'settings',
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
     $source_cf = [];
2242 2242
     $rows = DB::QUERY(
2243 2243
         'SELECT id_category
2244
-            FROM ' . prefixTable('categories_folders') . '
2244
+            FROM ' . prefixTable('categories_folders').'
2245 2245
             WHERE id_folder = %i',
2246 2246
         $source_id
2247 2247
     );
@@ -2252,7 +2252,7 @@  discard block
 block discarded – undo
2252 2252
     $target_cf = [];
2253 2253
     $rows = DB::QUERY(
2254 2254
         'SELECT id_category
2255
-            FROM ' . prefixTable('categories_folders') . '
2255
+            FROM ' . prefixTable('categories_folders').'
2256 2256
             WHERE id_folder = %i',
2257 2257
         $target_id
2258 2258
     );
@@ -2287,9 +2287,9 @@  discard block
 block discarded – undo
2287 2287
     string $password = null
2288 2288
 ) {
2289 2289
     // Load AntiXSS
2290
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2291
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2292
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2290
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2291
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2292
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2293 2293
     $antiXss = new voku\helper\AntiXSS();
2294 2294
     // Protect against bad inputs
2295 2295
     if (is_array($source_file) === true || is_array($target_file) === true) {
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
     $target_file = $antiXss->xss_clean($target_file);
2302 2302
     if (empty($password) === true || is_null($password) === true) {
2303 2303
         // get KEY to define password
2304
-        $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
2304
+        $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
2305 2305
         $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key);
2306 2306
     }
2307 2307
 
@@ -2346,20 +2346,20 @@  discard block
 block discarded – undo
2346 2346
 ) {
2347 2347
     // load PhpEncryption library
2348 2348
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2349
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php';
2350
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php';
2351
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php';
2352
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php';
2353
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php';
2354
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2355
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2356
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2357
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2358
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2359
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2360
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2361
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2362
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2349
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php';
2350
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php';
2351
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php';
2352
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php';
2353
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php';
2354
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2355
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2356
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2357
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2358
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2359
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2360
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2361
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2362
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2363 2363
     try {
2364 2364
         \Defuse\Crypto\File::encryptFileWithPassword(
2365 2365
             $source_file,
@@ -2396,20 +2396,20 @@  discard block
 block discarded – undo
2396 2396
 ) {
2397 2397
     // load PhpEncryption library
2398 2398
     $path_to_encryption = '/includes/libraries/Encryption/Encryption/';
2399
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/CryptoException.php';
2400
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/BadFormatException.php';
2401
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/IOException.php';
2402
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/EnvironmentIsBrokenException.php';
2403
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Exception/WrongKeyOrModifiedCiphertextException.php';
2404
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php';
2405
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php';
2406
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php';
2407
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php';
2408
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php';
2409
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php';
2410
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php';
2411
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php';
2412
-    include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php';
2399
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/CryptoException.php';
2400
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/BadFormatException.php';
2401
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/IOException.php';
2402
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/EnvironmentIsBrokenException.php';
2403
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Exception/WrongKeyOrModifiedCiphertextException.php';
2404
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php';
2405
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php';
2406
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php';
2407
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php';
2408
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php';
2409
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php';
2410
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php';
2411
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php';
2412
+    include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php';
2413 2413
     try {
2414 2414
         \Defuse\Crypto\File::decryptFileWithPassword(
2415 2415
             $source_file,
@@ -2456,9 +2456,9 @@  discard block
 block discarded – undo
2456 2456
 function fileDelete(string $file, array $SETTINGS): void
2457 2457
 {
2458 2458
     // Load AntiXSS
2459
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php';
2460
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php';
2461
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php';
2459
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php';
2460
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php';
2461
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php';
2462 2462
     $antiXss = new voku\helper\AntiXSS();
2463 2463
     $file = $antiXss->xss_clean($file);
2464 2464
     if (is_file($file)) {
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
     int  $dirPerm = 0755
2509 2509
 ) {
2510 2510
     // Check if the path exists
2511
-    if (! file_exists($path)) {
2511
+    if (!file_exists($path)) {
2512 2512
         return false;
2513 2513
     }
2514 2514
 
@@ -2546,7 +2546,7 @@  discard block
 block discarded – undo
2546 2546
  */
2547 2547
 function accessToItemIsGranted(int $item_id, array $SETTINGS)
2548 2548
 {
2549
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2549
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
2550 2550
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
2551 2551
     // Prepare superGlobal variables
2552 2552
     $session_groupes_visibles = $superGlobal->get('groupes_visibles', 'SESSION');
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
     // Load item data
2555 2555
     $data = DB::queryFirstRow(
2556 2556
         'SELECT id_tree
2557
-        FROM ' . prefixTable('items') . '
2557
+        FROM ' . prefixTable('items').'
2558 2558
         WHERE id = %i',
2559 2559
         $item_id
2560 2560
     );
@@ -2617,7 +2617,7 @@  discard block
 block discarded – undo
2617 2617
         }
2618 2618
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2619 2619
     }
2620
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2620
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2621 2621
     return $email;
2622 2622
 }
2623 2623
 
@@ -2633,8 +2633,8 @@  discard block
 block discarded – undo
2633 2633
 function performDBQuery(array $SETTINGS, string $fields, string $table): array
2634 2634
 {
2635 2635
     // include librairies & connect to DB
2636
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2637
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2636
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2637
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2638 2638
     if (defined('DB_PASSWD_CLEAR') === false) {
2639 2639
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2640 2640
     }
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
     DB::$connect_options = DB_CONNECT_OPTIONS;
2649 2649
     // Insert log in DB
2650 2650
     return DB::query(
2651
-        'SELECT ' . $fields . '
2651
+        'SELECT '.$fields.'
2652 2652
         FROM ' . prefixTable($table)
2653 2653
     );
2654 2654
 }
@@ -2663,11 +2663,11 @@  discard block
 block discarded – undo
2663 2663
 function formatSizeUnits(int $bytes): string
2664 2664
 {
2665 2665
     if ($bytes >= 1073741824) {
2666
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2666
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2667 2667
     } elseif ($bytes >= 1048576) {
2668
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2668
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2669 2669
     } elseif ($bytes >= 1024) {
2670
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2670
+        $bytes = number_format($bytes / 1024, 2).' KB';
2671 2671
     } elseif ($bytes > 1) {
2672 2672
         $bytes .= ' bytes';
2673 2673
     } elseif ($bytes === 1) {
@@ -2881,14 +2881,14 @@  discard block
 block discarded – undo
2881 2881
 
2882 2882
     // Encrypt the file content
2883 2883
     $plaintext = file_get_contents(
2884
-        filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL)
2884
+        filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL)
2885 2885
     );
2886 2886
     $ciphertext = $cipher->encrypt($plaintext);
2887 2887
     // Save new file
2888 2888
     $hash = md5($plaintext);
2889
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2889
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2890 2890
     file_put_contents($fileOut, $ciphertext);
2891
-    unlink($fileInPath . '/' . $fileInName);
2891
+    unlink($fileInPath.'/'.$fileInName);
2892 2892
     return [
2893 2893
         'fileHash' => base64_encode($hash),
2894 2894
         'objectKey' => base64_encode($objectKey),
@@ -2906,7 +2906,7 @@  discard block
 block discarded – undo
2906 2906
  */
2907 2907
 function decryptFile(string $fileName, string $filePath, string $key): string
2908 2908
 {
2909
-    if (! defined('FILE_BUFFER_SIZE')) {
2909
+    if (!defined('FILE_BUFFER_SIZE')) {
2910 2910
         define('FILE_BUFFER_SIZE', 128 * 1024);
2911 2911
     }
2912 2912
 
@@ -2925,7 +2925,7 @@  discard block
 block discarded – undo
2925 2925
     $cipher->enableContinuousBuffer();
2926 2926
     $cipher->disablePadding();
2927 2927
     // Get file content
2928
-    $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName);
2928
+    $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName);
2929 2929
     // Decrypt file content and return
2930 2930
     return base64_encode($cipher->decrypt($ciphertext));
2931 2931
 }
@@ -2979,8 +2979,8 @@  discard block
 block discarded – undo
2979 2979
     array $SETTINGS
2980 2980
 ): void {
2981 2981
     // include librairies & connect to DB
2982
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
2983
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
2982
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
2983
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
2984 2984
     if (defined('DB_PASSWD_CLEAR') === false) {
2985 2985
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
2986 2986
     }
@@ -2999,7 +2999,7 @@  discard block
 block discarded – undo
2999 2999
         $post_object_id
3000 3000
     );
3001 3001
     // Superglobals
3002
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3002
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
3003 3003
     $superGlobal = new protect\SuperGlobal\SuperGlobal();
3004 3004
     // Prepare superGlobal variables
3005 3005
     $sessionPpersonaFolders = $superGlobal->get('personal_folders', 'SESSION');
@@ -3024,8 +3024,8 @@  discard block
 block discarded – undo
3024 3024
         // Create sharekey for each user
3025 3025
         $users = DB::query(
3026 3026
             'SELECT id, public_key
3027
-            FROM ' . prefixTable('users') . '
3028
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
3027
+            FROM ' . prefixTable('users').'
3028
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
3029 3029
             AND public_key != ""'
3030 3030
         );
3031 3031
         foreach ($users as $user) {
@@ -3055,7 +3055,7 @@  discard block
 block discarded – undo
3055 3055
 function isBase64(string $str): bool
3056 3056
 {
3057 3057
     $str = (string) trim($str);
3058
-    if (! isset($str[0])) {
3058
+    if (!isset($str[0])) {
3059 3059
         return false;
3060 3060
     }
3061 3061
 
@@ -3123,12 +3123,12 @@  discard block
 block discarded – undo
3123 3123
         ],
3124 3124
     ];
3125 3125
     // Load expected libraries
3126
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3127
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php';
3128
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php';
3129
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php';
3130
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php';
3131
-    require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php';
3126
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php';
3127
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php';
3128
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php';
3129
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php';
3130
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php';
3131
+    require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php';
3132 3132
     $ad = new SplClassLoader('LdapRecord', '../includes/libraries');
3133 3133
     $ad->register();
3134 3134
     $connection = new Connection($config);
@@ -3137,7 +3137,7 @@  discard block
 block discarded – undo
3137 3137
         $connection->connect();
3138 3138
     } catch (\LdapRecord\Auth\BindException $e) {
3139 3139
         $error = $e->getDetailedError();
3140
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3140
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3141 3141
         return false;
3142 3142
     }
3143 3143
 
@@ -3150,7 +3150,7 @@  discard block
 block discarded – undo
3150 3150
         }
3151 3151
     } catch (\LdapRecord\Auth\BindException $e) {
3152 3152
         $error = $e->getDetailedError();
3153
-        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage();
3153
+        echo 'Error : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage();
3154 3154
         return false;
3155 3155
     }
3156 3156
 
@@ -3168,8 +3168,8 @@  discard block
 block discarded – undo
3168 3168
 function deleteUserObjetsKeys(int $userId, array $SETTINGS): bool
3169 3169
 {
3170 3170
     // include librairies & connect to DB
3171
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
3172
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3171
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
3172
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3173 3173
     if (defined('DB_PASSWD_CLEAR') === false) {
3174 3174
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3175 3175
     }
@@ -3229,7 +3229,7 @@  discard block
 block discarded – undo
3229 3229
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
3230 3230
             $now->setTimezone(new DateTimeZone($timezone));
3231 3231
             $offsets[] = $offset = $now->getOffset();
3232
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
3232
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
3233 3233
         }
3234 3234
 
3235 3235
         array_multisort($offsets, $timezones);
@@ -3249,7 +3249,7 @@  discard block
 block discarded – undo
3249 3249
 {
3250 3250
     $hours = intval($offset / 3600);
3251 3251
     $minutes = abs(intval($offset % 3600 / 60));
3252
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3252
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
3253 3253
 }
3254 3254
 
3255 3255
 /**
@@ -3349,8 +3349,7 @@  discard block
 block discarded – undo
3349 3349
 {
3350 3350
     if (isset($array[$key]) === true
3351 3351
         && (is_int($value) === true ?
3352
-            (int) $array[$key] === $value :
3353
-            (string) $array[$key] === $value)
3352
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
3354 3353
     ) {
3355 3354
         return true;
3356 3355
     }
@@ -3372,8 +3371,7 @@  discard block
 block discarded – undo
3372 3371
 {
3373 3372
     if (isset($var) === false
3374 3373
         || (is_int($value) === true ?
3375
-            (int) $var === $value :
3376
-            (string) $var === $value)
3374
+            (int) $var === $value : (string) $var === $value)
3377 3375
     ) {
3378 3376
         return true;
3379 3377
     }
@@ -3424,7 +3422,7 @@  discard block
 block discarded – undo
3424 3422
  */
3425 3423
 function isSetArrayOfValues(array $arrayOfValues): bool
3426 3424
 {
3427
-    foreach($arrayOfValues as $value) {
3425
+    foreach ($arrayOfValues as $value) {
3428 3426
         if (isset($value) === false) {
3429 3427
             return false;
3430 3428
         }
@@ -3446,7 +3444,7 @@  discard block
 block discarded – undo
3446 3444
     /*PHP8 - integer|string*/$value
3447 3445
 ) : bool
3448 3446
 {
3449
-    foreach($arrayOfVars as $variable) {
3447
+    foreach ($arrayOfVars as $variable) {
3450 3448
         if ($variable !== $value) {
3451 3449
             return false;
3452 3450
         }
@@ -3466,7 +3464,7 @@  discard block
 block discarded – undo
3466 3464
     /*PHP8 - integer|string*/$value
3467 3465
 ) : bool
3468 3466
 {
3469
-    foreach($arrayOfVars as $variable) {
3467
+    foreach ($arrayOfVars as $variable) {
3470 3468
         if ($variable === $value) {
3471 3469
             return true;
3472 3470
         }
@@ -3539,16 +3537,16 @@  discard block
 block discarded – undo
3539 3537
 ): array
3540 3538
 {
3541 3539
     // Load Sanitizer library
3542
-    require_once $path . '/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3543
-    require_once $path . '/includes/libraries/Illuminate/Support/Str.php';
3544
-    require_once $path . '/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3545
-    require_once $path . '/includes/libraries/Illuminate/Support/Arr.php';
3546
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3547
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3548
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3549
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3550
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3551
-    require_once $path . '/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3540
+    require_once $path.'/includes/libraries/Illuminate/Support/Traits/Macroable.php';
3541
+    require_once $path.'/includes/libraries/Illuminate/Support/Str.php';
3542
+    require_once $path.'/includes/libraries/Illuminate/Validation/ValidationRuleParser.php';
3543
+    require_once $path.'/includes/libraries/Illuminate/Support/Arr.php';
3544
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Contracts/Filter.php';
3545
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Trim.php';
3546
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/Cast.php';
3547
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EscapeHTML.php';
3548
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Filters/EmptyStringToNull.php';
3549
+    require_once $path.'/includes/libraries/Elegant/sanitizer/Sanitizer.php';
3552 3550
 
3553 3551
     // Sanitize post and get variables
3554 3552
     $sanitizer = new Elegant\sanitizer\Sanitizer($data, $filters);
@@ -3566,9 +3564,9 @@  discard block
 block discarded – undo
3566 3564
  */
3567 3565
 function cacheTreeUserHandler(int $user_id, string $data, array $SETTINGS, string $field_update = '')
3568 3566
 {
3569
-    include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
3567
+    include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
3570 3568
     //Connect to DB
3571
-    include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
3569
+    include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
3572 3570
     if (defined('DB_PASSWD_CLEAR') === false) {
3573 3571
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
3574 3572
     }
@@ -3584,7 +3582,7 @@  discard block
 block discarded – undo
3584 3582
     // Exists ?
3585 3583
     $userCacheId = DB::queryfirstrow(
3586 3584
         'SELECT increment_id
3587
-        FROM ' . prefixTable('cache_tree') . '
3585
+        FROM ' . prefixTable('cache_tree').'
3588 3586
         WHERE user_id = %i',
3589 3587
         $user_id
3590 3588
     );
@@ -3633,7 +3631,7 @@  discard block
 block discarded – undo
3633 3631
  */
3634 3632
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3635 3633
 { 
3636
-    $resultat = ($nombre/$total) * $pourcentage;
3634
+    $resultat = ($nombre / $total) * $pourcentage;
3637 3635
     return round($resultat);
3638 3636
 }
3639 3637
 
@@ -3661,7 +3659,7 @@  discard block
 block discarded – undo
3661 3659
 
3662 3660
     // Get last folder update
3663 3661
     $lastFolderChange = DB::queryfirstrow(
3664
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3662
+        'SELECT valeur FROM '.prefixTable('misc').'
3665 3663
         WHERE type = %s AND intitule = %s',
3666 3664
         'timestamp',
3667 3665
         'last_folder_change'
@@ -3691,7 +3689,7 @@  discard block
 block discarded – undo
3691 3689
     // Does this user has a tree cache
3692 3690
     $userCacheTree = DB::queryfirstrow(
3693 3691
         'SELECT '.$fieldName.'
3694
-        FROM ' . prefixTable('cache_tree') . '
3692
+        FROM ' . prefixTable('cache_tree').'
3695 3693
         WHERE user_id = %i',
3696 3694
         $_SESSION['user_id']
3697 3695
     );
@@ -3720,10 +3718,10 @@  discard block
 block discarded – undo
3720 3718
 )
3721 3719
 {
3722 3720
     //load ClassLoader
3723
-    include_once __DIR__. '/../sources/SplClassLoader.php';
3721
+    include_once __DIR__.'/../sources/SplClassLoader.php';
3724 3722
     
3725 3723
     //Connect to DB
3726
-    include_once __DIR__. '/../includes/libraries/Database/Meekrodb/db.class.php';
3724
+    include_once __DIR__.'/../includes/libraries/Database/Meekrodb/db.class.php';
3727 3725
     if (defined('DB_PASSWD_CLEAR') === false) {
3728 3726
         define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, []));
3729 3727
     }
@@ -3742,7 +3740,7 @@  discard block
 block discarded – undo
3742 3740
     if (count($folderIds) === 0) {
3743 3741
         $folderIds = DB::queryFirstColumn(
3744 3742
             'SELECT id
3745
-            FROM ' . prefixTable('nested_tree') . '
3743
+            FROM ' . prefixTable('nested_tree').'
3746 3744
             WHERE personal_folder=%i',
3747 3745
             0
3748 3746
         );
@@ -3759,8 +3757,8 @@  discard block
 block discarded – undo
3759 3757
         $rows_tmp = DB::query(
3760 3758
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3761 3759
             f.id_category AS category_id
3762
-            FROM ' . prefixTable('categories_folders') . ' AS f
3763
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3760
+            FROM ' . prefixTable('categories_folders').' AS f
3761
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3764 3762
             WHERE id_folder=%i',
3765 3763
             $folder
3766 3764
         );
@@ -3786,7 +3784,7 @@  discard block
 block discarded – undo
3786 3784
         $valTemp = '';
3787 3785
         $data = DB::queryFirstRow(
3788 3786
             'SELECT valeur
3789
-            FROM ' . prefixTable('misc') . '
3787
+            FROM ' . prefixTable('misc').'
3790 3788
             WHERE type = %s AND intitule=%i',
3791 3789
             'complex',
3792 3790
             $folder
@@ -3803,14 +3801,14 @@  discard block
 block discarded – undo
3803 3801
         $valTemp = '';
3804 3802
         $rows_tmp = DB::query(
3805 3803
             'SELECT t.title
3806
-            FROM ' . prefixTable('roles_values') . ' as v
3807
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3804
+            FROM ' . prefixTable('roles_values').' as v
3805
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3808 3806
             WHERE v.folder_id = %i
3809 3807
             GROUP BY title',
3810 3808
             $folder
3811 3809
         );
3812 3810
         foreach ($rows_tmp as $record) {
3813
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3811
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3814 3812
         }
3815 3813
         $arr_data['visibilityRoles'] = $valTemp;
3816 3814
 
@@ -3842,7 +3840,7 @@  discard block
 block discarded – undo
3842 3840
         // loop on users and check if user has this role
3843 3841
         $rows = DB::query(
3844 3842
             'SELECT id, fonction_id
3845
-            FROM ' . prefixTable('users') . '
3843
+            FROM ' . prefixTable('users').'
3846 3844
             WHERE id != %i',
3847 3845
             $_SESSION['user_id']
3848 3846
         );
Please login to merge, or discard this patch.