X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fhcard.php;h=828eeaf0910a3fdd5338d529eb49fbc6bb51283e;hb=708ffaff51d3f5112af6b1fbd25d7ff6391e496e;hp=7e5c2cc08add11cb7739eeafe7fe79cc4dbb0e18;hpb=a97b540ebb3f1d5bb5c18b4c0fb631443d03b5a7;p=friendica.git diff --git a/mod/hcard.php b/mod/hcard.php index 7e5c2cc08a..828eeaf091 100644 --- a/mod/hcard.php +++ b/mod/hcard.php @@ -8,6 +8,7 @@ use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Model\Contact; use Friendica\Model\Profile; +use Friendica\Model\User; function hcard_init(App $a) { @@ -16,9 +17,7 @@ function hcard_init(App $a) if ($a->argc > 1) { $which = $a->argv[1]; } else { - notice(L10n::t('No profile') . EOL); - $a->error = 404; - return; + throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('No profile')); } $profile = 0; @@ -29,27 +28,27 @@ function hcard_init(App $a) Profile::load($a, $which, $profile); - if ((x($a->profile, 'page-flags')) && ($a->profile['page-flags'] == Contact::PAGE_COMMUNITY)) { + if (!empty($a->profile['page-flags']) && ($a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) { $a->page['htmlhead'] .= ''; } - if (x($a->profile, 'openidserver')) { + if (!empty($a->profile['openidserver'])) { $a->page['htmlhead'] .= '' . "\r\n"; } - if (x($a->profile, 'openid')) { + if (!empty($a->profile['openid'])) { $delegate = ((strstr($a->profile['openid'], '://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']); $a->page['htmlhead'] .= '' . "\r\n"; } if (!$blocked) { - $keywords = ((x($a->profile, 'pub_keywords')) ? $a->profile['pub_keywords'] : ''); + $keywords = defaults($a->profile, 'pub_keywords', ''); $keywords = str_replace([',',' ',',,'], [' ',',',','], $keywords); if (strlen($keywords)) { - $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n"; } } - $a->page['htmlhead'] .= '' . "\r\n" ; - $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (($a->getURLPath()) ? '/' . $a->getURLPath() : '')); $a->page['htmlhead'] .= '' . "\r\n"; header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);