You are here

function fb_app_event_cb in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 5.2 fb_app.module \fb_app_event_cb()
  2. 6.3 fb_app.module \fb_app_event_cb()
  3. 7.3 fb_app.module \fb_app_event_cb()

Callback for FB_APP_PATH_EVENT.

We don't act on the events directly. We pass the information along via hook_fb. Other modules are thus notified of the event and can take action.

1 string reference to 'fb_app_event_cb'
fb_app_menu in ./fb_app.module
Implementation of hook_menu().

File

./fb_app.module, line 163
Implementation of Drupal for Facebook application.

Code

function fb_app_event_cb($event_type) {

  // Events are passed 'fb_sig' params, so globals should be set.
  global $_fb, $_fb_app;
  if (!$_fb_app) {
    drupal_not_found();
    return;
  }
  watchdog('fb_app_event_cb', print_r($_REQUEST, 1));

  // debug
  watchdog('fb_app_event_cb', 'session id is ' . session_id());
  fb_invoke(FB_APP_OP_EVENT, array(
    'event_type' => $event_type,
    'fb_app' => $_fb_app,
    'fb' => $_fb,
  ), NULL);

  // This page is called by facebook, not a user's browser.  User's should never see this.
  print 'Thanks Facebook, for your fancy API!';

  // It's facebook calling us, not the user.  And fb_sig params make it look
  // like a canvas page, but it could be connect.  So bad idea to save session.
  session_save_session(FALSE);
  exit;
}