diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-09-19 08:41:50 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-09-19 08:41:50 +0000 |
commit | 4e3a3aaed0159d5528c19f68ea238e69a5b62ba5 (patch) | |
tree | 34addac0853548f4098a8c60c25eb7914cec994f | |
parent | 34fc0b882d7b037dc8352245994b56c7372593b8 (diff) | |
download | brdo-4e3a3aaed0159d5528c19f68ea238e69a5b62ba5.tar.gz brdo-4e3a3aaed0159d5528c19f68ea238e69a5b62ba5.tar.bz2 |
- Bugfix: using non numeric terms in taxonomy-page URLs would result in SQL errors.
-rw-r--r-- | modules/taxonomy.module | 69 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 69 |
2 files changed, 70 insertions, 68 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 819194da4..0b20db1e4 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -855,44 +855,45 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { drupal_not_found(); } - // Build title: - $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids)); - $names = array(); - while ($term = db_fetch_object($result)) { - $names[] = $term->name; - } - $title = implode(', ', $names); - - switch ($op) { - case 'page': - // Build breadcrumb based on first hierarchy of first term: - $current->tid = $tids[0]; - $breadcrumbs = array(array('path' => $_GET['q'])); - while ($parents = taxonomy_get_parents($current->tid)) { - $current = array_shift($parents); - $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name); - } - $breadcrumbs = array_reverse($breadcrumbs); - menu_set_location($breadcrumbs); - - drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed') .'" />'); + if ($tids) { + // Build title: + $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids)); + $names = array(); + while ($term = db_fetch_object($result)) { + $names[] = $term->name; + } + $title = implode(', ', $names); + + switch ($op) { + case 'page': + // Build breadcrumb based on first hierarchy of first term: + $current->tid = $tids[0]; + $breadcrumbs = array(array('path' => $_GET['q'])); + while ($parents = taxonomy_get_parents($current->tid)) { + $current = array_shift($parents); + $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name); + } + $breadcrumbs = array_reverse($breadcrumbs); + menu_set_location($breadcrumbs); - $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE)); - print theme('page', $output, $title); - break; + drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed') .'" />'); - case 'feed': - $term = taxonomy_get_term($tids[0]); - $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE); - $channel['title'] = variable_get('site_name', 'drupal') .' - '. $title; - $channel['description'] = $term->description; + $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE)); + print theme('page', $output, $title); + break; - $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE); - node_feed($result, $channel); - break; + case 'feed': + $term = taxonomy_get_term($tids[0]); + $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE); + $channel['title'] = variable_get('site_name', 'drupal') .' - '. $title; + $channel['description'] = $term->description; - default: - drupal_not_found(); + $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE); + node_feed($result, $channel); + break; + default: + drupal_not_found(); + } } } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 819194da4..0b20db1e4 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -855,44 +855,45 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { drupal_not_found(); } - // Build title: - $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids)); - $names = array(); - while ($term = db_fetch_object($result)) { - $names[] = $term->name; - } - $title = implode(', ', $names); - - switch ($op) { - case 'page': - // Build breadcrumb based on first hierarchy of first term: - $current->tid = $tids[0]; - $breadcrumbs = array(array('path' => $_GET['q'])); - while ($parents = taxonomy_get_parents($current->tid)) { - $current = array_shift($parents); - $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name); - } - $breadcrumbs = array_reverse($breadcrumbs); - menu_set_location($breadcrumbs); - - drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed') .'" />'); + if ($tids) { + // Build title: + $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids)); + $names = array(); + while ($term = db_fetch_object($result)) { + $names[] = $term->name; + } + $title = implode(', ', $names); + + switch ($op) { + case 'page': + // Build breadcrumb based on first hierarchy of first term: + $current->tid = $tids[0]; + $breadcrumbs = array(array('path' => $_GET['q'])); + while ($parents = taxonomy_get_parents($current->tid)) { + $current = array_shift($parents); + $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name); + } + $breadcrumbs = array_reverse($breadcrumbs); + menu_set_location($breadcrumbs); - $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE)); - print theme('page', $output, $title); - break; + drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed') .'" />'); - case 'feed': - $term = taxonomy_get_term($tids[0]); - $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE); - $channel['title'] = variable_get('site_name', 'drupal') .' - '. $title; - $channel['description'] = $term->description; + $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE)); + print theme('page', $output, $title); + break; - $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE); - node_feed($result, $channel); - break; + case 'feed': + $term = taxonomy_get_term($tids[0]); + $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE); + $channel['title'] = variable_get('site_name', 'drupal') .' - '. $title; + $channel['description'] = $term->description; - default: - drupal_not_found(); + $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE); + node_feed($result, $channel); + break; + default: + drupal_not_found(); + } } } |