- $comment = '';
- $likebuttons = '';
-
- $template = $tpl;
-
- $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
-
- if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent']))
- continue;
-
- if(can_write_wall($a,$a->profile['profile_uid'])) {
- if($item['id'] == $item['parent']) {
- $likebuttons = replace_macros($like_tpl,array('$id' => $item['id']));
- }
- if($item['last-child']) {
- $comment = replace_macros($cmnt_tpl,array(
- '$return_path' => $_SESSION['return_url'],
- '$type' => 'wall-comment',
- '$id' => $item['item_id'],
- '$parent' => $item['parent'],
- '$profile_uid' => $a->profile['profile_uid'],
- '$mylink' => $contact['url'],
- '$mytitle' => t('Me'),
- '$myphoto' => $contact['thumb'],
- '$ww' => ''
- ));
- }
- }
-
-
- $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,
- // I can go directly to their profile as an authenticated guest.
-
- if(local_user() && ($item['contact-uid'] == $_SESSION['uid'])
- && ($item['rel'] == DIRECTION_IN || $item['rel'] == DIRECTION_BOTH) && (! $item['self'] ))
- $profile_url = $redirect_url;
-
-
- // 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
- // use the link in the feed. This is different than on the network page where we may not know the author.
-
- $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
- $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
- $profile_link = $profile_url;
-
- $drop = '';
- $dropping = false;
-
- if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == $_SESSION['uid']))
- $dropping = true;
-
- $drop = replace_macros((($dropping)? $droptpl : $fakedrop), array('$id' => $item['id']));
-
-
- $like = (($alike[$item['id']]) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
- $dislike = (($dlike[$item['id']]) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
-
-
- $o .= replace_macros($template,array(
- '$id' => $item['item_id'],
- '$profile_url' => $profile_link,
- '$name' => $profile_name,
- '$thumb' => $profile_avatar,
- '$title' => $item['title'],
- '$body' => bbcode($item['body']),
- '$ago' => relative_date($item['created']),
- '$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,
- '$like' => $like,
- '$vote' => $likebuttons,
- '$dislike' => $dislike,
- '$comment' => $comment
- ));
-
- }