@@ -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']])) { |