Passed
Branch code_review (3a90db)
by Nils
27:18 queued 02:44
created
api/Model/Operation.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
                 "error" => '',
39 39
             );
40 40
     
41
-        }catch (Exception $e) {    
41
+        } catch (Exception $e) {    
42 42
             return false;
43 43
         }
44 44
     }
Please login to merge, or discard this patch.
api/Model/FolderModel.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $ret = [];
35 35
 
36 36
         foreach ($rows as $row) {
37
-			$isVisible = in_array((int) $row['id'], $foldersId);
37
+            $isVisible = in_array((int) $row['id'], $foldersId);
38 38
             $childrens = $this->getFoldersChildren($row['id'], $foldersId);
39 39
 
40 40
             if ($isVisible || count($childrens) > 0) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                     [
44 44
                         'id' => (int) $row['id'],
45 45
                         'title' => $row['title'],
46
-						'isVisible' => $isVisible,
46
+                        'isVisible' => $isVisible,
47 47
                         'childrens' => $childrens
48 48
                     ]
49 49
                 );
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         if ( count($childrens) > 0) {
65 65
             foreach ($childrens as $children) {
66
-				$isVisible = in_array((int) $children['id'], $foldersId);
66
+                $isVisible = in_array((int) $children['id'], $foldersId);
67 67
                 $childs = $this->getFoldersChildren($children['id'], $foldersId);
68 68
 
69 69
                 if (in_array((int) $children['id'], $foldersId) || count($childs) > 0) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                         [
73 73
                             'id' => (int) $children['id'],
74 74
                             'title' => $children['title'],
75
-							'isVisible' => $isVisible,
75
+                            'isVisible' => $isVisible,
76 76
                             'childrens' => $childs
77 77
                         ]
78 78
                     );
Please login to merge, or discard this patch.
sources/users.queries.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2603,7 +2603,9 @@
 block discarded – undo
2603 2603
             }
2604 2604
             
2605 2605
             foreach ($results as $adUser) {
2606
-                if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) continue;
2606
+                if (isset($adUser[$SETTINGS['ldap_user_attribute']][0]) === false) {
2607
+                    continue;
2608
+                }
2607 2609
                 // Build the list of all groups in AD
