Make WordPress Core

Ticket #28926: 28926.patch

File 28926.patch, 1.3 KB (added by michalzuber, 11 years ago)
  • src/wp-includes/theme.php

     
    10401040        if ( 'remove-header' == $url )
    10411041                return false;
    10421042
     1043        if ( ! is_file( str_replace( get_site_url(), ABSPATH, $url ) ) )
     1044                return false;
     1045
    10431046        if ( is_random_header_image() )
    10441047                $url = get_random_header_image();
    10451048
     
    11491152        $header_images = array();
    11501153
    11511154        // @todo caching
    1152         $headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option('stylesheet'), 'orderby' => 'none', 'nopaging' => true ) );
     1155        $headers = get_posts( array(
     1156                'post_type'  => 'attachment',
     1157                'meta_key'   => '_wp_attachment_is_custom_header',
     1158                'meta_value' => get_option('stylesheet'),
     1159                'orderby'    => 'none',
     1160                'nopaging'   => true,
     1161        ) );
    11531162
    11541163        if ( empty( $headers ) )
    11551164                return array();
     
    11561165
    11571166        foreach ( (array) $headers as $header ) {
    11581167                $url = esc_url_raw( wp_get_attachment_url( $header->ID ) );
     1168                if ( ! is_file( str_replace( get_site_url(), ABSPATH, $url ) ) )
     1169                        continue;
     1170
    11591171                $header_data = wp_get_attachment_metadata( $header->ID );
    11601172                $header_index = basename($url);
    11611173                $header_images[$header_index] = array();