Passed
Push — dev ( 3ad29f...97f4bd )
by Nils
08:12
created
sources/utilities.queries.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 ) {
68 68
     // Not allowed page
69 69
     $_SESSION['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
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             $arrFolders = array();
122 122
             $rows = DB::query(
123 123
                 'SELECT valeur, intitule
124
-                FROM ' . prefixTable('misc') . '
124
+                FROM ' . prefixTable('misc').'
125 125
                 WHERE type  = %s',
126 126
                 'folder_deleted'
127 127
             );
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
                 'SELECT u.login as login, u.name as name, u.lastname as lastname,
144 144
                 i.id as id, i.label as label,
145 145
                 i.id_tree as id_tree, l.date as date, n.title as folder_title
146
-                FROM ' . prefixTable('log_items') . ' as l
147
-                INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
148
-                LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
149
-                LEFT JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id)
146
+                FROM ' . prefixTable('log_items').' as l
147
+                INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
148
+                LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
149
+                LEFT JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id)
150 150
                 WHERE i.inactif = %i
151 151
                 AND l.action = %s',
152 152
                 1,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                             'label' => $record['label'],
169 169
                             'date' => date($SETTINGS['date_format'], (int) $record['date']),
170 170
                             'login' => $record['login'],
171
-                            'name' => $record['name'] . ' ' . $record['lastname'],
171
+                            'name' => $record['name'].' '.$record['lastname'],
172 172
                             'folder_label' => $record['folder_title'],
173 173
                             'folder_deleted' => $thisFolder,
