X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FHCard.php;h=f245d71354089fd5c661f760a5879538f63f2545;hb=3bca4fe2a64671d09e08346456cdfa6c12f996e9;hp=e348f2ff5bc2f020d745df2fb6bc030c09497c0d;hpb=9a3a4def3dcd40fad9946037441e55586b3dd815;p=friendica.git diff --git a/src/Module/HCard.php b/src/Module/HCard.php index e348f2ff5b..f245d71354 100644 --- a/src/Module/HCard.php +++ b/src/Module/HCard.php @@ -1,6 +1,6 @@ getLocalUserId() && ($this->parameters['action'] ?? '') === 'view') { // A logged in user views a profile of a user - $nickname = $a->user['nickname']; - } 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::load($a, $nickname); + $profile = User::getOwnerDataByNick($nickname); - if (empty($a->profile)) { + if (empty($profile)) { throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); } $page = DI::page(); - if (!empty($a->profile['page-flags']) && ($a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) { + if (!empty($profile['page-flags']) && ($profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) { $page['htmlhead'] .= ''; } - if (!empty($a->profile['openidserver'])) { - $page['htmlhead'] .= '' . "\r\n"; + if (!empty($profile['openidserver'])) { + $page['htmlhead'] .= '' . "\r\n"; } - if (!empty($a->profile['openid'])) { - $delegate = ((strstr($a->profile['openid'], '://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']); + if (!empty($profile['openid'])) { + $delegate = ((strstr($profile['openid'], '://')) ? $profile['openid'] : 'http://' . $profile['openid']); $page['htmlhead'] .= '' . "\r\n"; } + $baseUrl = (string)DI::baseUrl(); + + $uri = urlencode('acct:' . $profile['nickname'] . '@' . DI::baseUrl()->getHost() . (DI::baseUrl()->getPath() ? '/' . DI::baseUrl()->getPath() : '')); + + $page['htmlhead'] .= '' . "\r\n"; + $page['htmlhead'] .= '' . "\r\n"; + $page['htmlhead'] .= '' . "\r\n"; + header('Link: <' . $baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); + + foreach (['request', 'confirm', 'notify', 'poll'] as $dfrn) { + $page['htmlhead'] .= "\r\n"; + } + + $block = (DI::config()->get('system', 'block_public') && !DI::userSession()->isAuthenticated()); + // check if blocked - if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) { - $keywords = $a->profile['pub_keywords'] ?? ''; + if ($block) { + $keywords = $profile['pub_keywords'] ?? ''; $keywords = str_replace([',', ' ', ',,'], [' ', ',', ','], $keywords); if (strlen($keywords)) { $page['htmlhead'] .= '' . "\r\n"; } } - $baseUrl = DI::baseUrl(); - - $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $baseUrl->getHostname() . ($baseUrl->getUrlPath() ? '/' . $baseUrl->getUrlPath() : '')); + $page['aside'] = Profile::getVCardHtml($profile, $block, false); - $page['htmlhead'] .= '' . "\r\n"; - $page['htmlhead'] .= '' . "\r\n"; - $page['htmlhead'] .= '' . "\r\n"; - header('Link: <' . $baseUrl->get() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); - - foreach (['request', 'confirm', 'notify', 'poll'] as $dfrn) { - $page['htmlhead'] .= "get() . "/dfrn_{$dfrn}/{$nickname}\" />\r\n"; - } + return ''; } }