Ticket #6871: 6871 version 2.diff
| File 6871 version 2.diff, 2.6 KB (added by , 18 years ago) |
|---|
-
wp-admin/includes/plugin.php
176 176 return; 177 177 } 178 178 179 //Invalid is any plugins which are deactivated due to error. 180 $invalid = array(); 181 179 182 // If a plugin file does not exist, remove it from the list of active 180 183 // plugins. 181 184 foreach ( $check_plugins as $check_plugin ) { 182 if ( !file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin) ) { 183 $current = get_option('active_plugins'); 184 $key = array_search($check_plugin, $current); 185 if ( false !== $key && NULL !== $key ) { 186 unset($current[$key]); 187 update_option('active_plugins', $current); 188 } 185 $result = validate_plugin($check_plugin); 186 if ( is_wp_error( $result ) ) { 187 $invalid[ $check_plugin ] = $result; 188 deactivate_plugins( $check_plugin, true); 189 189 } 190 190 } 191 192 return $invalid; 191 193 } 192 194 193 195 function validate_plugin($plugin) { 194 196 if ( validate_file($plugin) ) 195 197 return new WP_Error('plugin_invalid', __('Invalid plugin.')); 198 196 199 if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) 197 200 return new WP_Error('plugin_not_found', __('Plugin file does not exist.')); 198 201 202 $plugins = get_plugins(); 203 if ( ! isset($plugins[ $plugin ]) ) 204 return new WP_Error('plugin_not_proper', __('Invalid plugin.')); 205 199 206 return 0; 200 207 } 201 208 -
wp-admin/plugins.php
39 39 $title = __('Manage Plugins'); 40 40 require_once('admin-header.php'); 41 41 42 validate_active_plugins(); 42 $invalid = validate_active_plugins(); 43 if( ! empty($invalid) ) 44 foreach($invalid as $plugin_file => $error) 45 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>' 43 46 44 47 ?> 45 48 -
wp-settings.php
353 353 $current_plugins = get_option('active_plugins'); 354 354 if ( is_array($current_plugins) ) { 355 355 foreach ($current_plugins as $plugin) { 356 if ('' != $plugin && file_exists(ABSPATH . PLUGINDIR . '/' . $plugin))356 if ('' != $plugin && strpos($plugin,'/../') === false && substr($plugin,0,3) != '../' && file_exists(ABSPATH . PLUGINDIR . '/' . $plugin)) 357 357 include_once(ABSPATH . PLUGINDIR . '/' . $plugin); 358 358 } 359 359 }