diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-05-21 21:32:54 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-05-21 21:32:54 +0000 |
commit | 2b1664bc668b9928bc99f082f9b9abaed867512f (patch) | |
tree | f017f8753fbbe77f3f8075b551ba6df56625a211 /modules | |
parent | a7bced320e74066cac904be6b2bc8922a3a8af0b (diff) | |
download | brdo-2b1664bc668b9928bc99f082f9b9abaed867512f.tar.gz brdo-2b1664bc668b9928bc99f082f9b9abaed867512f.tar.bz2 |
- Patch #16452 by chx: made it possible to rewrite some taxonomy queries.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/taxonomy.module | 7 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module index abca53066..44586cf6b 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -741,7 +741,7 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { if (!isset($children[$vid])) { $children[$vid] = array(); - $result = db_query('SELECT t.*, parent FROM {term_data} t, {term_hierarchy} h WHERE t.tid = h.tid AND t.vid = %d ORDER BY weight, name', $vid); + $result = db_query(db_rewrite_sql('SELECT t.tid, t.*, parent FROM {term_data} t, {term_hierarchy} h WHERE t.tid = h.tid AND t.vid = %d ORDER BY weight, name', 't', 'tid'), $vid); while ($term = db_fetch_object($result)) { $children[$vid][$term->parent][] = $term->tid; $parents[$vid][$term->tid][] = $term->parent; @@ -1052,10 +1052,11 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { $rss_tids = urlencode($str_tids); if ($tids) { - // Build title: - $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids)); + $result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (%s)', 't', 'tid'), implode(',', $tids)); + $tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to. $names = array(); while ($term = db_fetch_object($result)) { + $tids[] = $term->tid; $names[] = $term->name; } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index abca53066..44586cf6b 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -741,7 +741,7 @@ function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) { if (!isset($children[$vid])) { $children[$vid] = array(); - $result = db_query('SELECT t.*, parent FROM {term_data} t, {term_hierarchy} h WHERE t.tid = h.tid AND t.vid = %d ORDER BY weight, name', $vid); + $result = db_query(db_rewrite_sql('SELECT t.tid, t.*, parent FROM {term_data} t, {term_hierarchy} h WHERE t.tid = h.tid AND t.vid = %d ORDER BY weight, name', 't', 'tid'), $vid); while ($term = db_fetch_object($result)) { $children[$vid][$term->parent][] = $term->tid; $parents[$vid][$term->tid][] = $term->parent; @@ -1052,10 +1052,11 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { $rss_tids = urlencode($str_tids); if ($tids) { - // Build title: - $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids)); + $result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (%s)', 't', 'tid'), implode(',', $tids)); + $tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to. $names = array(); while ($term = db_fetch_object($result)) { + $tids[] = $term->tid; $names[] = $term->name; } |