Passed
Push — master ( ceb3ad...8da2eb )
by Nils
07:27 queued 01:00
created
scripts/background_tasks___items_handler.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 DB::debugmode(false);
76 76
 $process_to_perform = DB::queryfirstrow(
77 77
     'SELECT *
78
-    FROM ' . prefixTable('background_tasks') . '
78
+    FROM ' . prefixTable('background_tasks').'
79 79
     WHERE is_in_progress = %i AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
80 80
     ORDER BY increment_id ASC',
81 81
     1
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     // search for next process to handle
94 94
     $process_to_perform = DB::queryfirstrow(
95 95
         'SELECT *
96
-        FROM ' . prefixTable('background_tasks') . '
96
+        FROM ' . prefixTable('background_tasks').'
97 97
         WHERE is_in_progress = %i AND (finished_at = "" OR finished_at IS NULL) AND process_type IN ("item_copy", "new_item", "update_item", "item_update_create_keys")
98 98
         ORDER BY increment_id ASC',
99 99
         0
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             $process_to_perform['increment_id']
112 112
         );
113 113
 
114
-        provideLog('[PROCESS][#'. $process_to_perform['increment_id'].'][START]', $SETTINGS);
114
+        provideLog('[PROCESS][#'.$process_to_perform['increment_id'].'][START]', $SETTINGS);
115 115
         handleTask(
116 116
             $process_to_perform['increment_id'],
117 117
             json_decode($process_to_perform['arguments'], true),
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         // Search if there are remaining tasks
142 142
         $process_to_perform = DB::queryFirstField(
143 143
             'SELECT 1
144
-            FROM ' . prefixTable('background_tasks') . '
144
+            FROM ' . prefixTable('background_tasks').'
145 145
             WHERE is_in_progress = %i AND process_type IN (
146 146
                 "item_copy",
147 147
                 "new_item",
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
  */
181 181
 function handleTask(int $processId, array $ProcessArguments, array $SETTINGS, int $itemId = null): bool
182 182
 {
183
-    provideLog('[PROCESS][#'. $processId.'][START]', $SETTINGS);
183
+    provideLog('[PROCESS][#'.$processId.'][START]', $SETTINGS);
184 184
     $task_to_perform = DB::queryfirstrow(
185 185
         'SELECT *
186
-        FROM ' . prefixTable('background_subtasks') . '
186
+        FROM ' . prefixTable('background_subtasks').'
187 187
         WHERE task_id = %i AND finished_at IS NULL
188 188
         ORDER BY increment_id ASC',
189 189
         $processId
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
         // if sub_task_in_progress === 1 then exit
198 198
         if ((int) $task_to_perform['sub_task_in_progress'] !== 0) {
199 199
             // Task is currently being in progress by another server process
200
-            provideLog('[TASK][#'. $task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
200
+            provideLog('[TASK][#'.$task_to_perform['increment_id'].'][WARNING] Similar task already being processes', $SETTINGS);
201 201
             return false;
202 202
         }
203 203
 
204 204
         // handle next task
205 205
         $args = json_decode($task_to_perform['task'], true);
206
-        provideLog('[TASK][#'. $task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
206
+        provideLog('[TASK][#'.$task_to_perform['increment_id'].'][START]Task '.$args['step'], $SETTINGS);
207 207
 
208 208
         // flag as in progress
209 209
         DB::update(
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         DB::update(
246 246
             prefixTable('background_subtasks'),
247 247
             array(
248
-                'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
248
+                'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
249 249
                 'task' => json_encode(["status" => "Done"]),
250 250
                 'is_in_progress' => -1,
251 251
                 'finished_at' => time(),
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         // are all tasks done?
261 261
         DB::query(
262 262
             'SELECT *
263
-            FROM ' . prefixTable('background_subtasks') . '
263
+            FROM ' . prefixTable('background_subtasks').'
264 264
             WHERE task_id = %i AND finished_at IS NULL',
265 265
             $processId
266 266
         );
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         // Loop on all files for this item
333 333
         // and encrypt them for each user
334 334
         if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
335
-        foreach($args['files_keys'] as $file) {
335
+        foreach ($args['files_keys'] as $file) {
336 336
             storeUsersShareKey(
337 337
                 prefixTable('sharekeys_items'),
338 338
                 0,
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         // Loop on all encrypted fields for this item
349 349
         // and encrypt them for each user
350 350
         if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
351
-        foreach($args['fields_keys'] as $field) {
351
+        foreach ($args['fields_keys'] as $field) {
352 352
             storeUsersShareKey(
353 353
                 prefixTable('sharekeys_fields'),
354 354
                 0,
@@ -400,6 +400,6 @@  discard block
 block discarded – undo
400 400
     DB::query(
401 401
         'DELETE FROM '.prefixTable('items_edition').'
402 402
         WHERE timestamp < %i',
403
-        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition']*60) : time() - EDITION_LOCK_PERIOD
403
+        ($SETTINGS['delay_item_edition'] > 0) ? time() - ($SETTINGS['delay_item_edition'] * 60) : time() - EDITION_LOCK_PERIOD
404 404
     );
405 405
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
 if (DB::count() > 0) {
85 85
     // handle tasks inside this process
86
-    if (WIP === true) error_log("Process in progress: ".$process_to_perform['increment_id']);
86
+    if (WIP === true) {
87
+        error_log("Process in progress: ".$process_to_perform['increment_id']);
88
+    }
87 89
     handleTask(
88 90
         $process_to_perform['increment_id'],
89 91
         json_decode($process_to_perform['arguments'], true),
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
     );
101 103
     
102 104
     if (DB::count() > 0) {
103
-        if (WIP === true) error_log("New process ta start: ".$process_to_perform['increment_id']);
105
+        if (WIP === true) {
106
+            error_log("New process ta start: ".$process_to_perform['increment_id']);
107
+        }
104 108
         // update DB - started_at
105 109
         DB::update(
106 110
             prefixTable('background_tasks'),
@@ -153,8 +157,9 @@  discard block
 block discarded – undo
153 157
         );
154 158
 
155 159
         // No more tasks, exit
156
-        if ($process_to_perform !== 1)
157
-            break;
160
+        if ($process_to_perform !== 1) {
161
+                    break;
162
+        }
158 163
 
159 164
         // Run next task
160 165
         $process = new Symfony\Component\Process\Process([
@@ -331,7 +336,9 @@  discard block
 block discarded – undo
331 336
     if ($args['step'] === 'create_users_files_key') {
332 337
         // Loop on all files for this item
333 338
         // and encrypt them for each user
334
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
339
+        if (WIP === true) {
340
+            provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
341
+        }
335 342
         foreach($args['files_keys'] as $file) {
336 343
             storeUsersShareKey(
337 344
                 prefixTable('sharekeys_items'),
@@ -347,7 +354,9 @@  discard block
 block discarded – undo
347 354
     } elseif ($args['step'] === 'create_users_fields_key') {
348 355
         // Loop on all encrypted fields for this item
349 356
         // and encrypt them for each user
350
-        if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
357
+        if (WIP === true) {
358
+            provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
359
+        }
351 360
         foreach($args['fields_keys'] as $field) {
352 361
             storeUsersShareKey(
353 362
                 prefixTable('sharekeys_fields'),
Please login to merge, or discard this patch.
sources/logs.datatables.php 1 patch
Spacing   +23 added lines, -24 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 ) {
77 77
     // Not allowed page
78 78
     $session->set('system-error_code', ERR_NOT_ALLOWED);
79
-    include $SETTINGS['cpassman_dir'] . '/error.php';
79
+    include $SETTINGS['cpassman_dir'].'/error.php';
80 80
     exit;
81 81
 }
82 82
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     
169 169
     // Output
170 170
     $sOutput = '{';
171
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
171
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
172 172
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
173 173
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
174 174
     $sOutput .= '"aaData": ';
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
     // Output
243 243
     $sOutput = '{';
244
-    $sOutput .= '"sEcho": '. $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
244
+    $sOutput .= '"sEcho": '.$request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
245 245
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
246 246
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
247 247
     $sOutput .= '"aaData": ';
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
     // Output
316 316
     $sOutput = '{';
317
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
317
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
318 318
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
319 319
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
320 320
     $sOutput .= '"aaData": ';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     // Output
389 389
     $sOutput = '{';
390
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
390
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
391 391
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
392 392
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
393 393
     $sOutput .= '"aaData": [ ';
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
     // Output
492 492
     $sOutput = '{';
493
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
493
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
494 494
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
495 495
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
496 496
     $sOutput .= '"aaData": [ ';
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         $iTotal = 0;
573 573
     }
574 574
     $sOutput = '{';
575
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
575
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
576 576
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
577 577
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
578 578
     $sOutput .= '"aaData": ';
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 
649 649
     // Output
650 650
     $sOutput = '{';
651
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
651
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
652 652
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
653 653
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
654 654
     $sOutput .= '"aaData": ';
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 
718 718
     // Output
719 719
     $sOutput = '{';
720
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
720
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
721 721
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
722 722
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
723 723
     $sOutput .= '"aaData": ';
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
     // Output
793 793
     $sOutput = '{';
794
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
794
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
795 795
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
796 796
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
797 797
     $sOutput .= '"aaData": ';
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
             FROM '.prefixTable('background_tasks').' AS p 
869 869
             LEFT JOIN '.prefixTable('users').' AS u ON %l
870 870
             WHERE %l ORDER BY %l %l LIMIT %i, %i';
871
-    $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
871
+    $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
872 872
 
873 873
     // Get the records
874 874
     $rows = DB::query($sql, ...$params);
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
     // Output
878 878
     $sOutput = '{';
879
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
879
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
880 880
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
881 881
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
882 882
     $sOutput .= '"aaData": ';
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
         //col1
892 892
         $sOutput .= '"<span data-done=\"'.$record['is_in_progress'].'\" data-type=\"'.$record['process_type'].'\" data-process-id=\"'.$record['increment_id'].'\"></span>", ';
893 893
         //col2
894
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
894
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
895 895
         //col3
896 896
         //$sOutput .= '"'.($record['updated_at'] === '' ? '-' : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['updated_at'])).'", ';
897 897
         $sOutput .= '"<div class=\"progress mt-2\"><div class=\"progress-bar\" style=\"width: '.$subtaskProgress.'\">'.$subtaskProgress.'</div></div>", ';
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
         // col5
902 902
         if (in_array($record['process_type'], array('create_user_keys', 'item_copy')) === true) {
903 903
             $data_user = DB::queryfirstrow(
904
-                'SELECT name, lastname FROM ' . prefixTable('users') . '
904
+                'SELECT name, lastname FROM '.prefixTable('users').'
905 905
                 WHERE id = %i',
906 906
                 json_decode($record['arguments'], true)['new_user_id']
907 907
             );
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
     FROM '.prefixTable('background_tasks').' AS p 
958 958
     LEFT JOIN '.prefixTable('users').' AS u ON %l
959 959
     WHERE %l ORDER BY %l %l LIMIT %i, %i';
960
-    $params = ['u.id = json_extract(p.arguments, "$[0]")',$sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
960
+    $params = ['u.id = json_extract(p.arguments, "$[0]")', $sWhere, $orderColumn, $orderDirection, $sLimitStart, $sLimitLength];
961 961
 
962 962
     // Get the records
963 963
     $rows = DB::query($sql, ...$params);
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 
966 966
     // Output
967 967
     $sOutput = '{';
968
-    $sOutput .= '"sEcho": '. (int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT) . ', ';
968
+    $sOutput .= '"sEcho": '.(int) $request->query->filter('draw', FILTER_SANITIZE_NUMBER_INT).', ';
969 969
     $sOutput .= '"iTotalRecords": '.$iTotal.', ';
970 970
     $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
971 971
     $sOutput .= '"aaData": ';
@@ -981,13 +981,12 @@  discard block
 block discarded – undo
981 981
         //col1
982 982
         $sOutput .= '"", ';
983 983
         //col2
984
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ';
984
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ';
985 985
         //col3
986 986
         $sOutput .= is_null($record['started_at']) === false ?
987
-            ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['started_at']).'", ') :
988
-                ('"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['created_at']).'", ');
987
+            ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['started_at']).'", ') : ('"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['created_at']).'", ');
989 988
         //col4
990
-        $sOutput .= '"'.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['finished_at']).'", ';
989
+        $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['finished_at']).'", ';
991 990
         // col7
992 991
         $sOutput .= '"'.gmdate('H:i:s', (int) $record['finished_at'] - (is_null($record['started_at']) === false ? (int) $record['started_at'] : (int) $record['created_at'])).'",';
993 992
         //col5
@@ -1006,7 +1005,7 @@  discard block
 block discarded – undo
1006 1005
         $newUserId = array_key_exists('new_user_id', $arguments) ? $arguments['new_user_id'] : null;
1007 1006
         if ($record['process_type'] === 'create_user_keys' && is_null($newUserId) === false && empty($newUserId) === false) {
1008 1007
             $data_user = DB::queryfirstrow(
1009
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1008
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1010 1009
                 WHERE id = %i',
1011 1010
                 $newUserId
1012 1011
             );
@@ -1022,7 +1021,7 @@  discard block
 block discarded – undo
1022 1021
         } elseif ($record['process_type'] === 'user_build_cache_tree') {
1023 1022
             $user = json_decode($record['arguments'], true)['user_id'];
1024 1023
             $data_user = DB::queryfirstrow(
1025
-                'SELECT name, lastname, login FROM ' . prefixTable('users') . '
1024
+                'SELECT name, lastname, login FROM '.prefixTable('users').'
1026 1025
                 WHERE id = %i',
1027 1026
                 $user
1028 1027
             );
@@ -1056,7 +1055,7 @@  discard block
 block discarded – undo
1056 1055
 {
1057 1056
     $subtasks = DB::query(
1058 1057
         'SELECT *
1059
-        FROM ' . prefixTable('background_subtasks') . '
1058
+        FROM ' . prefixTable('background_subtasks').'
1060 1059
         WHERE task_id = %i',
1061 1060
         $id
1062 1061
     );
@@ -1072,5 +1071,5 @@  discard block
 block discarded – undo
1072 1071
         $i++;
1073 1072
     }
1074 1073
 
1075
-    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0) .'%';
1074
+    return ($finished_nb !== 0 ? pourcentage($finished_nb, $nb, 100) : 0).'%';
1076 1075
 }
1077 1076
\ No newline at end of file
Please login to merge, or discard this patch.
sources/upload.files.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 ) {
77 77
     // Not allowed page
78 78
     $session->set('system-error_code', ERR_NOT_ALLOWED);
79
-    include $SETTINGS['cpassman_dir'] . '/error.php';
79
+    include $SETTINGS['cpassman_dir'].'/error.php';
80 80
     exit;
81 81
 }
82 82
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     } else {
131 131
         // check if token is expired
132 132
         $data = DB::queryFirstRow(
133
-            'SELECT end_timestamp FROM ' . prefixTable('tokens') . ' WHERE user_id = %i AND token = %s',
133
+            'SELECT end_timestamp FROM '.prefixTable('tokens').' WHERE user_id = %i AND token = %s',
134 134
             $session->get('user-id'),
135 135
             $post_user_token
136 136
         );
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 // HTTP headers for no cache etc
156 156
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
157
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
157
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
158 158
 header('Cache-Control: no-store, no-cache, must-revalidate');
159 159
 header('Cache-Control: post-check=0, pre-check=0', false);
160 160
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     }
167 167
 
168 168
     // Set directory used to store file
169
-    $targetDir = realpath($SETTINGS['cpassman_dir'] . '/includes/avatars');
169
+    $targetDir = realpath($SETTINGS['cpassman_dir'].'/includes/avatars');
170 170
 } else {
171 171
     $targetDir = realpath($SETTINGS['path_to_files_folder']);
172 172
 }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     $file_name = preg_replace('/[^a-zA-Z0-9-_\.]/', '', strtolower(basename($file->getClientOriginalName())));
220 220
     
221 221
     if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
222
-        error_log('Invalid file name: ' . $file_name . '.');
222
+        error_log('Invalid file name: '.$file_name.'.');
223 223
         echo handleUploadError('Invalid file name provided.');
224 224
         return false;
225 225
     }
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
             $ext = strtolower($ext);
234 234
         } else {
235 235
             // Case where the file extension is not a string
236
-            error_log('Invalid file name: ' . $file_name . '.');
236
+            error_log('Invalid file name: '.$file_name.'.');
237 237
             echo handleUploadError('Invalid file extension.');
238 238
             return false;
239 239
         }
240 240
     } else {
241 241
         // Case where the file name is not a string
242
-        error_log('Invalid file name: ' . $file_name . '.');
242
+        error_log('Invalid file name: '.$file_name.'.');
243 243
         echo handleUploadError('Invalid file.');
244 244
         return false;
245 245
     }
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
     // Validate against a list of allowed extensions
248 248
     $allowed_extensions = explode(
249 249
         ',',
250
-        $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
251
-            ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
250
+        $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
251
+            ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
252 252
     );
253 253
     if (
254 254
         !in_array($ext, $allowed_extensions) 
@@ -267,25 +267,25 @@  discard block
 block discarded – undo
267 267
 
268 268
 // is destination folder writable
269 269
 if (is_writable($SETTINGS['path_to_files_folder']) === false) {
270
-    echo handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.');
270
+    echo handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.');
271 271
     return false;
272 272
 }
273 273
 
274 274
 // Make sure the fileName is unique but only if chunking is disabled
275
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
275
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
276 276
     // $ext is guaranteed to be a string due to prior checks
277 277
     $fileNameA = substr($fileName, 0, strlen(/** @scrutinizer ignore-type */$ext));
278 278
     $fileNameB = substr($fileName, strlen(/** @scrutinizer ignore-type */$ext));
279 279
 
280 280
     $count = 1;
281
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
281
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
282 282
         ++$count;
283 283
     }
284 284
 
285
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
285
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
286 286
 }
287 287
 
288
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
288
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
289 289
 
290 290
 // Create target dir
291 291
 if (!file_exists($targetDir)) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 // Remove old temp files
300 300
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
301 301
     while (($fileClean = readdir($dir)) !== false) {
302
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $fileClean;
302
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$fileClean;
303 303
 
304 304
         // Remove temp file if it is older than the max age and is not the current file
305 305
         if (
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
     closedir($dir);
315 315
 } else {
316
-    echo handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.');
316
+    echo handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.');
317 317
     return false;
318 318
 }
319 319
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 
354 354
                 // Safe destination folder
355 355
                 $uploadDir = realpath($SETTINGS['path_to_upload_folder']);
356
-                $destinationPath = $uploadDir . DIRECTORY_SEPARATOR . $fileName;
356
+                $destinationPath = $uploadDir.DIRECTORY_SEPARATOR.$fileName;
357 357
                 
358 358
                 if (move_uploaded_file($tmpFilePath, $destinationPath)) {
359 359
                     // Open the moved file in read mode
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             return false;
395 395
         }
396 396
     } else {
397
-        echo handleUploadError('Failed to move uploaded file to ' . $SETTINGS['path_to_files_folder'] . '.');
397
+        echo handleUploadError('Failed to move uploaded file to '.$SETTINGS['path_to_files_folder'].'.');
398 398
         return false;
399 399
     }
400 400
 } else {
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
                 fwrite($out, $buff);
411 411
             }
412 412
         } else {
413
-            echo handleUploadError('Failed to open input stream ' . $SETTINGS['path_to_files_folder'] . '.');
413
+            echo handleUploadError('Failed to open input stream '.$SETTINGS['path_to_files_folder'].'.');
414 414
             return false;
415 415
         }
416 416
 
417 417
         fclose($in);
418 418
         fclose($out);
419 419
     } else {
420
-        echo handleUploadError('Failed to open output stream ' . $SETTINGS['path_to_files_folder'] . '.');
420
+        echo handleUploadError('Failed to open output stream '.$SETTINGS['path_to_files_folder'].'.');
421 421
         return false;
422 422
     }
423 423
 }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 ) {
451 451
     rename(
452 452
         $filePath,
453
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
453
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
454 454
     );
455 455
 
456 456
     // Add in DB
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 ) {
480 480
     rename(
481 481
         $filePath,
482
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
482
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
483 483
     );
484 484
 
485 485
     // Add in DB
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
     // rename the file
513 513
     rename(
514 514
         $filePath,
515
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext
515
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext
516 516
     );
517 517
 
518 518
     // make thumbnail
519 519
     $ret = makeThumbnail(
520
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext,
521
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '_thumb' . '.' . $ext,
520
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext,
521
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'_thumb'.'.'.$ext,
522 522
         40
523 523
     );
524 524
 
@@ -530,21 +530,21 @@  discard block
 block discarded – undo
530 530
     }
531 531
 
532 532
     // get current avatar and delete it
533
-    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM ' . prefixTable('users') . ' WHERE id=%i', $session->get('user-id'));
534
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar'], $SETTINGS);
535
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar_thumb'], $SETTINGS);
533
+    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM '.prefixTable('users').' WHERE id=%i', $session->get('user-id'));
534
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar'], $SETTINGS);
535
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar_thumb'], $SETTINGS);
536 536
 
537 537
     // store in DB the new avatar
538 538
     DB::query(
539
-        'UPDATE ' . prefixTable('users') . "
540
-        SET avatar='" . $newFileName . '.' . $ext . "', avatar_thumb='" . $newFileName . '_thumb' . '.' . $ext . "'
539
+        'UPDATE '.prefixTable('users')."
540
+        SET avatar='" . $newFileName.'.'.$ext."', avatar_thumb='".$newFileName.'_thumb'.'.'.$ext."'
541 541
         WHERE id=%i",
542 542
         $session->get('user-id')
543 543
     );
544 544
 
545 545
     // store in session
546
-    $session->set('user-avatar', $newFileName . '.' . $ext);
547
-    $session->set('user-avatar_thumb', $newFileName . '_thumb' . '.' . $ext);
546
+    $session->set('user-avatar', $newFileName.'.'.$ext);
547
+    $session->set('user-avatar_thumb', $newFileName.'_thumb'.'.'.$ext);
548 548
 
549 549
     // return info
550 550
     echo prepareExchangedData(
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 ) {
564 564
     rename(
565 565
         $filePath,
566
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
566
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
567 567
     );
568 568
 
569 569
     // Add in DB
Please login to merge, or discard this patch.
pages/profile.js.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) {
74 74
     // Not allowed page
75 75
     $session->set('system-error_code', ERR_NOT_ALLOWED);
76
-    include $SETTINGS['cpassman_dir'] . '/error.php';
76
+    include $SETTINGS['cpassman_dir'].'/error.php';
77 77
     exit;
78 78
 }
79 79
 ?>
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     })
98 98
 
99 99
     // Select user properties
100
-    $('#profile-user-language option[value=<?php echo $session->get('user-language');?>').attr('selected','selected');
100
+    $('#profile-user-language option[value=<?php echo $session->get('user-language'); ?>').attr('selected','selected');
101 101
 
102 102
 
103 103
     // AVATAR IMPORT
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
                     // reload page in case of language change
297 297
                     if ($('#profile-user-language').val()
298
-                        && $('#profile-user-language').val().toLowerCase() !== '<?php echo $session->get('user-language');?>') {
298
+                        && $('#profile-user-language').val().toLowerCase() !== '<?php echo $session->get('user-language'); ?>') {
299 299
                         // prepare reload
300 300
                         $(this).delay(3000).queue(function() {
301 301
                             document.location.href = "index.php?page=profile";
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                         // Inform user
307 307
                         toastr.remove();
308 308
                         toastr.info(
309
-                            '<?php echo $lang->get('alert_page_will_reload') . ' ... ' . $lang->get('please_wait'); ?>',
309
+                            '<?php echo $lang->get('alert_page_will_reload').' ... '.$lang->get('please_wait'); ?>',
310 310
                             '', {
311 311
                                 timeOut: 3000,
312 312
                                 progressBar: true
@@ -410,27 +410,27 @@  discard block
 block discarded – undo
410 410
         "defaultText": "<?php echo $lang->get('index_pw_level_txt'); ?>",
411 411
         "ratings": [
412 412
             {
413
-                "minScore": <?php echo TP_PW_STRENGTH_1;?>,
413
+                "minScore": <?php echo TP_PW_STRENGTH_1; ?>,
414 414
                 "className": "meterWarn",
415 415
                 "text": "<?php echo $lang->get('complex_level1'); ?>"
416 416
             },
417 417
             {
418
-                "minScore": <?php echo TP_PW_STRENGTH_2;?>,
418
+                "minScore": <?php echo TP_PW_STRENGTH_2; ?>,
419 419
                 "className": "meterWarn",
420 420
                 "text": "<?php echo $lang->get('complex_level2'); ?>"
421 421
             },
422 422
             {
423
-                "minScore": <?php echo TP_PW_STRENGTH_3;?>,
423
+                "minScore": <?php echo TP_PW_STRENGTH_3; ?>,
424 424
                 "className": "meterGood",
425 425
                 "text": "<?php echo $lang->get('complex_level3'); ?>"
426 426
             },
427 427
             {
428
-                "minScore": <?php echo TP_PW_STRENGTH_4;?>,
428
+                "minScore": <?php echo TP_PW_STRENGTH_4; ?>,
429 429
                 "className": "meterGood",
430 430
                 "text": "<?php echo $lang->get('complex_level4'); ?>"
431 431
             },
432 432
             {
433
-                "minScore": <?php echo TP_PW_STRENGTH_5;?>,
433
+                "minScore": <?php echo TP_PW_STRENGTH_5; ?>,
434 434
                 "className": "meterExcel",
435 435
                 "text": "<?php echo $lang->get('complex_level5'); ?>"
436 436
             }
@@ -523,27 +523,27 @@  discard block
 block discarded – undo
523 523
         "defaultText": "<?php echo $lang->get('index_pw_level_txt'); ?>",
524 524
         "ratings": [
525 525
             {
526
-                "minScore": <?php echo TP_PW_STRENGTH_1;?>,
526
+                "minScore": <?php echo TP_PW_STRENGTH_1; ?>,
527 527
                 "className": "meterWarn",
528 528
                 "text": "<?php echo $lang->get('complex_level1'); ?>"
529 529
             },
530 530
             {
531
-                "minScore": <?php echo TP_PW_STRENGTH_2;?>,
531
+                "minScore": <?php echo TP_PW_STRENGTH_2; ?>,
532 532
                 "className": "meterWarn",
533 533
                 "text": "<?php echo $lang->get('complex_level2'); ?>"
534 534
             },
535 535
             {
536
-                "minScore": <?php echo TP_PW_STRENGTH_3;?>,
536
+                "minScore": <?php echo TP_PW_STRENGTH_3; ?>,
537 537
                 "className": "meterGood",
538 538
                 "text": "<?php echo $lang->get('complex_level3'); ?>"
539 539
             },
540 540
             {
541
-                "minScore": <?php echo TP_PW_STRENGTH_4;?>,
541
+                "minScore": <?php echo TP_PW_STRENGTH_4; ?>,
542 542
                 "className": "meterGood",
543 543
                 "text": "<?php echo $lang->get('complex_level4'); ?>"
544 544
             },
545 545
             {
546
-                "minScore": <?php echo TP_PW_STRENGTH_5;?>,
546
+                "minScore": <?php echo TP_PW_STRENGTH_5; ?>,
547 547
                 "className": "meterExcel",
548 548
                 "text": "<?php echo $lang->get('complex_level5'); ?>"
549 549
             }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         }
560 560
     });
561 561
 
562
-    $('#profile-keys_download-date').text('<?php echo null === $session->get('user-keys_recovery_time') ? $lang->get('none') : date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $session->get('user-keys_recovery_time')); ?>');
562
+    $('#profile-keys_download-date').text('<?php echo null === $session->get('user-keys_recovery_time') ? $lang->get('none') : date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $session->get('user-keys_recovery_time')); ?>');
563 563
 
564 564
     $("#open-dialog-keys-download").on('click', function(event) {
565 565
         event.preventDefault();
Please login to merge, or discard this patch.
pages/items.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('items') === false) {
70 70
     // Not allowed page
71 71
     $session->set('system-error_code', ERR_NOT_ALLOWED);
72
-    include $SETTINGS['cpassman_dir'] . '/error.php';
72
+    include $SETTINGS['cpassman_dir'].'/error.php';
73 73
     exit;
74 74
 }
75 75
 // Define Timezone
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 // Get list of users
92 92
 $usersList = [];
93
-$rows = DB::query('SELECT id,login,email FROM ' . prefixTable('users') . ' ORDER BY login ASC');
93
+$rows = DB::query('SELECT id,login,email FROM '.prefixTable('users').' ORDER BY login ASC');
94 94
 foreach ($rows as $record) {
95 95
     $usersList[$record['login']] = [
96 96
         'id' => $record['id'],
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 // Get list of roles
102 102
 $arrRoles = [];
103 103
 $listRoles = '';
104
-$rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC');
104
+$rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC');
105 105
 foreach ($rows as $reccord) {
106 106
     $arrRoles[$reccord['title']] = [
107 107
         'id' => $reccord['id'],
108 108
         'title' => $reccord['title'],
109 109
     ];
110 110
     if (empty($listRoles)) {
111
-        $listRoles = $reccord['id'] . '#' . $reccord['title'];
111
+        $listRoles = $reccord['id'].'#'.$reccord['title'];
112 112
     } else {
113
-        $listRoles .= ';' . $reccord['id'] . '#' . $reccord['title'];
113
+        $listRoles .= ';'.$reccord['id'].'#'.$reccord['title'];
114 114
     }
115 115
 }
116 116
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                         <li class="nav-item"><a class="nav-link" href="#tab_3" data-toggle="tab"><i class="fa-solid fa-archive mr-2"></i><?php echo $lang->get('attachments'); ?></a></li>
186 186
                         <?php
187 187
                         echo isset($SETTINGS['item_extra_fields']) === true && (int) $SETTINGS['item_extra_fields'] === 1 ? '
188
-                            <li class="nav-item"><a class="nav-link" href="#tab_4" data-toggle="tab"><i class="fa-solid fa-cubes mr-2"></i>' . $lang->get('fields') . '</a></li>' : '';
188
+                            <li class="nav-item"><a class="nav-link" href="#tab_4" data-toggle="tab"><i class="fa-solid fa-cubes mr-2"></i>' . $lang->get('fields').'</a></li>' : '';
189 189
                         ?>
190 190
                     </ul>
191 191
                 </div><!-- /.card-header -->
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                                                 <?php
255 255
                                                 for ($i = 4; $i <= $SETTINGS['pwd_maximum_length']; ++$i) {
256 256
                                                     echo '
257
-                                                <option>' . $i . '</option>';
257
+                                                <option>' . $i.'</option>';
258 258
                                                 }
259 259
                                                 ?>
260 260
                                             </select>
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                                     <span class="ml-2 col-md-1 clear-me-html" id="form-item-icon-show"></span>
285 285
                                 </div>
286 286
                                 <small class='form-text text-muted'>
287
-                                    <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
287
+                                    <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
288 288
                                 </small>
289 289
                             </div>
290 290
 
@@ -472,39 +472,39 @@  discard block
 block discarded – undo
472 472
                             <div class="tab-pane" id="tab_4">
473 473
                                 <div id="form-item-field" class="hidden">
474 474
                                     <?php
475
-                                        $session_item_fields = $session->get('system-item_fields');//print_r($session_item_fields);
475
+                                        $session_item_fields = $session->get('system-item_fields'); //print_r($session_item_fields);
476 476
                                         if (isset($session_item_fields) === true) {
477 477
                                             foreach ($session_item_fields as $category) {
478 478
                                                 //print_r($category);
479 479
                                                 echo '
480
-                                            <div class="callout callout-info form-item-category hidden" id="form-item-category-' . $category['id'] . '">
481
-                                                <h5>' . $category['title'] . '</h5>
480
+                                            <div class="callout callout-info form-item-category hidden" id="form-item-category-' . $category['id'].'">
481
+                                                <h5>' . $category['title'].'</h5>
482 482
                                                 <p>';
483 483
                                                 foreach ($category['fields'] as $field) {
484 484
                                                     if ($field['type'] === 'textarea') {
485 485
                                                         echo '
486
-                                                    <div class="form-group mb-3 form-item-field" id="form-item-field-' . $field['id'] . '" data-field-id="' . $field['id'] . '">
486
+                                                    <div class="form-group mb-3 form-item-field" id="form-item-field-' . $field['id'].'" data-field-id="'.$field['id'].'">
487 487
                                                         <label>' . $field['title'],
488 488
                                                             $field['is_mandatory'] === '1' ?
489
-                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="' . $lang->get('is_mandatory') . '"></span>' : '',
489
+                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="'.$lang->get('is_mandatory').'"></span>' : '',
490 490
                                                             '</label>
491
-                                                        <textarea class="form-control form-item-control form-item-field-custom" rows="2" data-field-name="' . $field['id'] . '" data-field-mandatory="' . $field['is_mandatory'] . '" data-field-regex="' . $field['regex'] . '" data-change-ongoing="0"></textarea>
491
+                                                        <textarea class="form-control form-item-control form-item-field-custom" rows="2" data-field-name="' . $field['id'].'" data-field-mandatory="'.$field['is_mandatory'].'" data-field-regex="'.$field['regex'].'" data-change-ongoing="0"></textarea>
492 492
                                                     </div>';
493 493
                                                     } else {
494 494
                                                         echo '
495
-                                                    <div class="input-group mb-3 form-item-field" id="form-item-field-' . $field['id'] . '" data-field-id="' . $field['id'] . '">
495
+                                                    <div class="input-group mb-3 form-item-field" id="form-item-field-' . $field['id'].'" data-field-id="'.$field['id'].'">
496 496
                                                         <div class="input-group-prepend">
497 497
                                                             <span class="input-group-text">' . $field['title'],
498 498
                                                             $field['is_mandatory'] === '1' ?
499
-                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="' . $lang->get('is_mandatory') . '"></span>' : '',
499
+                                                                '<span class="fa-solid fa-fire text-danger ml-1 infotip" title="'.$lang->get('is_mandatory').'"></span>' : '',
500 500
                                                             '</span>
501 501
                                                         </div>
502
-                                                        <input type="' . $field['type'] . '" class="form-control form-item-control form-item-field-custom" data-field-name="' . $field['id'] . '" data-field-mandatory="' . $field['is_mandatory'] . '" data-field-regex="' . $field['regex'] . '" data-change-ongoing="0">
502
+                                                        <input type="' . $field['type'].'" class="form-control form-item-control form-item-field-custom" data-field-name="'.$field['id'].'" data-field-mandatory="'.$field['is_mandatory'].'" data-field-regex="'.$field['regex'].'" data-change-ongoing="0">
503 503
                                                     </div>';
504 504
                                                     }
505 505
                                                     if (!empty($field['regex'])) {
506 506
                                                         echo '
507
-                                                    <div>Regex: '. $field['regex'] .'</div>
507
+                                                    <div>Regex: '. $field['regex'].'</div>
508 508
                                                         ';
509 509
                                                     }
510 510
                                                 }
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
                                                 ) {
516 516
                                                     echo '
517 517
                                                     <div class="form-check icheck-blue">
518
-                                                        <input type="checkbox" class="form-check-input form-check-input-template form-item-control flat-blue" data-category-id="' . $category['id'] . '" data-change-ongoing="0" data-field-name="template" id="template_' . $category['id'] . '">
519
-                                                        <label class="form-check-label ml-3" for="template_' . $category['id'] . '">' . $lang->get('main_template') . '</label>
518
+                                                        <input type="checkbox" class="form-check-input form-check-input-template form-item-control flat-blue" data-category-id="' . $category['id'].'" data-change-ongoing="0" data-field-name="template" id="template_'.$category['id'].'">
519
+                                                        <label class="form-check-label ml-3" for="template_' . $category['id'].'">'.$lang->get('main_template').'</label>
520 520
                                                     </div>';
521 521
                                                 }
522 522
                                                 echo '
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
                                         } else {
527 527
                                             echo
528 528
                                             '<div class="alert alert-info">
529
-                                                <h5><i class="icon fa fa-info mr-3"></i>' . $lang->get('information') . '</h5>
530
-                                                ' . $lang->get('no_fields') . '
529
+                                                <h5><i class="icon fa fa-info mr-3"></i>' . $lang->get('information').'</h5>
530
+                                                ' . $lang->get('no_fields').'
531 531
                                             </div>';
532 532
                                         } ?>
533 533
                                 </div>
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                         <p><?php
669 669
                             echo str_replace(
670 670
         ['##otv_expiration_period##', '. '],
671
-        ['<span class="text-bold text-primary">' . $SETTINGS['otv_expiration_period'] . '</span>', '<br>'],
671
+        ['<span class="text-bold text-primary">'.$SETTINGS['otv_expiration_period'].'</span>', '<br>'],
672 672
         $lang->get('otv_message')
673 673
     );
674 674
                             ?></p>
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
 
687 687
                     <div class="row">
688 688
                         <div class="form-group col-4">
689
-                            <label for="form-item-otv-days"><i class="fa-regular fa-calendar-days mr-2"></i><?php echo $lang->get('number_of_days'); ?> (<?php echo $lang->get('maximum').': '.$SETTINGS['otv_expiration_period'];?>)</label>
689
+                            <label for="form-item-otv-days"><i class="fa-regular fa-calendar-days mr-2"></i><?php echo $lang->get('number_of_days'); ?> (<?php echo $lang->get('maximum').': '.$SETTINGS['otv_expiration_period']; ?>)</label>
690 690
                             <div class="input-group mb-3">
691
-                                <input type="number" class="form-control clear-me-val" id="form-item-otv-days" min="0" max="<?php echo $SETTINGS['otv_expiration_period'];?>" value="<?php echo $SETTINGS['otv_expiration_period'];?>">
691
+                                <input type="number" class="form-control clear-me-val" id="form-item-otv-days" min="0" max="<?php echo $SETTINGS['otv_expiration_period']; ?>" value="<?php echo $SETTINGS['otv_expiration_period']; ?>">
692 692
                             </div>
693 693
                         </div>
694 694
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
                             <select class="form-control form-folder-control select2" style="width:100%;" id="form-folder-add-complexicity" required>
777 777
                                 <?php
778 778
                                 foreach (TP_PW_COMPLEXITY as $key => $value) {
779
-                                    echo '<option value="' . $key . '">' . $value[1] . '</option>';
779
+                                    echo '<option value="'.$key.'">'.$value[1].'</option>';
780 780
                                 }
781 781
                                 ?>
782 782
                             </select>
@@ -794,14 +794,14 @@  discard block
 block discarded – undo
794 794
                             <label><?php echo $lang->get('icon'); ?></label>
795 795
                             <input type="text" class="form-control form-folder-control" id="form-folder-add-icon">
796 796
                             <small class='form-text text-muted'>
797
-                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
797
+                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
798 798
                             </small>
799 799
                         </div>
800 800
                         <div class="form-group">
801 801
                             <label><?php echo $lang->get('icon_on_selection'); ?></label>
802 802
                             <input type="text" class="form-control form-folder-control" id="form-folder-add-icon-selected">
803 803
                             <small class='form-text text-muted'>
804
-                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
804
+                                <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fa-solid fa-external-link-alt ml-1"></i></a>
805 805
                             </small>
806 806
                         </div>
807 807
                     </div>
@@ -1212,18 +1212,18 @@  discard block
 block discarded – undo
1212 1212
                                 <?php
1213 1213
                                     foreach ($session_item_fields as $elem) {
1214 1214
                                         echo '
1215
-                                <div class="callout callout-info card-item-category hidden" id="card-item-category-' . $elem['id'] . '">
1216
-                                    <h5>' . $elem['title'] . '</h5>
1215
+                                <div class="callout callout-info card-item-category hidden" id="card-item-category-' . $elem['id'].'">
1216
+                                    <h5>' . $elem['title'].'</h5>
1217 1217
                                     <p>
1218 1218
                                         <ul class="list-group list-group-unbordered mb-3">';
1219 1219
                                         foreach ($elem['fields'] as $field) {
1220 1220
                                             echo '
1221
-                                            <li class="list-group-item card-item-field hidden" id="card-item-field-' . $field['id'] . '">
1222
-                                                <span id="card-item-field-title-' . $field['id'] . '"><b>' . $field['title'] . '</b></span>
1223
-                                                <button type="button" class="float-right btn btn-secondary btn-sm ml-1 btn-copy-clipboard-clear"  data-clipboard-target="card-item-field-value-' . $field['id'] . '">
1221
+                                            <li class="list-group-item card-item-field hidden" id="card-item-field-' . $field['id'].'">
1222
+                                                <span id="card-item-field-title-' . $field['id'].'"><b>'.$field['title'].'</b></span>
1223
+                                                <button type="button" class="float-right btn btn-secondary btn-sm ml-1 btn-copy-clipboard-clear"  data-clipboard-target="card-item-field-value-' . $field['id'].'">
1224 1224
                                                     <i class="fa-solid fa-copy"></i>
1225 1225
                                                 </button>
1226
-                                                <span class="card-item-field-value float-right ml-1" id="card-item-field-value-' . $field['id'] . '"></span>
1226
+                                                <span class="card-item-field-value float-right ml-1" id="card-item-field-value-' . $field['id'].'"></span>
1227 1227
                                             </li>';
1228 1228
                                         }
1229 1229
                                         echo '
Please login to merge, or discard this patch.
scripts/task_maintenance_clean_orphan_objects.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -126,64 +126,64 @@
 block discarded – undo
126 126
 
127 127
     // Delete all item keys for which no user exist
128 128
     DB::query(
129
-        'DELETE k FROM ' . prefixTable('sharekeys_items') . ' k
130
-        LEFT JOIN ' . prefixTable('users') . ' u ON k.user_id = u.id
129
+        'DELETE k FROM '.prefixTable('sharekeys_items').' k
130
+        LEFT JOIN ' . prefixTable('users').' u ON k.user_id = u.id
131 131
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
132 132
     );
133 133
 
134 134
     // Delete all files keys for which no user exist
135 135
     DB::query(
136
-        'DELETE k FROM ' . prefixTable('sharekeys_files') . ' k
137
-        LEFT JOIN ' . prefixTable('users') . ' u ON k.user_id = u.id
136
+        'DELETE k FROM '.prefixTable('sharekeys_files').' k
137
+        LEFT JOIN ' . prefixTable('users').' u ON k.user_id = u.id
138 138
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
139 139
     );
140 140
 
141 141
     // Delete all fields keys for which no user exist
142 142
     DB::query(
143
-        'DELETE k FROM ' . prefixTable('sharekeys_fields') . ' k
144
-        LEFT JOIN ' . prefixTable('users') . ' u ON k.user_id = u.id
143
+        'DELETE k FROM '.prefixTable('sharekeys_fields').' k
144
+        LEFT JOIN ' . prefixTable('users').' u ON k.user_id = u.id
145 145
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
146 146
     );
147 147
 
148 148
     // Delete all item logs for which no user exist
149 149
     DB::query(
150
-        'DELETE l FROM ' . prefixTable('log_items') . ' l
151
-        LEFT JOIN ' . prefixTable('users') . ' u ON l.id_user = u.id
150
+        'DELETE l FROM '.prefixTable('log_items').' l
151
+        LEFT JOIN ' . prefixTable('users').' u ON l.id_user = u.id
152 152
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
153 153
     );
154 154
 
155 155
     // Delete all system logs for which no user exist
156 156
     DB::query(
157
-        'DELETE l FROM ' . prefixTable('log_system') . ' l
158
-        LEFT JOIN ' . prefixTable('users') . ' u ON l.qui = u.id
157
+        'DELETE l FROM '.prefixTable('log_system').' l
158
+        LEFT JOIN ' . prefixTable('users').' u ON l.qui = u.id
159 159
         WHERE u.id IS NULL OR u.deleted_at IS NOT NULL'
160 160
     );
161 161
 
162 162
     // Delete all item keys for which no object exist
163 163
     DB::query(
164
-        'DELETE k FROM ' . prefixTable('sharekeys_items') . ' k
165
-        LEFT JOIN ' . prefixTable('items') . ' i ON k.object_id = i.id
164
+        'DELETE k FROM '.prefixTable('sharekeys_items').' k
165
+        LEFT JOIN ' . prefixTable('items').' i ON k.object_id = i.id
166 166
         WHERE i.id IS NULL'
167 167
     );
168 168
 
169 169
     // Delete all files keys for which no object exist
170 170
     DB::query(
171
-        'DELETE k FROM ' . prefixTable('sharekeys_files') . ' k
172
-        LEFT JOIN ' . prefixTable('items') . ' i ON k.object_id = i.id
171
+        'DELETE k FROM '.prefixTable('sharekeys_files').' k
172
+        LEFT JOIN ' . prefixTable('items').' i ON k.object_id = i.id
173 173
         WHERE i.id IS NULL'
174 174
     );
175 175
 
176 176
     // Delete all fields keys for which no object exist
177 177
     DB::query(
178
-        'DELETE k FROM ' . prefixTable('sharekeys_fields') . ' k
179
-        LEFT JOIN ' . prefixTable('items') . ' i ON k.object_id = i.id
178
+        'DELETE k FROM '.prefixTable('sharekeys_fields').' k
179
+        LEFT JOIN ' . prefixTable('items').' i ON k.object_id = i.id
180 180
         WHERE i.id IS NULL'
181 181
     );
182 182
 
183 183
     // Delete all item logs for which no object exist
184 184
     DB::query(
185
-        'DELETE l FROM ' . prefixTable('log_items') . ' l
186
-        LEFT JOIN ' . prefixTable('items') . ' i ON l.id_item = i.id
185
+        'DELETE l FROM '.prefixTable('log_items').' l
186
+        LEFT JOIN ' . prefixTable('items').' i ON l.id_item = i.id
187 187
         WHERE i.id IS NULL'
188 188
     );
189 189
 
Please login to merge, or discard this patch.
scripts/background_tasks___userKeysCreation.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 $processToPerform = DB::queryfirstrow(
69 69
     'SELECT *
70
-    FROM ' . prefixTable('background_tasks') . '
70
+    FROM ' . prefixTable('background_tasks').'
71 71
     WHERE (finished_at IS NULL OR finished_at = "") AND process_type = %s
72 72
     ORDER BY increment_id ASC',
73 73
     'create_user_keys'
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     // Check if subtasks are still running
85 85
     // This in order to prevent the script from running multiple times on same objects
86 86
     while (DB::queryFirstField(
87
-        'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . ' 
87
+        'SELECT COUNT(*) FROM '.prefixTable('background_subtasks').' 
88 88
         WHERE is_in_progress = 1'
89 89
     ) > 0) {
90 90
         sleep(10); // Wait 10 seconds before continuing
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $subTaskParams = json_decode($subTask['task'], true);
118 118
 
119 119
             if (WIP === true) {
120
-                error_log('Subtask in progress: '.$subTask['increment_id']." (".$taskId.") - "./** @scrutinizer ignore-type */ print_r($subTaskParams,true));
120
+                error_log('Subtask in progress: '.$subTask['increment_id']." (".$taskId.") - "./** @scrutinizer ignore-type */ print_r($subTaskParams, true));
121 121
             }
122 122
             
123 123
             // Build all subtasks if first one
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                     // Get total number of items
127 127
                     DB::query(
128 128
                         'SELECT *
129
-                        FROM ' . prefixTable('items') . '
129
+                        FROM ' . prefixTable('items').'
130 130
                         '.(isset($taskArgumentsArray['only_personal_items']) === true && $taskArgumentsArray['only_personal_items'] === 1 ? 'WHERE perso = 1' : '')
131 131
                     );
132 132
                     createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                     // Get total number of items
136 136
                     DB::query(
137 137
                         'SELECT *
138
-                        FROM ' . prefixTable('log_items') . '
138
+                        FROM ' . prefixTable('log_items').'
139 139
                         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
140 140
                     );
141 141
                     createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                     // Get total number of items
145 145
                     DB::query(
146 146
                         'SELECT *
147
-                        FROM ' . prefixTable('categories_items') . '
147
+                        FROM ' . prefixTable('categories_items').'
148 148
                         WHERE encryption_type = "teampass_aes"'
149 149
                     );
150 150
                     createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId);
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
                     // Get total number of items
162 162
                     DB::query(
163 163
                         'SELECT *
164
-                        FROM ' . prefixTable('files') . ' AS f
165
-                        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
166
-                        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"'
164
+                        FROM ' . prefixTable('files').' AS f
165
+                        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
166
+                        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"'
167 167
                     );
168 168
                     createAllSubTasks($subTaskParams['step'], DB::count(), $subTaskParams['nb'], $taskId);
169 169
                 }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     // Check if subtasks have to be created
191 191
     DB::query(
192 192
         'SELECT *
193
-        FROM ' . prefixTable('background_subtasks') . '
193
+        FROM ' . prefixTable('background_subtasks').'
194 194
         WHERE task_id = %i AND task LIKE %ss',
195 195
         $taskId,
196 196
         $action
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 function countActiveSymfonyProcesses() {
219 219
     // Count the number of active processes
220 220
     return DB::queryFirstField(
221
-        'SELECT COUNT(*) FROM ' . prefixTable('background_subtasks') . 
221
+        'SELECT COUNT(*) FROM '.prefixTable('background_subtasks'). 
222 222
         ' WHERE process_id IS NOT NULL AND finished_at IS NULL'
223 223
     );
224 224
 }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 function getSubTasks($taskId) {
230 230
     $task_to_perform = DB::query(
231 231
         'SELECT *
232
-        FROM ' . prefixTable('background_subtasks') . '
232
+        FROM ' . prefixTable('background_subtasks').'
233 233
         WHERE task_id = %i AND finished_at IS NULL
234 234
         ORDER BY increment_id ASC',
235 235
         $taskId
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 function reloadSubTask($subTaskId) {
279 279
     // Retrieve subtask information from the database
280 280
     $subTask = DB::queryFirstRow(
281
-        'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE increment_id = %i', 
281
+        'SELECT * FROM '.prefixTable('background_subtasks').' WHERE increment_id = %i', 
282 282
         $subTaskId
283 283
     );
284 284
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     // Get all processes
324 324
     $subtasks = DB::query(
325 325
         'SELECT *
326
-        FROM ' . prefixTable('background_subtasks') . '
326
+        FROM ' . prefixTable('background_subtasks').'
327 327
         WHERE process_id IS NOT NULL AND finished_at IS NULL'
328 328
     );
329 329
 
Please login to merge, or discard this patch.
scripts/background_tasks___userKeysCreation_subtaskHdl.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 DB::update(
123 123
     prefixTable('background_subtasks'),
124 124
     array(
125
-        'sub_task_in_progress' => 0,    // flag sub task is no more in prgoress
125
+        'sub_task_in_progress' => 0, // flag sub task is no more in prgoress
126 126
         'is_in_progress' => 0,
127 127
         'finished_at' => time(),
128 128
         'updated_at' => time(),
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // Check if user exists
159 159
         $userInfo = DB::queryFirstRow(
160 160
             'SELECT public_key, private_key
161
-            FROM ' . prefixTable('users') . '
161
+            FROM ' . prefixTable('users').'
162 162
             WHERE id = %i',
163 163
             $post_user_id
164 164
         );
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 {
272 272
     $userInfo = DB::queryFirstRow(
273 273
         'SELECT pw, public_key, private_key, login, name
274
-        FROM ' . prefixTable('users') . '
274
+        FROM ' . prefixTable('users').'
275 275
         WHERE id = %i',
276 276
         $owner_id
277 277
     );
278 278
     
279 279
     // decrypt owner password
280
-    $pwd = cryption($owner_pwd, '','decrypt', $SETTINGS)['string'];
280
+    $pwd = cryption($owner_pwd, '', 'decrypt', $SETTINGS)['string'];
281 281
     // decrypt private key and send back
282 282
     return [
283 283
         'private_key' => decryptPrivateKey($pwd, $userInfo['private_key']),
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
     // Loop on items
318 318
     $rows = DB::query(
319 319
         'SELECT id, pw, perso
320
-        FROM ' . prefixTable('items') . '
320
+        FROM ' . prefixTable('items').'
321 321
         WHERE perso =  %i
322 322
         ORDER BY id ASC
323
-        LIMIT ' . $post_start . ', ' . $post_length,
323
+        LIMIT ' . $post_start.', '.$post_length,
324 324
         ($extra_arguments['only_personal_items'] ?? 0) === 1 ? 1 : 0
325 325
     );
326 326
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         // Get itemKey from current user
329 329
         $currentUserKey = DB::queryFirstRow(
330 330
             'SELECT share_key, increment_id
331
-            FROM ' . prefixTable('sharekeys_items') . '
331
+            FROM ' . prefixTable('sharekeys_items').'
332 332
             WHERE object_id = %i AND user_id = %i',
333 333
             $record['id'],
334 334
             (int) $record['perso'] === 0 ? $extra_arguments['owner_id'] : $extra_arguments['new_user_id']
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         
356 356
         $currentUserKey = DB::queryFirstRow(
357 357
             'SELECT increment_id
358
-            FROM ' . prefixTable('sharekeys_items') . '
358
+            FROM ' . prefixTable('sharekeys_items').'
359 359
             WHERE object_id = %i AND user_id = %i',
360 360
             $record['id'],
361 361
             $post_user_id
@@ -429,15 +429,15 @@  discard block
 block discarded – undo
429 429
     // Loop on logs
430 430
     $rows = DB::query(
431 431
         'SELECT increment_id
432
-        FROM ' . prefixTable('log_items') . '
432
+        FROM ' . prefixTable('log_items').'
433 433
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
434
-        LIMIT ' . $post_start . ', ' . $post_length
434
+        LIMIT ' . $post_start.', '.$post_length
435 435
     );
436 436
     foreach ($rows as $record) {
437 437
         // Get itemKey from current user
438 438
         $currentUserKey = DB::queryFirstRow(
439 439
             'SELECT share_key
440
-            FROM ' . prefixTable('sharekeys_logs') . '
440
+            FROM ' . prefixTable('sharekeys_logs').'
441 441
             WHERE object_id = %i AND user_id = %i',
442 442
             $record['increment_id'],
443 443
             $extra_arguments['owner_id']
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
470 470
                 $currentUserKey = DB::queryFirstRow(
471 471
                     'SELECT increment_id
472
-                    FROM ' . prefixTable('sharekeys_items') . '
472
+                    FROM ' . prefixTable('sharekeys_items').'
473 473
                     WHERE object_id = %i AND user_id = %i',
474 474
                     $record['id'],
475 475
                     $post_user_id
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     // SHould we change step?
492 492
     DB::query(
493 493
         'SELECT increment_id
494
-        FROM ' . prefixTable('log_items') . '
494
+        FROM ' . prefixTable('log_items').'
495 495
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
496 496
     );
497 497
 
@@ -531,15 +531,15 @@  discard block
 block discarded – undo
531 531
     // Loop on fields
532 532
     $rows = DB::query(
533 533
         'SELECT id
534
-        FROM ' . prefixTable('categories_items') . '
534
+        FROM ' . prefixTable('categories_items').'
535 535
         WHERE encryption_type = "teampass_aes"
536
-        LIMIT ' . $post_start . ', ' . $post_length
536
+        LIMIT ' . $post_start.', '.$post_length
537 537
     );
538 538
     foreach ($rows as $record) {
539 539
         // Get itemKey from current user
540 540
         $currentUserKey = DB::queryFirstRow(
541 541
             'SELECT share_key
542
-            FROM ' . prefixTable('sharekeys_fields') . '
542
+            FROM ' . prefixTable('sharekeys_fields').'
543 543
             WHERE object_id = %i AND user_id = %i',
544 544
             $record['id'],
545 545
             $extra_arguments['owner_id']
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                 if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
568 568
                     $currentUserKey = DB::queryFirstRow(
569 569
                         'SELECT increment_id
570
-                        FROM ' . prefixTable('sharekeys_items') . '
570
+                        FROM ' . prefixTable('sharekeys_items').'
571 571
                         WHERE object_id = %i AND user_id = %i',
572 572
                         $record['id'],
573 573
                         $post_user_id
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     // SHould we change step?
591 591
     DB::query(
592 592
         'SELECT *
593
-        FROM ' . prefixTable('categories_items') . '
593
+        FROM ' . prefixTable('categories_items').'
594 594
         WHERE encryption_type = "teampass_aes"'
595 595
     );
596 596
 
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
     // Loop on suggestions
631 631
     $rows = DB::query(
632 632
         'SELECT id
633
-        FROM ' . prefixTable('suggestion') . '
634
-        LIMIT ' . $post_start . ', ' . $post_length
633
+        FROM ' . prefixTable('suggestion').'
634
+        LIMIT ' . $post_start.', '.$post_length
635 635
     );
636 636
     foreach ($rows as $record) {
637 637
         // Get itemKey from current user
638 638
         $currentUserKey = DB::queryFirstRow(
639 639
             'SELECT share_key
640
-            FROM ' . prefixTable('sharekeys_suggestions') . '
640
+            FROM ' . prefixTable('sharekeys_suggestions').'
641 641
             WHERE object_id = %i AND user_id = %i',
642 642
             $record['id'],
643 643
             $extra_arguments['owner_id']
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
             if ((int) $post_user_id !== (int) $extra_arguments['owner_id']) {
670 670
                 $currentUserKey = DB::queryFirstRow(
671 671
                     'SELECT increment_id
672
-                    FROM ' . prefixTable('sharekeys_items') . '
672
+                    FROM ' . prefixTable('sharekeys_items').'
673 673
                     WHERE object_id = %i AND user_id = %i',
674 674
                     $record['id'],
675 675
                     $post_user_id
@@ -729,16 +729,16 @@  discard block
 block discarded – undo
729 729
     // Loop on files
730 730
     $rows = DB::query(
731 731
         'SELECT f.id AS id, i.perso AS perso
732
-        FROM ' . prefixTable('files') . ' AS f
733
-        INNER JOIN ' . prefixTable('items') . ' AS i ON i.id = f.id_item
734
-        WHERE f.status = "' . TP_ENCRYPTION_NAME . '"
735
-        LIMIT ' . $post_start . ', ' . $post_length
732
+        FROM ' . prefixTable('files').' AS f
733
+        INNER JOIN ' . prefixTable('items').' AS i ON i.id = f.id_item
734
+        WHERE f.status = "' . TP_ENCRYPTION_NAME.'"
735
+        LIMIT ' . $post_start.', '.$post_length
736 736
     ); //aes_encryption
737 737
     foreach ($rows as $record) {
738 738
         // Get itemKey from current user
739 739
         $currentUserKey = DB::queryFirstRow(
740 740
             'SELECT share_key, increment_id
741
-            FROM ' . prefixTable('sharekeys_files') . '
741
+            FROM ' . prefixTable('sharekeys_files').'
742 742
             WHERE object_id = %i AND user_id = %i',
743 743
             $record['id'],
744 744
             (int) $record['perso'] === 0 ? $extra_arguments['owner_id'] : $extra_arguments['new_user_id']
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
         $currentUserKey = DB::queryFirstRow(
768 768
             'SELECT increment_id
769
-            FROM ' . prefixTable('sharekeys_files') . '
769
+            FROM ' . prefixTable('sharekeys_files').'
770 770
             WHERE object_id = %i AND user_id = %i',
771 771
             $record['id'],
772 772
             $post_user_id
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
     // SHould we change step? Finished ?
798 798
     DB::query(
799 799
         'SELECT *
800
-        FROM ' . prefixTable('files') . '
801
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
800
+        FROM ' . prefixTable('files').'
801
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
802 802
     );
803 803
     $counter = DB::count();
804 804
     $next_start = (int) $post_start + (int) $post_length;
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
     // get user info
865 865
     $userInfo = DB::queryFirstRow(
866 866
         'SELECT email, login, auth_type, special, lastname, name
867
-        FROM ' . prefixTable('users') . '
867
+        FROM ' . prefixTable('users').'
868 868
         WHERE id = %i',
869 869
         $extra_arguments['new_user_id']
870 870
     );
@@ -879,10 +879,10 @@  discard block
 block discarded – undo
879 879
             filter_var($userInfo['email'], FILTER_SANITIZE_FULL_SPECIAL_CHARS),
880 880
             // @scrutinizer ignore-type
881 881
             empty($extra_arguments['email_body']) === false ? $extra_arguments['email_body'] : $lang->get('email_body_user_config_1'),
882
-            'TEAMPASS - ' . $lang->get('login_credentials'),
882
+            'TEAMPASS - '.$lang->get('login_credentials'),
883 883
             (array) filter_var_array(
884 884
                 [
885
-                    '#code#' => cryption($extra_arguments['new_user_code'], '','decrypt', $SETTINGS)['string'],
885
+                    '#code#' => cryption($extra_arguments['new_user_code'], '', 'decrypt', $SETTINGS)['string'],
886 886
                     '#lastname#' => isset($userInfo['name']) === true ? $userInfo['name'] : '',
887 887
                     '#login#' => isset($userInfo['login']) === true ? $userInfo['login'] : '',
888 888
                 ],
Please login to merge, or discard this patch.
sources/tools.queries.php 2 patches
Switch Indentation   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -91,215 +91,215 @@
 block discarded – undo
91 91
 switch ($post_type) {
92 92
 //##########################################################
93 93
 //CASE for creating a DB backup
94
-case 'perform_fix_pf_items-step1':
95
-    // Check KEY
96
-    if (!hash_equals((string) $session->get('key'), (string) $post_key)) {
97
-        echo prepareExchangedData(
98
-            array(
99
-                'error' => true,
100
-                'message' => $lang->get('key_is_not_correct'),
101
-            ),
102
-            'encode'
103
-        );
104
-        break;
105
-    }
106
-    // Is admin?
107
-    if ((int) $session->get('user-admin') !== 1) {
108
-        echo prepareExchangedData(
109
-            array(
110
-                'error' => true,
111
-                'message' => $lang->get('error_not_allowed_to'),
112
-            ),
113
-            'encode'
114
-        );
115
-        break;
116
-    }
94
+    case 'perform_fix_pf_items-step1':
95
+        // Check KEY
96
+        if (!hash_equals((string) $session->get('key'), (string) $post_key)) {
97
+            echo prepareExchangedData(
98
+                array(
99
+                    'error' => true,
100
+                    'message' => $lang->get('key_is_not_correct'),
101
+                ),
102
+                'encode'
103
+            );
104
+            break;
105
+        }
106
+        // Is admin?
107
+        if ((int) $session->get('user-admin') !== 1) {
108
+            echo prepareExchangedData(
109
+                array(
110
+                    'error' => true,
111
+                    'message' => $lang->get('error_not_allowed_to'),
112
+                ),
113
+                'encode'
114
+            );
115
+            break;
116
+        }
117 117
 
118
-    // decrypt and retrieve data in JSON format
119
-    $dataReceived = prepareExchangedData(
120
-        $post_data,
121
-        'decode'
122
-    );
118
+        // decrypt and retrieve data in JSON format
119
+        $dataReceived = prepareExchangedData(
120
+            $post_data,
121
+            'decode'
122
+        );
123 123
 
124
-    $userId = filter_var($dataReceived['userId'], FILTER_SANITIZE_NUMBER_INT);
124
+        $userId = filter_var($dataReceived['userId'], FILTER_SANITIZE_NUMBER_INT);
125 125
 
126
-    // Get user info
127
-    $userInfo = DB::queryFirstRow(
128
-        'SELECT private_key, public_key, psk, encrypted_psk
126
+        // Get user info
127
+        $userInfo = DB::queryFirstRow(
128
+            'SELECT private_key, public_key, psk, encrypted_psk
129 129
         FROM teampass_users
130 130
         WHERE id = %i',
131
-        $userId
132
-    );
131
+            $userId
132
+        );
133 133
 
134
-    // Get user's private folders
135
-    $userPFRoot = DB::queryFirstRow(
136
-        'SELECT id
134
+        // Get user's private folders
135
+        $userPFRoot = DB::queryFirstRow(
136
+            'SELECT id
137 137
         FROM teampass_nested_tree
138 138
         WHERE title = %i',
139
-        $userId
140
-    );
141
-    if (DB::count() === 0) {
142
-        echo prepareExchangedData(
143
-            array(
144
-                'error' => true,
145
-                'message' => 'User has no personal folders',
146
-            ),
147
-            'encode'
148
-        );
149
-        break;
150
-    }
151
-    $personalFolders = [];
152
-    $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
153
-    $tree->rebuild();
154
-    $folders = $tree->getDescendants($userPFRoot['id'], true);
155
-    foreach ($folders as $folder) {
156
-        array_push($personalFolders, $folder->id);
157
-    }
158
-
159
-    //Show done
160
-    echo prepareExchangedData(
161
-        array(
162
-            'error' => false,
163
-            'message' => 'Personal Folders found: ',
164
-            'personalFolders' => json_encode($personalFolders),
165
-        ),
166
-        'encode'
167
-    );
168
-    break;
169
-
170
-case 'perform_fix_pf_items-step2':
171
-    // Check KEY
172
-    if (!hash_equals((string) $session->get('key'), (string) $post_key)) {
173
-        echo prepareExchangedData(
174
-            array(
175
-                'error' => true,
176
-                'message' => $lang->get('key_is_not_correct'),
177
-            ),
178
-            'encode'
139
+            $userId
179 140
         );
180
-        break;
181
-    }
182
-    // Is admin?
183
-    if ((int) $session->get('user-admin') !== 1) {
141
+        if (DB::count() === 0) {
142
+            echo prepareExchangedData(
143
+                array(
144
+                    'error' => true,
145
+                    'message' => 'User has no personal folders',
146
+                ),
147
+                'encode'
148
+            );
149
+            break;
150
+        }
151
+        $personalFolders = [];
152
+        $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
153
+        $tree->rebuild();
154
+        $folders = $tree->getDescendants($userPFRoot['id'], true);
155
+        foreach ($folders as $folder) {
156
+            array_push($personalFolders, $folder->id);
157
+        }
158
+
159
+        //Show done
184 160
         echo prepareExchangedData(
185 161
             array(
186
-                'error' => true,
187
-                'message' => $lang->get('error_not_allowed_to'),
162
+                'error' => false,
163
+                'message' => 'Personal Folders found: ',
164
+                'personalFolders' => json_encode($personalFolders),
188 165
             ),
189 166
             'encode'
190 167
         );
191 168
         break;
192
-    }
193 169
 
194
-    // decrypt and retrieve data in JSON format
195
-    $dataReceived = prepareExchangedData(
196
-        $post_data,
197
-        'decode'
198
-    );
170
+    case 'perform_fix_pf_items-step2':
171
+        // Check KEY
172
+        if (!hash_equals((string) $session->get('key'), (string) $post_key)) {
173
+            echo prepareExchangedData(
174
+                array(
175
+                    'error' => true,
176
+                    'message' => $lang->get('key_is_not_correct'),
177
+                ),
178
+                'encode'
179
+            );
180
+            break;
181
+        }
182
+        // Is admin?
183
+        if ((int) $session->get('user-admin') !== 1) {
184
+            echo prepareExchangedData(
185
+                array(
186
+                    'error' => true,
187
+                    'message' => $lang->get('error_not_allowed_to'),
188
+                ),
189
+                'encode'
190
+            );
191
+            break;
192
+        }
199 193
 
200
-    $userId = filter_var($dataReceived['userId'], FILTER_SANITIZE_NUMBER_INT);
201
-    $personalFolders = filter_var($dataReceived['personalFolders'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
194
+        // decrypt and retrieve data in JSON format
195
+        $dataReceived = prepareExchangedData(
196
+            $post_data,
197
+            'decode'
198
+        );
199
+
200
+        $userId = filter_var($dataReceived['userId'], FILTER_SANITIZE_NUMBER_INT);
201
+        $personalFolders = filter_var($dataReceived['personalFolders'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
202 202
 
203
-    // Delete all private items with sharekeys
204
-    $pfiSharekeys = DB::queryFirstColumn(
205
-        'select s.increment_id
203
+        // Delete all private items with sharekeys
204
+        $pfiSharekeys = DB::queryFirstColumn(
205
+            'select s.increment_id
206 206
         from teampass_sharekeys_items as s
207 207
         INNER JOIN teampass_items AS i ON (i.id = s.object_id)
208 208
         WHERE s.user_id = %i AND i.perso = 1 AND i.id_tree IN %ls',
209
-        $userId,
210
-        $personalFolders
211
-    );
212
-    $pfiSharekeysCount = DB::count();
213
-    if ($pfiSharekeysCount > 0) {
214
-        DB::delete(
215
-            "teampass_sharekeys_items",
216
-            "increment_id IN %ls",
217
-            $pfiSharekeys
209
+            $userId,
210
+            $personalFolders
218 211
         );
219
-    }
212
+        $pfiSharekeysCount = DB::count();
213
+        if ($pfiSharekeysCount > 0) {
214
+            DB::delete(
215
+                "teampass_sharekeys_items",
216
+                "increment_id IN %ls",
217
+                $pfiSharekeys
218
+            );
219
+        }
220 220
 
221 221
     
222
-    //Show done
223
-    echo prepareExchangedData(
224
-        array(
225
-            'error' => false,
226
-            'message' => '<br>Number of Sharekeys for private items DELETED: ',
227
-            'nbDeleted' => $pfiSharekeysCount,
228
-            'personalFolders' => json_encode($personalFolders),
229
-        ),
230
-        'encode'
231
-    );
232
-    break;
233
-
234
-case 'perform_fix_pf_items-step3':
235
-    // Check KEY
236
-    if (!hash_equals((string) $session->get('key'), (string) $post_key)) {
237
-        echo prepareExchangedData(
238
-            array(
239
-                'error' => true,
240
-                'message' => $lang->get('key_is_not_correct'),
241
-            ),
242
-            'encode'
243
-        );
244
-        break;
245
-    }
246
-    // Is admin?
247
-    if ((int) $session->get('user-admin') !== 1) {
222
+        //Show done
248 223
         echo prepareExchangedData(
249 224
             array(
250
-                'error' => true,
251
-                'message' => $lang->get('error_not_allowed_to'),
225
+                'error' => false,
226
+                'message' => '<br>Number of Sharekeys for private items DELETED: ',
227
+                'nbDeleted' => $pfiSharekeysCount,
228
+                'personalFolders' => json_encode($personalFolders),
252 229
             ),
253 230
             'encode'
254 231
         );
255 232
         break;
256
-    }
257 233
 
258
-    // decrypt and retrieve data in JSON format
259
-    $dataReceived = prepareExchangedData(
260
-        $post_data,
261
-        'decode'
262
-    );
234
+    case 'perform_fix_pf_items-step3':
235
+        // Check KEY
236
+        if (!hash_equals((string) $session->get('key'), (string) $post_key)) {
237
+            echo prepareExchangedData(
238
+                array(
239
+                    'error' => true,
240
+                    'message' => $lang->get('key_is_not_correct'),
241
+                ),
242
+                'encode'
243
+            );
244
+            break;
245
+        }
246
+        // Is admin?
247
+        if ((int) $session->get('user-admin') !== 1) {
248
+            echo prepareExchangedData(
249
+                array(
250
+                    'error' => true,
251
+                    'message' => $lang->get('error_not_allowed_to'),
252
+                ),
253
+                'encode'
254
+            );
255
+            break;
256
+        }
257
+
258
+        // decrypt and retrieve data in JSON format
259
+        $dataReceived = prepareExchangedData(
260
+            $post_data,
261
+            'decode'
262
+        );
263 263
 
264
-    $userId = filter_var($dataReceived['userId'], FILTER_SANITIZE_NUMBER_INT);
265
-    $personalFolders = filter_var($dataReceived['personalFolders'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
264
+        $userId = filter_var($dataReceived['userId'], FILTER_SANITIZE_NUMBER_INT);
265
+        $personalFolders = filter_var($dataReceived['personalFolders'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
266 266
 
267
-    // Update from items_old to items all the private itemsitems that have been converted to teampass_aes
268
-    // Get all key back
269
-    $items = DB::query(
270
-        "SELECT id
267
+        // Update from items_old to items all the private itemsitems that have been converted to teampass_aes
268
+        // Get all key back
269
+        $items = DB::query(
270
+            "SELECT id
271 271
         FROM teampass_items
272 272
         WHERE id_tree IN %ls AND encryption_type = %s",
273
-        $personalFolders,
274
-        "teampass_aes"
275
-    );
276
-    //DB::debugMode(false);
277
-    $nbItems = DB::count();
278
-    foreach ($items as $item) {
279
-        $defusePwd = DB::queryFirstField("SELECT pw FROM teampass_items_old WHERE id = %i", $item['id']);
280
-        DB::update(
281
-            "teampass_items",
282
-            ['pw' => $defusePwd, "encryption_type" => "defuse"],
283
-            "id = %i",
284
-            $item['id']
273
+            $personalFolders,
274
+            "teampass_aes"
285 275
         );
286
-    }
276
+        //DB::debugMode(false);
277
+        $nbItems = DB::count();
278
+        foreach ($items as $item) {
279
+            $defusePwd = DB::queryFirstField("SELECT pw FROM teampass_items_old WHERE id = %i", $item['id']);
280
+            DB::update(
281
+                "teampass_items",
282
+                ['pw' => $defusePwd, "encryption_type" => "defuse"],
283
+                "id = %i",
284
+                $item['id']
285
+            );
286
+        }
287 287
 
288 288
     
289
-    //Show done
290
-    echo prepareExchangedData(
291
-        array(
292
-            'error' => false,
293
-            'message' => '<br>Number of items reseted to Defuse: ',
294
-            'nbItems' => $nbItems,
295
-            'personalFolders' => json_encode($personalFolders),
296
-        ),
297
-        'encode'
298
-    );
299
-    break;
300
-
301
-    /* TOOL #2 - Fixing items master keys */
302
-    /*
289
+        //Show done
290
+        echo prepareExchangedData(
291
+            array(
292
+                'error' => false,
293
+                'message' => '<br>Number of items reseted to Defuse: ',
294
+                'nbItems' => $nbItems,
295
+                'personalFolders' => json_encode($personalFolders),
296
+            ),
297
+            'encode'
298
+        );
299
+        break;
300
+
301
+        /* TOOL #2 - Fixing items master keys */
302
+        /*
303 303
     * STEP 1 - Check if we have the correct pwd for TP_USER
304 304
     */
305 305
     case 'perform_fix_items_master_keys-step1':
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('tools') === false) {
71 71
     // Not allowed page
72 72
     $session->set('system-error_code', ERR_NOT_ALLOWED);
73
-    include $SETTINGS['cpassman_dir'] . '/error.php';
73
+    include $SETTINGS['cpassman_dir'].'/error.php';
74 74
     exit;
75 75
 }
76 76
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         // Get PT_USER info
336 336
         $userInfo = DB::queryFirstRow(
337 337
             'SELECT pw, public_key, private_key, login, name
338
-            FROM ' . prefixTable('users') . '
338
+            FROM ' . prefixTable('users').'
339 339
             WHERE id = %i',
340 340
             TP_USER_ID
341 341
         );
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
         // Get one itemKey from current user
373 373
         $currentUserKey = DB::queryFirstRow(
374 374
             'SELECT ski.share_key, ski.increment_id AS increment_id, l.id_user
375
-            FROM ' . prefixTable('sharekeys_items') . ' AS ski
376
-            INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
375
+            FROM ' . prefixTable('sharekeys_items').' AS ski
376
+            INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
377 377
             WHERE ski.user_id = %i
378 378
             ORDER BY RAND()
379 379
             LIMIT 1',
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                 echo  prepareExchangedData(
393 393
                     array(
394 394
                         'error' => true,
395
-                        'message' => 'No issue found, normal process should work. This process is now finished. (item id : ' . $currentUserKey['increment_id'] . ')',
395
+                        'message' => 'No issue found, normal process should work. This process is now finished. (item id : '.$currentUserKey['increment_id'].')',
396 396
                     ),
397 397
                     'encode'
398 398
                 );
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
         // Get user info
453 453
         $userInfo = DB::queryFirstRow(
454 454
             'SELECT public_key, private_key
455
-            FROM ' . prefixTable('users') . '
455
+            FROM ' . prefixTable('users').'
456 456
             WHERE id = %i',
457 457
             $userId
458 458
         );
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
         // Get one itemKey from current user
476 476
         $currentUserKey = DB::queryFirstRow(
477 477
             'SELECT ski.share_key, ski.increment_id AS increment_id, l.id_user
478
-            FROM ' . prefixTable('sharekeys_items') . ' AS ski
479
-            INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
478
+            FROM ' . prefixTable('sharekeys_items').' AS ski
479
+            INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
480 480
             WHERE ski.user_id = %i
481 481
             ORDER BY RAND()
482 482
             LIMIT 1',
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
                 // Get number of users to treat
515 515
                 DB::query(
516 516
                     'SELECT i.id 
517
-                    FROM ' . prefixTable('items') . ' AS i
518
-                    INNER JOIN ' . prefixTable('sharekeys_items') . ' AS si ON i.id = si.object_id
517
+                    FROM ' . prefixTable('items').' AS i
518
+                    INNER JOIN ' . prefixTable('sharekeys_items').' AS si ON i.id = si.object_id
519 519
                     WHERE i.perso = %i AND si.user_id = %i;',
520 520
                     0,
521 521
                     $userId
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
             // Loop on items
598 598
             $rows = DB::query(
599 599
                 'SELECT si.object_id AS object_id, si.share_key AS share_key, i.pw AS pw, si.increment_id as increment_id
600
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
601
-                INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = si.object_id)
600
+                FROM ' . prefixTable('sharekeys_items').' AS si
601
+                INNER JOIN ' . prefixTable('items').' AS i ON (i.id = si.object_id)
602 602
                 WHERE si.user_id = %i
603 603
                 ORDER BY si.increment_id ASC
604
-                LIMIT ' . $startIndex . ', ' . $limit,
604
+                LIMIT ' . $startIndex.', '.$limit,
605 605
                 $userId
606 606
             );        
607 607
             
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
                     // It will be updated if already exists
626 626
                     $currentTPUserKey = DB::queryFirstRow(
627 627
                         'SELECT increment_id, user_id, share_key
628
-                        FROM ' . prefixTable('sharekeys_items') . '
628
+                        FROM ' . prefixTable('sharekeys_items').'
629 629
                         WHERE object_id = %i AND user_id = %i',
630 630
                         $record['object_id'],
631 631
                         TP_USER_ID
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
             DB::commit();
662 662
         } catch (Exception $e) {
663 663
             DB::rollback();
664
-            error_log("Teampass - Error: Keys treatment: " . $e->getMessage());
664
+            error_log("Teampass - Error: Keys treatment: ".$e->getMessage());
665 665
         }
666 666
 
667 667
         $nextIndex = (int) $startIndex + (int) $limit;
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
             // Get PT_USER info
718 718
             DB::queryFirstRow(
719 719
                 'SELECT operation_code
720
-                FROM ' . prefixTable('sharekeys_backup') . '
720
+                FROM ' . prefixTable('sharekeys_backup').'
721 721
                 WHERE operation_code = %s',
722 722
                 $operationCode
723 723
             );
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
                 // using increment_id_value in order to update the correct record
728 728
                 $rows = DB::query(
729 729
                     'SELECT *
730
-                    FROM ' . prefixTable('sharekeys_backup') . '
730
+                    FROM ' . prefixTable('sharekeys_backup').'
731 731
                     WHERE operation_code = %s',
732 732
                     $operationCode
733 733
                 );
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 
747 747
                 // Delete all sharekeys for this operation
748 748
                 DB::query(
749
-                    'DELETE FROM ' . prefixTable('sharekeys_backup') . '
749
+                    'DELETE FROM '.prefixTable('sharekeys_backup').'
750 750
                     WHERE operation_code = %i',
751 751
                     $operationCode
752 752
                 );
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
             // Get operation info
810 810
             DB::query(
811 811
                 'SELECT operation_code
812
-                FROM ' . prefixTable('sharekeys_backup') . '
812
+                FROM ' . prefixTable('sharekeys_backup').'
813 813
                 WHERE operation_code = %s',
814 814
                 $operationCode
815 815
             );
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
             if ($nbKeys > 0) {
819 819
                 // Delete all sharekeys for this operation
820 820
                 DB::query(
821
-                    'DELETE FROM ' . prefixTable('sharekeys_backup') . '
821
+                    'DELETE FROM '.prefixTable('sharekeys_backup').'
822 822
                     WHERE operation_code = %s',
823 823
                     $operationCode
824 824
                 );
Please login to merge, or discard this patch.