summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Cohen2011-02-23 18:24:45 (GMT)
committer Dave Cohen2011-02-23 18:24:45 (GMT)
commit816185991b857c19327101dcf9511ac12f85dc96 (patch)
tree5ba5567fe2a100acf96ad3dab7c58eb837668606
parent5c14b8cdb0b367523fcc8723bfd6cf7e5ae4ea77 (diff)
#1066486 by Dave Cohen, Agileware: pass token to fql query.
#1066068 by Dave Cohen: fatal error on viewing user profile.
-rw-r--r--fb.module9
1 files changed, 6 insertions, 3 deletions
diff --git a/fb.module b/fb.module
index 18f49cf..096fe59 100644
--- a/fb.module
+++ b/fb.module
@@ -403,8 +403,7 @@ function fb_vars() {
/**
* Helper to get the tokens needed to accss facebook's API.
*
- * Since facebook's php sdk is a joke, we have to implement the most basic
- * crap, like this.
+ * You would think that facebook's SDK would provide basic functions like this.
*
* @param $fb
* Get the token for this API instance. If NULL, use the global $_fb.
@@ -419,6 +418,8 @@ function fb_get_token($fb = NULL, $fbu = NULL) {
if (!$fb)
$fb = $GLOBALS['_fb'];
+ if (!$fb)
+ return;
$apikey = $fb->getAppId();
$cache_key = $apikey;
@@ -456,6 +457,8 @@ function fb_access_token($fb = NULL) { // deprecated XXX use fb_get_token()
static $cache;
if (!isset($fb))
$fb = $GLOBALS['_fb'];
+ if (!$fb)
+ return;
$apikey = $fb->getAppId();
@@ -1293,7 +1296,7 @@ function fb_users_getInfo($oids, $fb = NULL, $refresh_cache = FALSE) {
'uid',
);
try {
- $infos = fb_fql_query($fb, 'SELECT ' . implode(', ', $fields) . ' FROM user WHERE uid in(' . implode(', ', $oids) . ')');
+ $infos = fb_fql_query($fb, 'SELECT ' . implode(', ', $fields) . ' FROM user WHERE uid in(' . implode(', ', $oids) . ')', array(fb_get_token($fb)));
// Update cache with recent results.
if (is_array($infos)) {
foreach ($infos as $info) {