WordPress.org

Make WordPress Core

Ticket #9393: 9393_theme-install.patch

File 9393_theme-install.patch, 2.6 KB (added by Viper007Bond, 9 years ago)

Notice fixes for the theme installer

  • wp-admin/includes/theme-install.php

     
    9696 *
    9797 * @param string $page
    9898 */
    99 function install_theme_search($page) {
     99function install_theme_search( $page ) {
     100        global $theme_field_defaults;
     101
    100102        $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
    101103        $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
    102104
     
    362364 * @param string $page
    363365 * @param int $totalpages Number of pages.
    364366 */
    365 function display_themes($themes, $page = 1, $totalpages = 1) {
     367function display_themes( $themes, $page = 1, $totalpages = 1 ) {
    366368        global $themes_allowedtags;
    367369
    368370        $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
     
    419421                if ( $col == 1 ) $class[] = 'left';
    420422                if ( $row == $rows ) $class[] = 'bottom';
    421423                if ( $col == 3 ) $class[] = 'right';
    422                 $theme = $themes[$theme_index];
     424                $theme = ( isset($themes[$theme_index]) ) ? $themes[$theme_index] : '';
    423425                ?>
    424426                <td class="<?php echo join(' ', $class); ?>"><?php
    425427                        display_theme($theme);
     
    476478        $type = 'install';
    477479        // Check to see if this theme is known to be installed, and has an update awaiting it.
    478480        $update_themes = get_transient('update_themes');
    479         if ( is_object($update_themes) ) {
    480                 foreach ( (array)$update_themes->response as $file => $theme ) {
     481        if ( is_object($update_themes) && isset($update_themes->response) ) {
     482                foreach ( (array) $update_themes->response as $file => $theme ) {
    481483                        if ( $theme->slug === $api->slug ) {
    482484                                $type = 'update_available';
    483485                                $update_file = $file;
     
    618620                return;
    619621        }
    620622
    621         $theme = isset($_REQUEST['theme']) ? stripslashes( $_REQUEST['theme'] ) : '';
     623        $theme        = isset($_REQUEST['theme'])        ? stripslashes( $_REQUEST['theme'] )        : '';
     624        $theme_name   = isset($_REQUEST['theme_name'])   ? stripslashes( $_REQUEST['theme_name'] )   : '';
     625        $download_url = isset($_REQUEST['download_url']) ? stripslashes( $_REQUEST['download_url'] ) : '';
    622626
    623627        $url = 'theme-install.php?tab=install';
    624         $url = add_query_arg(array('theme' => $theme, 'theme_name' => stripslashes( $_REQUEST['theme_name'] ), 'download_url' => stripslashes( $_REQUEST['download_url'] ) ), $url);
     628        $url = add_query_arg(array('theme' => $theme, 'theme_name' => $theme_name, 'download_url' => $download_url ), $url);
    625629
    626630        $url = wp_nonce_url($url, 'install-theme_' . $theme);
    627631        if ( false === ($credentials = request_filesystem_credentials($url)) )