Changeset 11788
- Timestamp:
- 08/08/2009 07:22:19 AM (16 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/plugin-editor.php
r11671 r11788 10 10 require_once('admin.php'); 11 11 12 if ( !current_user_can('edit_plugins') ) 13 wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>'); 14 12 15 $title = __("Edit Plugins"); 13 16 $parent_file = 'plugins.php'; … … 34 37 $file = validate_file_to_edit($file, $plugin_files); 35 38 $real_file = WP_PLUGIN_DIR . '/' . $file; 39 $scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0; 36 40 37 41 switch ( $action ) { … … 40 44 41 45 check_admin_referer('edit-plugin_' . $file); 42 43 if ( !current_user_can('edit_plugins') )44 wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');45 46 46 47 $newcontent = stripslashes($_POST['newcontent']); … … 54 55 if ( is_plugin_active($file) ) 55 56 deactivate_plugins($file, true); 56 wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1 "));57 wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto")); 57 58 exit; 58 59 } 59 wp_redirect("plugin-editor.php?file=$file&a=te ");60 } else { 61 wp_redirect("plugin-editor.php?file=$file ");60 wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto"); 61 } else { 62 wp_redirect("plugin-editor.php?file=$file&scrollto=$scrollto"); 62 63 } 63 64 exit; … … 66 67 67 68 default: 68 69 if ( !current_user_can('edit_plugins') )70 wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');71 69 72 70 if ( isset($_GET['liveupdate']) ) { … … 80 78 activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error 81 79 82 wp_redirect("plugin-editor.php?file=$file&a=te ");80 wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto"); 83 81 exit; 84 82 } … … 206 204 <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" /> 207 205 <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" /> 206 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> 208 207 </div> 209 208 <?php if ( !empty( $docs_select ) ) : ?> … … 228 227 <br class="clear" /> 229 228 </div> 229 <script type="text/javascript"> 230 /* <![CDATA[ */ 231 jQuery(document).ready(function($){ 232 $('#template').submit(function(){ $('#scrollto').val( $('#newcontent').scrollTop() ); }); 233 $('#newcontent').scrollTop( $('#scrollto').val() ); 234 }); 235 /* ]]> */ 236 </script> 230 237 <?php 231 238 break; -
trunk/wp-admin/theme-editor.php
r11647 r11788 10 10 require_once('admin.php'); 11 11 12 if ( !current_user_can('edit_themes') ) 13 wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>'); 14 12 15 $title = __("Edit Themes"); 13 16 $parent_file = 'themes.php'; … … 37 40 $file = validate_file_to_edit($file, $allowed_files); 38 41 $real_file = get_real_file_to_edit($file); 42 $scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0; 39 43 40 44 $file_show = basename( $file ); … … 45 49 46 50 check_admin_referer('edit-theme_' . $file . $theme); 47 48 if ( !current_user_can('edit_themes') )49 wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');50 51 51 52 $newcontent = stripslashes($_POST['newcontent']); … … 57 58 fwrite($f, $newcontent); 58 59 fclose($f); 59 $location = "theme-editor.php?file=$file&theme=$theme&a=te ";60 $location = "theme-editor.php?file=$file&theme=$theme&a=te&scrollto=$scrollto"; 60 61 } else { 61 $location = "theme-editor.php?file=$file&theme=$theme ";62 $location = "theme-editor.php?file=$file&theme=$theme&scrollto=$scrollto"; 62 63 } 63 64 } else { 64 $location = "theme-editor.php?file=$file&theme=$theme ";65 $location = "theme-editor.php?file=$file&theme=$theme&scrollto=$scrollto"; 65 66 } 66 67 … … 74 75 75 76 default: 76 77 if ( !current_user_can('edit_themes') )78 wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');79 77 80 78 if ( use_codepress() ) … … 202 200 <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" /> 203 201 <input type="hidden" name="theme" value="<?php echo esc_attr($theme) ?>" /> 202 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> 204 203 </div> 205 204 <?php if ( isset($functions ) && count($functions) ) { ?> … … 230 229 <br class="clear" /> 231 230 </div> 231 <script type="text/javascript"> 232 /* <![CDATA[ */ 233 jQuery(document).ready(function($){ 234 $('#template').submit(function(){ $('#scrollto').val( $('#newcontent').scrollTop() ); }); 235 $('#newcontent').scrollTop( $('#scrollto').val() ); 236 }); 237 /* ]]> */ 238 </script> 232 239 <?php 233 240 break;
Note: See TracChangeset
for help on using the changeset viewer.