From c71fdbf348eb807efb975b1642f3fbcacd08d59b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 6 Apr 2012 14:51:35 +0200 Subject: [PATCH 1/7] Facebook: The import is now formatted in another way to make it look nicer --- facebook/facebook.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/facebook/facebook.php b/facebook/facebook.php index 1849cef3..6b433196 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -1333,22 +1333,35 @@ function fb_consume_stream($uid,$j,$wall = false) { $datarray['body'] = escape_tags($entry->message); + if($entry->name and $entry->link) + $datarray['body'] .= "\n\n[bookmark=".$entry->link."]".$entry->name."[/bookmark]"; + elseif ($entry->name) + $datarray['body'] .= "\n\n[b]" . $entry->name."[/b]"; + + if($entry->caption) { + if(!$entry->name and $entry->link) + $datarray['body'] .= "\n\n[bookmark=".$entry->link."]".$entry->caption."[/bookmark]"; + else + $datarray['body'] .= "[i]" . $entry->caption."[/i]\n"; + } + + if(!$entry->caption and !$entry->name) + $datarray['body'] .= "\n"; + + if($entry->description) + $datarray['body'] .= "\n[quote]" . $entry->description."[/quote]"; + if($entry->picture && $entry->link) { - $datarray['body'] .= "\n\n" . '[url=' . $entry->link . '][img]' . $entry->picture . '[/img][/url]'; + $datarray['body'] .= "\n" . '[url=' . $entry->link . '][img]' . $entry->picture . '[/img][/url]'; } else { if($entry->picture) - $datarray['body'] .= "\n\n" . '[img]' . $entry->picture . '[/img]'; + $datarray['body'] .= "\n" . '[img]' . $entry->picture . '[/img]'; // if just a link, it may be a wall photo - check if($entry->link) $datarray['body'] .= fb_get_photo($uid,$entry->link); } - if($entry->name) - $datarray['body'] .= "\n" . $entry->name; - if($entry->caption) - $datarray['body'] .= "\n" . $entry->caption; - if($entry->description) - $datarray['body'] .= "\n" . $entry->description; + $datarray['created'] = datetime_convert('UTC','UTC',$entry->created_time); $datarray['edited'] = datetime_convert('UTC','UTC',$entry->updated_time); From 6fc0f8fc022e0ce9fc873e76efd3ae83f43cc9da Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 6 Apr 2012 14:56:53 +0200 Subject: [PATCH 2/7] Removed plugin "pages" because it was absolete. (Replaced by "page") --- pages.tgz | Bin 1390 -> 1375 bytes pages/README | 3 -- pages/pages.php | 93 ------------------------------------------------ 3 files changed, 96 deletions(-) delete mode 100755 pages/README delete mode 100755 pages/pages.php diff --git a/pages.tgz b/pages.tgz index 1a0aa4187669861309319e2b263aa6fa61bf5431..5fd23f7302f3a9d134af0a0a10e329531c0793c6 100644 GIT binary patch literal 1375 zcmV-l1)%yLiwFSR=YCHB1MOFBZ`(Ey&R6?a+=#4_1IM!R=ApIS1*wY;Xp+KB+Yf;e zGZJkPmPL=Gl4e8y`;MgSC{CJeAF^VY9vGIzdw9otm9?N#rh<)UMH|uC-#6DC{83yx zcD=wx7i%j#vbK8CI63NVe@alTZ?4zEH<9V z|9*I|Yx2JvhV9+(ppE%Q@!kfspXD@b_@C#$`x>)e54N`IumvY{&R)U?Qw-+z4O5Zi z3(ZCL5fi1eK|ji7^6a?`akUDYznROl2`@H{#6;Da4g!c07R`WN zF?j>mjLl#oB1oswm~H#Ph+@bz%r3flX{I$z+WjkH=0N1#42Jj8Fe+EGrzI@ z%fVi|z16XXjHNFL%RmbO0=1!$OlUNgXE98ej*_y`i4=2tzmQ_WQ-%sQkqGevO<2{05xJ@`LHGtNRSd8s-rB_5Y)2Hy_uaT( zW-EK6SEfaEE;GNp>A_BzGHrig8}Qgvq^*5t-dc`fX{b1k$R>Q62i+}FhuWhA_00*YDVA+=-NQ8*Klkw45WYS09CNOaWlXKk(kPzpX1Bzo41+vIS zDyCCBH*U-oldkqq{dT{gVBlP*gw)-~5?8%KUx$dcW@*U~;YS~YQ_<#hvG?gqH;R)Miq zSlMvh{A-GE|XQr;)F zSW8Dl5k|rV&3zk6dEzV`Z9pFrTX-mxdsx~B13F^#oqN*7uo~W^B60#rI4VdhUsA#J<&E_v=6U zFK>ks+&|eN{)IXoJeQ3p-~aax-1|Q+?zKaF{|m$Y>izFufqU7jKk;_=qfc3(LWK$y hDpaUYp+bcU6)IGyP@zJF3Kjk-{sKZagPQ;-004oWv@`$! literal 1390 zcmV-!1(Et6iwFQFKXgw31MOE^Z`w!{<`sU$*-^GO5y3#XL@m%pEmc=)l8UD7LxjR$ z4|s&}uruSN*;W7ho*5hBkhIx-Nc*tl{2%rjnE%F;ShIuwdH(w^G3ym?f4>6za7tI~ zIeak1U@qS<Ly@A)mtu z_e07e_$(Iq-RDd8YRx6pEM8No8LtOyhT zybOg{x{hI7vN&*R;LsotvA0vqW+N4|rB+{5zTH!Te&p38@lz?{Y8y6pFOg9Vp6!_( z6IH9)^S}?8zXW#0gm1ti#Q;m< ztxdemwoj3K-;Miaw$(RzVOmrtGIsNa9_)k#)AkRx0S`8+zlP-4n3*n7{4XZvZm#PFCZzd*ZbNAg?U^)CABWxm z{&dO5(fiTsbC~jAT7xM@!2Fo8Ifb|5vlEzR^eIX#e|a|=k6;=zeJ$j2Ishk_%h-YA z(>Hh)MWD>z15z_w9_uR_rQt{wTPN-sgCTm46A93hTr&b!Kz9amrHo^PVIbXG2dIM0 zMLGjaKpq%O8Rvqadt_3(O?lPCDKqRMS8|3o7~VTaOkD14*afr0gFEYZIkAP9`uIh1 z&0t1x4(`-KrK}!LcHZJ#Nm|~6#kd*T?jEf@+na4B@mU<*z)D;(Kqkh@e6*u%=t-7T zf`lN!98esaxFNG_L}IZ(yYXP6m`rOA#UBhaIyUlFL>11)U^fl-!a=W`Nm`dC;Hmw0 zO2X*}{0ew5Aa>!#F-IMr3U1h2iO#3Xwqe=*}CQ$b>qm7vc2$d=+w1KUT>SY zT6g*$F84h=cPqf?%CsD$I!$=Vu%ARjXSYvwTl}tPwvzuvb!Ohyjk^)wx?qj(QwSxS z4~SDY(#-^zQN^(ETy(&bEa1|^y*m|FceVkF=!``K@W~I44hZ{-H~W}I=v2HU7!u=m zdADxsr0-D-OvH!87HiH#+`>qtK})|4B|mXCj#goaiOoC|D!p0S8v{CG%SP;5<>j#Qs~>p_ - * - */ - -function pages_install() { - register_hook('page_end', 'addon/pages/pages.php', 'pages_page_end'); -} - -function pages_uninstall() { - unregister_hook('page_end', 'addon/pages/pages.php', 'pages_page_end'); -} - -function pages_iscommunity($url, &$pagelist) { - // check every week for the status - should be enough - if ($pagelist[$url]["checked"]') != 0); - - $pagelist[$url] = array("community" => $iscommunity, "checked" => time()); - } else // Fetch from cache - $iscommunity = $pagelist[$url]["community"]; - return($iscommunity); -} - -function pages_getpages($uid) { - - // Fetch cached pagelist from configuration - $pagelist = get_pconfig($uid,'pages','pagelist'); - - if (sizeof($pagelist) == 0) - $pagelist = array(); - - $contacts = q("SELECT `id`, `url`, `Name` FROM `contact` - WHERE `network`= 'dfrn' AND `uid` = %d", - intval($uid)); - - $pages = array(); - - // Look if the profile is a community page - foreach($contacts as $contact) { - if (pages_iscommunity($contact["url"], $pagelist)) - $pages[] = array("url"=>$contact["url"], "Name"=>$contact["Name"], "id"=>$contact["id"]); - } - - // Write back cached pagelist - set_pconfig($uid,'pages','pagelist', $pagelist); - return($pages); -} - -function pages_page_end($a,&$b) { - // Only move on if if it's the "network" module and there is a logged on user - if (($a->module != "network") OR ($a->user['uid'] == 0)) - return; - - $pages = '
-
-

'.t("Community").'

-
"; - if (sizeof($contacts) > 0) { - $pos = strpos($a->page['aside'], '
0) { - $a->page['aside'] = substr($a->page['aside'], 0, $pos).$pages.substr($a->page['aside'], $pos); - } else - $a->page['aside'] = $pages.$a->page['aside']; - } -} -?> From 33df3995742eba7f9a4936ae9d0807547164be0b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 6 Apr 2012 20:22:35 +0200 Subject: [PATCH 3/7] Facebook: Pages are now imported. Formatting of the import is improved. --- facebook/facebook.php | 69 ++++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/facebook/facebook.php b/facebook/facebook.php index 6b433196..59acfa97 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -268,6 +268,10 @@ function fb_get_friends_sync_full($uid, $access_token, $person) { $jp->link = 'http://facebook.com/profile.php?id=' . $person->id; + // If its a page then set the first name from the username + if (!$jp->first_name and $jp->username) + $jp->first_name = $jp->username; + // check if we already have a contact $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1", @@ -1211,7 +1215,8 @@ function fb_consume_all($uid) { function fb_get_photo($uid,$link) { $access_token = get_pconfig($uid,'facebook','access_token'); if(! $access_token || (! stristr($link,'facebook.com/photo.php'))) - return "\n" . '[url=' . $link . ']' . t('link') . '[/url]'; + return ""; + //return "\n" . '[url=' . $link . ']' . t('link') . '[/url]'; $ret = preg_match('/fbid=([0-9]*)/',$link,$match); if($ret) $photo_id = $match[1]; @@ -1219,8 +1224,8 @@ function fb_get_photo($uid,$link) { $j = json_decode($x); if($j->picture) return "\n\n" . '[url=' . $link . '][img]' . $j->picture . '[/img][/url]'; - else - return "\n" . '[url=' . $link . ']' . t('link') . '[/url]'; + //else + // return "\n" . '[url=' . $link . ']' . t('link') . '[/url]'; } function fb_consume_stream($uid,$j,$wall = false) { @@ -1279,6 +1284,10 @@ function fb_consume_stream($uid,$j,$wall = false) { if($from->id == $self_id) $datarray['contact-id'] = $self[0]['id']; else { + // Looking if user is known - if not he is added + $access_token = get_pconfig($uid, 'facebook', 'access_token'); + fb_get_friends_sync_new($uid, $access_token, $from); + $r = q("SELECT * FROM `contact` WHERE `notify` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1", dbesc($from->id), intval($uid) @@ -1290,14 +1299,14 @@ function fb_consume_stream($uid,$j,$wall = false) { // don't store post if we don't have a contact if(! x($datarray,'contact-id')) { - if (get_config('facebook', 'pages')) { - // If no user is found then post it under the own id. - // Definitely a quickhack - $datarray['contact-id'] = $self[0]['id']; - } else { + //if (get_config('facebook', 'pages')) { + // // If no user is found then post it under the own id. + // // Definitely a quickhack + // $datarray['contact-id'] = $self[0]['id']; + //} else { logger('no contact: post ignored'); continue; - } + //} } $datarray['verb'] = ACTIVITY_POST; @@ -1345,11 +1354,22 @@ function fb_consume_stream($uid,$j,$wall = false) { $datarray['body'] .= "[i]" . $entry->caption."[/i]\n"; } - if(!$entry->caption and !$entry->name) - $datarray['body'] .= "\n"; + if(!$entry->caption and !$entry->name) { + if ($entry->link) + $datarray['body'] .= "\n[url]".$entry->link."[/url]\n"; + else + $datarray['body'] .= "\n"; + } + $quote = ""; if($entry->description) - $datarray['body'] .= "\n[quote]" . $entry->description."[/quote]"; + $quote = $entry->description; + + foreach ($entry->properties as $property) + $quote .= "\n".$property->name.": [url=".$property->href."]".$property->text."[/url]"; + + if ($quote) + $datarray['body'] .= "\n[quote]".$quote."[/quote]"; if($entry->picture && $entry->link) { $datarray['body'] .= "\n" . '[url=' . $entry->link . '][img]' . $entry->picture . '[/img][/url]'; @@ -1362,6 +1382,26 @@ function fb_consume_stream($uid,$j,$wall = false) { $datarray['body'] .= fb_get_photo($uid,$entry->link); } + if(trim($datarray['body']) == '') { + logger('facebook: empty body'); + continue; + } + + $datarray['body'] .= "\n"; + + if ($entry->icon) + $datarray['body'] .= "[img]".$entry->icon."[/img]   "; + + foreach ($entry->actions as $action) + if (($action->name != "Comment") and ($action->name != "Like")) + $datarray['body'] .= "[url=".$action->link."]".$action->name."[/url]   "; + + $datarray['body'] = trim($datarray['body']); + + //if(($datarray['body'] != '') and ($uid == 1)) + // $datarray['body'] .= "[noparse]".print_r($entry, true)."[/noparse]"; + + $datarray['created'] = datetime_convert('UTC','UTC',$entry->created_time); $datarray['edited'] = datetime_convert('UTC','UTC',$entry->updated_time); @@ -1373,11 +1413,6 @@ function fb_consume_stream($uid,$j,$wall = false) { $datarray['allow_cid'] = '<' . $self[0]['id'] . '>'; } - if(trim($datarray['body']) == '') { - logger('facebook: empty body'); - continue; - } - $top_item = item_store($datarray); $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($top_item), From 3689c821b692a99533f2cb338dccaaca8ed5f896 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 6 Apr 2012 23:36:41 +0200 Subject: [PATCH 4/7] Showmore: A little html bug was fixed (missing
) --- facebook/facebook.php | 34 ++++++++++++++++++++-------------- showmore/showmore.php | 3 ++- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/facebook/facebook.php b/facebook/facebook.php index 59acfa97..c5378e54 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -1365,21 +1365,26 @@ function fb_consume_stream($uid,$j,$wall = false) { if($entry->description) $quote = $entry->description; - foreach ($entry->properties as $property) - $quote .= "\n".$property->name.": [url=".$property->href."]".$property->text."[/url]"; + if ($entry->properties) + foreach ($entry->properties as $property) + $quote .= "\n".$property->name.": [url=".$property->href."]".$property->text."[/url]"; if ($quote) $datarray['body'] .= "\n[quote]".$quote."[/quote]"; - if($entry->picture && $entry->link) { - $datarray['body'] .= "\n" . '[url=' . $entry->link . '][img]' . $entry->picture . '[/img][/url]'; - } - else { - if($entry->picture) - $datarray['body'] .= "\n" . '[img]' . $entry->picture . '[/img]'; - // if just a link, it may be a wall photo - check - if($entry->link) - $datarray['body'] .= fb_get_photo($uid,$entry->link); + // Only import the picture when the message is no video + // oembed display a picture of the video as well + if ($entry->type != "video") { + if($entry->picture && $entry->link) { + $datarray['body'] .= "\n" . '[url=' . $entry->link . '][img]'.$entry->picture.'[/img][/url]'; + } + else { + if($entry->picture) + $datarray['body'] .= "\n" . '[img]' . $entry->picture . '[/img]'; + // if just a link, it may be a wall photo - check + if($entry->link) + $datarray['body'] .= fb_get_photo($uid,$entry->link); + } } if(trim($datarray['body']) == '') { @@ -1392,9 +1397,10 @@ function fb_consume_stream($uid,$j,$wall = false) { if ($entry->icon) $datarray['body'] .= "[img]".$entry->icon."[/img]   "; - foreach ($entry->actions as $action) - if (($action->name != "Comment") and ($action->name != "Like")) - $datarray['body'] .= "[url=".$action->link."]".$action->name."[/url]   "; + if ($entry->actions) + foreach ($entry->actions as $action) + if (($action->name != "Comment") and ($action->name != "Like")) + $datarray['body'] .= "[url=".$action->link."]".$action->name."[/url]   "; $datarray['body'] = trim($datarray['body']); diff --git a/showmore/showmore.php b/showmore/showmore.php index 6aeb6ff3..2b4d5d0f 100755 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -46,7 +46,8 @@ function showmore_addon_settings(&$a,&$s) { $s .= '
'; $s .= '
'; -// $s .= '
' . t('Use /expression/ to provide regular expressions') . '
'; +// $s .= '
' . t('Use /expression/ to provide regular expressions') . '
'; + $s .= ''; return; } From 11f1d7e260dc99dcff6473ebcdfd3d42f6a2a04c Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 7 Apr 2012 18:11:57 +0200 Subject: [PATCH 5/7] Facebook: Now the last fetched date is saved. --- facebook/facebook.php | 81 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 12 deletions(-) diff --git a/facebook/facebook.php b/facebook/facebook.php index c5378e54..c09ac2fb 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -1178,6 +1178,46 @@ function fb_queue_hook(&$a,&$b) { } } +function fb_get_timeline($access_token, &$since) { + + $entries->data = array(); + $newest = 0; + + $url = 'https://graph.facebook.com/me/home?access_token='.$access_token; + + if ($since != 0) + $url .= "&since=".$since; + + do { + $s = fetch_url($url); + $j = json_decode($s); + $oldestdate = time(); + if (isset($j->data)) + foreach ($j->data as $entry) { + $created = strtotime($entry->created_time); + + if ($newest < $created) + $newest = $created; + + if ($created >= $since) + $entries->data[] = $entry; + + if ($created <= $oldestdate) + $oldestdate = $created; + } + else + break; + + $url = $s->paging->next; + + } while (($oldestdate > $since) and ($since != 0)); + + if ($newest > $since) + $since = $newest; + + return($entries); +} + function fb_consume_all($uid) { require_once('include/items.php'); @@ -1199,17 +1239,20 @@ function fb_consume_all($uid) { } } } - $s = fetch_url('https://graph.facebook.com/me/home?access_token=' . $access_token); - if($s) { - $j = json_decode($s); - if (isset($j->data)) { - logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA); - fb_consume_stream($uid,$j,false); - } else { - logger('fb_consume_stream: feed: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL); - } - } + // Get the last date + $lastdate = get_pconfig($uid,'facebook','lastdate'); + // echo "Alt: ".$lastdate."\n"; + // fetch all items since the last date + $j = fb_get_timeline($access_token, &$lastdate); + if (isset($j->data)) { + logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA); + fb_consume_stream($uid,$j,false); + // echo "Neu: ".$lastdate."\n"; + // Write back the last date + set_pconfig($uid,'facebook','lastdate', $lastdate); + } else + logger('fb_consume_stream: feed: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL); } function fb_get_photo($uid,$link) { @@ -1304,7 +1347,7 @@ function fb_consume_stream($uid,$j,$wall = false) { // // Definitely a quickhack // $datarray['contact-id'] = $self[0]['id']; //} else { - logger('no contact: post ignored'); + logger('facebook: no contact '.$from->name.' '.$from->id.'. post ignored'); continue; //} } @@ -1340,6 +1383,8 @@ function fb_consume_stream($uid,$j,$wall = false) { $datarray['author-avatar'] = 'https://graph.facebook.com/' . $from->id . '/picture'; $datarray['plink'] = $datarray['author-link'] . '&v=wall&story_fbid=' . substr($entry->id,strpos($entry->id,'_') + 1); + logger('facebook: post '.$entry->id.' from '.$from->name); + $datarray['body'] = escape_tags($entry->message); if($entry->name and $entry->link) @@ -1388,7 +1433,7 @@ function fb_consume_stream($uid,$j,$wall = false) { } if(trim($datarray['body']) == '') { - logger('facebook: empty body'); + logger('facebook: empty body '.$entry->id.' '.print_r($entry, true)); continue; } @@ -1407,6 +1452,18 @@ function fb_consume_stream($uid,$j,$wall = false) { //if(($datarray['body'] != '') and ($uid == 1)) // $datarray['body'] .= "[noparse]".print_r($entry, true)."[/noparse]"; + if ($entry->place->name) + $datarray['coord'] = $entry->place->name; + else if ($entry->place->location->street or $entry->place->location->city or $entry->place->location->Denmark) { + if ($entry->place->location->street) + $datarray['coord'] = $entry->place->location->street; + if ($entry->place->location->city) + $datarray['coord'] .= " ".$entry->place->location->city; + if ($entry->place->location->country) + $datarray['coord'] .= " ".$entry->place->location->country; + } else if ($entry->place->location->latitude and $entry->place->location->longitude) + $datarray['coord'] = substr($entry->place->location->latitude, 0, 8) + .' '.substr($entry->place->location->longitude, 0, 8); $datarray['created'] = datetime_convert('UTC','UTC',$entry->created_time); $datarray['edited'] = datetime_convert('UTC','UTC',$entry->updated_time); From 94186ab4756334982f0ea2e2c92be7c40d9fe367 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 7 Apr 2012 21:38:45 +0200 Subject: [PATCH 6/7] facebook: Bug fixed that prevent old posts from being fetched. --- facebook/facebook.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/facebook/facebook.php b/facebook/facebook.php index c09ac2fb..473c5cd0 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -1208,9 +1208,9 @@ function fb_get_timeline($access_token, &$since) { else break; - $url = $s->paging->next; + $url = $j->paging->next; - } while (($oldestdate > $since) and ($since != 0)); + } while (($oldestdate > $since) and ($since != 0) and ($url != '')); if ($newest > $since) $since = $newest; @@ -1241,13 +1241,11 @@ function fb_consume_all($uid) { } // Get the last date $lastdate = get_pconfig($uid,'facebook','lastdate'); - // echo "Alt: ".$lastdate."\n"; // fetch all items since the last date $j = fb_get_timeline($access_token, &$lastdate); if (isset($j->data)) { logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA); fb_consume_stream($uid,$j,false); - // echo "Neu: ".$lastdate."\n"; // Write back the last date set_pconfig($uid,'facebook','lastdate', $lastdate); @@ -1432,6 +1430,10 @@ function fb_consume_stream($uid,$j,$wall = false) { } } + // Just as a test - to see if these are the missing entries + if(trim($datarray['body']) == '') + $datarray['body'] = $entry->story; + if(trim($datarray['body']) == '') { logger('facebook: empty body '.$entry->id.' '.print_r($entry, true)); continue; From be9f1fb659d7245f1b4e15eb8b46d157c3254c83 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 8 Apr 2012 00:27:26 +0200 Subject: [PATCH 7/7] Facebook: Removed the test output of empty posts. --- facebook/facebook.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/facebook/facebook.php b/facebook/facebook.php index 473c5cd0..70a353dd 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -1338,16 +1338,9 @@ function fb_consume_stream($uid,$j,$wall = false) { } // don't store post if we don't have a contact - if(! x($datarray,'contact-id')) { - //if (get_config('facebook', 'pages')) { - // // If no user is found then post it under the own id. - // // Definitely a quickhack - // $datarray['contact-id'] = $self[0]['id']; - //} else { - logger('facebook: no contact '.$from->name.' '.$from->id.'. post ignored'); - continue; - //} + logger('facebook: no contact '.$from->name.' '.$from->id.'. post ignored'); + continue; } $datarray['verb'] = ACTIVITY_POST; @@ -1431,8 +1424,8 @@ function fb_consume_stream($uid,$j,$wall = false) { } // Just as a test - to see if these are the missing entries - if(trim($datarray['body']) == '') - $datarray['body'] = $entry->story; + //if(trim($datarray['body']) == '') + // $datarray['body'] = $entry->story; if(trim($datarray['body']) == '') { logger('facebook: empty body '.$entry->id.' '.print_r($entry, true));