diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/aggregator/aggregator.module | 27 | ||||
-rw-r--r-- | modules/blog/blog.module | 5 | ||||
-rw-r--r-- | modules/book/book.module | 3 | ||||
-rw-r--r-- | modules/comment/comment.module | 5 | ||||
-rw-r--r-- | modules/contact/contact.module | 3 | ||||
-rw-r--r-- | modules/filter/filter.module | 13 | ||||
-rw-r--r-- | modules/forum/forum.module | 16 | ||||
-rw-r--r-- | modules/node/node.module | 13 | ||||
-rw-r--r-- | modules/poll/poll.module | 6 | ||||
-rw-r--r-- | modules/profile/profile.module | 1 | ||||
-rw-r--r-- | modules/search/search.module | 24 | ||||
-rw-r--r-- | modules/statistics/statistics.module | 5 | ||||
-rw-r--r-- | modules/system/system.install | 30 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 32 | ||||
-rw-r--r-- | modules/tracker/tracker.module | 10 | ||||
-rw-r--r-- | modules/user/user.module | 38 |
16 files changed, 123 insertions, 108 deletions
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 6648ff9bd..51fa8ddb8 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -51,19 +51,17 @@ function aggregator_menu() { 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/aggregator', ); - $items['admin/content/aggregator/remove/%'] = array( + $items['admin/content/aggregator/remove/%aggregator_feed'] = array( 'title' => t('Remove items'), 'page callback' => 'aggregator_admin_remove_feed', 'page arguments' => array(4), - 'map arguments' => array('aggregator_get_feed', 4), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, ); - $items['admin/content/aggregator/update/%'] = array( + $items['admin/content/aggregator/update/%aggregator_feed'] = array( 'title' => t('Update items'), 'page callback' => 'aggregator_admin_refresh_feed', 'page arguments' => array(4), - 'map arguments' => array('aggregator_get_feed', 4), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, ); @@ -137,24 +135,23 @@ function aggregator_menu() { 'weight' => 1, ); } - $items['aggregator/sources/%'] = array( + $items['aggregator/sources/%aggregator_feed'] = array( 'page callback' => 'aggregator_page_source', - 'map arguments' => array('aggregator_get_feed', 2), 'type' => MENU_CALLBACK, ); - $items['aggregator/sources/%/view'] = array( + $items['aggregator/sources/%aggregator_feed/view'] = array( 'title' => t('View'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); - $items['aggregator/sources/%/categorize'] = array( + $items['aggregator/sources/%aggregator_feed/categorize'] = array( 'title' => t('Categorize'), 'page callback' => 'drupal_get_form', 'page arguments' => array('aggregator_page_source'), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, ); - $items['aggregator/sources/%/configure'] = array( + $items['aggregator/sources/%aggregator_feed/configure'] = array( 'title' => t('Configure'), 'page callback' => 'drupal_get_form', 'page arguments' => array('aggregator_form_feed', 2), @@ -162,20 +159,18 @@ function aggregator_menu() { 'type' => MENU_LOCAL_TASK, 'weight' => 1, ); - $items['admin/content/aggregator/edit/feed/%'] = array( + $items['admin/content/aggregator/edit/feed/%aggregator_feed'] = array( 'title' => t('Edit feed'), 'page callback' => 'drupal_get_form', 'page arguments' => array('aggregator_form_feed', 5), 'access arguments' => array('administer news feeds'), - 'map arguments' => array('aggregator_get_feed', 5), 'type' => MENU_CALLBACK, ); - $items['admin/content/aggregator/edit/category/%'] = array( + $items['admin/content/aggregator/edit/category/%aggregator_category'] = array( 'title' => t('Edit category'), 'page callback' => 'drupal_get_form', 'page arguments' => array('aggregator_form_category', 5), 'access arguments' => array('administer news feeds'), - 'map arguments' => array('aggregator_get_category', 5), 'type' => MENU_CALLBACK, ); @@ -964,11 +959,11 @@ function aggregator_save_item($edit) { } } -function aggregator_get_feed($fid) { +function aggregator_feed_load($fid) { return db_fetch_array(db_query('SELECT * FROM {aggregator_feed} WHERE fid = %d', $fid)); } -function aggregator_get_category($cid) { +function aggregator_category_load($cid) { return db_fetch_array(db_query('SELECT * FROM {aggregator_category} WHERE cid = %d', $cid)); } @@ -1035,7 +1030,7 @@ function aggregator_page_last() { */ function aggregator_page_source() { $feed = db_fetch_object(db_query('SELECT * FROM {aggregator_feed} WHERE fid = %d', arg(2))); - drupal_set_title($feed->title); + drupal_set_title(check_plain($feed->title)); $info = theme('aggregator_feed', $feed); return _aggregator_page_list('SELECT * FROM {aggregator_item} WHERE fid = '. $feed->fid .' ORDER BY timestamp DESC, iid DESC', arg(3), $info); diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 5b853ddbe..ffdeeedec 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -105,6 +105,9 @@ function blog_feed_last() { * Menu callback; displays a Drupal page containing recent blog entries. */ function blog_page($a = NULL, $b = NULL) { + if (is_object($a)) { + $a = $a->uid; + } if (is_numeric($a)) { // $a is a user ID if ($b == 'feed') { @@ -256,7 +259,7 @@ function blog_menu() { 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, ); - $items['blog/%'] = array( + $items['blog/%user_current'] = array( 'title' => t('My blog'), 'page arguments' => array(1), 'access arguments' => array('edit own blog'), diff --git a/modules/book/book.module b/modules/book/book.module index d1913bc2e..93fb4b96e 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -114,13 +114,12 @@ function book_menu() { 'page arguments' => array(2, 3), 'type' => MENU_CALLBACK, ); - $items['node/%/outline'] = array( + $items['node/%node/outline'] = array( 'title' => t('Outline'), 'page callback' => 'drupal_get_form', 'page arguments' => array('book_outline', 1), 'access callback' => '_book_outline_access', 'access arguments' => array(1), - 'map arguments' => array('node_load', 1), 'type' => MENU_LOCAL_TASK, 'weight' => 2, ); diff --git a/modules/comment/comment.module b/modules/comment/comment.module index f92467c4a..f922d300e 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -195,15 +195,14 @@ function comment_menu() { 'access arguments' => array('post comments'), 'type' => MENU_CALLBACK, ); - $items['comment/reply'] = array( + $items['comment/reply/%node'] = array( 'title' => t('Reply to comment'), 'page callback' => 'comment_reply', 'access callback' => 'node_access', 'access arguments' => array('view', 2), - 'map arguments' => array('node_load', 2), 'type' => MENU_CALLBACK, ); - $items['node/%/%'] = array( + $items['node/%node/%'] = array( 'title' => t('View'), 'page callback' => 'node_page_view', 'page arguments' => array(1, 2), diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 909b90e6f..9fa22df51 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -84,14 +84,13 @@ function contact_menu() { 'access arguments' => array('access site-wide contact form'), 'type' => MENU_SUGGESTED_ITEM, ); - $items['user/%/contact'] = array( + $items['user/%user/contact'] = array( 'title' => t('Contact'), 'page callback' => 'contact_user_page', 'page arguments' => array(1), 'type' => MENU_LOCAL_TASK, 'access callback' => '_contact_user_tab_access', 'access arguments' => array(1), - 'map arguments' => array('user_load', 1), 'weight' => 2, ); return $items; diff --git a/modules/filter/filter.module b/modules/filter/filter.module index 83fa3ba74..ac13a0e98 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -81,26 +81,25 @@ function filter_menu() { 'access callback' => TRUE, 'type' => MENU_SUGGESTED_ITEM, ); - $items['admin/settings/filters/%'] = array( + $items['admin/settings/filters/%filter_format'] = array( 'type' => MENU_CALLBACK, 'page arguments' => array('filter_admin_format_form', 3), 'access arguments' => array('administer filters'), - 'map arguments' => array('filter_formats', 3), ); - $items['admin/settings/filters/%/list'] = array( + $items['admin/settings/filters/%filter_format/list'] = array( 'title' => t('View'), 'page arguments' => array('filter_admin_format_form', 3), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => 0, ); - $items['admin/settings/filters/%/configure'] = array( + $items['admin/settings/filters/%filter_format/configure'] = array( 'title' => t('Configure'), 'page arguments' => array('filter_admin_configure', 3), 'type' => MENU_LOCAL_TASK, 'weight' => 1, ); - $items['admin/settings/filters/%/order'] = array( + $items['admin/settings/filters/%filter_format/order'] = array( 'title' => t('Rearrange'), 'page arguments' => array('filter_admin_order', 3), 'type' => MENU_LOCAL_TASK, @@ -109,6 +108,10 @@ function filter_menu() { return $items; } +function filter_format_load($arg) { + return filter_formats($arg); +} + /** * Implementation of hook_perm(). */ diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 1351306cd..31103456b 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -75,19 +75,21 @@ function forum_menu() { 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/forum', ); - $items['admin/content/forum/edit'] = array( + $items['admin/content/forum/edit/%forum_term'] = array( 'page callback' => 'forum_form_main', - 'map arguments' => array('_forum_get_term', 5, array()), 'type' => MENU_CALLBACK, ); - $items['admin/content/forum/edit/container/%'] = array( + $items['admin/content/forum/edit/container/%forum_term'] = array( 'title' => t('Edit container'), + 'page callback' => 'forum_form_main', 'page arguments' => array('container', 5), + 'type' => MENU_CALLBACK, ); - $items['admin/content/forum/edit/forum/%'] = array( + $items['admin/content/forum/edit/forum/%forum_term'] = array( 'title' => t('Edit forum'), 'page callback' => 'forum_form_main', 'page arguments' => array('forum', 5), + 'type' => MENU_CALLBACK, ); return $items; } @@ -96,7 +98,7 @@ function forum_init() { drupal_add_css(drupal_get_path('module', 'forum') .'/forum.css'); } -function _forum_get_term($tid) { +function forum_term_load($tid) { return (array)taxonomy_get_term($tid); } @@ -295,7 +297,7 @@ function forum_block($op = 'list', $delta = 0, $edit = array()) { */ function forum_view(&$node, $teaser = FALSE, $page = FALSE) { if ($page) { - $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', '')); + $vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', '')); // Breadcrumb navigation $breadcrumb = array(); $breadcrumb[] = array('path' => 'forum', 'title' => $vocabulary->name); @@ -876,7 +878,7 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p global $user; // forum list, topics list, topic browser and 'add new topic' link - $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', '')); + $vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', '')); $title = $vocabulary->name; // Breadcrumb navigation: diff --git a/modules/node/node.module b/modules/node/node.module index 5ea928e46..cc9a3cf6f 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1166,33 +1166,32 @@ function node_menu() { } } - $items['node/%'] = array( + $items['node/%node'] = array( 'title' => t('View'), 'page callback' => 'node_page_view', 'page arguments' => array(1), 'access callback' => 'node_access', 'access arguments' => array('view', 1), - 'map arguments' => array('node_load', 1), 'type' => MENU_CALLBACK); - $items['node/%/view'] = array( + $items['node/%node/view'] = array( 'title' => t('View'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10); - $items['node/%/edit'] = array( + $items['node/%node/edit'] = array( 'title' => t('Edit'), 'page callback' => 'node_page_edit', 'page arguments' => array(1), 'access arguments' => array('update', 1), 'weight' => 1, 'type' => MENU_LOCAL_TASK); - $items['node/%/delete'] = array( + $items['node/%node/delete'] = array( 'title' => t('Delete'), 'page callback' => 'drupal_get_form', 'page arguments' => array('node_delete_confirm', 1), 'access arguments' => array('delete', 1), 'weight' => 1, 'type' => MENU_CALLBACK); - $items['node/%/revisions'] = array( + $items['node/%node/revisions'] = array( 'title' => t('Revisions'), 'page callback' => 'node_revisions', 'access callback' => '_node_revision_access', @@ -2464,7 +2463,7 @@ function node_update_index() { */ function node_form_alter($form_id, &$form) { // Advanced node search form - if ($form_id == 'search_form' && arg(1) == 'node' && user_access('use advanced search')) { + if ($form_id == 'search_form' && $form['module']['#value'] == 'node' && user_access('use advanced search')) { // Keyword boxes: $form['advanced'] = array( '#type' => 'fieldset', diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 44b1613e6..9f7b10796 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -239,14 +239,14 @@ function poll_menu() { 'type' => MENU_SUGGESTED_ITEM, ); - $items['poll/cancel/%'] = array( + $items['poll/cancel/%node'] = array( 'title' => t('Cancel'), 'page callback' => 'poll_cancel', 'page arguments' => array(2), 'access arguments' => array('cancel own vote'), 'type' => MENU_CALLBACK, ); - $items['node/%/votes'] = array( + $items['node/%node/votes'] = array( 'title' => t('Votes'), 'page callback' => 'poll_votes', 'access callback' => '_poll_menu_access', @@ -254,7 +254,7 @@ function poll_menu() { 'weight' => 3, 'type' => MENU_LOCAL_TASK, ); - $items['node/%/results'] = array( + $items['node/%node/results'] = array( 'title' => t('Results'), 'page callback' => 'poll_results', 'access callback' => '_poll_menu_access', diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 5ebe2c99b..4f70ded20 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -355,6 +355,7 @@ function profile_field_form_submit($form_id, $form_values) { drupal_set_message(t('The field has been updated.')); } cache_clear_all(); + menu_rebuild(); return 'admin/user/profile'; } diff --git a/modules/search/search.module b/modules/search/search.module index 282aef95d..323cdcb3f 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -140,7 +140,6 @@ function search_menu() { $items['search'] = array( 'title' => t('Search'), 'page callback' => 'search_view', - 'page arguments' => array('node'), 'access arguments' => array('search content'), 'type' => MENU_SUGGESTED_ITEM, ); @@ -167,13 +166,14 @@ function search_menu() { ); foreach (module_implements('search') as $name) { - $items['search/'. $name] = array( + $items['search/'. $name .'/%search'] = array( 'title' => module_invoke($name, 'search', 'name', TRUE), 'page callback' => 'search_view', 'page arguments' => array($name), 'access callback' => '_search_menu', 'access arguments' => array($name), 'type' => $name == 'node' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, + 'parent' => 'search', ); } return $items; @@ -183,6 +183,10 @@ function _search_menu($name) { return user_access('search content') && module_invoke($name, 'search', 'name'); } +function search_to_arg() { + return search_get_keys(); +} + /** * Validate callback. */ @@ -882,16 +886,21 @@ function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = a * Helper function for grabbing search keys. */ function search_get_keys() { - // Extract keys as remainder of path - // Note: support old GET format of searches for existing links. - $path = explode('/', $_GET['q'], 3); - return count($path) == 3 ? $path[2] : $_REQUEST['keys']; + static $return; + if (!isset($return)) { + // Extract keys as remainder of path + // Note: support old GET format of searches for existing links. + $path = explode('/', $_GET['q'], 3); + $keys = empty($_REQUEST['keys']) ? '' : $_REQUEST['keys']; + $return = count($path) == 3 ? $path[2] : $keys; + } + return $return; } /** * Menu callback; presents the search form and/or search results. */ -function search_view($type = '') { +function search_view($type = 'node') { // Search form submits with POST but redirects to GET. This way we can keep // the search query URL clean as a whistle: // search/type/keyword+keyword @@ -905,6 +914,7 @@ function search_view($type = '') { $keys = search_get_keys(); // Only perform search if there is non-whitespace search term: + $results = ''; if (trim($keys)) { // Log the search keys: watchdog('search', t('%keys (@type).', array('%keys' => $keys, '@type' => module_invoke($type, 'search', 'name'))), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys)); diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 2aeed3ba5..82de6c73a 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -143,14 +143,15 @@ function statistics_menu() { 'type' => MENU_NORMAL_ITEM, 'weight' => 3, ); - $items['user/%/track/navigation'] = array( + $items['user/%user/track/navigation'] = array( 'title' => t('Track page visits'), 'page callback' => 'statistics_user_tracker', + 'access callback' => 'user_access', 'access arguments' => array('access statistics'), 'type' => MENU_LOCAL_TASK, 'weight' => 2, ); - $items['node/%/track'] = array( + $items['node/%node/track'] = array( 'title' => t('Track'), 'page callback' => 'statistics_node_tracker', 'access callback' => 'user_access', diff --git a/modules/system/system.install b/modules/system/system.install index 069913beb..7c9bb13ee 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -327,31 +327,32 @@ function system_install() { ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); db_query("CREATE TABLE {menu} ( + mid int NOT NULL default '0', + pid int NOT NULL default '0', path varchar(255) NOT NULL default '', + load_functions varchar(255) NOT NULL default '', + to_arg_functions varchar(255) NOT NULL default '', access_callback varchar(255) NOT NULL default '', access_arguments text, page_callback varchar(255) NOT NULL default '', page_arguments text, - map_callback varchar(255) NOT NULL default '', - map_arguments text, fit int NOT NULL default '0', number_parts int NOT NULL default '0', vancode varchar(255) NOT NULL default '', - mid int NOT NULL default '0', - pid int NOT NULL default '0', visible int NOT NULL default '0', - menu_link varchar(255) NOT NULL default '', parents varchar(255) NOT NULL default '', depth int NOT NULL default '0', has_children int NOT NULL default '0', tab int NOT NULL default 0, title varchar(255) NOT NULL default '', - default_tab int NOT NULL default '0', parent varchar(255) NOT NULL default '', + type int NOT NULL default 0, PRIMARY KEY (path), KEY vancode (vancode), KEY fit (fit), - KEY visible (visible) + KEY visible (visible), + KEY pid (pid), + KEY parent (parent) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); db_query("CREATE TABLE {node} ( @@ -801,30 +802,31 @@ function system_install() { mid int NOT NULL default '0', pid int NOT NULL default '0', path varchar(255) NOT NULL default '', + load_functions varchar(255) NOT NULL default '', + to_arg_functions varchar(255) NOT NULL default '', access_callback varchar(255) NOT NULL default '', access_arguments text, page_callback varchar(255) NOT NULL default '', page_arguments text, - map_callback varchar(255) NOT NULL default '', - map_arguments text, - fit int NOT NULL default 0, - number_parts int NOT NULL default 0, + fit int NOT NULL default '0', + number_parts int NOT NULL default '0', vancode varchar(255) NOT NULL default '', visible int NOT NULL default '0', - menu_link varchar(255) NOT NULL default '', parents varchar(255) NOT NULL default '', depth int NOT NULL default '0', has_children int NOT NULL default '0', - tab int NOT NULL default '0', + tab int NOT NULL default 0, title varchar(255) NOT NULL default '', - default_tab int NOT NULL default '0', parent varchar(255) NOT NULL default '', + type int NOT NULL default 0, PRIMARY KEY (path) )"); db_query("CREATE INDEX {menu}_vancode_idx ON {menu} (vancode)"); db_query("CREATE INDEX {menu}_fit_idx ON {menu} (fit)"); db_query("CREATE INDEX {menu}_visible_idx ON {menu} (visible)"); + db_query("CREATE INDEX {menu}_parent_idx ON {menu} (parent)"); + db_query("CREATE INDEX {menu}_pid_idx ON {menu} (parent)"); db_query("CREATE TABLE {node} ( nid serial CHECK (nid >= 0), diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 9eac0968e..48919e3ee 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -59,7 +59,7 @@ function taxonomy_link($type, $node = NULL) { */ function taxonomy_term_path($term) { - $vocabulary = taxonomy_get_vocabulary($term->vid); + $vocabulary = taxonomy_vocabulary_load($term->vid); if ($vocabulary->module != 'taxonomy' && $path = module_invoke($vocabulary->module, 'term_path', $term)) { return $path; } @@ -91,7 +91,7 @@ function taxonomy_menu() { 'parent' => 'admin/content/taxonomy', ); - $items['admin/content/taxonomy/edit/vocabulary/%'] = array( + $items['admin/content/taxonomy/edit/vocabulary/%taxonomy_vocabulary'] = array( 'title' => t('Edit vocabulary'), 'page callback' => 'taxonomy_admin_vocabulary_edit', 'page arguments' => array(5), @@ -117,27 +117,26 @@ function taxonomy_menu() { 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); - $items['admin/content/taxonomy/%'] = array( + $items['admin/content/taxonomy/%taxonomy_vocabulary'] = array( 'title' => t('List terms'), 'page callback' => 'taxonomy_overview_terms', 'page arguments' => array(3), 'access arguments' => array('administer taxonomy'), - 'map arguments' => array('taxonomy_get_vocabulary', 3), 'type' => MENU_CALLBACK, ); - $items['admin/content/taxonomy/%/list'] = array( + $items['admin/content/taxonomy/%taxonomy_vocabulary/list'] = array( 'title' => t('List'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); - $items['admin/content/taxonomy/%/add/term'] = array( + $items['admin/content/taxonomy/%taxonomy_vocabulary/add/term'] = array( 'title' => t('Add term'), 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_form_term', 3), 'type' => MENU_LOCAL_TASK, - 'parent' => 'admin/content/taxonomy/%', + 'parent' => 'admin/content/taxonomy/%taxonomy_vocabulary', ); return $items; @@ -334,7 +333,7 @@ function taxonomy_save_vocabulary(&$edit) { * Constant indicating items were deleted. */ function taxonomy_del_vocabulary($vid) { - $vocabulary = (array) taxonomy_get_vocabulary($vid); + $vocabulary = (array) taxonomy_vocabulary_load($vid); db_query('DELETE FROM {vocabulary} WHERE vid = %d', $vid); db_query('DELETE FROM {vocabulary_node_types} WHERE vid = %d', $vid); @@ -351,7 +350,7 @@ function taxonomy_del_vocabulary($vid) { } function taxonomy_vocabulary_confirm_delete($vid) { - $vocabulary = taxonomy_get_vocabulary($vid); + $vocabulary = taxonomy_vocabulary_load($vid); $form['type'] = array('#type' => 'value', '#value' => 'vocabulary'); $form['vid'] = array('#type' => 'value', '#value' => $vid); @@ -593,7 +592,7 @@ function taxonomy_term_confirm_delete_submit($form_id, $form_values) { * Generate a form element for selecting terms from a vocabulary. */ function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') { - $vocabulary = taxonomy_get_vocabulary($vid); + $vocabulary = taxonomy_vocabulary_load($vid); $help = ($help) ? $help : $vocabulary->help; if ($vocabulary->required) { $blank = 0; @@ -764,7 +763,7 @@ function taxonomy_node_validate(&$node) { $terms = $node->taxonomy; if ($terms['tags']) { foreach ($terms['tags'] as $vid => $vid_value) { - $vocabulary = taxonomy_get_vocabulary($vid); + $vocabulary = taxonomy_vocabulary_load($vid); if (empty($vocabulary->tags)) { // see form_get_error $key = implode('][', $element['#parents']); // on why this is the key @@ -1109,7 +1108,7 @@ function taxonomy_get_term_by_name($name) { * The vocabulary object with all of its metadata. * Results are statically cached. */ -function taxonomy_get_vocabulary($vid) { +function taxonomy_vocabulary_load($vid) { static $vocabularies = array(); if (!array_key_exists($vid, $vocabularies)) { @@ -1388,14 +1387,11 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { /** * Page to edit a vocabulary. */ -function taxonomy_admin_vocabulary_edit($vid = NULL) { +function taxonomy_admin_vocabulary_edit($vocabulary) { if ($_POST['op'] == t('Delete') || $_POST['confirm']) { - return drupal_get_form('taxonomy_vocabulary_confirm_delete', $vid); + return drupal_get_form('taxonomy_vocabulary_confirm_delete', $vocabulary->vid); } - if ($vocabulary = (array)taxonomy_get_vocabulary($vid)) { - return drupal_get_form('taxonomy_form_vocabulary', $vocabulary); - } - return drupal_not_found(); + return drupal_get_form('taxonomy_form_vocabulary', (array)$vocabulary); } /** diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index dc9122d8e..51d6f6d3a 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -35,18 +35,22 @@ function tracker_menu() { 'type' => MENU_DEFAULT_LOCAL_TASK, 'access callback' => 'user_is_logged_in', ); - $items['tracker/%'] = array( + + $items['tracker/%user_current'] = array( 'title' => t('My recent posts'), 'type' => MENU_LOCAL_TASK, 'access callback' => 'user_is_logged_in', + 'access arguments' => array(1), ); - $items['user/%/track'] = array( + + $items['user/%user/track'] = array( 'title' => t('Track'), 'page callback' => 'tracker_track_user', + 'access callback' => 'user_access', 'access arguments' => array('access content'), 'type' => MENU_LOCAL_TASK, ); - $items['user/%/track/posts'] = array( + $items['user/%user/track/posts'] = array( 'title' => t('Track posts'), 'type' => MENU_DEFAULT_LOCAL_TASK, ); diff --git a/modules/user/user.module b/modules/user/user.module index c4d52b081..ff92c54fd 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -730,11 +730,15 @@ function user_menu() { ); // Registration and login pages. - $items['user/login'] = array( + $items['user'] = array( 'title' => t('Log in'), 'page callback' => 'drupal_get_form', 'page arguments' => array('user_login'), 'access callback' => 'user_is_anonymous', + ); + + $items['user/login'] = array( + 'title' => t('Log in'), 'type' => MENU_DEFAULT_LOCAL_TASK, ); @@ -857,7 +861,6 @@ function user_menu() { 'page callback' => 'user_admin', 'page arguments' => array('search'), 'access arguments' => array('administer users'), - 'type' => MENU_NORMAL_ITEM, ); } @@ -868,32 +871,22 @@ function user_menu() { 'weight' => 10, ); - $items['user'] = array( - 'title' => t('My account'), - 'page callback' => 'user_view', - 'page arguments' => array(1), - 'access callback' => 'user_view_access', - 'access arguments' => array(1), - 'map callback' => 'user_load_self', - ); - - $items['user/%'] = array( + $items['user/%user_current'] = array( 'title' => t('My account'), 'page callback' => 'user_view', 'page arguments' => array(1), 'access callback' => 'user_view_access', 'access arguments' => array(1), - 'map arguments' => array('user_load', 1), - 'type' => MENU_CALLBACK, + 'parent' => '', ); - $items['user/%/view'] = array( + $items['user/%user/view'] = array( 'title' => t('View'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); - $items['user/%/delete'] = array( + $items['user/%user/delete'] = array( 'title' => t('Delete'), 'page callback' => 'user_edit', 'access callback' => 'user_access', @@ -901,7 +894,7 @@ function user_menu() { 'type' => MENU_CALLBACK, ); - $items['user/%/edit'] = array( + $items['user/%user/edit'] = array( 'title' => t('Edit'), 'page callback' => 'drupal_get_form', 'page arguments' => array('user_edit'), @@ -913,7 +906,7 @@ function user_menu() { $empty_account = new stdClass(); if (($categories = _user_categories($empty_account)) && (count($categories) > 1)) { foreach ($categories as $key => $category) { - $items['user/%/edit/'. $category['name']] = array( + $items['user/%user/edit/'. $category['name']] = array( 'title' => $category['title'], 'page arguments' => array('user_edit', 3), 'type' => $category['name'] == 'account' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, @@ -928,6 +921,14 @@ function user_init() { drupal_add_css(drupal_get_path('module', 'user') .'/user.css', 'module'); } +function user_current_load($arg) { + return user_load($arg); +} + +function user_current_to_arg() { + return $GLOBALS['user']->uid; +} + /** * Accepts an user object, $account, or a DA name and returns an associative * array of modules and DA names. Called at external login. @@ -1588,6 +1589,7 @@ function user_edit_submit($form_id, $form_values) { function user_view($account) { global $user; + drupal_set_title(check_plain($account->name)); // Retrieve and merge all profile fields: $fields = array(); foreach (module_list() as $module) { |