From dfcfae6bcca54a27b1bf5099d96d54f2bba997d3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 5 Jan 2023 10:23:25 -0500 Subject: [PATCH] Replace $_GET references with $request in Update classes --- src/Module/Update/Community.php | 2 +- src/Module/Update/Network.php | 12 ++++++------ src/Module/Update/Profile.php | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Module/Update/Community.php b/src/Module/Update/Community.php index 05d2e94b06..b1e77c42ba 100644 --- a/src/Module/Update/Community.php +++ b/src/Module/Update/Community.php @@ -38,7 +38,7 @@ class Community extends CommunityModule $this->parseRequest(); $o = ''; - if (!empty($_GET['force']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update')) { + if (!empty($request['force']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update')) { $o = DI::conversation()->create(self::getItems(), 'community', true, false, 'commented', DI::userSession()->getLocalUserId()); } diff --git a/src/Module/Update/Network.php b/src/Module/Update/Network.php index 323d22cd5b..f8367e2d91 100644 --- a/src/Module/Update/Network.php +++ b/src/Module/Update/Network.php @@ -31,19 +31,19 @@ class Network extends NetworkModule { protected function rawContent(array $request = []) { - if (!isset($_GET['p']) || !isset($_GET['item'])) { + if (!isset($request['p']) || !isset($request['item'])) { System::exit(); } - $this->parseRequest($_GET); + $this->parseRequest($request); - $profile_uid = intval($_GET['p']); + $profile_uid = intval($request['p']); $o = ''; - if (!DI::pConfig()->get($profile_uid, 'system', 'no_auto_update') || ($_GET['force'] == 1)) { - if (!empty($_GET['item'])) { - $item = Post::selectFirst(['parent'], ['id' => $_GET['item']]); + if (!DI::pConfig()->get($profile_uid, 'system', 'no_auto_update') || ($request['force'] == 1)) { + if (!empty($request['item'])) { + $item = Post::selectFirst(['parent'], ['id' => $request['item']]); $parent = $item['parent'] ?? 0; } else { $parent = 0; diff --git a/src/Module/Update/Profile.php b/src/Module/Update/Profile.php index 9eb814bd01..c2b1951349 100644 --- a/src/Module/Update/Profile.php +++ b/src/Module/Update/Profile.php @@ -39,7 +39,7 @@ class Profile extends BaseModule $a = DI::app(); // Ensure we've got a profile owner if updating. - $a->setProfileOwner((int)($_GET['p'] ?? 0)); + $a->setProfileOwner((int)($request['p'] ?? 0)); if (DI::config()->get('system', 'block_public') && !DI::userSession()->getLocalUserId() && !DI::userSession()->getRemoteContactID($a->getProfileOwner())) { throw new ForbiddenException(); @@ -58,7 +58,7 @@ class Profile extends BaseModule $o = ''; - if (empty($_GET['force']) && DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update')) { + if (empty($request['force']) && DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update')) { System::htmlUpdateExit($o); } @@ -73,9 +73,9 @@ class Profile extends BaseModule AND `visible` AND (NOT `deleted` OR `gravity` = ?) AND `wall` " . $sql_extra, $a->getProfileOwner(), Item::GRAVITY_ACTIVITY]; - if ($_GET['force'] && !empty($_GET['item'])) { + if ($request['force'] && !empty($request['item'])) { // When the parent is provided, we only fetch this - $condition = DBA::mergeConditions($condition, ['parent' => $_GET['item']]); + $condition = DBA::mergeConditions($condition, ['parent' => $request['item']]); } elseif ($is_owner || !$last_updated) { // If the page user is the owner of the page we should query for unseen // items. Otherwise use a timestamp of the last succesful update request.