Make WordPress Core

Ticket #30307: 30307.2.patch

File 30307.2.patch, 2.3 KB (added by SergeyBiryukov, 11 years ago)
  • src/wp-admin/includes/comment.php

     
    3737        if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
    3838                wp_die ( __( 'You are not allowed to edit comments on this post.' ) );
    3939
     40        $comment_data = array();
     41
    4042        if ( isset( $_POST['newcomment_author'] ) )
    41                 $_POST['comment_author'] = $_POST['newcomment_author'];
     43                $comment_data['comment_author'] = $_POST['newcomment_author'];
    4244        if ( isset( $_POST['newcomment_author_email'] ) )
    43                 $_POST['comment_author_email'] = $_POST['newcomment_author_email'];
     45                $comment_data['comment_author_email'] = $_POST['newcomment_author_email'];
    4446        if ( isset( $_POST['newcomment_author_url'] ) )
    45                 $_POST['comment_author_url'] = $_POST['newcomment_author_url'];
     47                $comment_data['comment_author_url'] = $_POST['newcomment_author_url'];
    4648        if ( isset( $_POST['comment_status'] ) )
    47                 $_POST['comment_approved'] = $_POST['comment_status'];
     49                $comment_data['comment_approved'] = $_POST['comment_status'];
    4850        if ( isset( $_POST['content'] ) )
    49                 $_POST['comment_content'] = $_POST['content'];
     51                $comment_data['comment_content'] = $_POST['content'];
    5052        if ( isset( $_POST['comment_ID'] ) )
    51                 $_POST['comment_ID'] = (int) $_POST['comment_ID'];
     53                $comment_data['comment_ID'] = (int) $_POST['comment_ID'];
    5254
    53         foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
    54                 if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
    55                         $_POST['edit_date'] = '1';
     55        foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) {
     56                if ( ! empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
     57                        $comment_data['edit_date'] = '1';
    5658                        break;
    5759                }
    5860        }
    5961
    60         if ( !empty ( $_POST['edit_date'] ) ) {
     62        if ( ! empty( $comment_data['edit_date'] ) ) {
    6163                $aa = $_POST['aa'];
    6264                $mm = $_POST['mm'];
    6365                $jj = $_POST['jj'];
     
    6870                $hh = ($hh > 23 ) ? $hh -24 : $hh;
    6971                $mn = ($mn > 59 ) ? $mn -60 : $mn;
    7072                $ss = ($ss > 59 ) ? $ss -60 : $ss;
    71                 $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
     73                $comment_data['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
    7274        }
    7375
    74         wp_update_comment( $_POST );
     76        wp_update_comment( $comment_data );
    7577}
    7678
    7779/**