Skip to content

Commit 9b7a775

Browse files
committed
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
1 parent db47a49 commit 9b7a775

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Diff for: wp-admin/includes/ajax-actions.php

+2
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ function wp_ajax_wp_compression_test() {
197197
echo $out;
198198
wp_die();
199199
} elseif ( 'no' == $_GET['test'] ) {
200+
check_ajax_referer( 'update_can_compress_scripts' );
200201
update_site_option('can_compress_scripts', 0);
201202
} elseif ( 'yes' == $_GET['test'] ) {
203+
check_ajax_referer( 'update_can_compress_scripts' );
202204
update_site_option('can_compress_scripts', 1);
203205
}
204206
}

Diff for: wp-admin/includes/template.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,7 @@ function _media_states( $post ) {
17891789
function compression_test() {
17901790
?>
17911791
<script type="text/javascript">
1792+
var compressionNonce = <?php echo wp_json_encode( wp_create_nonce( 'update_can_compress_scripts' ) ); ?>;
17921793
var testCompression = {
17931794
get : function(test) {
17941795
var x;
@@ -1808,7 +1809,7 @@ function compression_test() {
18081809
}
18091810
};
18101811

1811-
x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&'+(new Date()).getTime(), true);
1812+
x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&_ajax_nonce='+compressionNonce+'&'+(new Date()).getTime(), true);
18121813
x.send('');
18131814
}
18141815
},

Diff for: wp-includes/version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @global string $wp_version
66
*/
7-
$wp_version = '4.5-RC1-37135';
7+
$wp_version = '4.5-RC1-37143';
88

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

0 commit comments

Comments
 (0)