bug #114, warn about linked Facebook item privacy

This commit is contained in:
Friendika 2011-08-02 17:04:03 -07:00
parent 2637831d90
commit b774127616
2 changed files with 17 additions and 8 deletions

View File

@ -111,13 +111,13 @@ function facebook_init(&$a) {
$token = substr($token,0,strpos($token,'&')); $token = substr($token,0,strpos($token,'&'));
set_pconfig($uid,'facebook','access_token',$token); set_pconfig($uid,'facebook','access_token',$token);
set_pconfig($uid,'facebook','post','1'); set_pconfig($uid,'facebook','post','1');
set_pconfig($uid,'facebook','no_linking',1);
fb_get_self($uid); fb_get_self($uid);
fb_get_friends($uid); fb_get_friends($uid);
fb_consume_all($uid); fb_consume_all($uid);
} }
// todo: is this a browser session or a server session? where do we go?
} }
} }
@ -258,6 +258,8 @@ function fb_get_friends($uid) {
} }
} }
// This is the POST method to the facebook settings page
// Content is posted to Facebook in the function facebook_post_hook()
function facebook_post(&$a) { function facebook_post(&$a) {
@ -298,6 +300,8 @@ function facebook_post(&$a) {
return; return;
} }
// Facebook settings form
function facebook_content(&$a) { function facebook_content(&$a) {
if(! local_user()) { if(! local_user()) {
@ -347,14 +351,18 @@ function facebook_content(&$a) {
$o .= '<form action="facebook" method="post" >'; $o .= '<form action="facebook" method="post" >';
$post_by_default = get_pconfig(local_user(),'facebook','post_by_default'); $post_by_default = get_pconfig(local_user(),'facebook','post_by_default');
$checked = (($post_by_default) ? ' checked="checked" ' : ''); $checked = (($post_by_default) ? ' checked="checked" ' : '');
$o .= '<input type="checkbox" name="post_by_default" value="1"' . $checked . '/>' . ' ' . t('Post to Facebook by default') . '<br />'; $o .= '<input type="checkbox" name="post_by_default" value="1"' . $checked . '/>' . ' ' . t('Post to Facebook by default') . EOL;
$no_linking = get_pconfig(local_user(),'facebook','no_linking'); $no_linking = get_pconfig(local_user(),'facebook','no_linking');
$checked = (($no_linking) ? '' : ' checked="checked" '); $checked = (($no_linking) ? '' : ' checked="checked" ');
$o .= '<input type="checkbox" name="facebook_linking" value="1"' . $checked . '/>' . ' ' . t('Link all your Facebook friends and conversations') . '<br />'; $o .= '<input type="checkbox" name="facebook_linking" value="1"' . $checked . '/>' . ' ' . t('Link all your Facebook friends and conversations') . EOL ;
$hidden = (($a->user['hidewall'] || get_config('system','block_public')) ? true : false);
if(! $hidden) {
$o .= EOL;
$o .= t('Warning: Your Facebook privacy settings can not be imported.') . EOL;
$o .= t('Linked Facebook items <strong>may</strong> be publicly visible, depending on your privacy settings for this website/account.') . EOL;
}
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form></div>'; $o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form></div>';
} }
@ -746,6 +754,8 @@ function fb_consume_all($uid) {
$access_token = get_pconfig($uid,'facebook','access_token'); $access_token = get_pconfig($uid,'facebook','access_token');
if(! $access_token) if(! $access_token)
return; return;
$s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token); $s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token);
if($s) { if($s) {
$j = json_decode($s); $j = json_decode($s);
@ -772,13 +782,12 @@ function fb_consume_stream($uid,$j,$wall = false) {
intval($uid) intval($uid)
); );
$user = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1", $user = q("SELECT `nickname`, `blockwall` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid) intval($uid)
); );
if(count($user)) if(count($user))
$my_local_url = $a->get_baseurl() . '/profile/' . $user[0]['nickname']; $my_local_url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
$self_id = get_pconfig($uid,'facebook','self_id'); $self_id = get_pconfig($uid,'facebook','self_id');
if(! count($j->data) || (! strlen($self_id))) if(! count($j->data) || (! strlen($self_id)))
return; return;

View File

@ -7,7 +7,7 @@ require_once('include/text.php');
require_once("include/pgettext.php"); require_once("include/pgettext.php");
define ( 'FRIENDIKA_VERSION', '2.2.1059' ); define ( 'FRIENDIKA_VERSION', '2.2.1060' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1076 ); define ( 'DB_UPDATE_VERSION', 1076 );