Changeset 6739 for trunk/wp-includes/pluggable.php
- Timestamp:
- 02/06/2008 09:19:47 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/pluggable.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)