Fix gallery shortcode orderby param for all SQL setups. Sanitize orderby. fixes #6476 for trunk

git-svn-id: https://develop.svn.wordpress.org/trunk@7592 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2008-04-03 03:05:49 +00:00
parent ecc7ec153a
commit ba4dab3cd6
3 changed files with 23 additions and 4 deletions

View File

@@ -460,6 +460,10 @@ function get_posts($args) {
if (!empty($exclusions))
$exclusions .= ')';
// orderby
if ( preg_match( '/.+ +(ASC|DESC)/i', $orderby ) )
$order = ''; // orderby has its own order, so we'll use that
$query = "SELECT DISTINCT * FROM $wpdb->posts ";
$query .= empty( $category ) ? '' : ", $wpdb->term_relationships, $wpdb->term_taxonomy ";
$query .= empty( $meta_key ) ? '' : ", $wpdb->postmeta ";