Ticket #6476: 6476.002.diff
File 6476.002.diff, 2.1 KB (added by , 16 years ago) |
---|
-
wp-includes/post.php
460 460 if (!empty($exclusions)) 461 461 $exclusions .= ')'; 462 462 463 // orderby 464 if ( preg_match( '/.+ (ASC|DESC)/i', $orderby ) ) 465 $order = ''; // orderby has its own order, so we'll use that 466 463 467 $query = "SELECT DISTINCT * FROM $wpdb->posts "; 464 468 $query .= empty( $category ) ? '' : ", $wpdb->term_relationships, $wpdb->term_taxonomy "; 465 469 $query .= empty( $meta_key ) ? '' : ", $wpdb->postmeta "; -
wp-includes/media.php
339 339 $output = apply_filters('post_gallery', '', $attr); 340 340 if ( $output != '' ) 341 341 return $output; 342 342 343 // We're trusting author input, so let's at least make sure it looks like a valid orderby statement 344 preg_match('/(^([a-z0-9_]+( +(ASC|DESC))?(, +?|$))+|RAND\(\))/i', $attr['orderby'], $obmatches); 345 if ( !$obmatches[0] ) 346 unset($attr['orderby']); 347 343 348 extract(shortcode_atts(array( 344 349 'orderby' => 'menu_order ASC, ID ASC', 345 350 'id' => $post->ID, … … 352 357 353 358 $id = intval($id); 354 359 $orderby = addslashes($orderby); 355 $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby= \"{$orderby}\"");360 $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}"); 356 361 357 362 if ( empty($attachments) ) 358 363 return ''; … … 426 431 function adjacent_image_link($prev = true) { 427 432 global $post; 428 433 $post = get_post($post); 429 $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby= \"menu_order ASC, ID ASC\""));434 $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC")); 430 435 431 436 foreach ( $attachments as $k => $attachment ) 432 437 if ( $attachment->ID == $post->ID )