174 174
                         )
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
             foreach ($post_folders as $folderId) {
227 227
                 $data = DB::queryfirstrow(
228 228
                     'SELECT valeur
229
-                    FROM ' . prefixTable('misc') . "
229
+                    FROM ' . prefixTable('misc')."
230 230
                     WHERE type = 'folder_deleted'
231 231
                     AND intitule = %s",
232
-                    'f' . $folderId
232
+                    'f'.$folderId
233 233
                 );
234 234
                 if ((int) $data['valeur'] !== 0) {
235 235
                     $folderData = explode(', ', $data['valeur']);
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                         prefixTable('misc'),
257 257
                         'type = %s AND intitule = %s',
258 258
                         'folder_deleted',
259
-                        'f' . $folderId
259
+                        'f'.$folderId
260 260
                     );
261 261
 
262 262
                     // Restore all items in this folder
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                     // Get list of all items in thos folder
273 273
                     $items = DB::query(
274 274
                         'SELECT id
275
-                        FROM ' . prefixTable('items') . '
275
+                        FROM ' . prefixTable('items').'
276 276
                         WHERE id_tree = %i',
277 277
                         $folderId
278 278
                     );
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
             foreach ($post_folders as $folderId) {
362 362
                 $data = DB::queryfirstrow(
363 363
                     'SELECT valeur
364
-                    FROM ' . prefixTable('misc') . "
364
+                    FROM ' . prefixTable('misc')."
365 365
                     WHERE type = 'folder_deleted'
366 366
                     AND intitule = %s",
367
-                    'f' . $folderId
367
+                    'f'.$folderId
368 368
                 );
369 369
                 if ((int) $data['valeur'] !== 0) {
370 370
                     $folderData = explode(', ', $data['valeur']);
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                         prefixTable('misc'),
398 398
                         'type = %s AND intitule = %s',
399 399
                         'folder_deleted',
400
-                        'f' . $folderData[0]
400
+                        'f'.$folderData[0]
401 401
                     );
402 402
 
403 403
                     // Delete all items in this folder
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                     // Get list of all items in thos folder
412 412
                     $items = DB::query(
413 413
                         'SELECT id
414
-                        FROM ' . prefixTable('items') . '
414
+                        FROM ' . prefixTable('items').'
415 415
                         WHERE id_tree = %i',
416 416
                         $folderData[0]
417 417
                     );
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             ) {
501 501
                 if ($post_log_type === 'items') {
502 502
                     DB::query(
503
-                        'SELECT * FROM ' . prefixTable('log_items') . '
503
+                        'SELECT * FROM '.prefixTable('log_items').'
504 504
                         WHERE (date BETWEEN %i AND %i)'
505 505
                         . ($post_filter_action === 'all' ? '' : ' AND action = "'.$post_filter_action.'"')
506 506
                         . ((int) $post_filter_user === -1 ? '' : ' AND id_user = '.(int) $post_filter_user),
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
                 } elseif ($post_log_type === 'connections') {
521 521
                     //db::debugmode(true);
522 522
                     DB::query(
523
-                        'SELECT * FROM ' . prefixTable('log_system') . '
523
+                        'SELECT * FROM '.prefixTable('log_system').'
524 524
                         WHERE type=%s '
525 525
                         . 'AND (date BETWEEN %i AND %i)'
526 526
                         . ($post_filter_action === 'all' ? '' : ' AND action = '.$post_filter_action)
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                     );
544 544
                 } elseif ($post_log_type === 'errors') {
545 545
                     DB::query(
546
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
546
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
547 547
                             'AND (date BETWEEN %i AND %i)',
548 548
                         'error',
549 549
                         $post_date_from,
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                     );
561 561
                 } elseif ($post_log_type === 'copy') {
562 562
                     DB::query(
563
-                        'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' .
563
+                        'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '.
564 564
                             'AND (date BETWEEN %i AND %i)',
565 565
                         'at_copy',
566 566
                         $post_date_from,
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
                     );
578 578
                 } elseif ($post_log_type === 'admin') {
579 579
                     DB::query(
580
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
580
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
581 581
                             'AND (date BETWEEN %i AND %i)',
582 582
                         'admin_action',
583 583
                         $post_date_from,
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
                     );
595 595
                 } elseif ($post_log_type === 'failed') {
596 596
                     DB::query(
597
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
597
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
598 598
                             'AND (date BETWEEN %i AND %i)',
599 599
                         'failed_auth',
600 600
                         $post_date_from,
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 
665 665
             $tasks = DB::query(
666 666
                 'SELECT *
667
-                FROM ' . prefixTable('processes_tasks') . '
667
+                FROM ' . prefixTable('processes_tasks').'
668 668
                 WHERE process_id = %i',
669 669
                 $post_id
670 670
             );
@@ -672,37 +672,37 @@  discard block
 block discarded – undo
672 672
             // Get some values
673 673
             DB::query(
674 674
                 'SELECT id
675
-                FROM ' . prefixTable('items') . '
675
+                FROM ' . prefixTable('items').'
676 676
                 WHERE perso = 0'
677 677
             );
678 678
             $items_number = DB::count();
679 679
 
680 680
             DB::query(
681 681
                 'SELECT increment_id
682
-                FROM ' . prefixTable('log_items') . '
682
+                FROM ' . prefixTable('log_items').'
683 683
                 WHERE raison LIKE "at_pw :%" AND encryption_type = "teampass_aes"'
684 684
             );
685 685
             $logs_number = DB::count();
686 686
 
687 687
             DB::query(
688 688
                 'SELECT id
689
-                FROM ' . prefixTable('categories_items') . '
689
+                FROM ' . prefixTable('categories_items').'
690 690
                 WHERE encryption_type = "teampass_aes"'
691 691
             );
692
-            $items_categories= DB::count();
692
+            $items_categories = DB::count();
693 693
 
694 694
             DB::query(
695 695
                 'SELECT id
696 696
                 FROM ' . prefixTable('suggestion')
697 697
             );
698
-            $items_suggestions= DB::count();
698
+            $items_suggestions = DB::count();
699 699
 
700 700
             DB::query(
701 701
                 'SELECT id
702
-                FROM ' . prefixTable('files') . '
703
-                WHERE status = "' . TP_ENCRYPTION_NAME . '"'
702
+                FROM ' . prefixTable('files').'
703
+                WHERE status = "' . TP_ENCRYPTION_NAME.'"'
704 704
             );
705
-            $items_files= DB::count();
705
+            $items_files = DB::count();
706 706
 
707 707
 
708 708
             // get list
@@ -717,26 +717,26 @@  discard block
 block discarded – undo
717 717
                     if ($detail['step'] === 'step0' || (int) $detail['index'] === 0) {
718 718
                         $task_progress = '0%';
719 719
                     } elseif ($detail['step'] === 'step10') {
720
-                        $task_progress = pourcentage($detail['index'], 1, 100) .'%';
720
+                        $task_progress = pourcentage($detail['index'], 1, 100).'%';
721 721
                     } elseif ($detail['step'] === 'step20') {
722
-                        $task_progress = pourcentage($detail['index'], $items_number, 100) .'%';
722
+                        $task_progress = pourcentage($detail['index'], $items_number, 100).'%';
723 723
                     } elseif ($detail['step'] === 'step30') {
724
-                        $task_progress = pourcentage($detail['index'], $logs_number, 100) .'%';
724
+                        $task_progress = pourcentage($detail['index'], $logs_number, 100).'%';
725 725
                     } elseif ($detail['step'] === 'step40') {
726
-                        $task_progress = pourcentage($detail['index'], $items_categories, 100) .'%';
726
+                        $task_progress = pourcentage($detail['index'], $items_categories, 100).'%';
727 727
                     } elseif ($detail['step'] === 'step50') {
728
-                        $task_progress = pourcentage($detail['index'], $items_suggestions, 100) .'%';
728
+                        $task_progress = pourcentage($detail['index'], $items_suggestions, 100).'%';
729 729
                     } elseif ($detail['step'] === 'step60') {
730
-                        $task_progress = pourcentage($detail['index'], $items_files, 100) .'%';
730
+                        $task_progress = pourcentage($detail['index'], $items_files, 100).'%';
731 731
                     }
732 732
                 }
733 733
 
734 734
                 array_push(
735 735
                     $ret,
736 736
                     [
737
-                        'created_at' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $task['created_at']),
738
-                        'updated_at' => is_null($task['updated_at']) === false ? date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $task['updated_at']) : '',
739
-                        'finished_at' => is_null($task['finished_at']) === false ? date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $task['finished_at']) : '',
737
+                        'created_at' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $task['created_at']),
738
+                        'updated_at' => is_null($task['updated_at']) === false ? date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $task['updated_at']) : '',
739
+                        'finished_at' => is_null($task['finished_at']) === false ? date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $task['finished_at']) : '',
740 740
                         'progress' => $task['finished_at'] !== null ? '100%' : $task_progress,
