]> git.mxchange.org Git - friendica.git/commitdiff
cleaned up photo_menu check and explanation
authorFriendika <info@friendika.com>
Mon, 4 Apr 2011 23:00:58 +0000 (16:00 -0700)
committerFriendika <info@friendika.com>
Mon, 4 Apr 2011 23:00:58 +0000 (16:00 -0700)
boot.php

index 34be06c81607b164e7861800d1394db09c3d78d7..3b86d0dbeb3f5484de1a090ca171c2531ace9cd2 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2687,37 +2687,35 @@ function item_photo_menu($item){
        $profile_link   = ((strlen($item['author-link']))   ? $item['author-link'] : $item['url']);
        $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
 
-       $contact_uid = ((x($item,'contact-uid')) && intval($item['contact-uid']) ? intval($item['contact-uid']) : 0);   
+       // $item['contact-uid'] is only set on profile page and indicates the uid of the user who owns the profile.
 
-       // $item['contact-uid'] is only set on profile page.
-       // So we are checking for a profile page where the viewer owns the page,
-       // otherwise a logged in user if some other page that displays items.
+       $profile_owner = ((x($item,'contact-uid')) && intval($item['contact-uid']) ? intval($item['contact-uid']) : 0); 
+
+       // So we are checking that this is a logged in user on some page that *isn't* a profile page
+       // OR a profile page where the viewer owns the profile. 
        // Then check if we can use a sparkle (redirect) link to the profile by virtue of it being our contact
        // or a friend's contact that we both have a connection to. 
 
-       if(((local_user() && (! $contact_uid)) || ($contact_uid && $contact_uid == local_user())) && strlen($item['author-link'])) {
+       if(((local_user() && ($profile_owner == 0)) 
+               || ($profile_owner && $profile_owner == local_user())) 
+               && strlen($item['author-link'])) {
+
                if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
                        $status_link = $redirect_url."?url=status";
                        $profile_link = $redirect_url."?url=profile";
                        $photos_link = $redirect_url."?url=photos";
-                       if (local_user() && (! link_compare($_SESSION['my_url'],$item['author-link']))) {
-                               $pm_url = $a->get_baseurl() . '/message/new/' . $item['cid'];
-                               $contact_url = $item['self']?"":$a->get_baseurl() . '/contacts/' . $item['cid'];
-                       }
+                       $pm_url = $a->get_baseurl() . '/message/new/' . $item['cid'];
+                       $contact_url = $item['self']?"":$a->get_baseurl() . '/contacts/' . $item['cid'];
                } 
                elseif(isset($a->authors[$item['author-link']])) {
                        $redirect_url = $a->get_baseurl() . '/redir/' . $a->authors[$item['author-link']]['id'];
                        $status_link = $redirect_url."?url=status";
                        $profile_link = $redirect_url."?url=profile";
                        $photos_link = $redirect_url."?url=photos";
-
-                       if (local_user() && (! link_compare($_SESSION['my_url'],$a->authors[$item['author-link']]['url']))) {
-                               if ($a->authors[$item['author-link']]['network']==='dfrn'){
-                                       $pm_url = $a->get_baseurl() . '/message/new/' . $a->authors[$item['author-link']]['id'];
-                               }
-                               $contact_url = $item['self']?"":$a->get_baseurl() . '/contacts/' . $a->authors[$item['author-link']]['id'] ;
+                       if ($a->authors[$item['author-link']]['network']==='dfrn'){
+                               $pm_url = $a->get_baseurl() . '/message/new/' . $a->authors[$item['author-link']]['id'];
                        }
-                                               
+                       $contact_url = $item['self']?"":$a->get_baseurl() . '/contacts/' . $a->authors[$item['author-link']]['id'] ;                                            
                }
        }