aboutsummaryrefslogtreecommitdiffstats
path: root/include/conversation.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/conversation.php')
-rw-r--r--include/conversation.php82
1 files changed, 55 insertions, 27 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 8e69e9ea3..410143a7a 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -6,7 +6,7 @@ require_once('include/items.php');
// is identical to the code in mod/message.php for 'item_extract_images' and
// 'item_redir_and_replace_images'
-if(! function_exists('item_extract_images')) {
+
function item_extract_images($body) {
$saved_image = array();
@@ -46,9 +46,9 @@ function item_extract_images($body) {
$new_body = $new_body . $orig_body;
return array('body' => $new_body, 'images' => $saved_image);
-}}
+}
+
-if(! function_exists('item_redir_and_replace_images')) {
function item_redir_and_replace_images($body, $images, $cid) {
$origbody = $body;
@@ -81,7 +81,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
}
return $newbody;
-}}
+}
@@ -108,6 +108,44 @@ function localize_item(&$item){
$item_url = get_rel_link($obj['link'],'alternate');
+ $Bphoto = '';
+
+ switch($obj->type) {
+ case ACTIVITY_OBJ_PHOTO:
+ $post_type = t('photo');
+ break;
+ case ACTIVITY_OBJ_EVENT:
+ $post_type = t('event');
+ break;
+ case ACTIVITY_OBJ_PERSON:
+ $post_type = t('channel');
+ $author_name = $obj['title'];
+ if($obj['link']) {
+ $author_link = get_rel_link($obj['link'],'alternate');
+ $Bphoto = get_rel_link($obj['link'],'photo');
+ }
+ break;
+ case ACTIVITY_OBJ_THING:
+ $post_type = $obj['title'];
+ if($obj['owner']) {
+ if(array_key_exists('name',$obj['owner']))
+ $obj['owner']['name'];
+ if(array_key_exists('link',$obj['owner']))
+ $author_link = get_rel_link($obj['owner']['link'],'alternate');
+ }
+ if($obj['link']) {
+ $Bphoto = get_rel_link($obj['link'],'photo');
+ }
+ break;
+
+ case ACTIVITY_OBJ_NOTE:
+ default:
+ $post_type = t('status');
+ if($obj->id != $item['mid'])
+ $post_type = t('comment');
+ break;
+ }
+
// If we couldn't parse something useful, don't bother translating.
// We need something better than zid here, probably magic_link(), but it needs writing
@@ -117,21 +155,6 @@ function localize_item(&$item){
$author = '[zrl=' . chanlink_url($item['author']['xchan_url']) . ']' . $item['author']['xchan_name'] . '[/zrl]';
$objauthor = '[zrl=' . chanlink_url($author_link) . ']' . $author_name . '[/zrl]';
- switch($obj->type) {
- case ACTIVITY_OBJ_PHOTO:
- $post_type = t('photo');
- break;
- case ACTIVITY_OBJ_EVENT:
- $post_type = t('event');
- break;
- case ACTIVITY_OBJ_NOTE:
- default:
- $post_type = t('status');
- if($obj->id != $item['mid'])
- $post_type = t('comment');
- break;
- }
-
$plink = '[zrl=' . zid($item_url) . ']' . $post_type . '[/zrl]';
if(activity_match($item['verb'],ACTIVITY_LIKE)) {
@@ -141,6 +164,8 @@ function localize_item(&$item){
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
}
$item['body'] = $item['localize'] = sprintf($bodyverb, $author, $objauthor, $plink);
+ if($Bphoto != "")
+ $item['body'] .= "\n\n\n" . '[zrl=' . chanlink_url($author_link) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
}
@@ -148,7 +173,8 @@ function localize_item(&$item){
if (activity_match($item['verb'],ACTIVITY_FRIEND)) {
- if ($item['obj_type']=="" || $item['obj_type']!== ACTIVITY_OBJ_PERSON) return;
+
+// if ($item['obj_type']=="" || $item['obj_type']!== ACTIVITY_OBJ_PERSON) return;
$Aname = $item['author']['xchan_name'];
$Alink = $item['author']['xchan_url'];
@@ -349,7 +375,9 @@ function count_descendants($item) {
function visible_activity($item) {
- if(activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE))
+ // likes can apply to other things besides posts. Check if they are post children, in which case we handle them specially
+
+ if((activity_match($item['verb'],ACTIVITY_LIKE) || activity_match($item['verb'],ACTIVITY_DISLIKE)) && ($item['mid'] != $item['parent_mid']))
return false;
return true;
}
@@ -826,7 +854,7 @@ function best_link_url($item) {
}
-if(! function_exists('item_photo_menu')){
+
function item_photo_menu($item){
$a = get_app();
$contact = null;
@@ -893,9 +921,9 @@ function item_photo_menu($item){
elseif ($v!="") $o .= "<li><a href=\"$v\">$k</a></li>\n";
}
return $o;
-}}
+}
+
-if(! function_exists('like_puller')) {
function like_puller($a,$item,&$arr,$mode) {
$url = '';
@@ -923,7 +951,7 @@ function like_puller($a,$item,&$arr,$mode) {
$arr[$item['thr_parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author']['xchan_name'] . '</a>';
}
return;
-}}
+}
// Format the like/dislike text for a profile item
// $cnt = number of people who like/dislike the item
@@ -932,7 +960,7 @@ function like_puller($a,$item,&$arr,$mode) {
// $id = item id
// returns formatted text
-if(! function_exists('format_like')) {
+
function format_like($cnt,$arr,$type,$id) {
$o = '';
if($cnt == 1)
@@ -956,7 +984,7 @@ function format_like($cnt,$arr,$type,$id) {
$o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
}
return $o;
-}}
+}
function status_editor($a,$x,$popup=false) {