diff --git a/facebook.tgz b/facebook.tgz index 0e6623f9..0ecd878c 100644 Binary files a/facebook.tgz and b/facebook.tgz differ diff --git a/facebook/facebook.php b/facebook/facebook.php index a103f2e8..6599a7a7 100644 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -294,6 +294,8 @@ function facebook_post(&$a) { set_pconfig($uid,'facebook','private_wall',$private_wall); + set_pconfig($uid,'facebook','blocked_apps',escape_tags(trim($_POST['blocked_apps']))); + $linkvalue = ((x($_POST,'facebook_linking')) ? intval($_POST['facebook_linking']) : 0); set_pconfig($uid,'facebook','no_linking', (($linkvalue) ? 0 : 1)); @@ -401,6 +403,12 @@ function facebook_content(&$a) { $o .= '
' . t('If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations.') . '
'; + + $blocked_apps = get_pconfig(local_user(),'facebook','blocked_apps'); + + $o .= ''; + $o .= ''; + $o .= ''; } @@ -864,6 +872,8 @@ function fb_consume_stream($uid,$j,$wall = false) { intval($uid) ); + $blocked_apps = get_pconfig($uid,'facebook','blocked_apps'); + $blocked_apps_arr = explode(',',$blocked_apps); $self_id = get_pconfig($uid,'facebook','self_id'); if(! count($j->data) || (! strlen($self_id))) @@ -922,6 +932,27 @@ function fb_consume_stream($uid,$j,$wall = false) { $datarray['app'] = strip_tags($entry->application->name); else $datarray['app'] = 'facebook'; + + $found_blocked = false; + + if(count($blocked_apps_arr)) { + foreach($blocked_apps_arr as $bad_appl) { + if(! strlen(trim($bad_appl))) { + continue; + } + + if(stristr($datarray['app'],$bad_appl)) { + $found_blocked = true; + break; + } + } + } + + if($found_blocked) { + logger('facebook: blocking application: ' . $datarray['app']); + continue; + } + $datarray['author-name'] = $from->name; $datarray['author-link'] = 'http://facebook.com/profile.php?id=' . $from->id; $datarray['author-avatar'] = 'https://graph.facebook.com/' . $from->id . '/picture';