Skip to content
Snippets Groups Projects
Commit 4e3a3aae authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Bugfix: using non numeric terms in taxonomy-page URLs would result in SQL errors.
parent 34fc0b88
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -855,44 +855,45 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { ...@@ -855,44 +855,45 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
drupal_not_found(); drupal_not_found();
} }
// Build title: if ($tids) {
$result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids)); // Build title:
$names = array(); $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids));
while ($term = db_fetch_object($result)) { $names = array();
$names[] = $term->name; while ($term = db_fetch_object($result)) {
} $names[] = $term->name;
$title = implode(', ', $names); }
$title = implode(', ', $names);
switch ($op) {
case 'page': switch ($op) {
// Build breadcrumb based on first hierarchy of first term: case 'page':
$current->tid = $tids[0]; // Build breadcrumb based on first hierarchy of first term:
$breadcrumbs = array(array('path' => $_GET['q'])); $current->tid = $tids[0];
while ($parents = taxonomy_get_parents($current->tid)) { $breadcrumbs = array(array('path' => $_GET['q']));
$current = array_shift($parents); while ($parents = taxonomy_get_parents($current->tid)) {
$breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name); $current = array_shift($parents);
} $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
$breadcrumbs = array_reverse($breadcrumbs); }
menu_set_location($breadcrumbs); $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') .'" />');
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE)); drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed') .'" />');
print theme('page', $output, $title);
break;
case 'feed': $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
$term = taxonomy_get_term($tids[0]); print theme('page', $output, $title);
$channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE); break;
$channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
$channel['description'] = $term->description;
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE); case 'feed':
node_feed($result, $channel); $term = taxonomy_get_term($tids[0]);
break; $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
$channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
$channel['description'] = $term->description;
default: $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
drupal_not_found(); node_feed($result, $channel);
break;
default:
drupal_not_found();
}
} }
} }
......
...@@ -855,44 +855,45 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { ...@@ -855,44 +855,45 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
drupal_not_found(); drupal_not_found();
} }
// Build title: if ($tids) {
$result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids)); // Build title:
$names = array(); $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids));
while ($term = db_fetch_object($result)) { $names = array();
$names[] = $term->name; while ($term = db_fetch_object($result)) {
} $names[] = $term->name;
$title = implode(', ', $names); }
$title = implode(', ', $names);
switch ($op) {
case 'page': switch ($op) {
// Build breadcrumb based on first hierarchy of first term: case 'page':
$current->tid = $tids[0]; // Build breadcrumb based on first hierarchy of first term:
$breadcrumbs = array(array('path' => $_GET['q'])); $current->tid = $tids[0];
while ($parents = taxonomy_get_parents($current->tid)) { $breadcrumbs = array(array('path' => $_GET['q']));
$current = array_shift($parents); while ($parents = taxonomy_get_parents($current->tid)) {
$breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name); $current = array_shift($parents);
} $breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
$breadcrumbs = array_reverse($breadcrumbs); }
menu_set_location($breadcrumbs); $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') .'" />');
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE)); drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed') .'" />');
print theme('page', $output, $title);
break;
case 'feed': $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
$term = taxonomy_get_term($tids[0]); print theme('page', $output, $title);
$channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE); break;
$channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
$channel['description'] = $term->description;
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE); case 'feed':
node_feed($result, $channel); $term = taxonomy_get_term($tids[0]);
break; $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
$channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
$channel['description'] = $term->description;
default: $result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
drupal_not_found(); node_feed($result, $channel);
break;
default:
drupal_not_found();
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment