- Bugfix: using non numeric terms in taxonomy-page URLs would result in SQL errors.

4.5.x
Dries Buytaert 2004-09-19 08:41:50 +00:00
parent 34fc0b882d
commit 4e3a3aaed0
2 changed files with 68 additions and 66 deletions

View File

@ -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);
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);
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') .'" />');
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));
print theme('page', $output, $title);
break;
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
print theme('page', $output, $title);
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;
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;
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
node_feed($result, $channel);
break;
default:
drupal_not_found();
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
node_feed($result, $channel);
break;
default:
drupal_not_found();
}
}
}

View File

@ -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);
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);
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') .'" />');
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));
print theme('page', $output, $title);
break;
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
print theme('page', $output, $title);
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;
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;
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
node_feed($result, $channel);
break;
default:
drupal_not_found();
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
node_feed($result, $channel);
break;
default:
drupal_not_found();
}
}
}