@@ -177,7 +177,7 @@ |
||
| 177 | 177 | throw new ApplicationLogicException('Cannot locate request'); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if($this->job->getEmailTemplate() !== null){ |
|
| 180 | + if($this->job->getEmailTemplate() !== null) { |
|
| 181 | 181 | $this->emailTemplate = EmailTemplate::getById($this->job->getEmailTemplate(), $this->getDatabase()); |
| 182 | 182 | |
| 183 | 183 | if ($this->emailTemplate === false) { |
@@ -115,8 +115,7 @@ discard block |
||
| 115 | 115 | SessionAlert::success("Email template has been saved successfully."); |
| 116 | 116 | |
| 117 | 117 | $this->redirect('emailManagement'); |
| 118 | - } |
|
| 119 | - else { |
|
| 118 | + } else { |
|
| 120 | 119 | $this->assignCSRFToken(); |
| 121 | 120 | $this->assign('id', $template->getId()); |
| 122 | 121 | $this->assign('emailTemplate', $template); |
@@ -183,8 +182,7 @@ discard block |
||
| 183 | 182 | SessionAlert::success("Email template has been saved successfully."); |
| 184 | 183 | |
| 185 | 184 | $this->redirect('emailManagement'); |
| 186 | - } |
|
| 187 | - else { |
|
| 185 | + } else { |
|
| 188 | 186 | $this->assignCSRFToken(); |
| 189 | 187 | $this->assign('id', -1); |
| 190 | 188 | $this->assign('emailTemplate', new EmailTemplate()); |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | if ($config->getEmailConfirmationEnabled()) { |
| 43 | 43 | $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
| 44 | 44 | $totalQuery = "SELECT COUNT(id) FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
| 45 | - } |
|
| 46 | - else { |
|
| 45 | + } else { |
|
| 47 | 46 | $query = "SELECT * FROM request WHERE status = :type;"; |
| 48 | 47 | $totalQuery = "SELECT COUNT(id) FROM request WHERE status = :type;"; |
| 49 | 48 | } |
@@ -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()); |
| 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(); |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | && $creationMode === 'bot' |
| 56 | 56 | ) { |
| 57 | 57 | throw new AccessDeniedException($secMgr); |
| 58 | - } |
|
| 59 | - elseif ($secMgr->allows('RequestCreation', User::CREATION_OAUTH, $user) !== SecurityManager::ALLOWED |
|
| 58 | + } elseif ($secMgr->allows('RequestCreation', User::CREATION_OAUTH, $user) !== SecurityManager::ALLOWED |
|
| 60 | 59 | && $creationMode === 'oauth' |
| 61 | 60 | ) { |
| 62 | 61 | throw new AccessDeniedException($secMgr); |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | $this->assign("declinedUsers", $declinedUsers); |
| 61 | 61 | |
| 62 | 62 | UserSearchHelper::get($database)->getRoleMap($roleMap); |
| 63 | - } |
|
| 64 | - else { |
|
| 63 | + } else { |
|
| 65 | 64 | $this->assign("showAll", false); |
| 66 | 65 | $this->assign("suspendedUsers", array()); |
| 67 | 66 | $this->assign("declinedUsers", array()); |
@@ -182,8 +181,7 @@ discard block |
||
| 182 | 181 | $this->redirect('statistics/users', 'detail', array('user' => $user->getId())); |
| 183 | 182 | |
| 184 | 183 | return; |
| 185 | - } |
|
| 186 | - else { |
|
| 184 | + } else { |
|
| 187 | 185 | $this->assignCSRFToken(); |
| 188 | 186 | $this->setTemplate('usermanagement/roleedit.tpl'); |
| 189 | 187 | $this->assign('user', $user); |
@@ -244,8 +242,7 @@ discard block |
||
| 244 | 242 | $this->redirect('userManagement'); |
| 245 | 243 | |
| 246 | 244 | return; |
| 247 | - } |
|
| 248 | - else { |
|
| 245 | + } else { |
|
| 249 | 246 | $this->assignCSRFToken(); |
| 250 | 247 | $this->setTemplate('usermanagement/changelevel-reason.tpl'); |
| 251 | 248 | $this->assign('user', $user); |
@@ -309,8 +306,7 @@ discard block |
||
| 309 | 306 | $this->redirect('userManagement'); |
| 310 | 307 | |
| 311 | 308 | return; |
| 312 | - } |
|
| 313 | - else { |
|
| 309 | + } else { |
|
| 314 | 310 | $this->assignCSRFToken(); |
| 315 | 311 | $this->setTemplate('usermanagement/changelevel-reason.tpl'); |
| 316 | 312 | $this->assign('user', $user); |
@@ -364,8 +360,7 @@ discard block |
||
| 364 | 360 | $this->redirect("userManagement"); |
| 365 | 361 | |
| 366 | 362 | return; |
| 367 | - } |
|
| 368 | - else { |
|
| 363 | + } else { |
|
| 369 | 364 | $this->assignCSRFToken(); |
| 370 | 365 | $this->setTemplate("usermanagement/changelevel-reason.tpl"); |
| 371 | 366 | $this->assign("user", $user); |
@@ -445,8 +440,7 @@ discard block |
||
| 445 | 440 | $this->redirect("userManagement"); |
| 446 | 441 | |
| 447 | 442 | return; |
| 448 | - } |
|
| 449 | - else { |
|
| 443 | + } else { |
|
| 450 | 444 | $this->assignCSRFToken(); |
| 451 | 445 | $this->setTemplate('usermanagement/renameuser.tpl'); |
| 452 | 446 | $this->assign('user', $user); |
@@ -505,8 +499,7 @@ discard block |
||
| 505 | 499 | $this->redirect("userManagement"); |
| 506 | 500 | |
| 507 | 501 | return; |
| 508 | - } |
|
| 509 | - else { |
|
| 502 | + } else { |
|
| 510 | 503 | $this->assignCSRFToken(); |
| 511 | 504 | $oauth = new OAuthUserHelper($user, $database, $this->getOAuthProtocolHelper(), |
| 512 | 505 | $this->getSiteConfiguration()); |
@@ -33,7 +33,8 @@ discard block |
||
| 33 | 33 | $bans = Ban::getActiveBans(null, $this->getDatabase()); |
| 34 | 34 | |
| 35 | 35 | $userIds = array_map( |
| 36 | - function(Ban $entry) { |
|
| 36 | + function(Ban $entry) |
|
| 37 | + { |
|
| 37 | 38 | return $entry->getUser(); |
| 38 | 39 | }, |
| 39 | 40 | $bans); |
@@ -64,8 +65,7 @@ discard block |
||
| 64 | 65 | SessionAlert::error($ex->getMessage()); |
| 65 | 66 | $this->redirect("bans", "set"); |
| 66 | 67 | } |
| 67 | - } |
|
| 68 | - else { |
|
| 68 | + } else { |
|
| 69 | 69 | $this->handleGetMethodForSetBan(); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -103,8 +103,7 @@ discard block |
||
| 103 | 103 | $this->getNotificationHelper()->unbanned($ban, $unbanReason); |
| 104 | 104 | |
| 105 | 105 | $this->redirect('bans'); |
| 106 | - } |
|
| 107 | - else { |
|
| 106 | + } else { |
|
| 108 | 107 | $this->assignCSRFToken(); |
| 109 | 108 | $this->assign('ban', $ban); |
| 110 | 109 | $this->setTemplate('bans/unban.tpl'); |
@@ -122,17 +121,14 @@ discard block |
||
| 122 | 121 | |
| 123 | 122 | if (!$duration) { |
| 124 | 123 | throw new ApplicationLogicException('Invalid ban time'); |
| 125 | - } |
|
| 126 | - elseif (time() > $duration) { |
|
| 124 | + } elseif (time() > $duration) { |
|
| 127 | 125 | throw new ApplicationLogicException('Ban time has already expired!'); |
| 128 | 126 | } |
| 129 | 127 | |
| 130 | 128 | return $duration; |
| 131 | - } |
|
| 132 | - elseif ($duration === "-1") { |
|
| 129 | + } elseif ($duration === "-1") { |
|
| 133 | 130 | return null; |
| 134 | - } |
|
| 135 | - else { |
|
| 131 | + } else { |
|
| 136 | 132 | $duration = WebRequest::postInt('duration') + time(); |
| 137 | 133 | |
| 138 | 134 | return $duration; |
@@ -62,8 +62,7 @@ |
||
| 62 | 62 | |
| 63 | 63 | $this->assignCSRFToken(); |
| 64 | 64 | $this->setTemplate('search/searchResult.tpl'); |
| 65 | - } |
|
| 66 | - else { |
|
| 65 | + } else { |
|
| 67 | 66 | $this->assignCSRFToken(); |
| 68 | 67 | $this->setTemplate('search/searchForm.tpl'); |
| 69 | 68 | } |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $user = User::getByUsername($username, $database); |
| 68 | - } |
|
| 69 | - else { |
|
| 68 | + } else { |
|
| 70 | 69 | $user = User::getById($partialId, $database); |
| 71 | 70 | } |
| 72 | 71 | |
@@ -105,8 +104,7 @@ discard block |
||
| 105 | 104 | |
| 106 | 105 | return; |
| 107 | 106 | } |
| 108 | - } |
|
| 109 | - else { |
|
| 107 | + } else { |
|
| 110 | 108 | $this->assign('showSignIn', true); |
| 111 | 109 | |
| 112 | 110 | $this->setupPartial(); |
@@ -131,8 +129,7 @@ discard block |
||
| 131 | 129 | if (WebRequest::isHttps()) { |
| 132 | 130 | // Client can clearly use HTTPS, so let's enforce it for all connections. |
| 133 | 131 | $this->headerQueue[] = "Strict-Transport-Security: max-age=15768000"; |
| 134 | - } |
|
| 135 | - else { |
|
| 132 | + } else { |
|
| 136 | 133 | // This is the login form, not the request form. We need protection here. |
| 137 | 134 | $this->redirectUrl('https://' . WebRequest::serverName() . WebRequest::requestUri()); |
| 138 | 135 | |
@@ -166,8 +163,7 @@ discard block |
||
| 166 | 163 | $username = $this->partialUser->getUsername(); |
| 167 | 164 | |
| 168 | 165 | $this->setupAlternates($this->partialUser, $partialStage, $database); |
| 169 | - } |
|
| 170 | - else { |
|
| 166 | + } else { |
|
| 171 | 167 | // No, see if we've preloaded a username |
| 172 | 168 | $preloadUsername = WebRequest::getString('tplUsername'); |
| 173 | 169 | if ($preloadUsername !== null) { |
@@ -194,13 +190,11 @@ discard block |
||
| 194 | 190 | $redirectDestination = WebRequest::clearPostLoginRedirect(); |
| 195 | 191 | if ($redirectDestination !== null) { |
| 196 | 192 | $this->redirectUrl($redirectDestination); |
| 197 | - } |
|
| 198 | - else { |
|
| 193 | + } else { |
|
| 199 | 194 | if ($user->isNewUser()) { |
| 200 | 195 | // home page isn't allowed, go to preferences instead |
| 201 | 196 | $this->redirect('preferences'); |
| 202 | - } |
|
| 203 | - else { |
|
| 197 | + } else { |
|
| 204 | 198 | // go to the home page |
| 205 | 199 | $this->redirect(''); |
| 206 | 200 | } |
@@ -323,7 +317,8 @@ discard block |
||
| 323 | 317 | if (isset($types[$type])) { |
| 324 | 318 | $options = $types[$type]; |
| 325 | 319 | |
| 326 | - array_walk($options, function(&$val) { |
|
| 320 | + array_walk($options, function(&$val) |
|
| 321 | + { |
|
| 327 | 322 | $val = $this->names[$val]; |
| 328 | 323 | }); |
| 329 | 324 | |