]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile.php
eradicate redundant get_uid function
[friendica.git] / mod / profile.php
index 8395bc1f60432e20d0bb2e23ad67ddca792504aa..5576b49dd128c4bc25da766d6cd27bda4cb9a59a 100644 (file)
@@ -90,7 +90,7 @@ function profile_content(&$a, $update = 0) {
                $a->profile['profile_uid'] = $update;
        }
        else {
-               if($a->profile['profile_uid'] == get_uid())             
+               if($a->profile['profile_uid'] == local_user())          
                        $o .= '<script> $(document).ready(function() { $(\'#nav-home-link\').addClass(\'nav-selected\'); });</script>';
        }
 
@@ -138,6 +138,7 @@ function profile_content(&$a, $update = 0) {
                        return $o;
                }
 
+               $celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false);
                if(can_write_wall($a,$a->profile['profile_uid'])) {
                        $tpl = load_view_file('view/jot-header.tpl');
        
@@ -156,7 +157,7 @@ function profile_content(&$a, $update = 0) {
                                '$visitor' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? 'block' : 'none'),
                                '$lockstate' => $lockstate,
                                '$bang' => '',
-                               '$acl' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? populate_acl($a->user) : ''),
+                               '$acl' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? populate_acl($a->user, $celeb) : ''),
                                '$profile_uid' => $a->profile['profile_uid']
                        ));
                }
@@ -231,8 +232,8 @@ function profile_content(&$a, $update = 0) {
                $a->set_pager_total($r[0]['total']);
 
        $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, 
-               `contact`.`name`, `contact`.`photo`, `contact`.`url`, 
-               `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, 
+               `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, 
+               `contact`.`thumb`, `contact`.`self`, 
                `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
                FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
@@ -268,29 +269,35 @@ function profile_content(&$a, $update = 0) {
 
                foreach($r as $item) {
 
+                       $sparkle = '';
+                       
                        if(($item['verb'] == ACTIVITY_LIKE) && ($item['id'] != $item['parent'])) {
                                $url = $item['url'];
-                               if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'])) 
+                               if(($item['network'] === 'dfrn') && (! $item['self'])) {
                                        $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
+                                       $sparkle = ' class="sparkle" ';
+                               }
                                if(! is_array($alike[$item['parent'] . '-l']))
                                        $alike[$item['parent'] . '-l'] = array();
                                $alike[$item['parent']] ++;
-                               $alike[$item['parent'] . '-l'][] = '<a href="'. $url . '">' . $item['name'] . '</a>';
+                               $alike[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['name'] . '</a>';
                        }
                        if(($item['verb'] == ACTIVITY_DISLIKE) && ($item['id'] != $item['parent'])) {
                                $url = $item['url'];
-                               if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'])) 
+                               if(($item['network'] === 'dfrn') && (! $item['self'])) { 
                                        $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
+                                       $sparkle = ' class="sparkle" ';
+                               }
                                if(! is_array($dlike[$item['parent'] . '-l']))
                                        $dlike[$item['parent'] . '-l'] = array();
                                $dlike[$item['parent']] ++;
-                               $dlike[$item['parent'] . '-l'][] = '<a href="'. $url . '">' . $item['name'] . '</a>';
+                               $dlike[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['name'] . '</a>';
                        }
                }
 
                foreach($r as $item) {
 
-               
+                       $sparkle = '';          
                        $comment = '';
                        $likebuttons = '';
 
@@ -301,6 +308,11 @@ function profile_content(&$a, $update = 0) {
                        if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) 
                                continue;
 
+                       $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
+                               || strlen($item['deny_cid']) || strlen($item['deny_gid']))
+                               ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
+                               : '<div class="wall-item-lock"></div>');
+
                        if(can_write_wall($a,$a->profile['profile_uid'])) {
                                if($item['id'] == $item['parent']) {
                                        $likebuttons = replace_macros($like_tpl,array('$id' => $item['id']));
@@ -313,7 +325,7 @@ function profile_content(&$a, $update = 0) {
                                                '$parent' => $item['parent'],
                                                '$profile_uid' =>  $a->profile['profile_uid'],
                                                '$mylink' => $contact['url'],
-                                               '$mytitle' => t('Me'),
+                                               '$mytitle' => t('This is you'),
                                                '$myphoto' => $contact['thumb'],
                                                '$ww' => ''
                                        ));
@@ -327,9 +339,12 @@ function profile_content(&$a, $update = 0) {
                        // I can go directly to their profile as an authenticated guest.
 
                        if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) 
-                               && ($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'] ))
+                               && ($item['network'] === 'dfrn') && (! $item['self'] )) {
                                $profile_url = $redirect_url;
-       
+                               $sparkle = ' sparkle';
+                       }
+                       else
+                               $sparkle = '';
 
                        // We received this post via a remote feed. It's either a wall-to-wall or a remote comment. The author is
                        // known to us and is reflected in the contact-id for this item. We can use the contact url or redirect rather than 
@@ -357,9 +372,11 @@ function profile_content(&$a, $update = 0) {
                                '$profile_url' => $profile_link,
                                '$name' => $profile_name,
                                '$thumb' => $profile_avatar,
+                               '$sparkle' => $sparkle,
                                '$title' => $item['title'],
                                '$body' => bbcode($item['body']),
                                '$ago' => relative_date($item['created']),
+                               '$lock' => $lock,
                                '$location' => (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : ''),
                                '$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
                                '$drop' => $drop,