? files ? sites/drumm-laptop.secure-5 Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.330.2.12 diff -u -F^f -r1.330.2.12 taxonomy.module --- modules/taxonomy/taxonomy.module 10 Nov 2007 04:09:03 -0000 1.330.2.12 +++ modules/taxonomy/taxonomy.module 5 Dec 2007 18:20:59 -0000 @@ -1243,16 +1243,20 @@ function taxonomy_select_nodes($tids = a } if ($operator == 'or') { - $str_tids = implode(',', call_user_func_array('array_merge', $descendant_tids)); - $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY '. $order; - $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1'; + $args = call_user_func_array('array_merge', $descendant_tids); + $placeholders = implode(',', array_fill(0, count($args), '%d')); + $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $placeholders .') AND n.status = 1 ORDER BY '. $order; + $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $placeholders .') AND n.status = 1'; } else { $joins = ''; $wheres = ''; + $args = array(); foreach ($descendant_tids as $index => $tids) { $joins .= ' INNER JOIN {term_node} tn'. $index .' ON n.nid = tn'. $index .'.nid'; - $wheres .= ' AND tn'. $index .'.tid IN ('. implode(',', $tids) .')'; + $placeholders = implode(',', array_fill(0, count($tids), '%d')); + $wheres .= ' AND tn'. $index .'.tid IN ('. $placeholders .')'; + $args = array_merge($args, $tids); } $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres .' ORDER BY '. $order; $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres; @@ -1260,10 +1264,10 @@ function taxonomy_select_nodes($tids = a $sql = db_rewrite_sql($sql); $sql_count = db_rewrite_sql($sql_count); if ($pager) { - $result = pager_query($sql, variable_get('default_nodes_main', 10), 0, $sql_count); + $result = pager_query($sql, variable_get('default_nodes_main', 10), 0, $sql_count, $args); } else { - $result = db_query_range($sql, 0, variable_get('feed_default_items', 10)); + $result = db_query_range($sql, 0, variable_get('feed_default_items', 10), $args); } }