Use `elseif` when slurping the `nonce` in `check_ajax_referer()` to avoid accidentally overwriting it.

Fail wonderboymusic in [25433].
Props ocean90.
Fixes #25369.
See [25433].



git-svn-id: https://develop.svn.wordpress.org/trunk@25550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2013-09-21 16:25:57 +00:00
parent 5315632f13
commit 825faf32da
1 changed files with 4 additions and 6 deletions

View File

@ -832,13 +832,11 @@ if ( !function_exists('check_ajax_referer') ) :
function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
$nonce = '';
if ( $query_arg && isset( $_REQUEST[$query_arg] ) )
$nonce = $_REQUEST[$query_arg];
if ( isset( $_REQUEST['_ajax_nonce'] ) )
if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) )
$nonce = $_REQUEST[ $query_arg ];
elseif ( isset( $_REQUEST['_ajax_nonce'] ) )
$nonce = $_REQUEST['_ajax_nonce'];
if ( isset( $_REQUEST['_wpnonce'] ) )
elseif ( isset( $_REQUEST['_wpnonce'] ) )
$nonce = $_REQUEST['_wpnonce'];
$result = wp_verify_nonce( $nonce, $action );