- $condition = ["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `id` = ?) AND `uid` != 0 AND NOT `blocked` AND `rel` IN (?, ?)",
- $parent['owner-id'], CONTACT_IS_SHARING, CONTACT_IS_FRIEND];
- $contacts = dba::select('contact', ['uid'], $condition);
- while ($contact = dba::fetch($contacts)) {
+ /// @todo add a field "pcid" in the contact table that referrs to the public contact id.
+ $owner = DBA::selectFirst('contact', ['url', 'nurl', 'alias'], ['id' => $parent['owner-id']]);
+ if (!DBA::isResult($owner)) {
+ return;
+ }
+
+ $condition = ['nurl' => $owner['nurl'], 'rel' => [Contact::SHARING, Contact::FRIEND]];
+ $contacts = DBA::select('contact', ['uid'], $condition);
+ while ($contact = DBA::fetch($contacts)) {
+ if ($contact['uid'] == 0) {
+ continue;
+ }
+
+ $users[$contact['uid']] = $contact['uid'];
+ }
+ DBA::close($contacts);
+
+ $condition = ['alias' => $owner['url'], 'rel' => [Contact::SHARING, Contact::FRIEND]];
+ $contacts = DBA::select('contact', ['uid'], $condition);
+ while ($contact = DBA::fetch($contacts)) {
+ if ($contact['uid'] == 0) {
+ continue;
+ }
+