? sites/default/modules
? sites/default/settings.php
Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.296
diff -u -p -r1.296 menu.inc
--- includes/menu.inc	14 Oct 2008 13:31:38 -0000	1.296
+++ includes/menu.inc	14 Oct 2008 19:09:35 -0000
@@ -1812,7 +1812,13 @@ function _menu_navigation_links_rebuild(
       // If the router path and the link path matches, it's surely a working
       // item, so we clear the updated flag.
       $updated = $item['updated'] && $router_path != $item['link_path'];
-      db_query("UPDATE {menu_links} SET router_path = '%s', updated = %d WHERE mlid = %d", $router_path, $updated, $item['mlid']);
+      db_update('menu_links')
+        ->fields(array(
+          'router_path' => $router_path,
+          'updated' => $updated,
+        ))
+        ->condition('mlid', $item['mlid'])
+        ->execute();
     }
   }
   // Find any item whose router path does not exist any more.
@@ -1957,22 +1963,23 @@ function menu_link_save(&$item) {
   }
 
   if (!$existing_item) {
-    db_query("INSERT INTO {menu_links} (
-       menu_name, plid, link_path,
-      hidden, external, has_children,
-      expanded, weight,
-      module, link_title, options,
-      customized, updated) VALUES (
-      '%s', %d, '%s',
-      %d, %d, %d,
-      %d, %d,
-      '%s', '%s', '%s', %d, %d)",
-      $item['menu_name'], $item['plid'], $item['link_path'],
-      $item['hidden'], $item['_external'], $item['has_children'],
-      $item['expanded'], $item['weight'],
-      $item['module'],  $item['link_title'], serialize($item['options']),
-      $item['customized'], $item['updated']);
-    $item['mlid'] = db_last_insert_id('menu_links', 'mlid');
+    $item['mlid'] = db_insert('menu_links')
+      ->fields(array(
+        'menu_name' => $item['menu_name'],
+        'plid' => $item['plid'],
+        'link_path' => $item['link_path'],
+        'hidden' => $item['hidden'],
+        'external' => $item['_external'],
+        'has_children' => $item['has_children'],
+        'expanded' => $item['expanded'],
+        'weight' => $item['weight'],
+        'module' => $item['module'],
+        'link_title' => $item['link_title'],
+        'options' => serialize($item['options']),
+        'customized' => $item['customized'],
+        'updated' => $item['updated'],
+      ))
+      ->execute();
   }
 
   if (!$item['plid']) {
@@ -2012,16 +2019,34 @@ function menu_link_save(&$item) {
       $item['router_path'] = _menu_find_router_path($menu, $item['link_path']);
     }
   }
-  db_query("UPDATE {menu_links} SET menu_name = '%s', plid = %d, link_path = '%s',
-    router_path = '%s', hidden = %d, external = %d, has_children = %d,
-    expanded = %d, weight = %d, depth = %d,
-    p1 = %d, p2 = %d, p3 = %d, p4 = %d, p5 = %d, p6 = %d, p7 = %d, p8 = %d, p9 = %d,
-    module = '%s', link_title = '%s', options = '%s', customized = %d WHERE mlid = %d",
-    $item['menu_name'], $item['plid'], $item['link_path'],
-    $item['router_path'], $item['hidden'], $item['_external'], $item['has_children'],
-    $item['expanded'], $item['weight'],  $item['depth'],
-    $item['p1'], $item['p2'], $item['p3'], $item['p4'], $item['p5'], $item['p6'], $item['p7'], $item['p8'], $item['p9'],
-    $item['module'],  $item['link_title'], serialize($item['options']), $item['customized'], $item['mlid']);
+  db_update('menu_links')
+    ->fields(array(
+      'menu_name' => $item['menu_name'],
+      'plid' => $item['plid'],
+      'link_path' => $item['link_path'],
+      'router_path' => $item['router_path'],
+      'hidden' => $item['hidden'],
+      'external' => $item['_external'],
+      'has_children' => $item['has_children'],
+      'expanded' => $item['expanded'],
+      'weight' => $item['weight'],
+      'depth' => $item['depth'],
+      'p1' => $item['p1'],
+      'p2' => $item['p2'],
+      'p3' => $item['p3'],
+      'p4' => $item['p4'],
+      'p5' => $item['p5'],
+      'p6' => $item['p6'],
+      'p7' => $item['p7'],
+      'p8' => $item['p8'],
+      'p9' => $item['p9'],
+      'module' => $item['module'],
+      'link_title' => $item['link_title'],
+      'options' => serialize($item['options']),
+      'customized' => $item['customized'],
+    ))
+    ->condition('mlid', $item['mlid'])
+    ->execute();
   // Check the has_children status of the parent.
   _menu_update_parental_status($item);
   menu_cache_clear($menu_name);
