@@ -88,11 +88,9 @@ discard block |
||
| 88 | 88 | if ($defaultAction === false) { |
| 89 | 89 | $statement = $database->prepare( |
| 90 | 90 | "SELECT * FROM `emailtemplate` WHERE defaultaction NOT IN ('created', 'not created') AND active = 1 AND domain = :domain;"); |
| 91 | - } |
|
| 92 | - elseif ($defaultAction === null) { |
|
| 91 | + } elseif ($defaultAction === null) { |
|
| 93 | 92 | $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE active = 1 AND domain = :domain;"); |
| 94 | - } |
|
| 95 | - else { |
|
| 93 | + } else { |
|
| 96 | 94 | $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE defaultaction = :forcreated AND active = 1 AND domain = :domain;"); |
| 97 | 95 | $statement->bindValue(":forcreated", $defaultAction); |
| 98 | 96 | } |
@@ -195,12 +193,10 @@ discard block |
||
| 195 | 193 | |
| 196 | 194 | if ($statement->execute()) { |
| 197 | 195 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 198 | - } |
|
| 199 | - else { |
|
| 196 | + } else { |
|
| 200 | 197 | throw new Exception($statement->errorInfo()); |
| 201 | 198 | } |
| 202 | - } |
|
| 203 | - else { |
|
| 199 | + } else { |
|
| 204 | 200 | // update |
| 205 | 201 | $statement = $this->dbObject->prepare(<<<SQL |
| 206 | 202 | UPDATE `emailtemplate` |
@@ -79,12 +79,10 @@ |
||
| 79 | 79 | |
| 80 | 80 | if ($statement->execute()) { |
| 81 | 81 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 82 | - } |
|
| 83 | - else { |
|
| 82 | + } else { |
|
| 84 | 83 | throw new Exception($statement->errorInfo()); |
| 85 | 84 | } |
| 86 | - } |
|
| 87 | - else { |
|
| 85 | + } else { |
|
| 88 | 86 | // update |
| 89 | 87 | throw new ApplicationLogicException('Updates to RequestData are not supported.'); |
| 90 | 88 | } |
@@ -56,12 +56,10 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | if ($user === false) { |
| 58 | 58 | self::$currentUser = new CommunityUser(); |
| 59 | - } |
|
| 60 | - else { |
|
| 59 | + } else { |
|
| 61 | 60 | self::$currentUser = $user; |
| 62 | 61 | } |
| 63 | - } |
|
| 64 | - else { |
|
| 62 | + } else { |
|
| 65 | 63 | $anonymousCoward = new CommunityUser(); |
| 66 | 64 | |
| 67 | 65 | self::$currentUser = $anonymousCoward; |
@@ -189,12 +187,10 @@ discard block |
||
| 189 | 187 | |
| 190 | 188 | if ($statement->execute()) { |
| 191 | 189 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 192 | - } |
|
| 193 | - else { |
|
| 190 | + } else { |
|
| 194 | 191 | throw new Exception($statement->errorInfo()); |
| 195 | 192 | } |
| 196 | - } |
|
| 197 | - else { |
|
| 193 | + } else { |
|
| 198 | 194 | // update |
| 199 | 195 | $statement = $this->dbObject->prepare(<<<SQL |
| 200 | 196 | UPDATE `user` SET |
@@ -393,12 +389,10 @@ discard block |
||
| 393 | 389 | if ($this->forceidentified === 0 || $this->forceidentified === "0") { |
| 394 | 390 | // User forced to unidentified in the database. |
| 395 | 391 | return false; |
| 396 | - } |
|
| 397 | - elseif ($this->forceidentified === 1 || $this->forceidentified === "1") { |
|
| 392 | + } elseif ($this->forceidentified === 1 || $this->forceidentified === "1") { |
|
| 398 | 393 | // User forced to identified in the database. |
| 399 | 394 | return true; |
| 400 | - } |
|
| 401 | - else { |
|
| 395 | + } else { |
|
| 402 | 396 | // User not forced to any particular identified status; consult IdentificationVerifier |
| 403 | 397 | return $iv->isUserIdentified($this->getOnWikiName()); |
| 404 | 398 | } |
@@ -108,12 +108,10 @@ |
||
| 108 | 108 | |
| 109 | 109 | if ($statement->execute()) { |
| 110 | 110 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 111 | - } |
|
| 112 | - else { |
|
| 111 | + } else { |
|
| 113 | 112 | throw new Exception($statement->errorInfo()); |
| 114 | 113 | } |
| 115 | - } |
|
| 116 | - else { |
|
| 114 | + } else { |
|
| 117 | 115 | // update |
| 118 | 116 | $statement = $this->dbObject->prepare(<<<SQL |
| 119 | 117 | UPDATE comment |
@@ -28,7 +28,8 @@ discard block |
||
| 28 | 28 | /** @var ?mixed */ |
| 29 | 29 | private $value; |
| 30 | 30 | |
| 31 | - public static function getLocalPreference(PdoDatabase $database, int $user, string $preference, int $domain) { |
|
| 31 | + public static function getLocalPreference(PdoDatabase $database, int $user, string $preference, int $domain) |
|
| 32 | + { |
|
| 32 | 33 | $statement = $database->prepare('SELECT * FROM userpreference WHERE preference = :preference AND USER = :user AND domain = :domain'); |
| 33 | 34 | $statement->execute([ |
| 34 | 35 | ':user' => $user, |
@@ -45,7 +46,8 @@ discard block |
||
| 45 | 46 | return $resultObject; |
| 46 | 47 | } |
| 47 | 48 | |
| 48 | - public static function getGlobalPreference(PdoDatabase $database, int $user, string $preference) { |
|
| 49 | + public static function getGlobalPreference(PdoDatabase $database, int $user, string $preference) |
|
| 50 | + { |
|
| 49 | 51 | $statement = $database->prepare('SELECT * FROM userpreference WHERE preference = :preference AND USER = :user AND domain IS NULL'); |
| 50 | 52 | $statement->execute([ |
| 51 | 53 | ':user' => $user, |
@@ -84,11 +86,10 @@ discard block |
||
| 84 | 86 | |
| 85 | 87 | if ($statement->execute()) { |
| 86 | 88 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 87 | - } |
|
| 88 | - else { |
|
| 89 | + } else { |
|
| 89 | 90 | throw new Exception($statement->errorInfo()); |
| 90 | 91 | } |
| 91 | - }else{ |
|
| 92 | + } else { |
|
| 92 | 93 | // update |
| 93 | 94 | $statement = $this->dbObject->prepare(<<<SQL |
| 94 | 95 | UPDATE `userpreference` SET |
@@ -101,12 +101,10 @@ |
||
| 101 | 101 | |
| 102 | 102 | if ($statement->execute()) { |
| 103 | 103 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 104 | - } |
|
| 105 | - else { |
|
| 104 | + } else { |
|
| 106 | 105 | throw new Exception($statement->errorInfo()); |
| 107 | 106 | } |
| 108 | - } |
|
| 109 | - else { |
|
| 107 | + } else { |
|
| 110 | 108 | // update |
| 111 | 109 | $statement = $this->dbObject->prepare(<<<SQL |
| 112 | 110 | UPDATE jobqueue SET |
@@ -258,12 +258,10 @@ |
||
| 258 | 258 | |
| 259 | 259 | if ($statement->execute()) { |
| 260 | 260 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 261 | - } |
|
| 262 | - else { |
|
| 261 | + } else { |
|
| 263 | 262 | throw new Exception($statement->errorInfo()); |
| 264 | 263 | } |
| 265 | - } |
|
| 266 | - else { |
|
| 264 | + } else { |
|
| 267 | 265 | $statement = $this->dbObject->prepare(<<<SQL |
| 268 | 266 | UPDATE requestqueue SET |
| 269 | 267 | enabled = :enabled, |
@@ -52,12 +52,10 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | if ($domain === false) { |
| 54 | 54 | self::$currentDomain = self::getById(1, $database); // FIXME: #594 User::getCurrent($database)->getDefaultDomain(); |
| 55 | - } |
|
| 56 | - else { |
|
| 55 | + } else { |
|
| 57 | 56 | self::$currentDomain = $domain; |
| 58 | 57 | } |
| 59 | - } |
|
| 60 | - else { |
|
| 58 | + } else { |
|
| 61 | 59 | self::$currentDomain = self::getById(1, $database); // FIXME: #594 User::getCurrent($database)->getDefaultDomain(); |
| 62 | 60 | } |
| 63 | 61 | } |
@@ -86,7 +84,8 @@ discard block |
||
| 86 | 84 | return $result; |
| 87 | 85 | } |
| 88 | 86 | |
| 89 | - public static function getAll(PdoDatabase $database) { |
|
| 87 | + public static function getAll(PdoDatabase $database) |
|
| 88 | + { |
|
| 90 | 89 | $statement = $database->prepare("SELECT * FROM domain;"); |
| 91 | 90 | $statement->execute(); |
| 92 | 91 | |
@@ -155,12 +154,10 @@ discard block |
||
| 155 | 154 | |
| 156 | 155 | if ($statement->execute()) { |
| 157 | 156 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 158 | - } |
|
| 159 | - else { |
|
| 157 | + } else { |
|
| 160 | 158 | throw new Exception($statement->errorInfo()); |
| 161 | 159 | } |
| 162 | - } |
|
| 163 | - else { |
|
| 160 | + } else { |
|
| 164 | 161 | $statement = $this->dbObject->prepare(<<<SQL |
| 165 | 162 | UPDATE domain SET |
| 166 | 163 | longname = :longname, |
@@ -264,8 +264,7 @@ |
||
| 264 | 264 | // Are we changing script? |
| 265 | 265 | if ($script === null || substr($currentScriptName, -1 * count($script)) === $script) { |
| 266 | 266 | $targetScriptName = $currentScriptName; |
| 267 | - } |
|
| 268 | - else { |
|
| 267 | + } else { |
|
| 269 | 268 | $targetScriptName = $this->getSiteConfiguration()->getBaseUrl() . '/' . $script; |
| 270 | 269 | } |
| 271 | 270 | |