WordPress.org

Make WordPress Core

Ticket #9233: wp-app.php.diff

File wp-app.php.diff, 1.2 KB (added by josephscott, 9 years ago)
  • wp-app.php

     
    2626/** Feed Handling API */
    2727require_once(ABSPATH . WPINC . '/feed.php');
    2828
     29/** Image updates */
     30require_once(ABSPATH . '/wp-admin/includes/image.php');
     31
    2932$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
    3033
    3134/**
     
    814817                        $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
    815818                }
    816819
     820                $upload_dir = wp_upload_dir( );
    817821                $location = get_post_meta($entry['ID'], '_wp_attached_file', true);
    818822                $filetype = wp_check_filetype($location);
    819823
     824                $location = "{$upload_dir['basedir']}/{$location}";
     825
    820826                if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
    821827                        $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
    822828
     
    843849                        $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.'));
    844850                }
    845851
     852                wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) );
     853
    846854                log_app('function',"put_file($postID)");
    847855                $this->ok();
    848856        }