@@ -29,7 +29,9 @@ discard block |
||
| 29 | 29 | trait ItemHandlerTrait { |
| 30 | 30 | |
| 31 | 31 | private function generateUserPasswordKeys($arguments) { |
| 32 | - if (LOG_TASKS=== true) $this->logger->log('Processing generateUserPasswordKeys : '.print_r($arguments, true), 'DEBUG'); |
|
| 32 | + if (LOG_TASKS=== true) { |
|
| 33 | + $this->logger->log('Processing generateUserPasswordKeys : '.print_r($arguments, true), 'DEBUG'); |
|
| 34 | + } |
|
| 33 | 35 | // Generate keys for user passwords |
| 34 | 36 | storeUsersShareKey( |
| 35 | 37 | 'sharekeys_items', |
@@ -49,7 +51,9 @@ discard block |
||
| 49 | 51 | * @param array $taskData |
| 50 | 52 | */ |
| 51 | 53 | private function generateUserFileKeys($taskData) { |
| 52 | - if (LOG_TASKS=== true) $this->logger->log('Processing generateUserFileKeys : '.print_r($taskData, true), 'DEBUG'); |
|
| 54 | + if (LOG_TASKS=== true) { |
|
| 55 | + $this->logger->log('Processing generateUserFileKeys : '.print_r($taskData, true), 'DEBUG'); |
|
| 56 | + } |
|
| 53 | 57 | foreach($taskData['files_keys'] as $file) { |
| 54 | 58 | storeUsersShareKey( |
| 55 | 59 | 'sharekeys_files', |
@@ -70,7 +74,9 @@ discard block |
||
| 70 | 74 | * @param array $arguments |
| 71 | 75 | */ |
| 72 | 76 | private function generateUserFieldKeys($arguments) { |
| 73 | - if (LOG_TASKS=== true) $this->logger->log('Processing generateUserFieldKeys : '.print_r($arguments, true), 'DEBUG'); |
|
| 77 | + if (LOG_TASKS=== true) { |
|
| 78 | + $this->logger->log('Processing generateUserFieldKeys : '.print_r($arguments, true), 'DEBUG'); |
|
| 79 | + } |
|
| 74 | 80 | foreach($arguments['fields_keys'] as $field) { |
| 75 | 81 | $this->logger->log('Processing generateUserFieldKeys for: ' . $field['object_id'], 'DEBUG'); |
| 76 | 82 | storeUsersShareKey( |
@@ -2604,7 +2604,9 @@ discard block |
||
| 2604 | 2604 | function encryptUserObjectKey(string $key, string $publicKey): string |
| 2605 | 2605 | { |
| 2606 | 2606 | // Empty password |
| 2607 | - if (empty($key)) return ''; |
|
| 2607 | + if (empty($key)) { |
|
| 2608 | + return ''; |
|
| 2609 | + } |
|
| 2608 | 2610 | |
| 2609 | 2611 | // Sanitize |
| 2610 | 2612 | $antiXss = new AntiXSS(); |
@@ -2753,7 +2755,9 @@ discard block |
||
| 2753 | 2755 | ]; |
| 2754 | 2756 | } |
| 2755 | 2757 | |
| 2756 | - if (WIP) error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL)); |
|
| 2758 | + if (WIP) { |
|
| 2759 | + error_log('DEBUG: File image url -> '.filter_var($safeFilePath, FILTER_SANITIZE_URL)); |
|
| 2760 | + } |
|
| 2757 | 2761 | |
| 2758 | 2762 | // Decrypt file content and return |
| 2759 | 2763 | return base64_encode($cipher->decrypt($ciphertext)); |
@@ -4232,7 +4236,9 @@ discard block |
||
| 4232 | 4236 | $taskName = [$taskName]; |
| 4233 | 4237 | } |
| 4234 | 4238 | foreach($taskName as $task) { |
| 4235 | - if (WIP === true) error_log('createTaskForItem - task: '.$task); |
|
| 4239 | + if (WIP === true) { |
|
| 4240 | + error_log('createTaskForItem - task: '.$task); |
|
| 4241 | + } |
|
| 4236 | 4242 | switch ($task) { |
| 4237 | 4243 | case 'item_password': |
| 4238 | 4244 | |
@@ -4665,19 +4671,22 @@ discard block |
||
| 4665 | 4671 | |
| 4666 | 4672 | // Organisation name (removed username@ and .tld) |
| 4667 | 4673 | $domain = explode('.', $emailParts[1]); |
| 4668 | - if (count($domain) > 1) |
|
| 4669 | - $forbiddenWords[] = $domain[0]; |
|
| 4674 | + if (count($domain) > 1) { |
|
| 4675 | + $forbiddenWords[] = $domain[0]; |
|
| 4676 | + } |
|
| 4670 | 4677 | } |
| 4671 | 4678 | } |
| 4672 | 4679 | |
| 4673 | 4680 | // Search forbidden words in password |
| 4674 | 4681 | foreach ($forbiddenWords as $word) { |
| 4675 | - if (empty($word)) |
|
| 4676 | - continue; |
|
| 4682 | + if (empty($word)) { |
|
| 4683 | + continue; |
|
| 4684 | + } |
|
| 4677 | 4685 | |
| 4678 | 4686 | // Stop if forbidden word found in password |
| 4679 | - if (stripos($password, $word) !== false) |
|
| 4680 | - return false; |
|
| 4687 | + if (stripos($password, $word) !== false) { |
|
| 4688 | + return false; |
|
| 4689 | + } |
|
| 4681 | 4690 | } |
| 4682 | 4691 | |
| 4683 | 4692 | // Get password complexity |