Changeset 10731 for trunk/wp-includes/comment.php
- Timestamp:
- 03/06/2009 05:06:15 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/comment.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r10730 r10731 881 881 $comment_type = ''; 882 882 883 $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->comments 884 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_karma, comment_approved, comment_agent, comment_type, comment_parent, user_id) 885 VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %d, %s, %s, %s, %d, %d)", 886 $comment_post_ID, $comment_author, $comment_author_email, $comment_author_url, $comment_author_IP, $comment_date, $comment_date_gmt, $comment_content, $comment_karma, $comment_approved, $comment_agent, $comment_type, $comment_parent, $user_id) ); 883 $data = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id'); 884 $wpdb->insert($wpdb->comments, $data); 887 885 888 886 $id = (int) $wpdb->insert_id; 889 887 890 if ( $comment_approved == 1 )888 if ( $comment_approved == 1 ) 891 889 wp_update_comment_count($comment_post_ID); 892 890 … … 1081 1079 1082 1080 // Escape data pulled from DB. 1083 foreach ( (array) $comment as $key => $value ) 1084 $comment[$key] = $wpdb->escape($value); 1081 $comment = $wpdb->escape($comment); 1085 1082 1086 1083 // Merge old and new fields with new fields overwriting old ones. … … 1103 1100 $comment_approved = 1; 1104 1101 1105 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->comments SET 1106 comment_content = %s, 1107 comment_author = %s, 1108 comment_author_email = %s, 1109 comment_approved = %s, 1110 comment_karma = %d, 1111 comment_author_url = %s, 1112 comment_date = %s, 1113 comment_date_gmt = %s 1114 WHERE comment_ID = %d", 1115 $comment_content, 1116 $comment_author, 1117 $comment_author_email, 1118 $comment_approved, 1119 $comment_karma, 1120 $comment_author_url, 1121 $comment_date, 1122 $comment_date_gmt, 1123 $comment_ID) ); 1102 $data = compact('comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt'); 1103 $wpdb->update($wpdb->comments, $data, compact('comment_ID')); 1124 1104 1125 1105 $rval = $wpdb->rows_affected; … … 1220 1200 $old = (int) $post->comment_count; 1221 1201 $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) ); 1222 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $new,$post_id) );1202 $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) ); 1223 1203 1224 1204 if ( 'page' == $post->post_type )
Note: See TracChangeset
for help on using the changeset viewer.