From 846a9813b23911ae2a87d87fb6fd9f188ed84dc0 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 1 Oct 2012 18:02:11 -0700 Subject: here's where the heavy lifting begins - everything is likely to be broken for quite some time as we add location and db independence to items and conversations and work through the rest of the permissions and how to federate the buggers. --- include/conversation.php | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'include/conversation.php') diff --git a/include/conversation.php b/include/conversation.php index 621032349..bad511551 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -111,7 +111,7 @@ function localize_item(&$item){ } break; default: - if($obj['resource-id']){ + if($obj['resource_id']){ $post_type = t('photo'); $m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); $rr['plink'] = $m[1]; @@ -239,7 +239,7 @@ function localize_item(&$item){ } break; default: - if($obj['resource-id']){ + if($obj['resource_id']){ $post_type = t('photo'); $m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); $rr['plink'] = $m[1]; @@ -329,11 +329,14 @@ function count_descendants($item) { function visible_activity($item) { - if(activity_match($child['verb'],ACTIVITY_LIKE) || activity_match($child['verb'],ACTIVITY_DISLIKE)) + if(activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)) return false; - if(activity_match($item['verb'],ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE && $item['uid'] != local_user()) - return false; + if(activity_match($item['verb'],ACTIVITY_FOLLOW) && $item['object-type'] === ACTIVITY_OBJ_NOTE) { + if(! (($item['self']) && ($item['uid'] == local_user()))) { + return false; + } + } return true; } @@ -1372,6 +1375,7 @@ function item_photo_menu($item){ if(! count($a->contacts)) load_contact_links(local_user()); } + $sub_link=""; $poke_link=""; $contact_url=""; $pm_url=""; @@ -1379,6 +1383,10 @@ function item_photo_menu($item){ $photos_link=""; $posts_link=""; + if((local_user()) && local_user() == $item['uid'] && $item['parent'] == $item['id'] && (! $item['self'])) { + $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;'; + } + $sparkle = false; $profile_link = best_link_url($item,$sparkle,$ssl_state); @@ -1417,6 +1425,7 @@ function item_photo_menu($item){ } $menu = Array( + t("Follow Thread") => $sub_link, t("View Status") => $status_link, t("View Profile") => $profile_link, t("View Photos") => $photos_link, @@ -1435,7 +1444,11 @@ function item_photo_menu($item){ $o = ""; foreach($menu as $k=>$v){ - if ($v!="") $o .= "
  • $k
  • \n"; + if(strpos($v,'javascript:') === 0) { + $v = substr($v,11); + $o .= "
  • $k
  • \n"; + } + elseif ($v!="") $o .= "
  • $k
  • \n"; } return $o; }} @@ -1456,16 +1469,16 @@ function like_puller($a,$item,&$arr,$mode) { else $url = zrl($url); - if(! $item['thr-parent']) - $item['thr-parent'] = $item['parent_uri']; + if(! $item['thr_parent']) + $item['thr_parent'] = $item['parent_uri']; - if(! ((isset($arr[$item['thr-parent'] . '-l'])) && (is_array($arr[$item['thr-parent'] . '-l'])))) - $arr[$item['thr-parent'] . '-l'] = array(); - if(! isset($arr[$item['thr-parent']])) - $arr[$item['thr-parent']] = 1; + if(! ((isset($arr[$item['thr_parent'] . '-l'])) && (is_array($arr[$item['thr_parent'] . '-l'])))) + $arr[$item['thr_parent'] . '-l'] = array(); + if(! isset($arr[$item['thr_parent']])) + $arr[$item['thr_parent']] = 1; else - $arr[$item['thr-parent']] ++; - $arr[$item['thr-parent'] . '-l'][] = '' . $item['author-name'] . ''; + $arr[$item['thr_parent']] ++; + $arr[$item['thr_parent'] . '-l'][] = '' . $item['author-name'] . ''; } return; }} @@ -1603,8 +1616,8 @@ function get_item_children($arr, $parent) { foreach($arr as $item) { if($item['id'] != $item['parent']) { if(get_config('system','thread_allow')) { - // Fallback to parent_uri if thr-parent is not set - $thr_parent = $item['thr-parent']; + // Fallback to parent_uri if thr_parent is not set + $thr_parent = $item['thr_parent']; if($thr_parent == '') $thr_parent = $item['parent_uri']; -- cgit v1.2.3