Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/wp-admin/includes/media.php

    r18018 r18366  
    229229        ), $post_data );
    230230
     231        // This should never be set as it would then overwrite an existing attachment.
     232        if ( isset( $attachment['ID'] ) )
     233                unset( $attachment['ID'] );
     234
    231235        // Save the data
    232236        $id = wp_insert_attachment($attachment, $file, $post_id);
    … …  
    281285                'post_content' => $content,
    282286        ), $post_data );
     287
     288        // This should never be set as it would then overwrite an existing attachment.
     289        if ( isset( $attachment['ID'] ) )
     290                unset( $attachment['ID'] );
    283291
    284292        // Save the attachment metadata
    … …  
    420428        if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
    421429                $post = $_post = get_post($attachment_id, ARRAY_A);
     430                $post_type_object = get_post_type_object( $post[ 'post_type' ] );
     431
     432                if ( !current_user_can( $post_type_object->cap->edit_post, $attachment_id ) )
     433                        continue;
     434
    422435                if ( isset($attachment['post_content']) )
    423436                        $post['post_content'] = $attachment['post_content'];
Note: See TracChangeset for help on using the changeset viewer.