Changeset 23416 for trunk/wp-admin/includes/comment.php
- Timestamp:
- 02/14/2013 10:51:06 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/comment.php
r23350 r23416 20 20 global $wpdb; 21 21 22 $comment_author = stripslashes($comment_author);23 $comment_date = stripslashes($comment_date);24 25 22 return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments 26 23 WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) ); … … 34 31 function edit_comment() { 35 32 36 if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) ) 33 $post_data = wp_unslash( $_POST ); 34 35 if ( ! current_user_can( 'edit_comment', (int) $post_data['comment_ID'] ) ) 37 36 wp_die ( __( 'You are not allowed to edit comments on this post.' ) ); 38 37 39 $ _POST['comment_author'] = $_POST['newcomment_author'];40 $ _POST['comment_author_email'] = $_POST['newcomment_author_email'];41 $ _POST['comment_author_url'] = $_POST['newcomment_author_url'];42 $ _POST['comment_approved'] = $_POST['comment_status'];43 $ _POST['comment_content'] = $_POST['content'];44 $ _POST['comment_ID'] = (int) $_POST['comment_ID'];38 $post_data['comment_author'] = $post_data['newcomment_author']; 39 $post_data['comment_author_email'] = $post_data['newcomment_author_email']; 40 $post_data['comment_author_url'] = $post_data['newcomment_author_url']; 41 $post_data['comment_approved'] = $post_data['comment_status']; 42 $post_data['comment_content'] = $post_data['content']; 43 $post_data['comment_ID'] = (int) $post_data['comment_ID']; 45 44 46 45 foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) { 47 if ( !empty( $ _POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {46 if ( !empty( $post_data['hidden_' . $timeunit] ) && $post_data['hidden_' . $timeunit] != $post_data[$timeunit] ) { 48 47 $_POST['edit_date'] = '1'; 49 48 break; … … 51 50 } 52 51 53 if ( !empty ( $ _POST['edit_date'] ) ) {54 $aa = $ _POST['aa'];55 $mm = $ _POST['mm'];56 $jj = $ _POST['jj'];57 $hh = $ _POST['hh'];58 $mn = $ _POST['mn'];59 $ss = $ _POST['ss'];52 if ( !empty ( $post_data['edit_date'] ) ) { 53 $aa = $post_data['aa']; 54 $mm = $post_data['mm']; 55 $jj = $post_data['jj']; 56 $hh = $post_data['hh']; 57 $mn = $post_data['mn']; 58 $ss = $post_data['ss']; 60 59 $jj = ($jj > 31 ) ? 31 : $jj; 61 60 $hh = ($hh > 23 ) ? $hh -24 : $hh; 62 61 $mn = ($mn > 59 ) ? $mn -60 : $mn; 63 62 $ss = ($ss > 59 ) ? $ss -60 : $ss; 64 $ _POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";63 $post_data['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; 65 64 } 66 65 67 wp_update_comment( $ _POST);66 wp_update_comment( $post_data ); 68 67 } 69 68
Note: See TracChangeset
for help on using the changeset viewer.