summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/fb_user_app.module9
-rw-r--r--fb.module10
2 files changed, 15 insertions, 4 deletions
diff --git a/contrib/fb_user_app.module b/contrib/fb_user_app.module
index 6b63168..7766211 100644
--- a/contrib/fb_user_app.module
+++ b/contrib/fb_user_app.module
@@ -81,12 +81,16 @@ function fb_user_app_fb($op, $data, &$return) {
// to provide it, depending on whether the user has logged in, and whether
// the session has expired.
$fbu = $data['fbu'];
- $result = db_query("SELECT * FROM {fb_user_app} WHERE apikey = '%s' and fbu = %d AND session_key_expires > %d", $fb_app->apikey, $fbu, time());
+ $result = db_query("SELECT * FROM {fb_user_app} WHERE apikey = '%s' and fbu = %d", $fb_app->apikey, $fbu);
$data = db_fetch_object($result);
if ($data && $data->session_key)
// Return array with FB id and apikey.
- $return = array($data->fbu, $data->session_key);
+ $return = array(
+ 'fbu' => $data->fbu,
+ 'access_token' => $data->session_key,
+ 'expires' => $data->session_key_expires,
+ );
}
elseif ($op == FB_OP_AJAX_EVENT) { // handle internal login
// @TODO - global user is not correct here.
@@ -134,6 +138,7 @@ function fb_user_app_track_user($fb, $fb_app) {
// test if we are tracking only those apps that have been granted offline
// access.
$fb_session = $fb->getSession();
+
// when 'expires' == 0 app has been granted offline access
if ($fb_user_type == 'user' &&
$fb_session["expires"] <> 0 &&
diff --git a/fb.module b/fb.module
index ae80e57..0138fed 100644
--- a/fb.module
+++ b/fb.module
@@ -1,5 +1,4 @@
<?php
-// $Id: fb.module,v 1.137.2.6 2011/02/23 22:04:37 yogadex Exp $
/**
* @file
@@ -453,7 +452,14 @@ function fb_get_token($fb = NULL, $fbu = NULL) {
$cache[$cache_key] = $session['access_token'];
}
else {
- // @TODO look up another user's access token.
+ $session_data = fb_invoke(FB_OP_GET_USER_SESSION, array(
+ 'fb' => $fb,
+ 'fb_app' => fb_get_app(array('apikey' => $apikey)),
+ 'fbu' => $fbu,
+ ), array());
+ if (count($session_data)) {
+ $cache[$cache_key] = $session_data['access_token'];
+ }
}
}
return isset($cache[$cache_key]) ? $cache[$cache_key] : NULL;