@@ -38,7 +38,7 @@ |
||
38 | 38 | "error" => '', |
39 | 39 | ); |
40 | 40 | |
41 | - }catch (Exception $e) { |
|
41 | + } catch (Exception $e) { |
|
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | } |
@@ -2603,7 +2603,9 @@ |
||
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) { |
@@ -146,8 +146,7 @@ |
||
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."; |
@@ -282,7 +282,9 @@ |
||
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 |
@@ -2621,7 +2621,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -1045,7 +1045,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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( |
@@ -74,7 +74,9 @@ discard block |
||
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 |
||
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'), |
@@ -149,7 +149,9 @@ |
||
149 | 149 | } |
150 | 150 | $filePath = realpath($filePath); |
151 | 151 | |
152 | - if (WIP === true) error_log('downloadFile.php: filePath: ' . $filePath." - "); |
|
152 | + if (WIP === true) { |
|
153 | + error_log('downloadFile.php: filePath: ' . $filePath." - "); |
|
154 | + } |
|
153 | 155 | |
154 | 156 | if ($filePath && is_readable($filePath) && strpos($filePath, realpath($SETTINGS['path_to_upload_folder'])) === 0) { |
155 | 157 | header('Content-Description: File Transfer'); |
@@ -86,7 +86,9 @@ discard block |
||
86 | 86 | |
87 | 87 | if (DB::count() > 0) { |
88 | 88 | // handle tasks inside this process |
89 | - if (WIP === true) error_log("Process in progress: ".$process_to_perform['increment_id']); |
|
89 | + if (WIP === true) { |
|
90 | + error_log("Process in progress: ".$process_to_perform['increment_id']); |
|
91 | + } |
|
90 | 92 | handleTask( |
91 | 93 | $process_to_perform['increment_id'], |
92 | 94 | json_decode($process_to_perform['arguments'], true), |
@@ -103,7 +105,9 @@ discard block |
||
103 | 105 | ); |
104 | 106 | |
105 | 107 | if (DB::count() > 0) { |
106 | - if (WIP === true) error_log("New process ta start: ".$process_to_perform['increment_id']); |
|
108 | + if (WIP === true) { |
|
109 | + error_log("New process ta start: ".$process_to_perform['increment_id']); |
|
110 | + } |
|
107 | 111 | // update DB - started_at |
108 | 112 | DB::update( |
109 | 113 | prefixTable('background_tasks'), |
@@ -306,7 +310,9 @@ discard block |
||
306 | 310 | if ($args['step'] === 'create_users_files_key') { |
307 | 311 | // Loop on all files for this item |
308 | 312 | // and encrypt them for each user |
309 | - if (WIP === true) provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS); |
|
313 | + if (WIP === true) { |
|
314 | + provideLog('[DEBUG] '.print_r($args['files_keys'], true), $SETTINGS); |
|
315 | + } |
|
310 | 316 | foreach($args['files_keys'] as $file) { |
311 | 317 | storeUsersShareKey( |
312 | 318 | prefixTable('sharekeys_items'), |
@@ -323,7 +329,9 @@ discard block |
||
323 | 329 | } elseif ($args['step'] === 'create_users_fields_key') { |
324 | 330 | // Loop on all encrypted fields for this item |
325 | 331 | // and encrypt them for each user |
326 | - if (WIP === true) provideLog('[DEBUG] '.print_r($args, true), $SETTINGS); |
|
332 | + if (WIP === true) { |
|
333 | + provideLog('[DEBUG] '.print_r($args, true), $SETTINGS); |
|
334 | + } |
|
327 | 335 | foreach($args['fields_keys'] as $field) { |
328 | 336 | storeUsersShareKey( |
329 | 337 | prefixTable('sharekeys_fields'), |