@@ -48,8 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | if ($external) { |
| 50 | 50 | return $smarty->fetch("offline/external.tpl"); |
| 51 | - } |
|
| 52 | - else { |
|
| 51 | + } else { |
|
| 53 | 52 | $hideCulprit = true; |
| 54 | 53 | |
| 55 | 54 | // Use the provided message if possible |
@@ -340,8 +340,7 @@ discard block |
||
| 340 | 340 | if (count($pathInfo) === 0) { |
| 341 | 341 | // No pathInfo, so no page to load. Load the main page. |
| 342 | 342 | return $this->getDefaultRoute(); |
| 343 | - } |
|
| 344 | - elseif (count($pathInfo) === 1) { |
|
| 343 | + } elseif (count($pathInfo) === 1) { |
|
| 345 | 344 | // Exactly one path info segment, it's got to be a page. |
| 346 | 345 | $classSegment = $pathInfo[0]; |
| 347 | 346 | |
@@ -353,8 +352,7 @@ discard block |
||
| 353 | 352 | // Let's handle more than two, and collapse it down into two. |
| 354 | 353 | $requestedAction = array_pop($pathInfo); |
| 355 | 354 | $classSegment = implode('/', $pathInfo); |
| 356 | - } |
|
| 357 | - else { |
|
| 355 | + } else { |
|
| 358 | 356 | // Two path info segments. |
| 359 | 357 | $classSegment = $pathInfo[0]; |
| 360 | 358 | $requestedAction = $pathInfo[1]; |
@@ -383,8 +381,7 @@ discard block |
||
| 383 | 381 | $action = 'main'; |
| 384 | 382 | |
| 385 | 383 | return array($pageClass, $action); |
| 386 | - } |
|
| 387 | - else { |
|
| 384 | + } else { |
|
| 388 | 385 | // Doesn't exist in map. Fall back to 404 |
| 389 | 386 | $pageClass = Page404::class; |
| 390 | 387 | $action = "main"; |
@@ -413,16 +410,14 @@ discard block |
||
| 413 | 410 | $action = $requestedAction; |
| 414 | 411 | |
| 415 | 412 | return array($pageClass, $action); |
| 416 | - } |
|
| 417 | - else { |
|
| 413 | + } else { |
|
| 418 | 414 | // Valid page, invalid action. 404 our way out. |
| 419 | 415 | $pageClass = Page404::class; |
| 420 | 416 | $action = 'main'; |
| 421 | 417 | |
| 422 | 418 | return array($pageClass, $action); |
| 423 | 419 | } |
| 424 | - } |
|
| 425 | - else { |
|
| 420 | + } else { |
|
| 426 | 421 | // Class doesn't exist in map. Fall back to 404 |
| 427 | 422 | $pageClass = Page404::class; |
| 428 | 423 | $action = 'main'; |
@@ -40,13 +40,11 @@ |
||
| 40 | 40 | echo 'Error resolving hostname, it doesn\'t look like this domain exists.'; |
| 41 | 41 | die(); |
| 42 | 42 | } |
| 43 | - } |
|
| 44 | - else { |
|
| 43 | + } else { |
|
| 45 | 44 | $data = urlencode($data); |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | echo '<script>window.location.href=' . json_encode(str_replace("%DATA%", $data, $toolList[$tool])) . '</script>'; |
| 49 | -} |
|
| 50 | -else { |
|
| 48 | +} else { |
|
| 51 | 49 | header("Location: " . $_SERVER["REQUEST_URI"] . "&round2=true"); |
| 52 | 50 | } |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | && (get_class($input) === DateTime::class || get_class($input) === DateTimeImmutable::class) |
| 23 | 23 | ) { |
| 24 | 24 | $then = $input; |
| 25 | - } |
|
| 26 | - else { |
|
| 25 | + } else { |
|
| 27 | 26 | try { |
| 28 | 27 | $then = new DateTime($input); |
| 29 | 28 | } |
@@ -53,29 +52,21 @@ discard block |
||
| 53 | 52 | if ($secs <= 10) { |
| 54 | 53 | $output = "just now"; |
| 55 | 54 | $pluralise = false; |
| 56 | - } |
|
| 57 | - elseif ($secs > 10 && $secs < $minuteCut) { |
|
| 55 | + } elseif ($secs > 10 && $secs < $minuteCut) { |
|
| 58 | 56 | $output = round($secs / $second) . " second"; |
| 59 | - } |
|
| 60 | - elseif ($secs >= $minuteCut && $secs < $hourCut) { |
|
| 57 | + } elseif ($secs >= $minuteCut && $secs < $hourCut) { |
|
| 61 | 58 | $output = round($secs / $minute) . " minute"; |
| 62 | - } |
|
| 63 | - elseif ($secs >= $hourCut && $secs < $dayCut) { |
|
| 59 | + } elseif ($secs >= $hourCut && $secs < $dayCut) { |
|
| 64 | 60 | $output = round($secs / $hour) . " hour"; |
| 65 | - } |
|
| 66 | - elseif ($secs >= $dayCut && $secs < $weekCut) { |
|
| 61 | + } elseif ($secs >= $dayCut && $secs < $weekCut) { |
|
| 67 | 62 | $output = round($secs / $day) . " day"; |
| 68 | - } |
|
| 69 | - elseif ($secs >= $weekCut && $secs < $monthCut) { |
|
| 63 | + } elseif ($secs >= $weekCut && $secs < $monthCut) { |
|
| 70 | 64 | $output = round($secs / $week) . " week"; |
| 71 | - } |
|
| 72 | - elseif ($secs >= $monthCut && $secs < $yearCut) { |
|
| 65 | + } elseif ($secs >= $monthCut && $secs < $yearCut) { |
|
| 73 | 66 | $output = round($secs / $month) . " month"; |
| 74 | - } |
|
| 75 | - elseif ($secs >= $yearCut && $secs < $year * 10) { |
|
| 67 | + } elseif ($secs >= $yearCut && $secs < $year * 10) { |
|
| 76 | 68 | $output = round($secs / $year) . " year"; |
| 77 | - } |
|
| 78 | - else { |
|
| 69 | + } else { |
|
| 79 | 70 | $output = "a long time ago"; |
| 80 | 71 | $pluralise = false; |
| 81 | 72 | } |
@@ -94,8 +94,7 @@ |
||
| 94 | 94 | if (!$policyIsSet) { |
| 95 | 95 | $constructedPolicy .= "'none' "; |
| 96 | 96 | } |
| 97 | - } |
|
| 98 | - else { |
|
| 97 | + } else { |
|
| 99 | 98 | $constructedPolicy .= "'none' "; |
| 100 | 99 | } |
| 101 | 100 | |
@@ -90,12 +90,10 @@ |
||
| 90 | 90 | |
| 91 | 91 | if ($statement->execute()) { |
| 92 | 92 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 93 | - } |
|
| 94 | - else { |
|
| 93 | + } else { |
|
| 95 | 94 | throw new Exception($statement->errorInfo()); |
| 96 | 95 | } |
| 97 | - } |
|
| 98 | - else { |
|
| 96 | + } else { |
|
| 99 | 97 | $statement = $this->dbObject->prepare(<<<SQL |
| 100 | 98 | UPDATE oauthidentity SET |
| 101 | 99 | iss = :iss |
@@ -130,8 +130,7 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | if ($timeout === null) { |
| 132 | 132 | $this->timeout = null; |
| 133 | - } |
|
| 134 | - else { |
|
| 133 | + } else { |
|
| 135 | 134 | $this->timeout = $timeout->format('Y-m-d H:i:s'); |
| 136 | 135 | } |
| 137 | 136 | } |
@@ -188,12 +187,10 @@ discard block |
||
| 188 | 187 | |
| 189 | 188 | if ($statement->execute()) { |
| 190 | 189 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 191 | - } |
|
| 192 | - else { |
|
| 190 | + } else { |
|
| 193 | 191 | throw new Exception($statement->errorInfo()); |
| 194 | 192 | } |
| 195 | - } |
|
| 196 | - else { |
|
| 193 | + } else { |
|
| 197 | 194 | // update |
| 198 | 195 | $statement = $this->dbObject->prepare(<<<SQL |
| 199 | 196 | UPDATE credential |
@@ -42,12 +42,10 @@ |
||
| 42 | 42 | |
| 43 | 43 | if ($statement->execute()) { |
| 44 | 44 | $this->id = (int)$this->dbObject->lastInsertId(); |
| 45 | - } |
|
| 46 | - else { |
|
| 45 | + } else { |
|
| 47 | 46 | throw new Exception($statement->errorInfo()); |
| 48 | 47 | } |
| 49 | - } |
|
| 50 | - else { |
|
| 48 | + } else { |
|
| 51 | 49 | // update |
| 52 | 50 | $statement = $this->dbObject->prepare(<<<SQL |
| 53 | 51 | UPDATE oauthtoken |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $user = User::getByUsername($username, $database); |
| 68 | - } |
|
| 69 | - else { |
|
| 68 | + } else { |
|
| 70 | 69 | $user = User::getById($partialId, $database); |
| 71 | 70 | } |
| 72 | 71 | |
@@ -105,8 +104,7 @@ discard block |
||
| 105 | 104 | |
| 106 | 105 | return; |
| 107 | 106 | } |
| 108 | - } |
|
| 109 | - else { |
|
| 107 | + } else { |
|
| 110 | 108 | $this->assign('showSignIn', true); |
| 111 | 109 | |
| 112 | 110 | $this->setupPartial(); |
@@ -131,8 +129,7 @@ discard block |
||
| 131 | 129 | if (WebRequest::isHttps()) { |
| 132 | 130 | // Client can clearly use HTTPS, so let's enforce it for all connections. |
| 133 | 131 | $this->headerQueue[] = "Strict-Transport-Security: max-age=15768000"; |
| 134 | - } |
|
| 135 | - else { |
|
| 132 | + } else { |
|
| 136 | 133 | // This is the login form, not the request form. We need protection here. |
| 137 | 134 | $this->redirectUrl('https://' . WebRequest::serverName() . WebRequest::requestUri()); |
| 138 | 135 | |
@@ -166,8 +163,7 @@ discard block |
||
| 166 | 163 | $username = $this->partialUser->getUsername(); |
| 167 | 164 | |
| 168 | 165 | $this->setupAlternates($this->partialUser, $partialStage, $database); |
| 169 | - } |
|
| 170 | - else { |
|
| 166 | + } else { |
|
| 171 | 167 | // No, see if we've preloaded a username |
| 172 | 168 | $preloadUsername = WebRequest::getString('tplUsername'); |
| 173 | 169 | if ($preloadUsername !== null) { |
@@ -194,13 +190,11 @@ discard block |
||
| 194 | 190 | $redirectDestination = WebRequest::clearPostLoginRedirect(); |
| 195 | 191 | if ($redirectDestination !== null) { |
| 196 | 192 | $this->redirectUrl($redirectDestination); |
| 197 | - } |
|
| 198 | - else { |
|
| 193 | + } else { |
|
| 199 | 194 | if ($user->isNewUser()) { |
| 200 | 195 | // home page isn't allowed, go to preferences instead |
| 201 | 196 | $this->redirect('preferences'); |
| 202 | - } |
|
| 203 | - else { |
|
| 197 | + } else { |
|
| 204 | 198 | // go to the home page |
| 205 | 199 | $this->redirect(''); |
| 206 | 200 | } |
@@ -323,7 +317,8 @@ discard block |
||
| 323 | 317 | if (isset($types[$type])) { |
| 324 | 318 | $options = $types[$type]; |
| 325 | 319 | |
| 326 | - array_walk($options, function(&$val) { |
|
| 320 | + array_walk($options, function(&$val) |
|
| 321 | + { |
|
| 327 | 322 | $val = $this->names[$val]; |
| 328 | 323 | }); |
| 329 | 324 | |