=== modified file 'includes/menu.inc'
--- includes/menu.inc	2007-12-26 19:02:23 +0000
+++ includes/menu.inc	2007-12-27 02:15:39 +0000
@@ -301,7 +301,11 @@ function menu_set_item($path, $router_it
  *   filled in based on the database values and the objects loaded.
  */
 function menu_get_item($path = NULL, $router_item = NULL) {
-  static $router_items;
+  static $router_items, $in_call = FALSE;
+  // Avoid recursive calls via menu_get_object.
+  if ($in_call) {
+    return FALSE;
+  }
   if (!isset($path)) {
     $path = $_GET['q'];
   }
@@ -314,7 +318,9 @@ function menu_get_item($path = NULL, $ro
     list($ancestors, $placeholders) = menu_get_ancestors($parts);
 
     if ($router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN ('. implode (',', $placeholders) .') ORDER BY fit DESC', $ancestors, 0, 1))) {
+      $in_call = TRUE;
       $map = _menu_translate($router_item, $original_map);
+      $in_call = FALSE;
       if ($map === FALSE) {
         $router_items[$path] = FALSE;
         return FALSE;
@@ -380,12 +386,12 @@ function _menu_load_objects(&$item, &$ma
 
           // Some arguments are placeholders for dynamic items to process.
           foreach ($args as $i => $arg) {
-            if ($arg == '%index') {
+            if ($arg === '%index') {
               // Pass on argument index to the load function, so multiple
               // occurances of the same placeholder can be identified.
               $args[$i] = $index;
             }
-            if ($arg == '%map') {
+            if ($arg === '%map') {
               // Pass on menu map by reference. The accepting function must
               // also declare this as a reference if it wants to modify
               // the map.
@@ -579,6 +585,7 @@ function menu_tail_to_arg($arg, $map, $i
  *   $item['title'] is generated from link_title, and may be localized.
  */
 function _menu_link_translate(&$item) {
+  global $menu_admin;
   if ($item['external']) {
     $item['access'] = 1;
     $map = array();
@@ -592,8 +599,15 @@ function _menu_link_translate(&$item) {
 
     // Note - skip callbacks without real values for their arguments.
     if (strpos($item['href'], '%') !== FALSE) {
-      $item['access'] = FALSE;
-      return FALSE;
+      if (empty($menu_admin)) {
+        $item['access'] = FALSE;
+        return FALSE;
+      }
+      else {
+        $item['href'] = $item['link_path'];
+        $item['access'] = TRUE;
+        $item['_no_link'] = TRUE;
+      }
     }
     // menu_tree_check_access() may set this ahead of time for links to nodes.
     if (!isset($item['access'])) {
@@ -1491,6 +1505,13 @@ function menu_get_active_title() {
   }
 }
 
+function menu_link_to_arg($arg, $map, $index) {
+  if ($menu_link = menu_get_object('menu_link', $index)) {
+    $arg = $menu_link['mlid'];
+  }
+  return $arg;
+}
+
 /**
  * Get a menu link by its mlid, access checked and link translated for
  * rendering.
@@ -1501,9 +1522,16 @@ function menu_get_active_title() {
  *   A menu link, with $item['access'] filled and link translated for
  *   rendering.
  */
-function menu_link_load($mlid) {
+function menu_link_load($mlid, $is_menu_admin = FALSE) {
+  global $menu_admin;
   if (is_numeric($mlid) && $item = db_fetch_array(db_query("SELECT m.*, ml.* FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path WHERE ml.mlid = %d", $mlid))) {
+    if ($is_menu_admin) {
+      $menu_admin = TRUE;
+    }
     _menu_link_translate($item);
+    if ($is_menu_admin) {
+      $menu_admin = FALSE;
+    }
     return $item;
   }
   return FALSE;

=== modified file 'modules/aggregator/aggregator.module'
--- modules/aggregator/aggregator.module	2007-12-23 13:17:19 +0000
+++ modules/aggregator/aggregator.module	2007-12-27 01:44:14 +0000
@@ -861,6 +861,13 @@ function aggregator_save_item($edit) {
   }
 }
 
+function aggregator_feed_to_arg($arg, $map, $index) {
+  if ($feed = menu_get_object('aggregator_feed', $index)) {
+    $arg = $feed['fid'];
+  }
+  return $arg;
+}
+
 /**
  * Load an aggregator feed.
  *
@@ -877,6 +884,14 @@ function aggregator_feed_load($fid) {
   return $feeds[$fid];
 }
 
+function aggregator_category_to_arg($arg, $map, $index) {
+  if ($category = menu_get_object('aggregator_category', $index)) {
+    $arg = $category['cid'];
+  }
+  return $arg;
+}
+
+
 /**
  * Load an aggregator category.
  *

=== modified file 'modules/contact/contact.module'
--- modules/contact/contact.module	2007-12-19 17:42:13 +0000
+++ modules/contact/contact.module	2007-12-27 01:41:52 +0000
@@ -121,6 +121,14 @@ function _contact_user_tab_access($accou
     );
 }
 
+
+function contact_to_arg($arg, $map, $index) {
+  if ($contact = menu_get_object('contact', $index)) {
+    $arg = $contact['cid'];
+  }
+  return $arg;
+}
+
 /**
  * Load the data for a single contact category.
  */

=== modified file 'modules/filter/filter.module'
--- modules/filter/filter.module	2007-12-22 23:24:24 +0000
+++ modules/filter/filter.module	2007-12-27 01:42:16 +0000
@@ -133,6 +133,13 @@ function filter_menu() {
   return $items;
 }
 
+function filter_format_to_arg($arg, $map, $index) {
+  if ($filter_format = menu_get_object('filter_format', $index)) {
+    $arg = $filter_format->fid;
+  }
+  return $arg;
+}
+
 function filter_format_load($arg) {
   return filter_formats($arg);
 }

=== modified file 'modules/forum/forum.module'
--- modules/forum/forum.module	2007-12-22 23:11:31 +0000
+++ modules/forum/forum.module	2007-12-27 01:42:30 +0000
@@ -64,6 +64,13 @@ function forum_theme() {
   );
 }
 
+function forum_term_to_arg($arg, $map, $index) {
+  if ($forum_term = menu_get_object('forum_term', $index)) {
+    $arg = $forum_term['tid'];
+  }
+  return $arg;
+}
+
 /**
  * Fetch a forum term.
  *

=== modified file 'modules/menu/menu.admin.inc'
--- modules/menu/menu.admin.inc	2007-12-22 23:24:24 +0000
+++ modules/menu/menu.admin.inc	2007-12-27 02:13:52 +0000
@@ -69,7 +69,10 @@ function _menu_overview_tree_form($tree)
       $mlid = 'mlid:'. $item['mlid'];
       $form[$mlid]['#item'] = $item;
       $form[$mlid]['#attributes'] = $item['hidden'] ? array('class' => 'menu-disabled') : array('class' => 'menu-enabled');
-      $form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['options']) . ($item['hidden'] ? ' ('. t('disabled') .')' : '');
+      $form[$mlid]['title']['#value'] = empty($item['_no_link']) ? l($item['title'], $item['href'], $item['options']) : check_plain($item['title']) .' ('. t('dynamic') .')';
+      if ($item['hidden']) {
+       $form[$mlid]['title']['#value'] .= ' ('. t('disabled') .')';
+      }
       $form[$mlid]['hidden'] = array(
         '#type' => 'checkbox',
         '#default_value' => !$item['hidden'],
@@ -374,7 +377,10 @@ function menu_edit_item_submit($form, &$
 
   $item['options']['attributes']['title'] = $item['description'];
   list($item['menu_name'], $item['plid']) = explode(':', $item['parent']);
-  if (!menu_link_save($item)) {
+  if (menu_link_save($item)) {
+    drupal_set_message(t('Your item was saved'));
+  }
+  else {
     drupal_set_message(t('There was an error saving the menu link.'), 'error');
   }
   $form_state['redirect'] = 'admin/build/menu-customize/'. $item['menu_name'];

=== modified file 'modules/menu/menu.module'
--- modules/menu/menu.module	2007-12-19 19:13:28 +0000
+++ modules/menu/menu.module	2007-12-27 01:49:20 +0000
@@ -115,6 +115,7 @@ function menu_menu() {
     'title' => 'Edit menu item',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('menu_edit_item', 'edit', 4, NULL),
+    'load arguments' => array(TRUE),
     'type' => MENU_CALLBACK,
     'file' => 'menu.admin.inc',
   );
@@ -122,6 +123,7 @@ function menu_menu() {
     'title' => 'Reset menu item',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('menu_reset_item_confirm', 4),
+    'load arguments' => array(TRUE),
     'type' => MENU_CALLBACK,
     'file' => 'menu.admin.inc',
   );
@@ -129,6 +131,7 @@ function menu_menu() {
     'title' => 'Delete menu item',
     'page callback' => 'menu_item_delete_page',
     'page arguments' => array(4),
+    'load arguments' => array(TRUE),
     'type' => MENU_CALLBACK,
     'file' => 'menu.admin.inc',
   );
@@ -178,6 +181,13 @@ function menu_overview_title($menu) {
   return $menu['title'];
 }
 
+function menu_to_arg($arg, $map, $index) {
+  if ($menu = menu_get_object('menu', $index)) {
+    $arg = $menu['menu_name'];
+  }
+  return $arg;
+}
+
 /**
  * Load the data for a single custom menu.
  */
@@ -461,15 +471,11 @@ function menu_valid_path($form_item) {
   if ($path == '<front>' || menu_path_is_external($path)) {
     $item = array('access' => TRUE);
   }
-  elseif (preg_match('/\/\%/', $path)) {
-    // Path is dynamic (ie 'user/%'), so check directly against menu_router table.
-    if ($item = db_fetch_array(db_query("SELECT * FROM {menu_router} where path = '%s' ", $path))) {
-      $item['link_path']  = $form_item['link_path'];
-      $item['link_title'] = $form_item['link_title'];
-      $item['external']   = FALSE;
-      $item['options'] = '';
-      _menu_link_translate($item);
-    }
+  // Path is dynamic (ie 'user/%'), so check directly against menu_router
+  // table. In the hope that on some page these will be accessible, we let
+  // them in.
+  elseif (preg_match('|/%|', $path) && ($item = db_fetch_array(db_query("SELECT * FROM {menu_router} where path = '%s' ", $path)))) {
+    $item['access'] = TRUE;
   }
   else {
     $item = menu_get_item($path);

=== modified file 'modules/node/node.module'
--- modules/node/node.module	2007-12-26 21:12:12 +0000
+++ modules/node/node.module	2007-12-27 02:08:49 +0000
@@ -1344,6 +1344,13 @@ function _node_add_access() {
   return FALSE;
 }
 
+function node_to_arg($arg, $map, $index) {
+  if ($node = menu_get_object('node', $index)) {
+    $arg = $node->nid;
+  }
+  return $arg;
+}
+
 /**
  * Implementation of hook_menu().
  */

=== modified file 'modules/taxonomy/taxonomy.module'
--- modules/taxonomy/taxonomy.module	2007-12-22 23:24:24 +0000
+++ modules/taxonomy/taxonomy.module	2007-12-27 01:43:09 +0000
@@ -961,6 +961,13 @@ function taxonomy_get_term_by_name($name
   return $result;
 }
 
+function taxonomy_vocabulary_to_arg($arg, $map, $index) {
+  if ($taxonomy_vocabulary = menu_get_object('taxonomy_vocabulary', $index)) {
+    $arg = $taxonomy_vocabulary->vid;
+  }
+  return $arg;
+}
+
 /**
  * Return the vocabulary object matching a vocabulary ID.
  *

=== modified file 'modules/user/user.module'
--- modules/user/user.module	2007-12-26 19:02:23 +0000
+++ modules/user/user.module	2007-12-27 01:44:31 +0000
@@ -1102,6 +1102,13 @@ function user_current_load($arg) {
   return user_load($arg ? $arg : $GLOBALS['user']->uid);
 }
 
+function user_category_to_arg($arg, $map, $index) {
+  if ($account = menu_get_object('user', $index)) {
+    $arg = $account->uid;
+  }
+  return $arg;
+}
+
 /**
  * Return a user object after checking if any profile category in the path exists.
  */

