From 519edd184b17d905c1c6b89dd5cc565b9c22d715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Sun, 18 Mar 2012 10:59:01 +0000 Subject: [PATCH] Delete the app_access_token once the addon is uninstalled. And some more error handling --- facebook/facebook.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/facebook/facebook.php b/facebook/facebook.php index 4524a486..a0fa3936 100755 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -75,6 +75,7 @@ function facebook_uninstall() { unregister_hook('plugin_settings', 'addon/facebook/facebook.php', 'facebook_plugin_settings'); if (get_config('facebook', 'realtime_active') == 1) facebook_subscription_del_users(); + del_config('facebook', 'app_access_token'); } @@ -150,8 +151,12 @@ function facebook_init(&$a) { $s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token); if($s) { $j = json_decode($s); - logger('facebook_init: wall: ' . print_r($j,true), LOGGER_DATA); - fb_consume_stream($uid,$j,($private_wall) ? false : true); + if (isset($j->data)) { + logger('facebook_init: wall: ' . print_r($j,true), LOGGER_DATA); + fb_consume_stream($uid,$j,($private_wall) ? false : true); + } else { + logger('facebook_init: wall: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL); + } } } @@ -1018,15 +1023,23 @@ function fb_consume_all($uid) { $s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token); if($s) { $j = json_decode($s); - logger('fb_consume_stream: wall: ' . print_r($j,true), LOGGER_DATA); - fb_consume_stream($uid,$j,($private_wall) ? false : true); + if (isset($j->data)) { + logger('fb_consume_stream: wall: ' . print_r($j,true), LOGGER_DATA); + fb_consume_stream($uid,$j,($private_wall) ? false : true); + } else { + logger('fb_consume_stream: wall: got no data from Facebook: ' . print_r($j,true), LOGGER_NORMAL); + } } } $s = fetch_url('https://graph.facebook.com/me/home?access_token=' . $access_token); if($s) { $j = json_decode($s); - logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA); - fb_consume_stream($uid,$j,false); + 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); + } } }