Some more avatar function replacements

This commit is contained in:
Michael 2020-07-28 19:30:55 +00:00
parent 701dbdf7fc
commit 71b6226909
15 changed files with 47 additions and 63 deletions

View File

@ -40,7 +40,6 @@ use Friendica\Object\Thread;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\Crypto; use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Temporal; use Friendica\Util\Temporal;
use Friendica\Util\XML; use Friendica\Util\XML;
@ -593,7 +592,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'name' => $profile_name, 'name' => $profile_name,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'lock' => $lock, 'lock' => $lock,
'thumb' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)), 'thumb' => DI::baseUrl()->remove($item['author-avatar']),
'title' => $title, 'title' => $title,
'body' => $body, 'body' => $body,
'tags' => $tags['tags'], 'tags' => $tags['tags'],
@ -613,7 +612,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'indent' => '', 'indent' => '',
'owner_name' => $owner_name, 'owner_name' => $owner_name,
'owner_url' => $owner_url, '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), 'plink' => Item::getPlink($item),
'edpost' => false, 'edpost' => false,
'isstarred' => $isstarred, 'isstarred' => $isstarred,

View File

@ -32,7 +32,6 @@ use Friendica\Model\Mail;
use Friendica\Model\Notify\Type; use Friendica\Model\Notify\Type;
use Friendica\Module\Security\Login; use Friendica\Module\Security\Login;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Temporal; use Friendica\Util\Temporal;
@ -393,12 +392,8 @@ function message_content(App $a)
$body_e = BBCode::convert($message['body']); $body_e = BBCode::convert($message['body']);
$to_name_e = $message['name']; $to_name_e = $message['name'];
$contact = Contact::getByURL($message['from-url'], false, ['thumb', 'addr']); $contact = Contact::getByURL($message['from-url'], false, ['thumb', 'addr', 'id', 'avatar']);
if (isset($contact["thumb"])) { $from_photo = Contact::getThumb($contact, $message['from-photo']);
$from_photo = $contact["thumb"];
} else {
$from_photo = $message['from-photo'];
}
$mails[] = [ $mails[] = [
'id' => $message['id'], 'id' => $message['id'],
@ -406,7 +401,7 @@ function message_content(App $a)
'from_url' => $from_url, 'from_url' => $from_url,
'from_addr' => $contact['addr'], 'from_addr' => $contact['addr'],
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB), 'from_photo' => $from_photo,
'subject' => $subject_e, 'subject' => $subject_e,
'body' => $body_e, 'body' => $body_e,
'delete' => DI::l10n()->t('Delete message'), 'delete' => DI::l10n()->t('Delete message'),
@ -525,12 +520,8 @@ function render_messages(array $msg, $t)
$body_e = $rr['body']; $body_e = $rr['body'];
$to_name_e = $rr['name']; $to_name_e = $rr['name'];
$contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr']); $contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr', 'id', 'avatar']);
if (isset($contact["thumb"])) { $from_photo = Contact::getThumb($contact, $rr['thumb'] ?: $rr['from-photo']);
$from_photo = $contact["thumb"];
} else {
$from_photo = (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']);
}
$rslt .= Renderer::replaceMacros($tpl, [ $rslt .= Renderer::replaceMacros($tpl, [
'$id' => $rr['id'], '$id' => $rr['id'],
@ -538,7 +529,7 @@ function render_messages(array $msg, $t)
'$from_url' => Contact::magicLink($rr['url']), '$from_url' => Contact::magicLink($rr['url']),
'$from_addr' => $contact['addr'] ?? '', '$from_addr' => $contact['addr'] ?? '',
'$sparkle' => ' sparkle', '$sparkle' => ' sparkle',
'$from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB), '$from_photo' => $from_photo,
'$subject' => $rr['title'], '$subject' => $rr['title'],
'$delete' => DI::l10n()->t('Delete conversation'), '$delete' => DI::l10n()->t('Delete conversation'),
'$body' => $body_e, '$body' => $body_e,

View File

@ -572,7 +572,7 @@ function networkThreadedView(App $a, $update, $parent)
'$title' => DI::l10n()->t('Group: %s', $group['name']) '$title' => DI::l10n()->t('Group: %s', $group['name'])
]) . $o; ]) . $o;
} elseif ($cid) { } elseif ($cid) {
$fields = ['id', 'name', 'network', 'writable', 'nurl', $fields = ['id', 'name', 'network', 'writable', 'nurl', 'avatar',
'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location']; 'forum', 'prv', 'contact-type', 'addr', 'thumb', 'location'];
$condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid]; $condition = ["`id` = ? AND (NOT `blocked` OR `pending`)", $cid];
$contact = DBA::selectFirst('contact', $fields, $condition); $contact = DBA::selectFirst('contact', $fields, $condition);

