You are here

function session_limit_menu in Session Limit 5

Same name and namespace in other branches
  1. 6.2 session_limit.module \session_limit_menu()
  2. 6 session_limit.module \session_limit_menu()
  3. 7.2 session_limit.module \session_limit_menu()

Implementation of hook_menu(). Redirect user if over session limit.

File

./session_limit.module, line 88
Established Sessions do NOT need to verify every page load. new Session must deal w/ determining which connection is cut.

Code

function session_limit_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'session/limit',
      'title' => t('Session Limit Exceeded'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'session_limit_page',
      ),
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
    if ($user->uid) {
      $items[] = array(
        'path' => 'mysessions',
        'title' => t('My sessions'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'session_limit_page',
        ),
        'access' => TRUE,
        'type' => MENU_SUGGESTED_ITEM,
      );
    }
    $items[] = array(
      'path' => 'admin/settings/session_limit',
      'title' => t('Session Limit'),
      'description' => t('Configure session limits.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'session_limit_settings',
      ),
    );
  }
  return $items;
}