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