@@ -18,8 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | if (!isset($_GET['user'])) { |
20 | 20 | return $this->getUserList(); |
21 | - } |
|
22 | - else { |
|
21 | + } else { |
|
23 | 22 | return $this->getUserDetail($_GET['user']); |
24 | 23 | } |
25 | 24 | } |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | |
181 | 181 | $out .= '>'; |
182 | 182 | |
183 | - $out .= '<td>' . $rowno . '</td>'; |
|
184 | - $out .= '<td>' . $row['COUNT(*)'] . '</td>'; |
|
183 | + $out .= '<td>'.$rowno.'</td>'; |
|
184 | + $out .= '<td>'.$row['COUNT(*)'].'</td>'; |
|
185 | 185 | |
186 | 186 | global $baseurl; |
187 | 187 | $out .= '<td><a '; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $out .= 'class="text-success" '; |
194 | 194 | } |
195 | 195 | |
196 | - $out .= 'href="' . $baseurl . '/statistics.php?page=Users&user=' . $row['user_id'] . '">' . $row['log_user'] . '</a></td>'; |
|
196 | + $out .= 'href="'.$baseurl.'/statistics.php?page=Users&user='.$row['user_id'].'">'.$row['log_user'].'</a></td>'; |
|
197 | 197 | |
198 | 198 | $out .= '</tr>'; |
199 | 199 |
@@ -14,31 +14,31 @@ discard block |
||
14 | 14 | |
15 | 15 | class StatsIdUsers extends StatisticsPage |
16 | 16 | { |
17 | - protected function execute() |
|
18 | - { |
|
19 | - return $this->getUserList(); |
|
20 | - } |
|
17 | + protected function execute() |
|
18 | + { |
|
19 | + return $this->getUserList(); |
|
20 | + } |
|
21 | 21 | |
22 | - public function getPageTitle() |
|
23 | - { |
|
24 | - return "User identification status"; |
|
25 | - } |
|
22 | + public function getPageTitle() |
|
23 | + { |
|
24 | + return "User identification status"; |
|
25 | + } |
|
26 | 26 | |
27 | - public function getPageName() |
|
28 | - { |
|
29 | - return "IdUsers"; |
|
30 | - } |
|
27 | + public function getPageName() |
|
28 | + { |
|
29 | + return "IdUsers"; |
|
30 | + } |
|
31 | 31 | |
32 | - public function isProtected() |
|
33 | - { |
|
34 | - return true; |
|
35 | - } |
|
32 | + public function isProtected() |
|
33 | + { |
|
34 | + return true; |
|
35 | + } |
|
36 | 36 | |
37 | - private function getUserList() |
|
38 | - { |
|
39 | - global $currentIdentificationVersion, $forceIdentification; |
|
37 | + private function getUserList() |
|
38 | + { |
|
39 | + global $currentIdentificationVersion, $forceIdentification; |
|
40 | 40 | |
41 | - $query = <<<SQL |
|
41 | + $query = <<<SQL |
|
42 | 42 | select username, status, checkuser, identified, case |
43 | 43 | when coalesce(identified, 0) = 0 then 'Not identified' |
44 | 44 | when identified < ${forceIdentification} then 'Expired' |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | order by username; |
52 | 52 | SQL; |
53 | 53 | |
54 | - $qb = new QueryBrowser(); |
|
55 | - $qb->rowFetchMode = PDO::FETCH_NUM; |
|
56 | - $qb->overrideTableTitles = array("User name", "Access level", "Checkuser?", "Version", "Identification status"); |
|
57 | - $r = $qb->executeQueryToTable($query); |
|
54 | + $qb = new QueryBrowser(); |
|
55 | + $qb->rowFetchMode = PDO::FETCH_NUM; |
|
56 | + $qb->overrideTableTitles = array("User name", "Access level", "Checkuser?", "Version", "Identification status"); |
|
57 | + $r = $qb->executeQueryToTable($query); |
|
58 | 58 | |
59 | - return $r; |
|
60 | - } |
|
59 | + return $r; |
|
60 | + } |
|
61 | 61 | |
62 | - public function requiresWikiDatabase() |
|
63 | - { |
|
64 | - return false; |
|
65 | - } |
|
62 | + public function requiresWikiDatabase() |
|
63 | + { |
|
64 | + return false; |
|
65 | + } |
|
66 | 66 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public static function getByAddress($address, PdoDatabase $database, $forUpdate = false) |
21 | 21 | { |
22 | 22 | $lockMode = $forUpdate ? ' FOR UPDATE' : ''; |
23 | - $sql = "SELECT * FROM geolocation WHERE address = :id LIMIT 1" . $lockMode; |
|
23 | + $sql = "SELECT * FROM geolocation WHERE address = :id LIMIT 1".$lockMode; |
|
24 | 24 | |
25 | 25 | $statement = $database->prepare($sql); |
26 | 26 | $statement->bindValue(":id", $address); |
@@ -47,12 +47,10 @@ |
||
47 | 47 | if ($statement->execute()) { |
48 | 48 | $this->isNew = false; |
49 | 49 | $this->id = $this->dbObject->lastInsertId(); |
50 | - } |
|
51 | - else { |
|
50 | + } else { |
|
52 | 51 | throw new Exception($statement->errorInfo()); |
53 | 52 | } |
54 | - } |
|
55 | - else { |
|
53 | + } else { |
|
56 | 54 | // update |
57 | 55 | $statement = $this->dbObject->prepare("UPDATE `geolocation` SET address = :address, data = :data WHERE id = :id;"); |
58 | 56 | $statement->bindValue(":address", $this->address); |
@@ -41,12 +41,10 @@ |
||
41 | 41 | if ($statement->execute()) { |
42 | 42 | $this->isNew = false; |
43 | 43 | $this->id = $this->dbObject->lastInsertId(); |
44 | - } |
|
45 | - else { |
|
44 | + } else { |
|
46 | 45 | throw new Exception($statement->errorInfo()); |
47 | 46 | } |
48 | - } |
|
49 | - else { |
|
47 | + } else { |
|
50 | 48 | // update |
51 | 49 | $statement = $this->dbObject->prepare("UPDATE `rdnscache` SET address = :address, data = :data WHERE id = :id;"); |
52 | 50 | $statement->bindValue(":address", $this->address); |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | if (User::getCurrent()->isAdmin() || User::getCurrent()->isCheckuser()) { |
27 | 27 | // current user is an admin or checkuser, so retrieve everything. |
28 | 28 | $statement = $database->prepare("SELECT * FROM comment WHERE request = :target;"); |
29 | - } |
|
30 | - else { |
|
29 | + } else { |
|
31 | 30 | // current user isn't an admin, so limit to only those which are visible to users, and private comments |
32 | 31 | // the user has posted themselves. |
33 | 32 | $statement = $database->prepare(<<<SQL |
@@ -70,12 +69,10 @@ discard block |
||
70 | 69 | if ($statement->execute()) { |
71 | 70 | $this->isNew = false; |
72 | 71 | $this->id = $this->dbObject->lastInsertId(); |
73 | - } |
|
74 | - else { |
|
72 | + } else { |
|
75 | 73 | throw new Exception($statement->errorInfo()); |
76 | 74 | } |
77 | - } |
|
78 | - else { |
|
75 | + } else { |
|
79 | 76 | // update |
80 | 77 | $statement = $this->dbObject->prepare(<<<SQL |
81 | 78 | UPDATE comment |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $blacklist = array("DCC", "CCTP", "PRIVMSG"); |
99 | 99 | $message = str_replace($blacklist, "(IRC Blacklist)", $message); //Lets stop DCC etc |
100 | 100 | |
101 | - $msg = IrcColourCode::RESET . IrcColourCode::BOLD . "[$whichami]" . IrcColourCode::RESET . ": $message"; |
|
101 | + $msg = IrcColourCode::RESET.IrcColourCode::BOLD."[$whichami]".IrcColourCode::RESET.": $message"; |
|
102 | 102 | |
103 | 103 | try { |
104 | 104 | $database = gGetDb('notifications'); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public static function userApproved(User $user) |
138 | 138 | { |
139 | - self::send("{$user->getUsername()} approved by " . User::getCurrent()->getUsername()); |
|
139 | + self::send("{$user->getUsername()} approved by ".User::getCurrent()->getUsername()); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public static function userPromoted(User $user) |
147 | 147 | { |
148 | - self::send("{$user->getUsername()} promoted to tool admin by " . User::getCurrent()->getUsername()); |
|
148 | + self::send("{$user->getUsername()} promoted to tool admin by ".User::getCurrent()->getUsername()); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public static function userDeclined(User $user, $reason) |
157 | 157 | { |
158 | - self::send("{$user->getUsername()} declined by " . User::getCurrent()->getUsername() . " ($reason)"); |
|
158 | + self::send("{$user->getUsername()} declined by ".User::getCurrent()->getUsername()." ($reason)"); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public static function userDemoted(User $user, $reason) |
167 | 167 | { |
168 | - self::send("{$user->getUsername()} demoted by " . User::getCurrent()->getUsername() . " ($reason)"); |
|
168 | + self::send("{$user->getUsername()} demoted by ".User::getCurrent()->getUsername()." ($reason)"); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public static function userSuspended(User $user, $reason) |
177 | 177 | { |
178 | - self::send("{$user->getUsername()} suspended by " . User::getCurrent()->getUsername() . " ($reason)"); |
|
178 | + self::send("{$user->getUsername()} suspended by ".User::getCurrent()->getUsername()." ($reason)"); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public static function userPrefChange(User $user) |
186 | 186 | { |
187 | - self::send("{$user->getUsername()}'s preferences were changed by " . User::getCurrent()->getUsername()); |
|
187 | + self::send("{$user->getUsername()}'s preferences were changed by ".User::getCurrent()->getUsername()); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public static function userRenamed(User $user, $old) |
196 | 196 | { |
197 | - self::send(User::getCurrent()->getUsername() . " renamed $old to {$user->getUsername()}"); |
|
197 | + self::send(User::getCurrent()->getUsername()." renamed $old to {$user->getUsername()}"); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | #endregion |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public static function interfaceMessageEdited(InterfaceMessage $message) |
209 | 209 | { |
210 | - self::send("Message {$message->getDescription()} ({$message->getId()}) edited by " . User::getCurrent()->getUsername()); |
|
210 | + self::send("Message {$message->getDescription()} ({$message->getId()}) edited by ".User::getCurrent()->getUsername()); |
|
211 | 211 | } |
212 | 212 | #endregion |
213 | 213 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public static function welcomeTemplateCreated(WelcomeTemplate $template) |
220 | 220 | { |
221 | - self::send("Welcome template {$template->getId()} created by " . User::getCurrent()->getUsername()); |
|
221 | + self::send("Welcome template {$template->getId()} created by ".User::getCurrent()->getUsername()); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public static function welcomeTemplateDeleted($templateid) |
229 | 229 | { |
230 | - self::send("Welcome template {$templateid} deleted by " . User::getCurrent()->getUsername()); |
|
230 | + self::send("Welcome template {$templateid} deleted by ".User::getCurrent()->getUsername()); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public static function welcomeTemplateEdited(WelcomeTemplate $template) |
238 | 238 | { |
239 | - self::send("Welcome template {$template->getId()} edited by " . User::getCurrent()->getUsername()); |
|
239 | + self::send("Welcome template {$template->getId()} edited by ".User::getCurrent()->getUsername()); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | #endregion |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $duration = "indefinitely"; |
253 | 253 | } |
254 | 254 | else { |
255 | - $duration = "until " . date("F j, Y, g:i a", $ban->getDuration()); |
|
255 | + $duration = "until ".date("F j, Y, g:i a", $ban->getDuration()); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | $username = User::getCurrent()->getUsername(); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public static function unbanned(Ban $ban, $unbanreason) |
269 | 269 | { |
270 | - self::send($ban->getTarget() . " unbanned by " . User::getCurrent()->getUsername() . " (" . $unbanreason . ")"); |
|
270 | + self::send($ban->getTarget()." unbanned by ".User::getCurrent()->getUsername()." (".$unbanreason.")"); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | #endregion |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | global $baseurl; |
284 | 284 | |
285 | 285 | self::send( |
286 | - IrcColourCode::DARK_GREY . "[[" |
|
287 | - . IrcColourCode::DARK_GREEN . "acc:" |
|
288 | - . IrcColourCode::ORANGE . $request->getId() |
|
289 | - . IrcColourCode::DARK_GREY . "]]" |
|
290 | - . IrcColourCode::RED . " N " |
|
291 | - . IrcColourCode::DARK_BLUE . $baseurl . "/acc.php?action=zoom&id={$request->getId()} " |
|
292 | - . IrcColourCode::DARK_RED . "* " |
|
293 | - . IrcColourCode::DARK_GREEN . $request->getName() |
|
294 | - . IrcColourCode::DARK_RED . " * " |
|
286 | + IrcColourCode::DARK_GREY."[[" |
|
287 | + . IrcColourCode::DARK_GREEN."acc:" |
|
288 | + . IrcColourCode::ORANGE.$request->getId() |
|
289 | + . IrcColourCode::DARK_GREY."]]" |
|
290 | + . IrcColourCode::RED." N " |
|
291 | + . IrcColourCode::DARK_BLUE.$baseurl."/acc.php?action=zoom&id={$request->getId()} " |
|
292 | + . IrcColourCode::DARK_RED."* " |
|
293 | + . IrcColourCode::DARK_GREEN.$request->getName() |
|
294 | + . IrcColourCode::DARK_RED." * " |
|
295 | 295 | . IrcColourCode::RESET |
296 | 296 | ); |
297 | 297 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public static function emailCreated(EmailTemplate $template) |
436 | 436 | { |
437 | - self::send("Email {$template->getId()} ({$template->getName()}) created by " . User::getCurrent()->getUsername()); |
|
437 | + self::send("Email {$template->getId()} ({$template->getName()}) created by ".User::getCurrent()->getUsername()); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | */ |
444 | 444 | public static function emailEdited(EmailTemplate $template) |
445 | 445 | { |
446 | - self::send("Email {$template->getId()} ({$template->getName()}) edited by " . User::getCurrent()->getUsername()); |
|
446 | + self::send("Email {$template->getId()} ({$template->getName()}) edited by ".User::getCurrent()->getUsername()); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | #endregion |
@@ -31,12 +31,10 @@ discard block |
||
31 | 31 | if ($statement->execute()) { |
32 | 32 | $this->isNew = false; |
33 | 33 | $this->id = $this->dbObject->lastInsertId(); |
34 | - } |
|
35 | - else { |
|
34 | + } else { |
|
36 | 35 | throw new Exception($statement->errorInfo()); |
37 | 36 | } |
38 | - } |
|
39 | - else { |
|
37 | + } else { |
|
40 | 38 | throw new Exception("You shouldn't be doing this..."); |
41 | 39 | } |
42 | 40 | } |
@@ -250,8 +248,7 @@ discard block |
||
250 | 248 | { |
251 | 249 | if ($ban->getDuration() == -1) { |
252 | 250 | $duration = "indefinitely"; |
253 | - } |
|
254 | - else { |
|
251 | + } else { |
|
255 | 252 | $duration = "until " . date("F j, Y, g:i a", $ban->getDuration()); |
256 | 253 | } |
257 | 254 |
@@ -83,12 +83,10 @@ discard block |
||
83 | 83 | if ($statement->execute()) { |
84 | 84 | $this->isNew = false; |
85 | 85 | $this->id = (int)$this->dbObject->lastInsertId(); |
86 | - } |
|
87 | - else { |
|
86 | + } else { |
|
88 | 87 | throw new Exception($statement->errorInfo()); |
89 | 88 | } |
90 | - } |
|
91 | - else { |
|
89 | + } else { |
|
92 | 90 | // update |
93 | 91 | $statement = $this->dbObject->prepare("UPDATE `request` SET " . |
94 | 92 | "status = :status, checksum = :checksum, emailsent = :emailsent, emailconfirm = :emailconfirm, " . |
@@ -372,12 +370,10 @@ discard block |
||
372 | 370 | if ($this->reserved != 0) { |
373 | 371 | if ($this->reserved == User::getCurrent()->getId()) { |
374 | 372 | return false; |
375 | - } |
|
376 | - else { |
|
373 | + } else { |
|
377 | 374 | return true; |
378 | 375 | } |
379 | - } |
|
380 | - else { |
|
376 | + } else { |
|
381 | 377 | return false; |
382 | 378 | } |
383 | 379 | |
@@ -392,8 +388,7 @@ discard block |
||
392 | 388 | |
393 | 389 | if ($this->getEmailConfirm() == $si) { |
394 | 390 | $this->setEmailConfirm("Confirmed"); |
395 | - } |
|
396 | - else { |
|
391 | + } else { |
|
397 | 392 | throw new TransactionException("Confirmation hash does not match the expected value", "Email confirmation failed"); |
398 | 393 | } |
399 | 394 | } |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | if ($this->isNew) { |
64 | 64 | // insert |
65 | 65 | $statement = $this->dbObject->prepare( |
66 | - "INSERT INTO `request` (" . |
|
67 | - "email, ip, name, comment, status, date, checksum, emailsent, emailconfirm, reserved, useragent, forwardedip" . |
|
68 | - ") VALUES (" . |
|
69 | - ":email, :ip, :name, :comment, :status, CURRENT_TIMESTAMP(), :checksum, :emailsent," . |
|
70 | - ":emailconfirm, :reserved, :useragent, :forwardedip" . |
|
66 | + "INSERT INTO `request` (". |
|
67 | + "email, ip, name, comment, status, date, checksum, emailsent, emailconfirm, reserved, useragent, forwardedip". |
|
68 | + ") VALUES (". |
|
69 | + ":email, :ip, :name, :comment, :status, CURRENT_TIMESTAMP(), :checksum, :emailsent,". |
|
70 | + ":emailconfirm, :reserved, :useragent, :forwardedip". |
|
71 | 71 | ");"); |
72 | 72 | $statement->bindValue(":email", $this->email); |
73 | 73 | $statement->bindValue(":ip", $this->ip); |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | } |
91 | 91 | else { |
92 | 92 | // update |
93 | - $statement = $this->dbObject->prepare("UPDATE `request` SET " . |
|
94 | - "status = :status, checksum = :checksum, emailsent = :emailsent, emailconfirm = :emailconfirm, " . |
|
95 | - "reserved = :reserved " . |
|
93 | + $statement = $this->dbObject->prepare("UPDATE `request` SET ". |
|
94 | + "status = :status, checksum = :checksum, emailsent = :emailsent, emailconfirm = :emailconfirm, ". |
|
95 | + "reserved = :reserved ". |
|
96 | 96 | "WHERE id = :id;"); |
97 | 97 | $statement->bindValue(":id", $this->id); |
98 | 98 | $statement->bindValue(":status", $this->status); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | public function updateChecksum() |
198 | 198 | { |
199 | - $this->checksum = md5($this->id . $this->name . $this->email . microtime()); |
|
199 | + $this->checksum = md5($this->id.$this->name.$this->email.microtime()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | public function getEmailSent() |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $query = $this->dbObject->prepare("SELECT * FROM request WHERE (ip = :ip OR forwardedip LIKE :forwarded) AND ip != :clearedip AND id != :id AND emailconfirm = 'Confirmed';"); |
324 | 324 | |
325 | 325 | $trustedIp = $this->getTrustedIp(); |
326 | - $trustedFilter = '%' . $trustedIp . '%'; |
|
326 | + $trustedFilter = '%'.$trustedIp.'%'; |
|
327 | 327 | |
328 | 328 | $query->bindValue(":id", $this->id); |
329 | 329 | $query->bindValue(":ip", $trustedIp); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | return false; |
352 | 352 | } |
353 | 353 | |
354 | - $apiResult = file_get_contents("https://en.wikipedia.org/w/api.php?action=titleblacklist&tbtitle=" . urlencode($this->name) . "&tbaction=new-account&tbnooverride&format=php"); |
|
354 | + $apiResult = file_get_contents("https://en.wikipedia.org/w/api.php?action=titleblacklist&tbtitle=".urlencode($this->name)."&tbaction=new-account&tbnooverride&format=php"); |
|
355 | 355 | |
356 | 356 | $data = unserialize($apiResult); |
357 | 357 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | |
424 | 424 | public function getObjectDescription() |
425 | 425 | { |
426 | - return '<a href="acc.php?action=zoom&id=' . $this->getId() . '">Request #' . $this->getId() . " (" . htmlentities($this->name) . ")</a>"; |
|
426 | + return '<a href="acc.php?action=zoom&id='.$this->getId().'">Request #'.$this->getId()." (".htmlentities($this->name).")</a>"; |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | public function getClosureReason() |
@@ -123,12 +123,10 @@ |
||
123 | 123 | if ($statement->execute()) { |
124 | 124 | $this->isNew = false; |
125 | 125 | $this->id = $this->dbObject->lastInsertId(); |
126 | - } |
|
127 | - else { |
|
126 | + } else { |
|
128 | 127 | throw new Exception($statement->errorInfo()); |
129 | 128 | } |
130 | - } |
|
131 | - else { |
|
129 | + } else { |
|
132 | 130 | // update |
133 | 131 | $statement = $this->dbObject->prepare(<<<SQL |
134 | 132 | UPDATE `emailtemplate` |