X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/d3b1ea255664edd2deef17f900a655613d20820d..3f5685912e89eb3b0534acd85aa0946b1ca2bbe3:/wp-admin/plugin-editor.php diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index e297ef4c..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,13 +79,10 @@ 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; } - if ( use_codepress() ) - wp_enqueue_script( 'codepress' ); - // List of allowable extensions $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions); @@ -111,12 +108,14 @@ default: if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { $functions = wp_doc_link_parse( $content ); - $docs_select = ''; + $docs_select .= ''; + foreach ( $functions as $function) { + $docs_select .= ''; + } + $docs_select .= ''; } - $docs_select .= ''; } $content = htmlspecialchars( $content ); @@ -136,8 +135,25 @@ default:

-
-
+ +
+
+%s (active)'), $file); + else + echo sprintf(__('Browsing %s (active)'), $file); + } else { + if ( is_writeable($real_file) ) + echo sprintf(__('Editing %s (inactive)'), $file); + else + echo sprintf(__('Browsing %s (inactive)'), $file); + } + ?> +
+
+ +
- +
@@ -221,10 +222,18 @@ foreach ( $plugin_files as $plugin_file ) :

the Codex for more information.'); ?>

- -
 
+ +
+ +include("admin-footer.php");