@@ -12,8 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | $database = gGetDb(); |
| 14 | 14 | |
| 15 | -$database->transactionally(function() use ($database) |
|
| 16 | -{ |
|
| 15 | +$database->transactionally(function() use ($database) { |
|
| 17 | 16 | $database->exec(<<<SQL |
| 18 | 17 | UPDATE user |
| 19 | 18 | SET |
@@ -87,8 +87,7 @@ |
||
| 87 | 87 | $database = gGetDb(); |
| 88 | 88 | |
| 89 | 89 | echo "Executing transaction...\n"; |
| 90 | -$database->transactionally(function() use ($ip, $database) |
|
| 91 | -{ |
|
| 90 | +$database->transactionally(function() use ($ip, $database) { |
|
| 92 | 91 | $database->exec("DELETE FROM xfftrustcache;"); |
| 93 | 92 | |
| 94 | 93 | $insert = $database->prepare("INSERT INTO xfftrustcache (ip) VALUES (:ip);"); |
@@ -71,8 +71,7 @@ discard block |
||
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $database->transactionally(function() use($database, $request, $smarty) |
|
| 75 | - { |
|
| 74 | + $database->transactionally(function() use($database, $request, $smarty) { |
|
| 76 | 75 | if ($request === false) { |
| 77 | 76 | throw new TransactionException($smarty->fetch('request/request-not-found.tpl'), "Ooops!"); |
| 78 | 77 | } |
@@ -136,8 +135,7 @@ discard block |
||
| 136 | 135 | else if ($enableEmailConfirm == 1) { |
| 137 | 136 | $request->generateEmailConfirmationHash(); |
| 138 | 137 | |
| 139 | - $database->transactionally(function() use($request) |
|
| 140 | - { |
|
| 138 | + $database->transactionally(function() use($request) { |
|
| 141 | 139 | $request->save(); |
| 142 | 140 | |
| 143 | 141 | // checksum depends on the ID, so we have to save again! |
@@ -151,8 +149,7 @@ discard block |
||
| 151 | 149 | } |
| 152 | 150 | else { |
| 153 | 151 | $request->setEmailConfirm(0); // Since it can't be null |
| 154 | - $database->transactionally(function() use($request) |
|
| 155 | - { |
|
| 152 | + $database->transactionally(function() use($request) { |
|
| 156 | 153 | $request->save(); |
| 157 | 154 | $request->updateChecksum(); |
| 158 | 155 | $request->save(); |
@@ -593,8 +593,7 @@ discard block |
||
| 593 | 593 | |
| 594 | 594 | public function approve() |
| 595 | 595 | { |
| 596 | - $this->dbObject->transactionally(function() |
|
| 597 | - { |
|
| 596 | + $this->dbObject->transactionally(function() { |
|
| 598 | 597 | $this->status = "User"; |
| 599 | 598 | $this->save(); |
| 600 | 599 | Logger::approvedUser($this->dbObject, $this); |
@@ -603,8 +602,7 @@ discard block |
||
| 603 | 602 | |
| 604 | 603 | public function suspend($comment) |
| 605 | 604 | { |
| 606 | - $this->dbObject->transactionally(function() use ($comment) |
|
| 607 | - { |
|
| 605 | + $this->dbObject->transactionally(function() use ($comment) { |
|
| 608 | 606 | $this->status = "Suspended"; |
| 609 | 607 | $this->save(); |
| 610 | 608 | Logger::suspendedUser($this->dbObject, $this, $comment); |
@@ -613,8 +611,7 @@ discard block |
||
| 613 | 611 | |
| 614 | 612 | public function decline($comment) |
| 615 | 613 | { |
| 616 | - $this->dbObject->transactionally(function() use ($comment) |
|
| 617 | - { |
|
| 614 | + $this->dbObject->transactionally(function() use ($comment) { |
|
| 618 | 615 | $this->status = "Declined"; |
| 619 | 616 | $this->save(); |
| 620 | 617 | Logger::declinedUser($this->dbObject, $this, $comment); |
@@ -623,8 +620,7 @@ discard block |
||
| 623 | 620 | |
| 624 | 621 | public function promote() |
| 625 | 622 | { |
| 626 | - $this->dbObject->transactionally(function() |
|
| 627 | - { |
|
| 623 | + $this->dbObject->transactionally(function() { |
|
| 628 | 624 | $this->status = "Admin"; |
| 629 | 625 | $this->save(); |
| 630 | 626 | Logger::promotedUser($this->dbObject, $this); |
@@ -633,8 +629,7 @@ discard block |
||
| 633 | 629 | |
| 634 | 630 | public function demote($comment) |
| 635 | 631 | { |
| 636 | - $this->dbObject->transactionally(function() use ($comment) |
|
| 637 | - { |
|
| 632 | + $this->dbObject->transactionally(function() use ($comment) { |
|
| 638 | 633 | $this->status = "User"; |
| 639 | 634 | $this->save(); |
| 640 | 635 | Logger::demotedUser($this->dbObject, $this, $comment); |
@@ -654,9 +654,9 @@ |
||
| 654 | 654 | |
| 655 | 655 | public function isCheckuser() |
| 656 | 656 | { |
| 657 | - if($this->isCheckuserCache === null) { |
|
| 658 | - $this->isCheckuserCache = $this->checkuser == 1 || $this->oauthCanCheckUser(); |
|
| 659 | - } |
|
| 657 | + if($this->isCheckuserCache === null) { |
|
| 658 | + $this->isCheckuserCache = $this->checkuser == 1 || $this->oauthCanCheckUser(); |
|
| 659 | + } |
|
| 660 | 660 | |
| 661 | 661 | return $this->isCheckuserCache; |
| 662 | 662 | } |
@@ -217,8 +217,7 @@ |
||
| 217 | 217 | |
| 218 | 218 | $items = array_merge($logs, $comments); |
| 219 | 219 | |
| 220 | - $sortKey = function(DataObject $item) |
|
| 221 | - { |
|
| 220 | + $sortKey = function(DataObject $item) { |
|
| 222 | 221 | if ($item instanceof Log) { |
| 223 | 222 | return $item->getTimestamp(); |
| 224 | 223 | } |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | if(!isset($_GET['tool']) |
| 13 | 13 | || !isset($toolList[$_GET['tool']]) |
| 14 | 14 | || !isset($_GET['data']) |
| 15 | -) |
|
| 16 | -{ |
|
| 15 | +) { |
|
| 17 | 16 | header("HTTP/1.1 403 Forbidden"); |
| 18 | 17 | return; |
| 19 | 18 | } |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | "requests" => $requests, |
| 156 | 156 | "total" => $totalRequests, |
| 157 | 157 | "api" => $v['api'], |
| 158 | - "type" => $type); |
|
| 158 | + "type" => $type); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | global $smarty; |
@@ -2036,41 +2036,41 @@ |
||
| 2036 | 2036 | }); |
| 2037 | 2037 | } |
| 2038 | 2038 | elseif ($action == "listall") { |
| 2039 | - global $availableRequestStates, $enableEmailConfirm; |
|
| 2039 | + global $availableRequestStates, $enableEmailConfirm; |
|
| 2040 | 2040 | |
| 2041 | 2041 | if (isset($_GET['status']) && isset($availableRequestStates[$_GET['status']])) { |
| 2042 | 2042 | $type = $_GET['status']; // safe, we've verified it's sane in the above if statement. |
| 2043 | 2043 | |
| 2044 | - $database = gGetDb(); |
|
| 2044 | + $database = gGetDb(); |
|
| 2045 | 2045 | |
| 2046 | - if ($enableEmailConfirm == 1) { |
|
| 2047 | - $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
|
| 2048 | - } else { |
|
| 2049 | - $query = "SELECT * FROM request WHERE status = :type;"; |
|
| 2050 | - } |
|
| 2046 | + if ($enableEmailConfirm == 1) { |
|
| 2047 | + $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
|
| 2048 | + } else { |
|
| 2049 | + $query = "SELECT * FROM request WHERE status = :type;"; |
|
| 2050 | + } |
|
| 2051 | 2051 | |
| 2052 | - $statement = $database->prepare($query); |
|
| 2052 | + $statement = $database->prepare($query); |
|
| 2053 | 2053 | |
| 2054 | - $statement->bindValue(":type", $type); |
|
| 2055 | - $statement->execute(); |
|
| 2054 | + $statement->bindValue(":type", $type); |
|
| 2055 | + $statement->execute(); |
|
| 2056 | 2056 | |
| 2057 | - $requests = $statement->fetchAll(PDO::FETCH_CLASS, "Request"); |
|
| 2058 | - foreach ($requests as $req) { |
|
| 2059 | - /** @var Request $req */ |
|
| 2060 | - $req->setDatabase($database); |
|
| 2061 | - } |
|
| 2057 | + $requests = $statement->fetchAll(PDO::FETCH_CLASS, "Request"); |
|
| 2058 | + foreach ($requests as $req) { |
|
| 2059 | + /** @var Request $req */ |
|
| 2060 | + $req->setDatabase($database); |
|
| 2061 | + } |
|
| 2062 | 2062 | |
| 2063 | - global $smarty; |
|
| 2064 | - $smarty->assign("requests", $requests); |
|
| 2065 | - $smarty->assign("showStatus", false); |
|
| 2066 | - $html = $smarty->fetch("mainpage/requesttable.tpl"); |
|
| 2067 | - echo $html; |
|
| 2068 | - } else { |
|
| 2069 | - echo defaultpage(); |
|
| 2070 | - } |
|
| 2063 | + global $smarty; |
|
| 2064 | + $smarty->assign("requests", $requests); |
|
| 2065 | + $smarty->assign("showStatus", false); |
|
| 2066 | + $html = $smarty->fetch("mainpage/requesttable.tpl"); |
|
| 2067 | + echo $html; |
|
| 2068 | + } else { |
|
| 2069 | + echo defaultpage(); |
|
| 2070 | + } |
|
| 2071 | 2071 | |
| 2072 | - BootstrapSkin::displayInternalFooter(); |
|
| 2073 | - die(); |
|
| 2072 | + BootstrapSkin::displayInternalFooter(); |
|
| 2073 | + die(); |
|
| 2074 | 2074 | } |
| 2075 | 2075 | # If the action specified does not exist, goto the default page. |
| 2076 | 2076 | else { |
@@ -154,8 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $database = gGetDb(); |
| 156 | 156 | |
| 157 | - $database->transactionally(function() use ($database, $useOauthSignup) |
|
| 158 | - { |
|
| 157 | + $database->transactionally(function() use ($database, $useOauthSignup) { |
|
| 159 | 158 | |
| 160 | 159 | $newUser = new User(); |
| 161 | 160 | $newUser->setDatabase($database); |
@@ -483,8 +482,7 @@ discard block |
||
| 483 | 482 | |
| 484 | 483 | $database = gGetDb(); |
| 485 | 484 | |
| 486 | - $database->transactionally(function() use ($database) |
|
| 487 | - { |
|
| 485 | + $database->transactionally(function() use ($database) { |
|
| 488 | 486 | global $smarty; |
| 489 | 487 | |
| 490 | 488 | $message = InterfaceMessage::getById($_GET['edit'], $database); |
@@ -572,8 +570,7 @@ discard block |
||
| 572 | 570 | |
| 573 | 571 | $database = gGetDb(); |
| 574 | 572 | |
| 575 | - $database->transactionally(function() use ($database, $baseurl) |
|
| 576 | - { |
|
| 573 | + $database->transactionally(function() use ($database, $baseurl) { |
|
| 577 | 574 | $template = new WelcomeTemplate(); |
| 578 | 575 | $template->setDatabase($database); |
| 579 | 576 | $template->setUserCode($_POST['usercode']); |
@@ -658,8 +655,7 @@ discard block |
||
| 658 | 655 | die(); |
| 659 | 656 | } |
| 660 | 657 | |
| 661 | - $database->transactionally(function() use($database, $template) |
|
| 662 | - { |
|
| 658 | + $database->transactionally(function() use($database, $template) { |
|
| 663 | 659 | $tid = $template->getId(); |
| 664 | 660 | |
| 665 | 661 | $database |
@@ -695,8 +691,7 @@ discard block |
||
| 695 | 691 | } |
| 696 | 692 | |
| 697 | 693 | if (isset($_POST['submit'])) { |
| 698 | - $database->transactionally(function() use($database, $template) |
|
| 699 | - { |
|
| 694 | + $database->transactionally(function() use($database, $template) { |
|
| 700 | 695 | $template->setUserCode($_POST['usercode']); |
| 701 | 696 | $template->setBotCode($_POST['botcode']); |
| 702 | 697 | $template->save(); |
@@ -827,8 +822,7 @@ discard block |
||
| 827 | 822 | |
| 828 | 823 | $currentUsername = User::getCurrent()->getUsername(); |
| 829 | 824 | |
| 830 | - $database->transactionally(function() use ($database, $ban, $duration, $currentUsername) |
|
| 831 | - { |
|
| 825 | + $database->transactionally(function() use ($database, $ban, $duration, $currentUsername) { |
|
| 832 | 826 | $ban->setDatabase($database); |
| 833 | 827 | $ban->setActive(1); |
| 834 | 828 | $ban->setType($_POST['type']); |
@@ -893,8 +887,7 @@ discard block |
||
| 893 | 887 | else { |
| 894 | 888 | $database = gGetDb(); |
| 895 | 889 | |
| 896 | - $database->transactionally(function() use ($database, $ban) |
|
| 897 | - { |
|
| 890 | + $database->transactionally(function() use ($database, $ban) { |
|
| 898 | 891 | $ban->setActive(0); |
| 899 | 892 | $ban->save(); |
| 900 | 893 | |
@@ -1043,8 +1036,7 @@ discard block |
||
| 1043 | 1036 | } |
| 1044 | 1037 | |
| 1045 | 1038 | $database = gGetDb(); |
| 1046 | - $database->transactionally(function() use ($database, $request) |
|
| 1047 | - { |
|
| 1039 | + $database->transactionally(function() use ($database, $request) { |
|
| 1048 | 1040 | global $availableRequestStates; |
| 1049 | 1041 | |
| 1050 | 1042 | $request->setReserved(0); |
@@ -1194,7 +1186,8 @@ discard block |
||
| 1194 | 1186 | $emailTemplate = EmailTemplate::getById($gem, gGetDb()); |
| 1195 | 1187 | if ($emailTemplate instanceof EmailTemplate) { |
| 1196 | 1188 | $isForCreated = $emailTemplate->getDefaultAction() === EmailTemplate::CREATED; |
| 1197 | - } else { |
|
| 1189 | + } |
|
| 1190 | + else { |
|
| 1198 | 1191 | $isForCreated = false; |
| 1199 | 1192 | } |
| 1200 | 1193 | |
@@ -1463,8 +1456,7 @@ discard block |
||
| 1463 | 1456 | elseif ($action == "reserve") { |
| 1464 | 1457 | $database = gGetDb(); |
| 1465 | 1458 | |
| 1466 | - $database->transactionally(function() use ($database) |
|
| 1467 | - { |
|
| 1459 | + $database->transactionally(function() use ($database) { |
|
| 1468 | 1460 | $request = Request::getById($_GET['resid'], $database); |
| 1469 | 1461 | |
| 1470 | 1462 | if ($request == false) { |
@@ -1567,8 +1559,7 @@ discard block |
||
| 1567 | 1559 | if ($reservedUser->getId() != User::getCurrent()->getId()) { |
| 1568 | 1560 | if (User::getCurrent()->isAdmin()) { |
| 1569 | 1561 | if (isset($_GET['confirm']) && $_GET['confirm'] == 1) { |
| 1570 | - $database->transactionally(function() use($database, $request) |
|
| 1571 | - { |
|
| 1562 | + $database->transactionally(function() use($database, $request) { |
|
| 1572 | 1563 | $request->setReserved(0); |
| 1573 | 1564 | $request->save(); |
| 1574 | 1565 | |
@@ -1593,8 +1584,7 @@ discard block |
||
| 1593 | 1584 | } |
| 1594 | 1585 | } |
| 1595 | 1586 | else { |
| 1596 | - $database->transactionally(function() use ($database, $request) |
|
| 1597 | - { |
|
| 1587 | + $database->transactionally(function() use ($database, $request) { |
|
| 1598 | 1588 | $request->setReserved(0); |
| 1599 | 1589 | $request->save(); |
| 1600 | 1590 | |
@@ -1787,8 +1777,7 @@ discard block |
||
| 1787 | 1777 | |
| 1788 | 1778 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
| 1789 | 1779 | $database = gGetDb(); |
| 1790 | - $database->transactionally(function() use ($database, $comment, $baseurl) |
|
| 1791 | - { |
|
| 1780 | + $database->transactionally(function() use ($database, $comment, $baseurl) { |
|
| 1792 | 1781 | |
| 1793 | 1782 | $comment->setComment($_POST['newcomment']); |
| 1794 | 1783 | $comment->setVisibility($_POST['visibility']); |
@@ -1836,8 +1825,7 @@ discard block |
||
| 1836 | 1825 | die(); |
| 1837 | 1826 | } |
| 1838 | 1827 | |
| 1839 | - $database->transactionally(function() use ($database, $user, $requestObject, $curuser) |
|
| 1840 | - { |
|
| 1828 | + $database->transactionally(function() use ($database, $user, $requestObject, $curuser) { |
|
| 1841 | 1829 | $updateStatement = $database->prepare("UPDATE request SET reserved = :userid WHERE id = :request LIMIT 1;"); |
| 1842 | 1830 | $updateStatement->bindValue(":userid", $user->getId()); |
| 1843 | 1831 | $updateStatement->bindValue(":request", $requestObject->getId()); |
@@ -1865,8 +1853,7 @@ discard block |
||
| 1865 | 1853 | } |
| 1866 | 1854 | if (isset($_POST['submit'])) { |
| 1867 | 1855 | $database = gGetDb(); |
| 1868 | - $database->transactionally(function() use ($database) |
|
| 1869 | - { |
|
| 1856 | + $database->transactionally(function() use ($database) { |
|
| 1870 | 1857 | global $baseurl; |
| 1871 | 1858 | |
| 1872 | 1859 | $emailTemplate = new EmailTemplate(); |
@@ -1944,8 +1931,7 @@ discard block |
||
| 1944 | 1931 | die(); |
| 1945 | 1932 | } |
| 1946 | 1933 | |
| 1947 | - $database->transactionally(function() use ($database, $emailTemplate) |
|
| 1948 | - { |
|
| 1934 | + $database->transactionally(function() use ($database, $emailTemplate) { |
|
| 1949 | 1935 | $emailTemplate->save(); |
| 1950 | 1936 | |
| 1951 | 1937 | Logger::editedEmail($database, $emailTemplate); |
@@ -2010,8 +1996,7 @@ discard block |
||
| 2010 | 1996 | } |
| 2011 | 1997 | elseif ($action == "oauthattach") { |
| 2012 | 1998 | $database = gGetDb(); |
| 2013 | - $database->transactionally(function() use ($database) |
|
| 2014 | - { |
|
| 1999 | + $database->transactionally(function() use ($database) { |
|
| 2015 | 2000 | try { |
| 2016 | 2001 | global $oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal; |
| 2017 | 2002 | |
@@ -2046,7 +2031,8 @@ discard block |
||
| 2046 | 2031 | |
| 2047 | 2032 | if ($enableEmailConfirm == 1) { |
| 2048 | 2033 | $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
| 2049 | - } else { |
|
| 2034 | + } |
|
| 2035 | + else { |
|
| 2050 | 2036 | $query = "SELECT * FROM request WHERE status = :type;"; |
| 2051 | 2037 | } |
| 2052 | 2038 | |
@@ -2066,7 +2052,8 @@ discard block |
||
| 2066 | 2052 | $smarty->assign("showStatus", false); |
| 2067 | 2053 | $html = $smarty->fetch("mainpage/requesttable.tpl"); |
| 2068 | 2054 | echo $html; |
| 2069 | - } else { |
|
| 2055 | + } |
|
| 2056 | + else { |
|
| 2070 | 2057 | echo defaultpage(); |
| 2071 | 2058 | } |
| 2072 | 2059 | |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | $db = gGetDb( ); |
| 12 | 12 | |
| 13 | -$db->transactionally(function() use ($db) |
|
| 14 | -{ |
|
| 13 | +$db->transactionally(function() use ($db) { |
|
| 15 | 14 | global $cDataClearIp, $cDataClearEmail, $dataclear_interval; |
| 16 | 15 | |
| 17 | 16 | $query = $db->prepare("UPDATE request SET ip = :ip, forwardedip = null, email = :mail, useragent = '' WHERE date < DATE_SUB(curdate(), INTERVAL $dataclear_interval) AND status = 'Closed';"); |