Passed
Push — master ( 8a1cfb...fe4f4f )
by Nils
17:06 queued 10:36
created
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.
sources/main.functions.php 1 patch
Spacing   +152 added lines, -154 removed lines patch added patch discarded remove patch
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
             $text = Crypto::decrypt($message, $key);
135 135
         }
136 136
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
137
-        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: ' . $ex->getMessage());
137
+        error_log('TEAMPASS-Error-Wrong key or modified ciphertext: '.$ex->getMessage());
138 138
         $err = 'wrong_key_or_modified_ciphertext';
139 139
     } catch (CryptoException\BadFormatException $ex) {
140
-        error_log('TEAMPASS-Error-Bad format exception: ' . $ex->getMessage());
140
+        error_log('TEAMPASS-Error-Bad format exception: '.$ex->getMessage());
141 141
         $err = 'bad_format';
142 142
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
143
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
143
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
144 144
         $err = 'environment_error';
145 145
     } catch (CryptoException\IOException $ex) {
146
-        error_log('TEAMPASS-Error-IO: ' . $ex->getMessage());
146
+        error_log('TEAMPASS-Error-IO: '.$ex->getMessage());
147 147
         $err = 'io_error';
148 148
     } catch (Exception $ex) {
149
-        error_log('TEAMPASS-Error-Unexpected exception: ' . $ex->getMessage());
149
+        error_log('TEAMPASS-Error-Unexpected exception: '.$ex->getMessage());
150 150
         $err = 'unexpected_error';
151 151
     }
152 152
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function trimElement($chaine, string $element): string
233 233
 {
234
-    if (! empty($chaine)) {
234
+    if (!empty($chaine)) {
235 235
         if (is_array($chaine) === true) {
236 236
             $chaine = implode(';', $chaine);
237 237
         }
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
  */
280 280
 function db_error_handler(array $params): void
281 281
 {
282
-    echo 'Error: ' . $params['error'] . "<br>\n";
283
-    echo 'Query: ' . $params['query'] . "<br>\n";
282
+    echo 'Error: '.$params['error']."<br>\n";
283
+    echo 'Query: '.$params['query']."<br>\n";
284 284
     throw new Exception('Error - Query', 1);
285 285
 }
286 286
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     $session->set('user-forbiden_personal_folders', []);
359 359
     
360 360
     // Get list of Folders
361
-    $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0);
361
+    $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0);
362 362
     foreach ($rows as $record) {
363 363
         array_push($groupesVisibles, $record['id']);
364 364
     }
@@ -368,20 +368,20 @@  discard block
 block discarded – undo
368 368
     // get complete list of ROLES
369 369
     $tmp = explode(';', $idFonctions);
370 370
     $rows = DB::query(
371
-        'SELECT * FROM ' . prefixTable('roles_title') . '
371
+        'SELECT * FROM '.prefixTable('roles_title').'
372 372
         ORDER BY title ASC'
373 373
     );
374 374
     foreach ($rows as $record) {
375
-        if (! empty($record['id']) && ! in_array($record['id'], $tmp)) {
375
+        if (!empty($record['id']) && !in_array($record['id'], $tmp)) {
376 376
             array_push($tmp, $record['id']);
377 377
         }
378 378
     }
379 379
     $session->set('user-roles', implode(';', $tmp));
380 380
     $session->set('user-admin', 1);
381 381
     // Check if admin has created Folders and Roles
382
-    DB::query('SELECT * FROM ' . prefixTable('nested_tree') . '');
382
+    DB::query('SELECT * FROM '.prefixTable('nested_tree').'');
383 383
     $session->set('user-nb_folders', DB::count());
384
-    DB::query('SELECT * FROM ' . prefixTable('roles_title'));
384
+    DB::query('SELECT * FROM '.prefixTable('roles_title'));
385 385
     $session->set('user-nb_roles', DB::count());
386 386
 
387 387
     return true;
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     // Does this user is allowed to see other items
465 465
     $inc = 0;
466 466
     $rows = DB::query(
467
-        'SELECT id, id_tree FROM ' . prefixTable('items') . '
467
+        'SELECT id, id_tree FROM '.prefixTable('items').'
468 468
             WHERE restricted_to LIKE %ss AND inactif = %s'.
469 469
             (count($allowedFolders) > 0 ? ' AND id_tree NOT IN ('.implode(',', $allowedFolders).')' : ''),
470 470
         $globalsUserId,
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
     // Check for the users roles if some specific rights exist on items
482 482
     $rows = DB::query(
483 483
         'SELECT i.id_tree, r.item_id
484
-        FROM ' . prefixTable('items') . ' as i
485
-        INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id)
484
+        FROM ' . prefixTable('items').' as i
485
+        INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id)
486 486
         WHERE i.id_tree <> "" '.
487 487
         (count($userRoles) > 0 ? 'AND r.role_id IN %li ' : '').
488 488
         'ORDER BY i.id_tree ASC',
@@ -536,16 +536,16 @@  discard block
 block discarded – undo
536 536
         ), SORT_NUMERIC)
537 537
     );
538 538
     // Folders and Roles numbers
539
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . '');
539
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').'');
540 540
     $session->set('user-nb_folders', DB::count());
541
-    DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title'));
541
+    DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title'));
542 542
     $session->set('user-nb_roles', DB::count());
543 543
     // check if change proposals on User's items
544 544
     if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) {
545 545
         $countNewItems = DB::query(
546 546
             'SELECT COUNT(*)
547
-            FROM ' . prefixTable('items_change') . ' AS c
548
-            LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item)
547
+            FROM ' . prefixTable('items_change').' AS c
548
+            LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item)
549 549
             WHERE i.action = %s AND i.id_user = %i',
550 550
             'at_creation',
