Remove Profile::load from Module\HCard
- Renamed and re-scoped Profile::sidebar to getVcardHtmlpull/10628/head
parent
8f0e36d617
commit
ceeb246128
|
@ -255,7 +255,7 @@ class Profile
|
||||||
* By now, the contact block isn't shown, when a different profile is given
|
* By now, the contact block isn't shown, when a different profile is given
|
||||||
* But: When this profile was on the same server, then we could display the contacts
|
* But: When this profile was on the same server, then we could display the contacts
|
||||||
*/
|
*/
|
||||||
DI::page()['aside'] .= self::sidebar($profile, $block, $show_contacts);
|
DI::page()['aside'] .= self::getVCardHtml($profile, $block, $show_contacts);
|
||||||
|
|
||||||
return $profile;
|
return $profile;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ class Profile
|
||||||
* @hooks 'profile_sidebar'
|
* @hooks 'profile_sidebar'
|
||||||
* array $arr
|
* array $arr
|
||||||
*/
|
*/
|
||||||
private static function sidebar(array $profile, bool $block, bool $show_contacts)
|
public static function getVCardHtml(array $profile, bool $block, bool $show_contacts)
|
||||||
{
|
{
|
||||||
$o = '';
|
$o = '';
|
||||||
$location = false;
|
$location = false;
|
||||||
|
|
|
@ -34,13 +34,11 @@ use Friendica\Network\HTTPException;
|
||||||
*/
|
*/
|
||||||
class HCard extends BaseModule
|
class HCard extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent(array $parameters = [])
|
public static function content(array $parameters = [])
|
||||||
{
|
{
|
||||||
$a = DI::app();
|
|
||||||
|
|
||||||
if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
|
if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
|
||||||
// A logged in user views a profile of a user
|
// A logged in user views a profile of a user
|
||||||
$nickname = $a->getLoggedInUserNickname();
|
$nickname = DI::app()->getLoggedInUserNickname();
|
||||||
} elseif (empty($parameters['action'])) {
|
} elseif (empty($parameters['action'])) {
|
||||||
// Show the profile hCard
|
// Show the profile hCard
|
||||||
$nickname = $parameters['profile'];
|
$nickname = $parameters['profile'];
|
||||||
|
@ -48,7 +46,7 @@ class HCard extends BaseModule
|
||||||
throw new HTTPException\NotFoundException(DI::l10n()->t('No profile'));
|
throw new HTTPException\NotFoundException(DI::l10n()->t('No profile'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = Profile::load($a, $nickname, false);
|
$profile = User::getOwnerDataByNick($nickname);
|
||||||
|
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||||
|
@ -67,15 +65,6 @@ class HCard extends BaseModule
|
||||||
$page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
|
$page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\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'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$baseUrl = DI::baseUrl();
|
$baseUrl = DI::baseUrl();
|
||||||
|
|
||||||
$uri = urlencode('acct:' . $profile['nickname'] . '@' . $baseUrl->getHostname() . ($baseUrl->getUrlPath() ? '/' . $baseUrl->getUrlPath() : ''));
|
$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) {
|
foreach (['request', 'confirm', 'notify', 'poll'] as $dfrn) {
|
||||||
$page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"" . $baseUrl->get() . "/dfrn_{$dfrn}/{$nickname}\" />\r\n";
|
$page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"" . $baseUrl->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'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$page['aside'] = Profile::getVCardHtml($profile, $block, false);
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue