From 7bee4e5997804658f508a32d07ca4143d8afe629 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 16 Dec 2014 14:12:40 -0800 Subject: build a channel based thread viewing link when in list_mode and when using the channel module, which will disable list_mode (this was checked in yesterday) for the benefit of viewing threads with the correct identities and comment permissions instead of relying on the semi-random uid chosen by mod/display when viewed by an authenticated remote_user(). --- include/ItemObject.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 6037daa7a..6f177b606 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -231,7 +231,14 @@ class Item extends BaseObject { localize_item($item); $body = prepare_body($item,true); - + + // $viewthread (below) is only valid in list mode. If this is a channel page, build the thread viewing link + // since we can't depend on llink or plink pointing to the right local location. + + $owner_address = substr($item['owner']['xchan_addr'],0,strpos($item['owner']['xchan_addr'],'@')); + $viewthread = $item['llink']; + if($conv->get_mode() === 'channel') + $viewthread = z_root() . '/channel/' . $owner_address . '?f=&mid=' . $item['mid']; $comment_count_txt = sprintf( tt('%d comment','%d comments',$total_children),$total_children ); $list_unseen_txt = (($unseen_comments) ? sprintf('%d unseen',$unseen_comments) : ''); @@ -249,6 +256,7 @@ class Item extends BaseObject { 'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']), 'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']), 'llink' => $item['llink'], + 'viewthread' => $viewthread, 'to' => t('to'), 'via' => t('via'), 'wall' => t('Wall-to-Wall'), -- cgit v1.2.3