551 551
             $globalsUserId
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 {
573 573
     $rows = DB::query(
574 574
         'SELECT *
575
-        FROM ' . prefixTable('roles_values') . '
575
+        FROM ' . prefixTable('roles_values').'
576 576
         WHERE type IN %ls'.(count($userRoles) > 0 ? ' AND role_id IN %li' : ''),
577 577
         ['W', 'ND', 'NE', 'NDNE', 'R'],
578 578
         $userRoles,
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     ) {
640 640
         $persoFld = DB::queryfirstrow(
641 641
             'SELECT id
642
-            FROM ' . prefixTable('nested_tree') . '
642
+            FROM ' . prefixTable('nested_tree').'
643 643
             WHERE title = %s AND personal_folder = %i'.
644 644
             (count($allowedFolders) > 0 ? ' AND id NOT IN ('.implode(',', $allowedFolders).')' : ''),
645 645
             $globalsUserId,
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
     }
673 673
     $persoFlds = DB::query(
674 674
         'SELECT id
675
-        FROM ' . prefixTable('nested_tree') . '
675
+        FROM ' . prefixTable('nested_tree').'
676 676
         WHERE %l',
677 677
         $where
678 678
     );
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
     //Load Tree
741 741
     $tree = new NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
742 742
     // truncate table
743
-    DB::query('TRUNCATE TABLE ' . prefixTable('cache'));
743
+    DB::query('TRUNCATE TABLE '.prefixTable('cache'));
744 744
     // reload date
745 745
     $rows = DB::query(
746 746
         'SELECT *
747
-        FROM ' . prefixTable('items') . ' as i
748
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
747
+        FROM ' . prefixTable('items').' as i
748
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
749 749
         AND l.action = %s
750 750
         AND i.inactif = %i',
751 751
         'at_creation',
@@ -757,18 +757,18 @@  discard block
 block discarded – undo
757 757
             $tags = '';
758 758
             $itemTags = DB::query(
759 759
                 'SELECT tag
760
-                FROM ' . prefixTable('tags') . '
760
+                FROM ' . prefixTable('tags').'
761 761
                 WHERE item_id = %i AND tag != ""',
762 762
                 $record['id']
763 763
             );
764 764
             foreach ($itemTags as $itemTag) {
765
-                $tags .= $itemTag['tag'] . ' ';
765
+                $tags .= $itemTag['tag'].' ';
766 766
             }
767 767
 
768 768
             // Get renewal period
769 769
             $resNT = DB::queryfirstrow(
770 770
                 'SELECT renewal_period
771
-                FROM ' . prefixTable('nested_tree') . '
771
+                FROM ' . prefixTable('nested_tree').'
772 772
                 WHERE id = %i',
773 773
                 $record['id_tree']
774 774
             );
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
                     // Is this a User id?
782 782
                     $user = DB::queryfirstrow(
783 783
                         'SELECT id, login
784
-                        FROM ' . prefixTable('users') . '
784
+                        FROM ' . prefixTable('users').'
785 785
                         WHERE id = %i',
786 786
                         $elem->title
787 787
                     );
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
                     'id' => $record['id'],
800 800
                     'label' => $record['label'],
801 801
                     'description' => $record['description'] ?? '',
802
-                    'url' => isset($record['url']) && ! empty($record['url']) ? $record['url'] : '0',
802
+                    'url' => isset($record['url']) && !empty($record['url']) ? $record['url'] : '0',
803 803
                     'tags' => $tags,
804 804
                     'id_tree' => $record['id_tree'],
805 805
                     'perso' => $record['perso'],
806
-                    'restricted_to' => isset($record['restricted_to']) && ! empty($record['restricted_to']) ? $record['restricted_to'] : '0',
806
+                    'restricted_to' => isset($record['restricted_to']) && !empty($record['restricted_to']) ? $record['restricted_to'] : '0',
807 807
                     'login' => $record['login'] ?? '',
808 808
                     'folder' => implode(' > ', $folder),
809 809
                     'author' => $record['id_user'],
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
     // get new value from db
833 833
     $data = DB::queryfirstrow(
834 834
         'SELECT label, description, id_tree, perso, restricted_to, login, url
835
-        FROM ' . prefixTable('items') . '
835
+        FROM ' . prefixTable('items').'
836 836
         WHERE id=%i',
837 837
         $ident
838 838
     );
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
     $tags = '';
841 841
     $itemTags = DB::query(
842 842
         'SELECT tag
843
-            FROM ' . prefixTable('tags') . '
843
+            FROM ' . prefixTable('tags').'
844 844
             WHERE item_id = %i AND tag != ""',
845 845
         $ident
846 846
     );
847 847
     foreach ($itemTags as $itemTag) {
848
-        $tags .= $itemTag['tag'] . ' ';
848
+        $tags .= $itemTag['tag'].' ';
849 849
     }
850 850
     // form id_tree to full foldername
851 851
     $folder = [];
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
             // Is this a User id?
857 857
             $user = DB::queryfirstrow(
858 858
                 'SELECT id, login
859
-                FROM ' . prefixTable('users') . '
859
+                FROM ' . prefixTable('users').'
860 860
                 WHERE id = %i',
861 861
                 $elem->title
862 862
             );
@@ -874,10 +874,10 @@  discard block
 block discarded – undo
874 874
             'label' => $data['label'],
875 875
             'description' => $data['description'],
876 876
             'tags' => $tags,
877
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
877
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
878 878
             'id_tree' => $data['id_tree'],
879 879
             'perso' => $data['perso'],
880
-            'restricted_to' => isset($data['restricted_to']) && ! empty($data['restricted_to']) ? $data['restricted_to'] : '0',
880
+            'restricted_to' => isset($data['restricted_to']) && !empty($data['restricted_to']) ? $data['restricted_to'] : '0',
881 881
             'login' => $data['login'] ?? '',
882 882
             'folder' => implode(' » ', $folder),
883 883
             'author' => $session->get('user-id'),
@@ -907,8 +907,8 @@  discard block
 block discarded – undo
907 907
     // get new value from db
908 908
     $data = DB::queryFirstRow(
909 909
         'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date
910
-        FROM ' . prefixTable('items') . ' as i
911
-        INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id)
910
+        FROM ' . prefixTable('items').' as i
911
+        INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id)
912 912
         WHERE i.id = %i
913 913
         AND l.action = %s',
914 914
         $ident,
@@ -918,12 +918,12 @@  discard block
 block discarded – undo
918 918
     $tags = '';
919 919
     $itemTags = DB::query(
920 920
         'SELECT tag
921
-            FROM ' . prefixTable('tags') . '
921
+            FROM ' . prefixTable('tags').'
922 922
             WHERE item_id = %i AND tag != ""',
923 923
         $ident
924 924
     );
925 925
     foreach ($itemTags as $itemTag) {
926
-        $tags .= $itemTag['tag'] . ' ';
926
+        $tags .= $itemTag['tag'].' ';
927 927
     }
928 928
     // form id_tree to full foldername
929 929
     $folder = [];
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
             // Is this a User id?
935 935
             $user = DB::queryfirstrow(
936 936
                 'SELECT id, login
937
-                FROM ' . prefixTable('users') . '
937
+                FROM ' . prefixTable('users').'
938 938
                 WHERE id = %i',
939 939
                 $elem->title
940 940
             );
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
             'label' => $data['label'],
954 954
             'description' => $data['description'],
955 955
             'tags' => isset($tags) && empty($tags) === false ? $tags : 'None',
956
-            'url' => isset($data['url']) && ! empty($data['url']) ? $data['url'] : '0',
956
+            'url' => isset($data['url']) && !empty($data['url']) ? $data['url'] : '0',
957 957
             'id_tree' => $data['id_tree'],
958 958
             'perso' => isset($data['perso']) && empty($data['perso']) === false && $data['perso'] !== 'None' ? $data['perso'] : '0',
959 959
             'restricted_to' => isset($data['restricted_to']) && empty($data['restricted_to']) === false ? $data['restricted_to'] : '0',
@@ -975,53 +975,53 @@  discard block
 block discarded – undo
975 975
 function getStatisticsData(array $SETTINGS): array
976 976
 {
977 977
     DB::query(
978
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
978
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
979 979
         0
980 980
     );
981 981
     $counter_folders = DB::count();
982 982
     DB::query(
983
-        'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i',
983
+        'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i',
984 984
         1
985 985
     );
986 986
     $counter_folders_perso = DB::count();
987 987
     DB::query(
988
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
988
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
989 989
         0
990 990
     );
991 991
     $counter_items = DB::count();
992 992
         DB::query(
993
-        'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i',
993
+        'SELECT id FROM '.prefixTable('items').' WHERE perso = %i',
994 994
         1
995 995
     );
996 996
     $counter_items_perso = DB::count();
997 997
         DB::query(
998
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE login NOT IN (%s, %s, %s)',
998
+        'SELECT id FROM '.prefixTable('users').' WHERE login NOT IN (%s, %s, %s)',
999 999
         'OTV', 'TP', 'API'
1000 1000
     );
1001 1001
     $counter_users = DB::count();
1002 1002
         DB::query(
1003
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i',
1003
+        'SELECT id FROM '.prefixTable('users').' WHERE admin = %i',
1004 1004
         1
1005 1005
     );
1006 1006
     $admins = DB::count();
1007 1007
     DB::query(
1008
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i',
1008
+        'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i',
1009 1009
         1
1010 1010
     );
1011 1011
     $managers = DB::count();
1012 1012
     DB::query(
1013
-        'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i',
1013
+        'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i',
1014 1014
         1
1015 1015
     );
1016 1016
     $readOnly = DB::count();
1017 1017
     // list the languages
1018 1018
     $usedLang = [];
1019 1019
     $tp_languages = DB::query(
1020
-        'SELECT name FROM ' . prefixTable('languages')
1020
+        'SELECT name FROM '.prefixTable('languages')
1021 1021
     );
1022 1022
     foreach ($tp_languages as $tp_language) {
1023 1023
         DB::query(
1024
-            'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s',
1024
+            'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s',
1025 1025
             $tp_language['name']
1026 1026
         );
1027 1027
         $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0);
@@ -1030,12 +1030,12 @@  discard block
 block discarded – undo
1030 1030
     // get list of ips
1031 1031
     $usedIp = [];
1032 1032
     $tp_ips = DB::query(
1033
-        'SELECT user_ip FROM ' . prefixTable('users')
1033
+        'SELECT user_ip FROM '.prefixTable('users')
1034 1034
     );
1035 1035
     foreach ($tp_ips as $ip) {
1036 1036
         if (array_key_exists($ip['user_ip'], $usedIp)) {
1037 1037
             $usedIp[$ip['user_ip']] += $usedIp[$ip['user_ip']];
1038
-        } elseif (! empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1038
+        } elseif (!empty($ip['user_ip']) && $ip['user_ip'] !== 'none') {
1039 1039
             $usedIp[$ip['user_ip']] = 1;
1040 1040
         }
1041 1041
     }
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
         <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;">
1131 1131
         <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;">
1132 1132
         <br><div style="float:right;">' .
1133
-        $textMail .
1133
+        $textMail.
1134 1134
         '<br><br></td></tr></table>
1135 1135
     </td></tr></table>
1136 1136
     <br></body></html>';
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 {
1212 1212
     array_walk_recursive(
1213 1213
         $array,
1214
-        static function (&$item): void {
1214
+        static function(&$item): void {
1215 1215
             if (mb_detect_encoding((string) $item, 'utf-8', true) === false) {
1216 1216
                 $item = mb_convert_encoding($item, 'ISO-8859-1', 'UTF-8');
1217 1217
             }
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
  */
1323 1323
 function prefixTable(string $table): string
1324 1324
 {
1325
-    $safeTable = htmlspecialchars(DB_PREFIX . $table);
1325
+    $safeTable = htmlspecialchars(DB_PREFIX.$table);
1326 1326
     if (empty($safeTable) === false) {
1327 1327
         // sanitize string
1328 1328
         return $safeTable;
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 function send_syslog($message, $host, $port, $component = 'teampass'): void
1445 1445
 {
1446 1446
     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
1447
-    $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message;
1447
+    $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message;
1448 1448
     socket_sendto($sock, (string) $syslog_message, strlen($syslog_message), 0, (string) $host, (int) $port);
1449 1449
     socket_close($sock);
1450 1450
 }
@@ -1491,14 +1491,14 @@  discard block
 block discarded – undo
1491 1491
     if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) {
1492 1492
         if ($type === 'user_mngt') {
1493 1493
             send_syslog(
1494
-                'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ',
1494
+                'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ',
1495 1495
                 $SETTINGS['syslog_host'],
1496 1496
                 $SETTINGS['syslog_port'],
1497 1497
                 'teampass'
1498 1498
             );
1499 1499
         } else {
1500 1500
             send_syslog(
1501
-                'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ',
1501
+                'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ',
1502 1502
                 $SETTINGS['syslog_host'],
1503 1503
                 $SETTINGS['syslog_port'],
1504 1504
                 'teampass'
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
         if (empty($item_label) === true) {
1574 1574
             $dataItem = DB::queryfirstrow(
1575 1575
                 'SELECT id, id_tree, label
1576
-                FROM ' . prefixTable('items') . '
1576
+                FROM ' . prefixTable('items').'
1577 1577
                 WHERE id = %i',
1578 1578
                 $item_id
1579 1579
             );
@@ -1581,11 +1581,11 @@  discard block
 block discarded – undo
1581 1581
         }
1582 1582
 
1583 1583
         send_syslog(
1584
-            'action=' . str_replace('at_', '', $action) .
1585
-                ' attribute=' . str_replace('at_', '', $attribute[0]) .
1586
-                ' itemno=' . $item_id .
1587
-                ' user=' . (is_null($login) === true ? '' : addslashes((string) $login)) .
1588
-                ' itemname="' . addslashes($item_label) . '"',
1584
+            'action='.str_replace('at_', '', $action).
1585
+                ' attribute='.str_replace('at_', '', $attribute[0]).
1586
+                ' itemno='.$item_id.
1587
+                ' user='.(is_null($login) === true ? '' : addslashes((string) $login)).
1588
+                ' itemname="'.addslashes($item_label).'"',
1589 1589
             $SETTINGS['syslog_host'],
1590 1590
             $SETTINGS['syslog_port'],
1591 1591
             'teampass'
@@ -1617,8 +1617,8 @@  discard block
 block discarded – undo
1617 1617
     $notification = DB::queryOneColumn(
1618 1618
         'email',
1619 1619
         'SELECT *
1620
-        FROM ' . prefixTable('notification') . ' AS n
1621
-        INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id)
1620
+        FROM ' . prefixTable('notification').' AS n
1621
+        INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id)
1622 1622
         WHERE n.item_id = %i AND n.user_id != %i',
1623 1623
         $item_id,
1624 1624
         $globalsUserId
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
         // Get list of changes
1630 1630
         $htmlChanges = '<ul>';
1631 1631
         foreach ($changes as $change) {
1632
-            $htmlChanges .= '<li>' . $change . '</li>';
1632
+            $htmlChanges .= '<li>'.$change.'</li>';
1633 1633
         }
1634 1634
         $htmlChanges .= '</ul>';
1635 1635
         // send email
@@ -1666,15 +1666,15 @@  discard block
 block discarded – undo
1666 1666
     $path = '';
1667 1667
     foreach ($arbo as $elem) {
1668 1668
         if (empty($path) === true) {
1669
-            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' ';
1669
+            $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' ';
1670 1670
         } else {
1671
-            $path .= '&#8594; ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1671
+            $path .= '&#8594; '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES);
1672 1672
         }
1673 1673
     }
1674 1674
 
1675 1675
     // Build text to show user
1676 1676
     if (empty($label) === false) {
1677
-        return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')';
1677
+        return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')';
1678 1678
     }
1679 1679
     return empty($path) === true ? '' : $path;
1680 1680
 }
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 {
1731 1731
     // Perform a copy if the file exists
1732 1732
     if (file_exists($configFilePath)) {
1733
-        $backupFilePath = $configFilePath . '.' . date('Y_m_d_His', time());
1733
+        $backupFilePath = $configFilePath.'.'.date('Y_m_d_His', time());
1734 1734
         if (!copy($configFilePath, $backupFilePath)) {
1735 1735
             return "ERROR: Could not copy file '$configFilePath'";
1736 1736
         }
@@ -1738,10 +1738,10 @@  discard block
 block discarded – undo
1738 1738
 
1739 1739
     // Regenerate the config file
1740 1740
     $data = ["<?php\n", "global \$SETTINGS;\n", "\$SETTINGS = array (\n"];
1741
-    $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', 'admin');
1741
+    $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type=%s', 'admin');
1742 1742
     foreach ($rows as $record) {
1743 1743
         $value = getEncryptedValue($record['valeur'], $record['is_encrypted']);
1744
-        $data[] = "    '{$record['intitule']}' => '". htmlspecialchars_decode($value, ENT_COMPAT) . "',\n";
1744
+        $data[] = "    '{$record['intitule']}' => '".htmlspecialchars_decode($value, ENT_COMPAT)."',\n";
1745 1745
     }
1746 1746
     $data[] = ");\n";
1747 1747
     $data = array_unique($data);
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
 {
1787 1787
     global $SETTINGS;
1788 1788
     /* LOAD CPASSMAN SETTINGS */
1789
-    if (! isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1789
+    if (!isset($SETTINGS['loaded']) || $SETTINGS['loaded'] !== 1) {
1790 1790
         $SETTINGS = [];
1791 1791
         $SETTINGS['duplicate_folder'] = 0;
1792 1792
         //by default, this is set to 0;
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
         //by default, this value is set to 5;
1797 1797
         $settings = [];
1798 1798
         $rows = DB::query(
1799
-            'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2',
1799
+            'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2',
1800 1800
             [
1801 1801
                 'type' => 'admin',
1802 1802
                 'type2' => 'settings',
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
     $source_cf = [];
1829 1829
     $rows = DB::QUERY(
1830 1830
         'SELECT id_category
1831
-            FROM ' . prefixTable('categories_folders') . '
1831
+            FROM ' . prefixTable('categories_folders').'
1832 1832
             WHERE id_folder = %i',
1833 1833
         $source_id
1834 1834
     );
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
     $target_cf = [];
1840 1840
     $rows = DB::QUERY(
1841 1841
         'SELECT id_category
1842
-            FROM ' . prefixTable('categories_folders') . '
1842
+            FROM ' . prefixTable('categories_folders').'
1843 1843
             WHERE id_folder = %i',
1844 1844
         $target_id
1845 1845
     );
@@ -1934,10 +1934,10 @@  discard block
 block discarded – undo
1934 1934
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1935 1935
         $err = 'wrong_key';
1936 1936
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1937
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1937
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1938 1938
         $err = 'environment_error';
1939 1939
     } catch (CryptoException\IOException $ex) {
1940
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1940
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1941 1941
         $err = 'general_error';
1942 1942
     }
1943 1943
 
@@ -1970,10 +1970,10 @@  discard block
 block discarded – undo
1970 1970
     } catch (CryptoException\WrongKeyOrModifiedCiphertextException $ex) {
1971 1971
         $err = 'wrong_key';
1972 1972
     } catch (CryptoException\EnvironmentIsBrokenException $ex) {
1973
-        error_log('TEAMPASS-Error-Environment: ' . $ex->getMessage());
1973
+        error_log('TEAMPASS-Error-Environment: '.$ex->getMessage());
1974 1974
         $err = 'environment_error';
1975 1975
     } catch (CryptoException\IOException $ex) {
1976
-        error_log('TEAMPASS-Error-General: ' . $ex->getMessage());
1976
+        error_log('TEAMPASS-Error-General: '.$ex->getMessage());
1977 1977
         $err = 'general_error';
1978 1978
     }
1979 1979
 
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
 ) {
2060 2060
     // Check if the path exists
2061 2061
     $path = basename($path);
2062
-    if (! file_exists($path)) {
2062
+    if (!file_exists($path)) {
2063 2063
         return false;
2064 2064
     }
2065 2065
 
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
     // Load item data
2113 2113
     $data = DB::queryFirstRow(
2114 2114
         'SELECT id_tree
2115
-        FROM ' . prefixTable('items') . '
2115
+        FROM ' . prefixTable('items').'
2116 2116
         WHERE id = %i',
2117 2117
         $item_id
2118 2118
     );
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
         }
2176 2176
         $host .= substr(explode(".", $email[1])[0], -1, 1);
2177 2177
     }
2178
-    $email = $name . "@" . $host . "." . explode(".", $email[1])[1];
2178
+    $email = $name."@".$host.".".explode(".", $email[1])[1];
2179 2179
     return $email;
2180 2180
 }
2181 2181
 
@@ -2206,11 +2206,11 @@  discard block
 block discarded – undo
2206 2206
 function formatSizeUnits(int $bytes): string
2207 2207
 {
2208 2208
     if ($bytes >= 1073741824) {
2209
-        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
2209
+        $bytes = number_format($bytes / 1073741824, 2).' GB';
2210 2210
     } elseif ($bytes >= 1048576) {
2211
-        $bytes = number_format($bytes / 1048576, 2) . ' MB';
2211
+        $bytes = number_format($bytes / 1048576, 2).' MB';
2212 2212
     } elseif ($bytes >= 1024) {
2213
-        $bytes = number_format($bytes / 1024, 2) . ' KB';
2213
+        $bytes = number_format($bytes / 1024, 2).' KB';
2214 2214
     } elseif ($bytes > 1) {
2215 2215
         $bytes .= ' bytes';
2216 2216
     } elseif ($bytes === 1) {
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
     $cipher->enableContinuousBuffer();
2460 2460
 
2461 2461
     // Encrypt the file content
2462
-    $filePath = filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL);
2462
+    $filePath = filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL);
2463 2463
     $fileContent = file_get_contents($filePath);
2464 2464
     $plaintext = $fileContent;
2465 2465
     $ciphertext = $cipher->encrypt($plaintext);
@@ -2467,9 +2467,9 @@  discard block
 block discarded – undo
2467 2467
     // Save new file
2468 2468
     // deepcode ignore InsecureHash: is simply used to get a unique name
2469 2469
     $hash = uniqid('', true);
2470
-    $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
2470
+    $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash;
2471 2471
     file_put_contents($fileOut, $ciphertext);
2472
-    unlink($fileInPath . '/' . $fileInName);
2472
+    unlink($fileInPath.'/'.$fileInName);
2473 2473
     return [
2474 2474
         'fileHash' => base64_encode($hash),
2475 2475
         'objectKey' => base64_encode($objectKey),
@@ -2485,9 +2485,9 @@  discard block
 block discarded – undo
2485 2485
  *
2486 2486
  * @return string|array
2487 2487
  */
2488
-function decryptFile(string $fileName, string $filePath, string $key): string|array
2488
+function decryptFile(string $fileName, string $filePath, string $key): string | array
2489 2489
 {
2490
-    if (! defined('FILE_BUFFER_SIZE')) {
2490
+    if (!defined('FILE_BUFFER_SIZE')) {
2491 2491
         define('FILE_BUFFER_SIZE', 128 * 1024);
2492 2492
     }
2493 2493
     
@@ -2504,7 +2504,7 @@  discard block
 block discarded – undo
2504 2504
     $cipher->enableContinuousBuffer();
2505 2505
     $cipher->disablePadding();
2506 2506
     // Get file content
2507
-    $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2507
+    $safeFilePath = realpath($filePath.'/'.TP_FILE_PREFIX.$safeFileName);
2508 2508
     if ($safeFilePath !== false && file_exists($safeFilePath)) {
2509 2509
         $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2510 2510
     } else {
@@ -2600,7 +2600,7 @@  discard block
 block discarded – undo
2600 2600
         // Only create the sharekey for a user
2601 2601
         $user = DB::queryFirstRow(
2602 2602
             'SELECT public_key
2603
-            FROM ' . prefixTable('users') . '
2603
+            FROM ' . prefixTable('users').'
2604 2604
             WHERE id = %i
2605 2605
             AND public_key != ""',
2606 2606
             $userId
@@ -2641,7 +2641,7 @@  discard block
 block discarded – undo
2641 2641
         }
2642 2642
         $users = DB::query(
2643 2643
             'SELECT id, public_key
2644
-            FROM ' . prefixTable('users') . '
2644
+            FROM ' . prefixTable('users').'
2645 2645
             WHERE id NOT IN %li
2646 2646
             AND public_key != ""',
2647 2647
             $user_ids
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
         foreach ($users as $user) {
2651 2651
             // Insert in DB the new object key for this item by user
2652 2652
             if (count($objectKeyArray) === 0) {
2653
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2653
+                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - '.$object_name.' - '.$post_object_id.' - '.$user['id'].' - '.$objectKey);
2654 2654
                 DB::insert(
2655 2655
                     $object_name,
2656 2656
                     [
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
                 );
2665 2665
             } else {
2666 2666
                 foreach ($objectKeyArray as $object) {
2667
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2667
+                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - '.$object_name.' - '.$object['objectId'].' - '.$user['id'].' - '.$object['objectKey']);
2668 2668
                     DB::insert(
2669 2669
                         $object_name,
2670 2670
                         [
@@ -2692,7 +2692,7 @@  discard block
 block discarded – undo
2692 2692
 function isBase64(string $str): bool
2693 2693
 {
2694 2694
     $str = (string) trim($str);
2695
-    if (! isset($str[0])) {
2695
+    if (!isset($str[0])) {
2696 2696
         return false;
2697 2697
     }
2698 2698
 
@@ -2766,7 +2766,7 @@  discard block
 block discarded – undo
2766 2766
     } catch (\LdapRecord\Auth\BindException $e) {
2767 2767
         $error = $e->getDetailedError();
2768 2768
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2769
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2769
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2770 2770
         }
2771 2771
         // deepcode ignore ServerLeak: No important data is sent
2772 2772
         echo 'An error occurred.';
@@ -2783,7 +2783,7 @@  discard block
 block discarded – undo
2783 2783
     } catch (\LdapRecord\Auth\BindException $e) {
2784 2784
         $error = $e->getDetailedError();
2785 2785
         if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
2786
-            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
2786
+            error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
2787 2787
         }
2788 2788
         // deepcode ignore ServerLeak: No important data is sent
2789 2789
         echo 'An error occurred.';
@@ -2810,7 +2810,7 @@  discard block
 block discarded – undo
2810 2810
     // expect if personal item
2811 2811
     DB::delete(
2812 2812
         prefixTable('sharekeys_items'),
2813
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2813
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2814 2814
         $userId
2815 2815
     );
2816 2816
     // Remove all item sharekeys files
@@ -2818,8 +2818,8 @@  discard block
 block discarded – undo
2818 2818
         prefixTable('sharekeys_files'),
2819 2819
         'user_id = %i AND object_id NOT IN (
2820 2820
             SELECT f.id 
2821
-            FROM ' . prefixTable('items') . ' AS i 
2822
-            INNER JOIN ' . prefixTable('files') . ' AS f ON f.id_item = i.id
2821
+            FROM ' . prefixTable('items').' AS i 
2822
+            INNER JOIN ' . prefixTable('files').' AS f ON f.id_item = i.id
2823 2823
             WHERE i.perso = 1
2824 2824
         )',
2825 2825
         $userId
@@ -2829,8 +2829,8 @@  discard block
 block discarded – undo
2829 2829
         prefixTable('sharekeys_fields'),
2830 2830
         'user_id = %i AND object_id NOT IN (
2831 2831
             SELECT c.id 
2832
-            FROM ' . prefixTable('items') . ' AS i 
2833
-            INNER JOIN ' . prefixTable('categories_items') . ' AS c ON c.item_id = i.id
2832
+            FROM ' . prefixTable('items').' AS i 
2833
+            INNER JOIN ' . prefixTable('categories_items').' AS c ON c.item_id = i.id
2834 2834
             WHERE i.perso = 1
2835 2835
         )',
2836 2836
         $userId
@@ -2838,13 +2838,13 @@  discard block
 block discarded – undo
2838 2838
     // Remove all item sharekeys logs
2839 2839
     DB::delete(
2840 2840
         prefixTable('sharekeys_logs'),
2841
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2841
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2842 2842
         $userId
2843 2843
     );
2844 2844
     // Remove all item sharekeys suggestions
2845 2845
     DB::delete(
2846 2846
         prefixTable('sharekeys_suggestions'),
2847
-        'user_id = %i AND object_id NOT IN (SELECT i.id FROM ' . prefixTable('items') . ' AS i WHERE i.perso = 1)',
2847
+        'user_id = %i AND object_id NOT IN (SELECT i.id FROM '.prefixTable('items').' AS i WHERE i.perso = 1)',
2848 2848
         $userId
2849 2849
     );
2850 2850
     return false;
@@ -2865,7 +2865,7 @@  discard block
 block discarded – undo
2865 2865
         foreach (DateTimeZone::listIdentifiers() as $timezone) {
2866 2866
             $now->setTimezone(new DateTimeZone($timezone));
2867 2867
             $offsets[] = $offset = $now->getOffset();
2868
-            $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone);
2868
+            $timezones[$timezone] = '('.format_GMT_offset($offset).') '.format_timezone_name($timezone);
2869 2869
         }
2870 2870
 
2871 2871
         array_multisort($offsets, $timezones);
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
 {
2886 2886
     $hours = intval($offset / 3600);
2887 2887
     $minutes = abs(intval($offset % 3600 / 60));
2888
-    return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2888
+    return 'GMT'.($offset ? sprintf('%+03d:%02d', $hours, $minutes) : '');
2889 2889
 }
2890 2890
 
2891 2891
 /**
@@ -2985,8 +2985,7 @@  discard block
 block discarded – undo
2985 2985
 {
2986 2986
     if (isset($array[$key]) === true
2987 2987
         && (is_int($value) === true ?
2988
-            (int) $array[$key] === $value :
2989
-            (string) $array[$key] === $value)
2988
+            (int) $array[$key] === $value : (string) $array[$key] === $value)
2990 2989
     ) {
2991 2990
         return true;
2992 2991
     }
@@ -3008,8 +3007,7 @@  discard block
 block discarded – undo
3008 3007
 {
3009 3008
     if (isset($var) === false
3010 3009
         || (is_int($value) === true ?
3011
-            (int) $var === $value :
3012
-            (string) $var === $value)
3010
+            (int) $var === $value : (string) $var === $value)
3013 3011
     ) {
3014 3012
         return true;
3015 3013
     }
@@ -3060,7 +3058,7 @@  discard block
 block discarded – undo
3060 3058
  */
3061 3059
 function isSetArrayOfValues(array $arrayOfValues): bool
3062 3060
 {
3063
-    foreach($arrayOfValues as $value) {
3061
+    foreach ($arrayOfValues as $value) {
3064 3062
         if (isset($value) === false) {
3065 3063
             return false;
3066 3064
         }
@@ -3082,7 +3080,7 @@  discard block
 block discarded – undo
3082 3080
     /*PHP8 - integer|string*/$value
3083 3081
 ) : bool
3084 3082
 {
3085
-    foreach($arrayOfVars as $variable) {
3083
+    foreach ($arrayOfVars as $variable) {
3086 3084
         if ($variable !== $value) {
3087 3085
             return false;
3088 3086
         }
@@ -3102,7 +3100,7 @@  discard block
 block discarded – undo
3102 3100
     /*PHP8 - integer|string*/$value
3103 3101
 ) : bool
3104 3102
 {
3105
-    foreach($arrayOfVars as $variable) {
3103
+    foreach ($arrayOfVars as $variable) {
3106 3104
         if ($variable === $value) {
3107 3105
             return true;
3108 3106
         }
@@ -3171,7 +3169,7 @@  discard block
 block discarded – undo
3171 3169
  * @param array     $filters
3172 3170
  * @return array|string
3173 3171
  */
3174
-function dataSanitizer(array $data, array $filters): array|string
3172
+function dataSanitizer(array $data, array $filters): array | string
3175 3173
 {
3176 3174
     // Load Sanitizer library
3177 3175
     $sanitizer = new Sanitizer($data, $filters);
@@ -3200,7 +3198,7 @@  discard block
 block discarded – undo
3200 3198
     // Exists ?
3201 3199
     $userCacheId = DB::queryfirstrow(
3202 3200
         'SELECT increment_id
3203
-        FROM ' . prefixTable('cache_tree') . '
3201
+        FROM ' . prefixTable('cache_tree').'
3204 3202
         WHERE user_id = %i',
3205 3203
         $user_id
3206 3204
     );
@@ -3251,7 +3249,7 @@  discard block
 block discarded – undo
3251 3249
  */
3252 3250
 function pourcentage(float $nombre, float $total, float $pourcentage): float
3253 3251
 { 
3254
-    $resultat = ($nombre/$total) * $pourcentage;
3252
+    $resultat = ($nombre / $total) * $pourcentage;
3255 3253
     return round($resultat);
3256 3254
 }
3257 3255
 
@@ -3281,7 +3279,7 @@  discard block
 block discarded – undo
3281 3279
 
3282 3280
     // Get last folder update
3283 3281
     $lastFolderChange = DB::queryfirstrow(
3284
-        'SELECT valeur FROM ' . prefixTable('misc') . '
3282
+        'SELECT valeur FROM '.prefixTable('misc').'
3285 3283
         WHERE type = %s AND intitule = %s',
3286 3284
         'timestamp',
3287 3285
         'last_folder_change'
@@ -3312,7 +3310,7 @@  discard block
 block discarded – undo
3312 3310
     // Does this user has a tree cache
3313 3311
     $userCacheTree = DB::queryfirstrow(
3314 3312
         'SELECT '.$fieldName.'
3315
-        FROM ' . prefixTable('cache_tree') . '
3313
+        FROM ' . prefixTable('cache_tree').'
3316 3314
         WHERE user_id = %i',
3317 3315
         $session->get('user-id')
3318 3316
     );
@@ -3355,7 +3353,7 @@  discard block
 block discarded – undo
3355 3353
     if (count($folderIds) === 0) {
3356 3354
         $folderIds = DB::queryFirstColumn(
3357 3355
             'SELECT id
3358
-            FROM ' . prefixTable('nested_tree') . '
3356
+            FROM ' . prefixTable('nested_tree').'
3359 3357
             WHERE personal_folder=%i',
3360 3358
             0
3361 3359
         );
@@ -3372,8 +3370,8 @@  discard block
 block discarded – undo
3372 3370
         $rows_tmp = DB::query(
3373 3371
             'SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory,
3374 3372
             f.id_category AS category_id
3375
-            FROM ' . prefixTable('categories_folders') . ' AS f
3376
-            INNER JOIN ' . prefixTable('categories') . ' AS c ON (f.id_category = c.parent_id)
3373
+            FROM ' . prefixTable('categories_folders').' AS f
3374
+            INNER JOIN ' . prefixTable('categories').' AS c ON (f.id_category = c.parent_id)
3377 3375
             WHERE id_folder=%i',
3378 3376
             $folder
3379 3377
         );
@@ -3399,7 +3397,7 @@  discard block
 block discarded – undo
3399 3397
         $valTemp = '';
3400 3398
         $data = DB::queryFirstRow(
3401 3399
             'SELECT valeur
3402
-            FROM ' . prefixTable('misc') . '
3400
+            FROM ' . prefixTable('misc').'
3403 3401
             WHERE type = %s AND intitule=%i',
3404 3402
             'complex',
3405 3403
             $folder
@@ -3416,14 +3414,14 @@  discard block
 block discarded – undo
3416 3414
         $valTemp = '';
3417 3415
         $rows_tmp = DB::query(
3418 3416
             'SELECT t.title
3419
-            FROM ' . prefixTable('roles_values') . ' as v
3420
-            INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id)
3417
+            FROM ' . prefixTable('roles_values').' as v
3418
+            INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id)
3421 3419
             WHERE v.folder_id = %i
3422 3420
             GROUP BY title',
3423 3421
             $folder
3424 3422
         );
3425 3423
         foreach ($rows_tmp as $record) {
3426
-            $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $record['title'];
3424
+            $valTemp .= (empty($valTemp) === true ? '' : ' - ').$record['title'];
3427 3425
         }
3428 3426
         $arr_data['visibilityRoles'] = $valTemp;
3429 3427
 
@@ -3456,7 +3454,7 @@  discard block
 block discarded – undo
3456 3454
         // loop on users and check if user has this role
3457 3455
         $rows = DB::query(
3458 3456
             'SELECT id, fonction_id
3459
-            FROM ' . prefixTable('users') . '
3457
+            FROM ' . prefixTable('users').'
3460 3458
             WHERE id != %i AND admin = 0 AND fonction_id IS NOT NULL AND fonction_id != ""',
3461 3459
             $session->get('user-id')
3462 3460
         );
@@ -3488,7 +3486,7 @@  discard block
 block discarded – undo
3488 3486
 
3489 3487
     $val = DB::queryfirstrow(
3490 3488
         'SELECT *
3491
-        FROM ' . prefixTable('users') . '
3489
+        FROM ' . prefixTable('users').'
3492 3490
         WHERE id = %i',
3493 3491
         $userId
3494 3492
     );
@@ -3504,12 +3502,12 @@  discard block
 block discarded – undo
3504 3502
 function upgradeRequired(): bool
3505 3503
 {
3506 3504
     // Get settings.php
3507
-    include_once __DIR__. '/../includes/config/settings.php';
3505
+    include_once __DIR__.'/../includes/config/settings.php';
3508 3506
 
3509 3507
     // Get timestamp in DB
3510 3508
     $val = DB::queryfirstrow(
3511 3509
         'SELECT valeur
3512
-        FROM ' . prefixTable('misc') . '
3510
+        FROM ' . prefixTable('misc').'
3513 3511
         WHERE type = %s AND intitule = %s',
3514 3512
         'admin',
3515 3513
         'upgrade_timestamp'
@@ -3560,7 +3558,7 @@  discard block
 block discarded – undo
3560 3558
     // prepapre background tasks for item keys generation        
3561 3559
     $userTP = DB::queryFirstRow(
3562 3560
         'SELECT pw, public_key, private_key
3563
-        FROM ' . prefixTable('users') . '
3561
+        FROM ' . prefixTable('users').'
3564 3562
         WHERE id = %i',
3565 3563
         TP_USER_ID
3566 3564
     );
@@ -3621,7 +3619,7 @@  discard block
 block discarded – undo
3621 3619
     }
3622 3620
 
3623 3621
     // Generate new keys
3624
-    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false){
3622
+    if ($user_self_change === true && empty($recovery_public_key) === false && empty($recovery_private_key) === false) {
3625 3623
         $userKeys = [
3626 3624
             'public_key' => $recovery_public_key,
3627 3625
             'private_key_clear' => $recovery_private_key,
@@ -3664,8 +3662,8 @@  discard block
 block discarded – undo
3664 3662
             'process_type' => 'create_user_keys',
3665 3663
             'arguments' => json_encode([
3666 3664
                 'new_user_id' => (int) $userId,
3667
-                'new_user_pwd' => cryption($passwordClear, '','encrypt')['string'],
3668
-                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '','encrypt')['string'],
3665
+                'new_user_pwd' => cryption($passwordClear, '', 'encrypt')['string'],
3666
+                'new_user_code' => cryption(empty($encryptionKey) === true ? uniqidReal(20) : $encryptionKey, '', 'encrypt')['string'],
3669 3667
                 'owner_id' => (int) TP_USER_ID,
3670 3668
                 'creator_pwd' => $userTP['pw'],
3671 3669
                 'send_email' => $sendEmailToUser === true ? 1 : 0,
@@ -3955,7 +3953,7 @@  discard block
 block discarded – undo
3955 3953
  */
3956 3954
 function createTaskForItem(
3957 3955
     string $processType,
3958
-    string|array $taskName,
3956
+    string | array $taskName,
3959 3957
     int $itemId,
3960 3958
     int $userId,
3961 3959
     string $objectKey,
@@ -3979,7 +3977,7 @@  discard block
 block discarded – undo
3979 3977
                 'object_key' => $objectKey,
3980 3978
                 'author' => (int) $userId,
3981 3979
             ]),
3982
-            'item_id' => (int) $parentId !== -1 ?  $parentId : null,
3980
+            'item_id' => (int) $parentId !== -1 ? $parentId : null,
3983 3981
         )
3984 3982
     );
3985 3983
     $processId = DB::insertId();
@@ -3989,7 +3987,7 @@  discard block
 block discarded – undo
3989 3987
     if (is_array($taskName) === false) {
3990 3988
         $taskName = [$taskName];
3991 3989
     }
3992
-    foreach($taskName as $task) {
3990
+    foreach ($taskName as $task) {
3993 3991
         if (WIP === true) error_log('createTaskForItem - task: '.$task);
3994 3992
         switch ($task) {
3995 3993
             case 'item_password':
@@ -4086,7 +4084,7 @@  discard block
 block discarded – undo
4086 4084
  * @param integer $user_id
4087 4085
  * @return void
4088 4086
  */
4089
-function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0)
4087
+function purgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0)
4090 4088
 {
4091 4089
     if ($allUsers === true) {
4092 4090
         // Load class DB
@@ -4096,7 +4094,7 @@  discard block
 block discarded – undo
4096 4094
 
4097 4095
         $users = DB::query(
4098 4096
             'SELECT id
4099
-            FROM ' . prefixTable('users') . '
4097
+            FROM ' . prefixTable('users').'
4100 4098
             WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.')
4101 4099
             ORDER BY login ASC'
4102 4100
         );
@@ -4114,7 +4112,7 @@  discard block
 block discarded – undo
4114 4112
  * @param integer $user_id
4115 4113
  * @return void
4116 4114
  */
4117
-function purgeUnnecessaryKeysForUser(int $user_id=0)
4115
+function purgeUnnecessaryKeysForUser(int $user_id = 0)
4118 4116
 {
4119 4117
     if ($user_id === 0) {
4120 4118
         return;
@@ -4125,8 +4123,8 @@  discard block
 block discarded – undo
4125 4123
 
4126 4124
     $personalItems = DB::queryFirstColumn(
4127 4125
         'SELECT id
4128
-        FROM ' . prefixTable('items') . ' AS i
4129
-        INNER JOIN ' . prefixTable('log_items') . ' AS li ON li.id_item = i.id
4126
+        FROM ' . prefixTable('items').' AS i
4127
+        INNER JOIN ' . prefixTable('log_items').' AS li ON li.id_item = i.id
4130 4128
         WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN (%i, '.TP_USER_ID.')',
4131 4129
         $user_id
4132 4130
     );
@@ -4175,7 +4173,7 @@  discard block
 block discarded – undo
4175 4173
     // Check if user exists
4176 4174
     $userInfo = DB::queryFirstRow(
4177 4175
         'SELECT login
4178
-        FROM ' . prefixTable('users') . '
4176
+        FROM ' . prefixTable('users').'
4179 4177
         WHERE id = %i',
4180 4178
         $userId
4181 4179
     );
@@ -4184,7 +4182,7 @@  discard block
 block discarded – undo
4184 4182
         $now = (int) time();
4185 4183
         // Prepare file content
4186 4184
         $export_value = file_get_contents(__DIR__."/../includes/core/teampass_ascii.txt")."\n".
4187
-            "Generation date: ".date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now)."\n\n".
4185
+            "Generation date: ".date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now)."\n\n".
4188 4186
             "RECOVERY KEYS - Not to be shared - To be store safely\n\n".
4189 4187
             "Public Key:\n".$session->get('user-public_key')."\n\n".
4190 4188
             "Private Key:\n".$session->get('user-private_key')."\n\n";
@@ -4207,7 +4205,7 @@  discard block
 block discarded – undo
4207 4205
         return prepareExchangedData(
4208 4206
             array(
4209 4207
                 'error' => false,
4210
-                'datetime' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $now),
4208
+                'datetime' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $now),
4211 4209
                 'timestamp' => $now,
4212 4210
                 'content' => base64_encode($export_value),
4213 4211
                 'login' => $userInfo['login'],
@@ -4233,8 +4231,8 @@  discard block
 block discarded – undo
4233 4231
  */
4234 4232
 function loadClasses(string $className = ''): void
4235 4233
 {
4236
-    require_once __DIR__. '/../includes/config/include.php';
4237
-    require_once __DIR__. '/../includes/config/settings.php';
4234
+    require_once __DIR__.'/../includes/config/include.php';
4235
+    require_once __DIR__.'/../includes/config/settings.php';
4238 4236
     require_once __DIR__.'/../vendor/autoload.php';
4239 4237
 
4240 4238
     if (defined('DB_PASSWD_CLEAR') === false) {
@@ -4445,7 +4443,7 @@  discard block
 block discarded – undo
4445 4443
 
4446 4444
     // Get current user hash
4447 4445
     $userHash = DB::queryFirstRow(
4448
-        "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
4446
+        "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
4449 4447
         $session->get('user-id')
4450 4448
     )['pw'];
4451 4449
 
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.
sources/main.queries.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 ) {
82 82
     // Not allowed page
83 83
     $session->set('system-error_code', ERR_NOT_ALLOWED);
84
-    include $SETTINGS['cpassman_dir'] . '/error.php';
84
+    include $SETTINGS['cpassman_dir'].'/error.php';
85 85
     exit;
86 86
 }
87 87
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
             // Get current user hash
271 271
             $userHash = DB::queryFirstRow(
272
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
272
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
273 273
                 $session->get('user-id')
274 274
             )['pw'];
275 275
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
  * @param string $post_key
326 326
  * @return string
327 327
  */
328
-function userHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS, string $post_key): string
328
+function userHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS, string $post_key): string
329 329
 {
330 330
     $session = SessionManager::getSession();
331 331
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     if (isset($dataReceived['user_id'])) {
361 361
         // Get info about user to modify
362 362
         $targetUserInfos = DB::queryfirstrow(
363
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
363
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
364 364
             WHERE id = %i',
365 365
             $dataReceived['user_id']
366 366
         );
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         case 'mail_me'://action_mail
510 510
             // Get info about user to send email
511 511
             $data_user = DB::queryfirstrow(
512
-                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
512
+                'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
513 513
                 WHERE email = %s',
514 514
                 filter_var($dataReceived['receipt'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)
515 515
             );
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
     if (isset($dataReceived['user_id'])) {
623 623
         // Get info about user to modify
624 624
         $targetUserInfos = DB::queryfirstrow(
625
-            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM ' . prefixTable('users') . '
625
+            'SELECT admin, gestionnaire, can_manage_all_users, isAdministratedByRole FROM '.prefixTable('users').'
626 626
             WHERE id = %i',
627 627
             $dataReceived['user_id']
628 628
         );
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
             // Get current user hash
703 703
             $userHash = DB::queryFirstRow(
704
-                "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
704
+                "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
705 705
                 $session->get('user-id')
706 706
             )['pw'];
707 707
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 
740 740
                 // Get current user hash
741 741
                 $userHash = DB::queryFirstRow(
742
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %d;",
742
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %d;",
743 743
                     $session->get('user-id')
744 744
                 )['pw'];
745 745
 
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 
784 784
                 // Get current user hash
785 785
                 $userHash = DB::queryFirstRow(
786
-                    "SELECT pw FROM " . prefixtable('users') . " WHERE id = %i;",
786
+                    "SELECT pw FROM ".prefixtable('users')." WHERE id = %i;",
787 787
                     $session->get('user-id')
788 788
                 )['pw'];
789 789
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
  * @param array $SETTINGS
828 828
  * @return string
829 829
  */
830
-function systemHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
830
+function systemHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
831 831
 {
832 832
     $session = SessionManager::getSession();
833 833
     switch ($post_type) {
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                 )
929 929
             );
930 930
 
931
-            return '[{"token" : "' . $token . '"}]';
931
+            return '[{"token" : "'.$token.'"}]';
932 932
 
933 933
         /*
934 934
         * Default case
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 }
945 945
 
946 946
 
947
-function utilsHandler(string $post_type, array|null|string $dataReceived, array $SETTINGS): string
947
+function utilsHandler(string $post_type, array | null | string $dataReceived, array $SETTINGS): string
948 948
 {
949 949
     switch ($post_type) {
950 950
         /*
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
         array(
1014 1014
             'error' => false,
1015 1015
             'timestamp' => $session->get('user-session_duration'),
1016
-            'max_time_to_add' => intdiv((($maximum_session_expiration_time*60) - ((int) $session->get('user-session_duration') - time())), 60),
1016
+            'max_time_to_add' => intdiv((($maximum_session_expiration_time * 60) - ((int) $session->get('user-session_duration') - time())), 60),
1017 1017
             'max_session_duration' => $maximum_session_expiration_time,
1018 1018
         ),
1019 1019
         'encode'
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
     // get number of items
1066 1066
     DB::queryFirstRow(
1067 1067
         'SELECT increment_id
1068
-        FROM ' . prefixTable('sharekeys_items') .
1068
+        FROM ' . prefixTable('sharekeys_items').
1069 1069
         ' WHERE user_id = %i',
1070 1070
         $userId
1071 1071
     );
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
         // check if expected security level is reached
1121 1121
         $dataUser = DB::queryfirstrow(
1122 1122
             'SELECT *
1123
-            FROM ' . prefixTable('users') . ' WHERE id = %i',
1123
+            FROM ' . prefixTable('users').' WHERE id = %i',
1124 1124
             $post_user_id
1125 1125
         );
1126 1126
 
@@ -1141,8 +1141,8 @@  discard block
 block discarded – undo
1141 1141
         if (empty($dataUser['fonction_id']) === false) {
1142 1142
             $data = DB::queryFirstRow(
1143 1143
                 'SELECT complexity
1144
-                FROM ' . prefixTable('roles_title') . '
1145
-                WHERE id IN (' . $dataUser['fonction_id'] . ')
1144
+                FROM ' . prefixTable('roles_title').'
1145
+                WHERE id IN (' . $dataUser['fonction_id'].')
1146 1146
                 ORDER BY complexity DESC'
1147 1147
             );
1148 1148
         } else {
@@ -1155,8 +1155,8 @@  discard block
 block discarded – undo
1155 1155
             return prepareExchangedData(
1156 1156
                 array(
1157 1157
                     'error' => true,
1158
-                    'message' => '<div style="margin:10px 0 10px 15px;">' . $lang->get('complexity_level_not_reached') . '.<br>' .
1159
-                        $lang->get('expected_complexity_level') . ': <b>' . TP_PW_COMPLEXITY[$data['complexity']][1] . '</b></div>',
1158
+                    'message' => '<div style="margin:10px 0 10px 15px;">'.$lang->get('complexity_level_not_reached').'.<br>'.
1159
+                        $lang->get('expected_complexity_level').': <b>'.TP_PW_COMPLEXITY[$data['complexity']][1].'</b></div>',
1160 1160
                 ),
1161 1161
                 'encode'
1162 1162
             );
@@ -1260,14 +1260,14 @@  discard block
 block discarded – undo
1260 1260
         // Get data about user
1261 1261
         $dataUser = DB::queryfirstrow(
1262 1262
             'SELECT id, email, pw
1263
-            FROM ' . prefixTable('users') . '
1263
+            FROM ' . prefixTable('users').'
1264 1264
             WHERE login = %s',
1265 1265
             $post_login
1266 1266
         );
1267 1267
     } else {
1268 1268
         $dataUser = DB::queryfirstrow(
1269 1269
             'SELECT id, login, email, pw
1270
-            FROM ' . prefixTable('users') . '
1270
+            FROM ' . prefixTable('users').'
1271 1271
             WHERE id = %i',
1272 1272
             $post_id
1273 1273
         );
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
     // Check if token already used
1322 1322
     $dataToken = DB::queryfirstrow(
1323 1323
         'SELECT end_timestamp, reason
1324
-        FROM ' . prefixTable('tokens') . '
1324
+        FROM ' . prefixTable('tokens').'
1325 1325
         WHERE token = %s AND user_id = %i',
1326 1326
         $post_token,
1327 1327
         $dataUser['id']
@@ -1332,11 +1332,11 @@  discard block
 block discarded – undo
1332 1332
         return prepareExchangedData(
1333 1333
             array(
1334 1334
                 'error' => true,
1335
-                'message' => 'TOKEN already used',//$lang->get('no_email_set'),
1335
+                'message' => 'TOKEN already used', //$lang->get('no_email_set'),
1336 1336
             ),
1337 1337
             'encode'
1338 1338
         );
1339
-    } elseif(DB::count() === 0) {
1339
+    } elseif (DB::count() === 0) {
1340 1340
         // Store token for this action
1341 1341
         DB::insert(
1342 1342
             prefixTable('tokens'),
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
                 'email' => $dataUser['email'],
1399 1399
                 'email_result' => str_replace(
1400 1400
                     '#email#',
1401
-                    '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1401
+                    '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1402 1402
                     addslashes($lang->get('admin_email_result_ok'))
1403 1403
                 ),
1404 1404
             ),
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
             'email' => $dataUser['email'],
1415 1415
             'email_result' => str_replace(
1416 1416
                 '#email#',
1417
-                '<b>' . obfuscateEmail($dataUser['email']) . '</b>',
1417
+                '<b>'.obfuscateEmail($dataUser['email']).'</b>',
1418 1418
                 addslashes($lang->get('admin_email_result_ok'))
1419 1419
             ),
1420 1420
         ),
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 
1432 1432
     if (isKeyExistingAndEqual('enable_send_email_on_user_login', 1, $SETTINGS) === true) {
1433 1433
         $row = DB::queryFirstRow(
1434
-            'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s',
1434
+            'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s',
1435 1435
             'cron',
1436 1436
             'sending_emails'
1437 1437
         );
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
         if ((int) (time() - $row['valeur']) >= 300 || (int) $row['valeur'] === 0) {
1440 1440
             $rows = DB::query(
1441 1441
                 'SELECT *
1442
-                FROM ' . prefixTable('emails') .
1442
+                FROM ' . prefixTable('emails').
1443 1443
                 ' WHERE status != %s',
1444 1444
                 'sent'
1445 1445
             );
@@ -1491,8 +1491,8 @@  discard block
 block discarded – undo
1491 1491
     $arr_html = array();
1492 1492
     $rows = DB::query(
1493 1493
         'SELECT i.id AS id, i.label AS label, i.id_tree AS id_tree, l.date, i.perso AS perso, i.restricted_to AS restricted
1494
-        FROM ' . prefixTable('log_items') . ' AS l
1495
-        RIGHT JOIN ' . prefixTable('items') . ' AS i ON (l.id_item = i.id)
1494
+        FROM ' . prefixTable('log_items').' AS l
1495
+        RIGHT JOIN ' . prefixTable('items').' AS i ON (l.id_item = i.id)
1496 1496
         WHERE l.action = %s AND l.id_user = %i
1497 1497
         ORDER BY l.date DESC
1498 1498
         LIMIT 0, 100',
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
     if (isKeyExistingAndEqual('enable_suggestion', 1, $SETTINGS) === true
1525 1525
         && ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1)
1526 1526
     ) {
1527
-        DB::query('SELECT * FROM ' . prefixTable('suggestion'));
1527
+        DB::query('SELECT * FROM '.prefixTable('suggestion'));
1528 1528
         $nb_suggestions_waiting = DB::count();
1529 1529
     }
1530 1530
 
@@ -1559,13 +1559,13 @@  discard block
 block discarded – undo
1559 1559
             if ($data === 'stat_languages') {
1560 1560
                 $tmp = '';
1561 1561
                 foreach ($stats_data[$data] as $key => $value) {
1562
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1562
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1563 1563
                 }
1564 1564
                 $statsToSend[$data] = $tmp;
1565 1565
             } elseif ($data === 'stat_country') {
1566 1566
                 $tmp = '';
1567 1567
                 foreach ($stats_data[$data] as $key => $value) {
1568
-                    $tmp .= $tmp === '' ? $key . '-' . $value : ',' . $key . '-' . $value;
1568
+                    $tmp .= $tmp === '' ? $key.'-'.$value : ','.$key.'-'.$value;
1569 1569
                 }
1570 1570
                 $statsToSend[$data] = $tmp;
1571 1571
             } else {
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
             $url_found = $value;
1653 1653
             if (empty($url_found) === false) {
1654 1654
                 $tmp = parse_url($url_found);
1655
-                $anonym_url = $tmp['scheme'] . '://<anonym_url>' . (isset($tmp['path']) === true ? $tmp['path'] : '');
1655
+                $anonym_url = $tmp['scheme'].'://<anonym_url>'.(isset($tmp['path']) === true ? $tmp['path'] : '');
1656 1656
                 $value = $anonym_url;
1657 1657
             } else {
1658 1658
                 $value = '';
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
     $teampass_errors = '';
1683 1683
     $rows = DB::query(
1684 1684
         'SELECT label, date AS error_date
1685
-        FROM ' . prefixTable('log_system') . "
1685
+        FROM ' . prefixTable('log_system')."
1686 1686
         WHERE `type` LIKE 'error'
1687 1687
         ORDER BY `date` DESC
1688 1688
         LIMIT 0, 10"
@@ -1690,9 +1690,9 @@  discard block
 block discarded – undo
1690 1690
     if (DB::count() > 0) {
1691 1691
         foreach ($rows as $record) {
1692 1692
             if (empty($teampass_errors) === true) {
1693
-                $teampass_errors = ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1693
+                $teampass_errors = ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1694 1694
             } else {
1695
-                $teampass_errors .= ' * ' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['error_date']) . ' - ' . $record['label'];
1695
+                $teampass_errors .= ' * '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['error_date']).' - '.$record['label'];
1696 1696
             }
1697 1697
         }
1698 1698
     }
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 
1702 1702
     // Now prepare text
1703 1703
     $txt = '### Page on which it happened
1704
-' . $data['current_page'] . '
1704
+' . $data['current_page'].'
1705 1705
 
1706 1706
 ### Steps to reproduce
1707 1707
 1.
@@ -1716,39 +1716,39 @@  discard block
 block discarded – undo
1716 1716
 Tell us what happens instead
1717 1717
 
1718 1718
 ### Server configuration
1719
-**Operating system**: ' . php_uname() . '
1719
+**Operating system**: ' . php_uname().'
1720 1720
 
1721
-**Web server:** ' . $_SERVER['SERVER_SOFTWARE'] . '
1721
+**Web server:** ' . $_SERVER['SERVER_SOFTWARE'].'
1722 1722
 
1723
-**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)) . '
1723
+**Database:** ' . ($link === false ? $lang->get('undefined') : mysqli_get_server_info($link)).'
1724 1724
 
1725
-**PHP version:** ' . PHP_VERSION . '
1725
+**PHP version:** ' . PHP_VERSION.'
1726 1726
 
1727
-**Teampass version:** ' . TP_VERSION . '.' . TP_VERSION_MINOR . '
1727
+**Teampass version:** ' . TP_VERSION.'.'.TP_VERSION_MINOR.'
1728 1728
 
1729 1729
 **Teampass configuration variables:**
1730 1730
 ```
1731
-' . $list_of_options . '
1731
+' . $list_of_options.'
1732 1732
 ```
1733 1733
 
1734 1734
 **Updated from an older Teampass or fresh install:**
1735 1735
 
1736 1736
 ### Client configuration
1737 1737
 
1738
-**Browser:** ' . $data['browser_name'] . ' - ' . $data['browser_version'] . '
1738
+**Browser:** ' . $data['browser_name'].' - '.$data['browser_version'].'
1739 1739
 
1740
-**Operating system:** ' . $data['os'] . ' - ' . $data['os_archi'] . 'bits
1740
+**Operating system:** ' . $data['os'].' - '.$data['os_archi'].'bits
1741 1741
 
1742 1742
 ### Logs
1743 1743
 
1744 1744
 #### Web server error log
1745 1745
 ```
1746
-' . $err['message'] . ' - ' . $err['file'] . ' (' . $err['line'] . ')
1746
+' . $err['message'].' - '.$err['file'].' ('.$err['line'].')
1747 1747
 ```
1748 1748
 
1749 1749
 #### Teampass 10 last system errors
1750 1750
 ```
1751
-' . $teampass_errors . '
1751
+' . $teampass_errors.'
1752 1752
 ```
1753 1753
 
1754 1754
 #### Log from the web-browser developer console (CTRL + SHIFT + i)
@@ -1788,7 +1788,7 @@  discard block
 block discarded – undo
1788 1788
         // Check if user exists
1789 1789
         $userInfo = DB::queryFirstRow(
1790 1790
             'SELECT public_key, private_key, pw, auth_type
1791
-            FROM ' . prefixTable('users') . '
1791
+            FROM ' . prefixTable('users').'
1792 1792
             WHERE id = %i',
1793 1793
             $post_user_id
1794 1794
         );
@@ -1797,9 +1797,9 @@  discard block
 block discarded – undo
1797 1797
             // Get one item
1798 1798
             $currentUserKey = DB::queryFirstRow(
1799 1799
                 'SELECT object_id, share_key, increment_id
1800
-                FROM ' . prefixTable('sharekeys_items') . ' AS si
1801
-                INNER JOIN ' . prefixTable('items') . ' AS i ON  (i.id = si.object_id)
1802
-                INNER JOIN ' . prefixTable('nested_tree') . ' AS nt ON  (i.id_tree = nt.id)
1800
+                FROM ' . prefixTable('sharekeys_items').' AS si
1801
+                INNER JOIN ' . prefixTable('items').' AS i ON  (i.id = si.object_id)
1802
+                INNER JOIN ' . prefixTable('nested_tree').' AS nt ON  (i.id_tree = nt.id)
1803 1803
                 WHERE user_id = %i AND nt.personal_folder = %i',
1804 1804
                 $post_user_id,
1805 1805
                 0
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
         // Get user info
1894 1894
         $userData = DB::queryFirstRow(
1895 1895
             'SELECT private_key
1896
-            FROM ' . prefixTable('users') . '
1896
+            FROM ' . prefixTable('users').'
1897 1897
             WHERE id = %i',
1898 1898
             $post_user_id
1899 1899
         );
@@ -1974,7 +1974,7 @@  discard block
 block discarded – undo
1974 1974
         // Get user info
1975 1975
         $userData = DB::queryFirstRow(
1976 1976
             'SELECT email, auth_type, login
1977
-            FROM ' . prefixTable('users') . '
1977
+            FROM ' . prefixTable('users').'
1978 1978
             WHERE id = %i',
1979 1979
             $post_user_id
1980 1980
         );
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
         // Get user info
2073 2073
         $userData = DB::queryFirstRow(
2074 2074
             'SELECT email, auth_type, login
2075
-            FROM ' . prefixTable('users') . '
2075
+            FROM ' . prefixTable('users').'
2076 2076
             WHERE id = %i',
2077 2077
             $post_user_id
2078 2078
         );
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
         // Check if user exists
2139 2139
         DB::queryFirstRow(
2140 2140
             'SELECT *
2141
-            FROM ' . prefixTable('users') . '
2141
+            FROM ' . prefixTable('users').'
2142 2142
             WHERE id = %i',
2143 2143
             $post_user_id
2144 2144
         );
@@ -2208,7 +2208,7 @@  discard block
 block discarded – undo
2208 2208
         // Check if user exists
2209 2209
         $userInfo = DB::queryFirstRow(
2210 2210
             'SELECT public_key
2211
-            FROM ' . prefixTable('users') . '
2211
+            FROM ' . prefixTable('users').'
2212 2212
             WHERE id = %i',
2213 2213
             $post_user_id
2214 2214
         );
@@ -2356,15 +2356,15 @@  discard block
 block discarded – undo
2356 2356
     // Loop on items
2357 2357
     $rows = DB::query(
2358 2358
         'SELECT id, pw
2359
-        FROM ' . prefixTable('items') . '
2359
+        FROM ' . prefixTable('items').'
2360 2360
         WHERE perso = 0
2361
-        LIMIT ' . $post_start . ', ' . $post_length
2361
+        LIMIT ' . $post_start.', '.$post_length
2362 2362
     );
2363 2363
     foreach ($rows as $record) {
2364 2364
         // Get itemKey from current user
2365 2365
         $currentUserKey = DB::queryFirstRow(
2366 2366
             'SELECT share_key, increment_id
2367
-            FROM ' . prefixTable('sharekeys_items') . '
2367
+            FROM ' . prefixTable('sharekeys_items').'
2368 2368
             WHERE object_id = %i AND user_id = %i',
2369 2369
             $record['id'],
2370 2370
             $session->get('user-id')
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2397 2397
                 $currentUserKey = DB::queryFirstRow(
2398 2398
                     'SELECT increment_id
2399
-                    FROM ' . prefixTable('sharekeys_items') . '
2399
+                    FROM ' . prefixTable('sharekeys_items').'
2400 2400
                     WHERE object_id = %i AND user_id = %i',
2401 2401
                     $record['id'],
2402 2402
                     $post_user_id
@@ -2429,7 +2429,7 @@  discard block
 block discarded – undo
2429 2429
     // SHould we change step?
2430 2430
     DB::query(
2431 2431
         'SELECT *
2432
-        FROM ' . prefixTable('items') . '
2432
+        FROM ' . prefixTable('items').'
2433 2433
         WHERE perso = 0'
2434 2434
     );
2435 2435
 
@@ -2454,15 +2454,15 @@  discard block
 block discarded – undo
2454 2454
     // Loop on logs
2455 2455
     $rows = DB::query(
2456 2456
         'SELECT increment_id
2457
-        FROM ' . prefixTable('log_items') . '
2457
+        FROM ' . prefixTable('log_items').'
2458 2458
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"
2459
-        LIMIT ' . $post_start . ', ' . $post_length
2459
+        LIMIT ' . $post_start.', '.$post_length
2460 2460
     );
2461 2461
     foreach ($rows as $record) {
2462 2462
         // Get itemKey from current user
2463 2463
         $currentUserKey = DB::queryFirstRow(
2464 2464
             'SELECT share_key
2465
-            FROM ' . prefixTable('sharekeys_logs') . '
2465
+            FROM ' . prefixTable('sharekeys_logs').'
2466 2466
             WHERE object_id = %i AND user_id = %i',
2467 2467
             $record['increment_id'],
2468 2468
             $session->get('user-id')
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2495 2495
                 $currentUserKey = DB::queryFirstRow(
2496 2496
                     'SELECT increment_id
2497
-                    FROM ' . prefixTable('sharekeys_items') . '
2497
+                    FROM ' . prefixTable('sharekeys_items').'
2498 2498
                     WHERE object_id = %i AND user_id = %i',
2499 2499
                     $record['id'],
2500 2500
                     $post_user_id
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
     // SHould we change step?
2517 2517
     DB::query(
2518 2518
         'SELECT increment_id
2519
-        FROM ' . prefixTable('log_items') . '
2519
+        FROM ' . prefixTable('log_items').'
2520 2520
         WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
2521 2521
     );
2522 2522
 
@@ -2541,15 +2541,15 @@  discard block
 block discarded – undo
2541 2541
     // Loop on fields
2542 2542
     $rows = DB::query(
2543 2543
         'SELECT id
2544
-        FROM ' . prefixTable('categories_items') . '
2544
+        FROM ' . prefixTable('categories_items').'
2545 2545
         WHERE encryption_type = "teampass_aes"
2546
-        LIMIT ' . $post_start . ', ' . $post_length
2546
+        LIMIT ' . $post_start.', '.$post_length
2547 2547
     );
2548 2548
     foreach ($rows as $record) {
2549 2549
         // Get itemKey from current user
2550 2550
         $currentUserKey = DB::queryFirstRow(
2551 2551
             'SELECT share_key
2552
-            FROM ' . prefixTable('sharekeys_fields') . '
2552
+            FROM ' . prefixTable('sharekeys_fields').'
2553 2553
             WHERE object_id = %i AND user_id = %i',
2554 2554
             $record['id'],
2555 2555
             $session->get('user-id')
@@ -2581,7 +2581,7 @@  discard block
 block discarded – undo
2581 2581
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2582 2582
                 $currentUserKey = DB::queryFirstRow(
2583 2583
                     'SELECT increment_id
2584
-                    FROM ' . prefixTable('sharekeys_items') . '
2584
+                    FROM ' . prefixTable('sharekeys_items').'
2585 2585
                     WHERE object_id = %i AND user_id = %i',
2586 2586
                     $record['id'],
2587 2587
                     $post_user_id
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
     // SHould we change step?
2604 2604
     DB::query(
2605 2605
         'SELECT *
2606
-        FROM ' . prefixTable('categories_items') . '
2606
+        FROM ' . prefixTable('categories_items').'
2607 2607
         WHERE encryption_type = "teampass_aes"'
2608 2608
     );
2609 2609
 
@@ -2628,14 +2628,14 @@  discard block
 block discarded – undo
2628 2628
     // Loop on suggestions
2629 2629
     $rows = DB::query(
2630 2630
         'SELECT id
2631
-        FROM ' . prefixTable('suggestion') . '
2632
-        LIMIT ' . $post_start . ', ' . $post_length
2631
+        FROM ' . prefixTable('suggestion').'
2632
+        LIMIT ' . $post_start.', '.$post_length
2633 2633
     );
2634 2634
     foreach ($rows as $record) {
2635 2635
         // Get itemKey from current user
2636 2636
         $currentUserKey = DB::queryFirstRow(
2637 2637
             'SELECT share_key
2638
-            FROM ' . prefixTable('sharekeys_suggestions') . '
2638
+            FROM ' . prefixTable('sharekeys_suggestions').'
2639 2639
             WHERE object_id = %i AND user_id = %i',
2640 2640
             $record['id'],
2641 2641
             $session->get('user-id')
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2668 2668
                 $currentUserKey = DB::queryFirstRow(
2669 2669
                     'SELECT increment_id
2670
-                    FROM ' . prefixTable('sharekeys_items') . '
2670
+                    FROM ' . prefixTable('sharekeys_items').'
2671 2671
                     WHERE object_id = %i AND user_id = %i',
2672 2672
                     $record['id'],
2673 2673
                     $post_user_id
@@ -2713,15 +2713,15 @@  discard block
 block discarded – undo
2713 2713
     // Loop on files
2714 2714
     $rows = DB::query(
2715 2715
         'SELECT id
2716
-        FROM ' . prefixTable('files') . '
2717
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"
2718
-        LIMIT ' . $post_start . ', ' . $post_length
2716
+        FROM ' . prefixTable('files').'
2717
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"
2718
+        LIMIT ' . $post_start.', '.$post_length
2719 2719
     ); //aes_encryption
2720 2720
     foreach ($rows as $record) {
2721 2721
         // Get itemKey from current user
2722 2722
         $currentUserKey = DB::queryFirstRow(
2723 2723
             'SELECT share_key
2724
-            FROM ' . prefixTable('sharekeys_files') . '
2724
+            FROM ' . prefixTable('sharekeys_files').'
2725 2725
             WHERE object_id = %i AND user_id = %i',
2726 2726
             $record['id'],
2727 2727
             $session->get('user-id')
@@ -2753,7 +2753,7 @@  discard block
 block discarded – undo
2753 2753
             if ((int) $post_user_id !== (int) $session->get('user-id')) {
2754 2754
                 $currentUserKey = DB::queryFirstRow(
2755 2755
                     'SELECT increment_id
2756
-                    FROM ' . prefixTable('sharekeys_items') . '
2756
+                    FROM ' . prefixTable('sharekeys_items').'
2757 2757
                     WHERE object_id = %i AND user_id = %i',
2758 2758
                     $record['id'],
2759 2759
                     $post_user_id
@@ -2775,8 +2775,8 @@  discard block
 block discarded – undo
2775 2775
     // SHould we change step?
2776 2776
     DB::query(
2777 2777
         'SELECT *
2778
-        FROM ' . prefixTable('files') . '
2779
-        WHERE status = "' . TP_ENCRYPTION_NAME . '"'
2778
+        FROM ' . prefixTable('files').'
2779
+        WHERE status = "' . TP_ENCRYPTION_NAME.'"'
2780 2780
     );
2781 2781
 
2782 2782
     $next_start = (int) $post_start + (int) $post_length;
@@ -2809,9 +2809,9 @@  discard block
 block discarded – undo
2809 2809
     if (count($session->get('user-personal_folders')) > 0) {
2810 2810
         $rows = DB::query(
2811 2811
             'SELECT id, pw
2812
-            FROM ' . prefixTable('items') . '
2812
+            FROM ' . prefixTable('items').'
2813 2813
             WHERE perso = 1 AND id_tree IN %ls AND encryption_type = %s
2814
-            LIMIT ' . $post_start . ', ' . $post_length,
2814
+            LIMIT ' . $post_start.', '.$post_length,
2815 2815
             $session->get('user-personal_folders'),
2816 2816
             "defuse"
2817 2817
         );
@@ -2819,7 +2819,7 @@  discard block
 block discarded – undo
2819 2819
             // Get itemKey from current user
2820 2820
             $currentUserKey = DB::queryFirstRow(
2821 2821
                 'SELECT share_key, increment_id
2822
-                FROM ' . prefixTable('sharekeys_items') . '
2822
+                FROM ' . prefixTable('sharekeys_items').'
2823 2823
                 WHERE object_id = %i AND user_id = %i',
2824 2824
                 $record['id'],
2825 2825
                 $session->get('user-id')
@@ -2846,7 +2846,7 @@  discard block
 block discarded – undo
2846 2846
                 if ((int) $post_user_id !== (int) $session->get('user-id')) {
2847 2847
                     $currentUserKey = DB::queryFirstRow(
2848 2848
                         'SELECT increment_id
2849
-                        FROM ' . prefixTable('sharekeys_items') . '
2849
+                        FROM ' . prefixTable('sharekeys_items').'
2850 2850
                         WHERE object_id = %i AND user_id = %i',
2851 2851
                         $record['id'],
2852 2852
                         $post_user_id
@@ -2869,7 +2869,7 @@  discard block
 block discarded – undo
2869 2869
     // SHould we change step?
2870 2870
     DB::query(
2871 2871
         'SELECT *
2872
-        FROM ' . prefixTable('items') . '
2872
+        FROM ' . prefixTable('items').'
2873 2873
         WHERE perso = 0'
2874 2874
     );
2875 2875
 
@@ -2897,7 +2897,7 @@  discard block
 block discarded – undo
2897 2897
         // Check if user exists
2898 2898
         $userInfo = DB::queryFirstRow(
2899 2899
             'SELECT public_key, encrypted_psk
2900
-            FROM ' . prefixTable('users') . '
2900
+            FROM ' . prefixTable('users').'
2901 2901
             WHERE id = %i',
2902 2902
             $post_user_id
2903 2903
         );
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
                 if ($post_counterItemsToTreat === -1) {
2924 2924
                     DB::query(
2925 2925
                         'SELECT id
2926
-                        FROM ' . prefixTable('items') . '
2926
+                        FROM ' . prefixTable('items').'
2927 2927
                         WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
2928 2928
                         $session->get('user-personal_folders'),
2929 2929
                         'teampass_aes'
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
                 // Loop on persoanl items
2937 2937
                 $rows = DB::query(
2938 2938
                     'SELECT id, pw
2939
-                    FROM ' . prefixTable('items') . '
2939
+                    FROM ' . prefixTable('items').'
2940 2940
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s
2941 2941
                     LIMIT ' . $post_length,
2942 2942
                     $session->get('user-personal_folders'),
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
                     // Loop on files
2981 2981
                     $rows = DB::query(
2982 2982
                         'SELECT id, file
2983
-                        FROM ' . prefixTable('files') . '
2983
+                        FROM ' . prefixTable('files').'
2984 2984
                         WHERE status != %s
2985 2985
                         AND id_item = %i',
2986 2986
                         TP_ENCRYPTION_NAME,
@@ -2991,13 +2991,13 @@  discard block
 block discarded – undo
2991 2991
                         // Now decrypt the file
2992 2992
                         prepareFileWithDefuse(
2993 2993
                             'decrypt',
2994
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'],
2995
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record2['file'] . '.delete',
2994
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'],
2995
+                            $SETTINGS['path_to_upload_folder'].'/'.$record2['file'].'.delete',
2996 2996
                             $post_user_psk
2997 2997
                         );
2998 2998
 
2999 2999
                         // Encrypt the file
3000
-                        $encryptedFile = encryptFile($record2['file'] . '.delete', $SETTINGS['path_to_upload_folder']);
3000
+                        $encryptedFile = encryptFile($record2['file'].'.delete', $SETTINGS['path_to_upload_folder']);
3001 3001
 
3002 3002
                         DB::update(
3003 3003
                             prefixTable('files'),
@@ -3020,7 +3020,7 @@  discard block
 block discarded – undo
3020 3020
                         );
3021 3021
 
3022 3022
                         // Unlink original file
3023
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record2['file']);
3023
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record2['file']);
3024 3024
                     }
3025 3025
                 }
3026 3026
 
@@ -3028,7 +3028,7 @@  discard block
 block discarded – undo
3028 3028
                 $next_start = (int) $post_start + (int) $post_length;
3029 3029
                 DB::query(
3030 3030
                     'SELECT id
3031
-                    FROM ' . prefixTable('items') . '
3031
+                    FROM ' . prefixTable('items').'
3032 3032
                     WHERE perso = 1 AND id_tree IN %ls AND encryption_type != %s',
3033 3033
                     $session->get('user-personal_folders'),
3034 3034
                     'teampass_aes'
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
         // Get user info
3099 3099
         $userData = DB::queryFirstRow(
3100 3100
             'SELECT special, auth_type, is_ready_for_usage, ongoing_process_id, otp_provided, keys_recovery_time
3101
-            FROM ' . prefixTable('users') . '
3101
+            FROM ' . prefixTable('users').'
3102 3102
             WHERE id = %i',
3103 3103
             $post_user_id
3104 3104
         );
@@ -3145,7 +3145,7 @@  discard block
 block discarded – undo
3145 3145
         // Get user info
3146 3146
         $userData = DB::queryFirstRow(
3147 3147
             'SELECT auth_type, login, private_key
3148
-            FROM ' . prefixTable('users') . '
3148
+            FROM ' . prefixTable('users').'
3149 3149
             WHERE id = %i',
3150 3150
             $post_user_id
3151 3151
         );
@@ -3195,7 +3195,7 @@  discard block
 block discarded – undo
3195 3195
                 return prepareExchangedData(
3196 3196
                     array(
3197 3197
                         'error' => false,
3198
-                        'message' => $lang->get('done'),'',
3198
+                        'message' => $lang->get('done'), '',
3199 3199
                     ),
3200 3200
                     'encode'
3201 3201
                 );
@@ -3243,7 +3243,7 @@  discard block
 block discarded – undo
3243 3243
         // Get user info
3244 3244
         $userData = DB::queryFirstRow(
3245 3245
             'SELECT auth_type, login, private_key, special
3246
-            FROM ' . prefixTable('users') . '
3246
+            FROM ' . prefixTable('users').'
3247 3247
             WHERE id = %i',
3248 3248
             $post_user_id
3249 3249
         );
@@ -3277,7 +3277,7 @@  discard block
 block discarded – undo
3277 3277
                 return prepareExchangedData(
3278 3278
                     array(
3279 3279
                         'error' => false,
3280
-                        'message' => $lang->get('done'),'',
3280
+                        'message' => $lang->get('done'), '',
3281 3281
                     ),
3282 3282
                     'encode'
3283 3283
                 );
@@ -3299,8 +3299,8 @@  discard block
 block discarded – undo
3299 3299
             // Get one itemKey from current user
3300 3300
             $currentUserKey = DB::queryFirstRow(
3301 3301
                 'SELECT ski.share_key, ski.increment_id, l.id_user
3302
-                FROM ' . prefixTable('sharekeys_items') . ' AS ski
3303
-                INNER JOIN ' . prefixTable('log_items') . ' AS l ON ski.object_id = l.id_item
3302
+                FROM ' . prefixTable('sharekeys_items').' AS ski
3303
+                INNER JOIN ' . prefixTable('log_items').' AS l ON ski.object_id = l.id_item
3304 3304
                 WHERE ski.user_id = %i
3305 3305
                 ORDER BY RAND()
3306 3306
                 LIMIT 1',
@@ -3390,7 +3390,7 @@  discard block
 block discarded – undo
3390 3390
             $session->get('user-id')
3391 3391
         );
3392 3392
         // Return data
3393
-        return '[{"new_value":"' . $session->get('user-session_duration') . '"}]';
3393
+        return '[{"new_value":"'.$session->get('user-session_duration').'"}]';
3394 3394
     }
3395 3395
     
3396 3396
     return '[{"new_value":"expired"}]';
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.