X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/98a4d31e52bd56c908617df281730bd4ba58d110..refs/tags/wordpress-2.9:/wp-admin/plugin-editor.php?ds=inline diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index 8b1602c3..05aa02a8 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -9,6 +9,9 @@ /** WordPress Administration Bootstrap */ require_once('admin.php'); +if ( !current_user_can('edit_plugins') ) + wp_die('

'.__('You do not have sufficient permissions to edit plugins for this blog.').'

'); + $title = __("Edit Plugins"); $parent_file = 'plugins.php'; @@ -19,7 +22,7 @@ wp_admin_css( 'theme-editor' ); $plugins = get_plugins(); if ( isset($_REQUEST['file']) ) - $plugin = $_REQUEST['file']; + $plugin = stripslashes($_REQUEST['file']); if ( empty($plugin) ) { $plugin = array_keys($plugins); @@ -30,9 +33,12 @@ $plugin_files = get_plugin_files($plugin); if ( empty($file) ) $file = $plugin_files[0]; +else + $file = stripslashes($file); $file = validate_file_to_edit($file, $plugin_files); $real_file = WP_PLUGIN_DIR . '/' . $file; +$scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0; switch ( $action ) { @@ -40,9 +46,6 @@ case 'update': check_admin_referer('edit-plugin_' . $file); - if ( !current_user_can('edit_plugins') ) - wp_die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); - $newcontent = stripslashes($_POST['newcontent']); if ( is_writeable($real_file) ) { $f = fopen($real_file, 'w+'); @@ -53,12 +56,12 @@ case 'update': if ( is_plugin_active($file) || isset($_POST['phperror']) ) { if ( is_plugin_active($file) ) deactivate_plugins($file, true); - wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1")); + wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto")); exit; } - wp_redirect("plugin-editor.php?file=$file&a=te"); + wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto"); } else { - wp_redirect("plugin-editor.php?file=$file"); + wp_redirect("plugin-editor.php?file=$file&scrollto=$scrollto"); } exit; @@ -66,9 +69,6 @@ break; default: - if ( !current_user_can('edit_plugins') ) - wp_die('

'.__('You do not have sufficient permissions to edit plugins for this blog.').'

'); - if ( isset($_GET['liveupdate']) ) { check_admin_referer('edit-plugin-test_' . $file); @@ -79,7 +79,7 @@ default: if ( ! is_plugin_active($file) ) activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error - wp_redirect("plugin-editor.php?file=$file&a=te"); + wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto"); exit; } @@ -202,6 +202,7 @@ foreach ( $plugin_files as $plugin_file ) : +
@@ -224,6 +225,14 @@ foreach ( $plugin_files as $plugin_file ) :
+