@@ -2119,7 +2144,12 @@ function menu_link_maintain($module, $op
       return menu_link_save($menu_link);
       break;
     case 'update':
-      db_query("UPDATE {menu_links} SET link_title = '%s' WHERE link_path = '%s' AND customized = 0 AND module = '%s'", $link_title, $link_path, $module);
+      db_update('menu_links')
+        ->fields(array('link_title' => $link_title))
+        ->condition('link_path', $link_path)
+        ->condition('customized', 0)
+        ->condition('module', $module)
+        ->execute();
       $result = db_query("SELECT menu_name FROM {menu_links} WHERE link_path = '%s' AND customized = 0 AND module = '%s'", $link_path, $module);
       while ($item = db_fetch_array($result)) {
         menu_cache_clear($item['menu_name']);
@@ -2232,8 +2262,10 @@ function _menu_update_parental_status($i
     }
 
     $parent_has_children = ((bool) $query->execute()->fetchField()) ? 1 : 0;
-    db_query("UPDATE {menu_links} SET has_children = %d WHERE mlid = %d", $parent_has_children, $item['plid']);
-
+    db_update('menu_links')
+      ->fields(array('has_children' => $parent_has_children))
+      ->condition('mlid', $item['plid'])
+      ->execute();
   }
 }
 
@@ -2411,23 +2443,29 @@ function _menu_router_build($callbacks) 
       'path' => $path,
     );
 
-    $title_arguments = $item['title arguments'] ? serialize($item['title arguments']) : '';
-    db_query("INSERT INTO {menu_router}
-      (path, load_functions, to_arg_functions, access_callback,
-      access_arguments, page_callback, page_arguments, fit,
-      number_parts, tab_parent, tab_root,
-      title, title_callback, title_arguments,
-      type, block_callback, description, position, weight)
-      VALUES ('%s', '%s', '%s', '%s',
-      '%s', '%s', '%s', %d,
-      %d, '%s', '%s',
-      '%s', '%s', '%s',
-      %d, '%s', '%s', '%s', %d)",
-      $path, $item['load_functions'], $item['to_arg_functions'], $item['access callback'],
-      serialize($item['access arguments']), $item['page callback'], serialize($item['page arguments']), $item['_fit'],
-      $item['_number_parts'], $item['tab_parent'], $item['tab_root'],
-      $item['title'], $item['title callback'], $title_arguments,
-      $item['type'], $item['block callback'], $item['description'], $item['position'], $item['weight']);
+    db_insert('menu_router')
+      ->fields(array(
+        'path' => $item['path'],
+        'load_functions' => $item['load_functions'],
+        'to_arg_functions' => $item['to_arg_functions'],
+        'access_callback' => $item['access callback'],
+        'access_arguments' => serialize($item['access arguments']),
+        'page_callback' => $item['page callback'],
+        'page_arguments' => serialize($item['page arguments']),
+        'fit' => $item['_fit'],
+        'number_parts' => $item['_number_parts'],
+        'tab_parent' => $item['tab_parent'],
+        'tab_root' => $item['tab_root'],
+        'title' => $item['title'],
+        'title_callback' => $item['title callback'],
+        'title_arguments' => ($item['title arguments'] ? serialize($item['title arguments']) : ''),
+        'type' => $item['type'],
+        'block_callback' => $item['block callback'],
+        'description' => $item['description'],
+        'position' => $item['position'],
+        'weight' => $item['weight'],
+      ))
+      ->execute();
   }
   // Sort the masks so they are in order of descending fit, and store them.
   $masks = array_keys($masks);
