]> git.mxchange.org Git - friendica.git/blobdiff - mod/display.php
Merge pull request #6977 from annando/fix-reshare
[friendica.git] / mod / display.php
index 7b95913ac17649870bd990b4d877a3947add3425..6723a77e9d106d269ce3a8f5d373f11633fc1553 100644 (file)
@@ -19,10 +19,10 @@ use Friendica\Model\Contact;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
 use Friendica\Model\Profile;
+use Friendica\Module\Objects;
 use Friendica\Protocol\ActivityPub;
 use Friendica\Protocol\DFRN;
 use Friendica\Util\Strings;
-use Friendica\Module\Objects;
 
 function display_init(App $a)
 {
@@ -79,10 +79,10 @@ function display_init(App $a)
 
                // Is it an item with uid=0?
                if (!DBA::isResult($item)) {
-                       $item = Item::selectFirst($fields, ['guid' => $a->argv[1], 'private' => [0, 2], 'uid' => 0]);
+                       $item = Item::selectFirstForUser(local_user(), $fields, ['guid' => $a->argv[1], 'private' => [0, 2], 'uid' => 0]);
                }
        } elseif (($a->argc == 3) && ($nick == 'feed-item')) {
-               $item = Item::selectFirst($fields, ['id' => $a->argv[2], 'private' => [0, 2], 'uid' => 0]);
+               $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $a->argv[2], 'private' => [0, 2], 'uid' => 0]);
        }
 
        if (!DBA::isResult($item)) {
@@ -283,22 +283,25 @@ function display_content(App $a, $update = false, $update_uid = 0)
        $is_remote_contact = false;
        $item_uid = local_user();
 
-       $parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
-       if (DBA::isResult($parent)) {
-               $a->profile['uid'] = defaults($a->profile, 'uid', $parent['uid']);
-               $a->profile['profile_uid'] = defaults($a->profile, 'profile_uid', $parent['uid']);
-               $is_remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']);
-       }
-
-       if ($is_remote_contact) {
-               $cdata = Contact::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']);
-               if (!empty($cdata['user'])) {
-                       $groups = Group::getIdsByContactId($cdata['user']);
-                       $remote_cid = $cdata['user'];
-                       $item_uid = $parent['uid'];
+       if (isset($item_parent_uri)) {
+               $parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
+               if (DBA::isResult($parent)) {
+                       $a->profile['uid'] = defaults($a->profile, 'uid', $parent['uid']);
+                       $a->profile['profile_uid'] = defaults($a->profile, 'profile_uid', $parent['uid']);
+                       $is_remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']);
+
+                       if ($is_remote_contact) {
+                               $cdata = Contact::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']);
+                               if (!empty($cdata['user'])) {
+                                       $groups = Group::getIdsByContactId($cdata['user']);
+                                       $remote_cid = $cdata['user'];
+                                       $item_uid = $parent['uid'];
+                               }
+                       }
                }
        }
 
+
        $page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
        if (DBA::isResult($page_contact)) {
                $a->page_contact = $page_contact;