@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | if (isset($_SESSION['user'])) { |
| 34 | 34 | $sessionuser = $_SESSION['user']; |
| 35 | -} |
|
| 36 | -else { |
|
| 35 | +} else { |
|
| 37 | 36 | $sessionuser = ""; |
| 38 | 37 | } |
| 39 | 38 | |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | $smarty->assign("target", $target); |
| 97 | 96 | |
| 98 | 97 | $smarty->display("search/searchresult.tpl"); |
| 99 | - } |
|
| 100 | - elseif ($_GET['type'] == 'IP') { |
|
| 98 | + } elseif ($_GET['type'] == 'IP') { |
|
| 101 | 99 | $qterm = '%' . $term . '%'; |
| 102 | 100 | |
| 103 | 101 | $statement = gGetDb()->prepare("SELECT * FROM request WHERE email <> '[email protected]' and ip <> '127.0.0.1' and ip LIKE :term or forwardedip LIKE :term2;"); |
@@ -115,8 +113,7 @@ discard block |
||
| 115 | 113 | $smarty->assign("target", $target); |
| 116 | 114 | |
| 117 | 115 | $smarty->display("search/searchresult.tpl"); |
| 118 | - } |
|
| 119 | - elseif ($_GET['type'] == 'Request') { |
|
| 116 | + } elseif ($_GET['type'] == 'Request') { |
|
| 120 | 117 | $qterm = '%' . $term . '%'; |
| 121 | 118 | |
| 122 | 119 | $statement = gGetDb()->prepare("SELECT * FROM request WHERE name LIKE :term;"); |
@@ -133,15 +130,13 @@ discard block |
||
| 133 | 130 | $smarty->assign("target", $target); |
| 134 | 131 | |
| 135 | 132 | $smarty->display("search/searchresult.tpl"); |
| 136 | - } |
|
| 137 | - else { |
|
| 133 | + } else { |
|
| 138 | 134 | BootstrapSkin::displayAlertBox("Unknown search type", "alert-error", "Error"); |
| 139 | 135 | $smarty->display("search/searchform.tpl"); |
| 140 | 136 | BootstrapSkin::displayInternalFooter(); |
| 141 | 137 | die(); |
| 142 | 138 | } |
| 143 | -} |
|
| 144 | -else { |
|
| 139 | +} else { |
|
| 145 | 140 | $smarty->display("search/searchform.tpl"); |
| 146 | 141 | } |
| 147 | 142 | |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | if (isset($_GET['ecoverride']) && User::getCurrent()->isAdmin()) { |
| 33 | 33 | $smarty->assign('ecoverride', true); |
| 34 | - } |
|
| 35 | - else { |
|
| 34 | + } else { |
|
| 36 | 35 | $smarty->assign('ecoverride', false); |
| 37 | 36 | } |
| 38 | 37 | |
@@ -79,16 +78,14 @@ discard block |
||
| 79 | 78 | if ($request->getStatus() == "Closed") { |
| 80 | 79 | $hash = md5($request->getId() . $request->getEmail() . $request->getTrustedIp() . microtime()); //If the request is closed, change the hash based on microseconds similar to the checksums. |
| 81 | 80 | $smarty->assign("isclosed", true); |
| 82 | - } |
|
| 83 | - else { |
|
| 81 | + } else { |
|
| 84 | 82 | $hash = md5($request->getId() . $request->getEmail() . $request->getTrustedIp()); |
| 85 | 83 | $smarty->assign("isclosed", false); |
| 86 | 84 | } |
| 87 | 85 | $smarty->assign("hash", $hash); |
| 88 | 86 | if ($hash == $urlhash) { |
| 89 | 87 | $correcthash = true; |
| 90 | - } |
|
| 91 | - else { |
|
| 88 | + } else { |
|
| 92 | 89 | $correcthash = false; |
| 93 | 90 | } |
| 94 | 91 | |
@@ -127,8 +124,7 @@ discard block |
||
| 127 | 124 | if (!$ipisprivate) { |
| 128 | 125 | $iprdns = $rdnsProvider->getRdns($p2); |
| 129 | 126 | $iplocation = $locationProvider->getIpLocation($p2); |
| 130 | - } |
|
| 131 | - else { |
|
| 127 | + } else { |
|
| 132 | 128 | // this is going to fail, so why bother trying? |
| 133 | 129 | $iprdns = false; |
| 134 | 130 | $iplocation = false; |
@@ -69,13 +69,15 @@ |
||
| 69 | 69 | echo ". IP location fetch complete.\n"; |
| 70 | 70 | $database->commit(); |
| 71 | 71 | echo ". Committed txn.\n"; |
| 72 | - } catch (Exception $ex) { |
|
| 72 | + } |
|
| 73 | + catch (Exception $ex) { |
|
| 73 | 74 | echo ". Encountered exception: " . $ex->getMessage(). "\n"; |
| 74 | 75 | $database->rollBack(); |
| 75 | 76 | echo ". Rolled back txn\n"; |
| 76 | 77 | throw $ex; |
| 77 | - } finally { |
|
| 78 | - if($database->hasActiveTransaction()){ |
|
| 78 | + } |
|
| 79 | + finally { |
|
| 80 | + if($database->hasActiveTransaction()) { |
|
| 79 | 81 | $database->rollBack(); |
| 80 | 82 | echo ". Rolled back txn\n"; |
| 81 | 83 | } |
@@ -89,8 +89,7 @@ discard block |
||
| 89 | 89 | BootstrapSkin::displayAlertBox($ex->getMessage(), "alert-error", "Unknown error", true, false); |
| 90 | 90 | BootstrapSkin::displayPublicFooter(); |
| 91 | 91 | } |
| 92 | -} |
|
| 93 | -else { |
|
| 92 | +} else { |
|
| 94 | 93 | if ($_SERVER['REQUEST_METHOD'] == "POST") { |
| 95 | 94 | $errorEncountered = false; |
| 96 | 95 | |
@@ -127,8 +126,7 @@ discard block |
||
| 127 | 126 | } |
| 128 | 127 | |
| 129 | 128 | $smarty->display("request/request-form.tpl"); |
| 130 | - } |
|
| 131 | - else if ($enableEmailConfirm == 1) { |
|
| 129 | + } else if ($enableEmailConfirm == 1) { |
|
| 132 | 130 | $request->generateEmailConfirmationHash(); |
| 133 | 131 | |
| 134 | 132 | $database->transactionally(function() use($request) |
@@ -143,8 +141,7 @@ discard block |
||
| 143 | 141 | $request->sendConfirmationEmail(); |
| 144 | 142 | |
| 145 | 143 | $smarty->display("request/email-confirmation.tpl"); |
| 146 | - } |
|
| 147 | - else { |
|
| 144 | + } else { |
|
| 148 | 145 | $request->setEmailConfirm(0); // Since it can't be null |
| 149 | 146 | $database->transactionally(function() use($request) |
| 150 | 147 | { |
@@ -158,8 +155,7 @@ discard block |
||
| 158 | 155 | } |
| 159 | 156 | |
| 160 | 157 | BootstrapSkin::displayPublicFooter(); |
| 161 | - } |
|
| 162 | - else { |
|
| 158 | + } else { |
|
| 163 | 159 | $smarty->display("request/request-form.tpl"); |
| 164 | 160 | BootstrapSkin::displayPublicFooter(); |
| 165 | 161 | } |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | $hashPos = strpos($rawline, '#'); |
| 25 | 25 | if ($hashPos !== false) { |
| 26 | 26 | $line = substr($rawline, 0, $hashPos); |
| 27 | - } |
|
| 28 | - else { |
|
| 27 | + } else { |
|
| 29 | 28 | $line = $rawline; |
| 30 | 29 | } |
| 31 | 30 | |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | reattachOAuthAccount(User::getCurrent()); |
| 71 | 71 | } |
| 72 | - } |
|
| 73 | - else { |
|
| 72 | + } else { |
|
| 74 | 73 | global $enforceOAuth; |
| 75 | 74 | |
| 76 | 75 | if ($enforceOAuth) { |
@@ -83,8 +82,7 @@ discard block |
||
| 83 | 82 | BootstrapSkin::displayAlertBox("I'm sorry, but, your account has not been approved by a site administrator yet. Please stand by.", "alert-error", "New account", true, false); |
| 84 | 83 | BootstrapSkin::displayInternalFooter(); |
| 85 | 84 | die(); |
| 86 | - } |
|
| 87 | - elseif (User::getCurrent()->isSuspended()) { |
|
| 85 | + } elseif (User::getCurrent()->isSuspended()) { |
|
| 88 | 86 | $database = gGetDb(); |
| 89 | 87 | $suspendstatement = $database->prepare(<<<SQL |
| 90 | 88 | SELECT comment |
@@ -105,8 +103,7 @@ discard block |
||
| 105 | 103 | $smarty->display("login/suspended.tpl"); |
| 106 | 104 | BootstrapSkin::displayInternalFooter(); |
| 107 | 105 | die(); |
| 108 | - } |
|
| 109 | - elseif (User::getCurrent()->isDeclined()) { |
|
| 106 | + } elseif (User::getCurrent()->isDeclined()) { |
|
| 110 | 107 | $database = gGetDb(); |
| 111 | 108 | $suspendstatement = $database->prepare(<<<SQL |
| 112 | 109 | SELECT comment |
@@ -127,11 +124,9 @@ discard block |
||
| 127 | 124 | $smarty->display("login/declined.tpl"); |
| 128 | 125 | BootstrapSkin::displayInternalFooter(); |
| 129 | 126 | die(); |
| 130 | - } |
|
| 131 | - elseif ((!User::getCurrent()->isCommunityUser()) && (User::getCurrent()->isUser() || User::getCurrent()->isAdmin())) { |
|
| 127 | + } elseif ((!User::getCurrent()->isCommunityUser()) && (User::getCurrent()->isUser() || User::getCurrent()->isAdmin())) { |
|
| 132 | 128 | $secure = 1; |
| 133 | - } |
|
| 134 | - else { |
|
| 129 | + } else { |
|
| 135 | 130 | //die("Not logged in!"); |
| 136 | 131 | } |
| 137 | 132 | } |
@@ -91,8 +91,7 @@ discard block |
||
| 91 | 91 | // all over the rest of the code |
| 92 | 92 | if ($this->hasActiveTransaction) { |
| 93 | 93 | return false; |
| 94 | - } |
|
| 95 | - else { |
|
| 94 | + } else { |
|
| 96 | 95 | // set the transaction isolation level for every transaction. |
| 97 | 96 | $this->exec("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;"); |
| 98 | 97 | |
@@ -146,8 +145,7 @@ discard block |
||
| 146 | 145 | // TODO: yuk. |
| 147 | 146 | if (defined("PUBLICMODE")) { |
| 148 | 147 | BootstrapSkin::displayPublicFooter(); |
| 149 | - } |
|
| 150 | - else { |
|
| 148 | + } else { |
|
| 151 | 149 | BootstrapSkin::displayInternalFooter(); |
| 152 | 150 | } |
| 153 | 151 | |
@@ -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 | |
@@ -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; |