View File

@ -327,7 +327,7 @@ function ping_init(App $a)
if (DBA::isResult($notifs)) { if (DBA::isResult($notifs)) {
foreach ($notifs as $notif) { 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']); $notif['photo'] = Contact::getMicro($contact, $notif['photo']);
$local_time = DateTimeFormat::local($notif['date']); $local_time = DateTimeFormat::local($notif['date']);

View File

@ -27,7 +27,6 @@ use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; 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']), 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
'img_hover' => $rr['url'], 'img_hover' => $rr['url'],
'name' => $contact_details['name'], 'name' => $contact_details['name'],
'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB), 'thumb' => Contact::getThumb($contact_details),
'details' => $contact_details['location'], 'details' => $contact_details['location'],
'tags' => $contact_details['keywords'], 'tags' => $contact_details['keywords'],
'about' => $contact_details['about'], 'about' => $contact_details['about'],

View File

@ -27,7 +27,6 @@ use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; 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]; $condition = [$condition_str, Protocol::DFRN, Protocol::ACTIVITYPUB, $uid];
$contacts = DBA::select('contact', $fields, $condition, $params); $contacts = DBA::select('contact', $fields, $condition, $params);
if (!$contacts) { if (!$contacts) {
@ -131,7 +130,7 @@ class ForumManager
'name' => $contact['name'], 'name' => $contact['name'],
'cid' => $contact['id'], 'cid' => $contact['id'],
'selected' => $selected, 'selected' => $selected,
'micro' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO)), 'micro' => DI::baseUrl()->remove(Contact::getMicro($contact)),
'id' => ++$id, 'id' => ++$id,
]; ];
$entries[] = $entry; $entries[] = $entry;

View File

@ -30,7 +30,6 @@ use Friendica\Core\Search;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\XML; use Friendica\Util\XML;
use League\HTMLToMarkdown\HtmlConverter; use League\HTMLToMarkdown\HtmlConverter;
@ -868,7 +867,7 @@ class HTML
'$click' => $contact['click'] ?? '', '$click' => $contact['click'] ?? '',
'$class' => $class, '$class' => $class,
'$url' => $url, '$url' => $url,
'$photo' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB), '$photo' => Contact::getThumb($contact),
'$name' => $contact['name'], '$name' => $contact['name'],
'title' => $contact['name'] . ' [' . $contact['addr'] . ']', 'title' => $contact['name'] . ' [' . $contact['addr'] . ']',
'$parkle' => $sparkle, '$parkle' => $sparkle,

View File

@ -34,7 +34,6 @@ use Friendica\Model\Group;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Temporal; use Friendica\Util\Temporal;
@ -432,10 +431,11 @@ class Widget
$entries = []; $entries = [];
foreach ($r as $rr) { foreach ($r as $rr) {
$contact = Contact::getByURL($rr['url']);
$entry = [ $entry = [
'url' => Contact::magicLink($rr['url']), 'url' => Contact::magicLink($rr['url']),
'name' => $rr['name'], 'name' => $contact['name'] ?? $rr['name'],
'photo' => ProxyUtils::proxifyUrl($rr['photo'], false, ProxyUtils::SIZE_THUMB), 'photo' => Contact::getThumb($contact, $rr['photo']),
]; ];
$entries[] = $entry; $entries[] = $entry;
} }

