@@ -55,8 +55,7 @@ |
||
| 55 | 55 | if ($pageCount < $pageLimit) { |
| 56 | 56 | if ($pageData['lowpage'] == 1 && $pageData['hipage'] < $pageData['maxpage']) { |
| 57 | 57 | $pageData['hipage'] = min($pageLimit, $pageData['maxpage']); |
| 58 | - } |
|
| 59 | - elseif ($pageData['lowpage'] > 1 && $pageData['hipage'] == $pageData['maxpage']) { |
|
| 58 | + } elseif ($pageData['lowpage'] > 1 && $pageData['hipage'] == $pageData['maxpage']) { |
|
| 60 | 59 | $pageData['lowpage'] = max(1, $pageData['maxpage'] - $pageLimit + 1); |
| 61 | 60 | } |
| 62 | 61 | } |
@@ -88,8 +88,7 @@ discard block |
||
| 88 | 88 | if ($securityResult === SecurityManager::ALLOWED) { |
| 89 | 89 | // We're allowed to run the page, so let's run it. |
| 90 | 90 | $this->runPage(); |
| 91 | - } |
|
| 92 | - else { |
|
| 91 | + } else { |
|
| 93 | 92 | $this->handleAccessDenied($securityResult); |
| 94 | 93 | |
| 95 | 94 | // Send the headers |
@@ -116,8 +115,7 @@ discard block |
||
| 116 | 115 | |
| 117 | 116 | if (WebRequest::testSiteNoticeCookieValue($siteNoticeHash)) { |
| 118 | 117 | $this->assign('siteNoticeState', 'd-none'); |
| 119 | - } |
|
| 120 | - else { |
|
| 118 | + } else { |
|
| 121 | 119 | $this->assign('siteNoticeState', 'd-block'); |
| 122 | 120 | } |
| 123 | 121 | |
@@ -163,19 +161,16 @@ discard block |
||
| 163 | 161 | $this->redirect("login"); |
| 164 | 162 | |
| 165 | 163 | return; |
| 166 | - } |
|
| 167 | - else { |
|
| 164 | + } else { |
|
| 168 | 165 | // Decide whether this was a rights failure, or an identification failure. |
| 169 | 166 | |
| 170 | 167 | if ($denyReason === SecurityManager::ERROR_NOT_IDENTIFIED) { |
| 171 | 168 | // Not identified |
| 172 | 169 | throw new NotIdentifiedException($this->getSecurityManager(), $this->getDomainAccessManager()); |
| 173 | - } |
|
| 174 | - elseif ($denyReason === SecurityManager::ERROR_DENIED) { |
|
| 170 | + } elseif ($denyReason === SecurityManager::ERROR_DENIED) { |
|
| 175 | 171 | // Nope, plain old access denied |
| 176 | 172 | throw new AccessDeniedException($this->getSecurityManager(), $this->getDomainAccessManager()); |
| 177 | - } |
|
| 178 | - else { |
|
| 173 | + } else { |
|
| 179 | 174 | throw new Exception('Unknown response from security manager.'); |
| 180 | 175 | } |
| 181 | 176 | } |
@@ -43,7 +43,8 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function switchDomain(User $user, Domain $newDomain): void |
| 45 | 45 | { |
| 46 | - $mapToId = function(DataObject $object) { |
|
| 46 | + $mapToId = function(DataObject $object) |
|
| 47 | + { |
|
| 47 | 48 | return $object->getId(); |
| 48 | 49 | }; |
| 49 | 50 | |
@@ -51,8 +52,7 @@ discard block |
||
| 51 | 52 | |
| 52 | 53 | if ($allowed) { |
| 53 | 54 | WebRequest::setActiveDomain($newDomain); |
| 54 | - } |
|
| 55 | - else { |
|
| 55 | + } else { |
|
| 56 | 56 | throw new AccessDeniedException($this->securityManager, $this); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -115,8 +115,7 @@ |
||
| 115 | 115 | $sql = 'UPDATE credential SET factor = factor - 1 WHERE user = :user AND factor > :factor'; |
| 116 | 116 | $statement = $this->database->prepare($sql); |
| 117 | 117 | $statement->execute(array(':user' => $user->getId(), ':factor' => $stage)); |
| 118 | - } |
|
| 119 | - else { |
|
| 118 | + } else { |
|
| 120 | 119 | // There are other auth factors at this point. Don't renumber the factors just yet. |
| 121 | 120 | } |
| 122 | 121 | |
@@ -197,12 +197,10 @@ |
||
| 197 | 197 | if ($this->roleConfiguration->roleNeedsIdentification($v)) { |
| 198 | 198 | if ($identified) { |
| 199 | 199 | $activeRoles[] = $v; |
| 200 | - } |
|
| 201 | - else { |
|
| 200 | + } else { |
|
| 202 | 201 | $inactiveRoles[] = $v; |
| 203 | 202 | } |
| 204 | - } |
|
| 205 | - else { |
|
| 203 | + } else { |
|
| 206 | 204 | $activeRoles[] = $v; |
| 207 | 205 | } |
| 208 | 206 | } |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | SessionAlert::error($ex->getMessage()); |
| 86 | 86 | $this->redirect("bans", "set"); |
| 87 | 87 | } |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | $this->handleGetMethodForSetBan(); |
| 91 | 90 | |
| 92 | 91 | $user = User::getCurrent($this->getDatabase()); |
@@ -134,8 +133,7 @@ discard block |
||
| 134 | 133 | SessionAlert::error($ex->getMessage()); |
| 135 | 134 | $this->redirect("bans", "set"); |
| 136 | 135 | } |
| 137 | - } |
|
| 138 | - else { |
|
| 136 | + } else { |
|
| 139 | 137 | $this->handleGetMethodForSetBan(); |
| 140 | 138 | |
| 141 | 139 | $user = User::getCurrent($database); |
@@ -262,8 +260,7 @@ discard block |
||
| 262 | 260 | $this->getNotificationHelper()->unbanned($ban, $unbanReason); |
| 263 | 261 | |
| 264 | 262 | $this->redirect('bans'); |
| 265 | - } |
|
| 266 | - else { |
|
| 263 | + } else { |
|
| 267 | 264 | $this->assignCSRFToken(); |
| 268 | 265 | $this->assign('ban', $ban); |
| 269 | 266 | $this->setTemplate('bans/unban.tpl'); |
@@ -283,17 +280,14 @@ discard block |
||
| 283 | 280 | |
| 284 | 281 | if (!$duration) { |
| 285 | 282 | throw new ApplicationLogicException('Invalid ban time'); |
| 286 | - } |
|
| 287 | - elseif (time() > $duration) { |
|
| 283 | + } elseif (time() > $duration) { |
|
| 288 | 284 | throw new ApplicationLogicException('Ban time has already expired!'); |
| 289 | 285 | } |
| 290 | 286 | |
| 291 | 287 | return $duration; |
| 292 | - } |
|
| 293 | - elseif ($duration === "-1") { |
|
| 288 | + } elseif ($duration === "-1") { |
|
| 294 | 289 | return null; |
| 295 | - } |
|
| 296 | - else { |
|
| 290 | + } else { |
|
| 297 | 291 | return WebRequest::postInt('duration') + time(); |
| 298 | 292 | } |
| 299 | 293 | } |
@@ -585,8 +579,7 @@ discard block |
||
| 585 | 579 | $ipParts = explode('/', $targetIp, 2); |
| 586 | 580 | $targetIp = $ipParts[0]; |
| 587 | 581 | $targetMask = (int)$ipParts[1]; |
| 588 | - } |
|
| 589 | - else { |
|
| 582 | + } else { |
|
| 590 | 583 | // Default the CIDR range based on the IP type |
| 591 | 584 | $targetMask = filter_var($targetIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ? 128 : 32; |
| 592 | 585 | } |
@@ -66,8 +66,7 @@ discard block |
||
| 66 | 66 | $this->assign("declinedUsers", $declinedUsers); |
| 67 | 67 | |
| 68 | 68 | UserSearchHelper::get($database)->getRoleMap($roleMap); |
| 69 | - } |
|
| 70 | - else { |
|
| 69 | + } else { |
|
| 71 | 70 | $this->assign("showAll", false); |
| 72 | 71 | $this->assign("suspendedUsers", array()); |
| 73 | 72 | $this->assign("declinedUsers", array()); |
@@ -161,8 +160,7 @@ discard block |
||
| 161 | 160 | if ($newValue === 0) { |
| 162 | 161 | if ($r['globalOnly']) { |
| 163 | 162 | $globalDelete[] = $r['object']; |
| 164 | - } |
|
| 165 | - else { |
|
| 163 | + } else { |
|
| 166 | 164 | $delete[] = $r['object']; |
| 167 | 165 | } |
| 168 | 166 | } |
@@ -170,8 +168,7 @@ discard block |
||
| 170 | 168 | if ($newValue === 1) { |
| 171 | 169 | if ($r['globalOnly']) { |
| 172 | 170 | $globalAdd[] = $name; |
| 173 | - } |
|
| 174 | - else { |
|
| 171 | + } else { |
|
| 175 | 172 | $add[] = $name; |
| 176 | 173 | } |
| 177 | 174 | } |
@@ -233,8 +230,7 @@ discard block |
||
| 233 | 230 | SessionAlert::quick('Roles changed for user ' . htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
| 234 | 231 | |
| 235 | 232 | $this->redirect('statistics/users', 'detail', array('user' => $user->getId())); |
| 236 | - } |
|
| 237 | - else { |
|
| 233 | + } else { |
|
| 238 | 234 | $this->assignCSRFToken(); |
| 239 | 235 | $this->setTemplate('usermanagement/roleedit.tpl'); |
| 240 | 236 | $this->assign('user', $user); |
@@ -295,8 +291,7 @@ discard block |
||
| 295 | 291 | $this->redirect('userManagement'); |
| 296 | 292 | |
| 297 | 293 | return; |
| 298 | - } |
|
| 299 | - else { |
|
| 294 | + } else { |
|
| 300 | 295 | $this->assignCSRFToken(); |
| 301 | 296 | $this->setTemplate('usermanagement/changelevel-reason.tpl'); |
| 302 | 297 | $this->assign('user', $user); |
@@ -360,8 +355,7 @@ discard block |
||
| 360 | 355 | $this->redirect('userManagement'); |
| 361 | 356 | |
| 362 | 357 | return; |
| 363 | - } |
|
| 364 | - else { |
|
| 358 | + } else { |
|
| 365 | 359 | $this->assignCSRFToken(); |
| 366 | 360 | $this->setTemplate('usermanagement/changelevel-reason.tpl'); |
| 367 | 361 | $this->assign('user', $user); |
@@ -415,8 +409,7 @@ discard block |
||
| 415 | 409 | $this->redirect("userManagement"); |
| 416 | 410 | |
| 417 | 411 | return; |
| 418 | - } |
|
| 419 | - else { |
|
| 412 | + } else { |
|
| 420 | 413 | $this->assignCSRFToken(); |
| 421 | 414 | $this->setTemplate("usermanagement/changelevel-reason.tpl"); |
| 422 | 415 | $this->assign("user", $user); |
@@ -499,8 +492,7 @@ discard block |
||
| 499 | 492 | $this->redirect("userManagement"); |
| 500 | 493 | |
| 501 | 494 | return; |
| 502 | - } |
|
| 503 | - else { |
|
| 495 | + } else { |
|
| 504 | 496 | $this->assignCSRFToken(); |
| 505 | 497 | $this->setTemplate('usermanagement/renameuser.tpl'); |
| 506 | 498 | $this->assign('user', $user); |
@@ -566,8 +558,7 @@ discard block |
||
| 566 | 558 | $this->redirect("userManagement"); |
| 567 | 559 | |
| 568 | 560 | return; |
| 569 | - } |
|
| 570 | - else { |
|
| 561 | + } else { |
|
| 571 | 562 | $this->assignCSRFToken(); |
| 572 | 563 | $oauth = new OAuthUserHelper($user, $database, $this->getOAuthProtocolHelper(), |
| 573 | 564 | $this->getSiteConfiguration()); |
@@ -361,8 +361,7 @@ discard block |
||
| 361 | 361 | // some old templates have been completely deleted and lost to the depths of time. |
| 362 | 362 | if ($welcomeTemplate === false) { |
| 363 | 363 | return "Welcome template #{$objectId}"; |
| 364 | - } |
|
| 365 | - else { |
|
| 364 | + } else { |
|
| 366 | 365 | $userCode = htmlentities($welcomeTemplate->getUserCode(), ENT_COMPAT, 'UTF-8'); |
| 367 | 366 | |
| 368 | 367 | return "<a href=\"{$baseurl}/internal.php/welcomeTemplates/view?template={$objectId}\">{$userCode}</a>"; |
@@ -380,8 +379,7 @@ discard block |
||
| 380 | 379 | $task = $job->getTask(); |
| 381 | 380 | if (isset($taskDescriptions[$task])) { |
| 382 | 381 | $description = $taskDescriptions[$task]; |
| 383 | - } |
|
| 384 | - else { |
|
| 382 | + } else { |
|
| 385 | 383 | $description = 'Unknown task'; |
| 386 | 384 | } |
| 387 | 385 | |
@@ -151,8 +151,7 @@ |
||
| 151 | 151 | |
| 152 | 152 | if ($ban->getDomain() === null) { |
| 153 | 153 | $allowed &= $this->securityManager->allows('BanType', 'global', $user) === SecurityManager::ALLOWED; |
| 154 | - } |
|
| 155 | - else { |
|
| 154 | + } else { |
|
| 156 | 155 | $currentDomain = Domain::getCurrent($this->database); |
| 157 | 156 | $allowed &= $currentDomain->getId() === $ban->getDomain(); |
| 158 | 157 | } |