@@ -70,15 +70,13 @@ |
||
| 70 | 70 | |
| 71 | 71 | if ($flagState === 1) { |
| 72 | 72 | Logger::flaggedComment($database, $comment, $request->getDomain()); |
| 73 | - } |
|
| 74 | - else { |
|
| 73 | + } else { |
|
| 75 | 74 | Logger::unflaggedComment($database, $comment, $request->getDomain()); |
| 76 | 75 | } |
| 77 | 76 | |
| 78 | 77 | if (WebRequest::postString('return') == 'list') { |
| 79 | 78 | $this->redirect('flaggedComments'); |
| 80 | - } |
|
| 81 | - else { |
|
| 79 | + } else { |
|
| 82 | 80 | $this->redirect('viewRequest', null, ['id' => $comment->getRequest()]); |
| 83 | 81 | } |
| 84 | 82 | } |
@@ -44,8 +44,7 @@ |
||
| 44 | 44 | $userObj = User::getByUsername($filterUser, $database); |
| 45 | 45 | if ($userObj !== false) { |
| 46 | 46 | $logSearch->byUser($userObj->getId()); |
| 47 | - } |
|
| 48 | - else { |
|
| 47 | + } else { |
|
| 49 | 48 | $logSearch->byUser(-1); |
| 50 | 49 | } |
| 51 | 50 | } |
@@ -61,28 +61,23 @@ |
||
| 61 | 61 | |
| 62 | 62 | if ($request->getReserved() === $currentUser->getId()) { |
| 63 | 63 | $data['hiddenText'] = false; |
| 64 | - } |
|
| 65 | - else { |
|
| 64 | + } else { |
|
| 66 | 65 | $data['hiddenText'] = true; |
| 67 | 66 | } |
| 68 | 67 | } |
| 69 | 68 | |
| 70 | 69 | if ($object->getVisibility() == 'requester' || $object->getVisibility() == 'user') { |
| 71 | 70 | $data['hidden'] = false; |
| 72 | - } |
|
| 73 | - elseif ($object->getVisibility() == 'admin') { |
|
| 71 | + } elseif ($object->getVisibility() == 'admin') { |
|
| 74 | 72 | if ($seeRestrictedComments) { |
| 75 | 73 | $data['hidden'] = false; |
| 76 | - } |
|
| 77 | - else { |
|
| 74 | + } else { |
|
| 78 | 75 | $data['hidden'] = true; |
| 79 | 76 | } |
| 80 | - } |
|
| 81 | - elseif ($object->getVisibility() == 'checkuser') { |
|
| 77 | + } elseif ($object->getVisibility() == 'checkuser') { |
|
| 82 | 78 | if ($seeCheckuserComments) { |
| 83 | 79 | $data['hidden'] = false; |
| 84 | - } |
|
| 85 | - else { |
|
| 80 | + } else { |
|
| 86 | 81 | $data['hidden'] = true; |
| 87 | 82 | } |
| 88 | 83 | } |
@@ -56,7 +56,8 @@ discard block |
||
| 56 | 56 | $this->setTemplate('form-management/main.tpl'); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - protected function preview() { |
|
| 59 | + protected function preview() |
|
| 60 | + { |
|
| 60 | 61 | $previewContent = WebRequest::getSessionContext('preview'); |
| 61 | 62 | |
| 62 | 63 | $renderer = new MarkdownRenderingHelper(); |
@@ -129,8 +130,7 @@ discard block |
||
| 129 | 130 | $form->save(); |
| 130 | 131 | Logger::requestFormCreated($database, $form); |
| 131 | 132 | $this->redirect('requestFormManagement'); |
| 132 | - } |
|
| 133 | - else { |
|
| 133 | + } else { |
|
| 134 | 134 | $this->populateFromObject($form); |
| 135 | 135 | WebRequest::setSessionContext('preview', [ |
| 136 | 136 | 'main' => $form->getFormContent(), |
@@ -142,8 +142,7 @@ discard block |
||
| 142 | 142 | $this->assign('createMode', true); |
| 143 | 143 | $this->setTemplate('form-management/edit.tpl'); |
| 144 | 144 | } |
| 145 | - } |
|
| 146 | - else { |
|
| 145 | + } else { |
|
| 147 | 146 | $this->populateFromObject(new RequestForm()); |
| 148 | 147 | WebRequest::setSessionContext('preview', null); |
| 149 | 148 | $this->assign('hidePreview', true); |
@@ -237,8 +236,7 @@ discard block |
||
| 237 | 236 | Logger::requestFormEdited($database, $form); |
| 238 | 237 | $form->save(); |
| 239 | 238 | $this->redirect('requestFormManagement'); |
| 240 | - } |
|
| 241 | - else { |
|
| 239 | + } else { |
|
| 242 | 240 | $this->populateFromObject($form); |
| 243 | 241 | WebRequest::setSessionContext('preview', [ |
| 244 | 242 | 'main' => $form->getFormContent(), |
@@ -250,8 +248,7 @@ discard block |
||
| 250 | 248 | $this->assign('createMode', false); |
| 251 | 249 | $this->setTemplate('form-management/edit.tpl'); |
| 252 | 250 | } |
| 253 | - } |
|
| 254 | - else { |
|
| 251 | + } else { |
|
| 255 | 252 | $this->populateFromObject($form); |
| 256 | 253 | WebRequest::setSessionContext('preview', [ |
| 257 | 254 | 'main' => $form->getFormContent(), |
@@ -54,12 +54,10 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | if ($this->barrierTest(RoleConfiguration::MAIN, $user, PageMain::class)) { |
| 56 | 56 | $this->redirect(''); |
| 57 | - } |
|
| 58 | - else { |
|
| 57 | + } else { |
|
| 59 | 58 | $this->redirect('preferences'); |
| 60 | 59 | } |
| 61 | - } |
|
| 62 | - else { |
|
| 60 | + } else { |
|
| 63 | 61 | $this->assignCSRFToken(); |
| 64 | 62 | $this->setTemplate('preferences/prefs.tpl'); |
| 65 | 63 | |
@@ -118,8 +116,7 @@ discard block |
||
| 118 | 116 | $globalDefinition = WebRequest::postBoolean($fieldName . 'Global'); |
| 119 | 117 | if ($globalDefinition) { |
| 120 | 118 | $preferencesManager->setGlobalPreference($preferenceName, $value); |
| 121 | - } |
|
| 122 | - else { |
|
| 119 | + } else { |
|
| 123 | 120 | $preferencesManager->setLocalPreference($preferenceName, $value); |
| 124 | 121 | } |
| 125 | 122 | } |
@@ -91,13 +91,11 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $this->redirect('multiFactor'); |
| 94 | - } |
|
| 95 | - else { |
|
| 94 | + } else { |
|
| 96 | 95 | SessionAlert::error('Error enabling YubiKey OTP - invalid credentials.'); |
| 97 | 96 | $this->redirect('multiFactor'); |
| 98 | 97 | } |
| 99 | - } |
|
| 100 | - else { |
|
| 98 | + } else { |
|
| 101 | 99 | if ($otpCredentialProvider->userIsEnrolled($currentUser->getId())) { |
| 102 | 100 | // user is not enrolled, we shouldn't have got here. |
| 103 | 101 | throw new ApplicationLogicException('User is already enrolled in the selected MFA mechanism'); |
@@ -161,8 +159,7 @@ discard block |
||
| 161 | 159 | $this->setTemplate('mfa/enableTotpEnroll.tpl'); |
| 162 | 160 | |
| 163 | 161 | return; |
| 164 | - } |
|
| 165 | - else { |
|
| 162 | + } else { |
|
| 166 | 163 | SessionAlert::error('Error enabling TOTP - invalid credentials.'); |
| 167 | 164 | $this->redirect('multiFactor'); |
| 168 | 165 | |
@@ -187,8 +184,7 @@ discard block |
||
| 187 | 184 | $this->setTemplate('mfa/regenScratchTokens.tpl'); |
| 188 | 185 | return; |
| 189 | 186 | } |
| 190 | - } |
|
| 191 | - else { |
|
| 187 | + } else { |
|
| 192 | 188 | $otpCredentialProvider->deleteCredential($currentUser); |
| 193 | 189 | SessionAlert::error('Error enabling TOTP: invalid token provided'); |
| 194 | 190 | } |
@@ -196,8 +192,7 @@ discard block |
||
| 196 | 192 | |
| 197 | 193 | $this->redirect('multiFactor'); |
| 198 | 194 | return; |
| 199 | - } |
|
| 200 | - else { |
|
| 195 | + } else { |
|
| 201 | 196 | SessionAlert::error('Error enabling TOTP - no enrollment found or enrollment expired.'); |
| 202 | 197 | $this->redirect('multiFactor'); |
| 203 | 198 | |
@@ -207,8 +202,7 @@ discard block |
||
| 207 | 202 | |
| 208 | 203 | // urgh, dunno what happened, but it's not something expected. |
| 209 | 204 | throw new ApplicationLogicException(); |
| 210 | - } |
|
| 211 | - else { |
|
| 205 | + } else { |
|
| 212 | 206 | if ($otpCredentialProvider->userIsEnrolled($currentUser->getId())) { |
| 213 | 207 | // user is not enrolled, we shouldn't have got here. |
| 214 | 208 | throw new ApplicationLogicException('User is already enrolled in the selected MFA mechanism'); |
@@ -258,13 +252,11 @@ discard block |
||
| 258 | 252 | $tokens = $otpCredentialProvider->getTokens(); |
| 259 | 253 | $this->assign('tokens', $tokens); |
| 260 | 254 | $this->setTemplate('mfa/regenScratchTokens.tpl'); |
| 261 | - } |
|
| 262 | - else { |
|
| 255 | + } else { |
|
| 263 | 256 | SessionAlert::error('Error refreshing scratch tokens - invalid credentials.'); |
| 264 | 257 | $this->redirect('multiFactor'); |
| 265 | 258 | } |
| 266 | - } |
|
| 267 | - else { |
|
| 259 | + } else { |
|
| 268 | 260 | $this->assignCSRFToken(); |
| 269 | 261 | |
| 270 | 262 | $this->assign('alertmessage', 'To regenerate your emergency scratch tokens, please prove you are who you say you are by providing your tool password below. Note that continuing will invalidate all remaining scratch tokens, and provide a set of new ones.'); |
@@ -302,13 +294,11 @@ discard block |
||
| 302 | 294 | $otpCredentialProvider->deleteCredential($currentUser); |
| 303 | 295 | SessionAlert::success('Disabled ' . $factorType . '.'); |
| 304 | 296 | $this->redirect('multiFactor'); |
| 305 | - } |
|
| 306 | - else { |
|
| 297 | + } else { |
|
| 307 | 298 | SessionAlert::error('Error disabling ' . $factorType . ' - invalid credentials.'); |
| 308 | 299 | $this->redirect('multiFactor'); |
| 309 | 300 | } |
| 310 | - } |
|
| 311 | - else { |
|
| 301 | + } else { |
|
| 312 | 302 | if (!$otpCredentialProvider->userIsEnrolled($currentUser->getId())) { |
| 313 | 303 | // user is not enrolled, we shouldn't have got here. |
| 314 | 304 | throw new ApplicationLogicException('User is not enrolled in the selected MFA mechanism'); |
@@ -33,13 +33,11 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | if ($currentUser->getId() === $request->getReserved()) { |
| 35 | 35 | $this->doUnreserve($request, $database); |
| 36 | - } |
|
| 37 | - else { |
|
| 36 | + } else { |
|
| 38 | 37 | // not the same user! |
| 39 | 38 | if ($this->barrierTest('force', $currentUser)) { |
| 40 | 39 | $this->doBreakReserve($request, $database); |
| 41 | - } |
|
| 42 | - else { |
|
| 40 | + } else { |
|
| 43 | 41 | throw new AccessDeniedException($this->getSecurityManager(), $this->getDomainAccessManager()); |
| 44 | 42 | } |
| 45 | 43 | } |
@@ -83,8 +81,7 @@ discard block |
||
| 83 | 81 | $this->skipAlerts(); |
| 84 | 82 | |
| 85 | 83 | $this->setTemplate("confirmations/breakreserve.tpl"); |
| 86 | - } |
|
| 87 | - else { |
|
| 84 | + } else { |
|
| 88 | 85 | $request->setReserved(null); |
| 89 | 86 | $request->setUpdateVersion(WebRequest::postInt('updateversion')); |
| 90 | 87 | $request->save(); |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | if ($success) { |
| 55 | 55 | $this->redirect(); |
| 56 | 56 | } |
| 57 | - } |
|
| 58 | - else { |
|
| 57 | + } else { |
|
| 59 | 58 | $this->assignCSRFToken(); |
| 60 | 59 | $this->showCustomCloseForm($database, $request); |
| 61 | 60 | } |
@@ -311,8 +310,7 @@ discard block |
||
| 311 | 310 | if ($action == EmailTemplate::ACTION_CREATED) { |
| 312 | 311 | $logCloseType = 'custom-y'; |
| 313 | 312 | $notificationCloseType = "Custom, Created"; |
| 314 | - } |
|
| 315 | - else { |
|
| 313 | + } else { |
|
| 316 | 314 | $logCloseType = 'custom-n'; |
| 317 | 315 | $notificationCloseType = "Custom, Not Created"; |
| 318 | 316 | } |
@@ -57,8 +57,7 @@ |
||
| 57 | 57 | && $creationMode === 'bot' |
| 58 | 58 | ) { |
| 59 | 59 | throw new AccessDeniedException($secMgr, $this->getDomainAccessManager()); |
| 60 | - } |
|
| 61 | - elseif ($secMgr->allows('RequestCreation', PreferenceManager::CREATION_OAUTH, $user) !== SecurityManager::ALLOWED |
|
| 60 | + } elseif ($secMgr->allows('RequestCreation', PreferenceManager::CREATION_OAUTH, $user) !== SecurityManager::ALLOWED |
|
| 62 | 61 | && $creationMode === 'oauth' |
| 63 | 62 | ) { |
| 64 | 63 | throw new AccessDeniedException($secMgr, $this->getDomainAccessManager()); |