Index: modules/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node.module,v
retrieving revision 1.499
diff -u -F^f -r1.499 node.module
--- modules/node.module	22 Jun 2005 20:19:58 -0000	1.499
+++ modules/node.module	23 Jun 2005 18:41:48 -0000
@@ -331,7 +331,7 @@ function node_invoke_nodeapi(&$node, $op
  *
  * @param $conditions
  *   An array of conditions to match against in the database query. Most calls
- *   will simply use array('nid' => 52).
+ *   will simply use array('nid' => 52), so you can supply a nid as well.
  * @param $revision
  *   Which numbered revision to load. Defaults to the current version.
  * @param $reset
@@ -347,19 +347,25 @@ function node_load($conditions, $revisio
     $nodes = array();
   }
 
-  $cachable = (count($conditions) == 1 && isset($conditions['nid']) && $revision == NULL);
-
-  if ($cachable && isset($nodes[$conditions['nid']])) {
-    return $nodes[$conditions['nid']];
+  if (is_numeric($conditions)) {
+    $nid = $conditions;
+    $cachable = ($revision == NULL);
+    if ($cachable && isset($nodes[$nid])) {
+      return $nodes[$nid];
+    }
+    $cond = 'n.nid = '. $nid;
   }
-
-  // Turn the conditions into a query.
-  foreach ($conditions as $key => $value) {
-    $cond[] = 'n.'. db_escape_string($key) ." = '". db_escape_string($value) ."'";
+  else {
+    // Turn the conditions into a query.
+    $cond = array();
+    foreach ($conditions as $key => $value) {
+      $cond[] = 'n.'. db_escape_string($key) ." = '". db_escape_string($value) ."'";
+    }
+    $cond = implode(' AND ', $cond);
   }
 
   // Retrieve the node.
-  $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.*, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE '. implode(' AND ', $cond))));
+  $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.*, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE '. $cond)));
   $node = drupal_unpack($node);
 
   // Unserialize the revisions and user data fields.
@@ -387,7 +393,7 @@ function node_load($conditions, $revisio
   }
 
   if ($cachable) {
-    $nodes[$conditions['nid']] = $node;
+    $nodes[$nid] = $node;
   }
 
   return $node;
