X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fhovercard.php;h=8b51eb00ae6b14881dde6128b32603b10e2228ea;hb=7f143c3159615b4a10539447bcf250a5fca793a5;hp=dfec16854113bea9ada0a4fdbd1ee704fb129645;hpb=daa1177e3a1e42b4c95e0a8759f1610942b952c7;p=friendica.git diff --git a/mod/hovercard.php b/mod/hovercard.php index dfec168541..8b51eb00ae 100644 --- a/mod/hovercard.php +++ b/mod/hovercard.php @@ -11,9 +11,10 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\System; -use Friendica\Database\dba; +use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\GContact; +use Friendica\Util\Proxy as ProxyUtils; function hovercard_init(App $a) { @@ -47,17 +48,39 @@ function hovercard_content() $cid = 0; if (strpos($profileurl, 'redir/') === 0) { $cid = intval(substr($profileurl, 6)); - $remote_contact = dba::selectFirst('contact', ['nurl'], ['id' => $cid]); + $remote_contact = DBA::selectFirst('contact', ['nurl'], ['id' => $cid]); $profileurl = defaults($remote_contact, 'nurl', ''); } $contact = []; // if it's the url containing https it should be converted to http $nurl = normalise_link(GContact::cleanContactUrl($profileurl)); - if ($nurl) { - // Search for contact data + if (!$nurl) { + return; + } + + // Search for contact data + // Look if the local user has got the contact + if (local_user()) { + $contact = Contact::getDetailsByURL($nurl, local_user()); + } + + // If not then check the global user + if (!count($contact)) { $contact = Contact::getDetailsByURL($nurl); } + + // Feeds url could have been destroyed through "cleanContactUrl", so we now use the original url + if (!count($contact) && local_user()) { + $nurl = normalise_link($profileurl); + $contact = Contact::getDetailsByURL($nurl, local_user()); + } + + if (!count($contact)) { + $nurl = normalise_link($profileurl); + $contact = Contact::getDetailsByURL($nurl); + } + if (!count($contact)) { return; } @@ -65,6 +88,8 @@ function hovercard_content() // Get the photo_menu - the menu if possible contact actions if (local_user()) { $actions = Contact::photoMenu($contact); + } else { + $actions = []; } // Move the contact data to the profile array so we can deliver it to @@ -72,7 +97,7 @@ function hovercard_content() 'name' => $contact['name'], 'nick' => $contact['nick'], 'addr' => defaults($contact, 'addr', $contact['url']), - 'thumb' => proxy_url($contact['thumb'], false, PROXY_SIZE_THUMB), + 'thumb' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB), 'url' => Contact::magicLink($contact['url']), 'nurl' => $contact['nurl'], // We additionally store the nurl as identifier 'location' => $contact['location'],