- $r = dba::fetch_first("SELECT `id`, `parent` FROM `item`
- WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
- AND `guid` = ? AND `uid` = ?", $a->argv[1], local_user());
- if (DBM::is_result($r)) {
- $item_id = $r["id"];
- $item_parent = $r["parent"];
+ $condition = ['guid' => $a->argv[1], 'uid' => local_user()];
+ $item = Item::selectFirstForUser(local_user(), $fields, $condition);
+ if (DBA::isResult($item)) {
+ $item_id = $item["id"];
+ $item_parent = $item["parent"];
+ $item_parent_uri = $item['parent-uri'];
+ }
+ }
+
+ if (($item_parent == 0) && remote_user()) {
+ $item = Item::selectFirst($fields, ['guid' => $a->argv[1], 'private' => 1, 'origin' => true]);
+ if (DBA::isResult($item) && Contact::isFollower(remote_user(), $item['uid'])) {
+ $item_id = $item["id"];
+ $item_parent = $item["parent"];
+ $item_parent_uri = $item['parent-uri'];