741 741
                         'is_in_progress' => (int) $task['is_in_progress'],
742 742
                         'step' => 'step'.$i,
@@ -785,19 +785,19 @@  discard block
 block discarded – undo
785 785
             // Get info about task
786 786
             $taskInfo = DB::queryfirstrow(
787 787
                 'SELECT p.process_type as process_type
788
-                FROM ' . prefixTable('processes') . ' as p
788
+                FROM ' . prefixTable('processes').' as p
789 789
                 WHERE p.increment_id = %i',
790 790
                 $post_id
791 791
             );
792 792
             if ($taskInfo !== null) {
793 793
                 // delete task
794 794
                 DB::query(
795
-                    'DELETE FROM ' . prefixTable('processes_tasks') . '
795
+                    'DELETE FROM '.prefixTable('processes_tasks').'
796 796
                     WHERE process_id = %i',
797 797
                     $post_id
798 798
                 );
799 799
                 DB::query(
800
-                    'DELETE FROM ' . prefixTable('processes') . '
800
+                    'DELETE FROM '.prefixTable('processes').'
801 801
                     WHERE increment_id = %i',
802 802
                     $post_id
803 803
                 );
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
                         ->setDayOfMonth('*')
865 865
                         ->setMonths('*')
866 866
                         ->setDayOfWeek('*')
867
-                        ->setTaskCommandLine($phpBinaryPath . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php')
867
+                        ->setTaskCommandLine($phpBinaryPath.' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php')
868 868
                         ->setComments('Teampass scheduler');
869 869
                     
870 870
                     $crontabRepository->addJob($crontabJob);
Please login to merge, or discard this patch.
sources/upload.attachments.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 ) {
69 69
     // Not allowed page
70 70
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 $post_isNewItem = filter_input(INPUT_POST, 'isNewItem', FILTER_SANITIZE_NUMBER_INT);
107 107
 $post_randomId = filter_input(INPUT_POST, 'randomId', FILTER_SANITIZE_NUMBER_INT);
108 108
 $post_isPersonal = filter_input(INPUT_POST, 'isPersonal', FILTER_SANITIZE_NUMBER_INT);
109
-$post_fileSize= filter_input(INPUT_POST, 'file_size', FILTER_SANITIZE_NUMBER_INT);
109
+$post_fileSize = filter_input(INPUT_POST, 'file_size', FILTER_SANITIZE_NUMBER_INT);
110 110
 
111 111
 // Get parameters
112 112
 $chunk = isset($_REQUEST['chunk']) ? (int) $_REQUEST['chunk'] : 0;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         // check if token is expired
168 168
         $data = DB::queryFirstRow(
169 169
             'SELECT end_timestamp
170
-            FROM ' . prefixTable('tokens') . '
170
+            FROM ' . prefixTable('tokens').'
171 171
             WHERE user_id = %i AND token = %s',
172 172
             $_SESSION['user_id'],
173 173
             $post_user_token
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
     }
193 193
 
194 194
     // Load Settings
195
-    include_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
195
+    include_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
196 196
 }
197 197
 
198 198
 // HTTP headers for no cache etc
199 199
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
200
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
200
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
201 201
 header('Cache-Control: no-store, no-cache, must-revalidate');
202 202
 header('Cache-Control: post-check=0, pre-check=0', false);
203 203
 
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 }
243 243
 
