@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | protected function main() |
21 | 21 | { |
22 | - if(WebRequest::wasPosted()) { |
|
22 | + if (WebRequest::wasPosted()) { |
|
23 | 23 | Session::destroy(); |
24 | 24 | $this->redirect("login"); |
25 | 25 | return; |
@@ -193,14 +193,16 @@ |
||
193 | 193 | return $this->partiallyLinked; |
194 | 194 | } |
195 | 195 | |
196 | - public function canCreateAccount() { |
|
196 | + public function canCreateAccount() |
|
197 | + { |
|
197 | 198 | return $this->isFullyLinked() |
198 | 199 | && $this->getIdentity(true)->getGrantBasic() |
199 | 200 | && $this->getIdentity(true)->getGrantHighVolume() |
200 | 201 | && $this->getIdentity(true)->getGrantCreateAccount(); |
201 | 202 | } |
202 | 203 | |
203 | - public function canWelcome() { |
|
204 | + public function canWelcome() |
|
205 | + { |
|
204 | 206 | return $this->isFullyLinked() |
205 | 207 | && $this->getIdentity(true)->getGrantBasic() |
206 | 208 | && $this->getIdentity(true)->getGrantHighVolume() |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // Create a task. |
79 | 79 | $taskName = $job->getTask(); |
80 | 80 | |
81 | - if(!class_exists($taskName)) { |
|
81 | + if (!class_exists($taskName)) { |
|
82 | 82 | throw new ApplicationLogicException('Job task does not exist'); |
83 | 83 | } |
84 | 84 | |
@@ -132,6 +132,6 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | public static function errorHandler($errno, $errstr, $errfile, $errline) { |
135 | - throw new Exception($errfile . "@" . $errline . ": " . $errstr); |
|
135 | + throw new Exception($errfile."@".$errline.": ".$errstr); |
|
136 | 136 | } |
137 | 137 | } |
@@ -131,7 +131,8 @@ |
||
131 | 131 | $task->setNotificationHelper($this->getNotificationHelper()); |
132 | 132 | } |
133 | 133 | |
134 | - public static function errorHandler($errno, $errstr, $errfile, $errline) { |
|
134 | + public static function errorHandler($errno, $errstr, $errfile, $errline) |
|
135 | + { |
|
135 | 136 | throw new Exception($errfile . "@" . $errline . ": " . $errstr); |
136 | 137 | } |
137 | 138 | } |
@@ -133,7 +133,7 @@ |
||
133 | 133 | if ($reservationId !== 0 && $reservationId !== null) { |
134 | 134 | if ($currentUser->getId() !== $reservationId) { |
135 | 135 | SessionAlert::error("Request is reserved by someone else."); |
136 | - $this->redirect('/viewRequest', null, ['id' => $request->getId()] ); |
|
136 | + $this->redirect('/viewRequest', null, ['id' => $request->getId()]); |
|
137 | 137 | return true; |
138 | 138 | } |
139 | 139 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $constructedPolicy = "Content-Security-Policy{$reportOnly}: "; |
63 | 63 | |
64 | 64 | foreach ($this->policy as $item => $values) { |
65 | - $constructedPolicy .= $item . ' '; |
|
65 | + $constructedPolicy .= $item.' '; |
|
66 | 66 | $policyIsSet = false; |
67 | 67 | |
68 | 68 | if (count($values) > 0) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | break; |
87 | 87 | default: |
88 | 88 | $policyIsSet = true; |
89 | - $constructedPolicy .= $value . ' '; |
|
89 | + $constructedPolicy .= $value.' '; |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | if ($this->configuration->getCspReportUri() !== null) { |
106 | - $constructedPolicy .= 'report-uri ' . $this->configuration->getCspReportUri(); |
|
106 | + $constructedPolicy .= 'report-uri '.$this->configuration->getCspReportUri(); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | return $constructedPolicy; |
@@ -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 | /** |