Changeset 3740
- Timestamp:
- 04/22/06 00:02:00 (3 years ago)
- Files:
-
- trunk/wp-includes/comment.php (modified) (1 diff)
- trunk/wp-includes/functions-post.php (modified) (3 diffs)
- trunk/wp-includes/template-functions-bookmarks.php (modified) (1 diff)
- trunk/wp-includes/template-functions-general.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/comment.php
r3714 r3740 61 61 function get_approved_comments($post_id) { 62 62 global $wpdb; 63 return $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '1' ORDER BY comment_date"); 63 64 $post_id = (int) $post_id; 65 return $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1' ORDER BY comment_date"); 64 66 } 65 67 trunk/wp-includes/functions-post.php
r3709 r3740 366 366 $postid = (int) $postid; 367 367 368 if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $postid") )368 if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$postid'") ) 369 369 return $post; 370 370 … … 375 375 $file = get_post_meta($postid, '_wp_attached_file', true); 376 376 377 $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid");378 379 $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid");380 381 $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid");382 383 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid");377 $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = '$postid'"); 378 379 $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = '$postid'"); 380 381 $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = '$postid'"); 382 383 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = '$postid'"); 384 384 385 385 if ( ! empty($meta['thumb']) ) { 386 386 // Don't delete the thumb if another attachment uses it 387 if (! $foo = $wpdb->get_row("SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE '%".$wpdb->escape($meta['thumb'])."%' AND post_id <> $postid"))387 if (! $foo = $wpdb->get_row("SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE '%".$wpdb->escape($meta['thumb'])."%' AND post_id <> '$postid'")) 388 388 @ unlink(str_replace(basename($file), $meta['thumb'], $file)); 389 389 } … … 482 482 global $wpdb; 483 483 484 $post_ID = (int) $post_ID; 485 484 486 $sql = "SELECT category_id 485 487 FROM $wpdb->post2cat 486 WHERE post_id = $post_ID488 WHERE post_id = '$post_ID' 487 489 ORDER BY category_id"; 488 490 trunk/wp-includes/template-functions-bookmarks.php
r3707 r3740 169 169 */ 170 170 function get_linkcatname($id = 0) { 171 $id = (int) $id; 172 171 173 if ( empty($id) ) 172 174 return ''; trunk/wp-includes/template-functions-general.php
r3681 r3740 502 502 // Get days with posts 503 503 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 504 FROM $wpdb->posts WHERE MONTH(post_date) = $thismonth505 AND YEAR(post_date) = $thisyear504 FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth' 505 AND YEAR(post_date) = '$thisyear' 506 506 AND post_type = 'post' AND post_status = 'publish' 507 507 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
