You are here

function fbconnect_test_fb_session_submit in Facebook Connect 6.2

Same name and namespace in other branches
  1. 8.2 tests/fbconnect_test.module \fbconnect_test_fb_session_submit()
  2. 7.2 tests/fbconnect_test.module \fbconnect_test_fb_session_submit()

@todo.

File

tests/fbconnect_test.module, line 53
@todo.

Code

function fbconnect_test_fb_session_submit($form, &$form_state) {
  $session = array(
    'uid' => $form_state['values']['fbuid'],
    'access_token' => $form_state['values']['access_token'],
    'expires' => time() + 3600,
  );
  ksort($session);

  // Generate the base string.
  $base_string = '';
  foreach ($session as $key => $value) {
    $base_string .= $key . '=' . $value;
  }
  $base_string .= fbconnect_facebook_client()
    ->getApiSecret();
  $session['sig'] = md5($base_string);
  if (!fbconnect_facebook_client()
    ->setSession($session)
    ->getSession()) {
    drupal_set_message('bad session', 'error');
  }
}