244 244
 // Validate file name (for our purposes we'll just remove invalid characters)
245
-$file_name = preg_replace('[^' . $valid_chars_regex . ']', '', strtolower(basename($_FILES['file']['name'])));
245
+$file_name = preg_replace('[^'.$valid_chars_regex.']', '', strtolower(basename($_FILES['file']['name'])));
246 246
 if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
247
-    handleAttachmentError('Invalid file name: ' . $file_name . '.', 114);
247
+    handleAttachmentError('Invalid file name: '.$file_name.'.', 114);
248 248
 }
249 249
 
250 250
 // Validate file extension
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
         $ext,
255 255
         explode(
256 256
             ',',
257
-            $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
258
-                ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
257
+            $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
258
+                ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
259 259
         )
260 260
     ) === false
261 261
 ) {
@@ -267,24 +267,24 @@  discard block
 block discarded – undo
267 267
 
268 268
 // Clean the fileName for security reasons
269 269
 $fileInfo = pathinfo($fileName);
270
-$fileName = base64_encode($fileInfo['filename']) . '.' . $fileInfo['extension'];
270
+$fileName = base64_encode($fileInfo['filename']).'.'.$fileInfo['extension'];
271 271
 $fileFullSize = 0;
272 272
 
273 273
 // Make sure the fileName is unique but only if chunking is disabled
274
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
274
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
275 275
     $ext = strrpos($fileName, '.');
276 276
     $fileNameA = substr($fileName, 0, $ext);
277 277
     $fileNameB = substr($fileName, $ext);
278 278
 
279 279
     $count = 1;
280
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
280
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
281 281
         ++$count;
282 282
     }
283 283
 
284
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
284
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
285 285
 }
286 286
 
287
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
287
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
288 288
 
289 289
 // Create target dir
290 290
 if (file_exists($targetDir) === false) {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 // Remove old temp files
299 299
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
300 300
     while (($file = readdir($dir)) !== false) {
301
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
301
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file;
302 302
 
303 303
         // Remove temp file if it is older than the max age and is not the current file
304 304
         if (
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
         // This is a public object
421 421
         $users = DB::query(
422 422
             'SELECT id, public_key
423
-            FROM ' . prefixTable('users') . '
424
-            WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '")
423
+            FROM ' . prefixTable('users').'
424
+            WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'")
425 425
             AND public_key != ""'
426 426
         );
427 427
         foreach ($users as $user) {
@@ -459,14 +459,14 @@  discard block
 block discarded – undo
459 459
                 'date' => time(),
460 460
                 'id_user' => $_SESSION['user_id'],
461 461
                 'action' => 'at_modification',
462
-                'raison' => 'at_add_file : ' . $fileName . ':' . $newID,
462
+                'raison' => 'at_add_file : '.$fileName.':'.$newID,
463 463
             )
464 464
         );
465 465
     }
466 466
 }
467 467
 
468 468
 // Return JSON-RPC response
