From d5c37001cde425968a2aa186db44e3f3bf1d2b0e Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 25 Sep 2019 07:02:07 +0000 Subject: [PATCH] Empty the "remote" variable, avoid being remote to yourself --- src/Core/Session.php | 3 ++- src/Model/Profile.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Core/Session.php b/src/Core/Session.php index cccd6951de..9927fca189 100644 --- a/src/Core/Session.php +++ b/src/Core/Session.php @@ -120,9 +120,10 @@ class Session 'my_url' => $a->getBaseURL() . '/profile/' . $user_record['nickname'], 'my_address' => $user_record['nickname'] . '@' . substr($a->getBaseURL(), strpos($a->getBaseURL(), '://') + 3), 'addr' => defaults($_SERVER, 'REMOTE_ADDR', '0.0.0.0'), + 'remote' => [] ]); - $remote_contacts = DBA::select('contact', ['id', 'uid'], ['nurl' => Strings::normaliseLink($_SESSION['my_url']), 'rel' => [Contact::FOLLOWER, Contact::FRIEND]]); + $remote_contacts = DBA::select('contact', ['id', 'uid'], ['nurl' => Strings::normaliseLink($_SESSION['my_url']), 'rel' => [Contact::FOLLOWER, Contact::FRIEND], 'self' => false]); while ($contact = DBA::fetch($remote_contacts)) { if (($contact['uid'] == 0) || Contact::isBlockedByUser($contact['id'], $contact['uid'])) { continue; diff --git a/src/Model/Profile.php b/src/Model/Profile.php index ab9b7fd00f..290b6d3490 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -1124,7 +1124,7 @@ class Profile /// @todo replace this and the query for this variable with some cleaner functionality $_SESSION['remote'] = []; - $remote_contacts = DBA::select('contact', ['id', 'uid'], ['nurl' => $visitor['nurl'], 'rel' => [Contact::FOLLOWER, Contact::FRIEND]]); + $remote_contacts = DBA::select('contact', ['id', 'uid'], ['nurl' => $visitor['nurl'], 'rel' => [Contact::FOLLOWER, Contact::FRIEND], 'self' => false]); while ($contact = DBA::fetch($remote_contacts)) { if (($contact['uid'] == 0) || Contact::isBlockedByUser($visitor['id'], $contact['uid'])) { continue; -- 2.39.5