Passed
Pull Request — master (#4682)
by Nils
06:11
created
scripts/background_tasks___items_handler.php 1 patch
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.
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/profile.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('profile') === false) {
68 68
     // Not allowed page
69 69
     $session->set('system-error_code', ERR_NOT_ALLOWED);
70
-    include $SETTINGS['cpassman_dir'] . '/error.php';
70
+    include $SETTINGS['cpassman_dir'].'/error.php';
71 71
     exit;
72 72
 }
73 73
 
@@ -100,49 +100,49 @@  discard block
 block discarded – undo
100 100
 $zones = timezone_list();
101 101
 // prepare list of languages
102 102
 $languages = DB::query(
103
-    'SELECT label, name FROM ' . prefixTable('languages') . ' ORDER BY label ASC'
103
+    'SELECT label, name FROM '.prefixTable('languages').' ORDER BY label ASC'
104 104
 );
105 105
 
106 106
 // Do some stats
107 107
 $userItemsNumber = DB::queryFirstField(
108 108
     'SELECT COUNT(id_item) as count
109
-    FROM ' . prefixTable('log_items') . '
109
+    FROM ' . prefixTable('log_items').'
110 110
     WHERE action = "at_creation" AND  id_user = %i',
111 111
     $session->get('user-id')
112 112
 );
113 113
 
114 114
 $userModificationNumber = DB::queryFirstField(
115 115
     'SELECT COUNT(id_item) as count
116
-    FROM ' . prefixTable('log_items') . '
116
+    FROM ' . prefixTable('log_items').'
117 117
     WHERE action = "at_modification" AND  id_user = %i',
118 118
     $session->get('user-id')
119 119
 );
120 120
 
121 121
 $userSeenItemsNumber = DB::queryFirstField(
122 122
     'SELECT COUNT(id_item) as count
123
-    FROM ' . prefixTable('log_items') . '
123
+    FROM ' . prefixTable('log_items').'
124 124
     WHERE action = "at_shown" AND  id_user = %i',
125 125
     $session->get('user-id')
126 126
 );
127 127
 
128 128
 $userSeenPasswordsNumber = DB::queryFirstField(
129 129
     'SELECT COUNT(id_item)
130
-    FROM ' . prefixTable('log_items') . '
130
+    FROM ' . prefixTable('log_items').'
131 131
     WHERE action = "at_password_shown" AND  id_user = %i',
132 132
     $session->get('user-id')
133 133
 );
134 134
 
135 135
 $userInfo = DB::queryFirstRow(
136 136
     'SELECT avatar, last_pw_change
137
-    FROM ' . prefixTable('users') . ' 
137
+    FROM ' . prefixTable('users').' 
138 138
     WHERE id = %i',
139 139
     $session->get('user-id')
140 140
 );
141 141
 
142 142
 if (empty($userInfo['avatar']) === true) {
143
-    $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg';
143
+    $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
144 144
 } else {
145
-    $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $userInfo['avatar'];
145
+    $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$userInfo['avatar'];
146 146
 }
147 147
 
148 148
 // Get Groups name
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 foreach ($session->get('user-roles_array') as $role) {
151 151
     $tmp = DB::queryFirstRow(
152 152
         'SELECT title 
153
-        FROM ' . prefixTable('roles_title') . ' 
153
+        FROM ' . prefixTable('roles_title').' 
154 154
         WHERE id = %i',
155 155
         $role
156 156
     );
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                         <h3 id="profile-username" class="text-center">
197 197
                             <?php
198 198
                             if (null !== $session->get('user-name') && empty($session->get('user-name')) === false) {
199
-                                echo $session->get('user-name') . ' ' . $session->get('user-lastname');
199
+                                echo $session->get('user-name').' '.$session->get('user-lastname');
200 200
                             } else {
201 201
                                 echo $session->get('user-login');
202 202
                             }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                                             } else {
265 265
                                                 echo date('d/m/Y', (int) $session->get('user-last_connection'));
266 266
                                             }