469
-die('{"jsonrpc" : "2.0", "result" : null, "id" : "' . $newID . '"}');
469
+die('{"jsonrpc" : "2.0", "result" : null, "id" : "'.$newID.'"}');
470 470
 
471 471
 /**
472 472
  * Undocumented function.
@@ -476,5 +476,5 @@  discard block
 block discarded – undo
476 476
  */
477 477
 function handleAttachmentError($message, $code)
478 478
 {
479
-    echo '{"jsonrpc" : "2.0", "error" : {"code": ' . htmlentities((string) $code, ENT_QUOTES) . ', "message": "' . htmlentities((string) $message, ENT_QUOTES) . '"}, "id" : "id"}';
479
+    echo '{"jsonrpc" : "2.0", "error" : {"code": '.htmlentities((string) $code, ENT_QUOTES).', "message": "'.htmlentities((string) $message, ENT_QUOTES).'"}, "id" : "id"}';
480 480
 }
Please login to merge, or discard this patch.
sources/utils.queries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 ) {
66 66
     // Not allowed page
67 67
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
68
-    include $SETTINGS['cpassman_dir'] . '/error.php';
68
+    include $SETTINGS['cpassman_dir'].'/error.php';
69 69
     exit;
70 70
 }
71 71
 
Please login to merge, or discard this patch.
sources/import.queries.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 ) {
72 72
     // Not allowed page
73 73
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
74
-    include $SETTINGS['cpassman_dir'] . '/error.php';
74
+    include $SETTINGS['cpassman_dir'].'/error.php';
75 75
     exit;
76 76
 }
77 77
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $lexer = new Lexer($config);
163 163
             $config->setIgnoreHeaderLine('true');
164 164
             $interpreter = new Interpreter();
