X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHCard.php;h=12ea65f136fb2c16432100616575c83113f4cc73;hb=e6a07832ddb1cf5e2dffcf53ed5b86c87e6ec1da;hp=3310749bc33e930c2959238871bb78bab02f0c84;hpb=536fbe5af17a4a393ea440155e2770f63b5a71f5;p=friendica.git diff --git a/src/Module/HCard.php b/src/Module/HCard.php index 3310749bc3..12ea65f136 100644 --- a/src/Module/HCard.php +++ b/src/Module/HCard.php @@ -34,21 +34,19 @@ use Friendica\Network\HTTPException; */ class HCard extends BaseModule { - public static function rawContent(array $parameters = []) + protected function content(array $request = []): string { - $a = DI::app(); - - if ((local_user()) && ($parameters['action'] ?? '') === 'view') { + if ((local_user()) && ($this->parameters['action'] ?? '') === 'view') { // A logged in user views a profile of a user - $nickname = $a->getLoggedInUserNickname(); - } elseif (empty($parameters['action'])) { + $nickname = DI::app()->getLoggedInUserNickname(); + } elseif (empty($this->parameters['action'])) { // Show the profile hCard - $nickname = $parameters['profile']; + $nickname = $this->parameters['profile']; } else { throw new HTTPException\NotFoundException(DI::l10n()->t('No profile')); } - $profile = Profile::load($a, $nickname, false); + $profile = User::getOwnerDataByNick($nickname); if (empty($profile)) { throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); @@ -67,15 +65,6 @@ class HCard extends BaseModule $page['htmlhead'] .= '' . "\r\n"; } - // check if blocked - if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) { - $keywords = $profile['pub_keywords'] ?? ''; - $keywords = str_replace([',', ' ', ',,'], [' ', ',', ','], $keywords); - if (strlen($keywords)) { - $page['htmlhead'] .= '' . "\r\n"; - } - } - $baseUrl = DI::baseUrl(); $uri = urlencode('acct:' . $profile['nickname'] . '@' . $baseUrl->getHostname() . ($baseUrl->getUrlPath() ? '/' . $baseUrl->getUrlPath() : '')); @@ -88,5 +77,20 @@ class HCard extends BaseModule foreach (['request', 'confirm', 'notify', 'poll'] as $dfrn) { $page['htmlhead'] .= "get() . "/dfrn_{$dfrn}/{$nickname}\" />\r\n"; } + + $block = (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()); + + // check if blocked + if ($block) { + $keywords = $profile['pub_keywords'] ?? ''; + $keywords = str_replace([',', ' ', ',,'], [' ', ',', ','], $keywords); + if (strlen($keywords)) { + $page['htmlhead'] .= '' . "\r\n"; + } + } + + $page['aside'] = Profile::getVCardHtml($profile, $block, false); + + return ''; } }