Simplified functionality to load the profile in the sidebar

This commit is contained in:
Michael 2021-07-23 12:39:37 +00:00
parent fe8e71216d
commit afe3c8954c
15 changed files with 195 additions and 138 deletions

View file

@ -272,7 +272,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$ssl_state = (local_user() ? true : false);
$profile_owner = 0;
$live_update_div = '';
$blocklist = conv_get_blocklist();
@ -281,7 +280,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
if ($mode === 'network') {
$items = conversation_add_children($items, false, $order, $uid);
$profile_owner = local_user();
if (!$update) {
/*
* The special div is needed for liveUpdate to kick in for this page.
@ -308,7 +306,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
}
} elseif ($mode === 'profile') {
$items = conversation_add_children($items, false, $order, $uid);
$profile_owner = $a->profile['uid'];
if (!$update) {
$tab = 'posts';
@ -322,13 +319,12 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
*/
$live_update_div = '<div id="live-profile"></div>' . "\r\n"
. "<script> var profile_uid = " . $a->profile['uid']
. "<script> var profile_uid = " . $uid
. "; var netargs = '?f='; </script>\r\n";
}
}
} elseif ($mode === 'notes') {
$items = conversation_add_children($items, false, $order, local_user());
$profile_owner = local_user();
if (!$update) {
$live_update_div = '<div id="live-notes"></div>' . "\r\n"
@ -337,7 +333,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
}
} elseif ($mode === 'display') {
$items = conversation_add_children($items, false, $order, $uid);
$profile_owner = $a->profile['uid'];
if (!$update) {
$live_update_div = '<div id="live-display"></div>' . "\r\n"
@ -346,7 +341,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
}
} elseif ($mode === 'community') {
$items = conversation_add_children($items, true, $order, $uid);
$profile_owner = 0;
if (!$update) {
$live_update_div = '<div id="live-community"></div>' . "\r\n"
@ -357,7 +351,6 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
}
} elseif ($mode === 'contacts') {
$items = conversation_add_children($items, false, $order, $uid);
$profile_owner = 0;
if (!$update) {
$live_update_div = '<div id="live-contact"></div>' . "\r\n"
@ -368,7 +361,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$live_update_div = '<div id="live-search"></div>' . "\r\n";
}
$page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
$page_dropping = ((local_user() && local_user() == $uid) ? true : false);
if (!$update) {
$_SESSION['return_path'] = DI::args()->getQueryString();

View file

@ -21,7 +21,7 @@
use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Content\Widget;
use Friendica\Core\ACL;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
@ -32,8 +32,7 @@ use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\Profile;
use Friendica\Module\Objects;
use Friendica\Module\ActivityPub\Objects;
use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\DFRN;
@ -126,7 +125,7 @@ function display_init(App $a)
}
}
Profile::load($a, $nick, $profiledata);
DI::page()['aside'] = Widget\VCard::getHTML($profiledata);
}
function display_fetchauthor($a, $item)
@ -257,6 +256,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$is_remote_contact = false;
$item_uid = local_user();
$page_uid = 0;
$parent = null;
if (!empty($parent_uri_id)) {
@ -264,21 +264,21 @@ function display_content(App $a, $update = false, $update_uid = 0)
}
if (DBA::isResult($parent)) {
$a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid'];
$is_remote_contact = Session::getRemoteContactID($a->profile['uid']);
$page_uid = ($page_uid ?? 0) ?: $parent['uid'];
$is_remote_contact = Session::getRemoteContactID($page_uid);
if ($is_remote_contact) {
$item_uid = $parent['uid'];
}
} else {
$a->profile = ['uid' => intval($item['uid'])];
$page_uid = $item['uid'];
}
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $page_uid]);
if (DBA::isResult($page_contact)) {
$a->page_contact = $page_contact;
}
$is_owner = (local_user() && (in_array($a->profile['uid'], [local_user(), 0])) ? true : false);
$is_owner = (local_user() && (in_array($page_uid, [local_user(), 0])) ? true : false);
if (!empty($a->profile['hidewall']) && !$is_owner && !$is_remote_contact) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.'));
@ -299,9 +299,9 @@ function display_content(App $a, $update = false, $update_uid = 0)
];
$o .= status_editor($a, $x, 0, true);
}
$sql_extra = Item::getPermissionsSQLByUserId($a->profile['uid']);
$sql_extra = Item::getPermissionsSQLByUserId($page_uid);
if (local_user() && (local_user() == $a->profile['uid'])) {
if (local_user() && (local_user() == $page_uid)) {
$condition = ['parent-uri-id' => $parent_uri_id, 'uid' => local_user(), 'unseen' => true];
$unseen = Post::exists($condition);
} else {
@ -314,7 +314,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$condition = ["`uri-id` = ? AND `uid` IN (0, ?) " . $sql_extra, $uri_id, $item_uid];
$fields = ['parent-uri-id', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id', 'owner-id', 'contact-id'];
$item = Post::selectFirstForUser($a->profile['uid'], $fields, $condition);
$item = Post::selectFirstForUser($page_uid, $fields, $condition);
if (!DBA::isResult($item)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('The requested item doesn\'t exist or has been deleted.'));

View file

@ -20,6 +20,7 @@
*/
use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\DI;
@ -157,7 +158,7 @@ function follow_content(App $a)
DI::page()['aside'] = '';
if ($protocol != Protocol::PHANTOM) {
Profile::load($a, '', $contact, false);
DI::page()['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false));
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'),
['$title' => DI::l10n()->t('Status Messages and Posts')]

View file

@ -20,12 +20,12 @@
*/
use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Util\Strings;
@ -105,7 +105,7 @@ function unfollow_content(App $a)
]);
DI::page()['aside'] = '';
Profile::load($a, '', Contact::getByURL($contact['url'], false));
DI::page()['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false));
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => DI::l10n()->t('Status Messages and Posts')]);

View file

@ -0,0 +1,99 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Content\Widget;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\Strings;
/**
* VCard widget
*
* @author Michael Vogel
*/
class VCard
{
/**
* Get HTML for vcard block
*
* @template widget/vcard.tpl
* @return string
*/
public static function getHTML(array $contact)
{
if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
$network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
} else {
$network_link = '';
}
$follow_link = '';
$unfollow_link = '';
$wallmessage_link = '';
if (local_user()) {
if ($contact['uid']) {
$id = $contact['id'];
$rel = $contact['rel'];
$pending = $contact['pending'];
} else {
$pcontact = Contact::selectFirst(['id', 'rel', 'pending'], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]);
$id = $pcontact['id'] ?? 0;
$rel = $pcontact['rel'] ?? Contact::NOTHING;
$pending = $pcontact['pending'] ?? false;
}
if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
if (in_array($rel, [Contact::SHARING, Contact::FRIEND])) {
$unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1';
} elseif(!$pending) {
$follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1';
}
}
if (in_array($rel, [Contact::FOLLOWER, Contact::FRIEND]) && Contact::canReceivePrivateMessages($contact)) {
$wallmessage_link = 'message/new/' . $id;
}
}
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
'$contact' => $contact,
'$photo' => Contact::getPhoto($contact),
'$url' => Contact::magicLinkByContact($contact, $contact['url']),
'$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'] ?? ''),
'$xmpp' => DI::l10n()->t('XMPP:'),
'$location' => DI::l10n()->t('Location:'),
'$network_link' => $network_link,
'$network' => DI::l10n()->t('Network:'),
'$account_type' => Contact::getAccountType($contact),
'$follow' => DI::l10n()->t('Follow'),
'$follow_link' => $follow_link,
'$unfollow' => DI::l10n()->t('Unfollow'),
'$unfollow_link' => $unfollow_link,
'$wallmessage' => DI::l10n()->t('Message'),
'$wallmessage_link' => $wallmessage_link,
]);
}
}

