@@ -70,12 +70,10 @@ discard block |
||
| 70 | 70 | $userinfoResult = $this->callApi(array('action' => 'query', 'meta' => 'userinfo'), 'GET'); |
| 71 | 71 | if (isset($userinfoResult->query->userinfo->anon)) { |
| 72 | 72 | throw new MediaWikiApiException('Unable to log in.'); |
| 73 | - } |
|
| 74 | - else { |
|
| 73 | + } else { |
|
| 75 | 74 | $this->knownLoggedIn = true; |
| 76 | 75 | } |
| 77 | - } |
|
| 78 | - else { |
|
| 76 | + } else { |
|
| 79 | 77 | $this->knownLoggedIn = true; |
| 80 | 78 | } |
| 81 | 79 | } |
@@ -94,11 +92,9 @@ discard block |
||
| 94 | 92 | |
| 95 | 93 | if ($method == 'GET') { |
| 96 | 94 | $data = $this->httpHelper->get($this->mediawikiWebServiceEndpoint, $apiParams); |
| 97 | - } |
|
| 98 | - elseif ($method == 'POST') { |
|
| 95 | + } elseif ($method == 'POST') { |
|
| 99 | 96 | $data = $this->httpHelper->post($this->mediawikiWebServiceEndpoint, $apiParams); |
| 100 | - } |
|
| 101 | - else { |
|
| 97 | + } else { |
|
| 102 | 98 | throw new ApplicationLogicException('Unsupported HTTP Method'); |
| 103 | 99 | } |
| 104 | 100 | |
@@ -141,7 +137,7 @@ discard block |
||
| 141 | 137 | |
| 142 | 138 | $loginResponse = $this->callApi($params, 'POST'); |
| 143 | 139 | |
| 144 | - if($loginResponse->login->result == 'Success'){ |
|
| 140 | + if($loginResponse->login->result == 'Success') { |
|
| 145 | 141 | return; |
| 146 | 142 | } |
| 147 | 143 | |
@@ -228,8 +228,7 @@ discard block |
||
| 228 | 228 | foreach ($req->fields as $name => $data) { |
| 229 | 229 | if ($data->type === 'checkbox') { |
| 230 | 230 | $checkboxFields[] = $name; |
| 231 | - } |
|
| 232 | - else { |
|
| 231 | + } else { |
|
| 233 | 232 | $requiredFields[] = $name; |
| 234 | 233 | } |
| 235 | 234 | } |
@@ -241,7 +240,8 @@ discard block |
||
| 241 | 240 | * @param string $username |
| 242 | 241 | * @return bool |
| 243 | 242 | */ |
| 244 | - public function checkAccountExists($username) { |
|
| 243 | + public function checkAccountExists($username) |
|
| 244 | + { |
|
| 245 | 245 | $parameters = array( |
| 246 | 246 | 'action' => 'query', |
| 247 | 247 | 'list' => 'users', |
@@ -195,14 +195,16 @@ |
||
| 195 | 195 | return $this->partiallyLinked; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - public function canCreateAccount() { |
|
| 198 | + public function canCreateAccount() |
|
| 199 | + { |
|
| 199 | 200 | return $this->isFullyLinked() |
| 200 | 201 | && $this->getIdentity(true)->getGrantBasic() |
| 201 | 202 | && $this->getIdentity(true)->getGrantHighVolume() |
| 202 | 203 | && $this->getIdentity(true)->getGrantCreateAccount(); |
| 203 | 204 | } |
| 204 | 205 | |
| 205 | - public function canWelcome() { |
|
| 206 | + public function canWelcome() |
|
| 207 | + { |
|
| 206 | 208 | return $this->isFullyLinked() |
| 207 | 209 | && $this->getIdentity(true)->getGrantBasic() |
| 208 | 210 | && $this->getIdentity(true)->getGrantHighVolume() |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | if ($notificationsDatabase !== null) { |
| 61 | 61 | $this->notificationsDatabase = $notificationsDatabase; |
| 62 | 62 | $this->notificationsEnabled = $siteConfiguration->getIrcNotificationsEnabled(); |
| 63 | - } |
|
| 64 | - else { |
|
| 63 | + } else { |
|
| 65 | 64 | $this->notificationsEnabled = false; |
| 66 | 65 | } |
| 67 | 66 | |
@@ -239,8 +238,7 @@ discard block |
||
| 239 | 238 | { |
| 240 | 239 | if ($ban->getDuration() === null) { |
| 241 | 240 | $duration = "indefinitely"; |
| 242 | - } |
|
| 243 | - else { |
|
| 241 | + } else { |
|
| 244 | 242 | $duration = "until " . date("F j, Y, g:i a", $ban->getDuration()); |
| 245 | 243 | } |
| 246 | 244 | |
@@ -23,7 +23,8 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return JobQueueSearchHelper |
| 25 | 25 | */ |
| 26 | - public static function get(PdoDatabase $database) { |
|
| 26 | + public static function get(PdoDatabase $database) |
|
| 27 | + { |
|
| 27 | 28 | $helper = new JobQueueSearchHelper($database); |
| 28 | 29 | return $helper; |
| 29 | 30 | } |
@@ -33,7 +34,8 @@ discard block |
||
| 33 | 34 | * |
| 34 | 35 | * @return $this |
| 35 | 36 | */ |
| 36 | - public function statusIn($statuses) { |
|
| 37 | + public function statusIn($statuses) |
|
| 38 | + { |
|
| 37 | 39 | $this->inClause('status', $statuses); |
| 38 | 40 | |
| 39 | 41 | return $this; |
@@ -42,27 +44,31 @@ discard block |
||
| 42 | 44 | /** |
| 43 | 45 | * @return $this |
| 44 | 46 | */ |
| 45 | - public function notAcknowledged() { |
|
| 47 | + public function notAcknowledged() |
|
| 48 | + { |
|
| 46 | 49 | $this->whereClause .= ' AND (acknowledged IS NULL OR acknowledged = 0)'; |
| 47 | 50 | |
| 48 | 51 | return $this; |
| 49 | 52 | } |
| 50 | 53 | |
| 51 | - public function byTask($task) { |
|
| 54 | + public function byTask($task) |
|
| 55 | + { |
|
| 52 | 56 | $this->whereClause .= ' AND task = ?'; |
| 53 | 57 | $this->parameterList[] = $task; |
| 54 | 58 | |
| 55 | 59 | return $this; |
| 56 | 60 | } |
| 57 | 61 | |
| 58 | - public function byUser($userId) { |
|
| 62 | + public function byUser($userId) |
|
| 63 | + { |
|
| 59 | 64 | $this->whereClause .= ' AND user = ?'; |
| 60 | 65 | $this->parameterList[] = $userId; |
| 61 | 66 | |
| 62 | 67 | return $this; |
| 63 | 68 | } |
| 64 | 69 | |
| 65 | - public function byStatus($status) { |
|
| 70 | + public function byStatus($status) |
|
| 71 | + { |
|
| 66 | 72 | $this->whereClause .= ' AND status = ?'; |
| 67 | 73 | $this->parameterList[] = $status; |
| 68 | 74 | |
@@ -53,7 +53,8 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return int |
| 55 | 55 | */ |
| 56 | - $sortKey = function(DataObject $item) { |
|
| 56 | + $sortKey = function(DataObject $item) |
|
| 57 | + { |
|
| 57 | 58 | if ($item instanceof Log) { |
| 58 | 59 | return $item->getTimestamp()->getTimestamp(); |
| 59 | 60 | } |
@@ -310,8 +311,7 @@ discard block |
||
| 310 | 311 | // some old templates have been completely deleted and lost to the depths of time. |
| 311 | 312 | if ($welcomeTemplate === false) { |
| 312 | 313 | return "Welcome template #{$objectId}"; |
| 313 | - } |
|
| 314 | - else { |
|
| 314 | + } else { |
|
| 315 | 315 | $userCode = htmlentities($welcomeTemplate->getUserCode(), ENT_COMPAT, 'UTF-8'); |
| 316 | 316 | |
| 317 | 317 | return "<a href=\"{$baseurl}/internal.php/welcomeTemplates/view?template={$objectId}\">{$userCode}</a>"; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $taskDescriptions = JobQueue::getTaskDescriptions(); |
| 324 | 324 | |
| 325 | 325 | $task = $job->getTask(); |
| 326 | - if(isset($taskDescriptions[$task])){ |
|
| 326 | + if(isset($taskDescriptions[$task])) { |
|
| 327 | 327 | $description = $taskDescriptions[$task]; |
| 328 | 328 | } else { |
| 329 | 329 | $description = 'Unknown task'; |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | if ($securityResult === SecurityManager::ALLOWED) { |
| 86 | 86 | // We're allowed to run the page, so let's run it. |
| 87 | 87 | $this->runPage(); |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | $this->handleAccessDenied($securityResult); |
| 91 | 90 | |
| 92 | 91 | // Send the headers |
@@ -110,8 +109,7 @@ discard block |
||
| 110 | 109 | |
| 111 | 110 | if (WebRequest::testSiteNoticeCookieValue($siteNoticeHash)) { |
| 112 | 111 | $this->assign('siteNoticeState', 'd-none'); |
| 113 | - } |
|
| 114 | - else { |
|
| 112 | + } else { |
|
| 115 | 113 | $this->assign('siteNoticeState', 'd-block'); |
| 116 | 114 | } |
| 117 | 115 | |
@@ -157,19 +155,16 @@ discard block |
||
| 157 | 155 | $this->redirect("login"); |
| 158 | 156 | |
| 159 | 157 | return; |
| 160 | - } |
|
| 161 | - else { |
|
| 158 | + } else { |
|
| 162 | 159 | // Decide whether this was a rights failure, or an identification failure. |
| 163 | 160 | |
| 164 | 161 | if ($denyReason === SecurityManager::ERROR_NOT_IDENTIFIED) { |
| 165 | 162 | // Not identified |
| 166 | 163 | throw new NotIdentifiedException($this->getSecurityManager()); |
| 167 | - } |
|
| 168 | - elseif ($denyReason === SecurityManager::ERROR_DENIED) { |
|
| 164 | + } elseif ($denyReason === SecurityManager::ERROR_DENIED) { |
|
| 169 | 165 | // Nope, plain old access denied |
| 170 | 166 | throw new AccessDeniedException($this->getSecurityManager()); |
| 171 | - } |
|
| 172 | - else { |
|
| 167 | + } else { |
|
| 173 | 168 | throw new Exception('Unknown response from security manager.'); |
| 174 | 169 | } |
| 175 | 170 | } |
@@ -259,8 +259,7 @@ discard block |
||
| 259 | 259 | // Are we changing script? |
| 260 | 260 | if ($script === null || substr($currentScriptName, -1 * count($script)) === $script) { |
| 261 | 261 | $targetScriptName = $currentScriptName; |
| 262 | - } |
|
| 263 | - else { |
|
| 262 | + } else { |
|
| 264 | 263 | $targetScriptName = $this->getSiteConfiguration()->getBaseUrl() . '/' . $script; |
| 265 | 264 | } |
| 266 | 265 | |
@@ -319,8 +318,9 @@ discard block |
||
| 319 | 318 | * |
| 320 | 319 | * @param string $path The path (relative to the application root) of the file |
| 321 | 320 | */ |
| 322 | - final protected function addJs($path){ |
|
| 323 | - if(in_array($path, $this->extraJs)){ |
|
| 321 | + final protected function addJs($path) |
|
| 322 | + { |
|
| 323 | + if(in_array($path, $this->extraJs)) { |
|
| 324 | 324 | // nothing to do |
| 325 | 325 | return; |
| 326 | 326 | } |
@@ -55,8 +55,7 @@ discard block |
||
| 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 | } |
@@ -102,7 +101,7 @@ discard block |
||
| 102 | 101 | $formParameters['limit'] = $this->limit; |
| 103 | 102 | $this->assign('searchParamsUrl', http_build_query($formParameters, '', '&')); |
| 104 | 103 | |
| 105 | - foreach ($formParameters as $key => $value) { |
|
| 104 | + foreach ($formParameters as $key => $value) { |
|
| 106 | 105 | $this->assign($key, $value); |
| 107 | 106 | } |
| 108 | 107 | } |