Make WordPress Core

Ticket #58831: 58831-add-missing-global-wpdb-and-missing-escaping.patch

File 58831-add-missing-global-wpdb-and-missing-escaping.patch, 2.9 KB (added by viralsampat, 3 months ago)
  • src/wp-admin/user-edit.php

    diff --git src/wp-admin/user-edit.php src/wp-admin/user-edit.php
    index c5468cf937..6d6007a0f4 100644
    $user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pag 
    9494 * @since 3.0.0
    9595 *
    9696 * @param bool $allow Whether to allow editing of any user. Default true.
     97 *
     98 * @global wpdb $wpdb WordPress database abstraction object.
    9799 */
     100
     101global $wpdb;
     102
    98103if ( is_multisite()
    99104        && ! current_user_can( 'manage_network_users' )
    100105        && $user_id !== $current_user->ID
    switch ( $action ) { 
    262267                                <?php endif; ?>
    263268                                <p>
    264269                                        <input type="hidden" name="from" value="profile" />
    265                                         <input type="hidden" name="checkuser_id" value="<?php echo get_current_user_id(); ?>" />
     270                                        <input type="hidden" name="checkuser_id" value="<?php echo esc_attr( get_current_user_id() ); ?>" />
    266271                                </p>
    267272
    268273                                <h2><?php _e( 'Personal Options' ); ?></h2>
    switch ( $action ) { 
    504509
    505510                                                                ?>
    506511                                                                <?php foreach ( $public_display as $id => $item ) : ?>
    507                                                                         <option <?php selected( $profile_user->display_name, $item ); ?>><?php echo $item; ?></option>
     512                                                                        <option <?php selected( $profile_user->display_name, $item ); ?>><?php echo esc_html( $item ); ?></option>
    508513                                                                <?php endforeach; ?>
    509514                                                        </select>
    510515                                                </td>
    switch ( $action ) { 
    552557                                        </tr>
    553558
    554559                                        <?php foreach ( wp_get_user_contact_methods( $profile_user ) as $name => $desc ) : ?>
    555                                         <tr class="user-<?php echo $name; ?>-wrap">
     560                                        <tr class="user-<?php echo esc_attr( $name ); ?>-wrap">
    556561                                                <th>
    557                                                         <label for="<?php echo $name; ?>">
     562                                                        <label for="<?php echo esc_attr( $name ); ?>">
    558563                                                        <?php
    559564                                                        /**
    560565                                                         * Filters a user contactmethod label.
  • src/wp-admin/users.php

    diff --git src/wp-admin/users.php src/wp-admin/users.php
    index 2c635c543a..977d8fd9d7 100644
    switch ( $wp_list_table->current_action() ) { 
    307307                 *
    308308                 * @param bool  $users_have_additional_content Whether the users have additional content. Default false.
    309309                 * @param int[] $user_ids                      Array of IDs for users being deleted.
     310                 *
     311                 * @global wpdb $wpdb WordPress database abstraction object.
    310312                 */
     313                global $wpdb;
    311314                $users_have_content = (bool) apply_filters( 'users_have_additional_content', false, $user_ids );
    312315
    313316                if ( $user_ids && ! $users_have_content ) {
    switch ( $wp_list_table->current_action() ) { 
    507510                ?>
    508511                <form method="post" name="updateusers" id="updateusers">
    509512                <?php wp_nonce_field( 'remove-users' ); ?>
    510                 <?php echo $referer; ?>
     513                <?php echo esc_html( $referer ); ?>
    511514
    512515                <div class="wrap">
    513516                <h1><?php _e( 'Remove Users from Site' ); ?></h1>
    switch ( $wp_list_table->current_action() ) { 
    679682
    680683                if ( ! empty( $messages ) ) {
    681684                        foreach ( $messages as $msg ) {
    682                                 echo $msg;
     685                                echo esc_html( $msg );
    683686                        }
    684687                }
    685688                ?>