=== modified file 'includes/menu.inc' --- includes/menu.inc 2007-03-08 19:03:48 +0000 +++ includes/menu.inc 2007-03-09 04:07:58 +0000 @@ -76,13 +76,12 @@ define('MENU_IS_ROOT', 0x0001); define('MENU_VISIBLE_IN_TREE', 0x0002); define('MENU_VISIBLE_IN_BREADCRUMB', 0x0004); -define('MENU_VISIBLE_IF_HAS_CHILDREN', 0x0008); +define('MENU_MODIFIED_BY_ADMIN', 0x0008); define('MENU_MODIFIABLE_BY_ADMIN', 0x0010); -define('MENU_MODIFIED_BY_ADMIN', 0x0020); -define('MENU_CREATED_BY_ADMIN', 0x0040); -define('MENU_IS_LOCAL_TASK', 0x0080); -define('MENU_EXPANDED', 0x0100); -define('MENU_LINKS_TO_PARENT', 0x0200); +define('MENU_CREATED_BY_ADMIN', 0x0020); +define('MENU_IS_LOCAL_TASK', 0x0040); +define('MENU_EXPANDED', 0x0080); +define('MENU_LINKS_TO_PARENT', 0x00100); /** * @} End of "Menu flags". @@ -103,25 +102,12 @@ define('MENU_LINKS_TO_PARENT', 0x0200); define('MENU_NORMAL_ITEM', MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB | MENU_MODIFIABLE_BY_ADMIN); /** - * Item groupings are used for pages like "node/add" that simply list - * subpages to visit. They are distinguished from other pages in that they will - * disappear from the menu if no subpages exist. - */ -define('MENU_ITEM_GROUPING', MENU_VISIBLE_IF_HAS_CHILDREN | MENU_VISIBLE_IN_BREADCRUMB | MENU_MODIFIABLE_BY_ADMIN); - -/** * Callbacks simply register a path so that the correct function is fired * when the URL is accessed. They are not shown in the menu. */ define('MENU_CALLBACK', MENU_VISIBLE_IN_BREADCRUMB); /** - * Dynamic menu items change frequently, and so should not be stored in the - * database for administrative customization. - */ -define('MENU_DYNAMIC_ITEM', MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB); - -/** * Modules may "suggest" menu items that the administrator may enable. They act * just as callbacks do until enabled, at which time they act like normal items. */ @@ -418,7 +404,6 @@ function _menu_translate($item, $map, $o * Returns a rendered menu tree. */ function menu_tree() { - global $user; if ($item = menu_get_item()) { list(, $menu) = _menu_tree(db_query('SELECT * FROM {menu} WHERE pid IN ('. $item->parents .') AND visible = 1 ORDER BY mleft')); return $menu; @@ -451,7 +436,7 @@ function _menu_tree($result = NULL, $dep $remnant = array('link' => '', 'has_children' => FALSE); } elseif ($item->depth == $depth) { - if ($link['link'] && !($old_type & MENU_VISIBLE_IF_HAS_CHILDREN)) { + if ($link['link']) { $tree .= theme('menu_link', $link); } $link = $menu_link; @@ -461,7 +446,6 @@ function _menu_tree($result = NULL, $dep $remnant = $menu_link; break; } - $old_type = $item->type; } if ($link['link']) { $tree .= theme('menu_link', $link); @@ -478,7 +462,7 @@ function theme_menu_tree($link, $tree) { } /** - * Generate the HTML for a menu link. + * Generate the HTML for a menu link optionally with a submenu. */ function theme_menu_link($link, $menu = '') { return '
  • '. $link['link'] . $menu .'
  • ' . "\n"; === modified file 'modules/aggregator/aggregator.module' --- modules/aggregator/aggregator.module 2007-02-27 12:29:22 +0000 +++ modules/aggregator/aggregator.module 2007-03-09 09:53:17 +0000 @@ -91,8 +91,7 @@ function aggregator_menu() { $items['aggregator/categories'] = array( 'title' => t('Categories'), 'page callback' => 'aggregator_page_categories', - 'access arguments' => array('access news feeds'), - 'type' => MENU_ITEM_GROUPING, + 'access callback' => '_aggregator_has_categories', ); $items['aggregator/rss'] = array( 'title' => t('RSS feed'), @@ -112,6 +111,7 @@ function aggregator_menu() { $items[$path] = array( 'title' => $category['title'], 'page callback' => 'aggregator_page_category', + 'access callback' => 'user_access', 'access arguments' => array('access news feeds'), ); $items[$path .'/view'] = array( @@ -181,6 +181,10 @@ function aggregator_init() { drupal_add_css(drupal_get_path('module', 'aggregator') .'/aggregator.css'); } +function _aggregator_has_categories() { + return user_access('access news feeds') && db_num_rows(db_query_range('SELECT 1 FROM {aggregator_category}', 0, 1)); +} + function aggregator_admin_settings() { $items = array(0 => t('none')) + drupal_map_assoc(array(3, 5, 10, 15, 20, 25), '_aggregator_items'); $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'); === modified file 'modules/node/node.module' --- modules/node/node.module 2007-03-07 13:09:32 +0000 +++ modules/node/node.module 2007-03-09 04:06:58 +0000 @@ -1132,8 +1132,7 @@ function node_menu() { $items['node/add'] = array( 'title' => t('Create content'), 'page callback' => 'node_add', - 'access callback' => 'user_access', - 'access arguments' => array('access content'), + 'access callback' => '_node_add_access', 'weight' => 1, ); $items['rss.xml'] = array( @@ -2090,6 +2089,16 @@ function theme_node_form($form) { return $output; } +function _node_add_access() { + $types = node_get_types(); + foreach ($types as $type) { + if (function_exists($type->module .'_form') && node_access('create', $type->type)) { + return TRUE; + } + } + return FALSE; +} + /** * Present a node submission form or a set of links to such forms. */