@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | if (file_exists($filepath . "/includes/statistics/Stats" . $pageName . ".php")) { |
| 31 | 31 | // and include it. |
| 32 | 32 | require_once($filepath . "/includes/statistics/Stats" . $pageName . ".php"); |
| 33 | - } |
|
| 34 | - else { |
|
| 33 | + } else { |
|
| 35 | 34 | // class def doesn't exist: error |
| 36 | 35 | die("Unknown statistics page"); |
| 37 | 36 | } |
@@ -48,13 +47,11 @@ discard block |
||
| 48 | 47 | if (get_parent_class($object) == "StatisticsPage") { |
| 49 | 48 | // all is good, return the new statistics page object |
| 50 | 49 | return $object; |
| 51 | - } |
|
| 52 | - else { |
|
| 50 | + } else { |
|
| 53 | 51 | // oops. this is our class, named correctly, but it's a bad definition. |
| 54 | 52 | die("Unrecognised statistics page definition."); |
| 55 | 53 | } |
| 56 | - } |
|
| 57 | - else { |
|
| 54 | + } else { |
|
| 58 | 55 | // file exists, but no definition of the class |
| 59 | 56 | die("No definition for statistics page: " . $statsPage); |
| 60 | 57 | } |
@@ -16,15 +16,13 @@ |
||
| 16 | 16 | if(!isset($_GET['tool']) |
| 17 | 17 | || !isset($toolList[$_GET['tool']]) |
| 18 | 18 | || !isset($_GET['data']) |
| 19 | -) |
|
| 20 | -{ |
|
| 19 | +) { |
|
| 21 | 20 | header("HTTP/1.1 403 Forbidden"); |
| 22 | 21 | return; |
| 23 | 22 | } |
| 24 | 23 | |
| 25 | 24 | if (isset($_GET['round2'])) { |
| 26 | 25 | echo '<script>window.location.href=' . json_encode(str_replace("%DATA%", urlencode($_GET['data']), $toolList[$_GET['tool']])) . '</script>'; |
| 27 | -} |
|
| 28 | -else { |
|
| 26 | +} else { |
|
| 29 | 27 | header("Location: " . $_SERVER["REQUEST_URI"] . "&round2=true"); |
| 30 | 28 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | 'bgpview' => 'https://bgpview.io/ip/%DATA%' |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | -if(!isset($_GET['tool']) |
|
| 16 | +if (!isset($_GET['tool']) |
|
| 17 | 17 | || !isset($toolList[$_GET['tool']]) |
| 18 | 18 | || !isset($_GET['data']) |
| 19 | 19 | ) |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | foreach ($this->overrideTableTitles as $value) { |
| 60 | 60 | $out .= "<th>" . $value . "</th>"; |
| 61 | 61 | } |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | if (count($results) > 0) { |
| 65 | 64 | foreach ($results[0] as $k => $v) { |
| 66 | 65 | $out .= "<th>" . $k . "</th>"; |
@@ -75,8 +74,7 @@ discard block |
||
| 75 | 74 | $currentreq++; |
| 76 | 75 | if (function_exists($this->tableCallbackFunction)) { |
| 77 | 76 | $out .= call_user_func($this->tableCallbackFunction, $row, $currentreq); |
| 78 | - } |
|
| 79 | - else { |
|
| 77 | + } else { |
|
| 80 | 78 | $out .= '<tr>'; |
| 81 | 79 | |
| 82 | 80 | if ($this->numberedList == true) { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | /** Initialises the PHP Session */ |
| 30 | 30 | function initialiseSession() { |
| 31 | - session_start(); |
|
| 31 | + session_start(); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | "requests" => $requests, |
| 161 | 161 | "total" => $totalRequests, |
| 162 | 162 | "api" => $v['api'], |
| 163 | - "type" => $type); |
|
| 163 | + "type" => $type); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | global $smarty; |
@@ -27,7 +27,8 @@ discard block |
||
| 27 | 27 | $session = new session(); |
| 28 | 28 | |
| 29 | 29 | /** Initialises the PHP Session */ |
| 30 | -function initialiseSession() { |
|
| 30 | +function initialiseSession() |
|
| 31 | +{ |
|
| 31 | 32 | session_start(); |
| 32 | 33 | } |
| 33 | 34 | |
@@ -43,8 +44,7 @@ discard block |
||
| 43 | 44 | if (User::getCurrent()->getEmailSig() != "") { |
| 44 | 45 | $emailsig = html_entity_decode(User::getCurrent()->getEmailSig(), ENT_QUOTES, "UTF-8"); |
| 45 | 46 | mail($target, "RE: [ACC #$id] English Wikipedia Account Request", $template->getText() . "\n\n" . $emailsig, $headers); |
| 46 | - } |
|
| 47 | - else { |
|
| 47 | + } else { |
|
| 48 | 48 | mail($target, "RE: [ACC #$id] English Wikipedia Account Request", $template->getText(), $headers); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { |
| 60 | 60 | // Client <=> Proxy is encrypted |
| 61 | 61 | return true; |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | // Proxy <=> Server link is encrypted, but not Client <=> Proxy. |
| 65 | 64 | return false; |
| 66 | 65 | } |
@@ -93,11 +92,9 @@ discard block |
||
| 93 | 92 | if (isset($_GET['error'])) { |
| 94 | 93 | if ($_GET['error'] == 'authfail') { |
| 95 | 94 | $errorbartext = BootstrapSkin::displayAlertBox("Username and/or password incorrect. Please try again.", "alert-error", "Auth failure", true, false, true); |
| 96 | - } |
|
| 97 | - elseif ($_GET['error'] == 'noid') { |
|
| 95 | + } elseif ($_GET['error'] == 'noid') { |
|
| 98 | 96 | $errorbartext = BootstrapSkin::displayAlertBox("It doesn't look like you've signed the most recent version of the <a href=\"https://meta.wikimedia.org/wiki/Access_to_nonpublic_personal_data_policy\">access to nonpublic personal data policy</a>.</p><p>Please email [email protected] if you believe this is in error.", "alert-error", "Auth failure", true, false, true); |
| 99 | - } |
|
| 100 | - elseif ($_GET['error'] == 'newacct') { |
|
| 97 | + } elseif ($_GET['error'] == 'newacct') { |
|
| 101 | 98 | $errorbartext = BootstrapSkin::displayAlertBox("I'm sorry, but, your account has not been approved by a site administrator yet. Please stand by.", "alert-info", "Account pending", true, false, true); |
| 102 | 99 | } |
| 103 | 100 | } |
@@ -108,8 +105,7 @@ discard block |
||
| 108 | 105 | if (isHttps()) { |
| 109 | 106 | // Client can clearly use HTTPS, so let's enforce it for all connections. |
| 110 | 107 | header("Strict-Transport-Security: max-age=15768000"); |
| 111 | - } |
|
| 112 | - else { |
|
| 108 | + } else { |
|
| 113 | 109 | // This is the login form, not the request form. We need protection here. |
| 114 | 110 | $path = 'https://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; |
| 115 | 111 | header("Location: " . $path); |
@@ -130,8 +126,7 @@ discard block |
||
| 130 | 126 | if ($enableEmailConfirm == 1) { |
| 131 | 127 | $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed' LIMIT :lim;"; |
| 132 | 128 | $totalquery = "SELECT COUNT(*) FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
| 133 | - } |
|
| 134 | - else { |
|
| 129 | + } else { |
|
| 135 | 130 | $query = "SELECT * FROM request WHERE status = :type LIMIT :lim;"; |
| 136 | 131 | $totalquery = "SELECT COUNT(*) FROM request WHERE status = :type;"; |
| 137 | 132 | } |
@@ -195,8 +190,7 @@ discard block |
||
| 195 | 190 | |
| 196 | 191 | if ($val === $needle) { |
| 197 | 192 | return $path2; |
| 198 | - } |
|
| 199 | - else if (is_array($val)) { |
|
| 193 | + } else if (is_array($val)) { |
|
| 200 | 194 | if ($ret = array_search_recursive($needle, $val, $path2)) { |
| 201 | 195 | return $ret; |
| 202 | 196 | } |
@@ -336,29 +330,21 @@ discard block |
||
| 336 | 330 | if ($secs <= 10) { |
| 337 | 331 | $output = "just now"; |
| 338 | 332 | $pluralise = false; |
| 339 | - } |
|
| 340 | - elseif ($secs > 10 && $secs < $minuteCut) { |
|
| 333 | + } elseif ($secs > 10 && $secs < $minuteCut) { |
|
| 341 | 334 | $output = round($secs / $second) . " second"; |
| 342 | - } |
|
| 343 | - elseif ($secs >= $minuteCut && $secs < $hourCut) { |
|
| 335 | + } elseif ($secs >= $minuteCut && $secs < $hourCut) { |
|
| 344 | 336 | $output = round($secs / $minute) . " minute"; |
| 345 | - } |
|
| 346 | - elseif ($secs >= $hourCut && $secs < $dayCut) { |
|
| 337 | + } elseif ($secs >= $hourCut && $secs < $dayCut) { |
|
| 347 | 338 | $output = round($secs / $hour) . " hour"; |
| 348 | - } |
|
| 349 | - elseif ($secs >= $dayCut && $secs < $weekCut) { |
|
| 339 | + } elseif ($secs >= $dayCut && $secs < $weekCut) { |
|
| 350 | 340 | $output = round($secs / $day) . " day"; |
| 351 | - } |
|
| 352 | - elseif ($secs >= $weekCut && $secs < $month) { |
|
| 341 | + } elseif ($secs >= $weekCut && $secs < $month) { |
|
| 353 | 342 | $output = round($secs / $week) . " week"; |
| 354 | - } |
|
| 355 | - elseif ($secs >= $month && $secs < $year) { |
|
| 343 | + } elseif ($secs >= $month && $secs < $year) { |
|
| 356 | 344 | $output = round($secs / $month) . " month"; |
| 357 | - } |
|
| 358 | - elseif ($secs >= $year && $secs < $year * 10) { |
|
| 345 | + } elseif ($secs >= $year && $secs < $year * 10) { |
|
| 359 | 346 | $output = round($secs / $year) . " year"; |
| 360 | - } |
|
| 361 | - else { |
|
| 347 | + } else { |
|
| 362 | 348 | $output = "a long time ago"; |
| 363 | 349 | $pluralise = false; |
| 364 | 350 | } |
@@ -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 | |
@@ -2043,41 +2043,41 @@ |
||
| 2043 | 2043 | }); |
| 2044 | 2044 | } |
| 2045 | 2045 | elseif ($action == "listall") { |
| 2046 | - global $availableRequestStates, $enableEmailConfirm; |
|
| 2046 | + global $availableRequestStates, $enableEmailConfirm; |
|
| 2047 | 2047 | |
| 2048 | 2048 | if (isset($_GET['status']) && isset($availableRequestStates[$_GET['status']])) { |
| 2049 | 2049 | $type = $_GET['status']; // safe, we've verified it's sane in the above if statement. |
| 2050 | 2050 | |
| 2051 | - $database = gGetDb(); |
|
| 2051 | + $database = gGetDb(); |
|
| 2052 | 2052 | |
| 2053 | - if ($enableEmailConfirm == 1) { |
|
| 2054 | - $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
|
| 2055 | - } else { |
|
| 2056 | - $query = "SELECT * FROM request WHERE status = :type;"; |
|
| 2057 | - } |
|
| 2053 | + if ($enableEmailConfirm == 1) { |
|
| 2054 | + $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
|
| 2055 | + } else { |
|
| 2056 | + $query = "SELECT * FROM request WHERE status = :type;"; |
|
| 2057 | + } |
|
| 2058 | 2058 | |
| 2059 | - $statement = $database->prepare($query); |
|
| 2059 | + $statement = $database->prepare($query); |
|
| 2060 | 2060 | |
| 2061 | - $statement->bindValue(":type", $type); |
|
| 2062 | - $statement->execute(); |
|
| 2061 | + $statement->bindValue(":type", $type); |
|
| 2062 | + $statement->execute(); |
|
| 2063 | 2063 | |
| 2064 | - $requests = $statement->fetchAll(PDO::FETCH_CLASS, "Request"); |
|
| 2065 | - foreach ($requests as $req) { |
|
| 2066 | - /** @var Request $req */ |
|
| 2067 | - $req->setDatabase($database); |
|
| 2068 | - } |
|
| 2064 | + $requests = $statement->fetchAll(PDO::FETCH_CLASS, "Request"); |
|
| 2065 | + foreach ($requests as $req) { |
|
| 2066 | + /** @var Request $req */ |
|
| 2067 | + $req->setDatabase($database); |
|
| 2068 | + } |
|
| 2069 | 2069 | |
| 2070 | - global $smarty; |
|
| 2071 | - $smarty->assign("requests", $requests); |
|
| 2072 | - $smarty->assign("showStatus", false); |
|
| 2073 | - $html = $smarty->fetch("mainpage/requesttable.tpl"); |
|
| 2074 | - echo $html; |
|
| 2075 | - } else { |
|
| 2076 | - echo defaultpage(); |
|
| 2077 | - } |
|
| 2070 | + global $smarty; |
|
| 2071 | + $smarty->assign("requests", $requests); |
|
| 2072 | + $smarty->assign("showStatus", false); |
|
| 2073 | + $html = $smarty->fetch("mainpage/requesttable.tpl"); |
|
| 2074 | + echo $html; |
|
| 2075 | + } else { |
|
| 2076 | + echo defaultpage(); |
|
| 2077 | + } |
|
| 2078 | 2078 | |
| 2079 | - BootstrapSkin::displayInternalFooter(); |
|
| 2080 | - die(); |
|
| 2079 | + BootstrapSkin::displayInternalFooter(); |
|
| 2080 | + die(); |
|
| 2081 | 2081 | } |
| 2082 | 2082 | # If the action specified does not exist, goto the default page. |
| 2083 | 2083 | else { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | elseif ($action == "sreg") { |
| 106 | 106 | global $useOauthSignup, $smarty, $allowRegistration; |
| 107 | 107 | |
| 108 | - if(!$allowRegistration) { |
|
| 108 | + if (!$allowRegistration) { |
|
| 109 | 109 | $smarty->display("registration/registerdisabled.tpl"); |
| 110 | 110 | BootstrapSkin::displayInternalFooter(); |
| 111 | 111 | die(); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | elseif ($action == "register") { |
| 216 | 216 | global $useOauthSignup, $smarty, $allowRegistration; |
| 217 | - if($allowRegistration) { |
|
| 217 | + if ($allowRegistration) { |
|
| 218 | 218 | $smarty->assign("useOauthSignup", $useOauthSignup); |
| 219 | 219 | $smarty->display("registration/register.tpl"); |
| 220 | 220 | } else { |
@@ -77,8 +77,7 @@ discard block |
||
| 77 | 77 | echo showlogin(); |
| 78 | 78 | BootstrapSkin::displayInternalFooter(); |
| 79 | 79 | die(); |
| 80 | - } |
|
| 81 | - else { |
|
| 80 | + } else { |
|
| 82 | 81 | // A content block is created if the action is none of the above. |
| 83 | 82 | // This block would later be used to keep all the HTML except the header and footer. |
| 84 | 83 | $out = "<div id=\"content\">"; |
@@ -101,8 +100,7 @@ discard block |
||
| 101 | 100 | echo defaultpage(); |
| 102 | 101 | BootstrapSkin::displayInternalFooter(); |
| 103 | 102 | die(); |
| 104 | -} |
|
| 105 | -elseif ($action == "sreg") { |
|
| 103 | +} elseif ($action == "sreg") { |
|
| 106 | 104 | global $useOauthSignup, $smarty, $allowRegistration; |
| 107 | 105 | |
| 108 | 106 | if(!$allowRegistration) { |
@@ -202,8 +200,7 @@ discard block |
||
| 202 | 200 | 0, |
| 203 | 201 | $ex); |
| 204 | 202 | } |
| 205 | - } |
|
| 206 | - else { |
|
| 203 | + } else { |
|
| 207 | 204 | global $baseurl; |
| 208 | 205 | Notification::userNew($newUser); |
| 209 | 206 | header("Location: {$baseurl}/acc.php?action=registercomplete"); |
@@ -211,8 +208,7 @@ discard block |
||
| 211 | 208 | }); |
| 212 | 209 | |
| 213 | 210 | die(); |
| 214 | -} |
|
| 215 | -elseif ($action == "register") { |
|
| 211 | +} elseif ($action == "register") { |
|
| 216 | 212 | global $useOauthSignup, $smarty, $allowRegistration; |
| 217 | 213 | if($allowRegistration) { |
| 218 | 214 | $smarty->assign("useOauthSignup", $useOauthSignup); |
@@ -222,12 +218,10 @@ discard block |
||
| 222 | 218 | } |
| 223 | 219 | BootstrapSkin::displayInternalFooter(); |
| 224 | 220 | die(); |
| 225 | -} |
|
| 226 | -elseif ($action == "registercomplete") { |
|
| 221 | +} elseif ($action == "registercomplete") { |
|
| 227 | 222 | $smarty->display("registration/alert-registrationcomplete.tpl"); |
| 228 | 223 | BootstrapSkin::displayInternalFooter(); |
| 229 | -} |
|
| 230 | -elseif ($action == "forgotpw") { |
|
| 224 | +} elseif ($action == "forgotpw") { |
|
| 231 | 225 | global $baseurl, $smarty; |
| 232 | 226 | |
| 233 | 227 | if (isset ($_GET['si']) && isset ($_GET['id'])) { |
@@ -256,14 +250,12 @@ discard block |
||
| 256 | 250 | |
| 257 | 251 | BootstrapSkin::displayInternalFooter(); |
| 258 | 252 | die(); |
| 259 | - } |
|
| 260 | - else { |
|
| 253 | + } else { |
|
| 261 | 254 | BootstrapSkin::displayAlertBox("Passwords did not match!", "alert-error", "Error", true, false); |
| 262 | 255 | BootstrapSkin::displayInternalFooter(); |
| 263 | 256 | die(); |
| 264 | 257 | } |
| 265 | - } |
|
| 266 | - else { |
|
| 258 | + } else { |
|
| 267 | 259 | BootstrapSkin::displayAlertBox("Invalid request<!-- 1 -->", "alert-error", "Error", true, false); |
| 268 | 260 | BootstrapSkin::displayInternalFooter(); |
| 269 | 261 | die(); |
@@ -277,8 +269,7 @@ discard block |
||
| 277 | 269 | $smarty->assign('si', $_GET['si']); |
| 278 | 270 | $smarty->assign('id', $_GET['id']); |
| 279 | 271 | $smarty->display('forgot-password/forgotpwreset.tpl'); |
| 280 | - } |
|
| 281 | - else { |
|
| 272 | + } else { |
|
| 282 | 273 | BootstrapSkin::displayAlertBox( |
| 283 | 274 | "The hash supplied in the link did not match the hash in the database!", |
| 284 | 275 | "alert-error", |
@@ -304,8 +295,7 @@ discard block |
||
| 304 | 295 | |
| 305 | 296 | BootstrapSkin::displayInternalFooter(); |
| 306 | 297 | die(); |
| 307 | - } |
|
| 308 | - elseif (strtolower($_POST['email']) != strtolower($user->getEmail())) { |
|
| 298 | + } elseif (strtolower($_POST['email']) != strtolower($user->getEmail())) { |
|
| 309 | 299 | BootstrapSkin::displayAlertBox("Could not find user with that username and email address!", |
| 310 | 300 | "alert-error", |
| 311 | 301 | "Error", |
@@ -314,8 +304,7 @@ discard block |
||
| 314 | 304 | |
| 315 | 305 | BootstrapSkin::displayInternalFooter(); |
| 316 | 306 | die(); |
| 317 | - } |
|
| 318 | - else { |
|
| 307 | + } else { |
|
| 319 | 308 | $hash = $user->getForgottenPasswordHash(); |
| 320 | 309 | |
| 321 | 310 | $smarty->assign("user", $user); |
@@ -347,8 +336,7 @@ discard block |
||
| 347 | 336 | |
| 348 | 337 | BootstrapSkin::displayInternalFooter(); |
| 349 | 338 | die(); |
| 350 | -} |
|
| 351 | -elseif ($action == "login") { |
|
| 339 | +} elseif ($action == "login") { |
|
| 352 | 340 | global $baseurl, $smarty; |
| 353 | 341 | |
| 354 | 342 | if (!isset($_POST['username'])) { |
@@ -379,8 +367,7 @@ discard block |
||
| 379 | 367 | |
| 380 | 368 | reattachOAuthAccount($user); |
| 381 | 369 | } |
| 382 | - } |
|
| 383 | - else { |
|
| 370 | + } else { |
|
| 384 | 371 | global $enforceOAuth; |
| 385 | 372 | |
| 386 | 373 | if ($enforceOAuth) { |
@@ -463,8 +450,7 @@ discard block |
||
| 463 | 450 | } |
| 464 | 451 | |
| 465 | 452 | header("Location: $baseurl/acc.php"); |
| 466 | -} |
|
| 467 | -elseif ($action == "messagemgmt") { |
|
| 453 | +} elseif ($action == "messagemgmt") { |
|
| 468 | 454 | global $smarty; |
| 469 | 455 | |
| 470 | 456 | if (isset($_GET['view'])) { |
@@ -548,8 +534,7 @@ discard block |
||
| 548 | 534 | |
| 549 | 535 | BootstrapSkin::displayInternalFooter(); |
| 550 | 536 | die(); |
| 551 | -} |
|
| 552 | -elseif ($action == "templatemgmt") { |
|
| 537 | +} elseif ($action == "templatemgmt") { |
|
| 553 | 538 | global $baseurl, $smarty; |
| 554 | 539 | |
| 555 | 540 | if (isset($_GET['view'])) { |
@@ -595,15 +580,13 @@ discard block |
||
| 595 | 580 | SessionAlert::success("Template successfully created."); |
| 596 | 581 | header("Location: $baseurl/acc.php?action=templatemgmt"); |
| 597 | 582 | }); |
| 598 | - } |
|
| 599 | - else { |
|
| 583 | + } else { |
|
| 600 | 584 | |
| 601 | 585 | if (isset($_POST['preview'])) { |
| 602 | 586 | $usercode = $_POST['usercode']; |
| 603 | 587 | $botcode = $_POST['botcode']; |
| 604 | 588 | echo displayPreview($usercode); |
| 605 | - } |
|
| 606 | - else { |
|
| 589 | + } else { |
|
| 607 | 590 | $usercode = ''; |
| 608 | 591 | $botcode = ''; |
| 609 | 592 | } |
@@ -629,8 +612,7 @@ discard block |
||
| 629 | 612 | SessionAlert::success("Disabled automatic user welcoming."); |
| 630 | 613 | header("Location: {$baseurl}/acc.php?action=templatemgmt"); |
| 631 | 614 | die(); |
| 632 | - } |
|
| 633 | - else { |
|
| 615 | + } else { |
|
| 634 | 616 | $template = WelcomeTemplate::getById($_GET['select'], gGetDb()); |
| 635 | 617 | if ($template !== false) { |
| 636 | 618 | $user->setWelcomeTemplate($template->getId()); |
@@ -639,8 +621,7 @@ discard block |
||
| 639 | 621 | SessionAlert::success("Updated selected welcome template for automatic welcoming."); |
| 640 | 622 | header("Location: {$baseurl}/acc.php?action=templatemgmt"); |
| 641 | 623 | die(); |
| 642 | - } |
|
| 643 | - else { |
|
| 624 | + } else { |
|
| 644 | 625 | SessionAlert::error("Something went wrong, we can't find the template you asked for!"); |
| 645 | 626 | header("Location: {$baseurl}/acc.php?action=templatemgmt"); |
| 646 | 627 | die(); |
@@ -717,8 +698,7 @@ discard block |
||
| 717 | 698 | |
| 718 | 699 | header("Location: $baseurl/acc.php?action=templatemgmt"); |
| 719 | 700 | die(); |
| 720 | - } |
|
| 721 | - else { |
|
| 701 | + } else { |
|
| 722 | 702 | $smarty->assign("template", $template); |
| 723 | 703 | $smarty->display("welcometemplate/edit.tpl"); |
| 724 | 704 | |
@@ -734,8 +714,7 @@ discard block |
||
| 734 | 714 | |
| 735 | 715 | BootstrapSkin::displayInternalFooter(); |
| 736 | 716 | die(); |
| 737 | -} |
|
| 738 | -elseif ($action == "sban") { |
|
| 717 | +} elseif ($action == "sban") { |
|
| 739 | 718 | global $smarty; |
| 740 | 719 | |
| 741 | 720 | // Checks whether the current user is an admin. |
@@ -763,21 +742,18 @@ discard block |
||
| 763 | 742 | |
| 764 | 743 | if ($duration == "-1") { |
| 765 | 744 | $duration = -1; |
| 766 | - } |
|
| 767 | - elseif ($duration == "other") { |
|
| 745 | + } elseif ($duration == "other") { |
|
| 768 | 746 | $duration = strtotime($_POST['otherduration']); |
| 769 | 747 | if (!$duration) { |
| 770 | 748 | BootstrapSkin::displayAlertBox("Invalid ban time", "alert-error", "", false, false); |
| 771 | 749 | BootstrapSkin::displayInternalFooter(); |
| 772 | 750 | die(); |
| 773 | - } |
|
| 774 | - elseif (time() > $duration) { |
|
| 751 | + } elseif (time() > $duration) { |
|
| 775 | 752 | BootstrapSkin::displayAlertBox("Ban time has already expired!", "alert-error", "", false, false); |
| 776 | 753 | BootstrapSkin::displayInternalFooter(); |
| 777 | 754 | die(); |
| 778 | 755 | } |
| 779 | - } |
|
| 780 | - else { |
|
| 756 | + } else { |
|
| 781 | 757 | $duration = $duration + time(); |
| 782 | 758 | } |
| 783 | 759 | |
@@ -857,8 +833,7 @@ discard block |
||
| 857 | 833 | |
| 858 | 834 | BootstrapSkin::displayInternalFooter(); |
| 859 | 835 | die(); |
| 860 | -} |
|
| 861 | -elseif ($action == "unban") { |
|
| 836 | +} elseif ($action == "unban") { |
|
| 862 | 837 | global $smarty; |
| 863 | 838 | |
| 864 | 839 | if (!isset($_GET['id']) || $_GET['id'] == "") { |
@@ -897,8 +872,7 @@ discard block |
||
| 897 | 872 | BootstrapSkin::displayAlertBox("You must enter an unban reason!", "alert-error", "", false, false); |
| 898 | 873 | BootstrapSkin::displayInternalFooter(); |
| 899 | 874 | die(); |
| 900 | - } |
|
| 901 | - else { |
|
| 875 | + } else { |
|
| 902 | 876 | $database = gGetDb(); |
| 903 | 877 | |
| 904 | 878 | $database->transactionally(function() use ($database, $ban) |
@@ -917,15 +891,13 @@ discard block |
||
| 917 | 891 | Notification::unbanned($ban, $_POST['unbanreason']); |
| 918 | 892 | die(); |
| 919 | 893 | } |
| 920 | - } |
|
| 921 | - else { |
|
| 894 | + } else { |
|
| 922 | 895 | $smarty->assign("ban", $ban); |
| 923 | 896 | $smarty->display("bans/unban.tpl"); |
| 924 | 897 | |
| 925 | 898 | BootstrapSkin::displayInternalFooter(); |
| 926 | 899 | } |
| 927 | -} |
|
| 928 | -elseif ($action == "ban") { |
|
| 900 | +} elseif ($action == "ban") { |
|
| 929 | 901 | global $smarty; |
| 930 | 902 | |
| 931 | 903 | if (isset ($_GET['ip']) || isset ($_GET['email']) || isset ($_GET['name'])) { |
@@ -945,8 +917,7 @@ discard block |
||
| 945 | 917 | $row = $statement->fetch(PDO::FETCH_ASSOC); |
| 946 | 918 | $target = getTrustedClientIP($row['ip'], $row['forwardedip']); |
| 947 | 919 | $type = "IP"; |
| 948 | - } |
|
| 949 | - elseif (isset($_GET['email'])) { |
|
| 920 | + } elseif (isset($_GET['email'])) { |
|
| 950 | 921 | $query = "SELECT email FROM request WHERE id = :ip;"; |
| 951 | 922 | $statement = $database->prepare($query); |
| 952 | 923 | $statement->bindValue(":ip", $_GET['email']); |
@@ -954,8 +925,7 @@ discard block |
||
| 954 | 925 | $row = $statement->fetch(PDO::FETCH_ASSOC); |
| 955 | 926 | $target = $row['email']; |
| 956 | 927 | $type = "EMail"; |
| 957 | - } |
|
| 958 | - elseif (isset($_GET['name'])) { |
|
| 928 | + } elseif (isset($_GET['name'])) { |
|
| 959 | 929 | $query = "SELECT name FROM request WHERE id = :ip;"; |
| 960 | 930 | $statement = $database->prepare($query); |
| 961 | 931 | $statement->bindValue(":ip", $_GET['name']); |
@@ -963,8 +933,7 @@ discard block |
||
| 963 | 933 | $row = $statement->fetch(PDO::FETCH_ASSOC); |
| 964 | 934 | $target = $row['name']; |
| 965 | 935 | $type = "Name"; |
| 966 | - } |
|
| 967 | - else { |
|
| 936 | + } else { |
|
| 968 | 937 | BootstrapSkin::displayAlertBox("Unknown ban type.", "alert-error"); |
| 969 | 938 | BootstrapSkin::displayInternalFooter(); |
| 970 | 939 | die(); |
@@ -979,8 +948,7 @@ discard block |
||
| 979 | 948 | $smarty->assign("bantype", $type); |
| 980 | 949 | $smarty->assign("bantarget", trim($target)); |
| 981 | 950 | $smarty->display("bans/banform.tpl"); |
| 982 | - } |
|
| 983 | - else { |
|
| 951 | + } else { |
|
| 984 | 952 | $bans = Ban::getActiveBans(); |
| 985 | 953 | |
| 986 | 954 | $smarty->assign("activebans", $bans); |
@@ -989,8 +957,7 @@ discard block |
||
| 989 | 957 | |
| 990 | 958 | BootstrapSkin::displayInternalFooter(); |
| 991 | 959 | die(); |
| 992 | -} |
|
| 993 | -elseif ($action == "defer" && $_GET['id'] != "" && $_GET['sum'] != "") { |
|
| 960 | +} elseif ($action == "defer" && $_GET['id'] != "" && $_GET['sum'] != "") { |
|
| 994 | 961 | global $availableRequestStates; |
| 995 | 962 | |
| 996 | 963 | if (array_key_exists($_GET['target'], $availableRequestStates)) { |
@@ -1071,14 +1038,12 @@ discard block |
||
| 1071 | 1038 | }); |
| 1072 | 1039 | |
| 1073 | 1040 | die(); |
| 1074 | - } |
|
| 1075 | - else { |
|
| 1041 | + } else { |
|
| 1076 | 1042 | BootstrapSkin::displayAlertBox("Defer target not valid.", "alert-error", "Error", true, false); |
| 1077 | 1043 | BootstrapSkin::displayInternalFooter(); |
| 1078 | 1044 | die(); |
| 1079 | 1045 | } |
| 1080 | -} |
|
| 1081 | -elseif ($action == "prefs") { |
|
| 1046 | +} elseif ($action == "prefs") { |
|
| 1082 | 1047 | global $smarty, $enforceOAuth; |
| 1083 | 1048 | |
| 1084 | 1049 | if (isset ($_POST['sig'])) { |
@@ -1092,8 +1057,7 @@ discard block |
||
| 1092 | 1057 | |
| 1093 | 1058 | if ($mailisvalid === false) { |
| 1094 | 1059 | BootstrapSkin::displayAlertBox("Invalid email address", "alert-error", "Error!"); |
| 1095 | - } |
|
| 1096 | - else { |
|
| 1060 | + } else { |
|
| 1097 | 1061 | $user->setEmail(trim($_POST['email'])); |
| 1098 | 1062 | } |
| 1099 | 1063 | } |
@@ -1114,20 +1078,17 @@ discard block |
||
| 1114 | 1078 | $smarty->display("prefs.tpl"); |
| 1115 | 1079 | BootstrapSkin::displayInternalFooter(); |
| 1116 | 1080 | die(); |
| 1117 | -} |
|
| 1118 | -elseif ($action == "done" && $_GET['id'] != "") { |
|
| 1081 | +} elseif ($action == "done" && $_GET['id'] != "") { |
|
| 1119 | 1082 | // check for valid close reasons |
| 1120 | 1083 | global $messages, $baseurl, $smarty; |
| 1121 | 1084 | |
| 1122 | 1085 | if (isset($_GET['email'])) { |
| 1123 | 1086 | if ($_GET['email'] == 0 || $_GET['email'] == "custom") { |
| 1124 | 1087 | $validEmail = true; |
| 1125 | - } |
|
| 1126 | - else { |
|
| 1088 | + } else { |
|
| 1127 | 1089 | $validEmail = EmailTemplate::getById($_GET['email'], gGetDb()) != false; |
| 1128 | 1090 | } |
| 1129 | - } |
|
| 1130 | - else { |
|
| 1091 | + } else { |
|
| 1131 | 1092 | $validEmail = false; |
| 1132 | 1093 | } |
| 1133 | 1094 | |
@@ -1193,8 +1154,7 @@ discard block |
||
| 1193 | 1154 | $ue = unserialize($userexist); |
| 1194 | 1155 | if (!isset ($ue['query']['users']['0']['missing'])) { |
| 1195 | 1156 | $exists = true; |
| 1196 | - } |
|
| 1197 | - else { |
|
| 1157 | + } else { |
|
| 1198 | 1158 | $exists = false; |
| 1199 | 1159 | } |
| 1200 | 1160 | |
@@ -1236,8 +1196,7 @@ discard block |
||
| 1236 | 1196 | $preloadTitle = $template->getName(); |
| 1237 | 1197 | $preloadText = $template->getText(); |
| 1238 | 1198 | $preloadAction = $template->getDefaultAction(); |
| 1239 | - } |
|
| 1240 | - else { |
|
| 1199 | + } else { |
|
| 1241 | 1200 | $preloadText = ""; |
| 1242 | 1201 | $preloadTitle = ""; |
| 1243 | 1202 | $preloadAction = ""; |
@@ -1275,8 +1234,7 @@ discard block |
||
| 1275 | 1234 | if (User::getCurrent()->getEmailSig() != "") { |
| 1276 | 1235 | $emailsig = html_entity_decode(User::getCurrent()->getEmailSig(), ENT_QUOTES, "UTF-8"); |
| 1277 | 1236 | mail($request->getEmail(), "RE: [ACC #{$request->getId()}] English Wikipedia Account Request", $_POST['msgbody'] . "\n\n" . $emailsig, $headers); |
| 1278 | - } |
|
| 1279 | - else { |
|
| 1237 | + } else { |
|
| 1280 | 1238 | mail($request->getEmail(), "RE: [ACC #{$request->getId()}] English Wikipedia Account Request", $_POST['msgbody'], $headers); |
| 1281 | 1239 | } |
| 1282 | 1240 | |
@@ -1289,8 +1247,7 @@ discard block |
||
| 1289 | 1247 | if ($_POST['action'] == EmailTemplate::CREATED) { |
| 1290 | 1248 | $gem = 'custom-y'; |
| 1291 | 1249 | $crea = "Custom, Created"; |
| 1292 | - } |
|
| 1293 | - else { |
|
| 1250 | + } else { |
|
| 1294 | 1251 | $gem = 'custom-n'; |
| 1295 | 1252 | $crea = "Custom, Not Created"; |
| 1296 | 1253 | } |
@@ -1301,8 +1258,7 @@ discard block |
||
| 1301 | 1258 | BootstrapSkin::displayAlertBox( |
| 1302 | 1259 | "Request " . $request->getId() . " (" . htmlentities($request->getName(), ENT_COMPAT, 'UTF-8') . ") marked as '" . htmlentities($crea, ENT_COMPAT, 'UTF-8') . "'.", |
| 1303 | 1260 | "alert-success"); |
| 1304 | - } |
|
| 1305 | - else if ($_POST['action'] == "mail") { |
|
| 1261 | + } else if ($_POST['action'] == "mail") { |
|
| 1306 | 1262 | // no action other than send mail! |
| 1307 | 1263 | Logger::sentMail(gGetDb(), $request, $messageBody); |
| 1308 | 1264 | Logger::unreserve(gGetDb(), $request); |
@@ -1310,8 +1266,7 @@ discard block |
||
| 1310 | 1266 | Notification::sentMail($request); |
| 1311 | 1267 | BootstrapSkin::displayAlertBox("Sent mail to Request {$request->getId()}", |
| 1312 | 1268 | "alert-success"); |
| 1313 | - } |
|
| 1314 | - else if (array_key_exists($_POST['action'], $availableRequestStates)) { |
|
| 1269 | + } else if (array_key_exists($_POST['action'], $availableRequestStates)) { |
|
| 1315 | 1270 | // Defer |
| 1316 | 1271 | |
| 1317 | 1272 | $request->setStatus($_POST['action']); |
@@ -1324,8 +1279,7 @@ discard block |
||
| 1324 | 1279 | Notification::requestDeferredWithMail($request); |
| 1325 | 1280 | BootstrapSkin::displayAlertBox("Request {$request->getId()} deferred to $deto, sending an email.", |
| 1326 | 1281 | "alert-success"); |
| 1327 | - } |
|
| 1328 | - else { |
|
| 1282 | + } else { |
|
| 1329 | 1283 | // hmm. not sure what happened. Log that we sent the mail anyway. |
| 1330 | 1284 | Logger::sentMail(gGetDb(), $request, $messageBody); |
| 1331 | 1285 | Logger::unreserve(gGetDb(), $request); |
@@ -1344,8 +1298,7 @@ discard block |
||
| 1344 | 1298 | echo defaultpage(); |
| 1345 | 1299 | BootstrapSkin::displayInternalFooter(); |
| 1346 | 1300 | die(); |
| 1347 | - } |
|
| 1348 | - else { |
|
| 1301 | + } else { |
|
| 1349 | 1302 | // Not a custom close, just a normal close |
| 1350 | 1303 | |
| 1351 | 1304 | $request->setStatus('Closed'); |
@@ -1358,8 +1311,7 @@ discard block |
||
| 1358 | 1311 | |
| 1359 | 1312 | if ($gem == '0') { |
| 1360 | 1313 | $crea = "Dropped"; |
| 1361 | - } |
|
| 1362 | - else { |
|
| 1314 | + } else { |
|
| 1363 | 1315 | $template = EmailTemplate::getById($gem, gGetDb()); |
| 1364 | 1316 | $crea = $template->getName(); |
| 1365 | 1317 | } |
@@ -1380,8 +1332,7 @@ discard block |
||
| 1380 | 1332 | BootstrapSkin::displayInternalFooter(); |
| 1381 | 1333 | die(); |
| 1382 | 1334 | } |
| 1383 | -} |
|
| 1384 | -elseif ($action == "zoom") { |
|
| 1335 | +} elseif ($action == "zoom") { |
|
| 1385 | 1336 | if (!isset($_GET['id'])) { |
| 1386 | 1337 | BootstrapSkin::displayAlertBox("No request specified!", "alert-error", "Error!", true, false); |
| 1387 | 1338 | BootstrapSkin::displayInternalFooter(); |
@@ -1390,8 +1341,7 @@ discard block |
||
| 1390 | 1341 | |
| 1391 | 1342 | if (isset($_GET['hash'])) { |
| 1392 | 1343 | $urlhash = $_GET['hash']; |
| 1393 | - } |
|
| 1394 | - else { |
|
| 1344 | + } else { |
|
| 1395 | 1345 | $urlhash = ""; |
| 1396 | 1346 | } |
| 1397 | 1347 | echo zoomPage($_GET['id'], $urlhash); |
@@ -1399,8 +1349,7 @@ discard block |
||
| 1399 | 1349 | $tailscript = getTypeaheadSource(User::getAllUsernames(gGetDb())); |
| 1400 | 1350 | BootstrapSkin::displayInternalFooter($tailscript); |
| 1401 | 1351 | die(); |
| 1402 | -} |
|
| 1403 | -elseif ($action == "logs") { |
|
| 1352 | +} elseif ($action == "logs") { |
|
| 1404 | 1353 | global $baseurl; |
| 1405 | 1354 | |
| 1406 | 1355 | $filterUser = isset($_GET['filterUser']) && $_GET['filterUser'] != "" ? $_GET['filterUser'] : false; |
@@ -1448,11 +1397,9 @@ discard block |
||
| 1448 | 1397 | if ($pageCount < $pageLimit) { |
| 1449 | 1398 | if ($pageData['lowpage'] == 1 && $pageData['hipage'] == $pageData['maxpage']) { |
| 1450 | 1399 | // nothing to do, we're already at max range. |
| 1451 | - } |
|
| 1452 | - elseif ($pageData['lowpage'] == 1 && $pageData['hipage'] < $pageData['maxpage']) { |
|
| 1400 | + } elseif ($pageData['lowpage'] == 1 && $pageData['hipage'] < $pageData['maxpage']) { |
|
| 1453 | 1401 | $pageData['hipage'] = min($pageLimit, $pageData['maxpage']); |
| 1454 | - } |
|
| 1455 | - elseif ($pageData['lowpage'] > 1 && $pageData['hipage'] == $pageData['maxpage']) { |
|
| 1402 | + } elseif ($pageData['lowpage'] > 1 && $pageData['hipage'] == $pageData['maxpage']) { |
|
| 1456 | 1403 | $pageData['lowpage'] = max(1, $pageData['maxpage'] - $pageLimit + 1); |
| 1457 | 1404 | } |
| 1458 | 1405 | } |
@@ -1475,8 +1422,7 @@ discard block |
||
| 1475 | 1422 | |
| 1476 | 1423 | BootstrapSkin::displayInternalFooter($tailscript); |
| 1477 | 1424 | die(); |
| 1478 | -} |
|
| 1479 | -elseif ($action == "reserve") { |
|
| 1425 | +} elseif ($action == "reserve") { |
|
| 1480 | 1426 | $database = gGetDb(); |
| 1481 | 1427 | |
| 1482 | 1428 | $database->transactionally(function() use ($database) |
@@ -1552,8 +1498,7 @@ discard block |
||
| 1552 | 1498 | }); |
| 1553 | 1499 | |
| 1554 | 1500 | die(); |
| 1555 | -} |
|
| 1556 | -elseif ($action == "breakreserve") { |
|
| 1501 | +} elseif ($action == "breakreserve") { |
|
| 1557 | 1502 | global $smarty; |
| 1558 | 1503 | |
| 1559 | 1504 | $database = gGetDb(); |
@@ -1595,20 +1540,17 @@ discard block |
||
| 1595 | 1540 | }); |
| 1596 | 1541 | |
| 1597 | 1542 | die(); |
| 1598 | - } |
|
| 1599 | - else { |
|
| 1543 | + } else { |
|
| 1600 | 1544 | global $baseurl; |
| 1601 | 1545 | $smarty->assign("reservedUser", $reservedUser); |
| 1602 | 1546 | $smarty->assign("request", $request); |
| 1603 | 1547 | |
| 1604 | 1548 | $smarty->display("confirmations/breakreserve.tpl"); |
| 1605 | 1549 | } |
| 1606 | - } |
|
| 1607 | - else { |
|
| 1550 | + } else { |
|
| 1608 | 1551 | echo "You cannot break " . htmlentities($reservedUser->getUsername()) . "'s reservation"; |
| 1609 | 1552 | } |
| 1610 | - } |
|
| 1611 | - else { |
|
| 1553 | + } else { |
|
| 1612 | 1554 | $database->transactionally(function() use ($database, $request) |
| 1613 | 1555 | { |
| 1614 | 1556 | $request->setReserved(0); |
@@ -1625,8 +1567,7 @@ discard block |
||
| 1625 | 1567 | |
| 1626 | 1568 | BootstrapSkin::displayInternalFooter(); |
| 1627 | 1569 | die(); |
| 1628 | -} |
|
| 1629 | -elseif ($action == "comment") { |
|
| 1570 | +} elseif ($action == "comment") { |
|
| 1630 | 1571 | global $smarty; |
| 1631 | 1572 | |
| 1632 | 1573 | $request = Request::getById($_GET['id'], gGetDb()); |
@@ -1634,8 +1575,7 @@ discard block |
||
| 1634 | 1575 | $smarty->display("commentform.tpl"); |
| 1635 | 1576 | BootstrapSkin::displayInternalFooter(); |
| 1636 | 1577 | die(); |
| 1637 | -} |
|
| 1638 | -elseif ($action == "comment-add") { |
|
| 1578 | +} elseif ($action == "comment-add") { |
|
| 1639 | 1579 | global $baseurl, $smarty; |
| 1640 | 1580 | |
| 1641 | 1581 | $request = Request::getById($_POST['id'], gGetDb()); |
@@ -1680,8 +1620,7 @@ discard block |
||
| 1680 | 1620 | |
| 1681 | 1621 | if (isset($_GET['hash'])) { |
| 1682 | 1622 | $urlhash = urlencode(htmlentities($_GET['hash'])); |
| 1683 | - } |
|
| 1684 | - else { |
|
| 1623 | + } else { |
|
| 1685 | 1624 | $urlhash = ""; |
| 1686 | 1625 | } |
| 1687 | 1626 | |
@@ -1695,8 +1634,7 @@ discard block |
||
| 1695 | 1634 | |
| 1696 | 1635 | BootstrapSkin::displayInternalFooter(); |
| 1697 | 1636 | die(); |
| 1698 | -} |
|
| 1699 | -elseif ($action == "comment-quick") { |
|
| 1637 | +} elseif ($action == "comment-quick") { |
|
| 1700 | 1638 | $request = Request::getById($_POST['id'], gGetDb()); |
| 1701 | 1639 | if ($request == false) { |
| 1702 | 1640 | BootstrapSkin::displayAlertBox("Could not find request!", "alert-error", "Error", true, false); |
@@ -1739,8 +1677,7 @@ discard block |
||
| 1739 | 1677 | Notification::commentCreated($comment); |
| 1740 | 1678 | |
| 1741 | 1679 | header("Location: acc.php?action=zoom&id=" . $request->getId()); |
| 1742 | -} |
|
| 1743 | -elseif ($action == "changepassword") { |
|
| 1680 | +} elseif ($action == "changepassword") { |
|
| 1744 | 1681 | if ((!isset($_POST['oldpassword'])) || $_POST['oldpassword'] == "") { |
| 1745 | 1682 | //Throw an error if old password is not specified. |
| 1746 | 1683 | BootstrapSkin::displayAlertBox("You did not enter your old password.", "alert-error", "Error", true, false); |
@@ -1777,8 +1714,7 @@ discard block |
||
| 1777 | 1714 | BootstrapSkin::displayAlertBox("Password successfully changed!", "alert-success", "", false, false); |
| 1778 | 1715 | BootstrapSkin::displayInternalFooter(); |
| 1779 | 1716 | die(); |
| 1780 | -} |
|
| 1781 | -elseif ($action == "ec") { |
|
| 1717 | +} elseif ($action == "ec") { |
|
| 1782 | 1718 | // edit comment |
| 1783 | 1719 | |
| 1784 | 1720 | global $smarty, $baseurl; |
@@ -1820,15 +1756,13 @@ discard block |
||
| 1820 | 1756 | }); |
| 1821 | 1757 | |
| 1822 | 1758 | die(); |
| 1823 | - } |
|
| 1824 | - else { |
|
| 1759 | + } else { |
|
| 1825 | 1760 | $smarty->assign("comment", $comment); |
| 1826 | 1761 | $smarty->display("edit-comment.tpl"); |
| 1827 | 1762 | BootstrapSkin::displayInternalFooter(); |
| 1828 | 1763 | die(); |
| 1829 | 1764 | } |
| 1830 | -} |
|
| 1831 | -elseif ($action == "sendtouser") { |
|
| 1765 | +} elseif ($action == "sendtouser") { |
|
| 1832 | 1766 | global $baseurl; |
| 1833 | 1767 | |
| 1834 | 1768 | $database = gGetDb(); |
@@ -1867,8 +1801,7 @@ discard block |
||
| 1867 | 1801 | Notification::requestReservationSent($requestObject, $user); |
| 1868 | 1802 | SessionAlert::success("Reservation sent successfully"); |
| 1869 | 1803 | header("Location: $baseurl/acc.php?action=zoom&id=$request"); |
| 1870 | -} |
|
| 1871 | -elseif ($action == "emailmgmt") { |
|
| 1804 | +} elseif ($action == "emailmgmt") { |
|
| 1872 | 1805 | global $smarty, $createdid, $availableRequestStates; |
| 1873 | 1806 | |
| 1874 | 1807 | /* New page for managing Emails, since I would rather not be handling editing |
@@ -1945,8 +1878,7 @@ discard block |
||
| 1945 | 1878 | $emailTemplate->setDefaultAction(EmailTemplate::CREATED); |
| 1946 | 1879 | $emailTemplate->setActive(1); |
| 1947 | 1880 | $emailTemplate->setPreloadOnly(0); |
| 1948 | - } |
|
| 1949 | - else { |
|
| 1881 | + } else { |
|
| 1950 | 1882 | $emailTemplate->setDefaultAction($_POST['defaultaction']); |
| 1951 | 1883 | $emailTemplate->setActive(isset($_POST['active'])); |
| 1952 | 1884 | $emailTemplate->setPreloadOnly(isset($_POST['preloadonly'])); |
@@ -2001,16 +1933,14 @@ discard block |
||
| 2001 | 1933 | |
| 2002 | 1934 | if (count($inactiverows) > 0) { |
| 2003 | 1935 | $smarty->assign('displayinactive', true); |
| 2004 | - } |
|
| 2005 | - else { |
|
| 1936 | + } else { |
|
| 2006 | 1937 | $smarty->assign('displayinactive', false); |
| 2007 | 1938 | } |
| 2008 | 1939 | |
| 2009 | 1940 | $smarty->display("email-management/main.tpl"); |
| 2010 | 1941 | BootstrapSkin::displayInternalFooter(); |
| 2011 | 1942 | die(); |
| 2012 | -} |
|
| 2013 | -elseif ($action == "oauthdetach") { |
|
| 1943 | +} elseif ($action == "oauthdetach") { |
|
| 2014 | 1944 | if ($enforceOAuth) { |
| 2015 | 1945 | BootstrapSkin::displayAccessDenied(); |
| 2016 | 1946 | BootstrapSkin::displayInternalFooter(); |
@@ -2023,8 +1953,7 @@ discard block |
||
| 2023 | 1953 | $currentUser->detachAccount(); |
| 2024 | 1954 | |
| 2025 | 1955 | header("Location: {$baseurl}/acc.php?action=logout"); |
| 2026 | -} |
|
| 2027 | -elseif ($action == "oauthattach") { |
|
| 1956 | +} elseif ($action == "oauthattach") { |
|
| 2028 | 1957 | $database = gGetDb(); |
| 2029 | 1958 | $database->transactionally(function() use ($database) |
| 2030 | 1959 | { |
@@ -2051,8 +1980,7 @@ discard block |
||
| 2051 | 1980 | throw new TransactionException($ex->getMessage(), "Connection to Wikipedia failed.", "alert-error", 0, $ex); |
| 2052 | 1981 | } |
| 2053 | 1982 | }); |
| 2054 | -} |
|
| 2055 | -elseif ($action == "listall") { |
|
| 1983 | +} elseif ($action == "listall") { |
|
| 2056 | 1984 | global $availableRequestStates, $enableEmailConfirm; |
| 2057 | 1985 | |
| 2058 | 1986 | if (isset($_GET['status']) && isset($availableRequestStates[$_GET['status']])) { |
@@ -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; |
@@ -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 | |