Skip to content
Permalink
Browse files Browse the repository at this point in the history
Add nonce to AJAX action for script compression setting
Built from https://develop.svn.wordpress.org/trunk@37143


git-svn-id: http://core.svn.wordpress.org/trunk@37110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nb committed Mar 30, 2016
1 parent db47a49 commit 9b7a775
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions wp-admin/includes/ajax-actions.php
Expand Up @@ -197,8 +197,10 @@ function wp_ajax_wp_compression_test() {
echo $out;
wp_die();
} elseif ( 'no' == $_GET['test'] ) {
check_ajax_referer( 'update_can_compress_scripts' );
update_site_option('can_compress_scripts', 0);
} elseif ( 'yes' == $_GET['test'] ) {
check_ajax_referer( 'update_can_compress_scripts' );
update_site_option('can_compress_scripts', 1);
}
}
Expand Down
3 changes: 2 additions & 1 deletion wp-admin/includes/template.php
Expand Up @@ -1789,6 +1789,7 @@ function _media_states( $post ) {
function compression_test() {
?>
<script type="text/javascript">
var compressionNonce = <?php echo wp_json_encode( wp_create_nonce( 'update_can_compress_scripts' ) ); ?>;
var testCompression = {
get : function(test) {
var x;
Expand All @@ -1808,7 +1809,7 @@ function compression_test() {
}
};

x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&'+(new Date()).getTime(), true);
x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&_ajax_nonce='+compressionNonce+'&'+(new Date()).getTime(), true);
x.send('');
}
},
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Expand Up @@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-RC1-37135';
$wp_version = '4.5-RC1-37143';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 9b7a775

Please sign in to comment.