X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FWidget%2FVCard.php;h=96f35e6584503f2aec7cd7a2fe9dbba6ab0ce03a;hb=5ec1891e0abc5ad4d1cecb1627af8e68ba6d1df8;hp=a7d7d8cbd2e7fa3d41d2b1e68b8d668156e150e2;hpb=afe3c8954c92d386fef3cb74217dd7ad593500cf;p=friendica.git diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php index a7d7d8cbd2..96f35e6584 100644 --- a/src/Content/Widget/VCard.php +++ b/src/Content/Widget/VCard.php @@ -1,6 +1,6 @@ $contact ?? [], 'callstack' => System::callstack(20)]); + } + + if ($contact['network'] != '') { + $network_link = Strings::formatNetworkName($contact['network'], $contact['url']); + $network_avatar = ContactSelector::networkToIcon($contact['network'], $contact['url']); } else { - $network_link = ''; + $network_link = ''; + $network_avatar = ''; } - $follow_link = ''; - $unfollow_link = ''; + $follow_link = ''; + $unfollow_link = ''; $wallmessage_link = ''; + $photo = Contact::getPhoto($contact); + if (local_user()) { if ($contact['uid']) { $id = $contact['id']; $rel = $contact['rel']; $pending = $contact['pending']; } else { - $pcontact = Contact::selectFirst(['id', 'rel', 'pending'], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]); + $pcontact = Contact::selectFirst([], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]); + $id = $pcontact['id'] ?? 0; $rel = $pcontact['rel'] ?? Contact::NOTHING; $pending = $pcontact['pending'] ?? false; + + if (!empty($pcontact) && in_array($pcontact['network'], [Protocol::MAIL, Protocol::FEED])) { + $photo = Contact::getPhoto($pcontact); + } } - if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) { + if (empty($contact['self']) && Protocol::supportsFollow($contact['network'])) { if (in_array($rel, [Contact::SHARING, Contact::FRIEND])) { $unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1'; - } elseif(!$pending) { + } elseif (!$pending) { $follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1'; } } @@ -80,14 +96,16 @@ class VCard return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [ '$contact' => $contact, - '$photo' => Contact::getPhoto($contact), + '$photo' => $photo, '$url' => Contact::magicLinkByContact($contact, $contact['url']), '$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'] ?? ''), '$xmpp' => DI::l10n()->t('XMPP:'), + '$matrix' => DI::l10n()->t('Matrix:'), '$location' => DI::l10n()->t('Location:'), '$network_link' => $network_link, + '$network_avatar' => $network_avatar, '$network' => DI::l10n()->t('Network:'), - '$account_type' => Contact::getAccountType($contact), + '$account_type' => Contact::getAccountType($contact['contact-type']), '$follow' => DI::l10n()->t('Follow'), '$follow_link' => $follow_link, '$unfollow' => DI::l10n()->t('Unfollow'),