Index: category.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/category/category.inc,v
retrieving revision 1.64.2.1
diff -u -p -r1.64.2.1 category.inc
--- category.inc	2 Feb 2007 08:24:56 -0000	1.64.2.1
+++ category.inc	7 Apr 2007 19:45:15 -0000
@@ -100,7 +100,7 @@ function category_get_container($cnid) {
  */
 function category_get_containers($type = NULL) {
   $type_sql = $type ? " WHERE nt.type = '%s'" : "";
-  $result = db_query("SELECT c.*, n.title, n.status, nt.type, cd.allowed_parent FROM {category_cont} c INNER JOIN {category} t ON c.cid = t.cid INNER JOIN {node} n ON c.cid = n.nid LEFT JOIN {category_cont_node_types} nt ON c.cid = nt.cid LEFT JOIN {category_cont_distant} cd ON c.cid = cd.cid". $type_sql ." ORDER BY t.weight, n.title", $type);
+  $result = db_query(db_rewrite_sql("SELECT c.*, n.title, n.status, nt.type, cd.allowed_parent FROM {category_cont} c INNER JOIN {category} t ON c.cid = t.cid INNER JOIN {node} n ON c.cid = n.nid LEFT JOIN {category_cont_node_types} nt ON c.cid = nt.cid LEFT JOIN {category_cont_distant} cd ON c.cid = cd.cid". $type_sql ." ORDER BY t.weight, n.title"), $type);
 
   $containers = array();
   $node_types = array();
@@ -1426,7 +1426,7 @@ function category_get_wrapper_status($ty
 function category_get_distant_child_containers($cnid) {
   $containers = array();
 
-  $result = db_query('SELECT cid FROM {category_cont_distant} WHERE allowed_parent = \'%s\'', $cnid);
+  $result = db_query("SELECT cid FROM {category_cont_distant} WHERE allowed_parent = '%s'", $cnid);
   while ($cont = db_fetch_object($result)) {
     $containers[$cont->cid] = $cont->cid;
   }
