X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FProfile%2FProfile.php;h=199b96e2c976e4f10b8ff69b5f5e42da1583e310;hb=69b7923df2beed71419bc38e61ca9755fad24b12;hp=4f083db2606c855cf9bdcfa9647b932c5665e88d;hpb=69c75daf4f9173573bcfece08a1040612de88c1d;p=friendica.git
diff --git a/src/Module/Profile/Profile.php b/src/Module/Profile/Profile.php
index 4f083db260..199b96e2c9 100644
--- a/src/Module/Profile/Profile.php
+++ b/src/Module/Profile/Profile.php
@@ -1,6 +1,6 @@
$parameters['nickname']]);
+ $user = DBA::selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname']]);
if (DBA::isResult($user)) {
- // The function returns an empty array when the account is removed, expired or blocked
- $data = ActivityPub\Transmitter::getProfile($user['uid']);
- if (!empty($data)) {
+ try {
+ $data = ActivityPub\Transmitter::getProfile($user['uid']);
header('Access-Control-Allow-Origin: *');
header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
System::jsonExit($data, 'application/activity+json');
+ } catch (HTTPException\NotFoundException $e) {
+ System::jsonError(404, ['error' => 'Record not found']);
}
}
- if (DBA::exists('userd', ['username' => $parameters['nickname']])) {
+ if (DBA::exists('userd', ['username' => $this->parameters['nickname']])) {
// Known deleted user
- $data = ActivityPub\Transmitter::getDeletedUser($parameters['nickname']);
+ $data = ActivityPub\Transmitter::getDeletedUser($this->parameters['nickname']);
System::jsonError(410, $data);
} else {
@@ -73,11 +73,11 @@ class Profile extends BaseProfile
}
}
- public static function content(array $parameters = [])
+ protected function content(array $request = []): string
{
$a = DI::app();
- $profile = ProfileModel::load($a, $parameters['nickname']);
+ $profile = ProfileModel::load($a, $this->parameters['nickname']);
if (!$profile) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Profile not found.'));
}
@@ -98,12 +98,12 @@ class Profile extends BaseProfile
DI::page()['htmlhead'] .= '' . "\n";
}
- DI::page()['htmlhead'] .= self::buildHtmlHead($profile, $parameters['nickname'], $remote_contact_id);
+ DI::page()['htmlhead'] .= self::buildHtmlHead($profile, $this->parameters['nickname'], $remote_contact_id);
Nav::setSelected('home');
$is_owner = local_user() == $profile['uid'];
- $o = self::getTabsHTML($a, 'profile', $is_owner, $profile);
+ $o = self::getTabsHTML($a, 'profile', $is_owner, $profile['nickname'], $profile['hide-friends']);
if (!empty($profile['hidewall']) && !$is_owner && !$remote_contact_id) {
notice(DI::l10n()->t('Access to this profile has been restricted.'));
@@ -134,7 +134,7 @@ class Profile extends BaseProfile
$view_as_contact_alert = DI::l10n()->t(
'You\'re currently viewing your profile as %s Cancel',
htmlentities($view_as_contacts[$key]['name'], ENT_COMPAT, 'UTF-8'),
- 'profile/' . $parameters['nickname'] . '/profile'
+ 'profile/' . $this->parameters['nickname'] . '/profile'
);
}
}
@@ -176,6 +176,10 @@ class Profile extends BaseProfile
$basic_fields += self::buildField('xmpp', DI::l10n()->t('XMPP:'), $profile['xmpp']);
}
+ if ($profile['matrix']) {
+ $basic_fields += self::buildField('matrix', DI::l10n()->t('Matrix:'), $profile['matrix']);
+ }
+
if ($profile['homepage']) {
$basic_fields += self::buildField('homepage', DI::l10n()->t('Homepage:'), HTML::toLink($profile['homepage']));
}