View file

@ -468,18 +468,14 @@ class Item
// Checking if there is already an item with the same guid
$condition = ['guid' => $item['guid'], 'network' => $item['network'], 'uid' => $item['uid']];
if (Post::exists($condition)) {
Logger::notice('Found already existing item', [
'guid' => $item['guid'],
'uid' => $item['uid'],
'network' => $item['network']
]);
Logger::notice('Found already existing item', $condition);
return true;
}
$condition = ['uri-id' => $item['uri-id'], 'uid' => $item['uid'],
'network' => [$item['network'], Protocol::DFRN]];
if (Post::exists($condition)) {
Logger::notice('duplicated item with the same uri found.', $item);
Logger::notice('duplicated item with the same uri found.', $condition);
return true;
}
@ -487,7 +483,7 @@ class Item
if (in_array($item['network'], [Protocol::DFRN, Protocol::DIASPORA])) {
$condition = ['guid' => $item['guid'], 'uid' => $item['uid']];
if (Post::exists($condition)) {
Logger::notice('duplicated item with the same guid found.', $item);
Logger::notice('duplicated item with the same guid found.', $condition);
return true;
}
} elseif ($item['network'] == Protocol::OSTATUS) {

View file

@ -211,38 +211,12 @@ class Profile
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function load(App $a, $nickname, array $profiledata = [], $show_connect = true)
public static function load(App $a, $nickname)
{
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
if (!DBA::isResult($user) && empty($profiledata)) {
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
return;
}
if (count($profiledata) > 0) {
// Ensure to have a "nickname" field
if (empty($profiledata['nickname']) && !empty($profiledata['nick'])) {
$profiledata['nickname'] = $profiledata['nick'];
}
// Add profile data to sidebar
DI::page()['aside'] .= self::sidebar($a, $profiledata, true, $show_connect);
if (!DBA::isResult($user)) {
return;
}
}
$profile = !empty($user['uid']) ? User::getOwnerDataById($user['uid'], false) : [];
if (empty($profile) && empty($profiledata)) {
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
return;
}
$profile = User::getOwnerDataByNick($nickname);
if (empty($profile)) {
$profile = ['uid' => 0, 'name' => $nickname];
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
return;
}
$a->profile = $profile;
@ -253,7 +227,7 @@ class Profile
DI::page()['title'] = $a->profile['name'] . ' @ ' . DI::config()->get('config', 'sitename');
if (!$profiledata && !DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) {
if (!DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) {
$a->setCurrentTheme($a->profile['theme']);
$a->setCurrentMobileTheme($a->profile['mobile-theme']);
}
@ -269,16 +243,14 @@ class Profile
require_once $theme_info_file;
}
$block = ((DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) ? true : false);
$block = (DI::config()->get('system', 'block_public') && !Session::isAuthenticated());
/**
* @todo
* By now, the contact block isn't shown, when a different profile is given
* But: When this profile was on the same server, then we could display the contacts
*/
if (!$profiledata) {
DI::page()['aside'] .= self::sidebar($a, $a->profile, $block, $show_connect);
}
DI::page()['aside'] .= self::sidebar($a, $a->profile, $block);
return;
}
@ -304,7 +276,7 @@ class Profile
* @hooks 'profile_sidebar'
* array $arr
*/
private static function sidebar(App $a, array $profile, $block = 0, $show_connect = true)
private static function sidebar(App $a, array $profile, $block = 0)
{
$o = '';
$location = false;
@ -374,7 +346,7 @@ class Profile
|| in_array($profile_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]);
$visitor_base_path = self::getMyURL() ? preg_replace('=/profile/(.*)=ism', '', self::getMyURL()) : '';
if (!$local_user_is_self && $show_connect) {
if (!$local_user_is_self) {
if (!$visitor_is_authenticated) {
// Remote follow is only available for local profiles
if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()->get()) === 0) {
@ -495,7 +467,7 @@ class Profile
$p['photo'] = Contact::getAvatarUrlForId($cid, ProxyUtils::SIZE_SMALL);
$p['url'] = Contact::magicLinkById($cid);
$p['url'] = Contact::magicLinkById($cid, $profile['url']);
$tpl = Renderer::getMarkupTemplate('profile/vcard.tpl');
$o .= Renderer::replaceMacros($tpl, [

View file

@ -308,42 +308,7 @@ class Contact extends BaseModule
$a->data['contact'] = $contact;
if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
$network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
} else {
$network_link = '';
}
$follow_link = '';
$unfollow_link = '';
if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
if ($contact['uid'] && in_array($contact['rel'], [Model\Contact::SHARING, Model\Contact::FRIEND])) {
$unfollow_link = 'unfollow?url=' . urlencode($contact['url']) . '&auto=1';
} elseif(!$contact['pending']) {
$follow_link = 'follow?url=' . urlencode($contact['url']) . '&auto=1';
}
}
$wallmessage_link = '';
if ($contact['uid'] && Model\Contact::canReceivePrivateMessages($contact)) {
$wallmessage_link = 'message/new/' . $contact['id'];
}
$vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
'$name' => $contact['name'],
'$photo' => Model\Contact::getPhoto($contact),
'$url' => Model\Contact::magicLinkByContact($contact, $contact['url']),
'$addr' => $contact['addr'] ?? '',
'$network_link' => $network_link,
'$network' => DI::l10n()->t('Network:'),
'$account_type' => Model\Contact::getAccountType($contact),
'$follow' => DI::l10n()->t('Follow'),
'$follow_link' => $follow_link,
'$unfollow' => DI::l10n()->t('Unfollow'),
'$unfollow_link' => $unfollow_link,
'$wallmessage' => DI::l10n()->t('Message'),
'$wallmessage_link' => $wallmessage_link,
]);
$vcard_widget = Widget\VCard::getHTML($contact);
$findpeople_widget = '';
$follow_widget = '';
@ -1002,11 +967,11 @@ class Contact extends BaseModule
}
if (DBA::isResult($contact)) {
DI::page()['aside'] = '';
if (!$update) {
$profiledata = Model\Contact::getByURLForUser($contact['url'], local_user());
Model\Profile::load($a, '', $profiledata, true);
DI::page()['aside'] = Widget\VCard::getHTML($profiledata);
} else {
DI::page()['aside'] = '';
}
if ($contact['uid'] == 0) {
@ -1026,15 +991,13 @@ class Contact extends BaseModule
$o = self::getTabsHTML($contact, self::TAB_POSTS);
if (DBA::isResult($contact)) {
DI::page()['aside'] = '';
$profiledata = Model\Contact::getByURLForUser($contact['url'], local_user());
if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) {
$profiledata['remoteconnect'] = DI::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);
}
Model\Profile::load($a, '', $profiledata, true);
DI::page()['aside'] = Widget\VCard::getHTML($profiledata);
if ($contact['uid'] == 0) {
$o .= Model\Contact::getPostsFromId($contact['id']);

View file

@ -22,6 +22,7 @@
namespace Friendica\Module\Contact;
use Friendica\BaseModule;
use Friendica\Content\Widget;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
@ -104,7 +105,7 @@ class Advanced extends BaseModule
throw new BadRequestException(DI::l10n()->t('Contact not found.'));
}
Model\Profile::load(DI::app(), "", Model\Contact::getByURL($contact["url"], false));
DI::page()['aside'] = Widget\VCard::getHTML($contact);
$warning = DI::l10n()->t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.');
$info = DI::l10n()->t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.');

View file

@ -38,7 +38,7 @@ class Contacts extends BaseModule
$localContactId = Model\Contact::getPublicIdByUserId(local_user());
Model\Profile::load($app, '', $contact);
DI::page()['aside'] = Widget\VCard::getHTML($contact);
$condition = [
'blocked' => false,

View file

@ -3,6 +3,7 @@
namespace Friendica\Module\Contact;
use Friendica\BaseModule;
use Friendica\Content\Widget;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
@ -135,7 +136,7 @@ class Poke extends BaseModule
throw new HTTPException\NotFoundException();
}
Model\Profile::load(DI::app(), '', Model\Contact::getByURL($contact["url"], false));
DI::page()['aside'] = Widget\VCard::getHTML(Model\Contact::getByURL($contact["url"], false));
$verbs = [];
foreach (DI::l10n()->getPokeVerbs() as $verb => $translations) {

View file

@ -878,8 +878,8 @@ class Feed
Protocol::OSTATUS, Protocol::DFRN, Protocol::DIASPORA];
if ($filter === 'comments') {
$condition[0] .= " AND `object-type` = ? ";
$condition[] = Activity\ObjectType::COMMENT;
$condition[0] .= " AND `gravity` = ? ";
$condition[] = GRAVITY_COMMENT;
}
if ($owner['account-type'] != User::ACCOUNT_TYPE_COMMUNITY) {

View file

@ -55,9 +55,9 @@ class UpdateContacts
$ids = self::getContactsToUpdate($condition, [], $limit);
Logger::info('Fetched federated user contacts', ['count' => count($ids)]);
$conditions = ["`id` IN (SELECT `author-id` FROM `post-user` WHERE `author-id` = `contact`.`id`)",
"`id` IN (SELECT `owner-id` FROM `post-user` WHERE `owner-id` = `contact`.`id`)",
"`id` IN (SELECT `causer-id` FROM `post-user` WHERE `causer-id` = `contact`.`id`)",
$conditions = ["`id` IN (SELECT `author-id` FROM `post` WHERE `author-id` = `contact`.`id`)",
"`id` IN (SELECT `owner-id` FROM `post` WHERE `owner-id` = `contact`.`id`)",
"`id` IN (SELECT `causer-id` FROM `post` WHERE `causer-id` = `contact`.`id`)",
"`id` IN (SELECT `cid` FROM `post-tag` WHERE `cid` = `contact`.`id`)",
"`id` IN (SELECT `cid` FROM `user-contact` WHERE `cid` = `contact`.`id`)"];

View file

@ -1,14 +1,27 @@
<div class="vcard h-card">
<div class="fn p-name" dir="auto">{{$name}}</div>
{{if $addr}}<div class="p-addr">{{$addr}}</div>{{/if}}
{{if $about}}<div class="title p-about" dir="auto">{{$about nofilter}}</div>{{/if}}
<div class="fn p-name" dir="auto">{{$contact.name}}</div>
{{if $contact.addr}}<div class="p-addr">{{$contact.addr}}</div>{{/if}}
{{if $url}}
<div id="profile-photo-wrapper"><a href="{{$url}}"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></a></div>
{{else}}
<div id="profile-photo-wrapper"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></div>
{{/if}}
{{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
{{if $about}}<div class="title p-about" dir="auto">{{$about nofilter}}</div>{{/if}}
{{if $contact.xmpp}}
<dl class="xmpp">
<dt class="xmpp-label">{{$xmpp}}</dt>
<dd class="xmpp-data">{{$contact.xmpp}}</dd>
</dl>
{{/if}}
{{if $contact.location}}
<dl class="location" dir="auto">
<dt class="location-label">{{$location}}</dt>
<dd class="adr h-adr">
<p class="p-location">{{$contact.location}}</p>
</dd>
</dl>
{{/if}}
{{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
<div id="profile-extra-links">

View file

@ -2,9 +2,9 @@
<div id="profile-photo-wrapper">
{{if $url}}
<a href="{{$url}}"><img class="photo u-photo" src="{{$photo}}" alt="{{$name}}" /></a>
<a href="{{$url}}"><img class="photo u-photo" src="{{$photo}}" alt="{{$contact.name}}" /></a>
{{else}}
<img class="photo u-photo" src="{{$photo}}" alt="{{$name}}" />
<img class="photo u-photo" src="{{$photo}}" alt="{{$contact.name}}" />
{{/if}}
</div>
@ -12,27 +12,25 @@
<div id="vcard-short-info-wrapper" style="display: none;">
<div id="vcard-short-info" class="media" style="display: none">
<div id="vcard-short-photo-wrapper" class="pull-left">
<img class="media-object" src="{{$photo}}" alt="{{$name}}" />
<img class="media-object" src="{{$photo}}" alt="{{$contact.name}}" />
</div>
<div id="vcard-short-desc" class="media-body">
<h4 class="media-heading" dir="auto">{{$name}}</h4>
{{if $addr}}<div class="vcard-short-addr">{{$addr}}</div>{{/if}}
<h4 class="media-heading" dir="auto">{{$contact.name}}</h4>
{{if $contact.addr}}<div class="vcard-short-addr">{{$contact.addr}}</div>{{/if}}
</div>
</div>
</div>
<div class="panel-body">
<div class="profile-header">
<h3 class="fn p-name" dir="auto">{{$name}}</h3>
<h3 class="fn p-name" dir="auto">{{$contact.name}}</h3>
{{if $addr}}<div class="p-addr">{{$addr}}</div>{{/if}}
{{if $contact.addr}}<div class="p-addr">{{$contact.addr}}</div>{{/if}}
{{if $account_type}}<div class="account-type">({{$account_type}})</div>{{/if}}
{{if $about}}<div class="title" dir="auto">{{$about nofilter}}</div>{{/if}}
{{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
</div>
<div id="profile-extra-links">
@ -59,5 +57,25 @@
</div>
{{/if}}
</div>
<div class="clear"></div>
{{if $contact.location}}
<div class="location detail">
<span class="location-label icon"><i class="fa fa-map-marker"></i></span>
<span class="adr">
<p class="p-location">{{$contact.location}}</p>
</span>
</div>
{{/if}}
{{if $contact.xmpp}}
<div class="xmpp">
<span class="xmpp-label icon"><i class="fa fa-comments"></i></span>
<span class="xmpp-data"><a href="xmpp:{{$contact.xmpp}}" rel="me" target="_blank" rel="noopener noreferrer">{{include file="sub/punct_wrap.tpl" text=$contact.xmpp}}</a></span>
</div>
{{/if}}
{{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
</div>
</div>