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