@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | public function authenticate(User $user, $data) |
| 25 | 25 | { |
| 26 | 26 | $storedData = $this->getCredentialData($user->getId()); |
| 27 | - if($storedData === null) |
|
| 27 | + if ($storedData === null) |
|
| 28 | 28 | { |
| 29 | 29 | // No available credential matching these parameters |
| 30 | 30 | return false; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if($storedData->getVersion() !== 2) { |
|
| 33 | + if ($storedData->getVersion() !== 2) { |
|
| 34 | 34 | // Non-2 versions are not supported. |
| 35 | 35 | return false; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if(password_verify($data, $storedData->getData())) { |
|
| 39 | - if(password_needs_rehash($storedData->getData(), PASSWORD_BCRYPT, array('cost' => self::PASSWORD_COST))){ |
|
| 38 | + if (password_verify($data, $storedData->getData())) { |
|
| 39 | + if (password_needs_rehash($storedData->getData(), PASSWORD_BCRYPT, array('cost' => self::PASSWORD_COST))) { |
|
| 40 | 40 | $this->setCredential($user, $storedData->getFactor(), $data); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $storedData = $this->getCredentialData($user->getId()); |
| 52 | 52 | |
| 53 | - if($storedData === null){ |
|
| 53 | + if ($storedData === null) { |
|
| 54 | 54 | $storedData = $this->createNewCredential($user); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | if ($data === false) { |
| 107 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
| 107 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $result = json_decode($data); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $response = $this->callApi($tokenParams, 'POST'); |
| 125 | 125 | |
| 126 | 126 | if (isset($response->error)) { |
| 127 | - throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info); |
|
| 127 | + throw new MediaWikiApiException($response->error->code.': '.$response->error->info); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $token = $response->query->tokens->logintoken; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $loginResponse = $this->callApi($params, 'POST'); |
| 144 | 144 | |
| 145 | - if($loginResponse->login->result == 'Success'){ |
|
| 145 | + if ($loginResponse->login->result == 'Success') { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | curl_setopt($this->curlHandle, CURLOPT_SSL_VERIFYPEER, false); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if($cookieJar !== null) { |
|
| 36 | + if ($cookieJar !== null) { |
|
| 37 | 37 | curl_setopt($this->curlHandle, CURLOPT_COOKIEFILE, $cookieJar); |
| 38 | 38 | curl_setopt($this->curlHandle, CURLOPT_COOKIEJAR, $cookieJar); |
| 39 | 39 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function get($url, $parameters = null, $headers = array()) |
| 60 | 60 | { |
| 61 | 61 | if ($parameters !== null && is_array($parameters)) { |
| 62 | - $getString = '?' . http_build_query($parameters); |
|
| 62 | + $getString = '?'.http_build_query($parameters); |
|
| 63 | 63 | $url .= $getString; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if ($result === false) { |
| 76 | 76 | $error = curl_error($this->curlHandle); |
| 77 | - throw new CurlException('Remote request failed with error ' . $error); |
|
| 77 | + throw new CurlException('Remote request failed with error '.$error); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $result; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | if ($result === false) { |
| 106 | 106 | $error = curl_error($this->curlHandle); |
| 107 | - throw new CurlException('Remote request failed with error ' . $error); |
|
| 107 | + throw new CurlException('Remote request failed with error '.$error); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return $result; |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $this->whereClause .= $whereClauseSection; |
| 86 | 86 | |
| 87 | - $countQuery = 'SELECT /* SearchHelper */ COUNT(*) FROM ' . $this->table . ' origin '; |
|
| 88 | - $countQuery .= $this->joinClause . $this->whereClause; |
|
| 87 | + $countQuery = 'SELECT /* SearchHelper */ COUNT(*) FROM '.$this->table.' origin '; |
|
| 88 | + $countQuery .= $this->joinClause.$this->whereClause; |
|
| 89 | 89 | |
| 90 | 90 | $query = $this->buildQuery(array('*')); |
| 91 | 91 | $query .= $this->applyOrder(); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | throw new ApplicationLogicException('Cannot apply distinct to column fetch already using group by'); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $this->groupByClause = ' GROUP BY origin.' . $column; |
|
| 149 | + $this->groupByClause = ' GROUP BY origin.'.$column; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $statement = $this->getData(array($column)); |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function getRecordCount(&$count) |
| 177 | 177 | { |
| 178 | - $query = 'SELECT /* SearchHelper */ COUNT(*) FROM ' . $this->table . ' origin '; |
|
| 179 | - $query .= $this->joinClause . $this->whereClause; |
|
| 178 | + $query = 'SELECT /* SearchHelper */ COUNT(*) FROM '.$this->table.' origin '; |
|
| 179 | + $query .= $this->joinClause.$this->whereClause; |
|
| 180 | 180 | |
| 181 | 181 | $statement = $this->database->prepare($query); |
| 182 | 182 | $statement->execute($this->parameterList); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | private function applyOrder() |
| 224 | 224 | { |
| 225 | 225 | if ($this->orderBy !== null) { |
| 226 | - return ' ORDER BY ' . $this->orderBy; |
|
| 226 | + return ' ORDER BY '.$this->orderBy; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | return ''; |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | { |
| 256 | 256 | $colData = array(); |
| 257 | 257 | foreach ($columns as $c) { |
| 258 | - $colData[] = 'origin.' . $c; |
|
| 258 | + $colData[] = 'origin.'.$c; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - $query = "SELECT {$this->modifiersClause} /* SearchHelper */ " . implode(', ', $colData) . ' FROM ' . $this->table . ' origin '; |
|
| 262 | - $query .= $this->joinClause . $this->whereClause . $this->groupByClause; |
|
| 261 | + $query = "SELECT {$this->modifiersClause} /* SearchHelper */ ".implode(', ', $colData).' FROM '.$this->table.' origin '; |
|
| 262 | + $query .= $this->joinClause.$this->whereClause.$this->groupByClause; |
|
| 263 | 263 | |
| 264 | 264 | return $query; |
| 265 | 265 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $valueCount = count($values); |
| 282 | 282 | |
| 283 | 283 | // Firstly, let's create a string of question marks, which will do as positional parameters. |
| 284 | - $inSection = str_repeat('?,', $valueCount - 1) . '?'; |
|
| 284 | + $inSection = str_repeat('?,', $valueCount - 1).'?'; |
|
| 285 | 285 | |
| 286 | 286 | $this->whereClause .= " AND {$column} IN ({$inSection})"; |
| 287 | 287 | $this->parameterList = array_merge($this->parameterList, $values); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $this->whereClause .= ' AND (ip LIKE ? OR forwardedip LIKE ?)'; |
| 52 | 52 | $this->parameterList[] = $ipAddress; |
| 53 | - $this->parameterList[] = '%' . trim($ipAddress, '%') . '%'; |
|
| 53 | + $this->parameterList[] = '%'.trim($ipAddress, '%').'%'; |
|
| 54 | 54 | |
| 55 | 55 | return $this; |
| 56 | 56 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | public function isHospitalised() |
| 168 | 168 | { |
| 169 | 169 | $this->whereClause .= ' AND status = ?'; |
| 170 | - $this->parameterList[] = RequestStatus::HOSPITAL; |
|
| 170 | + $this->parameterList[] = RequestStatus::HOSPITAL; |
|
| 171 | 171 | |
| 172 | 172 | return $this; |
| 173 | 173 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | public function notHospitalised() |
| 181 | 181 | { |
| 182 | 182 | $this->whereClause .= ' AND status <> ?'; |
| 183 | - $this->parameterList[] = RequestStatus::HOSPITAL; |
|
| 183 | + $this->parameterList[] = RequestStatus::HOSPITAL; |
|
| 184 | 184 | |
| 185 | 185 | return $this; |
| 186 | 186 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $template = EmailTemplate::getById((int)$id, $entry->getDatabase()); |
| 130 | 130 | |
| 131 | 131 | if ($template != false) { |
| 132 | - return "closed (" . $template->getName() . ")"; |
|
| 132 | + return "closed (".$template->getName().")"; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -275,10 +275,10 @@ discard block |
||
| 275 | 275 | $ban = Ban::getById($objectId, $database); |
| 276 | 276 | |
| 277 | 277 | if ($ban === false) { |
| 278 | - return 'Ban #' . $objectId . "</a>"; |
|
| 278 | + return 'Ban #'.$objectId."</a>"; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - return 'Ban #' . $objectId . " (" . htmlentities($ban->getTarget()) . ")</a>"; |
|
| 281 | + return 'Ban #'.$objectId." (".htmlentities($ban->getTarget()).")</a>"; |
|
| 282 | 282 | case 'EmailTemplate': |
| 283 | 283 | /** @var EmailTemplate $emailTemplate */ |
| 284 | 284 | $emailTemplate = EmailTemplate::getById($objectId, $database); |
@@ -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'; |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | return "<a href=\"{$baseurl}/internal.php/jobQueue/view?id={$objectId}\">Job #{$job->getId()} ({$description})</a>"; |
| 333 | 333 | default: |
| 334 | - return '[' . $objectType . " " . $objectId . ']'; |
|
| 334 | + return '['.$objectType." ".$objectId.']'; |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $renameData = unserialize($logEntry->getComment()); |
| 380 | 380 | $oldName = htmlentities($renameData['old'], ENT_COMPAT, 'UTF-8'); |
| 381 | 381 | $newName = htmlentities($renameData['new'], ENT_COMPAT, 'UTF-8'); |
| 382 | - $comment = 'Renamed \'' . $oldName . '\' to \'' . $newName . '\'.'; |
|
| 382 | + $comment = 'Renamed \''.$oldName.'\' to \''.$newName.'\'.'; |
|
| 383 | 383 | break; |
| 384 | 384 | case 'RoleChange': |
| 385 | 385 | $roleChangeData = unserialize($logEntry->getComment()); |
@@ -396,15 +396,15 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | $reason = htmlentities($roleChangeData['reason'], ENT_COMPAT, 'UTF-8'); |
| 398 | 398 | |
| 399 | - $roleDelta = 'Removed [' . implode(', ', $removed) . '], Added [' . implode(', ', $added) . ']'; |
|
| 400 | - $comment = $roleDelta . ' with comment: ' . $reason; |
|
| 399 | + $roleDelta = 'Removed ['.implode(', ', $removed).'], Added ['.implode(', ', $added).']'; |
|
| 400 | + $comment = $roleDelta.' with comment: '.$reason; |
|
| 401 | 401 | break; |
| 402 | 402 | case 'JobIssue': |
| 403 | 403 | $jobIssueData = unserialize($logEntry->getComment()); |
| 404 | 404 | $errorMessage = $jobIssueData['error']; |
| 405 | 405 | $status = $jobIssueData['status']; |
| 406 | 406 | |
| 407 | - $comment = 'Job ' . htmlentities($status, ENT_COMPAT, 'UTF-8') . ': '; |
|
| 407 | + $comment = 'Job '.htmlentities($status, ENT_COMPAT, 'UTF-8').': '; |
|
| 408 | 408 | $comment .= htmlentities($errorMessage, ENT_COMPAT, 'UTF-8'); |
| 409 | 409 | break; |
| 410 | 410 | case 'JobIssueRequest': |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function getRequestToken() |
| 79 | 79 | { |
| 80 | - $endpoint = $this->oauthEndpoint . '/initiate&format=json&oauth_callback=oob'; |
|
| 80 | + $endpoint = $this->oauthEndpoint.'/initiate&format=json&oauth_callback=oob'; |
|
| 81 | 81 | |
| 82 | 82 | $parsedUrl = parse_url($endpoint); |
| 83 | 83 | $urlParameters = array(); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $data = $this->httpHelper->get($targetUrl, null); |
| 93 | 93 | |
| 94 | 94 | if ($data === false) { |
| 95 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
| 95 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $token = json_decode($data); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if (isset($token->error)) { |
| 105 | - throw new OAuthException('Error encountered while getting request token: ' . $token->error); |
|
| 105 | + throw new OAuthException('Error encountered while getting request token: '.$token->error); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $token; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function callbackCompleted($oauthRequestToken, $oauthRequestSecret, $oauthVerifier) |
| 131 | 131 | { |
| 132 | - $endpoint = $this->oauthEndpoint . '/token&format=json'; |
|
| 132 | + $endpoint = $this->oauthEndpoint.'/token&format=json'; |
|
| 133 | 133 | |
| 134 | 134 | $requestConsumer = new OAuthConsumer($oauthRequestToken, $oauthRequestSecret); |
| 135 | 135 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $data = $this->httpHelper->get($targetUrl, null); |
| 148 | 148 | |
| 149 | 149 | if ($data === false) { |
| 150 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
| 150 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $token = json_decode($data); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if (isset($token->error)) { |
| 160 | - throw new OAuthException('Error encountered while getting access token: ' . $token->error); |
|
| 160 | + throw new OAuthException('Error encountered while getting access token: '.$token->error); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | return $token; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function getIdentityTicket($oauthAccessToken, $oauthAccessSecret) |
| 175 | 175 | { |
| 176 | - $endpoint = $this->oauthEndpoint . '/identify&format=json'; |
|
| 176 | + $endpoint = $this->oauthEndpoint.'/identify&format=json'; |
|
| 177 | 177 | |
| 178 | 178 | $oauthToken = new OAuthToken($oauthAccessToken, $oauthAccessSecret); |
| 179 | 179 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $data = $this->httpHelper->get($targetUrl, null); |
| 191 | 191 | |
| 192 | 192 | if ($data === false) { |
| 193 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
| 193 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | $decodedData = json_decode($data); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | if ($data === false) { |
| 249 | - throw new CurlException('Curl error: ' . $this->httpHelper->getError()); |
|
| 249 | + throw new CurlException('Curl error: '.$this->httpHelper->getError()); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | return json_decode($data); |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | |
| 27 | 27 | protected function getCreationReason(Request $request, User $user) |
| 28 | 28 | { |
| 29 | - return parent::getCreationReason($request, $user) . ', on behalf of [[User:' . $user->getOnWikiName() . ']]'; |
|
| 29 | + return parent::getCreationReason($request, $user).', on behalf of [[User:'.$user->getOnWikiName().']]'; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if (!$mediaWikiHelper->checkAccountExists($request->getName())){ |
|
| 64 | + if (!$mediaWikiHelper->checkAccountExists($request->getName())) { |
|
| 65 | 65 | $this->markFailed('Account does not exist!'); |
| 66 | 66 | |
| 67 | 67 | return; |