mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
jquery for list manipulation. Round one, fight. Props mdawaffe. fixes #4805
git-svn-id: https://develop.svn.wordpress.org/trunk@6213 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+18
-15
@@ -346,23 +346,26 @@ function check_admin_referer($action = -1) {
|
||||
}endif;
|
||||
|
||||
if ( !function_exists('check_ajax_referer') ) :
|
||||
function check_ajax_referer() {
|
||||
$current_name = '';
|
||||
if ( ( $current = wp_get_current_user() ) && $current->ID )
|
||||
$current_name = $current->data->user_login;
|
||||
if ( !$current_name )
|
||||
die('-1');
|
||||
function check_ajax_referer( $action = -1 ) {
|
||||
$nonce = $_REQUEST['_ajax_nonce'] ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce'];
|
||||
if ( !wp_verify_nonce( $nonce, $action ) ) {
|
||||
$current_name = '';
|
||||
if ( ( $current = wp_get_current_user() ) && $current->ID )
|
||||
$current_name = $current->data->user_login;
|
||||
if ( !$current_name )
|
||||
die('-1');
|
||||
|
||||
$cookie = explode('; ', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie
|
||||
foreach ( $cookie as $tasty ) {
|
||||
if ( false !== strpos($tasty, USER_COOKIE) )
|
||||
$user = substr(strstr($tasty, '='), 1);
|
||||
if ( false !== strpos($tasty, PASS_COOKIE) )
|
||||
$pass = substr(strstr($tasty, '='), 1);
|
||||
$cookie = explode('; ', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie
|
||||
foreach ( $cookie as $tasty ) {
|
||||
if ( false !== strpos($tasty, USER_COOKIE) )
|
||||
$user = substr(strstr($tasty, '='), 1);
|
||||
if ( false !== strpos($tasty, PASS_COOKIE) )
|
||||
$pass = substr(strstr($tasty, '='), 1);
|
||||
}
|
||||
|
||||
if ( $current_name != $user || !wp_login( $user, $pass, true ) )
|
||||
die('-1');
|
||||
}
|
||||
|
||||
if ( $current_name != $user || !wp_login( $user, $pass, true ) )
|
||||
die('-1');
|
||||
do_action('check_ajax_referer');
|
||||
}
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user