- Bugfix: using non numeric terms in taxonomy-page URLs would result in SQL errors.
parent
34fc0b882d
commit
4e3a3aaed0
|
@ -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) {
|
switch ($op) {
|
||||||
case 'page':
|
case 'page':
|
||||||
// Build breadcrumb based on first hierarchy of first term:
|
// Build breadcrumb based on first hierarchy of first term:
|
||||||
$current->tid = $tids[0];
|
$current->tid = $tids[0];
|
||||||
$breadcrumbs = array(array('path' => $_GET['q']));
|
$breadcrumbs = array(array('path' => $_GET['q']));
|
||||||
while ($parents = taxonomy_get_parents($current->tid)) {
|
while ($parents = taxonomy_get_parents($current->tid)) {
|
||||||
$current = array_shift($parents);
|
$current = array_shift($parents);
|
||||||
$breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
|
$breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
|
||||||
}
|
}
|
||||||
$breadcrumbs = array_reverse($breadcrumbs);
|
$breadcrumbs = array_reverse($breadcrumbs);
|
||||||
menu_set_location($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));
|
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
|
||||||
print theme('page', $output, $title);
|
print theme('page', $output, $title);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'feed':
|
case 'feed':
|
||||||
$term = taxonomy_get_term($tids[0]);
|
$term = taxonomy_get_term($tids[0]);
|
||||||
$channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
|
$channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
|
||||||
$channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
|
$channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
|
||||||
$channel['description'] = $term->description;
|
$channel['description'] = $term->description;
|
||||||
|
|
||||||
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
|
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
|
||||||
node_feed($result, $channel);
|
node_feed($result, $channel);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
default:
|
drupal_not_found();
|
||||||
drupal_not_found();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
switch ($op) {
|
||||||
case 'page':
|
case 'page':
|
||||||
// Build breadcrumb based on first hierarchy of first term:
|
// Build breadcrumb based on first hierarchy of first term:
|
||||||
$current->tid = $tids[0];
|
$current->tid = $tids[0];
|
||||||
$breadcrumbs = array(array('path' => $_GET['q']));
|
$breadcrumbs = array(array('path' => $_GET['q']));
|
||||||
while ($parents = taxonomy_get_parents($current->tid)) {
|
while ($parents = taxonomy_get_parents($current->tid)) {
|
||||||
$current = array_shift($parents);
|
$current = array_shift($parents);
|
||||||
$breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
|
$breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
|
||||||
}
|
}
|
||||||
$breadcrumbs = array_reverse($breadcrumbs);
|
$breadcrumbs = array_reverse($breadcrumbs);
|
||||||
menu_set_location($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));
|
$output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE));
|
||||||
print theme('page', $output, $title);
|
print theme('page', $output, $title);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'feed':
|
case 'feed':
|
||||||
$term = taxonomy_get_term($tids[0]);
|
$term = taxonomy_get_term($tids[0]);
|
||||||
$channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
|
$channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, NULL, NULL, TRUE);
|
||||||
$channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
|
$channel['title'] = variable_get('site_name', 'drupal') .' - '. $title;
|
||||||
$channel['description'] = $term->description;
|
$channel['description'] = $term->description;
|
||||||
|
|
||||||
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
|
$result = taxonomy_select_nodes($tids, $operator, $depth, FALSE);
|
||||||
node_feed($result, $channel);
|
node_feed($result, $channel);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
default:
|
drupal_not_found();
|
||||||
drupal_not_found();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue