diff options
Diffstat (limited to 'mod/profile.php')
-rw-r--r-- | mod/profile.php | 120 |
1 files changed, 74 insertions, 46 deletions
diff --git a/mod/profile.php b/mod/profile.php index 76ebe7d84..f3ec57329 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -51,7 +51,7 @@ function profile_init(&$a) { return; } - if(($remote_user) && ($a->argc > 2) && ($a->argv[2] == 'visit')) + if((remote_user()) && ($a->argc > 2) && ($a->argv[2] == 'visit')) $_SESSION['is_visitor'] = 1; else { unset($_SESSION['is_visitor']); @@ -69,41 +69,6 @@ function profile_init(&$a) { } -function item_display(&$a, $item,$template,$comment) { - - - $profile_url = $item['url']; - - if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] )) - $profile_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - - $photo = (($item['self']) ? $a->profile['photo'] : $item['photo']); - $thumb = (($item['self']) ? $a->profile['thumb'] : $item['thumb']); - - $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']); - $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url); - $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb); - -// if(! $item['owner-link']) { -// $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1". - - - - $o .= replace_macros($template,array( - '$id' => $item['item_id'], - '$profile_url' => $profile_link, - '$name' => $profile_name, - '$thumb' => $profile_avatar, - '$body' => bbcode($item['body']), - '$ago' => relative_date($item['created']), - '$indent' => (($item['parent'] != $item['item_id']) ? 'comment-' : ''), - '$comment' => $comment - )); - - - return $o; -} - function profile_content(&$a) { @@ -153,6 +118,7 @@ function profile_content(&$a) { $o .= replace_macros($tpl,array( '$baseurl' => $a->get_baseurl(), + '$return_path' => $a->cmd, '$visitor' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? 'block' : 'none'), '$lockstate' => 'unlock', '$acl' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? populate_acl() : ''), @@ -216,7 +182,7 @@ dbg(2); `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 - AND `contact`.`blocked` = 0 + AND `item`.`type` != 'remote' AND `contact`.`blocked` = 0 $sql_extra ORDER BY `parent` DESC, `id` ASC LIMIT %d ,%d ", intval($a->profile['uid']), @@ -226,23 +192,85 @@ dbg(2); ); - $template = file_get_contents('view/comment_item.tpl'); - + $cmnt_tpl = file_get_contents('view/comment_item.tpl'); $tpl = file_get_contents('view/wall_item.tpl'); + $wallwall = file_get_contents('view/wallwall_item.tpl'); + + if(count($r)) { - foreach($r as $rr) { + foreach($r as $item) { $comment = ''; + $template = $tpl; + $commentww = ''; + if(($item['parent'] == $item['item_id']) && (! $item['self'])) { + if($item['type'] == 'wall') { + $owner_url = $a->contact['url']; + $owner_photo = $a->contact['thumb']; + $owner_name = $a->contact['name']; + $template = $wallwall; + $commentww = 'ww'; + } + if($item['type'] == 'remote' && ($item['owner-link'] != $item['remote-link'])) { + $owner_url = $item['owner-link']; + $owner_photo = $item['owner-avatar']; + $owner_name = $item['owner-name']; + $template = $wallwall; + $commentww = 'ww'; + } + } + + + if(can_write_wall($a,$a->profile['profile_uid'])) { - if($rr['last-child']) { - $comment = replace_macros($template,array( - '$id' => $rr['item_id'], - '$parent' => $rr['parent'], - '$profile_uid' => $a->profile['profile_uid'] + if($item['last-child']) { + $comment = replace_macros($cmnt_tpl,array( + '$id' => $item['item_id'], + '$parent' => $item['parent'], + '$profile_uid' => $a->profile['profile_uid'], + '$ww' => $commentww )); } } - $o .= item_display($a,$rr,$tpl,$comment); + + + $profile_url = $item['url']; + + if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] )) + $profile_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; + + // $photo = (($item['self']) ? $a->profile['photo'] : $item['photo']); + // $thumb = (($item['self']) ? $a->profile['thumb'] : $item['thumb']); + + $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']); + $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url); + $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $item['thumb']); + + + + $o .= replace_macros($template,array( + '$id' => $item['item_id'], + '$profile_url' => $profile_link, + '$name' => $profile_name, + '$thumb' => $profile_avatar, + '$body' => bbcode($item['body']), + '$ago' => relative_date($item['created']), + '$indent' => (($item['parent'] != $item['item_id']) ? 'comment-' : ''), + '$owner_url' => $owner_url, + '$owner_photo' => $owner_photo, + '$owner_name' => $owner_name, + '$comment' => $comment + )); + + + + + + + + + + } } |