]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile.php
Merge branch 'omigeot-master'
[friendica.git] / mod / profile.php
index a5f440f434356bf0940f2e494d0947c65e558443..c84b493c5039ac6bf94e8f73ba388a38c44e845a 100644 (file)
@@ -18,38 +18,19 @@ function profile_init(&$a) {
 
        profile_load($a,$which,$profile);
 
-       if (!get_config('system','no_openid') && $a->profile['openid']!=""){
-               if (!isset($a->profile['openidserver'])){
-                       logger('friendika user table must be updated. `openidserver` field is missing');
-               } else {
-                       if ($a->profile['openidserver']==''){
-                               require_once('library/openid.php');
-                               $openid = new LightOpenID;
-                               $openid->identity = $a->profile['openid'];
-                               $a->profile['openidserver'] = $openid->discover($openid->identity);
-
-                               q("UPDATE `user` SET `openidserver` = '%s' WHERE `uid` = %d LIMIT 1",
-                                       dbesc($a->profile['openidserver']),
-                                       intval($a->profile['uid'])
-                               );
-                       }
-               
-               
-                       $a->page['htmlhead'] .= '<link rel="openid.server" href="'.$a->profile['openidserver'].'" />'. "\r\n";
-                       $a->page['htmlhead'] .= '<link rel="openid.delegate" href="'.$a->profile['openid'].'" />'. "\r\n";
-               }                   
-
+       if(x($a->profile,'openidserver'))                               
+               $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
+       if(x($a->profile,'openid')) {
+               $delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']);
+               $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
        }
 
-       
-
        $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
        $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
        $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
        header('Link: <' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
-  
-       
+       
        $dfrn_pages = array('request', 'confirm', 'notify', 'poll');
        foreach($dfrn_pages as $dfrn)
                $a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"".$a->get_baseurl()."/dfrn_{$dfrn}/{$which}\" />\r\n";
@@ -153,6 +134,10 @@ function profile_content(&$a, $update = 0) {
                                $lockstate = 'lock';
                        else
                                $lockstate = 'unlock';
+       
+      $jotplugins = "";
+      call_hooks('jot_tool', $jotplugins); 
+        
                        $o .= replace_macros($tpl,array(
                                '$baseurl' => $a->get_baseurl(),
                                '$defloc' => (($is_owner) ? $a->user['default-location'] : ''),
@@ -161,7 +146,8 @@ function profile_content(&$a, $update = 0) {
                                '$lockstate' => $lockstate,
                                '$bang' => '',
                                '$acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''),
-                               '$profile_uid' => $a->profile['profile_uid']
+                               '$profile_uid' => $a->profile['profile_uid'],
+                               '$jotplugins' => $jotplugins
                        ));
                }
 
@@ -247,6 +233,10 @@ function profile_content(&$a, $update = 0) {
 
        );
 
+
+       if($is_owner && ! $update)
+               $o .= get_birthdays();
+
        $cmnt_tpl = load_view_file('view/comment_item.tpl');
 
        $like_tpl = load_view_file('view/like.tpl');
@@ -264,7 +254,7 @@ function profile_content(&$a, $update = 0) {
        $alike = array();
        $dlike = array();
 
-       if(count($r)) {
+       if($r !== false && count($r)) {
 
                foreach($r as $item) {
                        like_puller($a,$item,$alike,'like');
@@ -312,7 +302,7 @@ function profile_content(&$a, $update = 0) {
 
                        $profile_url = $item['url'];
 
-                       // This is my profile but I'm not the author of this post/comment. If it's somebody that's a fan or mutual friend,
+                       // This is my profile page but I'm not the author of this post/comment. If it's somebody that's a fan or mutual friend,
                        // I can go directly to their profile as an authenticated guest.
 
                        if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) 
@@ -329,7 +319,7 @@ function profile_content(&$a, $update = 0) {
                        // local contact info at all. In this module you should never encounter a third-party author, but we still will do
                        // the right thing if you ever do. 
 
-                       $diff_author = (($item['url'] !== $item['author-link']) ? true : false);
+                       $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
 
                        $profile_name   = (((strlen($item['author-name']))   && $diff_author) ? $item['author-name']   : $item['name']);
                        $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']);
@@ -361,8 +351,9 @@ function profile_content(&$a, $update = 0) {
                        if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
                                $indent .= ' shiny'; 
 
-                       $o .= replace_macros($template,array(
+                       $tmp_item = replace_macros($template,array(
                                '$id' => $item['item_id'],
+                               '$title' => t('View $name\'s profile'),
                                '$profile_url' => $profile_link,
                                '$name' => $profile_name,
                                '$thumb' => $profile_avatar,
@@ -379,6 +370,11 @@ function profile_content(&$a, $update = 0) {
                                '$dislike' => $dislike,
                                '$comment' => $comment
                        ));
+
+                       $arr = array('item' => $item, 'output' => $tmp_item);
+                       call_hooks('display_item', $arr);
+
+                       $o .= $arr['output'];
                        
                }
        }
@@ -388,6 +384,8 @@ function profile_content(&$a, $update = 0) {
        }
                
        $o .= paginate($a);
+       $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+
 
        return $o;
 }