diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 4da1878051..253ba5113a 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2752,14 +2752,14 @@ function wp_ajax_get_revision_diffs() { require ABSPATH . 'wp-admin/includes/revision.php'; if ( ! $post = get_post( (int) $_REQUEST['post_id'] ) ) - wp_send_json_error(); + wp_send_json_error(111); if ( ! current_user_can( 'read_post', $post->ID ) ) - wp_send_json_error(); + wp_send_json_error(222); // Really just pre-loading the cache here. if ( ! $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ) ) - wp_send_json_error(); + wp_send_json_error(333); $return = array(); @set_time_limit( 0 ); @@ -3310,6 +3310,8 @@ function wp_ajax_save_wporg_username() { wp_send_json_error(); } + check_ajax_referer( 'save_wporg_username_' . get_current_user_id() ); + $username = isset( $_REQUEST['username'] ) ? wp_unslash( $_REQUEST['username'] ) : false; if ( ! $username ) { diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php index ba8445c1bd..1d0f6c9c20 100644 --- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -170,8 +170,13 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { break; case 'favorites': - $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); - update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); + $action = 'save_wporg_username_' . get_current_user_id(); + if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) { + $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); + update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); + } else { + $user = get_user_option( 'wporg_favorites' ); + } if ( $user ) $args['user'] = $user; else diff --git a/src/wp-admin/includes/plugin-install.php b/src/wp-admin/includes/plugin-install.php index bb450e12ef..4a1375d753 100644 --- a/src/wp-admin/includes/plugin-install.php +++ b/src/wp-admin/includes/plugin-install.php @@ -300,7 +300,8 @@ function install_plugins_upload() { * */ function install_plugins_favorites_form() { - $user = ! empty( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); + $user = get_user_option( 'wporg_favorites' ); + $action = 'save_wporg_username_' . get_current_user_id(); ?>

@@ -309,6 +310,7 @@ function install_plugins_favorites_form() { +

+