+ try {
+ $uid = User::getIdForURL($url);
+ if (!$uid) {
+ throw new HTTPException\NotFoundException('User not found.');
+ }
+
+ $owner = User::getOwnerDataById($uid);
+ $approfile = ActivityPub\Transmitter::getProfile($uid);
+
+ if (empty($owner['gsid'])) {
+ $owner['gsid'] = GServer::getID($approfile['generator']['url']);
+ }
+
+ $data = [
+ 'name' => $owner['name'], 'nick' => $owner['nick'], 'guid' => $approfile['diaspora:guid'] ?? '',
+ 'url' => $owner['url'], 'addr' => $owner['addr'], 'alias' => $owner['alias'],
+ 'photo' => User::getAvatarUrl($owner),
+ 'header' => $owner['header'] ? Contact::getHeaderUrlForId($owner['id'], $owner['updated']) : '',
+ 'account-type' => $owner['contact-type'], 'community' => ($owner['contact-type'] == User::ACCOUNT_TYPE_COMMUNITY),
+ 'keywords' => $owner['keywords'], 'location' => $owner['location'], 'about' => $owner['about'],
+ 'xmpp' => $owner['xmpp'], 'matrix' => $owner['matrix'],
+ 'hide' => !$owner['net-publish'], 'batch' => '', 'notify' => $owner['notify'],
+ 'poll' => $owner['poll'], 'request' => $owner['request'], 'confirm' => $owner['confirm'],
+ 'subscribe' => $approfile['generator']['url'] . '/follow?url={uri}', 'poco' => $owner['poco'],
+ 'following' => $approfile['following'], 'followers' => $approfile['followers'],
+ 'inbox' => $approfile['inbox'], 'outbox' => $approfile['outbox'],
+ 'sharedinbox' => $approfile['endpoints']['sharedInbox'], 'network' => Protocol::DFRN,
+ 'pubkey' => $owner['upubkey'], 'baseurl' => $approfile['generator']['url'], 'gsid' => $owner['gsid'],
+ 'manually-approve' => in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP])
+ ];
+ } catch (Exception $e) {
+ // Default values for non existing targets
+ $data = [
+ 'name' => $url, 'nick' => $url, 'url' => $url, 'network' => Protocol::PHANTOM,
+ 'photo' => DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO
+ ];