@@ -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) { |
@@ -58,7 +58,9 @@ |
||
| 58 | 58 | $get['state'] = filter_var($_GET['state'], FILTER_SANITIZE_SPECIAL_CHARS); |
| 59 | 59 | $get['session_state'] = filter_var($_GET['session_state'], FILTER_SANITIZE_SPECIAL_CHARS); |
| 60 | 60 | |
| 61 | - if (WIP === true) error_log('---- OAUTH2 START ----'); |
|
| 61 | + if (WIP === true) { |
|
| 62 | + error_log('---- OAUTH2 START ----'); |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | // Création d'une instance du contrôleur |
| 64 | 66 | $OAuth2 = new OAuth2Controller($SETTINGS); |
@@ -401,12 +401,13 @@ |
||
| 401 | 401 | <select class="form-control" id="profile-user-timezone"> |
| 402 | 402 | <?php foreach ($zones as $key => $zone): ?> |
| 403 | 403 | <option value="<?php echo $key; ?>"<?php |
| 404 | - if ($session->has('user-timezone')) |
|
| 405 | - if($session->get('user-timezone') === $key) |
|
| 404 | + if ($session->has('user-timezone')) { |
|
| 405 | + if($session->get('user-timezone') === $key) |
|
| 406 | 406 | echo ' selected'; |
| 407 | - elseif ($session->get('user-timezone') === 'not_defined') |
|
| 408 | - if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key) |
|
| 407 | + } elseif ($session->get('user-timezone') === 'not_defined') { |
|
| 408 | + if (isset($SETTINGS['timezone']) && $SETTINGS['timezone'] === $key) |
|
| 409 | 409 | echo ' selected'; |
| 410 | + } |
|
| 410 | 411 | ?>><?php echo $zone; ?></option> |
| 411 | 412 | <?php endforeach; ?> |
| 412 | 413 | </select> |
@@ -149,8 +149,7 @@ |
||
| 149 | 149 | </div> |
| 150 | 150 | <?php |
| 151 | 151 | } |
| 152 | -} |
|
| 153 | -catch (Exception $e) { |
|
| 152 | +} catch (Exception $e) { |
|
| 154 | 153 | if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) { |
| 155 | 154 | error_log('TEAMPASS Error - tasks page - '.$e->getMessage()); |
| 156 | 155 | } |
@@ -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 | |
@@ -112,8 +112,9 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function isParentFolderAllowed($parent_id, $user_accessible_folders, $user_is_admin, $user_can_create_root_folder) |
| 114 | 114 | { |
| 115 | - if ($parent_id == 0 && $user_can_create_root_folder == true) |
|
| 116 | - return true; |
|
| 115 | + if ($parent_id == 0 && $user_can_create_root_folder == true) { |
|
| 116 | + return true; |
|
| 117 | + } |
|
| 117 | 118 | |
| 118 | 119 | if (in_array($parent_id, $user_accessible_folders) === false |
| 119 | 120 | && (int) $user_is_admin !== 1 |
@@ -438,8 +439,9 @@ discard block |
||
| 438 | 439 | )['count']; |
| 439 | 440 | |
| 440 | 441 | // Don't insert duplicates |
| 441 | - if ($count > 0) |
|
| 442 | - continue; |
|
| 442 | + if ($count > 0) { |
|
| 443 | + continue; |
|
| 444 | + } |
|
| 443 | 445 | |
| 444 | 446 | // Insert new background task |
| 445 | 447 | DB::insert( |
@@ -55,7 +55,9 @@ discard block |
||
| 55 | 55 | public function processBackgroundTasks() { |
| 56 | 56 | // Prevent multiple concurrent executions |
| 57 | 57 | if (!$this->acquireProcessLock()) { |
| 58 | - if (LOG_TASKS=== true) $this->logger->log('Process already running', 'INFO'); |
|
| 58 | + if (LOG_TASKS=== true) { |
|
| 59 | + $this->logger->log('Process already running', 'INFO'); |
|
| 60 | + } |
|
| 59 | 61 | return false; |
| 60 | 62 | } |
| 61 | 63 | |
@@ -64,7 +66,9 @@ discard block |
||
| 64 | 66 | $this->processTaskBatches(); |
| 65 | 67 | $this->performMaintenanceTasks(); |
| 66 | 68 | } catch (Exception $e) { |
| 67 | - if (LOG_TASKS=== true) $this->logger->log('Task processing error: ' . $e->getMessage(), 'ERROR'); |
|
| 69 | + if (LOG_TASKS=== true) { |
|
| 70 | + $this->logger->log('Task processing error: ' . $e->getMessage(), 'ERROR'); |
|
| 71 | + } |
|
| 68 | 72 | } finally { |
| 69 | 73 | $this->releaseProcessLock(); |
| 70 | 74 | } |
@@ -131,7 +135,9 @@ discard block |
||
| 131 | 135 | |
| 132 | 136 | // Check if the maximum number of parallel tasks is reached |
| 133 | 137 | if ($runningTasks >= $this->maxParallelTasks) { |
| 134 | - if (LOG_TASKS=== true) $this->logger->log('Wait ... '.$runningTasks.' out of '.$this->maxParallelTasks.' are already running ', 'INFO'); |
|
| 138 | + if (LOG_TASKS=== true) { |
|
| 139 | + $this->logger->log('Wait ... '.$runningTasks.' out of '.$this->maxParallelTasks.' are already running ', 'INFO'); |
|
| 140 | + } |
|
| 135 | 141 | return; |
| 136 | 142 | } |
| 137 | 143 | |
@@ -149,7 +155,9 @@ discard block |
||
| 149 | 155 | ); |
| 150 | 156 | |
| 151 | 157 | foreach ($tasks as $task) { |
| 152 | - if (LOG_TASKS=== true) $this->logger->log('Launching '.$task['increment_id'], 'INFO'); |
|
| 158 | + if (LOG_TASKS=== true) { |
|
| 159 | + $this->logger->log('Launching '.$task['increment_id'], 'INFO'); |
|
| 160 | + } |
|
| 153 | 161 | $this->processIndividualTask($task); |
| 154 | 162 | } |
| 155 | 163 | } |
@@ -160,7 +168,9 @@ discard block |
||
| 160 | 168 | * @param array $task The task to process. |
| 161 | 169 | */ |
| 162 | 170 | private function processIndividualTask(array $task) { |
| 163 | - if (LOG_TASKS=== true) $this->logger->log('Starting task: ' . print_r($task, true), 'INFO'); |
|
| 171 | + if (LOG_TASKS=== true) { |
|
| 172 | + $this->logger->log('Starting task: ' . print_r($task, true), 'INFO'); |
|
| 173 | + } |
|
| 164 | 174 | |
| 165 | 175 | // Store progress in the database |
| 166 | 176 | DB::update( |
@@ -188,7 +198,9 @@ discard block |
||
| 188 | 198 | $process->mustRun(); |
| 189 | 199 | |
| 190 | 200 | } catch (Exception $e) { |
| 191 | - if (LOG_TASKS=== true) $this->logger->log('Error launching task: ' . $e->getMessage(), 'ERROR'); |
|
| 201 | + if (LOG_TASKS=== true) { |
|
| 202 | + $this->logger->log('Error launching task: ' . $e->getMessage(), 'ERROR'); |
|
| 203 | + } |
|
| 192 | 204 | DB::update( |
| 193 | 205 | prefixTable('background_tasks'), |
| 194 | 206 | [ |
@@ -290,7 +302,9 @@ discard block |
||
| 290 | 302 | $taskIds |
| 291 | 303 | ); |
| 292 | 304 | |
| 293 | - if (LOG_TASKS=== true) $this->logger->log('Old finished tasks cleaned: ' . count($taskIds), 'INFO'); |
|
| 305 | + if (LOG_TASKS=== true) { |
|
| 306 | + $this->logger->log('Old finished tasks cleaned: ' . count($taskIds), 'INFO'); |
|
| 307 | + } |
|
| 294 | 308 | } |
| 295 | 309 | } |
| 296 | 310 | |
@@ -134,7 +134,9 @@ |
||
| 134 | 134 | handleAttachmentError('File exceeds the maximum allowed size', 120, 413); |
| 135 | 135 | die(); |
| 136 | 136 | } |
| 137 | - if (WIP === true) error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize); |
|
| 137 | + if (WIP === true) { |
|
| 138 | + error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize); |
|
| 139 | + } |
|
| 138 | 140 | |
| 139 | 141 | // delete expired tokens |
| 140 | 142 | DB::delete(prefixTable('tokens'), 'end_timestamp < %i', time()); |