You are here

function autosave_popup_access in Autosave 7.2

Menu access callback.

Mostly autosave_save_access().

1 string reference to 'autosave_popup_access'
autosave_menu in ./autosave.module
Implements hook_menu().

File

./autosave.theme.inc, line 81

Code

function autosave_popup_access() {
  $form_id = str_replace('-', '_', $_POST['form_id']);
  $token = isset($_POST['form_token'], $form_id) && drupal_valid_token($_POST['form_token'], $form_id);

  // If we are just about to show the Form autosaved popup, it's
  // enough to verify the form token. We don't know the form path anyway.
  if ($_GET['q'] == 'autosave/popup/autosave_saved_popup') {
    return $token;
  }
  $_POST['autosave_form_path'] = $_POST['q'];
  $path = $_POST['q'];
  $menu_item = autosave_menu_get_item($path);
  $menu = isset($menu_item['access']) ? $menu_item['access'] : FALSE;
  return $token && $menu;
}