Theme Editior: Base the nonce on a simpler combination of fields, for easier debugging & reading.

See #42609.
Fixes #42705.


git-svn-id: https://develop.svn.wordpress.org/trunk@42246 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2017-11-27 03:43:11 +00:00
parent 6e0ba7864f
commit 44c75415b3
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -414,8 +414,7 @@ function wp_edit_theme_plugin_file( $args ) {
return new WP_Error( 'non_existent_theme', __( 'The requested theme does not exist.' ) );
}
$real_file = $theme->get_stylesheet_directory() . '/' . $file;
if ( ! wp_verify_nonce( $args['nonce'], 'edit-theme_' . $real_file . $stylesheet ) ) {
if ( ! wp_verify_nonce( $args['nonce'], 'edit-theme_' . $stylesheet . '_' . $file ) ) {
return new WP_Error( 'nonce_failure' );
}
@@ -450,7 +449,10 @@ function wp_edit_theme_plugin_file( $args ) {
return new WP_Error( 'disallowed_theme_file', __( 'Sorry, that file cannot be edited.' ) );
}
$real_file = $theme->get_stylesheet_directory() . '/' . $file;
$is_active = ( get_stylesheet() === $stylesheet || get_template() === $stylesheet );
} else {
return new WP_Error( 'missing_theme_or_plugin' );
}