session_api_test.module

Helper module for Session API tests.

Functions

Namesort descending Description
session_api_test_init Implementation of hook_init().
session_api_test_menu Implementation of hook_menu().
session_api_test_page Page callback.

File

tests/session_api_test.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * Helper module for Session API tests.
  5. */
  6. /**
  7. * Implementation of hook_menu().
  8. */
  9. function session_api_test_menu() {
  10. $items['session-api-test'] = array(
  11. 'page callback' => 'session_api_test_page',
  12. 'access arguments' => array('access content'),
  13. 'title' => 'Session API test module page',
  14. 'type' => MENU_CALLBACK,
  15. );
  16. return $items;
  17. }
  18. /**
  19. * Implementation of hook_init().
  20. */
  21. function session_api_test_init() {
  22. $sid = session_api_get_sid();
  23. header('X-Session-Api-Sid: ' . $sid);
  24. $session_id = db_query("SELECT session_id FROM {session_api} WHERE sid = :sid", array(':sid' => $sid))->fetchField();
  25. header('X-Session-Api-Session-Id: ' . $session_id);
  26. }
  27. /**
  28. * Page callback.
  29. */
  30. function session_api_test_page() {
  31. return t('Session API Test module enabled.');
  32. }