Changeset 15491 for trunk/wp-includes/comment.php
- Timestamp:
- 08/11/2010 09:54:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r13995 r15491 205 205 'type' => '', 206 206 'user_id' => '', 207 'search' => '', 208 'count' => false 207 209 ); 208 210 … … 236 238 $approved = "( comment_approved = '0' OR comment_approved = '1' )"; 237 239 238 $order = ( 'ASC' == $order) ? 'ASC' : 'DESC';240 $order = ( 'ASC' == strtoupper($order) ) ? 'ASC' : 'DESC'; 239 241 240 242 if ( ! empty( $orderby ) ) { … … 270 272 if ( !empty($number) ) { 271 273 if ( $offset ) 272 $ number= 'LIMIT ' . $offset . ',' . $number;274 $limit = 'LIMIT ' . $offset . ',' . $number; 273 275 else 274 $number = 'LIMIT ' . $number; 275 276 $limit = 'LIMIT ' . $number; 276 277 } else { 277 $ number= '';278 } 279 280 $post_where = '';278 $limit = ''; 279 } 280 281 $post_where = "WHERE $approved"; 281 282 282 283 if ( ! empty($post_id) ) 283 $post_where .= $wpdb->prepare( ' comment_post_ID = %d AND', $post_id );284 $post_where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id ); 284 285 if ( '' !== $author_email ) 285 $post_where .= $wpdb->prepare( ' comment_author_email = %s AND', $author_email );286 $post_where .= $wpdb->prepare( 'AND comment_author_email = %s', $author_email ); 286 287 if ( '' !== $karma ) 287 $post_where .= $wpdb->prepare( ' comment_karma = %d AND', $karma );288 $post_where .= $wpdb->prepare( 'AND comment_karma = %d', $karma ); 288 289 if ( 'comment' == $type ) 289 $post_where .= " comment_type = '' AND";290 $post_where .= " AND comment_type = ''"; 290 291 elseif ( ! empty( $type ) ) 291 $post_where .= $wpdb->prepare( ' comment_type = %s AND', $type );292 $post_where .= $wpdb->prepare( ' AND comment_type = %s', $type ); 292 293 if ( '' !== $parent ) 293 $post_where .= $wpdb->prepare( ' comment_parent = %d AND', $parent );294 $post_where .= $wpdb->prepare( ' AND comment_parent = %d', $parent ); 294 295 if ( '' !== $user_id ) 295 $post_where .= $wpdb->prepare( 'user_id = %d AND ', $user_id ); 296 297 $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE $post_where $approved ORDER BY $orderby $order $number" ); 296 $post_where .= $wpdb->prepare( ' AND user_id = %d', $user_id ); 297 if ( '' !== $search ) 298 $post_where .= _wp_search_sql($search, array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content')); 299 300 if ( $count ) 301 return $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments $post_where ORDER BY $orderby $order $limit" ); 302 303 $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments $post_where ORDER BY $orderby $order $limit" ); 304 298 305 wp_cache_add( $cache_key, $comments, 'comment' ); 299 306 … … 1283 1290 1284 1291 if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) ) 1285 wp_notify_postauthor($comment_ID, empty( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );1292 wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' ); 1286 1293 } 1287 1294
Note: See TracChangeset
for help on using the changeset viewer.