Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/29/2015 04:22:02 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Use bp_sanitize_pagination_arg() in BP_Core_Members_Template and include related tests. This prevents pagination values from being overridden outside of anticipated boundaries. See #5796.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-template.php

    r9351 r9412  
    222222         */
    223223        var $in_the_loop;
     224
     225        /**
     226         * The unique string used for pagination queries
     227         *
     228         * @access public
     229         * @var public
     230         */
     231        var $pag_arg;
    224232
    225233        /**
    … …  
    277285        function __construct( $type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value, $page_arg = 'upage', $member_type = '' ) {
    278286
    279                 $this->pag_page = !empty( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : (int) $page_number;
    280                 $this->pag_num  = !empty( $_REQUEST['num'] )   ? intval( $_REQUEST['num'] )   : (int) $per_page;
     287                $this->pag_arg  = sanitize_key( $page_arg );
     288                $this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $page_number );
     289                $this->pag_num  = bp_sanitize_pagination_arg( 'num',          $per_page    );
    281290                $this->type     = $type;
    282291
    … …  
    305314                if ( (int) $this->total_member_count && (int) $this->pag_num ) {
    306315                        $pag_args = array(
    307                                 $page_arg => '%#%',
     316                                $this->pag_arg => '%#%',
    308317                        );
    309318
Note: See TracChangeset for help on using the changeset viewer.