X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=0d901a3c06d6204eb076bf926d9cd585253393e1;hb=96342878398e394173ba1a2dd825afbcb19e7199;hp=6c60b0b9171328efe0be0b5959e8e7f8f85972cf;hpb=5e1335ac892ce07bf7b1a3a043f71b8abbed8dba;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index 6c60b0b917..0d901a3c06 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -5,8 +5,7 @@ */ function localize_item(&$item){ - if ($item['verb']=="http://activitystrea.ms/schema/1.0/like" || - $item['verb']=="http://activitystrea.ms/schema/1.0/dislike"){ + if ($item['verb']=== ACTIVITY_LIKE || $item['verb']=== ACTIVITY_DISLIKE){ $r = q("SELECT * from `item`,`contact` WHERE `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';", @@ -17,23 +16,42 @@ function localize_item(&$item){ $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]'; - $post_type = (($obj['resource-id']) ? t('photo') : t('status')); + switch($obj['verb']){ + case ACTIVITY_POST: + switch ($obj['object-type']){ + case ACTIVITY_OBJ_EVENT: + $post_type = t('event'); + break; + default: + $post_type = t('status'); + } + break; + default: + if($obj['resource-id']){ + $post_type = t('photo'); + $m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); + $rr['plink'] = $m[1]; + } else { + $post_type = t('status'); + } + } + $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]'; switch($item['verb']){ - case "http://activitystrea.ms/schema/1.0/like": + case ACTIVITY_LIKE : $bodyverb = t('%1$s likes %2$s\'s %3$s'); break; - case "http://activitystrea.ms/schema/1.0/dislike": + case ACTIVITY_DISLIKE: $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s'); break; } $item['body'] = sprintf($bodyverb, $author, $objauthor, $plink); } - if ($item['verb']=='http://activitystrea.ms/schema/1.0/make-friend'){ + if ($item['verb']=== ACTIVITY_FRIEND){ - if ($item['object-type']=="" || $item['object-type']!='http://activitystrea.ms/schema/1.0/person') return; + if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return; $Aname = $item['author-name']; $Alink = $item['author-link']; @@ -142,7 +160,7 @@ function conversation(&$a, $items, $mode, $update) { $owner_name = ''; $sparkle = ''; - if($mode === 'search') { + if($mode === 'search' || $mode === 'community') { if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent'])) continue; @@ -265,14 +283,14 @@ function conversation(&$a, $items, $mode, $update) { continue; $toplevelpost = (($item['id'] == $item['parent']) ? true : false); - + $toplevelprivate = false; // Take care of author collapsing and comment collapsing // If a single author has more than 3 consecutive top-level posts, squash the remaining ones. // If there are more than two comments, squash all but the last 2. - + if($toplevelpost) { - + $toplevelprivate = (($toplevelpost && $item['private']) ? true : false); $item_writeable = (($item['writable'] || $item['self']) ? true : false); if($blowhard == $item['cid'] && (! $item['self']) && ($mode != 'profile') && ($mode != 'notes')) { @@ -294,9 +312,12 @@ function conversation(&$a, $items, $mode, $update) { $comments_seen = 0; $comments_collapsed = false; } - else + else { + // prevent private email from leaking into public conversation + if((! $toplevelpost) && (! toplevelprivate) && ($item['private']) && ($profile_owner != local_user())) + continue; $comments_seen ++; - + } $override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false); $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false); @@ -329,7 +350,7 @@ function conversation(&$a, $items, $mode, $update) { if(($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) { - if($item['type'] === 'wall') { + if($item['wall']) { // On the network page, I am the owner. On the display page it will be the profile owner. // This will have been stored in $a->page_contact by our calling page. @@ -341,7 +362,7 @@ function conversation(&$a, $items, $mode, $update) { $template = $wallwall; $commentww = 'ww'; } - if(($item['type'] === 'remote') && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) { + if((! $item['wall']) && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) { // Could be anybody. @@ -426,7 +447,7 @@ function conversation(&$a, $items, $mode, $update) { $profile_link = ''; $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']); - if(($normalised != 'mailbox') && (x($a->contacts[$normalised]))) + if(($normalised != 'mailbox') && (x($a->contacts,$normalised))) $profile_avatar = $a->contacts[$normalised]['thumb']; else $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb); @@ -515,33 +536,6 @@ function conversation(&$a, $items, $mode, $update) { return $o; } - -if(! function_exists('load_contact_links')) { -function load_contact_links($uid) { - - $a = get_app(); - - $ret = array(); - - if(! $uid || x($a->contacts,'empty')) - return; - - $r = q("SELECT `id`,`network`,`url`,`thumb` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 ", - intval($uid) - ); - if(count($r)) { - foreach($r as $rr){ - $url = normalise_link($rr['url']); - $ret[$url] = $rr; - } - } - else - $ret['empty'] = true; - $a->contacts = $ret; - return; -}} - - function best_link_url($item,&$sparkle) { $a = get_app(); @@ -779,4 +773,4 @@ function status_editor($a,$x, $notes_cid = 0) { )); return $o; -} \ No newline at end of file +}