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