From 059e090b53643cb07a2634b700ada5cf3b6894e8 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Fri, 16 Jul 2010 06:24:41 -0700 Subject: sorting out visitor sessions --- mod/profile.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'mod/profile.php') diff --git a/mod/profile.php b/mod/profile.php index 5a1ac0639..6bd265562 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -43,12 +43,6 @@ function profile_load(&$a,$uid,$profile = 0) { function profile_init(&$a) { - if($_SESSION['authenticated']) { - - // choose which page to show (could be remote auth) - - } - if($a->argc > 1) $which = $a->argv[1]; else { @@ -57,6 +51,15 @@ function profile_init(&$a) { return; } + if(($remote_user) && ($a->argc > 2) && ($a->argv[2] == 'visit')) + $_SESSION['is_visitor'] = 1; + else { + unset($_SESSION['is_visitor']); + unset($_SESSION['visitor_id']); + if(! $_SESSION['uid']) + unset($_SESSION['authenticated']); + } + profile_load($a,$which); $a->page['htmlhead'] .= "get_baseurl() . "/profile/%s" . "\" />\r\n"; @@ -79,9 +82,9 @@ function item_display(&$a, $item,$template,$comment) { $o .= replace_macros($template,array( '$id' => $item['item_id'], - '$profile_url' => $profile_url, - '$name' => $item['name'], - '$thumb' => $thumb, + '$profile_url' => ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url), + '$name' => ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']), + '$thumb' => ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb), '$body' => bbcode($item['body']), '$ago' => relative_date($item['created']), '$indent' => (($item['parent'] != $item['item_id']) ? 'comment-' : ''), @@ -196,7 +199,7 @@ function profile_content(&$a) { if(count($r)) $a->set_pager_total($r[0]['total']); - +dbg(2); $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, -- cgit v1.2.3