Changeset 6739
- Timestamp:
- 02/06/2008 09:19:47 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
wp-admin/admin-ajax.php (modified) (2 diffs)
-
wp-admin/edit-form-advanced.php (modified) (1 diff)
-
wp-admin/edit-form.php (modified) (1 diff)
-
wp-admin/edit-page-form.php (modified) (1 diff)
-
wp-includes/js/autosave.js (modified) (3 diffs)
-
wp-includes/pluggable.php (modified) (2 diffs)
-
wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r6726 r6739 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']; … … 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') { -
trunk/wp-admin/edit-form-advanced.php
r6713 r6739 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 -
trunk/wp-admin/edit-form.php
r6567 r6739 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 -
trunk/wp-admin/edit-page-form.php
r6726 r6739 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 -
trunk/wp-includes/js/autosave.js
r6694 r6739 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) { … … 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() || "" … … 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) { -
trunk/wp-includes/pluggable.php
r6726 r6739 636 636 * 637 637 * @param string $action Action nonce 638 */ 639 function check_admin_referer($action = -1) { 638 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) 639 */ 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); … … 655 656 * 656 657 * @param string $action Action nonce 657 */ 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'); 666 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 } 675 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 } 658 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) 659 */ 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']; 665 666 if ( !wp_verify_nonce( $nonce, $action ) ) 667 die('-1'); 668 685 669 do_action('check_ajax_referer'); 686 670 } -
trunk/wp-includes/script-loader.php
r6726 r6739 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'),
Note: See TracChangeset
for help on using the changeset viewer.