@@ -30,13 +30,13 @@ |
||
| 30 | 30 | public function authenticate(User $user, $data) |
| 31 | 31 | { |
| 32 | 32 | $storedData = $this->getCredentialData($user->getId()); |
| 33 | - if($storedData === null) |
|
| 33 | + if ($storedData === null) |
|
| 34 | 34 | { |
| 35 | 35 | // No available credential matching these parameters |
| 36 | 36 | return false; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if($storedData->getVersion() !== 2) { |
|
| 39 | + if ($storedData->getVersion() !== 2) { |
|
| 40 | 40 | // Non-2 versions are not supported. |
| 41 | 41 | return false; |
| 42 | 42 | } |
@@ -30,8 +30,7 @@ |
||
| 30 | 30 | public function authenticate(User $user, $data) |
| 31 | 31 | { |
| 32 | 32 | $storedData = $this->getCredentialData($user->getId()); |
| 33 | - if($storedData === null) |
|
| 34 | - { |
|
| 33 | + if($storedData === null) { |
|
| 35 | 34 | // No available credential matching these parameters |
| 36 | 35 | return false; |
| 37 | 36 | } |
@@ -263,7 +263,7 @@ |
||
| 263 | 263 | "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database, |
| 264 | 264 | "username" => $toolserver_username, |
| 265 | 265 | "password" => $toolserver_password, |
| 266 | - "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
|
| 266 | + "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
|
| 267 | 267 | ), |
| 268 | 268 | "wikipedia" => array( |
| 269 | 269 | "dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db, |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $curlDisableSSLVerifyPeer = false; |
| 242 | 242 | |
| 243 | 243 | // Change this to be outside the web directory. |
| 244 | -$curlCookieJar = __DIR__ . '/../cookies.txt'; |
|
| 244 | +$curlCookieJar = __DIR__.'/../cookies.txt'; |
|
| 245 | 245 | |
| 246 | 246 | $yubicoApiId = 0; |
| 247 | 247 | $yubicoApiKey = ""; |
@@ -260,19 +260,19 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $cDatabaseConfig = array( |
| 262 | 262 | "acc" => array( |
| 263 | - "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database, |
|
| 263 | + "dsrcname" => "mysql:host=".$toolserver_host.";dbname=".$toolserver_database, |
|
| 264 | 264 | "username" => $toolserver_username, |
| 265 | 265 | "password" => $toolserver_password, |
| 266 | 266 | "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
| 267 | 267 | ), |
| 268 | 268 | "wikipedia" => array( |
| 269 | - "dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db, |
|
| 269 | + "dsrcname" => "mysql:host=".$antispoof_host.";dbname=".$antispoof_db, |
|
| 270 | 270 | "username" => $toolserver_username, |
| 271 | 271 | "password" => $toolserver_password, |
| 272 | 272 | "options" => array(), |
| 273 | 273 | ), |
| 274 | 274 | "notifications" => array( |
| 275 | - "dsrcname" => "mysql:host=" . $toolserver_notification_dbhost . ";dbname=" . $toolserver_notification_database, |
|
| 275 | + "dsrcname" => "mysql:host=".$toolserver_notification_dbhost.";dbname=".$toolserver_notification_database, |
|
| 276 | 276 | "username" => $notifications_username, |
| 277 | 277 | "password" => $notifications_password, |
| 278 | 278 | "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
@@ -303,13 +303,13 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // Set up the AutoLoader |
| 306 | -require_once(__DIR__ . "/includes/AutoLoader.php"); |
|
| 306 | +require_once(__DIR__."/includes/AutoLoader.php"); |
|
| 307 | 307 | spl_autoload_register('Waca\\AutoLoader::load'); |
| 308 | -require_once(__DIR__ . '/vendor/autoload.php'); |
|
| 308 | +require_once(__DIR__.'/vendor/autoload.php'); |
|
| 309 | 309 | |
| 310 | 310 | // Extra includes which are just plain awkward wherever they are. |
| 311 | -require_once(__DIR__ . '/lib/mediawiki-extensions-OAuth/lib/OAuth.php'); |
|
| 312 | -require_once(__DIR__ . '/lib/mediawiki-extensions-OAuth/lib/JWT.php'); |
|
| 311 | +require_once(__DIR__.'/lib/mediawiki-extensions-OAuth/lib/OAuth.php'); |
|
| 312 | +require_once(__DIR__.'/lib/mediawiki-extensions-OAuth/lib/JWT.php'); |
|
| 313 | 313 | |
| 314 | 314 | // Crap that's needed for libraries. >:( |
| 315 | 315 | /** |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $useOAuthSignup = $this->getSiteConfiguration()->getUseOAuthSignup(); |
| 34 | 34 | if (! $this->getSiteConfiguration()->isRegistrationAllowed()) { |
| 35 | - throw new AccessDeniedException(); |
|
| 35 | + throw new AccessDeniedException(); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Dual-mode page |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** @var Request[] $results */ |
| 107 | 107 | $results = $search->getRecordCount($requestCount)->fetch(); |
| 108 | 108 | |
| 109 | - if($requestCount > 0) { |
|
| 109 | + if ($requestCount > 0) { |
|
| 110 | 110 | $requestSectionData['Hospital - Requests failed auto-creation'] = array( |
| 111 | 111 | 'requests' => $this->prepareRequestData($results), |
| 112 | 112 | 'total' => $requestCount, |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | /** @var Request[] $results */ |
| 141 | 141 | $results = $search->getRecordCount($requestCount)->fetch(); |
| 142 | 142 | |
| 143 | - if($requestCount > 0) { |
|
| 143 | + if ($requestCount > 0) { |
|
| 144 | 144 | $requestSectionData['Requests queued in the Job Queue'] = array( |
| 145 | 145 | 'requests' => $this->prepareRequestData($results), |
| 146 | 146 | 'total' => $requestCount, |
@@ -241,19 +241,19 @@ |
||
| 241 | 241 | */ |
| 242 | 242 | public function setForwardedIp($forwardedip) |
| 243 | 243 | { |
| 244 | - // Verify that the XFF chain only contains valid IP addresses, and silently discard anything that isn't. |
|
| 244 | + // Verify that the XFF chain only contains valid IP addresses, and silently discard anything that isn't. |
|
| 245 | 245 | |
| 246 | - $xff = explode(',', $forwardedip); |
|
| 247 | - $valid = array(); |
|
| 246 | + $xff = explode(',', $forwardedip); |
|
| 247 | + $valid = array(); |
|
| 248 | 248 | |
| 249 | - foreach ($xff as $ip) { |
|
| 250 | - $ip = trim($ip); |
|
| 251 | - if (filter_var($ip, FILTER_VALIDATE_IP)) { |
|
| 252 | - $valid[] = $ip; |
|
| 253 | - } |
|
| 254 | - } |
|
| 249 | + foreach ($xff as $ip) { |
|
| 250 | + $ip = trim($ip); |
|
| 251 | + if (filter_var($ip, FILTER_VALIDATE_IP)) { |
|
| 252 | + $valid[] = $ip; |
|
| 253 | + } |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - $this->forwardedip = implode(", ", $valid); |
|
| 256 | + $this->forwardedip = implode(", ", $valid); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $onWikiName = $strings->upperCaseFirst($onWikiName); |
| 184 | 184 | |
| 185 | 185 | $parameters = self::$apiQueryParameters; |
| 186 | - $parameters['pltitles'] = "User:" . $onWikiName; |
|
| 186 | + $parameters['pltitles'] = "User:".$onWikiName; |
|
| 187 | 187 | $parameters['titles'] = $this->siteConfiguration->getIdentificationNoticeboardPage(); |
| 188 | 188 | |
| 189 | 189 | try { |
@@ -200,6 +200,6 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | $page = @array_pop($response['query']['pages']); |
| 202 | 202 | |
| 203 | - return @$page['links'][0]['title'] === "User:" . $onWikiName; |
|
| 203 | + return @$page['links'][0]['title'] === "User:".$onWikiName; |
|
| 204 | 204 | } |
| 205 | 205 | } |
@@ -190,7 +190,8 @@ |
||
| 190 | 190 | $endpoint = $this->siteConfiguration->getMetaWikimediaWebServiceEndpoint(); |
| 191 | 191 | $response = $this->httpHelper->get($endpoint, $parameters); |
| 192 | 192 | $response = json_decode($response, true); |
| 193 | - } catch (CurlException $ex) { |
|
| 193 | + } |
|
| 194 | + catch (CurlException $ex) { |
|
| 194 | 195 | // failed getting identification status, so throw a nicer error. |
| 195 | 196 | $message = 'Could not contact metawiki API to determine user\' identification status. ' |
| 196 | 197 | . 'This is probably a transient error, so please try again.'; |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $currentUser = User::getCurrent($database); |
| 49 | 49 | $this->assign('currentUser', $currentUser); |
| 50 | 50 | |
| 51 | - if($this->securityManager !== null) { |
|
| 51 | + if ($this->securityManager !== null) { |
|
| 52 | 52 | $this->setupNavMenuAccess($currentUser); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -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(); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | throw new ApplicationLogicException('Cannot apply distinct to column fetch already using group by'); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $this->groupByClause = ' GROUP BY origin.' . $column; |
|
| 150 | + $this->groupByClause = ' GROUP BY origin.'.$column; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $statement = $this->getData(array($column)); |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function getRecordCount(&$count) |
| 178 | 178 | { |
| 179 | - $query = 'SELECT /* SearchHelper */ COUNT(*) FROM ' . $this->table . ' origin '; |
|
| 180 | - $query .= $this->joinClause . $this->whereClause; |
|
| 179 | + $query = 'SELECT /* SearchHelper */ COUNT(*) FROM '.$this->table.' origin '; |
|
| 180 | + $query .= $this->joinClause.$this->whereClause; |
|
| 181 | 181 | |
| 182 | 182 | $statement = $this->database->prepare($query); |
| 183 | 183 | $statement->execute($this->parameterList); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | private function applyOrder() |
| 225 | 225 | { |
| 226 | 226 | if ($this->orderBy !== null) { |
| 227 | - return ' ORDER BY ' . $this->orderBy; |
|
| 227 | + return ' ORDER BY '.$this->orderBy; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | return ''; |
@@ -257,11 +257,11 @@ discard block |
||
| 257 | 257 | { |
| 258 | 258 | $colData = array(); |
| 259 | 259 | foreach ($columns as $c) { |
| 260 | - $colData[] = 'origin.' . $c; |
|
| 260 | + $colData[] = 'origin.'.$c; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $query = "SELECT {$this->modifiersClause} /* SearchHelper */ " . implode(', ', $colData) . ' FROM ' . $this->table . ' origin '; |
|
| 264 | - $query .= $this->joinClause . $this->whereClause . $this->groupByClause; |
|
| 263 | + $query = "SELECT {$this->modifiersClause} /* SearchHelper */ ".implode(', ', $colData).' FROM '.$this->table.' origin '; |
|
| 264 | + $query .= $this->joinClause.$this->whereClause.$this->groupByClause; |
|
| 265 | 265 | |
| 266 | 266 | return $query; |
| 267 | 267 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | // You can't use IN() with parameters directly, so let's munge something together. |
| 283 | 283 | // Let's create a string of question marks, which will do as positional parameters. |
| 284 | 284 | $valueCount = count($values); |
| 285 | - $inSection = str_repeat('?,', $valueCount - 1) . '?'; |
|
| 285 | + $inSection = str_repeat('?,', $valueCount - 1).'?'; |
|
| 286 | 286 | |
| 287 | 287 | $this->whereClause .= " AND {$column} IN ({$inSection})"; |
| 288 | 288 | $this->parameterList = array_merge($this->parameterList, $values); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | { |
| 348 | 348 | $userIds = array(); |
| 349 | 349 | |
| 350 | - foreach ($logs as $logEntry) { |
|
| 350 | + foreach ($logs as $logEntry) { |
|
| 351 | 351 | if (!$logEntry instanceof Log) { |
| 352 | 352 | // if this happens, we've done something wrong with passing back the log data. |
| 353 | 353 | throw new Exception('Log entry is not an instance of a Log, this should never happen.'); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | $logData = array(); |
| 370 | 370 | |
| 371 | - foreach ($logs as $logEntry) { |
|
| 371 | + foreach ($logs as $logEntry) { |
|
| 372 | 372 | $objectDescription = self::getObjectDescription($logEntry->getObjectId(), $logEntry->getObjectType(), |
| 373 | 373 | $database, $configuration); |
| 374 | 374 | |