]> git.mxchange.org Git - friendica.git/commitdiff
Some more avatar function replacements
authorMichael <heluecht@pirati.ca>
Tue, 28 Jul 2020 19:30:55 +0000 (19:30 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 28 Jul 2020 19:30:55 +0000 (19:30 +0000)
15 files changed:
include/conversation.php
mod/message.php
mod/network.php
mod/ping.php
mod/suggest.php
src/Content/ForumManager.php
src/Content/Text/HTML.php
src/Content/Widget.php
src/Content/Widget/ContactBlock.php
src/Factory/Notification/Notification.php
src/Module/BaseSearch.php
src/Module/Contact.php
src/Module/Search/Acl.php
src/Object/Post.php
view/theme/vier/theme.php

index 8050296a564a652fc82176c0748841e9c35b27c8..86af3b69d496902c71aab1c4a6c414056c1a9ded 100644 (file)
@@ -40,7 +40,6 @@ use Friendica\Object\Thread;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 use Friendica\Util\XML;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 use Friendica\Util\XML;
@@ -593,7 +592,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                                        'name' => $profile_name,
                                        'sparkle' => $sparkle,
                                        'lock' => $lock,
                                        'name' => $profile_name,
                                        'sparkle' => $sparkle,
                                        'lock' => $lock,
-                                       'thumb' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
+                                       'thumb' => DI::baseUrl()->remove($item['author-avatar']),
                                        'title' => $title,
                                        'body' => $body,
                                        'tags' => $tags['tags'],
                                        'title' => $title,
                                        'body' => $body,
                                        'tags' => $tags['tags'],
@@ -613,7 +612,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                                        'indent' => '',
                                        'owner_name' => $owner_name,
                                        'owner_url' => $owner_url,
                                        'indent' => '',
                                        'owner_name' => $owner_name,
                                        'owner_url' => $owner_url,
-                                       'owner_photo' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
+                                       'owner_photo' => DI::baseUrl()->remove($item['owner-avatar']),
                                        'plink' => Item::getPlink($item),
                                        'edpost' => false,
                                        'isstarred' => $isstarred,
                                        'plink' => Item::getPlink($item),
                                        'edpost' => false,
                                        'isstarred' => $isstarred,
index 204b136f9bb93a5c4f92601bab5ad5e90e8ee29c..f04bdaecd72dfb4284ce5cd7e68169655e93da7b 100644 (file)
@@ -32,7 +32,6 @@ use Friendica\Model\Mail;
 use Friendica\Model\Notify\Type;
 use Friendica\Module\Security\Login;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Model\Notify\Type;
 use Friendica\Module\Security\Login;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
@@ -393,12 +392,8 @@ function message_content(App $a)
                        $body_e = BBCode::convert($message['body']);
                        $to_name_e = $message['name'];
 
                        $body_e = BBCode::convert($message['body']);
                        $to_name_e = $message['name'];
 
-                       $contact = Contact::getByURL($message['from-url'], false, ['thumb', 'addr']);
-                       if (isset($contact["thumb"])) {
-                               $from_photo = $contact["thumb"];
-                       } else {
-                               $from_photo = $message['from-photo'];
-                       }
+                       $contact = Contact::getByURL($message['from-url'], false, ['thumb', 'addr', 'id', 'avatar']);
+                       $from_photo = Contact::getThumb($contact, $message['from-photo']);
 
                        $mails[] = [
                                'id' => $message['id'],
 
                        $mails[] = [
                                'id' => $message['id'],
@@ -406,7 +401,7 @@ function message_content(App $a)
                                'from_url' => $from_url,
                                'from_addr' => $contact['addr'],
                                'sparkle' => $sparkle,
                                'from_url' => $from_url,
                                'from_addr' => $contact['addr'],
                                'sparkle' => $sparkle,
-                               'from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB),
+                               'from_photo' => $from_photo,
                                'subject' => $subject_e,
                                'body' => $body_e,
                                'delete' => DI::l10n()->t('Delete message'),
                                'subject' => $subject_e,
                                'body' => $body_e,
                                'delete' => DI::l10n()->t('Delete message'),
@@ -525,12 +520,8 @@ function render_messages(array $msg, $t)
                $body_e = $rr['body'];
                $to_name_e = $rr['name'];
 
                $body_e = $rr['body'];
                $to_name_e = $rr['name'];
 
-               $contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr']);
-               if (isset($contact["thumb"])) {
-                       $from_photo = $contact["thumb"];
-               } else {
-                       $from_photo = (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']);
-               }
+               $contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr', 'id', 'avatar']);
+               $from_photo = Contact::getThumb($contact, $rr['thumb'] ?: $rr['from-photo']);
 
                $rslt .= Renderer::replaceMacros($tpl, [
                        '$id' => $rr['id'],
 
                $rslt .= Renderer::replaceMacros($tpl, [
                        '$id' => $rr['id'],
@@ -538,7 +529,7 @@ function render_messages(array $msg, $t)
                        '$from_url' => Contact::magicLink($rr['url']),
                        '$from_addr' => $contact['addr'] ?? '',
                        '$sparkle' => ' sparkle',
                        '$from_url' => Contact::magicLink($rr['url']),
                        '$from_addr' => $contact['addr'] ?? '',
                        '$sparkle' => ' sparkle',
-                       '$from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB),
+                       '$from_photo' => $from_photo,
                        '$subject' => $rr['title'],
                        '$delete' => DI::l10n()->t('Delete conversation'),
                        '$body' => $body_e,
                        '$subject' => $rr['title'],
                        '$delete' => DI::l10n()->t('Delete conversation'),
                        '$body' => $body_e,
index d82072754c9bf140e7d0602e8c68f63ff0dfeb1b..eb1dbdb0437ac8f52e3f26646adff4da980bddc6 100644 (file)
@@ -572,7 +572,7 @@ function networkThreadedView(App $a, $update, $parent)
                        '$title' => DI::l10n()->t('Group: %s', $group['name'])
                ]) . $o;
        } elseif ($cid) {
                        '$title' => DI::l10n()->t('Group: %s', $group['name'])
                ]) . $o;
        } elseif ($cid) {
-               $fields = ['id', 'name', 'network', 'writable', 'nurl',
+               $fields = ['id', 'name', 'network', 'writable', 'nurl', 'avatar',
                        'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
                $condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
                $contact = DBA::selectFirst('contact', $fields, $condition);
                        'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
                $condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
                $contact = DBA::selectFirst('contact', $fields, $condition);
index c6e32a9314c4544f701ecf89c4ac081bd4cda609..7c8d6c846d6c917113ccaef4c6dcab7d970db133 100644 (file)
@@ -327,7 +327,7 @@ function ping_init(App $a)
 
                if (DBA::isResult($notifs)) {
                        foreach ($notifs as $notif) {
 
                if (DBA::isResult($notifs)) {
                        foreach ($notifs as $notif) {
-                               $contact = Contact::getByURL($notif['url'], false, ['micro']);
+                               $contact = Contact::getByURL($notif['url'], false, ['micro', 'id', 'avatar']);
                                $notif['photo'] = Contact::getMicro($contact, $notif['photo']);
 
                                $local_time = DateTimeFormat::local($notif['date']);
                                $notif['photo'] = Contact::getMicro($contact, $notif['photo']);
 
                                $local_time = DateTimeFormat::local($notif['date']);
index 66d22b001ef40d8501c57175deac6ca08fa22b68..d592537f483aec45b05c6e2886061128644d50c5 100644 (file)
@@ -27,7 +27,6 @@ use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
-use Friendica\Util\Proxy as ProxyUtils;
 
 function suggest_init(App $a)
 {
 
 function suggest_init(App $a)
 {
@@ -111,7 +110,7 @@ function suggest_content(App $a)
                        'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
                        'img_hover' => $rr['url'],
                        'name' => $contact_details['name'],
                        'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
                        'img_hover' => $rr['url'],
                        'name' => $contact_details['name'],
-                       'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
+                       'thumb' => Contact::getThumb($contact_details),
                        'details'       => $contact_details['location'],
                        'tags'          => $contact_details['keywords'],
                        'about'         => $contact_details['about'],
                        'details'       => $contact_details['location'],
                        'tags'          => $contact_details['keywords'],
                        'about'         => $contact_details['about'],
index 9441e9dbb003bc08ce7c776383b52dac4af8c657..980e82522c38f154cc5ac424d8b73666026005f3 100644 (file)
@@ -27,7 +27,6 @@ use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
-use Friendica\Util\Proxy as ProxyUtils;
 
 /**
  * This class handles methods related to the forum functionality
 
 /**
  * This class handles methods related to the forum functionality
@@ -72,7 +71,7 @@ class ForumManager
 
                $forumlist = [];
 
 
                $forumlist = [];
 
-               $fields = ['id', 'url', 'name', 'micro', 'thumb'];
+               $fields = ['id', 'url', 'name', 'micro', 'thumb', 'avatar'];
                $condition = [$condition_str, Protocol::DFRN, Protocol::ACTIVITYPUB, $uid];
                $contacts = DBA::select('contact', $fields, $condition, $params);
                if (!$contacts) {
                $condition = [$condition_str, Protocol::DFRN, Protocol::ACTIVITYPUB, $uid];
                $contacts = DBA::select('contact', $fields, $condition, $params);
                if (!$contacts) {
@@ -131,7 +130,7 @@ class ForumManager
                                        'name' => $contact['name'],
                                        'cid' => $contact['id'],
                                        'selected'      => $selected,
                                        'name' => $contact['name'],
                                        'cid' => $contact['id'],
                                        'selected'      => $selected,
-                                       'micro' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO)),
+                                       'micro' => DI::baseUrl()->remove(Contact::getMicro($contact)),
                                        'id' => ++$id,
                                ];
                                $entries[] = $entry;
                                        'id' => ++$id,
                                ];
                                $entries[] = $entry;
index b69f5abc23d44f5f69e8876f085c6b62b49ff238..7b8153b8a8e735df5b7813834ed83437b8e0fa67 100644 (file)
@@ -30,7 +30,6 @@ use Friendica\Core\Search;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Util\Network;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Util\Network;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 use Friendica\Util\XML;
 use League\HTMLToMarkdown\HtmlConverter;
 use Friendica\Util\Strings;
 use Friendica\Util\XML;
 use League\HTMLToMarkdown\HtmlConverter;
@@ -868,7 +867,7 @@ class HTML
                        '$click' => $contact['click'] ?? '',
                        '$class' => $class,
                        '$url' => $url,
                        '$click' => $contact['click'] ?? '',
                        '$class' => $class,
                        '$url' => $url,
-                       '$photo' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB),
+                       '$photo' => Contact::getThumb($contact),
                        '$name' => $contact['name'],
                        'title' => $contact['name'] . ' [' . $contact['addr'] . ']',
                        '$parkle' => $sparkle,
                        '$name' => $contact['name'],
                        'title' => $contact['name'] . ' [' . $contact['addr'] . ']',
                        '$parkle' => $sparkle,
index fad863fbeb23b13075c93463bc30b8bc5b2a3597..e8e70c0e11cf097fee20a05757e92f4e75674be2 100644 (file)
@@ -34,7 +34,6 @@ use Friendica\Model\Group;
 use Friendica\Model\Item;
 use Friendica\Model\Profile;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Model\Item;
 use Friendica\Model\Profile;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
@@ -432,10 +431,11 @@ class Widget
 
                $entries = [];
                foreach ($r as $rr) {
 
                $entries = [];
                foreach ($r as $rr) {
+                       $contact = Contact::getByURL($rr['url']);
                        $entry = [
                                'url'   => Contact::magicLink($rr['url']),
                        $entry = [
                                'url'   => Contact::magicLink($rr['url']),
-                               'name'  => $rr['name'],
-                               'photo' => ProxyUtils::proxifyUrl($rr['photo'], false, ProxyUtils::SIZE_THUMB),
+                               'name'  => $contact['name'] ?? $rr['name'],
+                               'photo' => Contact::getThumb($contact, $rr['photo']),
                        ];
                        $entries[] = $entry;
                }
                        ];
                        $entries[] = $entry;
                }
index 47fac09a83aeb292476f7e0ac0077b4479ff36d1..85c722c8a02afc326916cd609c1d1640e53be198 100644 (file)
@@ -98,7 +98,7 @@ class ContactBlock
                                        $contact_ids[] = $contact["id"];
                                }
 
                                        $contact_ids[] = $contact["id"];
                                }
 
-                               $contacts_stmt = DBA::select('contact', ['id', 'uid', 'addr', 'url', 'name', 'thumb', 'network'], ['id' => $contact_ids]);
+                               $contacts_stmt = DBA::select('contact', ['id', 'uid', 'addr', 'url', 'name', 'thumb', 'avatar', 'network'], ['id' => $contact_ids]);
 
                                if (DBA::isResult($contacts_stmt)) {
                                        $contacts_title = DI::l10n()->tt('%d Contact', '%d Contacts', $total);
 
                                if (DBA::isResult($contacts_stmt)) {
                                        $contacts_title = DI::l10n()->tt('%d Contact', '%d Contacts', $total);
index 982c2a7e0d1cefe412e6d7fe6c44b7ce4f2cf296..ba36b0cef41cdfb54c28cecdb771d34a319d323f 100644 (file)
@@ -97,7 +97,7 @@ class Notification extends BaseFactory
 
                $item['label'] = (($item['gravity'] == GRAVITY_PARENT) ? 'post' : 'comment');
                $item['link']  = $this->baseUrl->get(true) . '/display/' . $item['parent-guid'];
 
                $item['label'] = (($item['gravity'] == GRAVITY_PARENT) ? 'post' : 'comment');
                $item['link']  = $this->baseUrl->get(true) . '/display/' . $item['parent-guid'];
-               $item['image'] = Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO);
+               $item['image'] = $item['author-avatar'];
                $item['url']   = $item['author-link'];
                $item['text']  = (($item['gravity'] == GRAVITY_PARENT)
                        ? $this->l10n->t("%s created a new post", $item['author-name'])
                $item['url']   = $item['author-link'];
                $item['text']  = (($item['gravity'] == GRAVITY_PARENT)
                        ? $this->l10n->t("%s created a new post", $item['author-name'])
@@ -125,7 +125,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'like',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'like',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s liked %s's post", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s liked %s's post", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -136,7 +136,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'dislike',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'dislike',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s disliked %s's post", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s disliked %s's post", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -147,7 +147,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attend',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attend',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -158,7 +158,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attendno',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attendno',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is not attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is not attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -169,7 +169,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attendmaybe',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attendmaybe',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s may attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s may attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -196,7 +196,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'friend',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'friend',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is now friends with %s", $item['author-name'], $item['fname']),
                                        'when'  => $item['when'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is now friends with %s", $item['author-name'], $item['fname']),
                                        'when'  => $item['when'],
index 57b5976ef0c9834c7cf1685b5e29ddc705a403a5..08970f67d77d52417cbdbcdd5dd5aab8d327e358 100644 (file)
@@ -31,7 +31,6 @@ use Friendica\Model;
 use Friendica\Network\HTTPException;
 use Friendica\Object\Search\ContactResult;
 use Friendica\Object\Search\ResultList;
 use Friendica\Network\HTTPException;
 use Friendica\Object\Search\ContactResult;
 use Friendica\Object\Search\ResultList;
-use Friendica\Util\Proxy as ProxyUtils;
 
 /**
  * Base class for search modules
 
 /**
  * Base class for search modules
@@ -160,13 +159,14 @@ class BaseSearch extends BaseModule
                                }
 
                                $photo = str_replace("http:///photo/", Search::getGlobalDirectory() . "/photo/", $result->getPhoto());
                                }
 
                                $photo = str_replace("http:///photo/", Search::getGlobalDirectory() . "/photo/", $result->getPhoto());
+                               $contact = Model\Contact::getByURL($result->getUrl());
 
                                $entry     = [
                                        'alt_text'     => $alt_text,
                                        'url'          => Model\Contact::magicLink($result->getUrl()),
                                        'itemurl'      => $result->getItem(),
 
                                $entry     = [
                                        'alt_text'     => $alt_text,
                                        'url'          => Model\Contact::magicLink($result->getUrl()),
                                        'itemurl'      => $result->getItem(),
-                                       'name'         => $result->getName(),
-                                       'thumb'        => ProxyUtils::proxifyUrl($photo, false, ProxyUtils::SIZE_THUMB),
+                                       'name'         => $contact['name'] ?? $result->getName(),
+                                       'thumb'        => Model\Contact::getThumb($contact, $photo),
                                        'img_hover'    => $result->getTags(),
                                        'conntxt'      => $connTxt,
                                        'connlnk'      => $connLink,
                                        'img_hover'    => $result->getTags(),
                                        'conntxt'      => $connTxt,
                                        'connlnk'      => $connLink,
index d21524a7939b5ed01add85c8538ef1d98198055b..3fa89cde916eb7aa64794f636429fd91a5643db0 100644 (file)
@@ -40,7 +40,6 @@ use Friendica\Module\Security\Login;
 use Friendica\Network\HTTPException\BadRequestException;
 use Friendica\Network\HTTPException\NotFoundException;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Network\HTTPException\BadRequestException;
 use Friendica\Network\HTTPException\NotFoundException;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 
 /**
 use Friendica\Util\Strings;
 
 /**
@@ -1067,7 +1066,7 @@ class Contact extends BaseModule
                        'id'        => $rr['id'],
                        'alt_text'  => $alt_text,
                        'dir_icon'  => $dir_icon,
                        'id'        => $rr['id'],
                        'alt_text'  => $alt_text,
                        'dir_icon'  => $dir_icon,
-                       'thumb'     => ProxyUtils::proxifyUrl($rr['thumb'], false, ProxyUtils::SIZE_THUMB),
+                       'thumb'     => Model\Contact::getThumb($rr),
                        'name'      => $rr['name'],
                        'username'  => $rr['name'],
                        'account_type' => Model\Contact::getAccountType($rr),
                        'name'      => $rr['name'],
                        'username'  => $rr['name'],
                        'account_type' => Model\Contact::getAccountType($rr),
index 2c0cc967c03f20cc0aad820712e6bf74d7483a8c..1e08adbe66dbd918e72dd2102b0f711882279672 100644 (file)
@@ -32,7 +32,6 @@ use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
 use Friendica\Network\HTTPException;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
 use Friendica\Network\HTTPException;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 
 /**
 use Friendica\Util\Strings;
 
 /**
@@ -83,14 +82,14 @@ class Acl extends BaseModule
                                DI::logger()->warning('Wrong result item from Search::searchGlobalContact', ['$g' => $g, '$search' => $search, '$mode' => $mode, '$page' => $page]);
                                continue;
                        }
                                DI::logger()->warning('Wrong result item from Search::searchGlobalContact', ['$g' => $g, '$search' => $search, '$mode' => $mode, '$page' => $page]);
                                continue;
                        }
-
+                       $contact = Contact::getByURL($g['url']);
                        $contacts[] = [
                        $contacts[] = [
-                               'photo'   => ProxyUtils::proxifyUrl($g['photo'], false, ProxyUtils::SIZE_MICRO),
-                               'name'    => htmlspecialchars($g['name']),
-                               'nick'    => $g['addr'] ?: $g['url'],
-                               'network' => $g['network'],
+                               'photo'   => Contact::getMicro($contact, $g['photo']),
+                               'name'    => htmlspecialchars($contact['name'] ?? $g['name']),
+                               'nick'    => $contact['nick'] ?? ($g['addr'] ?: $g['url']),
+                               'network' => $contact['network'] ?? $g['network'],
                                'link'    => $g['url'],
                                'link'    => $g['url'],
-                               'forum'   => !empty($g['community']) ? 1 : 0,
+                               'forum'   => !empty($g['community']),
                        ];
                }
 
                        ];
                }
 
@@ -231,7 +230,7 @@ class Acl extends BaseModule
                $r = [];
                switch ($type) {
                        case self::TYPE_MENTION_CONTACT_GROUP:
                $r = [];
                switch ($type) {
                        case self::TYPE_MENTION_CONTACT_GROUP:
-                               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv`, (`prv` OR `forum`) AS `frm` FROM `contact`
+                               $r = q("SELECT `id`, `name`, `nick`, `avatar`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv`, (`prv` OR `forum`) AS `frm` FROM `contact`
                                        WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                                        AND NOT (`network` IN ('%s', '%s'))
                                        $sql_extra2
                                        WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                                        AND NOT (`network` IN ('%s', '%s'))
                                        $sql_extra2
@@ -243,7 +242,7 @@ class Acl extends BaseModule
                                break;
 
                        case self::TYPE_MENTION_CONTACT:
                                break;
 
                        case self::TYPE_MENTION_CONTACT:
-                               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
+                               $r = q("SELECT `id`, `name`, `nick`, `avatar`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
                                        WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                                        AND NOT (`network` IN ('%s'))
                                        $sql_extra2
                                        WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                                        AND NOT (`network` IN ('%s'))
                                        $sql_extra2
@@ -254,7 +253,7 @@ class Acl extends BaseModule
                                break;
 
                        case self::TYPE_MENTION_FORUM:
                                break;
 
                        case self::TYPE_MENTION_FORUM:
-                               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
+                               $r = q("SELECT `id`, `name`, `nick`, `avatar`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
                                        WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                                        AND NOT (`network` IN ('%s'))
                                        AND (`forum` OR `prv`)
                                        WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
                                        AND NOT (`network` IN ('%s'))
                                        AND (`forum` OR `prv`)
@@ -266,7 +265,7 @@ class Acl extends BaseModule
                                break;
 
                        case self::TYPE_PRIVATE_MESSAGE:
                                break;
 
                        case self::TYPE_PRIVATE_MESSAGE:
-                               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
+                               $r = q("SELECT `id`, `name`, `nick`, `avatar`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
                                        WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
                                        AND `network` IN ('%s', '%s', '%s')
                                        $sql_extra2
                                        WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
                                        AND `network` IN ('%s', '%s', '%s')
                                        $sql_extra2
@@ -280,7 +279,7 @@ class Acl extends BaseModule
 
                        case self::TYPE_ANY_CONTACT:
                        default:
 
                        case self::TYPE_ANY_CONTACT:
                        default:
-                               $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
+                               $r = q("SELECT `id`, `name`, `nick`, `avatar`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv`, `avatar` FROM `contact`
                                        WHERE `uid` = %d AND NOT `deleted` AND NOT `pending` AND NOT `archive`
                                        $sql_extra2
                                        ORDER BY `name`",
                                        WHERE `uid` = %d AND NOT `deleted` AND NOT `pending` AND NOT `archive`
                                        $sql_extra2
                                        ORDER BY `name`",
@@ -350,7 +349,7 @@ class Acl extends BaseModule
                                        continue;
                                }
 
                                        continue;
                                }
 
-                               $contact = Contact::getByURL($author, false, ['micro', 'name', 'id', 'network', 'nick', 'addr', 'url', 'forum']);
+                               $contact = Contact::getByURL($author, false, ['micro', 'name', 'id', 'network', 'nick', 'addr', 'url', 'forum', 'avatar']);
 
                                if (count($contact) > 0) {
                                        $unknown_contacts[] = [
 
                                if (count($contact) > 0) {
                                        $unknown_contacts[] = [
index ee886c1576a2a2342387d12dbe80642341d52959..a9d2f8634e6696842d70e5eef84c2075a1b55b4a 100644 (file)
@@ -38,7 +38,6 @@ use Friendica\Model\User;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
@@ -447,7 +446,7 @@ class Post
                        'profile_url'     => $profile_link,
                        'item_photo_menu' => item_photo_menu($item),
                        'name'            => $name_e,
                        'profile_url'     => $profile_link,
                        'item_photo_menu' => item_photo_menu($item),
                        'name'            => $name_e,
-                       'thumb'           => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
+                       'thumb'           => DI::baseUrl()->remove($item['author-avatar']),
                        'osparkle'        => $osparkle,
                        'sparkle'         => $sparkle,
                        'title'           => $title_e,
                        'osparkle'        => $osparkle,
                        'sparkle'         => $sparkle,
                        'title'           => $title_e,
@@ -461,7 +460,7 @@ class Post
                        'shiny'           => $shiny,
                        'owner_self'      => $item['author-link'] == Session::get('my_url'),
                        'owner_url'       => $this->getOwnerUrl(),
                        'shiny'           => $shiny,
                        'owner_self'      => $item['author-link'] == Session::get('my_url'),
                        'owner_url'       => $this->getOwnerUrl(),
-                       'owner_photo'     => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
+                       'owner_photo'     => DI::baseUrl()->remove($item['owner-avatar']),
                        'owner_name'      => $owner_name_e,
                        'plink'           => Item::getPlink($item),
                        'edpost'          => $edpost,
                        'owner_name'      => $owner_name_e,
                        'plink'           => Item::getPlink($item),
                        'edpost'          => $edpost,
index fdcc8f11d55bdfee42d59cb9958a496aa114edbb..3f7a1a66a97ffb306d298560e6daef38e683a447 100644 (file)
@@ -18,7 +18,6 @@ use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 
 function vier_init(App $a)
 use Friendica\Util\Strings;
 
 function vier_init(App $a)
@@ -127,11 +126,12 @@ function vier_community_info()
                        $aside['$comunity_profiles_items'] = [];
 
                        foreach ($r as $rr) {
                        $aside['$comunity_profiles_items'] = [];
 
                        foreach ($r as $rr) {
+                               $contact = Contact::getByURL($rr['url']);
                                $entry = Renderer::replaceMacros($tpl, [
                                        '$id' => $rr['id'],
                                        '$profile_link' => 'follow/?url='.urlencode($rr['url']),
                                $entry = Renderer::replaceMacros($tpl, [
                                        '$id' => $rr['id'],
                                        '$profile_link' => 'follow/?url='.urlencode($rr['url']),
-                                       '$photo' => ProxyUtils::proxifyUrl($rr['photo'], false, ProxyUtils::SIZE_MICRO),
-                                       '$alt_text' => $rr['name'],
+                                       '$photo' => Contact::getMicro($contact, $rr['photo']),
+                                       '$alt_text' => $contact['name'] ?? $rr['name'],
                                ]);
                                $aside['$comunity_profiles_items'][] = $entry;
                        }
                                ]);
                                $aside['$comunity_profiles_items'][] = $entry;
                        }
@@ -207,7 +207,7 @@ function vier_community_info()
                                        'name'         => $contact['name'],
                                        'cid'          => $contact['id'],
                                        'selected'     => $selected,
                                        'name'         => $contact['name'],
                                        'cid'          => $contact['id'],
                                        'selected'     => $selected,
-                                       'micro'        => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO)),
+                                       'micro'        => Contact::getMicro($contact),
                                        'id'           => ++$id,
                                ];
                                $entries[] = $entry;
                                        'id'           => ++$id,
                                ];
                                $entries[] = $entry;