@@ -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 { |
@@ -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; |
| 107 | 105 | |
| 108 | 106 | // TODO: check blocked |
@@ -196,8 +194,7 @@ discard block |
||
| 196 | 194 | 0, |
| 197 | 195 | $ex); |
| 198 | 196 | } |
| 199 | - } |
|
| 200 | - else { |
|
| 197 | + } else { |
|
| 201 | 198 | global $baseurl; |
| 202 | 199 | Notification::userNew($newUser); |
| 203 | 200 | header("Location: {$baseurl}/acc.php?action=registercomplete"); |
@@ -205,19 +202,16 @@ discard block |
||
| 205 | 202 | }); |
| 206 | 203 | |
| 207 | 204 | die(); |
| 208 | -} |
|
| 209 | -elseif ($action == "register") { |
|
| 205 | +} elseif ($action == "register") { |
|
| 210 | 206 | global $useOauthSignup, $smarty; |
| 211 | 207 | $smarty->assign("useOauthSignup", $useOauthSignup); |
| 212 | 208 | $smarty->display("registration/register.tpl"); |
| 213 | 209 | BootstrapSkin::displayInternalFooter(); |
| 214 | 210 | die(); |
| 215 | -} |
|
| 216 | -elseif ($action == "registercomplete") { |
|
| 211 | +} elseif ($action == "registercomplete") { |
|
| 217 | 212 | $smarty->display("registration/alert-registrationcomplete.tpl"); |
| 218 | 213 | BootstrapSkin::displayInternalFooter(); |
| 219 | -} |
|
| 220 | -elseif ($action == "forgotpw") { |
|
| 214 | +} elseif ($action == "forgotpw") { |
|
| 221 | 215 | global $baseurl, $smarty; |
| 222 | 216 | |
| 223 | 217 | if (isset ($_GET['si']) && isset ($_GET['id'])) { |
@@ -246,14 +240,12 @@ discard block |
||
| 246 | 240 | |
| 247 | 241 | BootstrapSkin::displayInternalFooter(); |
| 248 | 242 | die(); |
| 249 | - } |
|
| 250 | - else { |
|
| 243 | + } else { |
|
| 251 | 244 | BootstrapSkin::displayAlertBox("Passwords did not match!", "alert-error", "Error", true, false); |
| 252 | 245 | BootstrapSkin::displayInternalFooter(); |
| 253 | 246 | die(); |
| 254 | 247 | } |
| 255 | - } |
|
| 256 | - else { |
|
| 248 | + } else { |
|
| 257 | 249 | BootstrapSkin::displayAlertBox("Invalid request<!-- 1 -->", "alert-error", "Error", true, false); |
| 258 | 250 | BootstrapSkin::displayInternalFooter(); |
| 259 | 251 | die(); |
@@ -267,8 +259,7 @@ discard block |
||
| 267 | 259 | $smarty->assign('si', $_GET['si']); |
| 268 | 260 | $smarty->assign('id', $_GET['id']); |
| 269 | 261 | $smarty->display('forgot-password/forgotpwreset.tpl'); |
| 270 | - } |
|
| 271 | - else { |
|
| 262 | + } else { |
|
| 272 | 263 | BootstrapSkin::displayAlertBox( |
| 273 | 264 | "The hash supplied in the link did not match the hash in the database!", |
| 274 | 265 | "alert-error", |
@@ -294,8 +285,7 @@ discard block |
||
| 294 | 285 | |
| 295 | 286 | BootstrapSkin::displayInternalFooter(); |
| 296 | 287 | die(); |
| 297 | - } |
|
| 298 | - elseif (strtolower($_POST['email']) != strtolower($user->getEmail())) { |
|
| 288 | + } elseif (strtolower($_POST['email']) != strtolower($user->getEmail())) { |
|
| 299 | 289 | BootstrapSkin::displayAlertBox("Could not find user with that username and email address!", |
| 300 | 290 | "alert-error", |
| 301 | 291 | "Error", |
@@ -304,8 +294,7 @@ discard block |
||
| 304 | 294 | |
| 305 | 295 | BootstrapSkin::displayInternalFooter(); |
| 306 | 296 | die(); |
| 307 | - } |
|
| 308 | - else { |
|
| 297 | + } else { |
|
| 309 | 298 | $hash = $user->getForgottenPasswordHash(); |
| 310 | 299 | |
| 311 | 300 | $smarty->assign("user", $user); |
@@ -337,8 +326,7 @@ discard block |
||
| 337 | 326 | |
| 338 | 327 | BootstrapSkin::displayInternalFooter(); |
| 339 | 328 | die(); |
| 340 | -} |
|
| 341 | -elseif ($action == "login") { |
|
| 329 | +} elseif ($action == "login") { |
|
| 342 | 330 | global $baseurl, $smarty; |
| 343 | 331 | |
| 344 | 332 | if (!isset($_POST['username'])) { |
@@ -369,8 +357,7 @@ discard block |
||
| 369 | 357 | |
| 370 | 358 | reattachOAuthAccount($user); |
| 371 | 359 | } |
| 372 | - } |
|
| 373 | - else { |
|
| 360 | + } else { |
|
| 374 | 361 | global $enforceOAuth; |
| 375 | 362 | |
| 376 | 363 | if ($enforceOAuth) { |
@@ -453,8 +440,7 @@ discard block |
||
| 453 | 440 | } |
| 454 | 441 | |
| 455 | 442 | header("Location: $baseurl/acc.php"); |
| 456 | -} |
|
| 457 | -elseif ($action == "messagemgmt") { |
|
| 443 | +} elseif ($action == "messagemgmt") { |
|
| 458 | 444 | global $smarty; |
| 459 | 445 | |
| 460 | 446 | if (isset($_GET['view'])) { |
@@ -538,8 +524,7 @@ discard block |
||
| 538 | 524 | |
| 539 | 525 | BootstrapSkin::displayInternalFooter(); |
| 540 | 526 | die(); |
| 541 | -} |
|
| 542 | -elseif ($action == "templatemgmt") { |
|
| 527 | +} elseif ($action == "templatemgmt") { |
|
| 543 | 528 | global $baseurl, $smarty; |
| 544 | 529 | |
| 545 | 530 | if (isset($_GET['view'])) { |
@@ -585,15 +570,13 @@ discard block |
||
| 585 | 570 | SessionAlert::success("Template successfully created."); |
| 586 | 571 | header("Location: $baseurl/acc.php?action=templatemgmt"); |
| 587 | 572 | }); |
| 588 | - } |
|
| 589 | - else { |
|
| 573 | + } else { |
|
| 590 | 574 | |
| 591 | 575 | if (isset($_POST['preview'])) { |
| 592 | 576 | $usercode = $_POST['usercode']; |
| 593 | 577 | $botcode = $_POST['botcode']; |
| 594 | 578 | echo displayPreview($usercode); |
| 595 | - } |
|
| 596 | - else { |
|
| 579 | + } else { |
|
| 597 | 580 | $usercode = ''; |
| 598 | 581 | $botcode = ''; |
| 599 | 582 | } |
@@ -619,8 +602,7 @@ discard block |
||
| 619 | 602 | SessionAlert::success("Disabled automatic user welcoming."); |
| 620 | 603 | header("Location: {$baseurl}/acc.php?action=templatemgmt"); |
| 621 | 604 | die(); |
| 622 | - } |
|
| 623 | - else { |
|
| 605 | + } else { |
|
| 624 | 606 | $template = WelcomeTemplate::getById($_GET['select'], gGetDb()); |
| 625 | 607 | if ($template !== false) { |
| 626 | 608 | $user->setWelcomeTemplate($template->getId()); |
@@ -629,8 +611,7 @@ discard block |
||
| 629 | 611 | SessionAlert::success("Updated selected welcome template for automatic welcoming."); |
| 630 | 612 | header("Location: {$baseurl}/acc.php?action=templatemgmt"); |
| 631 | 613 | die(); |
| 632 | - } |
|
| 633 | - else { |
|
| 614 | + } else { |
|
| 634 | 615 | SessionAlert::error("Something went wrong, we can't find the template you asked for!"); |
| 635 | 616 | header("Location: {$baseurl}/acc.php?action=templatemgmt"); |
| 636 | 617 | die(); |
@@ -707,8 +688,7 @@ discard block |
||
| 707 | 688 | |
| 708 | 689 | header("Location: $baseurl/acc.php?action=templatemgmt"); |
| 709 | 690 | die(); |
| 710 | - } |
|
| 711 | - else { |
|
| 691 | + } else { |
|
| 712 | 692 | $smarty->assign("template", $template); |
| 713 | 693 | $smarty->display("welcometemplate/edit.tpl"); |
| 714 | 694 | |
@@ -724,8 +704,7 @@ discard block |
||
| 724 | 704 | |
| 725 | 705 | BootstrapSkin::displayInternalFooter(); |
| 726 | 706 | die(); |
| 727 | -} |
|
| 728 | -elseif ($action == "sban") { |
|
| 707 | +} elseif ($action == "sban") { |
|
| 729 | 708 | global $smarty; |
| 730 | 709 | |
| 731 | 710 | // Checks whether the current user is an admin. |
@@ -753,21 +732,18 @@ discard block |
||
| 753 | 732 | |
| 754 | 733 | if ($duration == "-1") { |
| 755 | 734 | $duration = -1; |
| 756 | - } |
|
| 757 | - elseif ($duration == "other") { |
|
| 735 | + } elseif ($duration == "other") { |
|
| 758 | 736 | $duration = strtotime($_POST['otherduration']); |
| 759 | 737 | if (!$duration) { |
| 760 | 738 | BootstrapSkin::displayAlertBox("Invalid ban time", "alert-error", "", false, false); |
| 761 | 739 | BootstrapSkin::displayInternalFooter(); |
| 762 | 740 | die(); |
| 763 | - } |
|
| 764 | - elseif (time() > $duration) { |
|
| 741 | + } elseif (time() > $duration) { |
|
| 765 | 742 | BootstrapSkin::displayAlertBox("Ban time has already expired!", "alert-error", "", false, false); |
| 766 | 743 | BootstrapSkin::displayInternalFooter(); |
| 767 | 744 | die(); |
| 768 | 745 | } |
| 769 | - } |
|
| 770 | - else { |
|
| 746 | + } else { |
|
| 771 | 747 | $duration = $duration + time(); |
| 772 | 748 | } |
| 773 | 749 | |
@@ -847,8 +823,7 @@ discard block |
||
| 847 | 823 | |
| 848 | 824 | BootstrapSkin::displayInternalFooter(); |
| 849 | 825 | die(); |
| 850 | -} |
|
| 851 | -elseif ($action == "unban") { |
|
| 826 | +} elseif ($action == "unban") { |
|
| 852 | 827 | global $smarty; |
| 853 | 828 | |
| 854 | 829 | if (!isset($_GET['id']) || $_GET['id'] == "") { |
@@ -887,8 +862,7 @@ discard block |
||
| 887 | 862 | BootstrapSkin::displayAlertBox("You must enter an unban reason!", "alert-error", "", false, false); |
| 888 | 863 | BootstrapSkin::displayInternalFooter(); |
| 889 | 864 | die(); |
| 890 | - } |
|
| 891 | - else { |
|
| 865 | + } else { |
|
| 892 | 866 | $database = gGetDb(); |
| 893 | 867 | |
| 894 | 868 | $database->transactionally(function() use ($database, $ban) |
@@ -907,15 +881,13 @@ discard block |
||
| 907 | 881 | Notification::unbanned($ban, $_POST['unbanreason']); |
| 908 | 882 | die(); |
| 909 | 883 | } |
| 910 | - } |
|
| 911 | - else { |
|
| 884 | + } else { |
|
| 912 | 885 | $smarty->assign("ban", $ban); |
| 913 | 886 | $smarty->display("bans/unban.tpl"); |
| 914 | 887 | |
| 915 | 888 | BootstrapSkin::displayInternalFooter(); |
| 916 | 889 | } |
| 917 | -} |
|
| 918 | -elseif ($action == "ban") { |
|
| 890 | +} elseif ($action == "ban") { |
|
| 919 | 891 | global $smarty; |
| 920 | 892 | |
| 921 | 893 | if (isset ($_GET['ip']) || isset ($_GET['email']) || isset ($_GET['name'])) { |
@@ -935,8 +907,7 @@ discard block |
||
| 935 | 907 | $row = $statement->fetch(PDO::FETCH_ASSOC); |
| 936 | 908 | $target = getTrustedClientIP($row['ip'], $row['forwardedip']); |
| 937 | 909 | $type = "IP"; |
| 938 | - } |
|
| 939 | - elseif (isset($_GET['email'])) { |
|
| 910 | + } elseif (isset($_GET['email'])) { |
|
| 940 | 911 | $query = "SELECT email FROM request WHERE id = :ip;"; |
| 941 | 912 | $statement = $database->prepare($query); |
| 942 | 913 | $statement->bindValue(":ip", $_GET['email']); |
@@ -944,8 +915,7 @@ discard block |
||
| 944 | 915 | $row = $statement->fetch(PDO::FETCH_ASSOC); |
| 945 | 916 | $target = $row['email']; |
| 946 | 917 | $type = "EMail"; |
| 947 | - } |
|
| 948 | - elseif (isset($_GET['name'])) { |
|
| 918 | + } elseif (isset($_GET['name'])) { |
|
| 949 | 919 | $query = "SELECT name FROM request WHERE id = :ip;"; |
| 950 | 920 | $statement = $database->prepare($query); |
| 951 | 921 | $statement->bindValue(":ip", $_GET['name']); |
@@ -953,8 +923,7 @@ discard block |
||
| 953 | 923 | $row = $statement->fetch(PDO::FETCH_ASSOC); |
| 954 | 924 | $target = $row['name']; |
| 955 | 925 | $type = "Name"; |
| 956 | - } |
|
| 957 | - else { |
|
| 926 | + } else { |
|
| 958 | 927 | BootstrapSkin::displayAlertBox("Unknown ban type.", "alert-error"); |
| 959 | 928 | BootstrapSkin::displayInternalFooter(); |
| 960 | 929 | die(); |
@@ -969,8 +938,7 @@ discard block |
||
| 969 | 938 | $smarty->assign("bantype", $type); |
| 970 | 939 | $smarty->assign("bantarget", trim($target)); |
| 971 | 940 | $smarty->display("bans/banform.tpl"); |
| 972 | - } |
|
| 973 | - else { |
|
| 941 | + } else { |
|
| 974 | 942 | $bans = Ban::getActiveBans(); |
| 975 | 943 | |
| 976 | 944 | $smarty->assign("activebans", $bans); |
@@ -979,8 +947,7 @@ discard block |
||
| 979 | 947 | |
| 980 | 948 | BootstrapSkin::displayInternalFooter(); |
| 981 | 949 | die(); |
| 982 | -} |
|
| 983 | -elseif ($action == "defer" && $_GET['id'] != "" && $_GET['sum'] != "") { |
|
| 950 | +} elseif ($action == "defer" && $_GET['id'] != "" && $_GET['sum'] != "") { |
|
| 984 | 951 | global $availableRequestStates; |
| 985 | 952 | |
| 986 | 953 | if (array_key_exists($_GET['target'], $availableRequestStates)) { |
@@ -1061,14 +1028,12 @@ discard block |
||
| 1061 | 1028 | }); |
| 1062 | 1029 | |
| 1063 | 1030 | die(); |
| 1064 | - } |
|
| 1065 | - else { |
|
| 1031 | + } else { |
|
| 1066 | 1032 | BootstrapSkin::displayAlertBox("Defer target not valid.", "alert-error", "Error", true, false); |
| 1067 | 1033 | BootstrapSkin::displayInternalFooter(); |
| 1068 | 1034 | die(); |
| 1069 | 1035 | } |
| 1070 | -} |
|
| 1071 | -elseif ($action == "prefs") { |
|
| 1036 | +} elseif ($action == "prefs") { |
|
| 1072 | 1037 | global $smarty, $enforceOAuth; |
| 1073 | 1038 | |
| 1074 | 1039 | if (isset ($_POST['sig'])) { |
@@ -1082,8 +1047,7 @@ discard block |
||
| 1082 | 1047 | |
| 1083 | 1048 | if ($mailisvalid === false) { |
| 1084 | 1049 | BootstrapSkin::displayAlertBox("Invalid email address", "alert-error", "Error!"); |
| 1085 | - } |
|
| 1086 | - else { |
|
| 1050 | + } else { |
|
| 1087 | 1051 | $user->setEmail(trim($_POST['email'])); |
| 1088 | 1052 | } |
| 1089 | 1053 | } |
@@ -1104,20 +1068,17 @@ discard block |
||
| 1104 | 1068 | $smarty->display("prefs.tpl"); |
| 1105 | 1069 | BootstrapSkin::displayInternalFooter(); |
| 1106 | 1070 | die(); |
| 1107 | -} |
|
| 1108 | -elseif ($action == "done" && $_GET['id'] != "") { |
|
| 1071 | +} elseif ($action == "done" && $_GET['id'] != "") { |
|
| 1109 | 1072 | // check for valid close reasons |
| 1110 | 1073 | global $messages, $baseurl, $smarty; |
| 1111 | 1074 | |
| 1112 | 1075 | if (isset($_GET['email'])) { |
| 1113 | 1076 | if ($_GET['email'] == 0 || $_GET['email'] == "custom") { |
| 1114 | 1077 | $validEmail = true; |
| 1115 | - } |
|
| 1116 | - else { |
|
| 1078 | + } else { |
|
| 1117 | 1079 | $validEmail = EmailTemplate::getById($_GET['email'], gGetDb()) != false; |
| 1118 | 1080 | } |
| 1119 | - } |
|
| 1120 | - else { |
|
| 1081 | + } else { |
|
| 1121 | 1082 | $validEmail = false; |
| 1122 | 1083 | } |
| 1123 | 1084 | |
@@ -1183,8 +1144,7 @@ discard block |
||
| 1183 | 1144 | $ue = unserialize($userexist); |
| 1184 | 1145 | if (!isset ($ue['query']['users']['0']['missing'])) { |
| 1185 | 1146 | $exists = true; |
| 1186 | - } |
|
| 1187 | - else { |
|
| 1147 | + } else { |
|
| 1188 | 1148 | $exists = false; |
| 1189 | 1149 | } |
| 1190 | 1150 | |
@@ -1226,8 +1186,7 @@ discard block |
||
| 1226 | 1186 | $preloadTitle = $template->getName(); |
| 1227 | 1187 | $preloadText = $template->getText(); |
| 1228 | 1188 | $preloadAction = $template->getDefaultAction(); |
| 1229 | - } |
|
| 1230 | - else { |
|
| 1189 | + } else { |
|
| 1231 | 1190 | $preloadText = ""; |
| 1232 | 1191 | $preloadTitle = ""; |
| 1233 | 1192 | $preloadAction = ""; |
@@ -1265,8 +1224,7 @@ discard block |
||
| 1265 | 1224 | if (User::getCurrent()->getEmailSig() != "") { |
| 1266 | 1225 | $emailsig = html_entity_decode(User::getCurrent()->getEmailSig(), ENT_QUOTES, "UTF-8"); |
| 1267 | 1226 | mail($request->getEmail(), "RE: [ACC #{$request->getId()}] English Wikipedia Account Request", $_POST['msgbody'] . "\n\n" . $emailsig, $headers); |
| 1268 | - } |
|
| 1269 | - else { |
|
| 1227 | + } else { |
|
| 1270 | 1228 | mail($request->getEmail(), "RE: [ACC #{$request->getId()}] English Wikipedia Account Request", $_POST['msgbody'], $headers); |
| 1271 | 1229 | } |
| 1272 | 1230 | |
@@ -1279,8 +1237,7 @@ discard block |
||
| 1279 | 1237 | if ($_POST['action'] == EmailTemplate::CREATED) { |
| 1280 | 1238 | $gem = 'custom-y'; |
| 1281 | 1239 | $crea = "Custom, Created"; |
| 1282 | - } |
|
| 1283 | - else { |
|
| 1240 | + } else { |
|
| 1284 | 1241 | $gem = 'custom-n'; |
| 1285 | 1242 | $crea = "Custom, Not Created"; |
| 1286 | 1243 | } |
@@ -1291,8 +1248,7 @@ discard block |
||
| 1291 | 1248 | BootstrapSkin::displayAlertBox( |
| 1292 | 1249 | "Request " . $request->getId() . " (" . htmlentities($request->getName(), ENT_COMPAT, 'UTF-8') . ") marked as '" . htmlentities($crea, ENT_COMPAT, 'UTF-8') . "'.", |
| 1293 | 1250 | "alert-success"); |
| 1294 | - } |
|
| 1295 | - else if ($_POST['action'] == "mail") { |
|
| 1251 | + } else if ($_POST['action'] == "mail") { |
|
| 1296 | 1252 | // no action other than send mail! |
| 1297 | 1253 | Logger::sentMail(gGetDb(), $request, $messageBody); |
| 1298 | 1254 | Logger::unreserve(gGetDb(), $request); |
@@ -1300,8 +1256,7 @@ discard block |
||
| 1300 | 1256 | Notification::sentMail($request); |
| 1301 | 1257 | BootstrapSkin::displayAlertBox("Sent mail to Request {$request->getId()}", |
| 1302 | 1258 | "alert-success"); |
| 1303 | - } |
|
| 1304 | - else if (array_key_exists($_POST['action'], $availableRequestStates)) { |
|
| 1259 | + } else if (array_key_exists($_POST['action'], $availableRequestStates)) { |
|
| 1305 | 1260 | // Defer |
| 1306 | 1261 | |
| 1307 | 1262 | $request->setStatus($_POST['action']); |
@@ -1314,8 +1269,7 @@ discard block |
||
| 1314 | 1269 | Notification::requestDeferredWithMail($request); |
| 1315 | 1270 | BootstrapSkin::displayAlertBox("Request {$request->getId()} deferred to $deto, sending an email.", |
| 1316 | 1271 | "alert-success"); |
| 1317 | - } |
|
| 1318 | - else { |
|
| 1272 | + } else { |
|
| 1319 | 1273 | // hmm. not sure what happened. Log that we sent the mail anyway. |
| 1320 | 1274 | Logger::sentMail(gGetDb(), $request, $messageBody); |
| 1321 | 1275 | Logger::unreserve(gGetDb(), $request); |
@@ -1334,8 +1288,7 @@ discard block |
||
| 1334 | 1288 | echo defaultpage(); |
| 1335 | 1289 | BootstrapSkin::displayInternalFooter(); |
| 1336 | 1290 | die(); |
| 1337 | - } |
|
| 1338 | - else { |
|
| 1291 | + } else { |
|
| 1339 | 1292 | // Not a custom close, just a normal close |
| 1340 | 1293 | |
| 1341 | 1294 | $request->setStatus('Closed'); |
@@ -1348,8 +1301,7 @@ discard block |
||
| 1348 | 1301 | |
| 1349 | 1302 | if ($gem == '0') { |
| 1350 | 1303 | $crea = "Dropped"; |
| 1351 | - } |
|
| 1352 | - else { |
|
| 1304 | + } else { |
|
| 1353 | 1305 | $template = EmailTemplate::getById($gem, gGetDb()); |
| 1354 | 1306 | $crea = $template->getName(); |
| 1355 | 1307 | } |
@@ -1370,8 +1322,7 @@ discard block |
||
| 1370 | 1322 | BootstrapSkin::displayInternalFooter(); |
| 1371 | 1323 | die(); |
| 1372 | 1324 | } |
| 1373 | -} |
|
| 1374 | -elseif ($action == "zoom") { |
|
| 1325 | +} elseif ($action == "zoom") { |
|
| 1375 | 1326 | if (!isset($_GET['id'])) { |
| 1376 | 1327 | BootstrapSkin::displayAlertBox("No request specified!", "alert-error", "Error!", true, false); |
| 1377 | 1328 | BootstrapSkin::displayInternalFooter(); |
@@ -1380,8 +1331,7 @@ discard block |
||
| 1380 | 1331 | |
| 1381 | 1332 | if (isset($_GET['hash'])) { |
| 1382 | 1333 | $urlhash = $_GET['hash']; |
| 1383 | - } |
|
| 1384 | - else { |
|
| 1334 | + } else { |
|
| 1385 | 1335 | $urlhash = ""; |
| 1386 | 1336 | } |
| 1387 | 1337 | echo zoomPage($_GET['id'], $urlhash); |
@@ -1389,8 +1339,7 @@ discard block |
||
| 1389 | 1339 | $tailscript = getTypeaheadSource(User::getAllUsernames(gGetDb())); |
| 1390 | 1340 | BootstrapSkin::displayInternalFooter($tailscript); |
| 1391 | 1341 | die(); |
| 1392 | -} |
|
| 1393 | -elseif ($action == "logs") { |
|
| 1342 | +} elseif ($action == "logs") { |
|
| 1394 | 1343 | global $baseurl; |
| 1395 | 1344 | |
| 1396 | 1345 | $filterUser = isset($_GET['filterUser']) && $_GET['filterUser'] != "" ? $_GET['filterUser'] : false; |
@@ -1438,11 +1387,9 @@ discard block |
||
| 1438 | 1387 | if ($pageCount < $pageLimit) { |
| 1439 | 1388 | if ($pageData['lowpage'] == 1 && $pageData['hipage'] == $pageData['maxpage']) { |
| 1440 | 1389 | // nothing to do, we're already at max range. |
| 1441 | - } |
|
| 1442 | - elseif ($pageData['lowpage'] == 1 && $pageData['hipage'] < $pageData['maxpage']) { |
|
| 1390 | + } elseif ($pageData['lowpage'] == 1 && $pageData['hipage'] < $pageData['maxpage']) { |
|
| 1443 | 1391 | $pageData['hipage'] = min($pageLimit, $pageData['maxpage']); |
| 1444 | - } |
|
| 1445 | - elseif ($pageData['lowpage'] > 1 && $pageData['hipage'] == $pageData['maxpage']) { |
|
| 1392 | + } elseif ($pageData['lowpage'] > 1 && $pageData['hipage'] == $pageData['maxpage']) { |
|
| 1446 | 1393 | $pageData['lowpage'] = max(1, $pageData['maxpage'] - $pageLimit + 1); |
| 1447 | 1394 | } |
| 1448 | 1395 | } |
@@ -1465,8 +1412,7 @@ discard block |
||
| 1465 | 1412 | |
| 1466 | 1413 | BootstrapSkin::displayInternalFooter($tailscript); |
| 1467 | 1414 | die(); |
| 1468 | -} |
|
| 1469 | -elseif ($action == "reserve") { |
|
| 1415 | +} elseif ($action == "reserve") { |
|
| 1470 | 1416 | $database = gGetDb(); |
| 1471 | 1417 | |
| 1472 | 1418 | $database->transactionally(function() use ($database) |
@@ -1542,8 +1488,7 @@ discard block |
||
| 1542 | 1488 | }); |
| 1543 | 1489 | |
| 1544 | 1490 | die(); |
| 1545 | -} |
|
| 1546 | -elseif ($action == "breakreserve") { |
|
| 1491 | +} elseif ($action == "breakreserve") { |
|
| 1547 | 1492 | global $smarty; |
| 1548 | 1493 | |
| 1549 | 1494 | $database = gGetDb(); |
@@ -1585,20 +1530,17 @@ discard block |
||
| 1585 | 1530 | }); |
| 1586 | 1531 | |
| 1587 | 1532 | die(); |
| 1588 | - } |
|
| 1589 | - else { |
|
| 1533 | + } else { |
|
| 1590 | 1534 | global $baseurl; |
| 1591 | 1535 | $smarty->assign("reservedUser", $reservedUser); |
| 1592 | 1536 | $smarty->assign("request", $request); |
| 1593 | 1537 | |
| 1594 | 1538 | $smarty->display("confirmations/breakreserve.tpl"); |
| 1595 | 1539 | } |
| 1596 | - } |
|
| 1597 | - else { |
|
| 1540 | + } else { |
|
| 1598 | 1541 | echo "You cannot break " . htmlentities($reservedUser->getUsername()) . "'s reservation"; |
| 1599 | 1542 | } |
| 1600 | - } |
|
| 1601 | - else { |
|
| 1543 | + } else { |
|
| 1602 | 1544 | $database->transactionally(function() use ($database, $request) |
| 1603 | 1545 | { |
| 1604 | 1546 | $request->setReserved(0); |
@@ -1615,8 +1557,7 @@ discard block |
||
| 1615 | 1557 | |
| 1616 | 1558 | BootstrapSkin::displayInternalFooter(); |
| 1617 | 1559 | die(); |
| 1618 | -} |
|
| 1619 | -elseif ($action == "comment") { |
|
| 1560 | +} elseif ($action == "comment") { |
|
| 1620 | 1561 | global $smarty; |
| 1621 | 1562 | |
| 1622 | 1563 | $request = Request::getById($_GET['id'], gGetDb()); |
@@ -1624,8 +1565,7 @@ discard block |
||
| 1624 | 1565 | $smarty->display("commentform.tpl"); |
| 1625 | 1566 | BootstrapSkin::displayInternalFooter(); |
| 1626 | 1567 | die(); |
| 1627 | -} |
|
| 1628 | -elseif ($action == "comment-add") { |
|
| 1568 | +} elseif ($action == "comment-add") { |
|
| 1629 | 1569 | global $baseurl, $smarty; |
| 1630 | 1570 | |
| 1631 | 1571 | $request = Request::getById($_POST['id'], gGetDb()); |
@@ -1670,8 +1610,7 @@ discard block |
||
| 1670 | 1610 | |
| 1671 | 1611 | if (isset($_GET['hash'])) { |
| 1672 | 1612 | $urlhash = urlencode(htmlentities($_GET['hash'])); |
| 1673 | - } |
|
| 1674 | - else { |
|
| 1613 | + } else { |
|
| 1675 | 1614 | $urlhash = ""; |
| 1676 | 1615 | } |
| 1677 | 1616 | |
@@ -1685,8 +1624,7 @@ discard block |
||
| 1685 | 1624 | |
| 1686 | 1625 | BootstrapSkin::displayInternalFooter(); |
| 1687 | 1626 | die(); |
| 1688 | -} |
|
| 1689 | -elseif ($action == "comment-quick") { |
|
| 1627 | +} elseif ($action == "comment-quick") { |
|
| 1690 | 1628 | $request = Request::getById($_POST['id'], gGetDb()); |
| 1691 | 1629 | if ($request == false) { |
| 1692 | 1630 | BootstrapSkin::displayAlertBox("Could not find request!", "alert-error", "Error", true, false); |
@@ -1729,8 +1667,7 @@ discard block |
||
| 1729 | 1667 | Notification::commentCreated($comment); |
| 1730 | 1668 | |
| 1731 | 1669 | header("Location: acc.php?action=zoom&id=" . $request->getId()); |
| 1732 | -} |
|
| 1733 | -elseif ($action == "changepassword") { |
|
| 1670 | +} elseif ($action == "changepassword") { |
|
| 1734 | 1671 | if ((!isset($_POST['oldpassword'])) || $_POST['oldpassword'] == "") { |
| 1735 | 1672 | //Throw an error if old password is not specified. |
| 1736 | 1673 | BootstrapSkin::displayAlertBox("You did not enter your old password.", "alert-error", "Error", true, false); |
@@ -1767,8 +1704,7 @@ discard block |
||
| 1767 | 1704 | BootstrapSkin::displayAlertBox("Password successfully changed!", "alert-success", "", false, false); |
| 1768 | 1705 | BootstrapSkin::displayInternalFooter(); |
| 1769 | 1706 | die(); |
| 1770 | -} |
|
| 1771 | -elseif ($action == "ec") { |
|
| 1707 | +} elseif ($action == "ec") { |
|
| 1772 | 1708 | // edit comment |
| 1773 | 1709 | |
| 1774 | 1710 | global $smarty, $baseurl; |
@@ -1810,15 +1746,13 @@ discard block |
||
| 1810 | 1746 | }); |
| 1811 | 1747 | |
| 1812 | 1748 | die(); |
| 1813 | - } |
|
| 1814 | - else { |
|
| 1749 | + } else { |
|
| 1815 | 1750 | $smarty->assign("comment", $comment); |
| 1816 | 1751 | $smarty->display("edit-comment.tpl"); |
| 1817 | 1752 | BootstrapSkin::displayInternalFooter(); |
| 1818 | 1753 | die(); |
| 1819 | 1754 | } |
| 1820 | -} |
|
| 1821 | -elseif ($action == "sendtouser") { |
|
| 1755 | +} elseif ($action == "sendtouser") { |
|
| 1822 | 1756 | global $baseurl; |
| 1823 | 1757 | |
| 1824 | 1758 | $database = gGetDb(); |
@@ -1857,8 +1791,7 @@ discard block |
||
| 1857 | 1791 | Notification::requestReservationSent($requestObject, $user); |
| 1858 | 1792 | SessionAlert::success("Reservation sent successfully"); |
| 1859 | 1793 | header("Location: $baseurl/acc.php?action=zoom&id=$request"); |
| 1860 | -} |
|
| 1861 | -elseif ($action == "emailmgmt") { |
|
| 1794 | +} elseif ($action == "emailmgmt") { |
|
| 1862 | 1795 | global $smarty, $createdid, $availableRequestStates; |
| 1863 | 1796 | |
| 1864 | 1797 | /* New page for managing Emails, since I would rather not be handling editing |
@@ -1935,8 +1868,7 @@ discard block |
||
| 1935 | 1868 | $emailTemplate->setDefaultAction(EmailTemplate::CREATED); |
| 1936 | 1869 | $emailTemplate->setActive(1); |
| 1937 | 1870 | $emailTemplate->setPreloadOnly(0); |
| 1938 | - } |
|
| 1939 | - else { |
|
| 1871 | + } else { |
|
| 1940 | 1872 | $emailTemplate->setDefaultAction($_POST['defaultaction']); |
| 1941 | 1873 | $emailTemplate->setActive(isset($_POST['active'])); |
| 1942 | 1874 | $emailTemplate->setPreloadOnly(isset($_POST['preloadonly'])); |
@@ -1991,16 +1923,14 @@ discard block |
||
| 1991 | 1923 | |
| 1992 | 1924 | if (count($inactiverows) > 0) { |
| 1993 | 1925 | $smarty->assign('displayinactive', true); |
| 1994 | - } |
|
| 1995 | - else { |
|
| 1926 | + } else { |
|
| 1996 | 1927 | $smarty->assign('displayinactive', false); |
| 1997 | 1928 | } |
| 1998 | 1929 | |
| 1999 | 1930 | $smarty->display("email-management/main.tpl"); |
| 2000 | 1931 | BootstrapSkin::displayInternalFooter(); |
| 2001 | 1932 | die(); |
| 2002 | -} |
|
| 2003 | -elseif ($action == "oauthdetach") { |
|
| 1933 | +} elseif ($action == "oauthdetach") { |
|
| 2004 | 1934 | if ($enforceOAuth) { |
| 2005 | 1935 | BootstrapSkin::displayAccessDenied(); |
| 2006 | 1936 | BootstrapSkin::displayInternalFooter(); |
@@ -2013,8 +1943,7 @@ discard block |
||
| 2013 | 1943 | $currentUser->detachAccount(); |
| 2014 | 1944 | |
| 2015 | 1945 | header("Location: {$baseurl}/acc.php?action=logout"); |
| 2016 | -} |
|
| 2017 | -elseif ($action == "oauthattach") { |
|
| 1946 | +} elseif ($action == "oauthattach") { |
|
| 2018 | 1947 | $database = gGetDb(); |
| 2019 | 1948 | $database->transactionally(function() use ($database) |
| 2020 | 1949 | { |
@@ -2041,8 +1970,7 @@ discard block |
||
| 2041 | 1970 | throw new TransactionException($ex->getMessage(), "Connection to Wikipedia failed.", "alert-error", 0, $ex); |
| 2042 | 1971 | } |
| 2043 | 1972 | }); |
| 2044 | -} |
|
| 2045 | -elseif ($action == "listall") { |
|
| 1973 | +} elseif ($action == "listall") { |
|
| 2046 | 1974 | global $availableRequestStates, $enableEmailConfirm; |
| 2047 | 1975 | |
| 2048 | 1976 | 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 | |