<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
-use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
* @template widget/vcard.tpl
* @return string
*/
- public static function getHTML(array $contact)
+ public static function getHTML(array $contact): string
{
if (!isset($contact['network']) || !isset($contact['id'])) {
Logger::warning('Incomplete contact', ['contact' => $contact ?? [], 'callstack' => System::callstack(20)]);
$photo = Contact::getPhoto($contact);
- if (Session::getLocalUser()) {
+ if (DI::userSession()->getLocalUserId()) {
if ($contact['uid']) {
$id = $contact['id'];
$rel = $contact['rel'];
$pending = $contact['pending'];
} else {
- $pcontact = Contact::selectFirst([], ['uid' => Session::getLocalUser(), 'uri-id' => $contact['uri-id']]);
+ $pcontact = Contact::selectFirst([], ['uid' => DI::userSession()->getLocalUserId(), 'uri-id' => $contact['uri-id'], 'deleted' => false]);
$id = $pcontact['id'] ?? 0;
$rel = $pcontact['rel'] ?? Contact::NOTHING;
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';
+ $unfollow_link = 'contact/unfollow?url=' . urlencode($contact['url']) . '&auto=1';
} elseif (!$pending) {
- $follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1';
+ $follow_link = 'contact/follow?url=' . urlencode($contact['url']) . '&auto=1';
}
}