@@ -434,8 +434,9 @@ |
||
| 434 | 434 | )['count']; |
| 435 | 435 | |
| 436 | 436 | // Don't insert duplicates |
| 437 | - if ($count > 0) |
|
| 438 | - continue; |
|
| 437 | + if ($count > 0) { |
|
| 438 | + continue; |
|
| 439 | + } |
|
| 439 | 440 | |
| 440 | 441 | // Insert new background task |
| 441 | 442 | DB::insert( |
@@ -81,8 +81,9 @@ discard block |
||
| 81 | 81 | $session = SessionManager::getSession(); |
| 82 | 82 | |
| 83 | 83 | // Random encryption key |
| 84 | -if ($session->get('key') === null) |
|
| 84 | +if ($session->get('key') === null) { |
|
| 85 | 85 | $session->set('key', generateQuickPassword(30, false)); |
| 86 | +} |
|
| 86 | 87 | |
| 87 | 88 | $request = SymfonyRequest::createFromGlobals(); |
| 88 | 89 | $configManager = new ConfigManager(__DIR__, $request->getRequestUri()); |
@@ -943,7 +944,10 @@ discard block |
||
| 943 | 944 | <input type="password" class="form-control" id="dialog-ldap-user-build-keys-database-code"> |
| 944 | 945 | <br/> |
| 945 | 946 | </div> |
| 946 | - <div class="input-group mb-3<?php if ($session_auth_type === 'oauth2') echo ' hidden'; ?>"> |
|
| 947 | + <div class="input-group mb-3<?php if ($session_auth_type === 'oauth2') { |
|
| 948 | + echo ' hidden'; |
|
| 949 | +} |
|
| 950 | +?>"> |
|
| 947 | 951 | <div class="input-group-prepend"> |
| 948 | 952 | <span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span> |
| 949 | 953 | </div> |
@@ -2514,7 +2514,9 @@ discard block |
||
| 2514 | 2514 | ]; |
| 2515 | 2515 | } |
| 2516 | 2516 | |
| 2517 | - if (WIP) error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL)); |
|
| 2517 | + if (WIP) { |
|
| 2518 | + error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL)); |
|
| 2519 | + } |
|
| 2518 | 2520 | |
| 2519 | 2521 | // Decrypt file content and return |
| 2520 | 2522 | return base64_encode($cipher->decrypt($ciphertext)); |
@@ -2644,7 +2646,9 @@ discard block |
||
| 2644 | 2646 | foreach ($users as $user) { |
| 2645 | 2647 | // Insert in DB the new object key for this item by user |
| 2646 | 2648 | if (count($objectKeyArray) === 0) { |
| 2647 | - if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey); |
|
| 2649 | + if (WIP === true) { |
|
| 2650 | + error_log('TEAMPASS Debug - storeUsersShareKey case1 - ' . $object_name . ' - ' . $post_object_id . ' - ' . $user['id'] . ' - ' . $objectKey); |
|
| 2651 | + } |
|
| 2648 | 2652 | DB::insert( |
| 2649 | 2653 | $object_name, |
| 2650 | 2654 | [ |
@@ -2658,7 +2662,9 @@ discard block |
||
| 2658 | 2662 | ); |
| 2659 | 2663 | } else { |
| 2660 | 2664 | foreach ($objectKeyArray as $object) { |
| 2661 | - if (WIP === true) error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']); |
|
| 2665 | + if (WIP === true) { |
|
| 2666 | + error_log('TEAMPASS Debug - storeUsersShareKey case2 - ' . $object_name . ' - ' . $object['objectId'] . ' - ' . $user['id'] . ' - ' . $object['objectKey']); |
|
| 2667 | + } |
|
| 2662 | 2668 | DB::insert( |
| 2663 | 2669 | $object_name, |
| 2664 | 2670 | [ |
@@ -3984,7 +3990,9 @@ discard block |
||
| 3984 | 3990 | $taskName = [$taskName]; |
| 3985 | 3991 | } |
| 3986 | 3992 | foreach($taskName as $task) { |
| 3987 | - if (WIP === true) error_log('createTaskForItem - task: '.$task); |
|
| 3993 | + if (WIP === true) { |
|
| 3994 | + error_log('createTaskForItem - task: '.$task); |
|
| 3995 | + } |
|
| 3988 | 3996 | switch ($task) { |
| 3989 | 3997 | case 'item_password': |
| 3990 | 3998 | |
@@ -4444,19 +4452,22 @@ discard block |
||
| 4444 | 4452 | |
| 4445 | 4453 | // Organisation name (removed username@ and .tld) |
| 4446 | 4454 | $domain = explode('.', $emailParts[1]); |
| 4447 | - if (count($domain) > 1) |
|
| 4448 | - $forbiddenWords[] = $domain[0]; |
|
| 4455 | + if (count($domain) > 1) { |
|
| 4456 | + $forbiddenWords[] = $domain[0]; |
|
| 4457 | + } |
|
| 4449 | 4458 | } |
| 4450 | 4459 | } |
| 4451 | 4460 | |
| 4452 | 4461 | // Search forbidden words in password |
| 4453 | 4462 | foreach ($forbiddenWords as $word) { |
| 4454 | - if (empty($word)) |
|
| 4455 | - continue; |
|
| 4463 | + if (empty($word)) { |
|
| 4464 | + continue; |
|
| 4465 | + } |
|
| 4456 | 4466 | |
| 4457 | 4467 | // Stop if forbidden word found in password |
| 4458 | - if (stripos($password, $word) !== false) |
|
| 4459 | - return false; |
|
| 4468 | + if (stripos($password, $word) !== false) { |
|
| 4469 | + return false; |
|
| 4470 | + } |
|
| 4460 | 4471 | } |
| 4461 | 4472 | |
| 4462 | 4473 | // Get password complexity |
@@ -301,7 +301,9 @@ |
||
| 301 | 301 | break; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if (WIP === true) error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key); |
|
| 304 | + if (WIP === true) { |
|
| 305 | + error_log('DEBUG: Offset -> '.$post_offset.'/'.$post_totalSize.' | File -> '.$post_clearFilename.' | key -> '.$post_key); |
|
| 306 | + } |
|
| 305 | 307 | |
| 306 | 308 | include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
| 307 | 309 | |
@@ -1223,7 +1223,9 @@ discard block |
||
| 1223 | 1223 | ); |
| 1224 | 1224 | |
| 1225 | 1225 | // Create a task to create sharekeys for users |
| 1226 | - if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw); |
|
| 1226 | + if (WIP=== true) { |
|
| 1227 | + error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw); |
|
| 1228 | + } |
|
| 1227 | 1229 | $tasksToBePerformed = ['item_password']; |
| 1228 | 1230 | $encryptionTaskIsRequested = true; |
| 1229 | 1231 | } else { |
@@ -1539,7 +1541,9 @@ discard block |
||
| 1539 | 1541 | |
| 1540 | 1542 | // create a task for all fields updated |
| 1541 | 1543 | if ($encryptionTaskIsRequested === true) { |
| 1542 | - if (WIP === true) error_log('createTaskForItem - '.print_r($tasksToBePerformed, true)); |
|
| 1544 | + if (WIP === true) { |
|
| 1545 | + error_log('createTaskForItem - '.print_r($tasksToBePerformed, true)); |
|
| 1546 | + } |
|
| 1543 | 1547 | createTaskForItem( |
| 1544 | 1548 | 'item_update_create_keys', |
| 1545 | 1549 | $tasksToBePerformed, |
@@ -2046,7 +2050,9 @@ discard block |
||
| 2046 | 2050 | $inputData['itemId'] |
| 2047 | 2051 | ); |
| 2048 | 2052 | foreach ($rows as $record) { |
| 2049 | - if ($record['raison'] === NULL) continue; |
|
| 2053 | + if ($record['raison'] === NULL) { |
|
| 2054 | + continue; |
|
| 2055 | + } |
|
| 2050 | 2056 | $reason = explode(':', $record['raison']); |
| 2051 | 2057 | if (count($reason) > 0) { |
| 2052 | 2058 | $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - ' |
@@ -4559,7 +4565,9 @@ discard block |
||
| 4559 | 4565 | $inputData['itemId'] |
| 4560 | 4566 | ); |
| 4561 | 4567 | |
| 4562 | - if (WIP === true) error_log('Existing edition locks: '.DB::count()); |
|
| 4568 | + if (WIP === true) { |
|
| 4569 | + error_log('Existing edition locks: '.DB::count()); |
|
| 4570 | + } |
|
| 4563 | 4571 | |
| 4564 | 4572 | // Check if item has no edition lock |
| 4565 | 4573 | if ((int) DB::count() > 0 ) { |
@@ -4572,7 +4580,9 @@ discard block |
||
| 4572 | 4580 | } else { |
| 4573 | 4581 | $delay = EDITION_LOCK_PERIOD; // One day delay |
| 4574 | 4582 | } |
| 4575 | - if (WIP === true) error_log('delay: ' . $delay); |
|
| 4583 | + if (WIP === true) { |
|
| 4584 | + error_log('delay: ' . $delay); |
|
| 4585 | + } |
|
| 4576 | 4586 | |
| 4577 | 4587 | // We remove old edition locks if delay is expired meaning more than 1 day long |
| 4578 | 4588 | if (round(abs(time() - $dataTmp['timestamp']),0) > $delay) { |
@@ -4580,7 +4590,9 @@ discard block |
||
| 4580 | 4590 | // In this case, delete edition lock and possible ongoing processes |
| 4581 | 4591 | // and continue editing this time |
| 4582 | 4592 | // We coonsidere if the most recent item is still locked then all other locks can be removed |
| 4583 | - if (WIP === true) error_log('Delay is expired, removing old locks'); |
|
| 4593 | + if (WIP === true) { |
|
| 4594 | + error_log('Delay is expired, removing old locks'); |
|
| 4595 | + } |
|
| 4584 | 4596 | foreach ($dataItemEditionLocks as $itemEditionLock) { |
| 4585 | 4597 | // delete lock |
| 4586 | 4598 | DB::delete( |
@@ -4847,8 +4859,9 @@ discard block |
||
| 4847 | 4859 | $ids = $tree->getDescendants($folder['id'], true, false, true); |
| 4848 | 4860 | |
| 4849 | 4861 | // This folder is owned by user |
| 4850 | - if (in_array($inputData['folderId'], $ids)) |
|
| 4851 | - $accessLevel = 30; |
|
| 4862 | + if (in_array($inputData['folderId'], $ids)) { |
|
| 4863 | + $accessLevel = 30; |
|
| 4864 | + } |
|
| 4852 | 4865 | } |
| 4853 | 4866 | } |
| 4854 | 4867 | |
@@ -2401,7 +2401,9 @@ discard block |
||
| 2401 | 2401 | // Complete $userInfo |
| 2402 | 2402 | $userInfo['has_been_created'] = 1; |
| 2403 | 2403 | |
| 2404 | - if (WIP === true) error_log("--- USER CREATED ---"); |
|
| 2404 | + if (WIP === true) { |
|
| 2405 | + error_log("--- USER CREATED ---"); |
|
| 2406 | + } |
|
| 2405 | 2407 | |
| 2406 | 2408 | return [ |
| 2407 | 2409 | 'error' => false, |
@@ -2437,7 +2439,9 @@ discard block |
||
| 2437 | 2439 | } |
| 2438 | 2440 | |
| 2439 | 2441 | // Oauth2 user already exists and authenticated |
| 2440 | - if (WIP === true) error_log("--- USER AUTHENTICATED ---"); |
|
| 2442 | + if (WIP === true) { |
|
| 2443 | + error_log("--- USER AUTHENTICATED ---"); |
|
| 2444 | + } |
|
| 2441 | 2445 | $userInfo['has_been_created'] = 0; |
| 2442 | 2446 | |
| 2443 | 2447 | $passwordManager = new PasswordManager(); |
@@ -2667,8 +2671,9 @@ discard block |
||
| 2667 | 2671 | ); |
| 2668 | 2672 | |
| 2669 | 2673 | // No valid email address for user |
| 2670 | - if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL)) |
|
| 2671 | - return; |
|
| 2674 | + if (!$userInfos || !filter_var($userInfos['email'], FILTER_VALIDATE_EMAIL)) { |
|
| 2675 | + return; |
|
| 2676 | + } |
|
| 2672 | 2677 | |
| 2673 | 2678 | $unlock_url = $SETTINGS['cpassman_url'].'/self-unlock.php?login='.$value.'&otp='.$unlock_code; |
| 2674 | 2679 | |