You are here

function admin_landing_page_access in Admin 6

Same name and namespace in other branches
  1. 6.2 admin.module \admin_landing_page_access()
  2. 7.2 admin.module \admin_landing_page_access()

Menu access callback for admin landing pages.

1 string reference to 'admin_landing_page_access'
admin_menu_alter in ./admin.module
Implementation of hook_menu_alter().

File

./admin.module, line 50

Code

function admin_landing_page_access($path) {
  static $paths;
  if (!isset($paths)) {
    $cache = cache_get('admin_paths');
    $paths = $cache && !empty($cache->data) ? $cache->data : array();
  }
  if (!isset($paths[$path])) {
    $item = db_fetch_array(db_query("SELECT mlid, menu_name FROM {menu_links} ml WHERE ml.router_path = '%s' AND module = 'system'", $path));
    $result = db_query("\n      SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.*\n      FROM {menu_links} ml\n      LEFT JOIN {menu_router} m ON ml.router_path = m.path\n      WHERE ml.plid = %d AND ml.menu_name = '%s' AND hidden = 0", $item['mlid'], $item['menu_name']);
    $paths[$path] = FALSE;
    while ($item = db_fetch_array($result)) {
      $item['options'] = unserialize($item['options']);
      if ($item['external']) {
        if (!empty($item['options']['alter'])) {
          drupal_alter('translated_menu_link', $item, $map);
        }
        if ($item['access']) {
          $paths[$path] = TRUE;
          break;
        }
      }
      else {
        $map = explode('/', $item['link_path']);
        _menu_link_map_translate($map, $item['to_arg_functions']);
        $item['href'] = implode('/', $map);
        if (strpos($item['href'], '%') !== FALSE) {
          continue;
        }
        if (!isset($item['access'])) {
          if (!_menu_load_objects($item, $map)) {
            continue;
          }
          _menu_check_access($item, $map);
        }
        if (!$item['access']) {
          continue;
        }
        $paths[$path] = TRUE;
        break;
      }
    }
    cache_set('admin_paths', $paths);
  }
  return $paths[$path];
}