From 1bb89d2030871a185a54aba8214a82b28b821b3d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 28 Mar 2015 22:14:46 +0100 Subject: [PATCH 1/3] Making sure that really only public postings are relayed. --- fbpost/fbpost.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index 5fa6e431d..9092c7d12 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -991,11 +991,15 @@ function fbpost_fetchwall($a, $uid) { $access_token = get_pconfig($uid,'facebook','access_token'); $post_to_page = get_pconfig($uid,'facebook','post_to_page'); + $mirror_page = get_pconfig($uid,'facebook','mirror_page'); $lastcreated = get_pconfig($uid,'facebook','last_created'); if ((int)$post_to_page == 0) $post_to_page = "me"; + if ((int)$mirror_page != 0) + $post_to_page = $mirror_page; + $url = "https://graph.facebook.com/".$post_to_page."/feed?access_token=".$access_token; $first_time = ($lastcreated == ""); @@ -1021,7 +1025,8 @@ function fbpost_fetchwall($a, $uid) { if ($item->application->id == get_config('facebook','appid')) continue; - if(isset($item->privacy) && ($item->privacy->value !== 'EVERYONE') && ($item->privacy->value !== '')) + //if(isset($item->privacy) && ($item->privacy->value !== 'EVERYONE') && ($item->privacy->value !== '')) + if((isset($item->privacy) && ($item->privacy->value !== 'EVERYONE')) OR !isset($item->privacy)) continue; if (($post_to_page != $item->from->id) AND ((int)$post_to_page != 0)) @@ -1091,7 +1096,13 @@ function fbpost_fetchwall($a, $uid) { $data = json_decode($feed); if (isset($data->images)) { $pagedata["images"][0]["src"] = $data->images[0]->source; - logger('fbpost_fetchwall: got fbid image '.$preview, LOGGER_DEBUG); + logger('got fbid image from images for '.$item->object_id, LOGGER_DEBUG); + } elseif (isset($data->source)) { + $pagedata["images"][0]["src"] = $data->source; + logger('got fbid image from source for '.$item->object_id, LOGGER_DEBUG); + } elseif (isset($data->picture)) { + $pagedata["images"][0]["src"] = $data->picture; + logger('got fbid image from picture for '.$item->object_id, LOGGER_DEBUG); } } From 488650e377f19e8d77aa51884f35b8c7bde8f462 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 29 Mar 2015 00:25:39 +0100 Subject: [PATCH 2/3] fbpost: changed the facebook permissions to the current requirements --- fbpost/fbpost.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index 9092c7d12..fe6bd2906 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -248,9 +248,10 @@ function fbpost_content(&$a) { $o .= '
'; //read_stream,publish_stream,manage_pages,photo_upload,user_groups,offline_access + //export_stream,read_stream,publish_stream,manage_pages,photo_upload,user_groups,publish_actions,user_friends,share_item,video_upload,status_update - $o .= '' . t('Install Facebook Post connector for this account.') . ''; + $o .= '' . t('Install Facebook Post connector for this account.') . ''; $o .= '
'; } @@ -261,8 +262,10 @@ function fbpost_content(&$a) { $o .= '
'; - $o .= '' . t('Re-authenticate [This is necessary whenever your Facebook password is changed.]') . ''; + //export_stream,read_stream,publish_stream,manage_pages,photo_upload,user_groups,publish_actions,user_friends,share_item,video_upload,status_update + + $o .= '' . t('Re-authenticate [This is necessary whenever your Facebook password is changed.]') . ''; $o .= '
'; $o .= '
'; From b0f9f2fdb59fdf5cd53c258e30e4766c32184116 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 29 Mar 2015 01:59:23 +0100 Subject: [PATCH 3/3] Improved readme. --- fbpost/README.md | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fbpost/README.md b/fbpost/README.md index c214360a8..63145be03 100644 --- a/fbpost/README.md +++ b/fbpost/README.md @@ -1,18 +1,10 @@ -Installing the Friendica/Facebook connector +#### Installing the Friendica/Facebook connector -Detailed instructions how to use this plugin can be found at -the [How to: Friendica's Facebook Connector](https://github.com/friendica/friendica/wiki/How-to:-Friendica%E2%80%99s-Facebook-connector) page. +Please register a Facebook application at [developers.facebook.com](https://developers.facebook.com/apps/async/create/platform-setup/dialog/) -Vidoes and embeds will not be posted if there is no other content. Links -and images will be converted to a format suitable for the Facebook API and -long posts truncated - with a link to view the full post. +Chose "Website" as platform. Next you have to let your application be reviewed. You need these permissions for that: -Facebook contacts will not be able to view private photos, as they are not able to -authenticate to your site to establish identity. We will address this -in a future release. +publish_actions, publish_pages, user_posts, user_photos, user_status, user_videos, manage_pages -This addon will only post your entries to your Facebook account but won't fetch -content from there. +After your application was reviewed, your users can post to Facebook. -Info: please make sure that you understand all aspects due to Friendica's -default licence which is: [MIT License](https://github.com/friendica/friendica/blob/master/LICENSE)