165
-            $interpreter->addObserver(function (array $row) use (&$valuesToImport) {
165
+            $interpreter->addObserver(function(array $row) use (&$valuesToImport) {
166 166
                 $valuesToImport[] = array(
167 167
                     'Label' => $row[0],
168 168
                     'Login' => $row[1],
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
         {
504 504
             // Manage entries
505 505
             if (isset($array['Entry']) === true) {
506
-                foreach($array['Entry'] as $key => $value) {
506
+                foreach ($array['Entry'] as $key => $value) {
507 507
                     if (isset($value['String']) === true) {
508 508
                         $itemDefinition = [];
509 509
                         $c = count($value['String']);
@@ -538,13 +538,13 @@  discard block
 block discarded – undo
538 538
             }
539 539
 
540 540
             // Manage GROUPS
541
-            if (isset($array['Group']) === true && is_array($array['Group'])=== true) {
541
+            if (isset($array['Group']) === true && is_array($array['Group']) === true) {
542 542
                 $currentFolderId = $previousFolder;
543 543
                 if (isset($array['Group']['UUID']) === true) {
544 544
                     // build expect array format
545 545
                     $array['Group'] = [$array['Group']];
546 546
                 }
547
-                foreach($array['Group'] as $key => $value){
547
+                foreach ($array['Group'] as $key => $value) {
548 548
                     // Add this new folder
549 549
                     array_push(
550 550
                         $newItemsToAdd['folders'],
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
         ];
638 638
         $startPathLevel = 1;
639 639
 
640
-        foreach($post_folders as $folder) {
640
+        foreach ($post_folders as $folder) {
641 641
             // get parent id
642 642
             $parentId = $arrFolders[$folder['parentFolderId']];
643 643
 
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
     ];
942 942
 }
943 943
 
944
-spl_autoload_register(function ($class) {
944
+spl_autoload_register(function($class) {
945 945
     $prefix = 'League\\Csv\\';
946 946
     $base_dir = __DIR__.'/src/';
947 947
     $len = strlen($prefix);
Please login to merge, or discard this patch.
sources/upload.files.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 ) {
69 69
     // Not allowed page
70 70
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     } else {
119 119
         // check if token is expired
120 120
         $data = DB::queryFirstRow(
121
-            'SELECT end_timestamp FROM ' . prefixTable('tokens') . ' WHERE user_id = %i AND token = %s',
121
+            'SELECT end_timestamp FROM '.prefixTable('tokens').' WHERE user_id = %i AND token = %s',
122 122
             $_SESSION['user_id'],
123 123
             $post_user_token
124 124
         );
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 
143 143
 // HTTP headers for no cache etc
144 144
 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
145
-header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
145
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
146 146
 header('Cache-Control: no-store, no-cache, must-revalidate');
147 147
 header('Cache-Control: post-check=0, pre-check=0', false);
148 148
 
149 149
 if (null !== $post_type_upload && $post_type_upload === 'upload_profile_photo') {
150
-    $targetDir = $SETTINGS['cpassman_dir'] . '/includes/avatars';
150
+    $targetDir = $SETTINGS['cpassman_dir'].'/includes/avatars';
151 151
 } else {
152 152
     $targetDir = $SETTINGS['path_to_files_folder'];
153 153
 }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
 // Validate file name (for our purposes we'll just remove invalid characters)
210 210
 $file_name = preg_replace(
211
-    '/[^' . $valid_chars_regex . '\.]/',
211
+    '/[^'.$valid_chars_regex.'\.]/',
212 212
     '',
213 213
     filter_var(
214 214
         strtolower(basename($_FILES['file']['name'])),
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     )
217 217
 );
218 218
 if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
219
-    handleUploadError('Invalid file name: ' . $file_name . '.');
219
+    handleUploadError('Invalid file name: '.$file_name.'.');
220 220
     return false;
221 221
 }
222 222
 
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
         $ext,
232 232
         explode(
233 233
             ',',
234
-            $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] .
235
-                ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext']
234
+            $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext'].
235
+                ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext']
236 236
         )
237 237
     ) === false
238 238
     && $post_type_upload !== 'import_items_from_keepass'
@@ -245,28 +245,28 @@  discard block
 block discarded – undo
245 245
 
246 246
 // is destination folder writable
247 247
 if (is_writable($SETTINGS['path_to_files_folder']) === false) {
248
-    handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.');
248
+    handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.');
249 249
     return false;
250 250
 }
251 251
 
252 252
 // Clean the fileName for security reasons
253 253
 $fileName = preg_replace('/[^\w\.]+/', '_', $fileName);
254
-$fileName = preg_replace('/[^' . $valid_chars_regex . '\.]/', '', strtolower(basename($fileName)));
254
+$fileName = preg_replace('/[^'.$valid_chars_regex.'\.]/', '', strtolower(basename($fileName)));
255 255
 
256 256
 // Make sure the fileName is unique but only if chunking is disabled
257
-if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
257
+if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) {
258 258
     $fileNameA = substr($fileName, 0, strlen($ext));
259 259
     $fileNameB = substr($fileName, strlen($ext));
260 260
 
261 261
     $count = 1;
262
-    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) {
262
+    while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) {
263 263
         ++$count;
264 264
     }
265 265
 
266
-    $fileName = $fileNameA . '_' . $count . $fileNameB;
266
+    $fileName = $fileNameA.'_'.$count.$fileNameB;
267 267
 }
268 268
 
269
-$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
269
+$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName;
270 270
 
271 271
 // Create target dir
272 272
 if (!file_exists($targetDir)) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 // Remove old temp files
281 281
 if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) {
282 282
     while (($file = readdir($dir)) !== false) {
283
-        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
283
+        $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file;
284 284
 
285 285
         // Remove temp file if it is older than the max age and is not the current file
286 286
         if (
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 ) {
377 377
     rename(
378 378
         $filePath,
379
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
379
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
380 380
     );
381 381
 
382 382
     // Add in DB
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 ) {
406 406
     rename(
407 407
         $filePath,
408
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
408
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
409 409
     );
410 410
 
411 411
     // Add in DB
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
     // rename the file
439 439
     rename(
440 440
         $filePath,
441
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext
441
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext
442 442
     );
443 443
 
444 444
     // make thumbnail
445 445
     $ret = makeThumbnail(
446
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext,
447
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName . '_thumb' . '.' . $ext,
446
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext,
447
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName.'_thumb'.'.'.$ext,
448 448
         40
449 449
     );
450 450
 
@@ -455,21 +455,21 @@  discard block
 block discarded – undo
455 455
     }
456 456
 
457 457
     // get current avatar and delete it
458
-    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM ' . prefixTable('users') . ' WHERE id=%i', $_SESSION['user_id']);
459
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar'], $SETTINGS);
460
-    fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar_thumb'], $SETTINGS);
458
+    $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM '.prefixTable('users').' WHERE id=%i', $_SESSION['user_id']);
459
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar'], $SETTINGS);
460
+    fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar_thumb'], $SETTINGS);
461 461
 
462 462
     // store in DB the new avatar
463 463
     DB::query(
464
-        'UPDATE ' . prefixTable('users') . "
465
-        SET avatar='" . $newFileName . '.' . $ext . "', avatar_thumb='" . $newFileName . '_thumb' . '.' . $ext . "'
464
+        'UPDATE '.prefixTable('users')."
465
+        SET avatar='" . $newFileName.'.'.$ext."', avatar_thumb='".$newFileName.'_thumb'.'.'.$ext."'
466 466
         WHERE id=%i",
467 467
         $_SESSION['user_id']
468 468
     );
469 469
 
470 470
     // store in session
471
-    $_SESSION['user_avatar'] = $newFileName . '.' . $ext;
472
-    $_SESSION['user_avatar_thumb'] = $newFileName . '_thumb' . '.' . $ext;
471
+    $_SESSION['user_avatar'] = $newFileName.'.'.$ext;
472
+    $_SESSION['user_avatar_thumb'] = $newFileName.'_thumb'.'.'.$ext;
473 473
 
474 474
     // return info
475 475
     echo prepareExchangedData(
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 ) {
489 489
     rename(
490 490
         $filePath,
491
-        $targetDir . DIRECTORY_SEPARATOR . $newFileName
491
+        $targetDir.DIRECTORY_SEPARATOR.$newFileName
492 492
     );
493 493
 
494 494
     // Add in DB
Please login to merge, or discard this patch.
sources/roles.queries.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 ) {
69 69
     // Not allowed page
70 70
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
                 echo prepareExchangedData(
740 740
                     array(
741 741
                         'error' => true,
742
-                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(),
742
+                        'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(),
743 743
                     ),
744 744
                     'encode'
745 745
                 );
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
                 $matches
756 756
             );
757 757
             $searchCriteria = [];
758
-            foreach($matches[0] as $match) {
758
+            foreach ($matches[0] as $match) {
759 759
                 $parts = [];
760 760
                 if (!str_contains($match, ',')) {
761 761
                     $tmp = explode("=", trim($match, '()'));
@@ -770,14 +770,14 @@  discard block
 block discarded – undo
770 770
 
771 771
             // check if synched with roles in Teampass
772 772
             $retAD = [];
773
-            foreach($retGroups as $key => $group) {
773
+            foreach ($retGroups as $key => $group) {
774 774
                 // exists in Teampass
775 775
                 $role_detail = DB::queryfirstrow(
776 776
                     'SELECT a.increment_id, a.role_id, r.title
777 777
                     FROM '.prefixTable('ldap_groups_roles').' AS a
778 778
                     INNER JOIN '.prefixTable('roles_title').' AS r ON r.id = a.role_id
779 779
                     WHERE ldap_group_id = %i',
780
-                    $group[(isset($SETTINGS['ldap_guid_attibute']) === true && empty($SETTINGS['ldap_guid_attibute']) === false ? $SETTINGS['ldap_guid_attibute']: 'gidnumber')][0]
780
+                    $group[(isset($SETTINGS['ldap_guid_attibute']) === true && empty($SETTINGS['ldap_guid_attibute']) === false ? $SETTINGS['ldap_guid_attibute'] : 'gidnumber')][0]
781 781
                 );
782 782
                 $counter = DB::count();
783 783
 
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
                     [
793 793
                         'ad_group_id' => (int) $group[(isset($SETTINGS['ldap_guid_attibute']) === true && empty($SETTINGS['ldap_guid_attibute']) === false ? $SETTINGS['ldap_guid_attibute'] : 'gidnumber')][0],
794 794
                         'ad_group_title' => $group['cn'][0],
795
-                        'role_id' => $counter> 0 ? (int) $role_detail['role_id'] : -1,
795
+                        'role_id' => $counter > 0 ? (int) $role_detail['role_id'] : -1,
796 796
                         'id' => $counter > 0 ? (int) $role_detail['increment_id'] : -1,
797 797
                         'role_title' => $counter > 0 ? $role_detail['title'] : '',
798 798
                     ]
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
             
803 803
             // Get all groups in Teampass
804 804
             $teampassRoles = array();
805
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
805
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
806 806
             foreach ($rows as $record) {
807 807
                 array_push(
808 808
                     $teampassRoles,
Please login to merge, or discard this patch.
sources/users.datatable.php 1 patch
Spacing   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 ) {
72 72
     // Not allowed page
73 73
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
74
-    include $SETTINGS['cpassman_dir'] . '/error.php';
74
+    include $SETTINGS['cpassman_dir'].'/error.php';
75 75
     exit;
76 76
 }
77 77
 
@@ -232,22 +232,20 @@  discard block
 block discarded – undo
232 232
 
233 233
         // Get some infos about user
234 234
         $userDisplayInfos = 
235
-            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.langHdl('creation_date').': '.date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
235
+            (isset($userDate['date']) ? '<i class=\"fas fa-calendar-day infotip text-info ml-2\" title=\"'.langHdl('creation_date').': '.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $userDate['date']).'\"></i>' : '')
236 236
             .
237 237
             ((int) $record['last_connexion'] > 0 ? '<i class=\"far fa-clock infotip text-info ml-2\" title=\"'.langHdl('index_last_seen').": ".
238
-            date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
238
+            date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['last_connexion']).'\"></i>' : '')
239 239
             .
240 240
             ((int) $record['user_ip'] > 0 ? '<i class=\"fas fa-street-view infotip text-info ml-1\" title=\"'.langHdl('ip').": ".($record['user_ip']).'\"></i>' : '')
241 241
             .
242 242
             ($record['auth_type'] === 'ldap' ? '<i class=\"far fa-address-book infotip text-warning ml-1\" title=\"'.langHdl('managed_through_ad').'\"></i>' : '')
243 243
             .
244 244
             ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && ((int) $SETTINGS['duo'] === 1 || (int) $SETTINGS['google_authentication'] === 1)) ?
245
-                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.langHdl('mfa_disabled_for_user').'\"></i>') :
246
-                ''
245
+                ((int) $record['mfa_enabled'] === 1 ? '' : '<i class=\"fa-solid fa-fingerprint infotip ml-1\" style=\"color:Tomato\" title=\"'.langHdl('mfa_disabled_for_user').'\"></i>') : ''
247 246
             ).
248 247
             ((in_array($record['id'], [OTV_USER_ID, TP_USER_ID, SSH_USER_ID, API_USER_ID]) === false && (int) $record['admin'] !== 1 && is_null($record['keys_recovery_time']) === true) ? 
249
-                '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.langHdl('recovery_keys_not_downloaded').'\"></i>' :
250
-                ''
248
+                '<i class=\"fa-solid fa-download infotip ml-1\" style=\"color:Tomato\" title=\"'.langHdl('recovery_keys_not_downloaded').'\"></i>' : ''
251 249
             );
252 250
         
253 251
         $sOutput .= '["<span data-id=\"'.$record['id'].'\" data-fullname=\"'.
Please login to merge, or discard this patch.
sources/ldap.activedirectory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     try {
48 48
         Container::addConnection($connection);
49 49
         // get id attribute
50
-        if (isset($SETTINGS['ldap_guid_attibute']) ===true && empty($SETTINGS['ldap_guid_attibute']) === false) {
50
+        if (isset($SETTINGS['ldap_guid_attibute']) === true && empty($SETTINGS['ldap_guid_attibute']) === false) {
51 51
             $idAttribute = $SETTINGS['ldap_guid_attibute'];
52 52
         } else {
53 53
             $idAttribute = 'objectguid';
Please login to merge, or discard this patch.
sources/folders.datatable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 ) {
71 71
     // Not allowed page
72 72
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
73
-    include $SETTINGS['cpassman_dir'] . '/error.php';
73
+    include $SETTINGS['cpassman_dir'].'/error.php';
74 74
     exit;
75 75
 }
76 76
 
Please login to merge, or discard this patch.