Bugfix for replies from pumpio to pictures.
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $postarray,
- 'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item,
+ //'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item,
+ 'link' => $a->get_baseurl().'/display/'.get_item_guid($item),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $postarray,
- 'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item,
+ //'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item,
+ 'link' => $a->get_baseurl().'/display/'.get_item_guid($item),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
}
// Don't create accounts of people who just comment something
$createuser = false;
- } else
+
+ $postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
+ } else {
$postarray['thr-parent'] = $postarray['uri'];
+ $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
+ }
$postarray['plink'] = $post["canonical_url"];
$page_info = "\n[url=".$photo["url"]."][img]".$photo["large"]."[/img][/url]";
elseif ($photo["url"] != "")
$page_info = "\n[img]".$photo["url"]."[/img]";
+
+ if ($photo["url"] != "")
+ $postarray['object-type'] = ACTIVITY_OBJ_IMAGE;
+
} else
$photo = array("url" => "", "large" => "");
$postarray['wall'] = 0;
$postarray['verb'] = ACTIVITY_POST;
+ $postarray['object-type'] = ACTIVITY_OBJ_NOTE; // default value - is maybe changed later when media is attached
$postarray['network'] = dbesc(NETWORK_FACEBOOK);
$postarray['uri'] = "fb::".$post->post_id;
$postarray["body"] = $msgdata["body"];
$postarray["tag"] = $msgdata["tags"];
+ // Change the object type when an attachment is present
+ if (isset($post->attachment->fb_object_type))
+ logger('fb_object_type: '.$post->attachment->fb_object_type." ".print_r($post->attachment, true), LOGGER_DEBUG);
+ switch ($post->attachment->fb_object_type) {
+ case 'photo':
+ $postarray['object-type'] = ACTIVITY_OBJ_IMAGE; // photo is deprecated: http://activitystrea.ms/head/activity-schema.html#image
+ break;
+ case 'video':
+ $postarray['object-type'] = ACTIVITY_OBJ_VIDEO;
+ break;
+ case '':
+ //$postarray['object-type'] = ACTIVITY_OBJ_BOOKMARK;
+ break;
+ default:
+ logger('Unknown object type '.$post->attachment->fb_object_type, LOGGER_DEBUG);
+ break;
+ }
+
$content = "";
$type = "";
$content = "[b]" . $post->attachment->name."[/b]";
$quote = "";
- if(isset($post->attachment->description) and ($post->attachment->fb_object_type != "photo"))
+ if (isset($post->attachment->description) and ($post->attachment->fb_object_type != "photo"))
$quote = $post->attachment->description;
- if(isset($post->attachment->caption) and ($post->attachment->fb_object_type == "photo"))
+ if (isset($post->attachment->caption) and ($post->attachment->fb_object_type == "photo"))
$quote = $post->attachment->caption;
if ($quote.$post->attachment->href.$content.$postarray["body"] == "")
return;
- if (isset($post->attachment->media) // AND !strstr($post->attachment->href, "://www.youtube.com/")
- //AND !strstr($post->attachment->href, "://youtu.be/")
- //AND !strstr($post->attachment->href, ".vimeo.com/"))
- AND (($type == "") OR ($type == "link"))) {
+ if (isset($post->attachment->media) AND (($type == "") OR ($type == "link"))) {
foreach ($post->attachment->media AS $media) {
- //$media->photo->owner = number_format($media->photo->owner, 0, '', '');
- //if ($media->photo->owner != '') {
- // $postarray['author-name'] = $contacts[$media->photo->owner]->name;
- // $postarray['author-link'] = $contacts[$media->photo->owner]->url;
- // $postarray['author-avatar'] = $contacts[$media->photo->owner]->pic_square;
- //}
if (isset($media->type))
$type = $media->type;
- if(isset($media->src) && isset($media->href) AND ($media->src != "") AND ($media->href != ""))
- $content .= "\n".'[url='.$media->href.'][img]'.fpost_cleanpicture($media->src).'[/img][/url]';
+ if (isset($media->src))
+ $preview = $media->src;
+
+ if (isset($media->photo))
+ if (isset($media->photo->images) AND (count($media->photo->images) > 1))
+ $preview = $media->photo->images[1]->src;
+
+ if (isset($media->href) AND ($preview != "") AND ($media->href != ""))
+ $content .= "\n".'[url='.$media->href.'][img]'.$preview.'[/img][/url]';
else {
- if (isset($media->src) AND ($media->src != ""))
- $content .= "\n".'[img]'.fpost_cleanpicture($media->src).'[/img]';
+ if ($preview != "")
+ $content .= "\n".'[img]'.$preview.'[/img]';
// if just a link, it may be a wall photo - check
- if(isset($post->link))
+ if (isset($post->link))
$content .= fbpost_get_photo($media->href);
}
}
}
+ if ($type == "link")
+ $postarray["object-type"] = ACTIVITY_OBJ_BOOKMARK;
+
if ($content)
$postarray["body"] .= "\n";
$postarray['wall'] = 0;
$postarray['verb'] = ACTIVITY_POST;
+ $postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
$postarray['network'] = dbesc(NETWORK_FACEBOOK);
$postarray['uri'] = "fb::".$comment->id;
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $postarray,
- 'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $item,
+ //'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $item,
+ 'link' => $a->get_baseurl().'/display/'.get_item_guid($item),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
$likedata = array();
$likedata['parent'] = $orig_post['id'];
+
$likedata['verb'] = ACTIVITY_LIKE;
+ $likedata['object-type'] = ACTIVITY_OBJ_NOTE;
$likedate['network'] = dbesc(NETWORK_FACEBOOK);
+
$likedata['gravity'] = 3;
$likedata['uid'] = $uid;
$likedata['wall'] = 0;
$url = "https://graph.facebook.com/fql?q=".urlencode(json_encode($fql))."&access_token=".$access_token;
$feed = fetch_url($url);
+ file_put_contents("fb.".$uid);
$data = json_decode($feed);
if (!is_array($data->data)) {
$inReplyTo = array("id" => $orig_post["uri"],
"objectType" => "note");
+ if (($orig_post["object-type"] != "") AND (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA)))
+ $inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
+
$params["object"] = array(
'objectType' => "comment",
'content' => $title.$content,
else
$uri = $orig_post["uri"];
- if (strstr($uri, "/api/comment/"))
+ if (($orig_post["object-type"] != "") AND (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA)))
+ $objectType = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
+ elseif (strstr($uri, "/api/comment/"))
$objectType = "comment";
elseif (strstr($uri, "/api/note/"))
$objectType = "note";
$likedata['parent-uri'] = $orig_post["uri"];
$likedata['contact-id'] = $contactid;
$likedata['app'] = $post->generator->displayName;
- $likedata['verb'] = ACTIVITY_LIKE;
$likedata['author-name'] = $post->actor->displayName;
$likedata['author-link'] = $post->actor->url;
$likedata['author-avatar'] = $post->actor->image->url;
$postarray['uid'] = $uid;
$postarray['wall'] = 0;
$postarray['uri'] = $post->object->id;
+ $postarray['object-type'] = NAMESPACE_ACTIVITY_SCHEMA.strtolower($post->object->objectType);
if ($post->object->objectType != "comment") {
$contact_id = pumpio_get_contact($uid, $post->actor);
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $postarray,
- 'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $top_item,
+ //'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $top_item,
+ 'link' => $a->get_baseurl().'/display/'.get_item_guid($top_item),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
if (count($r)) {
$postarray['thr-parent'] = $r[0]["uri"];
$postarray['parent-uri'] = $r[0]["parent-uri"];
+ $postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
} else {
$r = q("SELECT * FROM `item` WHERE `extid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent),
if (count($r)) {
$postarray['thr-parent'] = $r[0]['uri'];
$postarray['parent-uri'] = $r[0]['parent-uri'];
+ $postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
} else {
$postarray['thr-parent'] = $postarray['uri'];
$postarray['parent-uri'] = $postarray['uri'];
+ $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
}
}
}
// Don't create accounts of people who just comment something
$create_user = false;
- } else
+ } else {
$postarray['parent-uri'] = $postarray['uri'];
+ $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
+ }
if ($contactid == 0) {
$contactid = statusnet_fetch_contact($uid, $post->user, $create_user);
$postarray['contact-id'] = $contactid;
$postarray['verb'] = ACTIVITY_POST;
+
$postarray['author-name'] = $postarray['owner-name'];
$postarray['author-link'] = $postarray['owner-link'];
$postarray['author-avatar'] = $postarray['owner-avatar'];
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $postarray,
- 'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $top_item,
+ //'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $top_item,
+ 'link' => $a->get_baseurl().'/display/'.get_item_guid($top_item),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
'to_email' => $u[0]['email'],
'uid' => $u[0]['uid'],
'item' => $postarray,
- 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item,
+ //'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item,
+ 'link' => $a->get_baseurl().'/display/'.get_item_guid($item),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
if (count($r)) {
$postarray['thr-parent'] = $r[0]["uri"];
$postarray['parent-uri'] = $r[0]["parent-uri"];
+ $postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
} else {
$r = q("SELECT * FROM `item` WHERE `extid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent),
if (count($r)) {
$postarray['thr-parent'] = $r[0]['uri'];
$postarray['parent-uri'] = $r[0]['parent-uri'];
+ $postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
} else {
$postarray['thr-parent'] = $postarray['uri'];
$postarray['parent-uri'] = $postarray['uri'];
+ $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
}
}
}
// Don't create accounts of people who just comment something
$create_user = false;
- } else
+ } else {
$postarray['parent-uri'] = $postarray['uri'];
+ $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
+ }
if ($contactid == 0) {
$contactid = twitter_fetch_contact($uid, $post->user, $create_user);
//$postarray['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $postarray['body']);
//$has_picture = true;
$postarray['body'] = str_replace($media->url, "", $postarray['body']);
+ $postarray['object-type'] = ACTIVITY_OBJ_IMAGE;
$picture = $media->media_url_https;
break;
default:
//$postarray['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $postarray['body']);
//$has_picture = true;
$postarray['body'] = str_replace($media->url, "", $postarray['body']);
+ $postarray['object-type'] = ACTIVITY_OBJ_IMAGE;
$picture = $media->media_url_https;
break;
default:
'to_email' => $user[0]['email'],
'uid' => $user[0]['uid'],
'item' => $postarray,
- 'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $top_item,
+ //'link' => $a->get_baseurl() . '/display/' . $user[0]['nickname'] . '/' . $top_item,
+ 'link' => $a->get_baseurl().'/display/'.get_item_guid($top_item),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],
'to_email' => $u[0]['email'],
'uid' => $u[0]['uid'],
'item' => $postarray,
- 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item,
+ //'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item,
+ 'link' => $a->get_baseurl().'/display/'.get_item_guid($item),
'source_name' => $postarray['author-name'],
'source_link' => $postarray['author-link'],
'source_photo' => $postarray['author-avatar'],