Add some plugin activation validation.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-11-08 02:20:02 +00:00
parent 911d3a1403
commit a25c8cb077
1 changed files with 9 additions and 4 deletions

View File

@ -5,12 +5,17 @@ if ( isset($_GET['action']) ) {
if ('activate' == $_GET['action']) {
check_admin_referer('activate-plugin_' . $_GET['plugin']);
$current = get_option('active_plugins');
if (!in_array($_GET['plugin'], $current)) {
$current[] = trim( $_GET['plugin'] );
$plugin = trim($_GET['plugin']);
if ( validate_file($plugin) )
wp_die(__('Invalid plugin.'));
if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
wp_die(__('Plugin file does not exist.'));
if (!in_array($plugin, $current)) {
$current[] = $plugin;
sort($current);
update_option('active_plugins', $current);
include(ABSPATH . PLUGINDIR . '/' . trim( $_GET['plugin'] ));
do_action('activate_' . trim( $_GET['plugin'] ));
include(ABSPATH . PLUGINDIR . '/' . $plugin);
do_action('activate_' . $plugin);
}
wp_redirect('plugins.php?activate=true');
} else if ('deactivate' == $_GET['action']) {