]> git.mxchange.org Git - friendica.git/blob - mod/hcard.php
Update function calls
[friendica.git] / mod / hcard.php
1 <?php
2 /**
3  * @file mod/hcard.php
4  */
5 use Friendica\App;
6 use Friendica\Core\Config;
7 use Friendica\Core\System;
8
9 function hcard_init(App $a)
10 {
11         $blocked = (((Config::get('system', 'block_public')) && (! local_user()) && (! remote_user())) ? true : false);
12
13         if ($a->argc > 1) {
14                 $which = $a->argv[1];
15         } else {
16                 notice(t('No profile') . EOL);
17                 $a->error = 404;
18                 return;
19         }
20
21         $profile = 0;
22         if ((local_user()) && ($a->argc > 2) && ($a->argv[2] === 'view')) {
23                 $which   = $a->user['nickname'];
24                 $profile = $a->argv[1];
25         }
26
27         Profile::load($a, $which, $profile);
28
29         if ((x($a->profile, 'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
30                 $a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
31         }
32         if (x($a->profile, 'openidserver')) {
33                 $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
34         }
35         if (x($a->profile, 'openid')) {
36                 $delegate = ((strstr($a->profile['openid'], '://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']);
37                 $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
38         }
39
40         if (! $blocked) {
41                 $keywords = ((x($a->profile, 'pub_keywords')) ? $a->profile['pub_keywords'] : '');
42                 $keywords = str_replace(array(',',' ',',,'), array(' ',',',','), $keywords);
43                 if (strlen($keywords)) {
44                         $a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n" ;
45                 }
46         }
47
48         $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
49         $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
50         $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
51         $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
52         header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
53
54         $dfrn_pages = array('request', 'confirm', 'notify', 'poll');
55         foreach ($dfrn_pages as $dfrn) {
56                 $a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"".System::baseUrl()."/dfrn_{$dfrn}/{$which}\" />\r\n";
57         }
58 }