if($b['deleted'] || ($b['created'] !== $b['edited']))
return;
+ // Don't transmit answers (have to be cleaned up in the following code)
+ if($b['parent'] != $b['id'])
+ return;
+
// if post comes from facebook don't send it back
if($b['app'] == "Facebook")
return;
$url = "https://graph.facebook.com/".$post_to_page."/feed?access_token=".$access_token;
+ $first_time = ($lastcreated == "");
+
if ($lastcreated != "")
$url .= "&since=".urlencode($lastcreated);
$feed = fetch_url($url);
$data = json_decode($feed);
+
+ if (!is_array($data->data))
+ return;
+
$items = array_reverse($data->data);
foreach ($items as $item) {
if ($item->created_time > $lastcreated)
$lastcreated = $item->created_time;
+ if ($first_time)
+ continue;
+
if ($item->application->id == get_config('facebook','appid'))
continue;
if(isset($item->privacy) && ($item->privacy->value !== 'EVERYONE') && ($item->privacy->value !== ''))
continue;
+ if (($post_to_page != $item->from->id) AND ((int)$post_to_page != 0))
+ continue;
+
$_SESSION["authenticated"] = true;
$_SESSION["uid"] = $uid;
elseif (isset($item->name))
$_REQUEST["body"] .= "\n\n[b]" . $item->name."[/b]";
- if(isset($item->caption)) {
+ /*if(isset($item->caption)) {
if(!isset($item->name) and isset($item->link))
$_REQUEST["body"] .= "\n\n[bookmark=".$item->link."]".$item->caption."[/bookmark]";
//else
$_REQUEST["body"] .= "\n[url]".$item->link."[/url]\n";
else
$_REQUEST["body"] .= "\n";
- }
+ }*/
$quote = "";
- if(isset($item->description))
+ if(isset($item->description) and ($item->type != "photo"))
$quote = $item->description;
- if (isset($item->properties))
- foreach ($item->properties as $property)
- $quote .= "\n".$property->name.": [url=".$property->href."]".$property->text."[/url]";
+ if(isset($item->caption) and ($item->type == "photo"))
+ $quote = $item->caption;
+
+ //if (isset($item->properties))
+ // foreach ($item->properties as $property)
+ // $quote .= "\n".$property->name.": [url=".$property->href."]".$property->text."[/url]";
if ($quote)
$_REQUEST["body"] .= "\n[quote]".$quote."[/quote]";
// Only import the picture when the message is no video
// oembed display a picture of the video as well
if ($item->type != "video") {
+ //if (($item->type != "video") and ($item->type != "photo")) {
if(isset($item->picture) && isset($item->link))
$_REQUEST["body"] .= "\n".'[url='.$item->link.'][img]'.fpost_cleanpicture($item->picture).'[/img][/url]';
else {