Ticket #15764: 15764.diff
| File 15764.diff, 5.2 KB (added by , 15 years ago) |
|---|
-
wp-includes/taxonomy.php
1237 1237 } 1238 1238 1239 1239 if ( !empty($name__like) ) 1240 $where .= " AND t.name LIKE ' {$name__like}%'";1240 $where .= " AND t.name LIKE '" . like_escape( $name__like ) . "%'"; 1241 1241 1242 1242 if ( '' !== $parent ) { 1243 1243 $parent = (int) $parent; -
wp-includes/comment.php
345 345 * @return string 346 346 */ 347 347 function get_search_sql( $string, $cols ) { 348 $string = esc_sql( $string);348 $string = esc_sql( like_escape( $string ) ); 349 349 350 350 $searches = array(); 351 351 foreach ( $cols as $col ) -
wp-includes/functions.php
1206 1206 1207 1207 foreach ( $pung as $link_test ) { 1208 1208 if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post 1209 $mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test. '%') );1209 $mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $link_test ) . '%') ); 1210 1210 do_action( 'delete_postmeta', $mid ); 1211 1211 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN(%s)", implode( ',', $mid ) ) ); 1212 1212 do_action( 'deleted_postmeta', $mid ); … … 1226 1226 } 1227 1227 1228 1228 foreach ( (array) $post_links as $url ) { 1229 if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $url. '%' ) ) ) {1229 if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $url ) . '%' ) ) ) { 1230 1230 1231 1231 if ( $headers = wp_get_http_headers( $url) ) { 1232 1232 $len = (int) $headers['content-length']; -
wp-includes/class-wp-xmlrpc-server.php
3367 3367 } elseif ( is_string($urltest['fragment']) ) { 3368 3368 // ...or a string #title, a little more complicated 3369 3369 $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']); 3370 $sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title);3370 $sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", like_escape( $title ) ); 3371 3371 if (! ($post_ID = $wpdb->get_var($sql)) ) { 3372 3372 // returning unknown error '0' is better than die()ing 3373 3373 return new IXR_Error(0, ''); -
wp-includes/query.php
2045 2045 $n = !empty($q['exact']) ? '' : '%'; 2046 2046 $searchand = ''; 2047 2047 foreach( (array) $q['search_terms'] as $term ) { 2048 $term = addslashes_gpc($term);2048 $term = esc_sql( like_escape( $term ) ); 2049 2049 $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))"; 2050 2050 $searchand = ' AND '; 2051 2051 } 2052 $term = esc_sql( $q['s']);2052 $term = esc_sql( like_escape( $q['s'] ) ); 2053 2053 if ( empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) 2054 2054 $search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')"; 2055 2055 -
wp-includes/canonical.php
385 385 if ( !get_query_var('name') ) 386 386 return false; 387 387 388 $where = $wpdb->prepare("post_name LIKE %s", get_query_var('name') . '%');388 $where = $wpdb->prepare("post_name LIKE %s", like_escape( get_query_var('name') ) . '%'); 389 389 390 390 // if any of post_type, year, monthnum, or day are set, use them to refine the query 391 391 if ( get_query_var('post_type') ) -
wp-admin/admin-ajax.php
1246 1246 1247 1247 $searchand = $search = ''; 1248 1248 foreach ( (array) $search_terms as $term ) { 1249 $term = addslashes_gpc($term);1249 $term = esc_sql( like_escape( $term ) ); 1250 1250 $search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))"; 1251 1251 $searchand = ' AND '; 1252 1252 } 1253 $term = $wpdb->escape($s);1253 $term = esc_sql( like_escape( $s ) ); 1254 1254 if ( count($search_terms) > 1 && $search_terms[0] != $s ) 1255 1255 $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; 1256 1256