diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-23 18:28:40 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-23 18:28:40 +0000 |
commit | 87bb8cd69cc593fe6bed330fb1791eac9df87167 (patch) | |
tree | 6b2ad252df89d2a1863198fd44b321b59e42ef54 /wp-includes/link-template.php | |
parent | 0cbda3349a2571904ea063fdd73e018299919589 (diff) | |
download | wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.gz wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.xz wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.zip |
Merge with WordPress, rev 6285 and untested
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1125 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/link-template.php')
-rw-r--r-- | wp-includes/link-template.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 6a0677b..c3b7ed7 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -367,9 +367,9 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') { if ( $in_same_cat ) { $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id "; $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=tt_ids'); - $join .= ' AND (tr.term_taxonomy_id = ' . intval($cat_array[0]); + $join .= $wpdb->prepare(' AND (tr.term_taxonomy_id = %d', $cat_array[0]); for ( $i = 1; $i < (count($cat_array)); $i++ ) { - $join .= ' OR tr.term_taxonomy_id = ' . intval($cat_array[$i]); + $join .= $wpdb->prepare(' OR tr.term_taxonomy_id = %d', $cat_array[$i]); } $join .= ')'; } @@ -382,7 +382,7 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') { } $join = apply_filters( 'get_previous_post_join', $join, $in_same_cat, $excluded_categories ); - $where = apply_filters( 'get_previous_post_where', "WHERE p.post_date < '$current_post_date' AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql", $in_same_cat, $excluded_categories ); + $where = apply_filters( 'get_previous_post_where', $wpdb->prepare("WHERE p.post_date < %s AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date), $in_same_cat, $excluded_categories ); $sort = apply_filters( 'get_previous_post_sort', 'ORDER BY p.post_date DESC LIMIT 1' ); return @$wpdb->get_row("SELECT p.ID, p.post_title FROM $wpdb->posts AS p $join $where $sort"); @@ -400,9 +400,9 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') { if ( $in_same_cat ) { $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id "; $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=tt_ids'); - $join .= ' AND (tr.term_taxonomy_id = ' . intval($cat_array[0]); + $join .= $wpdb->prepare(' AND (tr.term_taxonomy_id = %d', $cat_array[0]); for ( $i = 1; $i < (count($cat_array)); $i++ ) { - $join .= ' OR tr.term_taxonomy_id = ' . intval($cat_array[$i]); + $join .= $wpdb->prepare(' OR tr.term_taxonomy_id = $d', $cat_array[$i]); } $join .= ')'; } @@ -415,7 +415,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') { } $join = apply_filters( 'get_next_post_join', $join, $in_same_cat, $excluded_categories ); - $where = apply_filters( 'get_next_post_where', "WHERE p.post_date > '$current_post_date' AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql AND p.ID != $post->ID", $in_same_cat, $excluded_categories ); + $where = apply_filters( 'get_next_post_where', $wpdb->prepare("WHERE p.post_date > %s AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql AND p.ID != %d", $current_post_date, $post->ID), $in_same_cat, $excluded_categories ); $sort = apply_filters( 'get_next_post_sort', 'ORDER BY p.post_date ASC LIMIT 1' ); return @$wpdb->get_row("SELECT p.ID, p.post_title FROM $wpdb->posts AS p $join $where $sort"); |