WordPress.org

Make WordPress Core

Changeset 17256


Ignore:
Timestamp:
01/11/11 20:15:25 (3 years ago)
Author:
ryan
Message:

Strip and prepare ajax tag search string. Avoids applying slashes toward the character count. Props brianlayman. see #13580

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r17255 r17256  
    8787    } 
    8888 
    89     $s = $_GET['q']; // is this slashed already? 
     89    $s = stripslashes( $_GET['q'] ); 
    9090 
    9191    if ( false !== strpos( $s, ',' ) ) { 
     
    9797        die; // require 2 chars for matching 
    9898 
    99     $results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = '$taxonomy' AND t.name LIKE ('%" . $s . "%')" ); 
     99    $results = $wpdb->get_col( $wpdb->prepare( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.name LIKE (%s)", $taxonomy, '%' . like_escape( $s ) . '%' ) ); 
    100100 
    101101    echo join( $results, "\n" ); 
Note: See TracChangeset for help on using the changeset viewer.