Make WordPress Core

Ticket #6871: 6871 version 4 for 2.6.diff

File 6871 version 4 for 2.6.diff, 1.9 KB (added by guillep2k, 18 years ago)

Tested with 2.6.

  • wp-admin/includes/plugin.php

     
    239239                return;
    240240        }
    241241
     242        //Invalid is any plugins which are deactivated due to error.
     243        $invalid = array();
     244
    242245        // If a plugin file does not exist, remove it from the list of active
    243246        // plugins.
    244247        foreach ( $check_plugins as $check_plugin ) {
    245248                $result = validate_plugin($check_plugin);
    246249                if ( is_wp_error( $result ) ) {
     250                        $invalid[ $check_plugin ] = $result;
    247251                        deactivate_plugins( $check_plugin, true);
    248252                }
    249253        }
     254       
     255        return $invalid;
    250256}
    251257
    252258function validate_plugin($plugin) {
  • wp-admin/plugins.php

     
    165165$title = __('Manage Plugins');
    166166require_once('admin-header.php');
    167167
    168 validate_active_plugins();
    169 
     168$invalid = validate_active_plugins();
     169if( !empty($invalid) )
     170        foreach($invalid as $plugin_file => $error)
     171                echo '<div id="message" class="updated fade"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to <em>"%s"</em>.'), $plugin_file, $error->get_error_message()) . '</p></div>';
    170172?>
    171173
    172174<?php if ( isset($_GET['error']) ) : ?>
  • wp-settings.php

     
    417417        $current_plugins = get_option('active_plugins');
    418418        if ( is_array($current_plugins) ) {
    419419                foreach ($current_plugins as $plugin) {
    420                         if ('' != $plugin && file_exists(WP_PLUGIN_DIR . '/' . $plugin))
     420                        if ('' != $plugin && strpos(str_replace('\\','/','/'.$plugin),'/../') === false && file_exists(WP_PLUGIN_DIR . '/' . $plugin))
    421421                                include_once(WP_PLUGIN_DIR . '/' . $plugin);
    422422                }
    423423        }