]> git.mxchange.org Git - friendica.git/blobdiff - mod/hovercard.php
fix hovercard for not logged in users
[friendica.git] / mod / hovercard.php
index 334bf228abe74ddb253c79ccb5d1b253ef69f593..0e8cc80f27ae962453b57988f4d005d037c3e890 100644 (file)
@@ -9,6 +9,7 @@
  */
 use Friendica\App;
 use Friendica\Core\Config;
+use Friendica\Core\System;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 use Friendica\Model\Profile;
@@ -26,7 +27,7 @@ function hovercard_content()
 
        // Get out if the system doesn't have public access allowed
        if (intval(Config::get('system', 'block_public'))) {
-               http_status_exit(401);
+               System::httpExit(401);
        }
 
        // Return the raw content of the template. We use this to make templates usable for js functions.
@@ -43,7 +44,7 @@ function hovercard_content()
        // the contact. So we strip out the contact id from the internal url and look in the contact table for
        // the real url (nurl)
        $cid = 0;
-       if (local_user() && strpos($profileurl, 'redir/') === 0) {
+       if (strpos($profileurl, 'redir/') === 0) {
                $cid = intval(substr($profileurl, 6));
                $remote_contact = dba::selectFirst('contact', ['nurl'], ['id' => $cid]);
                $profileurl = defaults($remote_contact, 'nurl', '');
@@ -71,7 +72,7 @@ function hovercard_content()
                'nick'     => $contact['nick'],
                'addr'     => defaults($contact, 'addr', $contact['url']),
                'thumb'    => proxy_url($contact['thumb'], false, PROXY_SIZE_THUMB),
-               'url'      => $cid ? ('redir/' . $cid) : Profile::zrl($contact['url']),
+               'url'      => Contact::magicLink($contact['url']),
                'nurl'     => $contact['nurl'], // We additionally store the nurl as identifier
                'location' => $contact['location'],
                'gender'   => $contact['gender'],
@@ -90,7 +91,7 @@ function hovercard_content()
 
                return $o;
        } else {
-               json_return_and_die($profile);
+               System::jsonExit($profile);
        }
 }