View 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)) { if (DBA::isResult($contacts_stmt)) {
$contacts_title = DI::l10n()->tt('%d Contact', '%d Contacts', $total); $contacts_title = DI::l10n()->tt('%d Contact', '%d Contacts', $total);

View File

@ -97,7 +97,7 @@ class Notification extends BaseFactory
$item['label'] = (($item['gravity'] == GRAVITY_PARENT) ? 'post' : 'comment'); $item['label'] = (($item['gravity'] == GRAVITY_PARENT) ? 'post' : 'comment');
$item['link'] = $this->baseUrl->get(true) . '/display/' . $item['parent-guid']; $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['url'] = $item['author-link'];
$item['text'] = (($item['gravity'] == GRAVITY_PARENT) $item['text'] = (($item['gravity'] == GRAVITY_PARENT)
? $this->l10n->t("%s created a new post", $item['author-name']) ? $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([ return new \Friendica\Object\Notification\Notification([
'label' => 'like', 'label' => 'like',
'link' => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'], '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'], 'url' => $item['author-link'],
'text' => $this->l10n->t("%s liked %s's post", $item['author-name'], $item['parent-author-name']), 'text' => $this->l10n->t("%s liked %s's post", $item['author-name'], $item['parent-author-name']),
'when' => $item['when'], 'when' => $item['when'],
@ -136,7 +136,7 @@ class Notification extends BaseFactory
return new \Friendica\Object\Notification\Notification([ return new \Friendica\Object\Notification\Notification([
'label' => 'dislike', 'label' => 'dislike',
'link' => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'], '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'], 'url' => $item['author-link'],
'text' => $this->l10n->t("%s disliked %s's post", $item['author-name'], $item['parent-author-name']), 'text' => $this->l10n->t("%s disliked %s's post", $item['author-name'], $item['parent-author-name']),
'when' => $item['when'], 'when' => $item['when'],
@ -147,7 +147,7 @@ class Notification extends BaseFactory
return new \Friendica\Object\Notification\Notification([ return new \Friendica\Object\Notification\Notification([
'label' => 'attend', 'label' => 'attend',
'link' => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'], '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'], 'url' => $item['author-link'],
'text' => $this->l10n->t("%s is attending %s's event", $item['author-name'], $item['parent-author-name']), 'text' => $this->l10n->t("%s is attending %s's event", $item['author-name'], $item['parent-author-name']),
'when' => $item['when'], 'when' => $item['when'],
@ -158,7 +158,7 @@ class Notification extends BaseFactory
return new \Friendica\Object\Notification\Notification([ return new \Friendica\Object\Notification\Notification([
'label' => 'attendno', 'label' => 'attendno',
'link' => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'], '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'], 'url' => $item['author-link'],
'text' => $this->l10n->t("%s is not attending %s's event", $item['author-name'], $item['parent-author-name']), 'text' => $this->l10n->t("%s is not attending %s's event", $item['author-name'], $item['parent-author-name']),
'when' => $item['when'], 'when' => $item['when'],
@ -169,7 +169,7 @@ class Notification extends BaseFactory
return new \Friendica\Object\Notification\Notification([ return new \Friendica\Object\Notification\Notification([
'label' => 'attendmaybe', 'label' => 'attendmaybe',
'link' => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'], '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'], 'url' => $item['author-link'],
'text' => $this->l10n->t("%s may attending %s's event", $item['author-name'], $item['parent-author-name']), 'text' => $this->l10n->t("%s may attending %s's event", $item['author-name'], $item['parent-author-name']),
'when' => $item['when'], 'when' => $item['when'],
@ -196,7 +196,7 @@ class Notification extends BaseFactory
return new \Friendica\Object\Notification\Notification([ return new \Friendica\Object\Notification\Notification([
'label' => 'friend', 'label' => 'friend',
'link' => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'], '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'], 'url' => $item['author-link'],
'text' => $this->l10n->t("%s is now friends with %s", $item['author-name'], $item['fname']), 'text' => $this->l10n->t("%s is now friends with %s", $item['author-name'], $item['fname']),
'when' => $item['when'], 'when' => $item['when'],

View File

@ -31,7 +31,6 @@ use Friendica\Model;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Object\Search\ContactResult; use Friendica\Object\Search\ContactResult;
use Friendica\Object\Search\ResultList; 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 = [ $entry = [
'alt_text' => $alt_text, 'alt_text' => $alt_text,
'url' => Model\Contact::magicLink($result->getUrl()), 'url' => Model\Contact::magicLink($result->getUrl()),
'itemurl' => $result->getItem(), 'itemurl' => $result->getItem(),
'name' => $result->getName(), 'name' => $contact['name'] ?? $result->getName(),
'thumb' => ProxyUtils::proxifyUrl($photo, false, ProxyUtils::SIZE_THUMB), 'thumb' => Model\Contact::getThumb($contact, $photo),
'img_hover' => $result->getTags(), 'img_hover' => $result->getTags(),
'conntxt' => $connTxt, 'conntxt' => $connTxt,
'connlnk' => $connLink, 'connlnk' => $connLink,

View File

@ -40,7 +40,6 @@ use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException\BadRequestException; use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Network\HTTPException\NotFoundException; use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Util\DateTimeFormat; 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'], 'id' => $rr['id'],
'alt_text' => $alt_text, 'alt_text' => $alt_text,
'dir_icon' => $dir_icon, 'dir_icon' => $dir_icon,
'thumb' => ProxyUtils::proxifyUrl($rr['thumb'], false, ProxyUtils::SIZE_THUMB), 'thumb' => Model\Contact::getThumb($rr),
'name' => $rr['name'], 'name' => $rr['name'],
'username' => $rr['name'], 'username' => $rr['name'],
'account_type' => Model\Contact::getAccountType($rr), 'account_type' => Model\Contact::getAccountType($rr),

View File

@ -32,7 +32,6 @@ use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Network\HTTPException; 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]); DI::logger()->warning('Wrong result item from Search::searchGlobalContact', ['$g' => $g, '$search' => $search, '$mode' => $mode, '$page' => $page]);
continue; continue;
} }
$contact = Contact::getByURL($g['url']);
$contacts[] = [ $contacts[] = [
'photo' => ProxyUtils::proxifyUrl($g['photo'], false, ProxyUtils::SIZE_MICRO), 'photo' => Contact::getMicro($contact, $g['photo']),
'name' => htmlspecialchars($g['name']), 'name' => htmlspecialchars($contact['name'] ?? $g['name']),
'nick' => $g['addr'] ?: $g['url'], 'nick' => $contact['nick'] ?? ($g['addr'] ?: $g['url']),
'network' => $g['network'], '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 = []; $r = [];
switch ($type) { switch ($type) {
case self::TYPE_MENTION_CONTACT_GROUP: 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` != '' 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')) AND NOT (`network` IN ('%s', '%s'))
$sql_extra2 $sql_extra2
@ -243,7 +242,7 @@ class Acl extends BaseModule
break; break;
case self::TYPE_MENTION_CONTACT: 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` != '' 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 NOT (`network` IN ('%s'))
$sql_extra2 $sql_extra2
@ -254,7 +253,7 @@ class Acl extends BaseModule
break; break;
case self::TYPE_MENTION_FORUM: 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` != '' 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 NOT (`network` IN ('%s'))
AND (`forum` OR `prv`) AND (`forum` OR `prv`)
@ -266,7 +265,7 @@ class Acl extends BaseModule
break; break;
case self::TYPE_PRIVATE_MESSAGE: 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` WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
AND `network` IN ('%s', '%s', '%s') AND `network` IN ('%s', '%s', '%s')
$sql_extra2 $sql_extra2
@ -280,7 +279,7 @@ class Acl extends BaseModule
case self::TYPE_ANY_CONTACT: case self::TYPE_ANY_CONTACT:
default: 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` WHERE `uid` = %d AND NOT `deleted` AND NOT `pending` AND NOT `archive`
$sql_extra2 $sql_extra2
ORDER BY `name`", 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) { if (count($contact) > 0) {
$unknown_contacts[] = [ $unknown_contacts[] = [

View File

@ -38,7 +38,6 @@ use Friendica\Model\User;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\Crypto; use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Temporal; use Friendica\Util\Temporal;
@ -447,7 +446,7 @@ class Post
'profile_url' => $profile_link, 'profile_url' => $profile_link,
'item_photo_menu' => item_photo_menu($item), 'item_photo_menu' => item_photo_menu($item),
'name' => $name_e, '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, 'osparkle' => $osparkle,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'title' => $title_e, 'title' => $title_e,
@ -461,7 +460,7 @@ class Post
'shiny' => $shiny, 'shiny' => $shiny,
'owner_self' => $item['author-link'] == Session::get('my_url'), 'owner_self' => $item['author-link'] == Session::get('my_url'),
'owner_url' => $this->getOwnerUrl(), '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, 'owner_name' => $owner_name_e,
'plink' => Item::getPlink($item), 'plink' => Item::getPlink($item),
'edpost' => $edpost, 'edpost' => $edpost,

View File

@ -18,7 +18,6 @@ use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings; use Friendica\Util\Strings;
function vier_init(App $a) function vier_init(App $a)
@ -127,11 +126,12 @@ function vier_community_info()
$aside['$comunity_profiles_items'] = []; $aside['$comunity_profiles_items'] = [];
foreach ($r as $rr) { foreach ($r as $rr) {
$contact = Contact::getByURL($rr['url']);
$entry = Renderer::replaceMacros($tpl, [ $entry = Renderer::replaceMacros($tpl, [
'$id' => $rr['id'], '$id' => $rr['id'],
'$profile_link' => 'follow/?url='.urlencode($rr['url']), '$profile_link' => 'follow/?url='.urlencode($rr['url']),
'$photo' => ProxyUtils::proxifyUrl($rr['photo'], false, ProxyUtils::SIZE_MICRO), '$photo' => Contact::getMicro($contact, $rr['photo']),
'$alt_text' => $rr['name'], '$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'], 'name' => $contact['name'],
'cid' => $contact['id'], 'cid' => $contact['id'],
'selected' => $selected, 'selected' => $selected,
'micro' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO)), 'micro' => Contact::getMicro($contact),
'id' => ++$id, 'id' => ++$id,
]; ];
$entries[] = $entry; $entries[] = $entry;