function _fb_settings_honor_signed_request in Drupal for Facebook 6.3
Same name and namespace in other branches
- 7.3 fb_settings.inc \_fb_settings_honor_signed_request()
Get the fb_settings from a parsed signed request. http://developers.facebook.com/docs/authentication/canvas signed request will be found on canvas pages, and some connect pages and ajax callbacks.
1 call to _fb_settings_honor_signed_request()
- fb_settings.inc in ./
fb_settings.inc - This file is to be included from your sites/.../settings.php file.
File
- ./
fb_settings.inc, line 90 - This file is to be included from your sites/.../settings.php file.
Code
function _fb_settings_honor_signed_request($sr) {
if (isset($sr['page'])) {
// Iframe page tab.
fb_settings(FB_SETTINGS_CB_PAGE, $sr['page']['id']);
fb_settings(FB_SETTINGS_PAGE_ID, $sr['page']['id']);
fb_settings(FB_SETTINGS_TYPE, FB_SETTINGS_TYPE_PAGE_TAB);
if (isset($sr['user_id'])) {
fb_settings(FB_SETTINGS_FBU, $sr['user_id']);
}
}
if (isset($sr['profile_id'])) {
// Only on old FBML tabs. Deprecated now that iframe tabs are preferred.
fb_settings(FB_SETTINGS_CB_PAGE, $sr['profile_id']);
fb_settings(FB_SETTINGS_CB_PAGE, $sr['profile_id']);
fb_settings(FB_SETTINGS_TYPE, FB_SETTINGS_TYPE_PROFILE);
if ($sr['user_id'] != $sr['profile_id']) {
fb_settings(FB_SETTINGS_FBU, $sr['user_id']);
}
}
elseif (isset($sr['user_id'])) {
fb_settings(FB_SETTINGS_FBU, $sr['user_id']);
}
if (isset($sr['oauth_token'])) {
fb_settings(FB_SETTINGS_TOKEN, $sr['oauth_token']);
if (!fb_settings(FB_SETTINGS_ID)) {
// Prefer app id learned from url rewriting over that learned from signed request (because sr may be encrypted).
$tokens = explode('|', $sr['oauth_token']);
if (($app_id = $tokens[0]) && !empty($tokens[1])) {
fb_settings(FB_SETTINGS_ID, $app_id);
}
}
}
}