@@ -154,8 +154,7 @@ discard block |
||
| 154 | 154 | $smarty->display("usermanagement/changelevel-reason.tpl"); |
| 155 | 155 | BootstrapSkin::displayInternalFooter(); |
| 156 | 156 | die(); |
| 157 | - } |
|
| 158 | - else { |
|
| 157 | + } else { |
|
| 159 | 158 | $user->demote($_POST['reason']); |
| 160 | 159 | |
| 161 | 160 | BootstrapSkin::displayAlertBox( |
@@ -198,8 +197,7 @@ discard block |
||
| 198 | 197 | false); |
| 199 | 198 | BootstrapSkin::displayInternalFooter(); |
| 200 | 199 | die(); |
| 201 | - } |
|
| 202 | - elseif (!isset($_POST['reason'])) { |
|
| 200 | + } elseif (!isset($_POST['reason'])) { |
|
| 203 | 201 | global $smarty; |
| 204 | 202 | $smarty->assign("user", $user); |
| 205 | 203 | $smarty->assign("status", "Suspended"); |
@@ -207,8 +205,7 @@ discard block |
||
| 207 | 205 | $smarty->display("usermanagement/changelevel-reason.tpl"); |
| 208 | 206 | BootstrapSkin::displayInternalFooter(); |
| 209 | 207 | die(); |
| 210 | - } |
|
| 211 | - else { |
|
| 208 | + } else { |
|
| 212 | 209 | $user->suspend($_POST['reason']); |
| 213 | 210 | |
| 214 | 211 | Notification::userSuspended($user, $_POST['reason']); |
@@ -301,8 +298,7 @@ discard block |
||
| 301 | 298 | $smarty->display("usermanagement/changelevel-reason.tpl"); |
| 302 | 299 | BootstrapSkin::displayInternalFooter(); |
| 303 | 300 | die(); |
| 304 | - } |
|
| 305 | - else { |
|
| 301 | + } else { |
|
| 306 | 302 | $user->decline($_POST['reason']); |
| 307 | 303 | |
| 308 | 304 | Notification::userDeclined($user, $_POST['reason']); |
@@ -346,8 +342,7 @@ discard block |
||
| 346 | 342 | $smarty->display("usermanagement/renameuser.tpl"); |
| 347 | 343 | BootstrapSkin::displayInternalFooter(); |
| 348 | 344 | die(); |
| 349 | - } |
|
| 350 | - else { |
|
| 345 | + } else { |
|
| 351 | 346 | if (!isset($_POST['newname']) || trim($_POST['newname']) == "") { |
| 352 | 347 | BootstrapSkin::displayAlertBox("The new username cannot be empty.", "alert-error", "Error", true, false); |
| 353 | 348 | BootstrapSkin::displayInternalFooter(); |
@@ -429,8 +424,7 @@ discard block |
||
| 429 | 424 | global $smarty; |
| 430 | 425 | $smarty->assign("user", $user); |
| 431 | 426 | $smarty->display("usermanagement/edituser.tpl"); |
| 432 | - } |
|
| 433 | - else { |
|
| 427 | + } else { |
|
| 434 | 428 | $database = gGetDb(); |
| 435 | 429 | if (!$database->beginTransaction()) { |
| 436 | 430 | BootstrapSkin::displayAlertBox( |
@@ -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']])) { |