Make WordPress Core


Ignore:
Timestamp:
06/21/2013 05:54:40 AM (12 years ago)
Author:
nacin
Message:

More robust escaping in the plugin/theme upgrader.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-upgrader.php

    r24313 r24474  
    100100                default:
    101101                    if ( ! $wp_filesystem->find_folder($dir) )
    102                         return new WP_Error('fs_no_folder', sprintf($this->strings['fs_no_folder'], $dir));
     102                        return new WP_Error( 'fs_no_folder', sprintf( $this->strings['fs_no_folder'], esc_html( basename( $dir ) ) ) );
    103103                    break;
    104104            }
     
    11451145            foreach ( $errors->get_error_messages() as $message ) {
    11461146                if ( $errors->get_error_data() )
    1147                     $this->feedback($message . ' ' . $errors->get_error_data() );
     1147                    $this->feedback($message . ' ' . esc_html( $errors->get_error_data() ) );
    11481148                else
    11491149                    $this->feedback($message);
     
    11591159            $args = func_get_args();
    11601160            $args = array_splice($args, 1);
    1161             if ( !empty($args) )
     1161            if ( $args ) {
     1162                $args = array_map( 'strip_tags', $args );
     1163                $args = array_map( 'esc_html', $args );
    11621164                $string = vsprintf($string, $args);
     1165            }
    11631166        }
    11641167        if ( empty($string) )
     
    12001203        $this->plugin = $this->upgrader->plugin_info();
    12011204        if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
    1202             echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) .'"></iframe>';
     1205            echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) .'"></iframe>';
    12031206        }
    12041207
    12051208        $update_actions =  array(
    1206             'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
     1209            'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
    12071210            'plugins_page' => '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
    12081211        );
     
    12561259            $args = func_get_args();
    12571260            $args = array_splice($args, 1);
    1258             if ( !empty($args) )
     1261            if ( $args ) {
     1262                $args = array_map( 'strip_tags', $args );
     1263                $args = array_map( 'esc_html', $args );
    12591264                $string = vsprintf($string, $args);
     1265            }
    12601266        }
    12611267        if ( empty($string) )
     
    12811287            foreach ( $error->get_error_messages() as $emessage ) {
    12821288                if ( $error->get_error_data() )
    1283                     $messages[] = $emessage . ' ' . $error->get_error_data();
     1289                    $messages[] = $emessage . ' ' . esc_html( $error->get_error_data() );
    12841290                else
    12851291                    $messages[] = $emessage;
     
    14431449
    14441450        if ( 'import' == $from )
    1445             $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;from=import&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin &amp; Run Importer') . '</a>';
     1451            $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;from=import&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin &amp; Run Importer') . '</a>';
    14461452        else
    1447             $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>';
     1453            $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>';
    14481454
    14491455        if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
    1450             $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" target="_parent">' . __('Network Activate') . '</a>';
     1456            $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" target="_parent">' . __('Network Activate') . '</a>';
    14511457            unset( $install_actions['activate_plugin'] );
    14521458        }
Note: See TracChangeset for help on using the changeset viewer.