Passed
Pull Request — master (#4822)
by Nils
05:44
created
sources/utilities.queries.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $arrFolders = array();
129 129
             $rows = DB::query(
130 130
                 'SELECT valeur, intitule
131
-                FROM ' . prefixTable('misc') . '
131
+                FROM ' . prefixTable('misc').'
132 132
                 WHERE type  = %s',
133 133
                 'folder_deleted'
134 134
             );
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
                 i.id as id, i.label as label,
152 152
                 i.id_tree as id_tree, l.date as date, n.title as folder_title,
153 153
                 a.del_enabled as del_enabled, a.del_value as del_value, a.del_type as del_type
154
-                FROM ' . prefixTable('log_items') . ' as l
155
-                INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
156
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
157
-                LEFT JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id)
158
-                INNER JOIN ' . prefixTable('automatic_del') . ' as a ON (l.id_item = a.item_id)
154
+                FROM ' . prefixTable('log_items').' as l
155
+                INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
156
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
157
+                LEFT JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id)
158
+                INNER JOIN ' . prefixTable('automatic_del').' as a ON (l.id_item = a.item_id)
159 159
                 WHERE i.inactif = %i
160 160
                 AND l.action = %s',
161 161
                 1,
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                             'label' => $record['label'],
178 178
                             'date' => date($SETTINGS['date_format'], (int) $record['date']),
179 179
                             'login' => $record['login'],
180
-                            'name' => $record['name'] . ' ' . $record['lastname'],
180
+                            'name' => $record['name'].' '.$record['lastname'],
181 181
                             'folder_label' => $record['folder_title'],
182 182
                             'folder_deleted' => $thisFolder,
