@@ -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 |
@@ -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 | } |
@@ -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` |
@@ -653,9 +653,9 @@ |
||
| 653 | 653 | |
| 654 | 654 | public function isCheckuser() |
| 655 | 655 | { |
| 656 | - if($this->isCheckuserCache === null) { |
|
| 657 | - $this->isCheckuserCache = $this->checkuser == 1 || $this->oauthCanCheckUser(); |
|
| 658 | - } |
|
| 656 | + if($this->isCheckuserCache === null) { |
|
| 657 | + $this->isCheckuserCache = $this->checkuser == 1 || $this->oauthCanCheckUser(); |
|
| 658 | + } |
|
| 659 | 659 | |
| 660 | 660 | return $this->isCheckuserCache; |
| 661 | 661 | } |
@@ -46,8 +46,7 @@ discard block |
||
| 46 | 46 | if (self::$currentUser === null) { |
| 47 | 47 | if (isset($_SESSION['userID'])) { |
| 48 | 48 | self::$currentUser = self::getById($_SESSION['userID'], $database); |
| 49 | - } |
|
| 50 | - else { |
|
| 49 | + } else { |
|
| 51 | 50 | $anonymousCoward = new CommunityUser(); |
| 52 | 51 | |
| 53 | 52 | self::$currentUser = $anonymousCoward; |
@@ -259,12 +258,10 @@ discard block |
||
| 259 | 258 | if ($filter === null) { |
| 260 | 259 | $userListQuery = "SELECT username FROM user;"; |
| 261 | 260 | $userListResult = $database->query($userListQuery); |
| 262 | - } |
|
| 263 | - elseif ($filter === true) { |
|
| 261 | + } elseif ($filter === true) { |
|
| 264 | 262 | $userListQuery = "SELECT username FROM user WHERE status IN ('User', 'Admin');"; |
| 265 | 263 | $userListResult = $database->query($userListQuery); |
| 266 | - } |
|
| 267 | - else { |
|
| 264 | + } else { |
|
| 268 | 265 | $userListQuery = "SELECT username FROM user WHERE status = :status;"; |
| 269 | 266 | $userListResult = $database->prepare($userListQuery); |
| 270 | 267 | $userListResult->execute(array(":status" => $filter)); |
@@ -314,12 +311,10 @@ discard block |
||
| 314 | 311 | if ($statement->execute()) { |
| 315 | 312 | $this->isNew = false; |
| 316 | 313 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 317 | - } |
|
| 318 | - else { |
|
| 314 | + } else { |
|
| 319 | 315 | throw new Exception($statement->errorInfo()); |
| 320 | 316 | } |
| 321 | - } |
|
| 322 | - else { |
|
| 317 | + } else { |
|
| 323 | 318 | // update |
| 324 | 319 | $statement = $this->dbObject->prepare(<<<SQL |
| 325 | 320 | UPDATE `user` SET |
@@ -699,8 +694,7 @@ discard block |
||
| 699 | 694 | |
| 700 | 695 | if ($this->oauthidentitycache == null) { |
| 701 | 696 | $this->identityCache = null; |
| 702 | - } |
|
| 703 | - else { |
|
| 697 | + } else { |
|
| 704 | 698 | $this->identityCache = unserialize($this->oauthidentitycache); |
| 705 | 699 | } |
| 706 | 700 | |
@@ -718,14 +712,12 @@ discard block |
||
| 718 | 712 | ) { |
| 719 | 713 | // Use cached value - it's either valid or we don't care. |
| 720 | 714 | return $this->identityCache; |
| 721 | - } |
|
| 722 | - else { |
|
| 715 | + } else { |
|
| 723 | 716 | // Cache expired and not forcing use of cached value |
| 724 | 717 | $this->getIdentityCache(); |
| 725 | 718 | return $this->identityCache; |
| 726 | 719 | } |
| 727 | - } |
|
| 728 | - else { |
|
| 720 | + } else { |
|
| 729 | 721 | // Cache isn't ours or doesn't exist |
| 730 | 722 | $this->getIdentityCache(); |
| 731 | 723 | return $this->identityCache; |
@@ -653,7 +653,7 @@ |
||
| 653 | 653 | |
| 654 | 654 | public function isCheckuser() |
| 655 | 655 | { |
| 656 | - if($this->isCheckuserCache === null) { |
|
| 656 | + if ($this->isCheckuserCache === null) { |
|
| 657 | 657 | $this->isCheckuserCache = $this->checkuser == 1 || $this->oauthCanCheckUser(); |
| 658 | 658 | } |
| 659 | 659 | |
@@ -48,12 +48,10 @@ |
||
| 48 | 48 | if ($statement->execute()) { |
| 49 | 49 | $this->isNew = false; |
| 50 | 50 | $this->id = $this->dbObject->lastInsertId(); |
| 51 | - } |
|
| 52 | - else { |
|
| 51 | + } else { |
|
| 53 | 52 | throw new Exception($statement->errorInfo()); |
| 54 | 53 | } |
| 55 | - } |
|
| 56 | - else { |
|
| 54 | + } else { |
|
| 57 | 55 | // update |
| 58 | 56 | $statement = $this->dbObject->prepare("UPDATE interfacemessage SET type = :type, description = :desc, content = :content, updatecounter = updatecounter + 1 WHERE id = :id;"); |
| 59 | 57 | $statement->bindValue(":id", $this->id); |
@@ -74,8 +74,7 @@ |
||
| 74 | 74 | if ($statement->execute()) { |
| 75 | 75 | $this->isNew = false; |
| 76 | 76 | $this->id = $this->dbObject->lastInsertId(); |
| 77 | - } |
|
| 78 | - else { |
|
| 77 | + } else { |
|
| 79 | 78 | throw new Exception($statement->errorInfo()); |
| 80 | 79 | } |
| 81 | 80 | } |
@@ -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 `welcometemplate` SET usercode = :usercode, botcode = :botcode WHERE id = :id;"); |
| 58 | 56 | $statement->bindValue(":id", $this->id); |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | $query = "SELECT * FROM ban WHERE target = :target;"; |
| 30 | 30 | $statement = $database->prepare($query); |
| 31 | 31 | $statement->bindValue(":target", $target); |
| 32 | - } |
|
| 33 | - else { |
|
| 32 | + } else { |
|
| 34 | 33 | $query = "SELECT * FROM ban;"; |
| 35 | 34 | $statement = $database->prepare($query); |
| 36 | 35 | } |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | $query = "SELECT * FROM ban WHERE target = :target AND (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1;"; |
| 65 | 64 | $statement = $database->prepare($query); |
| 66 | 65 | $statement->bindValue(":target", $target); |
| 67 | - } |
|
| 68 | - else { |
|
| 66 | + } else { |
|
| 69 | 67 | $query = "SELECT * FROM ban WHERE (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1;"; |
| 70 | 68 | $statement = $database->prepare($query); |
| 71 | 69 | } |
@@ -160,12 +158,10 @@ discard block |
||
| 160 | 158 | if ($statement->execute()) { |
| 161 | 159 | $this->isNew = false; |
| 162 | 160 | $this->id = $this->dbObject->lastInsertId(); |
| 163 | - } |
|
| 164 | - else { |
|
| 161 | + } else { |
|
| 165 | 162 | throw new Exception($statement->errorInfo()); |
| 166 | 163 | } |
| 167 | - } |
|
| 168 | - else { |
|
| 164 | + } else { |
|
| 169 | 165 | // update |
| 170 | 166 | $statement = $this->dbObject->prepare("UPDATE `ban` SET duration = :duration, active = :active, user = :user WHERE id = :id;"); |
| 171 | 167 | $statement->bindValue(":id", $this->id); |
@@ -215,8 +211,7 @@ discard block |
||
| 215 | 211 | } |
| 216 | 212 | |
| 217 | 213 | $this->user = $u->getId(); |
| 218 | - } |
|
| 219 | - else { |
|
| 214 | + } else { |
|
| 220 | 215 | $this->user = $user; |
| 221 | 216 | } |
| 222 | 217 | } |
@@ -35,12 +35,10 @@ discard block |
||
| 35 | 35 | if ($statement->execute()) { |
| 36 | 36 | $this->isNew = false; |
| 37 | 37 | $this->id = $this->dbObject->lastInsertId(); |
| 38 | - } |
|
| 39 | - else { |
|
| 38 | + } else { |
|
| 40 | 39 | throw new Exception($statement->errorInfo()); |
| 41 | 40 | } |
| 42 | - } |
|
| 43 | - else { |
|
| 41 | + } else { |
|
| 44 | 42 | throw new Exception("Updating logs is not available"); |
| 45 | 43 | } |
| 46 | 44 | } |
@@ -100,8 +98,7 @@ discard block |
||
| 100 | 98 | { |
| 101 | 99 | if (is_a($user, "User")) { |
| 102 | 100 | $this->user = $user->getId(); |
| 103 | - } |
|
| 104 | - else { |
|
| 101 | + } else { |
|
| 105 | 102 | $this->user = $user; |
| 106 | 103 | } |
| 107 | 104 | } |