267
-                                            echo ' ' . $lang->get('at') . ' ';
267
+                                            echo ' '.$lang->get('at').' ';
268 268
                                             if (isset($SETTINGS['time_format']) === true) {
269 269
                                                 echo date($SETTINGS['time_format'], (int) $session->get('user-last_connection'));
270 270
                                             } else {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                                         </a>
275 275
                                     </li>
276 276
                                     <?php
277
-                                    if (null !== $session->get('user-last_pw_change') && ! empty($session->get('user-last_pw_change') === true)) {
277
+                                    if (null !== $session->get('user-last_pw_change') && !empty($session->get('user-last_pw_change') === true)) {
278 278
                                         // Handle last password change string
279 279
                                         if ($session->has('user-last_pw_change') && null !== $session->get('user-last_pw_change')) {
280 280
                                             if (isset($SETTINGS['date_format']) === true) {
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
                                         ) {
295 295
                                             $numDaysBeforePwExpiration = '';
296 296
                                         } else {
297
-                                            $numDaysBeforePwExpiration = $LANG['index_pw_expiration'] . ' ' . $session->get('user-num_days_before_exp') . ' ' . $LANG['days'] . '.';
297
+                                            $numDaysBeforePwExpiration = $LANG['index_pw_expiration'].' '.$session->get('user-num_days_before_exp').' '.$LANG['days'].'.';
298 298
                                         }
299 299
                                         echo '
300 300
                                     <li class="list-group-item">
301
-                                        <b><i class="fas fa-calendar-alt fa-fw fa-lg mr-2"></i>' . $lang->get('index_last_pw_change') . '</b>
302
-                                        <a class="float-right">' . $last_pw_change . ' ' . $numDaysBeforePwExpiration . '</a>
301
+                                        <b><i class="fas fa-calendar-alt fa-fw fa-lg mr-2"></i>' . $lang->get('index_last_pw_change').'</b>
302
+                                        <a class="float-right">' . $last_pw_change.' '.$numDaysBeforePwExpiration.'</a>
303 303
                                     </li>';
304 304
                                     }
305 305
                                     ?>
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                                     if (isset($SETTINGS['api']) === true && (int) $SETTINGS['api'] === 1) {
320 320
                                         echo '
321 321
                                     <li class="list-group-item">
322
-                                        <b><i class="fas fa-paper-plane fa-fw fa-lg mr-2"></i>' . $lang->get('user_profile_api_key') . '</b>
322
+                                        <b><i class="fas fa-paper-plane fa-fw fa-lg mr-2"></i>' . $lang->get('user_profile_api_key').'</b>
323 323
                                         <button class="btn btn-sm btn-primary float-right" id="copy-api-key"><i class="fa-regular fa-copy  pointer"></i></button>
324 324
                                         <a class="float-right mr-2" id="profile-user-api-token">',
325 325
                                             null !== $session->get('user-api_key') ? $session->get('user-api_key') : '',
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
                                         <?php
338 338
                                         $rows = DB::query(
339 339
                                             'SELECT label AS labelAction, date, null
340
-                                                    FROM ' . prefixTable('log_system') . '
340
+                                                    FROM ' . prefixTable('log_system').'
341 341
                                                     WHERE qui = %i
342 342
                                                     UNION
343 343
                                                     SELECT l.action, l.date, i.label AS itemLabel
344
-                                                    FROM ' . prefixTable('log_items') . ' AS l
345
-                                                    INNER JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
344
+                                                    FROM ' . prefixTable('log_items').' AS l
345
+                                                    INNER JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
346 346
                                                     WHERE l.id_user = %i AND l.action IN ("at_access")
347 347
                                                     ORDER BY date DESC
348 348
                                                     LIMIT 0, 40',
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
                                                 $text = $lang->get($record['labelAction']);
357 357
                                             }
358 358
                                             if (empty($record['NULL']) === false) {
359
-                                                $text .= ' ' . $lang->get('for') . ' <span class="font-weight-light">' . addslashes($record['NULL']) . '</span>';
359
+                                                $text .= ' '.$lang->get('for').' <span class="font-weight-light">'.addslashes($record['NULL']).'</span>';
360 360
                                             }
361
-                                            echo '<li class="list-group-item">' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - ' . $text . '</li>';
361
+                                            echo '<li class="list-group-item">'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - '.$text.'</li>';
362 362
                                         }
363 363
                                         ?>
364 364
                                     </ul>
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
                                 <?php endif; /* disable_user_edit_profile */
393 393
                                 if (($SETTINGS['disable_user_edit_timezone'] ?? '0') === '0') : ?>
394 394
                                     <div class="form-group">
395
-                                        <label class="col-sm-10 control-label"><?php echo $lang->get('timezone_selection');?></label>
395
+                                        <label class="col-sm-10 control-label"><?php echo $lang->get('timezone_selection'); ?></label>
396 396
                                         <div class="col-sm-10">
397 397
                                             <select class="form-control" id="profile-user-timezone">
398 398
                                                 <?php foreach ($zones as $key => $zone): ?>
399 399
                                                     <option value="<?php echo $key; ?>"<?php 
400 400
                                                         if ($session->has('user-timezone'))
401
-                                                            if($session->get('user-timezone') === $key)
401
+                                                            if ($session->get('user-timezone') === $key)
402 402
                                                                 echo ' selected';
403 403
                                                             elseif ($session->get('user-timezone') === 'not_defined')
404 404
                                                                 if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key)
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
                                             <select class="form-control" id="profile-user-language">
417 417
                                                 <?php
418 418
                                                     foreach ($languages as $language) {
419
-                                                        echo '<option value="' . $language['name'] . '"',
419
+                                                        echo '<option value="'.$language['name'].'"',
420 420
                                                         strtolower($session->get('user-language')) === strtolower($language['name']) ?
421 421
                                                         ' selected="selected"' : '',
422
-                                                    '>' . $language['label'] . '</option>';
422
+                                                    '>'.$language['label'].'</option>';
423 423
                                                     }
424 424
                                                 ?>
425 425
                                             </select>
@@ -432,11 +432,11 @@  discard block
 block discarded – undo
432 432
                                         <div class="col-sm-10">
433 433
                                             <select class="form-control" id="profile-user-treeloadstrategy">
434 434
                                                 
435
-                                                <option value="sequential" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'sequential' ? ' selected' : '';?>>
435
+                                                <option value="sequential" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'sequential' ? ' selected' : ''; ?>>
436 436
                                                     <?php echo $lang->get('sequential'); ?>
437 437
                                                 </option>
438 438
                                                 
439
-                                                <option value="full" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'full' ? ' selected' : '';?>>
439
+                                                <option value="full" <?php echo $session->has('user-tree_load_strategy') && $session->get('user-tree_load_strategy') && null !== $session->get('user-tree_load_strategy') && $session->get('user-tree_load_strategy') === 'full' ? ' selected' : ''; ?>>
440 440
                                                     <?php echo $lang->get('full'); ?>
441 441
                                                 </option>
442 442
                                             </select>
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
                                         <div class="col-sm-10">
450 450
                                             <select class="form-control" id="profile-user-split_view_mode">
451 451
                                                 
452
-                                                <option value="0" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && $session->get('user-split_view_mode') === 0 ? 'selected' : '';?>>
452
+                                                <option value="0" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && $session->get('user-split_view_mode') === 0 ? 'selected' : ''; ?>>
453 453
                                                     <?php echo $lang->get('no'); ?>
454 454
                                                 </option>
455 455
                                                 
456
-                                                <option value="1" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && (int) $session->get('user-split_view_mode') === 1 ? 'selected' : '';?>>
456
+                                                <option value="1" <?php echo $session->has('user-split_view_mode') && $session->get('user-split_view_mode') && null !== $session->get('user-split_view_mode') && (int) $session->get('user-split_view_mode') === 1 ? 'selected' : ''; ?>>
457 457
                                                     <?php echo $lang->get('yes'); ?>
458 458
                                                 </option>
459 459
                                             </select>
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
                                                 <?php 
472 472
                                                 }
473 473
                                                 if (isset($SETTINGS['api']) === true && (int) $SETTINGS['api'] === 1) {
474
-                                                    echo '<button type="button" class="btn btn-warning float-right" id="profile-button-api_token">' . $lang->get('generate_api_token') . '</button>';
474
+                                                    echo '<button type="button" class="btn btn-warning float-right" id="profile-button-api_token">'.$lang->get('generate_api_token').'</button>';
475 475
                                                 }
476 476
                                                 ?>
477 477
                                                 <div id="profile-avatar-file-container" class="hidden"></div>
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.