183 183
                             'del_enabled' => (bool) $record['del_enabled'],
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
             foreach ($post_folders as $folderId) {
239 239
                 $data = DB::queryFirstRow(
240 240
                     'SELECT valeur
241
-                    FROM ' . prefixTable('misc') . "
241
+                    FROM ' . prefixTable('misc')."
242 242
                     WHERE type = 'folder_deleted'
243 243
                     AND intitule = %s",
244
-                    'f' . $folderId
244
+                    'f'.$folderId
245 245
                 );
246 246
                 if ((int) $data['valeur'] !== 0) {
247 247
                     $folderData = explode(', ', $data['valeur']);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                         prefixTable('misc'),
269 269
                         'type = %s AND intitule = %s',
270 270
                         'folder_deleted',
271
-                        'f' . $folderId
271
+                        'f'.$folderId
272 272
                     );
273 273
 
274 274
                     // Restore all items in this folder
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                     // Get list of all items in thos folder
285 285
                     $items = DB::query(
286 286
                         'SELECT id
287
-                        FROM ' . prefixTable('items') . '
287
+                        FROM ' . prefixTable('items').'
288 288
                         WHERE id_tree = %i',
289 289
                         $folderId
290 290
                     );
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
             foreach ($post_folders as $folderId) {
374 374
                 $data = DB::queryFirstRow(
375 375
                     'SELECT valeur
376
-                    FROM ' . prefixTable('misc') . "
376
+                    FROM ' . prefixTable('misc')."
377 377
                     WHERE type = 'folder_deleted'
378 378
                     AND intitule = %s",
379
-                    'f' . $folderId
379
+                    'f'.$folderId
380 380
                 );
381 381
                 if ((int) $data['valeur'] !== 0) {
382 382
                     $exploded = explode(',', $data['valeur']);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                         prefixTable('misc'),
388 388
                         'type = %s AND intitule = %s',
389 389
                         'folder_deleted',
390
-                        'f' . $folderData[0]
390
+                        'f'.$folderData[0]
391 391
                     );
392 392
 
393 393
                     // Delete all items in this folder
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                     // Get list of all items in thos folder
402 402
                     $items = DB::query(
403 403
                         'SELECT id
404
-                        FROM ' . prefixTable('items') . '
404
+                        FROM ' . prefixTable('items').'
405 405
                         WHERE id_tree = %i',
406 406
                         $folderData[0]
407 407
                     );
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                         // Delete all fields
419 419
                         $fields = DB::query(
420 420
                             'SELECT id
421
-                            FROM ' . prefixTable('categories_items') . '
421
+                            FROM ' . prefixTable('categories_items').'
422 422
                             WHERE item_id = %i',
423 423
                             $folderData[0]
424 424
                         );
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                         // Delete all files
439 439
                         $files = DB::query(
440 440
                             'SELECT id
441
-                            FROM ' . prefixTable('files') . '
441
+                            FROM ' . prefixTable('files').'
442 442
                             WHERE id_item = %i',
443 443
                             $folderData[0]
444 444
                         );
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                 // Delete sharekey fields
496 496
                 $itemFields = DB::query(
497 497
                     'SELECT id
498
-                    FROM ' . prefixTable('categories_items') . '
498
+                    FROM ' . prefixTable('categories_items').'
499 499
                     WHERE item_id = %i',
500 500
                     $itemId
501 501
                 );
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
                 // Delete sharekey files
511 511
                 $itemFiles = DB::query(
512 512
                     'SELECT id
513
-                    FROM ' . prefixTable('files') . '
513
+                    FROM ' . prefixTable('files').'
514 514
                     WHERE id_item = %i',
515 515
                     $itemId
516 516
                 );
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
             ) {
588 588
                 if ($post_log_type === 'items') {
589 589
                     DB::query(
590
-                        'SELECT * FROM ' . prefixTable('log_items') . '
590
+                        'SELECT * FROM '.prefixTable('log_items').'
591 591
                         WHERE (date BETWEEN %i AND %i)'
592 592
                         . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"')
593 593
                         . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user),
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
                 } elseif ($post_log_type === 'connections') {
608 608
                     //db::debugmode(true);
609 609
                     DB::query(
610
-                        'SELECT * FROM ' . prefixTable('log_system') . '
610
+                        'SELECT * FROM '.prefixTable('log_system').'
611 611
                         WHERE type=%s '
612 612
                         . 'AND (date BETWEEN %i AND %i)'
613 613
                         . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action)
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
                     );
631 631
                 } elseif ($post_log_type === 'errors') {
632 632
                     DB::query(
633
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
633
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
634 634
                             'AND (date BETWEEN %i AND %i)',
635 635
                         'error',
636 636
                         $post_date_from,
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
                     );
648 648
                 } elseif ($post_log_type === 'copy') {
649 649
                     DB::query(
650
-                        'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' .
650
+                        'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '.
651 651
                             'AND (date BETWEEN %i AND %i)',
652 652
                         'at_copy',
653 653
                         $post_date_from,
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
                     );
665 665
                 } elseif ($post_log_type === 'admin') {
666 666
                     DB::query(
667
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
667
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
668 668
                             'AND (date BETWEEN %i AND %i)',
669 669
                         'admin_action',
670 670
                         $post_date_from,
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
                     );
682 682
                 } elseif ($post_log_type === 'failed') {
683 683
                     DB::query(
684
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
684
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
685 685
                             'AND (date BETWEEN %i AND %i)',
686 686
                         'failed_auth',
687 687
                         $post_date_from,
@@ -752,19 +752,19 @@  discard block
 block discarded – undo
752 752
             // Get info about task
753 753
             $taskInfo = DB::queryFirstRow(
754 754
                 'SELECT p.process_type as process_type
755
-                FROM ' . prefixTable('background_tasks') . ' as p
755
+                FROM ' . prefixTable('background_tasks').' as p
756 756
                 WHERE p.increment_id = %i',
757 757
                 $post_id
758 758
             );
759 759
             if ($taskInfo !== null) {
760 760
                 // delete task
761 761
                 DB::query(
762
-                    'DELETE FROM ' . prefixTable('background_subtasks') . '
762
+                    'DELETE FROM '.prefixTable('background_subtasks').'
763 763
                     WHERE task_id = %i',
764 764
                     $post_id
765 765
                 );
766 766
                 DB::query(
767
-                    'DELETE FROM ' . prefixTable('background_tasks') . '
767
+                    'DELETE FROM '.prefixTable('background_tasks').'
768 768
                     WHERE increment_id = %i',
769 769
                     $post_id
770 770
                 );
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
                         ->setDayOfMonth('*')
832 832
                         ->setMonths('*')
833 833
                         ->setDayOfWeek('*')
834
-                        ->setTaskCommandLine($phpBinaryPath . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php')
834
+                        ->setTaskCommandLine($phpBinaryPath.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php')
835 835
                         ->setComments('Teampass scheduler');
836 836
                     
837 837
                     $crontabRepository->addJob($crontabJob);
Please login to merge, or discard this patch.
sources/core/services/QRCodeService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         if ($this->isResetBlocked($params['origin'])) {
54 54
             return $this->respondError(
55
-                "113 " . $this->lang->get('error_not_allowed_to') . " - " .
55
+                "113 ".$this->lang->get('error_not_allowed_to')." - ".
56 56
                 isKeyExistingAndEqual('ga_reset_by_user', 1, $this->settings)
57 57
             );
58 58
         }
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 
84 84
         [$secretKey, $temporaryCode] = $this->generateAndStoreSecret($user['id']);
85 85
 
86
-        logEvents($this->settings, 'user_connection', 'at_2fa_google_code_send_by_email', (string)$user['id'], stripslashes($params['login']), stripslashes($params['login']));
86
+        logEvents($this->settings, 'user_connection', 'at_2fa_google_code_send_by_email', (string) $user['id'], stripslashes($params['login']), stripslashes($params['login']));
87 87
         DB::update(prefixTable('tokens'), ['end_timestamp' => time()], 'id = %i', $tokenId);
88 88
 
89
-        if ((int)$params['send_mail'] === 1) {
89
+        if ((int) $params['send_mail'] === 1) {
90 90
             $this->send2FACodeByEmail($user['email'], $temporaryCode);
91 91
 
92 92
             return $this->respondSuccess($user['email'], $params['send_mail']);
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
     {
106 106
         if (isValueSetNullEmpty($id)) {
107 107
             $user = DB::queryFirstRow(
108
-                'SELECT id, email, pw FROM ' . prefixTable('users') . ' WHERE login = %s',
108
+                'SELECT id, email, pw FROM '.prefixTable('users').' WHERE login = %s',
109 109
                 $login
110 110
             );
111 111
         } else {
112 112
             $user = DB::queryFirstRow(
113
-                'SELECT id, login, email, pw FROM ' . prefixTable('users') . ' WHERE id = %i',
113
+                'SELECT id, login, email, pw FROM '.prefixTable('users').' WHERE id = %i',
114 114
                 $id
115 115
             );
116 116
             $login = $user['login'] ?? $login;
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
         return DB::count() > 0 ? $user : null;
120 120
     }
121 121
 
122
-    private function handleToken(string $token, int $userId): int|false
122
+    private function handleToken(string $token, int $userId): int | false
123 123
     {
124 124
         $dataToken = DB::queryFirstRow(
125
-            'SELECT end_timestamp, reason FROM ' . prefixTable('tokens') . ' WHERE token = %s AND user_id = %i',
125
+            'SELECT end_timestamp, reason FROM '.prefixTable('tokens').' WHERE token = %s AND user_id = %i',
126 126
             $token,
127 127
             $userId
128 128
         );
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             return DB::insertId();
146 146
         }
147 147
 
148
-        return (int) DB::queryFirstField('SELECT id FROM ' . prefixTable('tokens') . ' WHERE token = %s AND user_id = %i', $token, $userId);
148
+        return (int) DB::queryFirstField('SELECT id FROM '.prefixTable('tokens').' WHERE token = %s AND user_id = %i', $token, $userId);
149 149
     }
150 150
 
151 151
     private function generateAndStoreSecret(int $userId): array
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             'email' => $email,
186 186
             'email_result' => str_replace(
187 187
                 '#email#',
188
-                '<b>' . obfuscateEmail($email) . '</b>',
188
+                '<b>'.obfuscateEmail($email).'</b>',
189 189
                 addslashes($this->lang->get('admin_email_result_ok'))
190 190
             ),
191 191
         ], 'encode');
Please login to merge, or discard this patch.
sources/core/services/OneTimeCodeService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     private function getUser(int $userId): ?array
66 66
     {
67 67
         $user = DB::queryFirstRow(
68
-            'SELECT email, auth_type, login FROM ' . prefixTable('users') . ' WHERE id = %i',
68
+            'SELECT email, auth_type, login FROM '.prefixTable('users').' WHERE id = %i',
69 69
             $userId
70 70
         );
71 71
 
Please login to merge, or discard this patch.
sources/main.queries.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 ) {
79 79
     // Not allowed page
80 80
     $session->set('system-error_code', ERR_NOT_ALLOWED);
81
-    include $SETTINGS['cpassman_dir'] . '/error.php';
81
+    include $SETTINGS['cpassman_dir'].'/error.php';
82 82
     exit;
83 83
 }
84 84
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
             // Get current user hash
268 268
             $userHash = DB::queryFirstRow(
269
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
269
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
270 270
                 $session->get('user-id')
271 271
             )['pw'];
272 272
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
  * @param string $post_key
322 322
  * @return string
323 323
  */
324
-function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string
324
+function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string
325 325
 {
326 326
     $session = SessionManager::getSession();
327 327
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     if (isset($dataReceived['user_id'])) {
357 357
         // Get info about user to modify
358 358
         $targetUserInfos = DB::queryFirstRow(
359
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
359
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
360 360
             WHERE id = %i',
361 361
             $dataReceived['user_id']
362 362
         );
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
         case 'mail_me'://action_mail
506 506
             // Get info about user to send email
507 507
             $data_user = DB::queryFirstRow(
508
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
508
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
509 509
                 WHERE email = %s',
510 510
                 filter_var($dataReceived['receipt'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)
511 511
             );
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     if (isset($dataReceived['user_id'])) {
619 619
         // Get info about user to modify
620 620
         $targetUserInfos = DB::queryFirstRow(
621
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
621
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
622 622
             WHERE id = %i',
623 623
             $dataReceived['user_id']
624 624
         );
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 
697 697
             // Get current user hash
698 698
             $userHash = DB::queryFirstRow(
699
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
699
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
700 700
                 $session->get('user-id')
701 701
             )['pw'];
702 702
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 
735 735
                 // Get current user hash
736 736
                 $userHash = DB::queryFirstRow(
737
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
737
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
738 738
                     $session->get('user-id')
739 739
                 )['pw'];
740 740
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 
779 779
                 // Get current user hash
780 780
                 $userHash = DB::queryFirstRow(
781
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %i;",
781
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %i;",
782 782
                     $session->get('user-id')
783 783
                 )['pw'];
784 784
 
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
     }
858 858
 
859 859
     return prepareSuccessResponse([
860
-        'count' => getNumberOfItemsToTreat((int)$userId, $SETTINGS)
860
+        'count' => getNumberOfItemsToTreat((int) $userId, $SETTINGS)
861 861
     ]);
862 862
 }
863 863
 
@@ -953,12 +953,12 @@  discard block
 block discarded – undo
953 953
     // Generate token
954 954
     $passwordManager = new PasswordManager();
955 955
     $token = $passwordManager->generatePassword(
956
-        (int)$params['size'],
957
-        (bool)$params['secure'],
958
-        (bool)$params['numeric'],
959
-        (bool)$params['capital'],
960
-        (bool)$params['symbols'],
961
-        (bool)$params['lowercase']
956
+        (int) $params['size'],
957
+        (bool) $params['secure'],
958
+        (bool) $params['numeric'],
959
+        (bool) $params['capital'],
960
+        (bool) $params['symbols'],
961
+        (bool) $params['lowercase']
962 962
     );
963 963
 
964 964
     DB::insert(prefixTable('tokens'), [
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
         'token' => $token,
967 967
         'reason' => $params['reason'],
968 968
         'creation_timestamp' => time(),
969
-        'end_timestamp' => time() + (int)$params['duration'],
969
+        'end_timestamp' => time() + (int) $params['duration'],
970 970
     ]);
971 971
 
972 972
     return prepareSuccessResponse(['token' => $token]);
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 
1014 1014
 
1015 1015
 
1016
-function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
1016
+function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
1017 1017
 {
1018 1018
     switch ($post_type) {
1019 1019
         /*
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
         array(
1083 1083
             'error' => false,
1084 1084
             'timestamp' => $session->get('user-session_duration'),
1085
-            'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60),
1085
+            'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60),
1086 1086
             'max_session_duration' => $maximum_session_expiration_time,
1087 1087
         ),
1088 1088
         'encode'
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
     // get number of items
1135 1135
     DB::queryFirstRow(
1136 1136
         'SELECT increment_id
1137
-        FROM ' . prefixTable('sharekeys_items') .
1137
+        FROM ' . prefixTable('sharekeys_items').
1138 1138
         ' WHERE user_id = %i',
1139 1139
         $userId
1140 1140
     );
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
         // check if expected security level is reached
1190 1190
         $dataUser = DB::queryFirstRow(
1191 1191
             'SELECT *
1192
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
1192
+            FROM ' . prefixTable('users').' WHERE id = %i',
1193 1193
             $post_user_id
1194 1194
         );
1195 1195
 
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
         if (empty($dataUser['fonction_id']) === false) {
1211 1211
             $data = DB::queryFirstRow(
1212 1212
                 'SELECT complexity
1213
-                FROM ' . prefixTable('roles_title') . '
1214
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
1213
+                FROM ' . prefixTable('roles_title').'
1214
+                WHERE id IN (' . $dataUser['fonction_id'].')
1215 1215
                 ORDER BY complexity DESC'
1216 1216
             );
1217 1217
         } else {
@@ -1224,8 +1224,8 @@  discard block
 block discarded – undo
1224 1224
             return prepareExchangedData(
1225 1225
                 array(
1226 1226
                     'error' => true,
1227
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' .
1228
-                        $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
1227
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'.
1228
+                        $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
1229 1229
                 ),
1230 1230
                 'encode'
1231 1231
             );
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 
1311 1311
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
1312 1312
         $row = DB::queryFirstRow(
1313
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1313
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1314 1314
             'cron',
1315 1315
             'sending_emails'
1316 1316
         );
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1319 1319
             $rows = DB::query(
1320 1320
                 'SELECT *
1321
-                FROM ' . prefixTable('emails') .
1321
+                FROM ' . prefixTable('emails').
1322 1322
                 ' WHERE status != %s',
1323 1323
                 'sent'
1324 1324
             );
@@ -1375,8 +1375,8 @@  discard block
 block discarded – undo
1375 1375
     $arr_html = array();
1376 1376
     $rows = DB::query(
1377 1377
         '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
1378
-        FROM ' . prefixTable('log_items') . ' AS l
1379
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1378
+        FROM ' . prefixTable('log_items').' AS l
1379
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1380 1380
         WHERE l.action = %s AND l.id_user = %i
1381 1381
         ORDER BY l.date DESC
1382 1382
         LIMIT 0, 100',
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1409 1409
         && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1)
1410 1410
     ) {
1411
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1411
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1412 1412
         $nb_suggestions_waiting = DB::count();
1413 1413
     }
1414 1414
 
@@ -1448,13 +1448,13 @@  discard block
 block discarded – undo
1448 1448
             if ($data === 'stat_languages') {
1449 1449
                 $tmp = '';
1450 1450
                 foreach ($stats_data[$data] as $key => $value) {
1451
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1451
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1452 1452
                 }
1453 1453
                 $statsToSend[$data] = $tmp;
1454 1454
             } elseif ($data === 'stat_country') {
1455 1455
                 $tmp = '';
1456 1456
                 foreach ($stats_data[$data] as $key => $value) {
1457
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1457
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1458 1458
                 }
1459 1459
                 $statsToSend[$data] = $tmp;
1460 1460
             } else {
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
     $anonymUrl = '';
1541 1541
     if (!empty($urlFound)) {
1542 1542
         $parsed = parse_url($urlFound);
1543
-        $anonymUrl = $parsed['scheme'] . '://<anonym_url>' . ($parsed['path'] ?? '');
1543
+        $anonymUrl = $parsed['scheme'].'://<anonym_url>'.($parsed['path'] ?? '');
1544 1544
     }
1545 1545
 
1546 1546
     // Filtrage et tri des réglages
@@ -1561,21 +1561,21 @@  discard block
 block discarded – undo
1561 1561
     // Récupère dernière erreur PHP
1562 1562
     $phpError = error_get_last();
1563 1563
     $phpErrorMsg = $phpError
1564
-        ? $phpError['message'] . ' - ' . $phpError['file'] . ' (' . $phpError['line'] . ')'
1564
+        ? $phpError['message'].' - '.$phpError['file'].' ('.$phpError['line'].')'
1565 1565
         : $lang->get('no_error_logged');
1566 1566
 
1567 1567
     // Dernières erreurs Teampass
1568 1568
     $teampassErrors = [];
1569 1569
     $errors = DB::query(
1570 1570
         'SELECT label, date AS error_date
1571
-         FROM ' . prefixTable('log_system') . "
1571
+         FROM ' . prefixTable('log_system')."
1572 1572
          WHERE `type` = 'error'
1573 1573
          ORDER BY `date` DESC
1574 1574
          LIMIT 10"
1575 1575
     );
1576 1576
 
1577 1577
     foreach ($errors as $record) {
1578
-        $teampassErrors[] = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1578
+        $teampassErrors[] = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1579 1579
     }
1580 1580
     $teampassErrors = count($teampassErrors) > 0 ? implode("\n", $teampassErrors) : $lang->get('no_error_logged');
1581 1581
 
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
         // Check if user exists
1665 1665
         $userInfo = DB::queryFirstRow(
1666 1666
             'SELECT public_key, private_key, pw, auth_type
1667
-            FROM ' . prefixTable('users') . '
1667
+            FROM ' . prefixTable('users').'
1668 1668
             WHERE id = %i',
1669 1669
             $post_user_id
1670 1670
         );
@@ -1673,9 +1673,9 @@  discard block
 block discarded – undo
1673 1673
             // Get one item
1674 1674
             $currentUserKey = DB::queryFirstRow(
1675 1675
                 'SELECT object_id, share_key, increment_id
1676
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
1677
-                INNER JOIN ' . prefixTable('items') . ' AS i ON  (i.id = si.object_id)
1678
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON  (i.id_tree = nt.id)
1676
+                FROM ' . prefixTable('sharekeys_items').' AS si
1677
+                INNER JOIN ' . prefixTable('items').' AS i ON  (i.id = si.object_id)
1678
+                INNER JOIN ' . prefixTable('nested_tree').' AS nt ON  (i.id_tree = nt.id)
1679 1679
                 WHERE user_id = %i AND nt.personal_folder = %i',
1680 1680
                 $post_user_id,
1681 1681
                 0
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
         // Get user info
1770 1770
         $userData = DB::queryFirstRow(
1771 1771
             'SELECT private_key
1772
-            FROM ' . prefixTable('users') . '
1772
+            FROM ' . prefixTable('users').'
1773 1773
             WHERE id = %i',
1774 1774
             $post_user_id
1775 1775
         );
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
         // Get user info
1851 1851
         $userData = DB::queryFirstRow(
1852 1852
             'SELECT email, auth_type, login
1853
-            FROM ' . prefixTable('users') . '
1853
+            FROM ' . prefixTable('users').'
1854 1854
             WHERE id = %i',
1855 1855
             $post_user_id
1856 1856
         );
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
         // Check if user exists
1959 1959
         DB::queryFirstRow(
1960 1960
             'SELECT *
1961
-            FROM ' . prefixTable('users') . '
1961
+            FROM ' . prefixTable('users').'
1962 1962
             WHERE id = %i',
1963 1963
             $post_user_id
1964 1964
         );
@@ -2028,7 +2028,7 @@  discard block
 block discarded – undo
2028 2028
         // Check if user exists
2029 2029
         $userInfo = DB::queryFirstRow(
2030 2030
             'SELECT public_key
2031
-            FROM ' . prefixTable('users') . '
2031
+            FROM ' . prefixTable('users').'
2032 2032
             WHERE id = %i',
2033 2033
             $post_user_id
2034 2034
         );
@@ -2176,15 +2176,15 @@  discard block
 block discarded – undo
2176 2176
     // Loop on items
2177 2177
     $rows = DB::query(
2178 2178
         'SELECT id, pw
2179
-        FROM ' . prefixTable('items') . '
2179
+        FROM ' . prefixTable('items').'
2180 2180
         WHERE perso = 0
2181
-        LIMIT ' . $post_start . ', ' . $post_length
2181
+        LIMIT ' . $post_start.', '.$post_length
2182 2182
     );
2183 2183
     foreach ($rows as $record) {
2184 2184
         // Get itemKey from current user
2185 2185
         $currentUserKey = DB::queryFirstRow(
2186 2186
             'SELECT share_key, 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
             $session->get('user-id')
@@ -2216,7 +2216,7 @@  discard block
 block discarded – undo
2216 2216
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2217 2217
                 $currentUserKey = DB::queryFirstRow(
2218 2218
                     'SELECT increment_id
2219
-                    FROM ' . prefixTable('sharekeys_items') . '
2219
+                    FROM ' . prefixTable('sharekeys_items').'
2220 2220
                     WHERE object_id = %i AND user_id = %i',
2221 2221
                     $record['id'],
2222 2222
                     $post_user_id
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
     // SHould we change step?
2250 2250
     DB::query(
2251 2251
         'SELECT *
2252
-        FROM ' . prefixTable('items') . '
2252
+        FROM ' . prefixTable('items').'
2253 2253
         WHERE perso = 0'
2254 2254
     );
2255 2255
 
@@ -2274,15 +2274,15 @@  discard block
 block discarded – undo
2274 2274
     // Loop on logs
2275 2275
     $rows = DB::query(
2276 2276
         'SELECT increment_id
2277
-        FROM ' . prefixTable('log_items') . '
2277
+        FROM ' . prefixTable('log_items').'
2278 2278
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2279
-        LIMIT ' . $post_start . ', ' . $post_length
2279
+        LIMIT ' . $post_start.', '.$post_length
2280 2280
     );
2281 2281
     foreach ($rows as $record) {
2282 2282
         // Get itemKey from current user
2283 2283
         $currentUserKey = DB::queryFirstRow(
2284 2284
             'SELECT share_key
2285
-            FROM ' . prefixTable('sharekeys_logs') . '
2285
+            FROM ' . prefixTable('sharekeys_logs').'
2286 2286
             WHERE object_id = %i AND user_id = %i',
2287 2287
             $record['increment_id'],
2288 2288
             $session->get('user-id')
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2315 2315
                 $currentUserKey = DB::queryFirstRow(
2316 2316
                     'SELECT increment_id
2317
-                    FROM ' . prefixTable('sharekeys_items') . '
2317
+                    FROM ' . prefixTable('sharekeys_items').'
2318 2318
                     WHERE object_id = %i AND user_id = %i',
2319 2319
                     $record['id'],
2320 2320
                     $post_user_id
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
     // SHould we change step?
2337 2337
     DB::query(
2338 2338
         'SELECT increment_id
2339
-        FROM ' . prefixTable('log_items') . '
2339
+        FROM ' . prefixTable('log_items').'
2340 2340
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2341 2341
     );
2342 2342
 
@@ -2361,15 +2361,15 @@  discard block
 block discarded – undo
2361 2361
     // Loop on fields
2362 2362
     $rows = DB::query(
2363 2363
         'SELECT id
2364
-        FROM ' . prefixTable('categories_items') . '
2364
+        FROM ' . prefixTable('categories_items').'
2365 2365
         WHERE encryption_type = "teampass_aes"
2366
-        LIMIT ' . $post_start . ', ' . $post_length
2366
+        LIMIT ' . $post_start.', '.$post_length
2367 2367
     );
2368 2368
     foreach ($rows as $record) {
2369 2369
         // Get itemKey from current user
2370 2370
         $currentUserKey = DB::queryFirstRow(
2371 2371
             'SELECT share_key
2372
-            FROM ' . prefixTable('sharekeys_fields') . '
2372
+            FROM ' . prefixTable('sharekeys_fields').'
2373 2373
             WHERE object_id = %i AND user_id = %i',
2374 2374
             $record['id'],
2375 2375
             $session->get('user-id')
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2402 2402
                 $currentUserKey = DB::queryFirstRow(
2403 2403
                     'SELECT increment_id
2404
-                    FROM ' . prefixTable('sharekeys_items') . '
2404
+                    FROM ' . prefixTable('sharekeys_items').'
2405 2405
                     WHERE object_id = %i AND user_id = %i',
2406 2406
                     $record['id'],
2407 2407
                     $post_user_id
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
     // SHould we change step?
2424 2424
     DB::query(
2425 2425
         'SELECT *
2426
-        FROM ' . prefixTable('categories_items') . '
2426
+        FROM ' . prefixTable('categories_items').'
2427 2427
         WHERE encryption_type = "teampass_aes"'
2428 2428
     );
2429 2429
 
@@ -2448,14 +2448,14 @@  discard block
 block discarded – undo
2448 2448
     // Loop on suggestions
2449 2449
     $rows = DB::query(
2450 2450
         'SELECT id
2451
-        FROM ' . prefixTable('suggestion') . '
2452
-        LIMIT ' . $post_start . ', ' . $post_length
2451
+        FROM ' . prefixTable('suggestion').'
2452
+        LIMIT ' . $post_start.', '.$post_length
2453 2453
     );
2454 2454
     foreach ($rows as $record) {
2455 2455
         // Get itemKey from current user
2456 2456
         $currentUserKey = DB::queryFirstRow(
2457 2457
             'SELECT share_key
2458
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2458
+            FROM ' . prefixTable('sharekeys_suggestions').'
2459 2459
             WHERE object_id = %i AND user_id = %i',
2460 2460
             $record['id'],
2461 2461
             $session->get('user-id')
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2488 2488
                 $currentUserKey = DB::queryFirstRow(
2489 2489
                     'SELECT increment_id
2490
-                    FROM ' . prefixTable('sharekeys_items') . '
2490
+                    FROM ' . prefixTable('sharekeys_items').'
2491 2491
                     WHERE object_id = %i AND user_id = %i',
2492 2492
                     $record['id'],
2493 2493
                     $post_user_id
@@ -2533,15 +2533,15 @@  discard block
 block discarded – undo
2533 2533
     // Loop on files
2534 2534
     $rows = DB::query(
2535 2535
         'SELECT id
2536
-        FROM ' . prefixTable('files') . '
2537
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2538
-        LIMIT ' . $post_start . ', ' . $post_length
2536
+        FROM ' . prefixTable('files').'
2537
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2538
+        LIMIT ' . $post_start.', '.$post_length
2539 2539
     ); //aes_encryption
2540 2540
     foreach ($rows as $record) {
2541 2541
         // Get itemKey from current user
2542 2542
         $currentUserKey = DB::queryFirstRow(
2543 2543
             'SELECT share_key
2544
-            FROM ' . prefixTable('sharekeys_files') . '
2544
+            FROM ' . prefixTable('sharekeys_files').'
2545 2545
             WHERE object_id = %i AND user_id = %i',
2546 2546
             $record['id'],
2547 2547
             $session->get('user-id')
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2574 2574
                 $currentUserKey = DB::queryFirstRow(
2575 2575
                     'SELECT increment_id
2576
-                    FROM ' . prefixTable('sharekeys_items') . '
2576
+                    FROM ' . prefixTable('sharekeys_items').'
2577 2577
                     WHERE object_id = %i AND user_id = %i',
2578 2578
                     $record['id'],
2579 2579
                     $post_user_id
@@ -2595,8 +2595,8 @@  discard block
 block discarded – undo
2595 2595
     // SHould we change step?
2596 2596
     DB::query(
2597 2597
         'SELECT *
2598
-        FROM ' . prefixTable('files') . '
2599
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2598
+        FROM ' . prefixTable('files').'
2599
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2600 2600
     );
2601 2601
 
2602 2602
     $next_start = (int) $post_start + (int) $post_length;
@@ -2629,9 +2629,9 @@  discard block
 block discarded – undo
2629 2629
     if (count($session->get('user-personal_folders')) > 0) {
2630 2630
         $rows = DB::query(
2631 2631
             'SELECT id, pw
2632
-            FROM ' . prefixTable('items') . '
2632
+            FROM ' . prefixTable('items').'
2633 2633
             WHERE perso = 1 AND id_tree IN %ls AND encryption_type = %s
2634
-            LIMIT ' . $post_start . ', ' . $post_length,
2634
+            LIMIT ' . $post_start.', '.$post_length,
2635 2635
             $session->get('user-personal_folders'),
2636 2636
             "defuse"
2637 2637
         );
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
             // Get itemKey from current user
2640 2640
             $currentUserKey = DB::queryFirstRow(
2641 2641
                 'SELECT share_key, increment_id
2642
-                FROM ' . prefixTable('sharekeys_items') . '
2642
+                FROM ' . prefixTable('sharekeys_items').'
2643 2643
                 WHERE object_id = %i AND user_id = %i',
2644 2644
                 $record['id'],
2645 2645
                 $session->get('user-id')
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
                 if ((int) $post_user_id !== (int) $session->get('user-id')) {
2667 2667
                     $currentUserKey = DB::queryFirstRow(
2668 2668
                         'SELECT increment_id
2669
-                        FROM ' . prefixTable('sharekeys_items') . '
2669
+                        FROM ' . prefixTable('sharekeys_items').'
2670 2670
                         WHERE object_id = %i AND user_id = %i',
2671 2671
                         $record['id'],
2672 2672
                         $post_user_id
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
     // SHould we change step?
2690 2690
     DB::query(
2691 2691
         'SELECT *
2692
-        FROM ' . prefixTable('items') . '
2692
+        FROM ' . prefixTable('items').'
2693 2693
         WHERE perso = 0'
2694 2694
     );
2695 2695
 
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
         // Check if user exists
2718 2718
         $userInfo = DB::queryFirstRow(
2719 2719
             'SELECT public_key, encrypted_psk
2720
-            FROM ' . prefixTable('users') . '
2720
+            FROM ' . prefixTable('users').'
2721 2721
             WHERE id = %i',
2722 2722
             $post_user_id
2723 2723
         );
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
                 if ($post_counterItemsToTreat === -1) {
2744 2744
                     DB::query(
2745 2745
                         'SELECT id
2746
-                        FROM ' . prefixTable('items') . '
2746
+                        FROM ' . prefixTable('items').'
2747 2747
                         WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
2748 2748
                         $session->get('user-personal_folders'),
2749 2749
                         'teampass_aes'
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
                 // Loop on persoanl items
2757 2757
                 $rows = DB::query(
2758 2758
                     'SELECT id, pw
2759
-                    FROM ' . prefixTable('items') . '
2759
+                    FROM ' . prefixTable('items').'
2760 2760
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s
2761 2761
                     LIMIT ' . $post_length,
2762 2762
                     $session->get('user-personal_folders'),
@@ -2800,7 +2800,7 @@  discard block
 block discarded – undo
2800 2800
                     // Loop on files
2801 2801
                     $rows = DB::query(
2802 2802
                         'SELECT id, file
2803
-                        FROM ' . prefixTable('files') . '
2803
+                        FROM ' . prefixTable('files').'
2804 2804
                         WHERE status != %s
2805 2805
                         AND id_item = %i',
2806 2806
                         TP_ENCRYPTION_NAME,
@@ -2811,13 +2811,13 @@  discard block
 block discarded – undo
2811 2811
                         // Now decrypt the file
2812 2812
                         prepareFileWithDefuse(
2813 2813
                             'decrypt',
2814
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2815
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2814
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2815
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2816 2816
                             $post_user_psk
2817 2817
                         );
2818 2818
 
2819 2819
                         // Encrypt the file
2820
-                        $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
2820
+                        $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
2821 2821
 
2822 2822
                         DB::update(
2823 2823
                             prefixTable('files'),
@@ -2840,7 +2840,7 @@  discard block
 block discarded – undo
2840 2840
                         );
2841 2841
 
2842 2842
                         // Unlink original file
2843
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
2843
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
2844 2844
                     }
2845 2845
                 }
2846 2846
 
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
                 $next_start = (int) $post_start + (int) $post_length;
2849 2849
                 DB::query(
2850 2850
                     'SELECT id
2851
-                    FROM ' . prefixTable('items') . '
2851
+                    FROM ' . prefixTable('items').'
2852 2852
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
2853 2853
                     $session->get('user-personal_folders'),
2854 2854
                     'teampass_aes'
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
         // Get user info
2919 2919
         $userData = DB::queryFirstRow(
2920 2920
             'SELECT special, auth_type, is_ready_for_usage, ongoing_process_id, otp_provided, keys_recovery_time
2921
-            FROM ' . prefixTable('users') . '
2921
+            FROM ' . prefixTable('users').'
2922 2922
             WHERE id = %i',
2923 2923
             $post_user_id
2924 2924
         );
@@ -2965,7 +2965,7 @@  discard block
 block discarded – undo
2965 2965
         // Get user info
2966 2966
         $userData = DB::queryFirstRow(
2967 2967
             'SELECT auth_type, login, private_key
2968
-            FROM ' . prefixTable('users') . '
2968
+            FROM ' . prefixTable('users').'
2969 2969
             WHERE id = %i',
2970 2970
             $post_user_id
2971 2971
         );
@@ -3015,7 +3015,7 @@  discard block
 block discarded – undo
3015 3015
                 return prepareExchangedData(
3016 3016
                     array(
3017 3017
                         'error' => false,
3018
-                        'message' => $lang->get('done'),'',
3018
+                        'message' => $lang->get('done'), '',
3019 3019
                     ),
3020 3020
                     'encode'
3021 3021
                 );
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
         // Get user info
3064 3064
         $userData = DB::queryFirstRow(
3065 3065
             'SELECT auth_type, login, private_key, special
3066
-            FROM ' . prefixTable('users') . '
3066
+            FROM ' . prefixTable('users').'
3067 3067
             WHERE id = %i',
3068 3068
             $post_user_id
3069 3069
         );
@@ -3097,7 +3097,7 @@  discard block
 block discarded – undo
3097 3097
                 return prepareExchangedData(
3098 3098
                     array(
3099 3099
                         'error' => false,
3100
-                        'message' => $lang->get('done'),'',
3100
+                        'message' => $lang->get('done'), '',
3101 3101
                     ),
3102 3102
                     'encode'
3103 3103
                 );
@@ -3119,8 +3119,8 @@  discard block
 block discarded – undo
3119 3119
             // Get one itemKey from current user
3120 3120
             $currentUserKey = DB::queryFirstRow(
3121 3121
                 'SELECT ski.share_key, ski.increment_id, l.id_user
3122
-                FROM ' . prefixTable('sharekeys_items') . ' AS ski
3123
-                INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
3122
+                FROM ' . prefixTable('sharekeys_items').' AS ski
3123
+                INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
3124 3124
                 WHERE ski.user_id = %i
3125 3125
                 ORDER BY RAND()
3126 3126
                 LIMIT 1',
@@ -3210,7 +3210,7 @@  discard block
 block discarded – undo
3210 3210
             $session->get('user-id')
3211 3211
         );
3212 3212
         // Return data
3213
-        return '[{"new_value":"' . $session->get('user-session_duration') . '"}]';
3213
+        return '[{"new_value":"'.$session->get('user-session_duration').'"}]';
3214 3214
     }
3215 3215
     
3216 3216
     return '[{"new_value":"expired"}]';
Please login to merge, or discard this patch.
sources/backups.queries.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
             // Prepare variables
139 139
             $post_key = filter_var($dataReceived['encryptionKey'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
140 140
         
141
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
141
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
142 142
         
143 143
             // get a token
144 144
             $passwordManager = new PasswordManager();
145 145
             $token = $passwordManager->generatePassword(20, false, true, true, false, true);
146 146
         
147 147
             //save file
148
-            $filename = time() . '-' . $token . '.sql';
149
-            $filepath = $SETTINGS['path_to_files_folder'] . '/' . $filename;
148
+            $filename = time().'-'.$token.'.sql';
149
+            $filepath = $SETTINGS['path_to_files_folder'].'/'.$filename;
150 150
             $handle = fopen($filepath, 'w+');
151 151
             
152 152
             if ($handle === false) {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             $tables = array();
165 165
             $result = DB::query('SHOW TABLES');
166 166
             foreach ($result as $row) {
167
-                $tables[] = $row['Tables_in_' . DB_NAME];
167
+                $tables[] = $row['Tables_in_'.DB_NAME];
168 168
             }
169 169
         
170 170
             $backupSuccess = true;
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
                 if (empty($pre) || substr_count($table, $pre) > 0) {
175 175
                     $table = safeString($table);
176 176
                     // Write table drop and creation
177
-                    fwrite($handle, 'DROP TABLE IF EXISTS ' . $table . ";\n");
178
-                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
179
-                    fwrite($handle, safeString($row2['Create Table']) . ";\n\n");
177
+                    fwrite($handle, 'DROP TABLE IF EXISTS '.$table.";\n");
178
+                    $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
179
+                    fwrite($handle, safeString($row2['Create Table']).";\n\n");
180 180
         
181 181
                     // Get field information
182 182
                     DB::query(
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                         }
202 202
                         
203 203
                         foreach ($rows as $record) {
204
-                            $insertQuery = 'INSERT INTO ' . $table . ' VALUES(';
204
+                            $insertQuery = 'INSERT INTO '.$table.' VALUES(';
205 205
                             $values = array();
206 206
                             
207 207
                             foreach ($record as $value) {
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
                                 if ($value === null) {
210 210
                                     $values[] = 'NULL';
211 211
                                 } else {
212
-                                    $values[] = '"' . addslashes(preg_replace("/\n/", '\\n', $value)) . '"';
212
+                                    $values[] = '"'.addslashes(preg_replace("/\n/", '\\n', $value)).'"';
213 213
                                 }
214 214
                             }
215 215
                             
216
-                            $insertQuery .= implode(',', $values) . ");\n";
216
+                            $insertQuery .= implode(',', $values).");\n";
217 217
                             fwrite($handle, $insertQuery);
218 218
                             
219 219
                             // Flush buffer periodically to free memory
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
                 prepareFileWithDefuse(
244 244
                     'encrypt',
245 245
                     $filepath,
246
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
246
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
247 247
                     $post_key
248 248
                 );
249 249
         
250 250
                 // Do clean
251 251
                 unlink($filepath);
252 252
                 rename(
253
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
253
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
254 254
                     $filepath
255 255
                 );
256 256
             }
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
                 array(
274 274
                     'error' => false,
275 275
                     'message' => '',
276
-                    'download' => 'sources/downloadFile.php?name=' . urlencode($filename) .
277
-                        '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' .
278
-                        $session->get('user-key_tmp') . '&pathIsFiles=1',
276
+                    'download' => 'sources/downloadFile.php?name='.urlencode($filename).
277
+                        '&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.
278
+                        $session->get('user-key_tmp').'&pathIsFiles=1',
279 279
                 ),
280 280
                 'encode'
281 281
             );
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
                 error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
337 337
             }
338 338
         
339
-            include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
339
+            include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
340 340
         
341 341
             if (empty($post_clearFilename) === true) {
342 342
                 // Get filename from database
343 343
                 $data = DB::queryFirstRow(
344 344
                     'SELECT valeur
345
-                    FROM ' . prefixTable('misc') . '
345
+                    FROM ' . prefixTable('misc').'
346 346
                     WHERE increment_id = %i',
347 347
                     $post_backupFile
348 348
                 );
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
                 $post_backupFile = safeString($data['valeur']);
370 370
                 
371 371
                 // Verify file exists
372
-                if (!file_exists($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile)) {
372
+                if (!file_exists($SETTINGS['path_to_files_folder'].'/'.$post_backupFile)) {
373 373
                     echo prepareExchangedData(
374 374
                         array(
375 375
                             'error' => true,
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
                     // Decrypt the file
387 387
                     $ret = prepareFileWithDefuse(
388 388
                         'decrypt',
389
-                        $SETTINGS['path_to_files_folder'] . '/' . $post_backupFile,
390
-                        $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile,
389
+                        $SETTINGS['path_to_files_folder'].'/'.$post_backupFile,
390
+                        $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile,
391 391
                         $post_key
392 392
                     );
393 393
                     
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
                     }
405 405
         
406 406
                     // Do clean
407
-                    fileDelete($SETTINGS['path_to_files_folder'] . '/' . $post_backupFile, $SETTINGS);
408
-                    $post_backupFile = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $post_backupFile;
407
+                    fileDelete($SETTINGS['path_to_files_folder'].'/'.$post_backupFile, $SETTINGS);
408
+                    $post_backupFile = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$post_backupFile;
409 409
                 } else {
410 410
                     echo prepareExchangedData(
411 411
                         array(
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
                                 DB::query($query);
488 488
                                 $executedQueries++;
489 489
                             } catch (Exception $e) {
490
-                                $errors[] = "Error executing query: " . $e->getMessage() . " - Query: " . substr($query, 0, 100) . "...";
490
+                                $errors[] = "Error executing query: ".$e->getMessage()." - Query: ".substr($query, 0, 100)."...";
491 491
                             }
492 492
                             $query = '';
493 493
                         }
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             } catch (Exception $e) {
504 504
                 // Rollback transaction on any exception
505 505
                 DB::rollback();
506
-                $errors[] = "Transaction failed: " . $e->getMessage();
506
+                $errors[] = "Transaction failed: ".$e->getMessage();
507 507
             }
508 508
         
509 509
             // Calculate the new offset
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                 echo prepareExchangedData(
519 519
                     array(
520 520
                         'error' => true,
521
-                        'message' => 'Errors occurred during import: ' . implode('; ', $errors),
521
+                        'message' => 'Errors occurred during import: '.implode('; ', $errors),
522 522
                         'newOffset' => $newOffset,
523 523
                         'totalSize' => $post_totalSize,
524 524
                         'clearFilename' => $post_backupFile,
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
             break;
135 135
         }
136 136
 
137
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
137
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
138 138
         $return = '';
139 139
 
140 140
         //Get all tables
141 141
         $tables = array();
142 142
         $result = DB::query('SHOW TABLES');
143 143
         foreach ($result as $row) {
144
-            $tables[] = $row['Tables_in_' . DB_NAME];
144
+            $tables[] = $row['Tables_in_'.DB_NAME];
145 145
         }
146 146
 
147 147
         //cycle through
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
150 150
                 $table = (is_string($table) ? $table : strval($table));
151 151
                 // Do query
152
-                $result = DB::query('SELECT * FROM ' . $table);
152
+                $result = DB::query('SELECT * FROM '.$table);
153 153
                 DB::query(
154 154
                     'SELECT *
155 155
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
                 $numFields = DB::count();
162 162
 
163 163
                 // prepare a drop table
164
-                $return .= 'DROP TABLE ' . $table . ';';
165
-                $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table);
166
-                $return .= "\n\n" . strval($row2['Create Table']) . ";\n\n";
164
+                $return .= 'DROP TABLE '.$table.';';
165
+                $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table);
166
+                $return .= "\n\n".strval($row2['Create Table']).";\n\n";
167 167
 
168 168
                 //prepare all fields and datas
169 169
                 for ($i = 0; $i < $numFields; ++$i) {
170 170
                     if (is_object($result)) {
171 171
                         while ($row = $result->fetch_row()) {
172
-                            $return .= 'INSERT INTO ' . $table . ' VALUES(';
172
+                            $return .= 'INSERT INTO '.$table.' VALUES(';
173 173
                             for ($j = 0; $j < $numFields; ++$j) {
174 174
                                 $row[$j] = addslashes($row[$j]);
175 175
                                 $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
176 176
                                 if (isset($row[$j])) {
177
-                                    $return .= '"' . $row[$j] . '"';
177
+                                    $return .= '"'.$row[$j].'"';
178 178
                                 } else {
179 179
                                     $return .= 'NULL';
180 180
                                 }
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
             $newPassword = $passwordManager->generatePassword(20, false, true, true, false, true);
197 197
 
198 198
             //save file
199
-            $filename = time() . '-' . $token . '.sql';
200
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
199
+            $filename = time().'-'.$token.'.sql';
200
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
201 201
             if ($handle !== false) {
202 202
                 //write file
203 203
                 fwrite($handle, $return);
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
                 // Encrypt the file
210 210
                 prepareFileWithDefuse(
211 211
                     'encrypt',
212
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
213
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
212
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
213
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
214 214
                     $post_option
215 215
                 );
216 216
 
217 217
                 // Do clean
218
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
218
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
219 219
                 rename(
220
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
221
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
220
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
221
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
222 222
                 );
223 223
             }
224 224
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             //update LOG
231 231
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $session->get('user-id'), $session->get('user-login'));
232 232
 
233
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' . $session->get('user-key_tmp') . '&pathIsFiles=1"}]';
233
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.$session->get('user-key_tmp').'&pathIsFiles=1"}]';
234 234
         }
235 235
         break;
236 236
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             );
260 260
             break;
261 261
         }
262
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
262
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
263 263
 
264 264
         $dataPost = explode('&', $post_option);
265 265
         $file = htmlspecialchars($dataPost[0]);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         // Get filename from database
269 269
         $data = DB::queryFirstRow(
270 270
             'SELECT valeur
271
-            FROM ' . prefixTable('misc') . '
271
+            FROM ' . prefixTable('misc').'
272 272
             WHERE increment_id = %i',
273 273
             $file
274 274
         );
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
             // Decrypt the file
288 288
             $ret = prepareFileWithDefuse(
289 289
                 'decrypt',
290
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
291
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
290
+                $SETTINGS['path_to_files_folder'].'/'.$file,
291
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
292 292
                 $key
293 293
             );
294 294
 
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
             }
300 300
 
301 301
             // Do clean
302
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
303
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
302
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
303
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
304 304
         } else {
305
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
305
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
306 306
         }
307 307
 
308 308
         //read sql file
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         fclose($handle);
320 320
 
321 321
         //delete file
322
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
322
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
323 323
 
324 324
         //Show done
325 325
         echo '[{"result":"db_restore" , "message":""}]';
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
                 $tablename = (is_string($tablename) ? $tablename : strval($tablename));
359 359
                 if (substr_count($tablename, DB_PREFIX) > 0) {
360 360
                     // launch optimization quieries
361
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
362
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
361
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
362
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
363 363
                 }
364 364
             }
365 365
         }
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
         //Clean up LOG_ITEMS table
368 368
         $rows = DB::query(
369 369
             'SELECT id
370
-            FROM ' . prefixTable('items') . '
370
+            FROM ' . prefixTable('items').'
371 371
             ORDER BY id ASC'
372 372
         );
373 373
         foreach ($rows as $item) {
374 374
             DB::query(
375
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
375
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
376 376
                 $item['id'],
377 377
                 'at_creation'
378 378
             );
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             if ($counter === 0) {
381 381
                 //Create new at_creation entry
382 382
                 $rowTmp = DB::queryFirstRow(
383
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
383
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
384 384
                     $item['id']
385 385
                 );
386 386
                 DB::insert(
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
         echo prepareExchangedData(
411 411
             array(
412 412
                 'error' => false,
413
-                'message' => $lang->get('last_execution') . ' ' .
414
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
413
+                'message' => $lang->get('last_execution').' '.
414
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
415 415
                     '<i class="fas fa-check text-success ml-2"></i>',
416 416
             ),
417 417
             'encode'
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             break;
448 448
         }
449 449
 
450
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
450
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
451 451
         updateCacheTable('reload', NULL);
452 452
 
453 453
         // Log
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
         echo prepareExchangedData(
464 464
             [
465 465
                 'error' => false,
466
-                'message' => $lang->get('last_execution') . ' ' .
467
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
466
+                'message' => $lang->get('last_execution').' '.
467
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
468 468
                     '<i class="fas fa-check text-success mr-2"></i>',
469 469
             ],
470 470
             'encode'
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         $session->set('user-reencrypt_old_salt', file_get_contents(SECUREPATH.'/'.SECUREFILE));
507 507
 
508 508
         // generate new saltkey
509
-        $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
509
+        $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
510 510
         copy(
511 511
             SECUREPATH.'/'.SECUREFILE,
512 512
             $old_sk_filename
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $session->get('user-id'), $session->get('user-login'));
536 536
 
537 537
         // get number of items to change
538
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
538
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
539 539
         $nb_of_items = DB::count();
540 540
 
541 541
         // create backup table
542
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
542
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
543 543
         DB::query(
544
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
544
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
545 545
             `id` int(12) NOT null AUTO_INCREMENT,
546 546
             `current_table` varchar(100) NOT NULL,
547 547
             `current_field` varchar(500) NOT NULL,
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
         );
570 570
 
571 571
         // delete previous backup files
572
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
572
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
573 573
         foreach ($files as $file) { // iterate files
574 574
             if (is_file($file)) {
575 575
                 $file_parts = pathinfo($file);
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
                 echo prepareExchangedData(
657 657
                     array(
658 658
                         'error' => true,
659
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
659
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
660 660
                         'nbOfItems' => '',
661 661
                         'nextAction' => '',
662 662
                     ),
@@ -669,9 +669,9 @@  discard block
 block discarded – undo
669 669
                 //change all encrypted data in Items (passwords)
670 670
                 $rows = DB::query(
671 671
                     'SELECT id, pw, pw_iv
672
-                    FROM ' . prefixTable('items') . '
672
+                    FROM ' . prefixTable('items').'
673 673
                     WHERE perso = %s
674
-                    LIMIT ' . $post_start . ', ' . $post_length,
674
+                    LIMIT ' . $post_start.', '.$post_length,
675 675
                     '0'
676 676
                 );
677 677
                 foreach ($rows as $record) {
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
                             'current_field' => 'pw',
684 684
                             'value_id' => $record['id'],
685 685
                             'value' => $record['pw'],
686
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
686
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
687 687
                             'value2' => 'none',
688 688
                             'result' => 'none',
689 689
                         )
@@ -732,9 +732,9 @@  discard block
 block discarded – undo
732 732
                 //change all encrypted data in Logs (passwords)
733 733
                 $rows = DB::query(
734 734
                     'SELECT raison, increment_id
735
-                    FROM ' . prefixTable('log_items') . "
735
+                    FROM ' . prefixTable('log_items')."
736 736
                     WHERE action = %s AND raison LIKE 'at_pw :%'
737
-                    LIMIT " . $post_start . ', ' . $post_length,
737
+                    LIMIT " . $post_start.', '.$post_length,
738 738
                     'at_modification'
739 739
                 );
740 740
                 foreach ($rows as $record) {
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
                             'current_field' => 'raison',
747 747
                             'value_id' => $record['increment_id'],
748 748
                             'value' => $record['raison'],
749
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
749
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
750 750
                             'value2' => 'none',
751 751
                             'result' => 'none',
752 752
                         )
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
                         DB::update(
775 775
                             prefixTable('log_items'),
776 776
                             array(
777
-                                'raison' => 'at_pw :' . $encrypt['string'],
777
+                                'raison' => 'at_pw :'.$encrypt['string'],
778 778
                                 'encryption_type' => 'defuse',
779 779
                             ),
780 780
                             'increment_id = %i',
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
                 //change all encrypted data in CATEGORIES (passwords)
800 800
                 $rows = DB::query(
801 801
                     'SELECT id, data
802
-                    FROM ' . prefixTable('categories_items') . '
803
-                    LIMIT ' . $post_start . ', ' . $post_length
802
+                    FROM ' . prefixTable('categories_items').'
803
+                    LIMIT ' . $post_start.', '.$post_length
804 804
                 );
805 805
                 foreach ($rows as $record) {
806 806
                     // backup data
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                             'current_field' => 'data',
812 812
                             'value_id' => $record['id'],
813 813
                             'value' => $record['data'],
814
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
814
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
815 815
                             'value2' => 'none',
816 816
                             'result' => 'none',
817 817
                         )
@@ -859,9 +859,9 @@  discard block
 block discarded – undo
859 859
                 // Change all encrypted data in FILES (passwords)
860 860
                 $rows = DB::query(
861 861
                     'SELECT id, file, status
862
-                    FROM ' . prefixTable('files') . "
862
+                    FROM ' . prefixTable('files')."
863 863
                     WHERE status = 'encrypted'
864
-                    LIMIT " . $post_start . ', ' . $post_length
864
+                    LIMIT " . $post_start.', '.$post_length
865 865
                 );
866 866
                 foreach ($rows as $record) {
867 867
                     // backup data
@@ -879,20 +879,20 @@  discard block
 block discarded – undo
879 879
                     );
880 880
                     $newID = DB::insertId();
881 881
 
882
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
882
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
883 883
                         // make a copy of file
884 884
                         if (!copy(
885
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
886
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
885
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
886
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
887 887
                         )) {
888 888
                             $error = 'Copy not possible';
889 889
                             exit;
890 890
                         } else {
891 891
                             // prepare a bck of file (that will not be deleted)
892
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
892
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
893 893
                             copy(
894
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
895
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
894
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
895
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
896 896
                             );
897 897
                         }
898 898
 
@@ -900,22 +900,22 @@  discard block
 block discarded – undo
900 900
                         // STEP1 - Do decryption
901 901
                         prepareFileWithDefuse(
902 902
                             'decrypt',
903
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
904
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'
903
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
904
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'
905 905
                         );
906 906
 
907 907
                         // Do cleanup of files
908
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
908
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
909 909
 
910 910
                         // STEP2 - Do encryption
911 911
                         prepareFileWithDefuse(
912 912
                             'encryp',
913
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
914
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file']
913
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
914
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file']
915 915
                         );
916 916
 
917 917
                         // Do cleanup of files
918
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
918
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
919 919
 
920 920
                         // Update backup table
921 921
                         DB::update(
@@ -941,13 +941,13 @@  discard block
 block discarded – undo
941 941
                 // do some things for new object
942 942
                 if (isset($objects[0])) {
943 943
                     if ($objects[0] === 'logs') {
944
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
944
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
945 945
                     } elseif ($objects[0] === 'files') {
946
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
946
+                        DB::query('SELECT id FROM '.prefixTable('files'));
947 947
                     } elseif ($objects[0] === 'categories') {
948
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
948
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
949 949
                     } elseif ($objects[0] === 'custfields') {
950
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
950
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
951 951
                     }
952 952
                     $nb_of_items = DB::count();
953 953
                 } else {
@@ -1067,12 +1067,12 @@  discard block
 block discarded – undo
1067 1067
                 );
1068 1068
             } elseif ($record['current_table'] === 'files') {
1069 1069
                 // restore backup file
1070
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1071
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1072
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1070
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1071
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1072
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1073 1073
                         rename(
1074
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1075
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1074
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1075
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1076 1076
                         );
1077 1077
                     }
1078 1078
                 }
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
         }
1092 1092
 
1093 1093
         // drop table
1094
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1094
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1095 1095
 
1096 1096
         // Send back
1097 1097
         echo prepareExchangedData(
@@ -1134,17 +1134,17 @@  discard block
 block discarded – undo
1134 1134
         // delete files
1135 1135
         $rows = DB::query(
1136 1136
             'SELECT value, value2
1137
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1137
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1138 1138
             WHERE current_table = 'files'"
1139 1139
         );
1140 1140
         foreach ($rows as $record) {
1141
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1142
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1141
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1142
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1143 1143
             }
1144 1144
         }
1145 1145
 
1146 1146
         // drop table
1147
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1147
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1148 1148
 
1149 1149
         echo '[{"status":"done"}]';
1150 1150
         break;
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
                 'encode'
1176 1176
             );
1177 1177
         } else {
1178
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1178
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1179 1179
 
1180 1180
             //send email
1181 1181
             $emailSettings = new EmailSettings($SETTINGS);
@@ -1213,13 +1213,13 @@  discard block
 block discarded – undo
1213 1213
             break;
1214 1214
         }
1215 1215
 
1216
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1216
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1217 1217
         $emailSettings = new EmailSettings($SETTINGS);
1218 1218
         $emailService = new EmailService();
1219 1219
 
1220 1220
         $rows = DB::query(
1221 1221
             'SELECT *
1222
-            FROM ' . prefixTable('emails') . '
1222
+            FROM ' . prefixTable('emails').'
1223 1223
             WHERE status = %s OR status = %s',
1224 1224
             'not_sent',
1225 1225
             ''
@@ -1305,13 +1305,13 @@  discard block
 block discarded – undo
1305 1305
             break;
1306 1306
         }
1307 1307
 
1308
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1308
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1309 1309
 
1310 1310
         // Instatiate email settings and service
1311 1311
         $emailSettings = new EmailSettings($SETTINGS);
1312 1312
         $emailService = new EmailService();
1313 1313
 
1314
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1314
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1315 1315
         foreach ($rows as $record) {
1316 1316
             //send email
1317 1317
             $email = $emailService->sendMail(
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
             break;
1381 1381
         }
1382 1382
 
1383
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1383
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1384 1384
 
1385 1385
         // init
1386 1386
         $filesList = array();
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
                 FROM ' . prefixTable('files')
1394 1394
             );
1395 1395
             foreach ($rows as $record) {
1396
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1396
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1397 1397
                     $addFile = false;
1398 1398
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1399 1399
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1458,8 +1458,8 @@  discard block
 block discarded – undo
1458 1458
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1459 1459
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1460 1460
 
1461
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1462
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1461
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1462
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1463 1463
 
1464 1464
         $cpt = 0;
1465 1465
         $continu = true;
@@ -1472,33 +1472,33 @@  discard block
 block discarded – undo
1472 1472
                 // Get file name
1473 1473
                 $file_info = DB::queryFirstRow(
1474 1474
                     'SELECT file
1475
-                    FROM ' . prefixTable('files') . '
1475
+                    FROM ' . prefixTable('files').'
1476 1476
                     WHERE id = %i',
1477 1477
                     $file
1478 1478
                 );
1479 1479
 
1480 1480
                 // skip file is Coherancey not respected
1481
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
1481
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
1482 1482
                     // Case where we want to decrypt
1483 1483
                     if ($post_option === 'decrypt') {
1484 1484
                         prepareFileWithDefuse(
1485 1485
                             'decrypt',
1486
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1487
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1486
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1487
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1488 1488
                         );
1489 1489
                         // Case where we want to encrypt
1490 1490
                     } elseif ($post_option === 'encrypt') {
1491 1491
                         prepareFileWithDefuse(
1492 1492
                             'encrypt',
1493
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
1494
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1493
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
1494
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1495 1495
                         );
1496 1496
                     }
1497 1497
                     // Do file cleanup
1498
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
1498
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
1499 1499
                     rename(
1500
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
1501
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
1500
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
1501
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
1502 1502
                     );
1503 1503
 
1504 1504
                     // store in DB
@@ -1533,8 +1533,8 @@  discard block
 block discarded – undo
1533 1533
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
1534 1534
             );
1535 1535
 
1536
-            $message = $lang->get('last_execution') . ' ' .
1537
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
1536
+            $message = $lang->get('last_execution').' '.
1537
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
1538 1538
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
1539 1539
         }
1540 1540
 
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT);
1630 1630
 
1631 1631
             DB::query(
1632
-                'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i',
1632
+                'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i',
1633 1633
                 $post_id
1634 1634
             );
1635 1635
         }
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
             // Delete existing key
1725 1725
         } elseif (null !== $post_action && $post_action === 'delete') {
1726 1726
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
1727
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id);
1727
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id);
1728 1728
         }
1729 1729
 
1730 1730
         echo prepareExchangedData(
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
 
1740 1740
     case 'save_api_status':
1741 1741
         // Do query
1742
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
1742
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
1743 1743
         $counter = DB::count();
1744 1744
         if ($counter === 0) {
1745 1745
             DB::insert(
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 
1769 1769
     case 'run_duo_config_check':
1770 1770
         //Libraries call
1771
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1771
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1772 1772
         // Check KEY
1773 1773
         if ($post_key !== $session->get('key')) {
1774 1774
             echo prepareExchangedData(
@@ -1874,7 +1874,7 @@  discard block
 block discarded – undo
1874 1874
         } else {
1875 1875
             $tmp = 1;
1876 1876
         }
1877
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1877
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
1878 1878
         $counter = DB::count();
1879 1879
         if ($counter === 0) {
1880 1880
             DB::insert(
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 
1903 1903
         // ga_website_name
1904 1904
         if (is_null($dataReceived['ga_website_name']) === false) {
1905
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1905
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
1906 1906
             $counter = DB::count();
1907 1907
             if ($counter === 0) {
1908 1908
                 DB::insert(
@@ -1932,7 +1932,7 @@  discard block
 block discarded – undo
1932 1932
         }
1933 1933
 
1934 1934
         // send data
1935
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
1935
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
1936 1936
         break;
1937 1937
 
1938 1938
     case 'save_agses_options':
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 
1956 1956
         // agses_hosted_url
1957 1957
         if (!is_null($dataReceived['agses_hosted_url'])) {
1958
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1958
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
1959 1959
             $counter = DB::count();
1960 1960
             if ($counter === 0) {
1961 1961
                 DB::insert(
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
 
1987 1987
         // agses_hosted_id
1988 1988
         if (!is_null($dataReceived['agses_hosted_id'])) {
1989
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1989
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
1990 1990
             $counter = DB::count();
1991 1991
             if ($counter === 0) {
1992 1992
                 DB::insert(
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 
2018 2018
         // agses_hosted_apikey
2019 2019
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2020
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2020
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2021 2021
             $counter = DB::count();
2022 2022
             if ($counter === 0) {
2023 2023
                 DB::insert(
@@ -2047,7 +2047,7 @@  discard block
 block discarded – undo
2047 2047
         }
2048 2048
 
2049 2049
         // send data
2050
-        echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]';
2050
+        echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]';
2051 2051
         break;
2052 2052
 
2053 2053
     case 'save_option_change':
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
 
2089 2089
         // Check if setting is already in DB. If NO then insert, if YES then update.
2090 2090
         $data = DB::query(
2091
-            'SELECT * FROM ' . prefixTable('misc') . '
2091
+            'SELECT * FROM '.prefixTable('misc').'
2092 2092
             WHERE type = %s AND intitule = %s',
2093 2093
             'admin',
2094 2094
             $post_field
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
                     array(
2112 2112
                         'valeur' => time(),
2113 2113
                         'type' => 'admin',
2114
-                        'intitule' => $post_field . '_time',
2114
+                        'intitule' => $post_field.'_time',
2115 2115
                         'updated_at' => time(),
2116 2116
                     )
2117 2117
                 );
@@ -2133,10 +2133,10 @@  discard block
 block discarded – undo
2133 2133
             if ($post_field === 'send_stats') {
2134 2134
                 // Check if previous time exists, if not them insert this value in DB
2135 2135
                 DB::query(
2136
-                    'SELECT * FROM ' . prefixTable('misc') . '
2136
+                    'SELECT * FROM '.prefixTable('misc').'
2137 2137
                     WHERE type = %s AND intitule = %s',
2138 2138
                     'admin',
2139
-                    $post_field . '_time'
2139
+                    $post_field.'_time'
2140 2140
                 );
2141 2141
                 $counter = DB::count();
2142 2142
                 if ($counter === 0) {
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
                         array(
2146 2146
                             'valeur' => 0,
2147 2147
                             'type' => 'admin',
2148
-                            'intitule' => $post_field . '_time',
2148
+                            'intitule' => $post_field.'_time',
2149 2149
                             'created_at' => time(),
2150 2150
                         )
2151 2151
                     );
@@ -2167,13 +2167,13 @@  discard block
 block discarded – undo
2167 2167
         // special Cases
2168 2168
         if ($post_field === 'cpassman_url') {
2169 2169
             // update also jsUrl for CSFP protection
2170
-            $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js';
2170
+            $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js';
2171 2171
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2172 2172
             $data = file_get_contents($csrfp_file);
2173 2173
             $posJsUrl = strpos($data, '"jsUrl" => "');
2174 2174
             $posEndLine = strpos($data, '",', $posJsUrl);
2175 2175
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2176
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data);
2176
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data);
2177 2177
             file_put_contents($csrfp_file, $newdata);
2178 2178
         } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) {
2179 2179
             DB::update(
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
         echo prepareExchangedData(
2199 2199
             array(
2200 2200
                 'error' => false,
2201
-                'misc' => $counter . ' ; ' . $SETTINGS[$post_field],
2201
+                'misc' => $counter.' ; '.$SETTINGS[$post_field],
2202 2202
                 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '',
2203 2203
             ),
2204 2204
             'encode'
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 
2242 2242
         // send statistics
2243 2243
         if (null !== $post_status) {
2244
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2244
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2245 2245
             $counter = DB::count();
2246 2246
             if ($counter === 0) {
2247 2247
                 DB::insert(
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 
2273 2273
         // send statistics items
2274 2274
         if (null !== $post_list) {
2275
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2275
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2276 2276
             $counter = DB::count();
2277 2277
             if ($counter === 0) {
2278 2278
                 DB::insert(
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
             break;
2319 2319
         }
2320 2320
 
2321
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2321
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2322 2322
             if (DB::count() === 1) {
2323 2323
                 echo 1;
2324 2324
             } else {
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
 
2380 2380
         $rows = DB::query(
2381 2381
             'SELECT id, title
2382
-                FROM ' . prefixTable('roles_title') . '
2382
+                FROM ' . prefixTable('roles_title').'
2383 2383
                 ORDER BY title ASC'
2384 2384
         );
2385 2385
         foreach ($rows as $record) {
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
 
2512 2512
         $ignoredFiles = DB::queryFirstField(
2513 2513
             'SELECT valeur 
2514
-            FROM ' . prefixTable('misc') . ' 
2514
+            FROM ' . prefixTable('misc').' 
2515 2515
             WHERE type = %s AND intitule = %s',
2516 2516
             'admin',
2517 2517
             'ignored_unknown_files'
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
         // Get ignored unknown files
2555 2555
         $existingData = DB::queryFirstRow(
2556 2556
             'SELECT valeur 
2557
-            FROM ' . prefixTable('misc') . ' 
2557
+            FROM ' . prefixTable('misc').' 
2558 2558
             WHERE type = %s AND intitule = %s',
2559 2559
             'admin',
2560 2560
             'ignored_unknown_files'
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
         // Get the list of files to delete
2612 2612
         $filesToDelete = DB::queryFirstField(
2613 2613
             'SELECT valeur 
2614
-            FROM ' . prefixTable('misc') . ' 
2614
+            FROM ' . prefixTable('misc').' 
2615 2615
             WHERE type = %s AND intitule = %s',
2616 2616
             'admin',
2617 2617
             'unknown_files'
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
     $lang = new Language($session->get('user-language') ?? 'english');
2659 2659
 
2660 2660
     $results = [];
2661
-    $fullPath = __DIR__ . '/../';
2661
+    $fullPath = __DIR__.'/../';
2662 2662
     
2663 2663
     foreach ($files as $file) {
2664 2664
         // Normalize path separators for cross-platform compatibility
@@ -2707,7 +2707,7 @@  discard block
 block discarded – undo
2707 2707
         }
2708 2708
         
2709 2709
         // Try to delete the file
2710
-        $deleteResult = '';//@unlink($normalizedPath);
2710
+        $deleteResult = ''; //@unlink($normalizedPath);
2711 2711
         
2712 2712
         if ($deleteResult) {
2713 2713
             $results[$normalizedPath] = [
@@ -2737,7 +2737,7 @@  discard block
 block discarded – undo
2737 2737
  */
2738 2738
 function filesIntegrityCheck($baseDir): array
2739 2739
 {
2740
-    $referenceFile = __DIR__ . '/../files_reference.txt';
2740
+    $referenceFile = __DIR__.'/../files_reference.txt';
2741 2741
 
2742 2742
     $unknownFiles = findUnknownFiles($baseDir, $referenceFile);
2743 2743
 
@@ -2775,7 +2775,7 @@  discard block
 block discarded – undo
2775 2775
                 $dir,
2776 2776
                 FilesystemIterator::SKIP_DOTS
2777 2777
             ),
2778
-            function ($current, $key, $iterator) {
2778
+            function($current, $key, $iterator) {
2779 2779
                 // Ignore hidden files and folders
2780 2780
                 if ($current->getFilename()[0] === '.') {
2781 2781
                     return false;
@@ -2789,7 +2789,7 @@  discard block
 block discarded – undo
2789 2789
     foreach ($iterator as $file) {
2790 2790
         try {
2791 2791
             if ($file->isFile()) {
2792
-                $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname());
2792
+                $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname());
2793 2793
                 $relativePath = str_replace('\\', '/', $relativePath); // Normalisation Windows/Linux
2794 2794
 
2795 2795
                 // Split relatif path into parts
@@ -2855,7 +2855,7 @@  discard block
 block discarded – undo
2855 2855
     // Get ignored files
2856 2856
     $ignoredFiles = DB::queryFirstField(
2857 2857
         'SELECT valeur 
2858
-        FROM ' . prefixTable('misc') . ' 
2858
+        FROM ' . prefixTable('misc').' 
2859 2859
         WHERE type = %s AND intitule = %s',
2860 2860
         'admin',
2861 2861
         'ignored_unknown_files'
@@ -2874,7 +2874,7 @@  discard block
 block discarded – undo
2874 2874
 function tablesIntegrityCheck(): array
2875 2875
 {
2876 2876
     // Get integrity tables file
2877
-    $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json';
2877
+    $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json';
2878 2878
     if (file_exists($integrityTablesFile) === false) {
2879 2879
         return [
2880 2880
             'error' => true,
@@ -2892,7 +2892,7 @@  discard block
 block discarded – undo
2892 2892
     // Get all tables
2893 2893
     $tables = [];
2894 2894
     foreach (DB::queryFirstColumn("SHOW TABLES") as $table) {
2895
-        $tables[] = str_replace(DB_PREFIX, "", $table);;
2895
+        $tables[] = str_replace(DB_PREFIX, "", $table); ;
2896 2896
     }
2897 2897
     // Prepare the integrity check
2898 2898
     $tablesInError = [];
@@ -2958,7 +2958,7 @@  discard block
 block discarded – undo
2958 2958
 
2959 2959
         // Compare hashes
2960 2960
         $expectedHash = $referenceData[$file];
2961
-        $actualHash = md5_file($baseDir . '/' . $file);
2961
+        $actualHash = md5_file($baseDir.'/'.$file);
2962 2962
 
2963 2963
         if ($expectedHash !== $actualHash) {
2964 2964
             $issues[] = "$file (expected: <i>$expectedHash</i>, actual: <i>$actualHash</i>)";
@@ -3011,7 +3011,7 @@  discard block
 block discarded – undo
3011 3011
     foreach ($iterator as $file) {
3012 3012
         if ($file->isFile()) {
3013 3013
             // Build relative path
3014
-            $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname());
3014
+            $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname());
3015 3015
             $relativePath = str_replace('\\', '/', $relativePath); // Normalize for Windows
3016 3016
             // Calculate hash
3017 3017
             $files[$relativePath] = md5_file($file->getPathname());
Please login to merge, or discard this patch.