Commit 5c7983c4 authored by Dries's avatar Dries

- Patch #8179 by JonBob: reintroduced menu caching.

parent 6f0fd3aa
......@@ -5,7 +5,7 @@
* @file
* Functions that need to be loaded on every Drupal request.
*/
define('CACHE_PERMANENT', 0);
define('CACHE_TEMPORARY', -1);
......
This diff is collapsed.
......@@ -21,12 +21,14 @@ function admin_help($section) {
/**
* Implementation of hook_menu().
*/
function admin_menu() {
function admin_menu($may_cache) {
$items = array();
$items[] = array('path' => 'admin', 'title' => t('administer'),
'access' => user_access('access administration pages'),
'callback' => 'admin_main_page',
'weight' => 9);
if ($may_cache) {
$items[] = array('path' => 'admin', 'title' => t('administer'),
'access' => user_access('access administration pages'),
'callback' => 'admin_main_page',
'weight' => 9);
}
return $items;
}
......
......@@ -119,53 +119,49 @@ function aggregator_link($type) {
/**
* Implementation of hook_menu().
*/
function aggregator_menu() {
function aggregator_menu($may_cache) {
$items = array();
$edit = user_access('administer news feeds');
$view = user_access('access news feeds');
$items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'),
'callback' => 'aggregator_admin_overview', 'access' => $edit);
$items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/edit/category', 'title' => t('edit category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/remove', 'title' => t('remove items'),
'callback' => 'aggregator_admin_remove_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/update', 'title' => t('update items'),
'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/add/category', 'title' => t('add category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/configure', 'title' => t('configure'),
'callback' => 'aggregator_configure', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'aggregator', 'title' => t('news aggregator'),
'callback' => 'aggregator_page_last', 'access' => $view,
'weight' => 5);
$items[] = array('path' => 'aggregator/sources', 'title' => t('sources'),
'callback' => 'aggregator_page_sources', 'access' => $view);
$items[] = array('path' => 'aggregator/categories', 'title' => t('categories'),
'callback' => 'aggregator_page_categories', 'access' => $view,
'type' => MENU_ITEM_GROUPING);
// To reduce the number of SQL queries, we don't query the database when
// not on an aggregator page.
// If caching of the menu is implemented, this check should be removed
// so that DHTML menu presentation can be used correctly.
if (arg(0) == 'aggregator') {
if ($may_cache) {
$edit = user_access('administer news feeds');
$view = user_access('access news feeds');
$items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'),
'callback' => 'aggregator_admin_overview', 'access' => $edit);
$items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/edit/category', 'title' => t('edit category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/remove', 'title' => t('remove items'),
'callback' => 'aggregator_admin_remove_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/update', 'title' => t('update items'),
'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/add/category', 'title' => t('add category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/configure', 'title' => t('configure'),
'callback' => 'aggregator_configure', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'aggregator', 'title' => t('news aggregator'),
'callback' => 'aggregator_page_last', 'access' => $view,
'weight' => 5);
$items[] = array('path' => 'aggregator/sources', 'title' => t('sources'),
'callback' => 'aggregator_page_sources', 'access' => $view);
$items[] = array('path' => 'aggregator/categories', 'title' => t('categories'),
'callback' => 'aggregator_page_categories', 'access' => $view,
'type' => MENU_ITEM_GROUPING);
// Sources:
$result = db_query('SELECT title, fid FROM {aggregator_feed} ORDER BY title');
while ($feed = db_fetch_object($result)) {
......@@ -197,11 +193,11 @@ function aggregator_menu() {
'type' => MENU_LOCAL_TASK,
'weight' => 1);
}
}
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
}
return $items;
}
......
......@@ -119,53 +119,49 @@ function aggregator_link($type) {
/**
* Implementation of hook_menu().
*/
function aggregator_menu() {
function aggregator_menu($may_cache) {
$items = array();
$edit = user_access('administer news feeds');
$view = user_access('access news feeds');
$items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'),
'callback' => 'aggregator_admin_overview', 'access' => $edit);
$items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/edit/category', 'title' => t('edit category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/remove', 'title' => t('remove items'),
'callback' => 'aggregator_admin_remove_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/update', 'title' => t('update items'),
'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/add/category', 'title' => t('add category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/configure', 'title' => t('configure'),
'callback' => 'aggregator_configure', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'aggregator', 'title' => t('news aggregator'),
'callback' => 'aggregator_page_last', 'access' => $view,
'weight' => 5);
$items[] = array('path' => 'aggregator/sources', 'title' => t('sources'),
'callback' => 'aggregator_page_sources', 'access' => $view);
$items[] = array('path' => 'aggregator/categories', 'title' => t('categories'),
'callback' => 'aggregator_page_categories', 'access' => $view,
'type' => MENU_ITEM_GROUPING);
// To reduce the number of SQL queries, we don't query the database when
// not on an aggregator page.
// If caching of the menu is implemented, this check should be removed
// so that DHTML menu presentation can be used correctly.
if (arg(0) == 'aggregator') {
if ($may_cache) {
$edit = user_access('administer news feeds');
$view = user_access('access news feeds');
$items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'),
'callback' => 'aggregator_admin_overview', 'access' => $edit);
$items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/edit/category', 'title' => t('edit category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/remove', 'title' => t('remove items'),
'callback' => 'aggregator_admin_remove_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/update', 'title' => t('update items'),
'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/add/category', 'title' => t('add category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/configure', 'title' => t('configure'),
'callback' => 'aggregator_configure', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'aggregator', 'title' => t('news aggregator'),
'callback' => 'aggregator_page_last', 'access' => $view,
'weight' => 5);
$items[] = array('path' => 'aggregator/sources', 'title' => t('sources'),
'callback' => 'aggregator_page_sources', 'access' => $view);
$items[] = array('path' => 'aggregator/categories', 'title' => t('categories'),
'callback' => 'aggregator_page_categories', 'access' => $view,
'type' => MENU_ITEM_GROUPING);
// Sources:
$result = db_query('SELECT title, fid FROM {aggregator_feed} ORDER BY title');
while ($feed = db_fetch_object($result)) {
......@@ -197,11 +193,11 @@ function aggregator_menu() {
'type' => MENU_LOCAL_TASK,
'weight' => 1);
}
}
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
}
return $items;
}
......
......@@ -207,12 +207,15 @@ function archive_link($type) {
/**
* Implementation of hook_menu().
*/
function archive_menu() {
function archive_menu($may_cache) {
$items = array();
$items[] = array('path' => 'archive', 'title' => t('archives'),
'access' => user_access('access content'),
'callback' => 'archive_page',
'type' => MENU_SUGGESTED_ITEM);
if ($may_cache) {
$items[] = array('path' => 'archive', 'title' => t('archives'),
'access' => user_access('access content'),
'callback' => 'archive_page',
'type' => MENU_SUGGESTED_ITEM);
}
return $items;
}
......
......@@ -207,12 +207,15 @@ function archive_link($type) {
/**
* Implementation of hook_menu().
*/
function archive_menu() {
function archive_menu($may_cache) {
$items = array();
$items[] = array('path' => 'archive', 'title' => t('archives'),
'access' => user_access('access content'),
'callback' => 'archive_page',
'type' => MENU_SUGGESTED_ITEM);
if ($may_cache) {
$items[] = array('path' => 'archive', 'title' => t('archives'),
'access' => user_access('access content'),
'callback' => 'archive_page',
'type' => MENU_SUGGESTED_ITEM);
}
return $items;
}
......
......@@ -48,26 +48,29 @@ function block_perm() {
/**
* Implementation of hook_menu().
*/
function block_menu() {
function block_menu($may_cache) {
$items = array();
$items[] = array('path' => 'admin/block', 'title' => t('blocks'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin');
$items[] = array('path' => 'admin/block/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/block/edit', 'title' => t('edit block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/block/delete', 'title' => t('delete block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_delete',
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/block/add', 'title' => t('add'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_LOCAL_TASK);
if ($may_cache) {
$items[] = array('path' => 'admin/block', 'title' => t('blocks'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin');
$items[] = array('path' => 'admin/block/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/block/edit', 'title' => t('edit block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/block/delete', 'title' => t('delete block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_delete',
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/block/add', 'title' => t('add'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_LOCAL_TASK);
}
return $items;
}
......
......@@ -48,26 +48,29 @@ function block_perm() {
/**
* Implementation of hook_menu().
*/
function block_menu() {
function block_menu($may_cache) {
$items = array();
$items[] = array('path' => 'admin/block', 'title' => t('blocks'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin');
$items[] = array('path' => 'admin/block/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/block/edit', 'title' => t('edit block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/block/delete', 'title' => t('delete block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_delete',
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/block/add', 'title' => t('add'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_LOCAL_TASK);
if ($may_cache) {
$items[] = array('path' => 'admin/block', 'title' => t('blocks'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin');
$items[] = array('path' => 'admin/block/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/block/edit', 'title' => t('edit block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/block/delete', 'title' => t('delete block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_delete',
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/block/add', 'title' => t('add'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_LOCAL_TASK);
}
return $items;
}
......
......@@ -259,23 +259,26 @@ function blog_link($type, $node = 0, $main) {
/**
* Implementation of hook_menu().
*/
function blog_menu() {
function blog_menu($may_cache) {
global $user;
$items = array();
$items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
'access' => user_access('edit own blog'));
$items[] = array('path' => 'blog', 'title' => t('blogs'),
'callback' => 'blog_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'blog/'. $user->uid, 'title' => t('my blog'),
'access' => user_access('edit own blog'),
'type' => MENU_DYNAMIC_ITEM);
$items[] = array('path' => 'blog/feed', 'title' => t('RSS feed'),
'callback' => 'blog_feed',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
if ($may_cache) {
$items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
'access' => user_access('edit own blog'));
$items[] = array('path' => 'blog', 'title' => t('blogs'),
'callback' => 'blog_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'blog/feed', 'title' => t('RSS feed'),
'callback' => 'blog_feed',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'blog/'. $user->uid, 'title' => t('my blog'),
'access' => user_access('edit own blog'),
'type' => MENU_DYNAMIC_ITEM);
}
return $items;
}
......
......@@ -259,23 +259,26 @@ function blog_link($type, $node = 0, $main) {
/**
* Implementation of hook_menu().
*/
function blog_menu() {
function blog_menu($may_cache) {
global $user;
$items = array();
$items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
'access' => user_access('edit own blog'));
$items[] = array('path' => 'blog', 'title' => t('blogs'),
'callback' => 'blog_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'blog/'. $user->uid, 'title' => t('my blog'),
'access' => user_access('edit own blog'),
'type' => MENU_DYNAMIC_ITEM);
$items[] = array('path' => 'blog/feed', 'title' => t('RSS feed'),
'callback' => 'blog_feed',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
if ($may_cache) {
$items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
'access' => user_access('edit own blog'));
$items[] = array('path' => 'blog', 'title' => t('blogs'),
'callback' => 'blog_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'blog/feed', 'title' => t('RSS feed'),
'callback' => 'blog_feed',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'blog/'. $user->uid, 'title' => t('my blog'),
'access' => user_access('edit own blog'),
'type' => MENU_DYNAMIC_ITEM);
}
return $items;
}
......
......@@ -512,15 +512,16 @@ function blogapi_settings() {
return $output;
}
function blogapi_menu() {
global $user;
function blogapi_menu($may_cache) {
$items = array();
if ($_GET['q'] == variable_get('site_frontpage', 'node')) {
drupal_set_html_head('<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . url('blogapi/rsd', NULL, NULL, TRUE) . '" />');
}
$items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access_content'), 'type' => MENU_CALLBACK);
if ($may_cache) {
$items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access_content'), 'type' => MENU_CALLBACK);
}
return $items;
}
......
......@@ -512,15 +512,16 @@ function blogapi_settings() {
return $output;
}
function blogapi_menu() {
global $user;
function blogapi_menu($may_cache) {
$items = array();
if ($_GET['q'] == variable_get('site_frontpage', 'node')) {
drupal_set_html_head('<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . url('blogapi/rsd', NULL, NULL, TRUE) . '" />');
}
$items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access_content'), 'type' => MENU_CALLBACK);
if ($may_cache) {
$items[] = array('path' => 'blogapi', 'title' => t('RSD'), 'callback' => 'blogapi_blogapi', 'access' => user_access('access_content'), 'type' => MENU_CALLBACK);
}
return $items;
}
......
......@@ -76,31 +76,33 @@ function book_link($type, $node = 0, $main = 0) {
/**
* Implementation of hook_menu().
*/
function book_menu() {
function book_menu($may_cache) {
$items = array();
$items[] = array('path' => 'node/add/book', 'title' => t('book page'),
'access' => user_access('maintain books'));
$items[] = array('path' => 'admin/node/book', 'title' => t('books'),
'callback' => 'book_admin',
'access' => user_access('administer nodes'),
'weight' => 4);
$items[] = array('path' => 'admin/node/book/orphan', 'title' => t('orphan pages'),
'callback' => 'book_admin_orphan',
'access' => user_access('administer nodes'),
'weight' => 8);
$result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title');
while ($book = db_fetch_object($result)) {
$items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title)));
}
$items[] = array('path' => 'book', 'title' => t('books'),
'callback' => 'book_render',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'book/print', 'title' => t('printer-friendly version'),
'callback' => 'book_print',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
if ($may_cache) {
$items[] = array('path' => 'node/add/book', 'title' => t('book page'),
'access' => user_access('maintain books'));
$items[] = array('path' => 'admin/node/book', 'title' => t('books'),
'callback' => 'book_admin',
'access' => user_access('administer nodes'),
'weight' => 4);
$items[] = array('path' => 'admin/node/book/orphan', 'title' => t('orphan pages'),
'callback' => 'book_admin_orphan',
'access' => user_access('administer nodes'),
'weight' => 8);
$result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title');
while ($book = db_fetch_object($result)) {
$items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title)));
}
$items[] = array('path' => 'book', 'title' => t('books'),
'callback' => 'book_render',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'book/print', 'title' => t('printer-friendly version'),
'callback' => 'book_print',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
}
return $items;
}
......
......@@ -76,31 +76,33 @@ function book_link($type, $node = 0, $main = 0) {
/**
* Implementation of hook_menu().
*/
function book_menu() {
function book_menu($may_cache) {
$items = array();
$items[] = array('path' => 'node/add/book', 'title' => t('book page'),
'access' => user_access('maintain books'));
$items[] = array('path' => 'admin/node/book', 'title' => t('books'),
'callback' => 'book_admin',
'access' => user_access('administer nodes'),
'weight' => 4);
$items[] = array('path' => 'admin/node/book/orphan', 'title' => t('orphan pages'),
'callback' => 'book_admin_orphan',
'access' => user_access('administer nodes'),
'weight' => 8);
$result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title');
while ($book = db_fetch_object($result)) {
$items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title)));
}
$items[] = array('path' => 'book', 'title' => t('books'),
'callback' => 'book_render',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'book/print', 'title' => t('printer-friendly version'),
'callback' => 'book_print',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
if ($may_cache) {
$items[] = array('path' => 'node/add/book', 'title' => t('book page'),
'access' => user_access('maintain books'));
$items[] = array('path' => 'admin/node/book', 'title' => t('books'),
'callback' => 'book_admin',
'access' => user_access('administer nodes'),
'weight' => 4);
$items[] = array('path' => 'admin/node/book/orphan', 'title' => t('orphan pages'),
'callback' => 'book_admin_orphan',
'access' => user_access('administer nodes'),
'weight' => 8);
$result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title');
while ($book = db_fetch_object($result)) {
$items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title)));
}
$items[] = array('path' => 'book', 'title' => t('books'),
'callback' => 'book_render',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'book/print', 'title' => t('printer-friendly version'),
'callback' => 'book_print',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
}
return $items;
}
......
......@@ -84,56 +84,58 @@ function comment_help($section = "admin/help#comment") {
/**
* Implementation of hook_menu().
*/
function comment_menu() {
function comment_menu($may_cache) {
$items = array();
$access = user_access('administer comments');
$items[] = array('path' => 'admin/comment', 'title' => t('comments'),
'callback' => 'comment_admin_overview', 'access' => $access);
$items[] = array('path' => 'admin/comment/edit', 'title' => t('edit comment'),
'callback' => 'comment_admin_edit', 'access' => $access, 'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/comment/delete', 'title' => t('delete comment'),
'callback' => 'comment_delete', 'access' => $access, 'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/comment/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/comment/configure', 'title' => t('configure'),
'callback' => 'comment_configure', 'access' => $access, 'type' => MENU_LOCAL_TASK);
if (module_exist('search')) {
$items[] = array('path' => 'admin/comment/search', 'title' => t('search'),
'callback' => 'comment_search', 'access' => $access, 'type' => MENU_LOCAL_TASK);
}
// Subtabs:
$items[] = array('path' => 'admin/comment/list/new', 'title' => t('new comments'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/comment/list/approval', 'title' => t('approval queue'),
'callback' => 'comment_admin_overview', 'access' => $access,
'callback arguments' => 'approval',
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/comment/configure/settings', 'title' => t('settings'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$access = user_access('administer comments') && user_access('administer moderation');
$items[] = array('path' => 'admin/comment/configure/matrix', 'title' => t('moderation matrix'),
'callback' => 'comment_matrix_settings', 'access' => $access, 'type' => MENU_LOCAL_TASK);