@@ -91,8 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | if ($siteConfiguration->getTitleBlacklistEnabled()) { |
| 93 | 93 | $page->setBlacklistHelper(new BlacklistHelper($httpHelper, $database, $siteConfiguration)); |
| 94 | - } |
|
| 95 | - else { |
|
| 94 | + } else { |
|
| 96 | 95 | $page->setBlacklistHelper(new FakeBlacklistHelper()); |
| 97 | 96 | } |
| 98 | 97 | } |
@@ -150,8 +150,7 @@ |
||
| 150 | 150 | |
| 151 | 151 | if ($ban->getDomain() === null) { |
| 152 | 152 | $allowed &= $this->securityManager->allows('BanType', 'global', $user) === ISecurityManager::ALLOWED; |
| 153 | - } |
|
| 154 | - else { |
|
| 153 | + } else { |
|
| 155 | 154 | $currentDomain = Domain::getCurrent($this->database); |
| 156 | 155 | $allowed &= $currentDomain->getId() === $ban->getDomain(); |
| 157 | 156 | } |
@@ -362,8 +362,7 @@ discard block |
||
| 362 | 362 | // some old templates have been completely deleted and lost to the depths of time. |
| 363 | 363 | if ($welcomeTemplate === false) { |
| 364 | 364 | return "Welcome template #{$objectId}"; |
| 365 | - } |
|
| 366 | - else { |
|
| 365 | + } else { |
|
| 367 | 366 | $userCode = htmlentities($welcomeTemplate->getUserCode(), ENT_COMPAT, 'UTF-8'); |
| 368 | 367 | |
| 369 | 368 | return "<a href=\"{$baseurl}/internal.php/welcomeTemplates/view?template={$objectId}\">{$userCode}</a>"; |
@@ -381,8 +380,7 @@ discard block |
||
| 381 | 380 | $task = $job->getTask(); |
| 382 | 381 | if (isset($taskDescriptions[$task])) { |
| 383 | 382 | $description = $taskDescriptions[$task]; |
| 384 | - } |
|
| 385 | - else { |
|
| 383 | + } else { |
|
| 386 | 384 | $description = 'Unknown task'; |
| 387 | 385 | } |
| 388 | 386 | |
@@ -549,11 +547,9 @@ discard block |
||
| 549 | 547 | if (in_array($logEntry->getAction(), $protectedLogActions) && $logEntry->getObjectType() === 'User') { |
| 550 | 548 | if ($allowAccountLog) { |
| 551 | 549 | // do nothing, allowed to see all account logs |
| 552 | - } |
|
| 553 | - else if ($allowAccountLogSelf && $currentUser->getId() === $logEntry->getObjectId()) { |
|
| 550 | + } else if ($allowAccountLogSelf && $currentUser->getId() === $logEntry->getObjectId()) { |
|
| 554 | 551 | // do nothing, allowed to see own account log |
| 555 | - } |
|
| 556 | - else { |
|
| 552 | + } else { |
|
| 557 | 553 | $comment = null; |
| 558 | 554 | } |
| 559 | 555 | } |
@@ -88,8 +88,7 @@ discard block |
||
| 88 | 88 | if ($securityResult === ISecurityManager::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 === ISecurityManager::ERROR_NOT_IDENTIFIED) { |
| 171 | 168 | // Not identified |
| 172 | 169 | throw new NotIdentifiedException($this->getSecurityManager(), $this->getDomainAccessManager()); |
| 173 | - } |
|
| 174 | - elseif ($denyReason === ISecurityManager::ERROR_DENIED) { |
|
| 170 | + } elseif ($denyReason === ISecurityManager::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 | } |
@@ -46,7 +46,8 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function switchDomain(User $user, Domain $newDomain): void |
| 48 | 48 | { |
| 49 | - $mapToId = function(DataObject $object) { |
|
| 49 | + $mapToId = function(DataObject $object) |
|
| 50 | + { |
|
| 50 | 51 | return $object->getId(); |
| 51 | 52 | }; |
| 52 | 53 | |
@@ -54,8 +55,7 @@ discard block |
||
| 54 | 55 | |
| 55 | 56 | if ($allowed) { |
| 56 | 57 | WebRequest::setActiveDomain($newDomain); |
| 57 | - } |
|
| 58 | - else { |
|
| 58 | + } else { |
|
| 59 | 59 | throw new DomainSwitchNotAllowedException(); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -58,12 +58,10 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | if ($user === false) { |
| 60 | 60 | self::$currentUser = new CommunityUser(); |
| 61 | - } |
|
| 62 | - else { |
|
| 61 | + } else { |
|
| 63 | 62 | self::$currentUser = $user; |
| 64 | 63 | } |
| 65 | - } |
|
| 66 | - else { |
|
| 64 | + } else { |
|
| 67 | 65 | $anonymousCoward = new CommunityUser(); |
| 68 | 66 | |
| 69 | 67 | self::$currentUser = $anonymousCoward; |
@@ -190,12 +188,10 @@ discard block |
||
| 190 | 188 | |
| 191 | 189 | if ($statement->execute()) { |
| 192 | 190 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 193 | - } |
|
| 194 | - else { |
|
| 191 | + } else { |
|
| 195 | 192 | throw new Exception($statement->errorInfo()); |
| 196 | 193 | } |
| 197 | - } |
|
| 198 | - else { |
|
| 194 | + } else { |
|
| 199 | 195 | // update |
| 200 | 196 | $statement = $this->dbObject->prepare(<<<SQL |
| 201 | 197 | UPDATE `user` SET |
@@ -134,7 +134,8 @@ discard block |
||
| 134 | 134 | $job->setDatabase($database); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $this->getTypeAheadHelper()->defineTypeAheadSource('username-typeahead', function() use ($database) { |
|
| 137 | + $this->getTypeAheadHelper()->defineTypeAheadSource('username-typeahead', function() use ($database) |
|
| 138 | + { |
|
| 138 | 139 | return UserSearchHelper::get($database)->fetchColumn('username'); |
| 139 | 140 | }); |
| 140 | 141 | |
@@ -178,8 +179,7 @@ discard block |
||
| 178 | 179 | ->byObjectId($job->getId())->getRecordCount($logCount)->fetch(); |
| 179 | 180 | if ($logCount === 0) { |
| 180 | 181 | $this->assign('log', array()); |
| 181 | - } |
|
| 182 | - else { |
|
| 182 | + } else { |
|
| 183 | 183 | list($users, $logData) = LogHelper::prepareLogsForTemplate($logs, $database, $this->getSiteConfiguration(), $this->getSecurityManager()); |
| 184 | 184 | |
| 185 | 185 | $this->assign("log", $logData); |
@@ -64,8 +64,7 @@ discard block |
||
| 64 | 64 | $this->assign('deactivatedUsers', $deactivatedUsers); |
| 65 | 65 | |
| 66 | 66 | UserSearchHelper::get($database)->getRoleMap($roleMap); |
| 67 | - } |
|
| 68 | - else { |
|
| 67 | + } else { |
|
| 69 | 68 | $this->assign("showAll", false); |
| 70 | 69 | $this->assign('deactivatedUsers', array()); |
| 71 | 70 | |
@@ -159,8 +158,7 @@ discard block |
||
| 159 | 158 | if ($newValue === 0) { |
| 160 | 159 | if ($r['globalOnly']) { |
| 161 | 160 | $globalDelete[] = $r['object']; |
| 162 | - } |
|
| 163 | - else { |
|
| 161 | + } else { |
|
| 164 | 162 | $delete[] = $r['object']; |
| 165 | 163 | } |
| 166 | 164 | } |
@@ -168,8 +166,7 @@ discard block |
||
| 168 | 166 | if ($newValue === 1) { |
| 169 | 167 | if ($r['globalOnly']) { |
| 170 | 168 | $globalAdd[] = $name; |
| 171 | - } |
|
| 172 | - else { |
|
| 169 | + } else { |
|
| 173 | 170 | $add[] = $name; |
| 174 | 171 | } |
| 175 | 172 | } |
@@ -231,8 +228,7 @@ discard block |
||
| 231 | 228 | SessionAlert::quick('Roles changed for user ' . htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8')); |
| 232 | 229 | |
| 233 | 230 | $this->redirect('statistics/users', 'detail', array('user' => $user->getId())); |
| 234 | - } |
|
| 235 | - else { |
|
| 231 | + } else { |
|
| 236 | 232 | $this->assignCSRFToken(); |
| 237 | 233 | $this->setTemplate('usermanagement/roleedit.tpl'); |
| 238 | 234 | $this->assign('user', $user); |
@@ -293,8 +289,7 @@ discard block |
||
| 293 | 289 | $this->redirect('userManagement'); |
| 294 | 290 | |
| 295 | 291 | return; |
| 296 | - } |
|
| 297 | - else { |
|
| 292 | + } else { |
|
| 298 | 293 | $this->assignCSRFToken(); |
| 299 | 294 | $this->setTemplate('usermanagement/changelevel-reason.tpl'); |
| 300 | 295 | $this->assign('user', $user); |
@@ -352,8 +347,7 @@ discard block |
||
| 352 | 347 | $this->redirect("userManagement"); |
| 353 | 348 | |
| 354 | 349 | return; |
| 355 | - } |
|
| 356 | - else { |
|
| 350 | + } else { |
|
| 357 | 351 | $this->assignCSRFToken(); |
| 358 | 352 | $this->setTemplate("usermanagement/changelevel-reason.tpl"); |
| 359 | 353 | $this->assign("user", $user); |
@@ -436,8 +430,7 @@ discard block |
||
| 436 | 430 | $this->redirect("userManagement"); |
| 437 | 431 | |
| 438 | 432 | return; |
| 439 | - } |
|
| 440 | - else { |
|
| 433 | + } else { |
|
| 441 | 434 | $this->assignCSRFToken(); |
| 442 | 435 | $this->setTemplate('usermanagement/renameuser.tpl'); |
| 443 | 436 | $this->assign('user', $user); |
@@ -505,8 +498,7 @@ discard block |
||
| 505 | 498 | $this->redirect("userManagement"); |
| 506 | 499 | |
| 507 | 500 | return; |
| 508 | - } |
|
| 509 | - else { |
|
| 501 | + } else { |
|
| 510 | 502 | $this->assignCSRFToken(); |
| 511 | 503 | $oauth = new OAuthUserHelper($user, $database, $this->getOAuthProtocolHelper(), |
| 512 | 504 | $this->getSiteConfiguration()); |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | try { |
| 46 | 46 | $this->getDomainAccessManager()->switchDomain($currentUser, $newDomain); |
| 47 | 47 | } |
| 48 | - catch(DomainSwitchNotAllowedException $ex){ |
|
| 48 | + catch(DomainSwitchNotAllowedException $ex) { |
|
| 49 | 49 | throw new AccessDeniedException($this->getSecurityManager(), $this->getDomainAccessManager()); |
| 50 | 50 | } |
| 51 | 51 | |