Skip to content

Commit d12ec69

Browse files
committed
Add nonce for widget accessibility mode.
Props vortfu. See #23328. Merges [39765] to 3.7 branch. git-svn-id: https://develop.svn.wordpress.org/branches/3.7@39771 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2c0dfc3 commit d12ec69

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/wp-admin/includes/screen.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,8 @@ public function show_screen_options() {
901901

902902
switch ( $this->id ) {
903903
case 'widgets':
904-
$this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
904+
$nonce = wp_create_nonce( 'widgets-access' );
905+
$this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=' . urlencode( $nonce ) . '">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=' . urlencode( $nonce ) . '">' . __('Disable accessibility mode') . "</a></p>\n";
905906
break;
906907
default:
907908
$this->_screen_settings = '';

src/wp-admin/widgets.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
$widgets_access = get_user_setting( 'widgets_access' );
1919
if ( isset($_GET['widgets-access']) ) {
20+
check_admin_referer( 'widgets-access' );
21+
2022
$widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
2123
set_user_setting( 'widgets_access', $widgets_access );
2224
}

0 commit comments

Comments
 (0)