@@ -91,7 +91,7 @@ |
||
| 91 | 91 | */ |
| 92 | 92 | public function setCredential(User $user, $factor, $data) |
| 93 | 93 | { |
| 94 | - $issuer = 'ACC - ' . $this->getConfiguration()->getIrcNotificationsInstance(); |
|
| 94 | + $issuer = 'ACC - '.$this->getConfiguration()->getIrcNotificationsInstance(); |
|
| 95 | 95 | $totp = TOTP::create(); |
| 96 | 96 | $totp->setLabel($user->getUsername()); |
| 97 | 97 | $totp->setIssuer($issuer); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $blacklist = array("DCC", "CCTP", "PRIVMSG"); |
| 90 | 90 | $message = str_replace($blacklist, "(IRC Blacklist)", $message); // Lets stop DCC etc |
| 91 | 91 | |
| 92 | - $msg = IrcColourCode::RESET . IrcColourCode::BOLD . "[$instanceName]" . IrcColourCode::RESET . ": $message"; |
|
| 92 | + $msg = IrcColourCode::RESET.IrcColourCode::BOLD."[$instanceName]".IrcColourCode::RESET.": $message"; |
|
| 93 | 93 | |
| 94 | 94 | try { |
| 95 | 95 | $notification = new Notification(); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function userApproved(User $user) |
| 129 | 129 | { |
| 130 | - $this->send("{$user->getUsername()} approved by " . $this->currentUser->getUsername()); |
|
| 130 | + $this->send("{$user->getUsername()} approved by ".$this->currentUser->getUsername()); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function userDeclined(User $user, $reason) |
| 140 | 140 | { |
| 141 | - $this->send("{$user->getUsername()} declined by " . $this->currentUser->getUsername() . " ($reason)"); |
|
| 141 | + $this->send("{$user->getUsername()} declined by ".$this->currentUser->getUsername()." ($reason)"); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function userSuspended(User $user, $reason) |
| 151 | 151 | { |
| 152 | - $this->send("{$user->getUsername()} suspended by " . $this->currentUser->getUsername() . " ($reason)"); |
|
| 152 | + $this->send("{$user->getUsername()} suspended by ".$this->currentUser->getUsername()." ($reason)"); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function userPrefChange(User $user) |
| 161 | 161 | { |
| 162 | - $this->send("{$user->getUsername()}'s preferences were changed by " . $this->currentUser->getUsername()); |
|
| 162 | + $this->send("{$user->getUsername()}'s preferences were changed by ".$this->currentUser->getUsername()); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function userRenamed(User $user, $old) |
| 172 | 172 | { |
| 173 | - $this->send($this->currentUser->getUsername() . " renamed $old to {$user->getUsername()}"); |
|
| 173 | + $this->send($this->currentUser->getUsername()." renamed $old to {$user->getUsername()}"); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | public function userRolesEdited(User $user, $reason) |
| 181 | 181 | { |
| 182 | 182 | $currentUser = $this->currentUser->getUsername(); |
| 183 | - $this->send("Active roles for {$user->getUsername()} changed by " . $currentUser . " ($reason)"); |
|
| 183 | + $this->send("Active roles for {$user->getUsername()} changed by ".$currentUser." ($reason)"); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | #endregion |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function siteNoticeEdited() |
| 194 | 194 | { |
| 195 | - $this->send("Site notice edited by " . $this->currentUser->getUsername()); |
|
| 195 | + $this->send("Site notice edited by ".$this->currentUser->getUsername()); |
|
| 196 | 196 | } |
| 197 | 197 | #endregion |
| 198 | 198 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function welcomeTemplateCreated(WelcomeTemplate $template) |
| 206 | 206 | { |
| 207 | - $this->send("Welcome template {$template->getId()} created by " . $this->currentUser->getUsername()); |
|
| 207 | + $this->send("Welcome template {$template->getId()} created by ".$this->currentUser->getUsername()); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function welcomeTemplateDeleted($templateid) |
| 216 | 216 | { |
| 217 | - $this->send("Welcome template {$templateid} deleted by " . $this->currentUser->getUsername()); |
|
| 217 | + $this->send("Welcome template {$templateid} deleted by ".$this->currentUser->getUsername()); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public function welcomeTemplateEdited(WelcomeTemplate $template) |
| 226 | 226 | { |
| 227 | - $this->send("Welcome template {$template->getId()} edited by " . $this->currentUser->getUsername()); |
|
| 227 | + $this->send("Welcome template {$template->getId()} edited by ".$this->currentUser->getUsername()); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | #endregion |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $duration = "indefinitely"; |
| 242 | 242 | } |
| 243 | 243 | else { |
| 244 | - $duration = "until " . date("F j, Y, g:i a", $ban->getDuration()); |
|
| 244 | + $duration = "until ".date("F j, Y, g:i a", $ban->getDuration()); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | $username = $this->currentUser->getUsername(); |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function unbanned(Ban $ban, $unbanreason) |
| 259 | 259 | { |
| 260 | - $this->send($ban->getTarget() . " unbanned by " . $this->currentUser |
|
| 261 | - ->getUsername() . " (" . $unbanreason . ")"); |
|
| 260 | + $this->send($ban->getTarget()." unbanned by ".$this->currentUser |
|
| 261 | + ->getUsername()." (".$unbanreason.")"); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | #endregion |
@@ -273,15 +273,15 @@ discard block |
||
| 273 | 273 | public function requestReceived(Request $request) |
| 274 | 274 | { |
| 275 | 275 | $this->send( |
| 276 | - IrcColourCode::DARK_GREY . "[[" |
|
| 277 | - . IrcColourCode::DARK_GREEN . "acc:" |
|
| 278 | - . IrcColourCode::ORANGE . $request->getId() |
|
| 279 | - . IrcColourCode::DARK_GREY . "]]" |
|
| 280 | - . IrcColourCode::RED . " N " |
|
| 281 | - . IrcColourCode::DARK_BLUE . $this->baseUrl . "/internal.php/viewRequest?id={$request->getId()} " |
|
| 282 | - . IrcColourCode::DARK_RED . "* " |
|
| 283 | - . IrcColourCode::DARK_GREEN . $request->getName() |
|
| 284 | - . IrcColourCode::DARK_RED . " * " |
|
| 276 | + IrcColourCode::DARK_GREY."[[" |
|
| 277 | + . IrcColourCode::DARK_GREEN."acc:" |
|
| 278 | + . IrcColourCode::ORANGE.$request->getId() |
|
| 279 | + . IrcColourCode::DARK_GREY."]]" |
|
| 280 | + . IrcColourCode::RED." N " |
|
| 281 | + . IrcColourCode::DARK_BLUE.$this->baseUrl."/internal.php/viewRequest?id={$request->getId()} " |
|
| 282 | + . IrcColourCode::DARK_RED."* " |
|
| 283 | + . IrcColourCode::DARK_GREEN.$request->getName() |
|
| 284 | + . IrcColourCode::DARK_RED." * " |
|
| 285 | 285 | . IrcColourCode::RESET |
| 286 | 286 | ); |
| 287 | 287 | } |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | public function emailCreated(EmailTemplate $template) |
| 443 | 443 | { |
| 444 | 444 | $username = $this->currentUser->getUsername(); |
| 445 | - $this->send("Email {$template->getId()} ({$template->getName()}) created by " . $username); |
|
| 445 | + $this->send("Email {$template->getId()} ({$template->getName()}) created by ".$username); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /** |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | public function emailEdited(EmailTemplate $template) |
| 454 | 454 | { |
| 455 | 455 | $username = $this->currentUser->getUsername(); |
| 456 | - $this->send("Email {$template->getId()} ({$template->getName()}) edited by " . $username); |
|
| 456 | + $this->send("Email {$template->getId()} ({$template->getName()}) edited by ".$username); |
|
| 457 | 457 | } |
| 458 | 458 | #endregion |
| 459 | 459 | } |
@@ -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 | /** |
@@ -28,15 +28,15 @@ |
||
| 28 | 28 | return (bool)$dontUseDb; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Gets the offline message |
|
| 33 | - * |
|
| 34 | - * @param bool $external |
|
| 35 | - * @param null|string $message |
|
| 36 | - * |
|
| 37 | - * @return string |
|
| 38 | - * @throws SmartyException |
|
| 39 | - */ |
|
| 31 | + /** |
|
| 32 | + * Gets the offline message |
|
| 33 | + * |
|
| 34 | + * @param bool $external |
|
| 35 | + * @param null|string $message |
|
| 36 | + * |
|
| 37 | + * @return string |
|
| 38 | + * @throws SmartyException |
|
| 39 | + */ |
|
| 40 | 40 | public static function getOfflineMessage($external, $message = null) |
| 41 | 41 | { |
| 42 | 42 | global $dontUseDbCulprit, $dontUseDbReason, $baseurl; |
@@ -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.'; |