WordPress.org

Make WordPress Core

Changeset 39764


Ignore:
Timestamp:
01/11/2017 01:44:36 AM (3 years ago)
Author:
aaroncampbell
Message:

Add nonce for widget accessibility mode.

Props vortfu.

See #23328.

Merges [39760] to 4.4 branch.

Location:
branches/4.4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4

  • branches/4.4/src/wp-admin/includes/class-wp-screen.php

    r36145 r39764  
    916916        switch ( $this->base ) {
    917917            case 'widgets':
    918                 $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";
     918                $nonce = wp_create_nonce( 'widgets-access' );
     919                $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";
    919920                break;
    920921            case 'post' :
  • branches/4.4/src/wp-admin/widgets.php

    r36369 r39764  
    2323$widgets_access = get_user_setting( 'widgets_access' );
    2424if ( isset($_GET['widgets-access']) ) {
     25    check_admin_referer( 'widgets-access' );
     26
    2527    $widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
    2628    set_user_setting( 'widgets_access', $widgets_access );
Note: See TracChangeset for help on using the changeset viewer.