Extracted as variable to have 2 more array fields moved to array initialization.

This commit is contained in:
Roland Häder 2022-07-29 17:19:07 +02:00
parent 676ca36c52
commit 1210e235fb
No known key found for this signature in database
GPG Key ID: C82EDE5DDFA0BA77

View File

@ -703,6 +703,7 @@ class Contact
} }
$file_suffix = 'jpg'; $file_suffix = 'jpg';
$url = DI::baseUrl() . '/profile/' . $user['nickname'];
$fields = [ $fields = [
'name' => $profile['name'], 'name' => $profile['name'],
@ -717,7 +718,10 @@ class Contact
'xmpp' => $profile['xmpp'], 'xmpp' => $profile['xmpp'],
'matrix' => $profile['matrix'], 'matrix' => $profile['matrix'],
'network' => Protocol::DFRN, 'network' => Protocol::DFRN,
'url' => DI::baseUrl() . '/profile/' . $user['nickname'], 'url' => $url,
// it seems as if ported accounts can have wrong values, so we make sure that now everything is fine.
'nurl' => Strings::normaliseLink($url),
'uri-id' => ItemURI::getIdByURI($url),
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3), 'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'], 'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'],
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'], 'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
@ -726,9 +730,6 @@ class Contact
'poco' => DI::baseUrl() . '/poco/' . $user['nickname'], 'poco' => DI::baseUrl() . '/poco/' . $user['nickname'],
]; ];
// it seems as if ported accounts can have wrong values, so we make sure that now everything is fine.
$fields['nurl'] = Strings::normaliseLink($fields['url']);
$fields['uri-id'] = ItemURI::getIdByURI($fields['url']);
$avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]); $avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
if (DBA::isResult($avatar)) { if (DBA::isResult($avatar)) {