WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/02/2007 06:45:47 PM (13 years ago)
Author:
markjaquith
Message:

prepare() for wp-includes/ link-template.php, post.php, general-template.php, pluggable.php, functions.php. see #4553

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r6152 r6180  
    368368        $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id ";
    369369        $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=tt_ids');
    370         $join .= ' AND (tr.term_taxonomy_id = ' . intval($cat_array[0]);
     370        $join .= $wpdb->prepare(' AND (tr.term_taxonomy_id = %d', $cat_array[0]);
    371371        for ( $i = 1; $i < (count($cat_array)); $i++ ) {
    372             $join .= ' OR tr.term_taxonomy_id = ' . intval($cat_array[$i]);
     372            $join .= $wpdb->prepare(' OR tr.term_taxonomy_id = %d', $cat_array[$i]);
    373373        }
    374374        $join .= ')';
     
    383383
    384384    $join  = apply_filters( 'get_previous_post_join', $join, $in_same_cat, $excluded_categories );
    385     $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 );
     385    $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 );
    386386    $sort  = apply_filters( 'get_previous_post_sort', 'ORDER BY p.post_date DESC LIMIT 1' );
    387387
     
    401401        $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id ";
    402402        $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=tt_ids');
    403         $join .= ' AND (tr.term_taxonomy_id = ' . intval($cat_array[0]);
     403        $join .= $wpdb->prepare(' AND (tr.term_taxonomy_id = %d', $cat_array[0]);
    404404        for ( $i = 1; $i < (count($cat_array)); $i++ ) {
    405             $join .= ' OR tr.term_taxonomy_id = ' . intval($cat_array[$i]);
     405            $join .= $wpdb->prepare(' OR tr.term_taxonomy_id = $d', $cat_array[$i]);
    406406        }
    407407        $join .= ')';
     
    416416
    417417    $join  = apply_filters( 'get_next_post_join', $join, $in_same_cat, $excluded_categories );
    418     $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 );
     418    $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 );
    419419    $sort  = apply_filters( 'get_next_post_sort', 'ORDER BY p.post_date ASC LIMIT 1' );
    420420
Note: See TracChangeset for help on using the changeset viewer.