2608 2610
                 if (isset($adUser['memberof']) === true) {
2609 2611
                     foreach($adUser['memberof'] as $j => $adUserGroup) {
Please login to merge, or discard this patch.
sources/main.functions.php 2 patches
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2226 2226
  *
2227 2227
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2228
-  *
2228
+ *
2229 2229
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2230 2230
  * @param int    $filePerm The permissions any found files should get.
2231 2231
  * @param int    $dirPerm  The permissions any found folder should get.
@@ -3848,7 +3848,6 @@  discard block
 block discarded – undo
3848 3848
  * @param integer $processId
3849 3849
  * @param integer $nbItemsToTreat
3850 3850
  * @return void
3851
- 
3852 3851
  */
3853 3852
 function createUserTasks($processId, $nbItemsToTreat): void
3854 3853
 {
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2621,7 +2621,9 @@  discard block
 block discarded – undo
2621 2621
     $safeFilePath = realpath($filePath . '/' . TP_FILE_PREFIX . $safeFileName);
2622 2622
     $ciphertext = file_get_contents(filter_var($safeFilePath, FILTER_SANITIZE_URL));
2623 2623
 
2624
-    if (WIP) error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
2624
+    if (WIP) {
2625
+        error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL));
2626
+    }
2625 2627
 
2626 2628
     // Decrypt file content and return
2627 2629
     return base64_encode($cipher->decrypt($ciphertext));
@@ -2749,7 +2751,9 @@  discard block
 block discarded – undo
2749 2751
         foreach ($users as $user) {
2750 2752
             // Insert in DB the new object key for this item by user
2751 2753
             if (count($objectKeyArray) === 0) {
2752
-                if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2754
+                if (WIP === true) {
2755
+                    error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey);
2756
+                }
2753 2757
                 DB::insert(
2754 2758
                     $object_name,
2755 2759
                     [
@@ -2763,7 +2767,9 @@  discard block
 block discarded – undo
2763 2767
                 );
2764 2768
             } else {
2765 2769
                 foreach ($objectKeyArray as $object) {
2766
-                    if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2770
+                    if (WIP === true) {
2771
+                        error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']);
2772
+                    }
2767 2773
                     DB::insert(
2768 2774
                         $object_name,
2769 2775
                         [
@@ -3608,7 +3614,9 @@  discard block
 block discarded – undo
3608 3614
     );
3609 3615
     
3610 3616
     // if not exists then error
3611
-    if (is_null($val) === true || count($val) === 0 || defined('UPGRADE_MIN_DATE') === false) return true;
3617
+    if (is_null($val) === true || count($val) === 0 || defined('UPGRADE_MIN_DATE') === false) {
3618
+        return true;
3619
+    }
3612 3620
 
3613 3621
     // if empty or too old then error
3614 3622
     if (empty($val['valeur']) === true || (int) $val['valeur'] < (int) UPGRADE_MIN_DATE) {
Please login to merge, or discard this patch.
pages/tasks.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,8 +146,7 @@
 block discarded – undo
146 146
                                             </div>
147 147
         <?php
148 148
     }
149
-}
150
-catch (Exception $e) {
149
+} catch (Exception $e) {
151 150
     error_log('TEAMPASS Error - tasks page - '.$e->getMessage());
152 151
     // deepcode ignore ServerLeak: no critical information is provided
153 152
     echo "An error occurred.";
Please login to merge, or discard this patch.
sources/backups.queries.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -282,7 +282,9 @@
 block discarded – undo
282 282
             $post_totalSize = (int) filter_var($dataReceived['post_totalSize'], FILTER_SANITIZE_NUMBER_INT);
283 283
             $batchSize = 500;
284 284
 
285
-            if (WIP === true) error_log('DEBUG: Offset -> '.$post_offset.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
285
+            if (WIP === true) {
286
+                error_log('DEBUG: Offset -> '.$post_offset.' | File -> '.$post_clearFilename.' | key -> '.$post_key);
287
+            }
286 288
 
287 289
             include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
288 290
 
Please login to merge, or discard this patch.
sources/items.queries.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1045,7 +1045,9 @@  discard block
 block discarded – undo
1045 1045
             $session->get('user-id')
1046 1046
         );
1047 1047
         if (DB::count() === 0) {
1048
-            if (LOG_TO_SERVER === true) error_log('TEAMPASS | user '.$session->get('user-id').' has no sharekey for item '.$inputData['itemId']);
1048
+            if (LOG_TO_SERVER === true) {
1049
+                error_log('TEAMPASS | user '.$session->get('user-id').' has no sharekey for item '.$inputData['itemId']);
1050
+            }
1049 1051
             echo (string) prepareExchangedData(
1050 1052
                 array(
1051 1053
                     'error' => true,
@@ -1164,7 +1166,9 @@  discard block
 block discarded – undo
1164 1166
                 );
1165 1167
 
1166 1168
                 // Create a task to create sharekeys for users
1167
-                if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1169
+                if (WIP=== true) {
1170
+                    error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw);
1171
+                }
1168 1172
                 $tasksToBePerformed = ['item_password'];
1169 1173
                 /*createTaskForItem(
1170 1174
                     'item_update_create_keys',
@@ -1489,7 +1493,9 @@  discard block
 block discarded – undo
1489 1493
 
1490 1494
             // create a task for all fields updated
1491 1495
             if ($encryptionTaskIsRequested === true) {
1492
-                if (WIP === true) error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1496
+                if (WIP === true) {
1497
+                    error_log('createTaskForItem - '.print_r($tasksToBePerformed, true));
1498
+                }
1493 1499
                 createTaskForItem(
1494 1500
                     'item_update_create_keys',
1495 1501
                     $tasksToBePerformed,
@@ -1996,7 +2002,9 @@  discard block
 block discarded – undo
1996 2002
                 $inputData['itemId']
1997 2003
             );
1998 2004
             foreach ($rows as $record) {
1999
-                if ($record['raison'] === NULL) continue;
2005
+                if ($record['raison'] === NULL) {
2006
+                    continue;
2007
+                }
2000 2008
                 $reason = explode(':', $record['raison']);
2001 2009
                 if (count($reason) > 0) {
2002 2010
                     $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - '
@@ -4586,7 +4594,9 @@  discard block
 block discarded – undo
4586 4594
                 $inputData['itemId']
4587 4595
             );
4588 4596
             
4589
-            if (WIP === true) error_log('Existing edition locks: '.DB::count());
4597
+            if (WIP === true) {
4598
+                error_log('Existing edition locks: '.DB::count());
4599
+            }
4590 4600
 
4591 4601
             // Check if item has no edition lock
4592 4602
             if ((int) DB::count() > 0 ) {
@@ -4599,7 +4609,9 @@  discard block
 block discarded – undo
4599 4609
                 } else {
4600 4610
                     $delay = EDITION_LOCK_PERIOD; // One day delay
4601 4611
                 }
4602
-                if (WIP === true) error_log('delay: ' . $delay);
4612
+                if (WIP === true) {
4613
+                    error_log('delay: ' . $delay);
4614
+                }
4603 4615
 
4604 4616
                 // We remove old edition locks if delay is expired meaning more than 1 day long
4605 4617
                 if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) {
@@ -4607,7 +4619,9 @@  discard block
 block discarded – undo
4607 4619
                     // In this case, delete edition lock and possible ongoing processes
4608 4620
                     // and continue editing this time
4609 4621
                     // We coonsidere if the most recent item is still locked then all other locks can be removed
4610
-                    if (WIP === true)  error_log('Delay is expired, removing old locks');
4622
+                    if (WIP === true) {
4623
+                        error_log('Delay is expired, removing old locks');
4624
+                    }
4611 4625
                     foreach ($dataItemEditionLocks as $itemEditionLock) {
4612 4626
                         // delete lock
4613 4627
                         DB::delete(
Please login to merge, or discard this patch.
pages/search.js.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
  * Certain components of this file may be under different licenses. For
23 23
  * details, see the `licenses` directory or individual file headers.
24 24
  * ---
25
-  * @file      search.js.php
25
+ * @file      search.js.php
26 26
  * @author    Nils Laumaillé ([email protected])
27 27
  * @copyright 2009-2024 Teampass.net
28 28
  * @license   GPL-3.0
Please login to merge, or discard this patch.
scripts/background_tasks___items_handler_subtask.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 if ($args['step'] === 'create_users_files_key') {
75 75
     // Loop on all files for this item
76 76
     // and encrypt them for each user
77
-    if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
77
+    if (WIP === true) {
78
+        provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS);
79
+    }
78 80
     foreach($args['files_keys'] as $file) {
79 81
         storeUsersShareKey(
80 82
             prefixTable('sharekeys_items'),
@@ -91,7 +93,9 @@  discard block
 block discarded – undo
91 93
 } elseif ($args['step'] === 'create_users_fields_key') {
92 94
     // Loop on all encrypted fields for this item
93 95
     // and encrypt them for each user
94
-    if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
96
+    if (WIP === true) {
97
+        provideLog('[DEBUG] '.print_r($args, true), $SETTINGS);
98
+    }
95 99
     foreach($args['fields_keys'] as $field) {
96 100
         storeUsersShareKey(
97 101
             prefixTable('sharekeys_fields'),
Please login to merge, or discard this patch.