Ticket #5782: 5782.diff
| File 5782.diff, 6.0 KB (added by , 18 years ago) |
|---|
-
wp-includes/js/autosave.js
36 36 jQuery.post(autosaveL10n.requestFile, { 37 37 action: "autosave-generate-nonces", 38 38 post_ID: res, 39 cookie: document.cookie,39 autosavenonce: jQuery('#autosavenonce').val(), 40 40 post_type: jQuery('#post_type').val() 41 41 }, function(html) { 42 42 jQuery('#_wpnonce').val(html); … … 87 87 action: "autosave", 88 88 post_ID: jQuery("#post_ID").val() || 0, 89 89 post_title: jQuery("#title").val() || "", 90 cookie: document.cookie,90 autosavenonce: jQuery('#autosavenonce').val(), 91 91 tags_input: jQuery("#tags-input").val() || "", 92 92 post_type: jQuery('#post_type').val() || "" 93 93 }; … … 99 99 tinyMCE.triggerSave(); 100 100 } 101 101 102 post_data["content"] = jQuery("#content").val();102 post_data["content"] = jQuery("#content").val(); 103 103 104 104 if(post_data["post_title"].length==0 || post_data["content"].length==0 || post_data["post_title"] + post_data["content"] == autosaveLast) { 105 105 return; -
wp-includes/pluggable.php
635 635 * @uses do_action() Calls 'check_admin_referer' on $action. 636 636 * 637 637 * @param string $action Action nonce 638 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) 638 639 */ 639 function check_admin_referer($action = -1 ) {640 function check_admin_referer($action = -1, $query_arg = '_wpnonce' ) { 640 641 $adminurl = strtolower(get_option('siteurl')).'/wp-admin'; 641 642 $referer = strtolower(wp_get_referer()); 642 if ( !wp_verify_nonce($_REQUEST[ '_wpnonce'], $action) &&643 if ( !wp_verify_nonce($_REQUEST[$query_arg], $action) && 643 644 !(-1 == $action && strpos($referer, $adminurl) !== false)) { 644 645 wp_nonce_ays($action); 645 646 die(); … … 654 655 * @since 2.0.4 655 656 * 656 657 * @param string $action Action nonce 658 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) 657 659 */ 658 function check_ajax_referer( $action = -1 ) { 659 $nonce = $_REQUEST['_ajax_nonce'] ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce']; 660 if ( !wp_verify_nonce( $nonce, $action ) ) { 661 $current_id = ''; 662 if ( ( $current = wp_get_current_user() ) && $current->ID ) 663 $current_id = $current->ID; 664 if ( !$current_id ) 665 die('-1'); 660 function check_ajax_referer( $action = -1, $query_arg = false ) { 661 if ( $query_arg ) 662 $nonce = $_REQUEST[$query_arg]; 663 else 664 $nonce = $_REQUEST['_ajax_nonce'] ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce']; 666 665 667 $auth_cookie = ''; 668 $cookie = explode('; ', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie 669 foreach ( $cookie as $tasty ) { 670 if ( false !== strpos($tasty, AUTH_COOKIE . '=') ) { 671 $auth_cookie = substr(strstr($tasty, '='), 1); 672 break; 673 } 674 } 666 if ( !wp_verify_nonce( $nonce, $action ) ) 667 die('-1'); 675 668 676 if ( empty($auth_cookie) )677 die('-1');678 679 if ( ! $user_id = wp_validate_auth_cookie( $auth_cookie ) )680 die('-1');681 682 if ( $current_id != $user_id )683 die('-1');684 }685 669 do_action('check_ajax_referer'); 686 670 } 687 671 endif; -
wp-includes/script-loader.php
37 37 38 38 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); 39 39 40 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('jquery', 'schedule'), '20080 104');40 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('jquery', 'schedule'), '20080206'); 41 41 $this->localize( 'autosave', 'autosaveL10n', array( 42 42 'autosaveInterval' => apply_filters('autosave_interval', '120'), 43 43 'errorText' => __('Error: %response%'), -
wp-admin/admin-ajax.php
467 467 $x->send(); 468 468 break; 469 469 case 'autosave' : // The name of this action is hardcoded in edit_post() 470 check_ajax_referer( $action);470 check_ajax_referer( 'autosave', 'autosavenonce' ); 471 471 $_POST['post_content'] = $_POST['content']; 472 472 $_POST['post_excerpt'] = $_POST['excerpt']; 473 473 $_POST['post_status'] = 'draft'; … … 499 499 die('0'); 500 500 break; 501 501 case 'autosave-generate-nonces' : 502 check_ajax_referer( $action);502 check_ajax_referer( 'autosave', 'autosavenonce' ); 503 503 $ID = (int) $_POST['post_ID']; 504 504 if($_POST['post_type'] == 'post') { 505 505 if(current_user_can('edit_post', $ID)) -
wp-admin/edit-page-form.php
56 56 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea"> 57 57 <h3><?php _e('Page') ?></h3> 58 58 <?php the_editor($post->post_content); ?> 59 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?> 59 60 </div> 60 61 61 62 <div id="submitpost"> -
wp-admin/edit-form.php
39 39 } 40 40 ?> 41 41 <div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?></textarea></div> 42 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?> 42 43 </fieldset> 43 44 44 45 -
wp-admin/edit-form-advanced.php
88 88 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea"> 89 89 <h3><?php _e('Post') ?></h3> 90 90 <?php the_editor($post->post_content); ?> 91 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?> 91 92 </div> 92 93 93 94 <?php echo $form_pingback ?>