Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/29/2015 04:33:39 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Use bp_sanitize_pagination_arg() in BP_Messages_Box_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-messages/bp-messages-template.php

    r9386 r9415  
    140140
    141141        $r = wp_parse_args( $args, array(
     142            'page'         => 1,
     143            'per_page'     => 10,
     144            'page_arg'     => 'mpage',
     145            'box'          => 'inbox',
     146            'type'         => 'all',
    142147            'user_id'      => bp_loggedin_user_id(),
    143             'box'          => 'inbox',
    144             'per_page'     => 10,
    145148            'max'          => false,
    146             'type'         => 'all',
    147149            'search_terms' => '',
    148             'page_arg'     => 'mpage',
    149150            'meta_query'   => array(),
    150151        ) );
    151152
    152         $this->pag_page     = isset( $_GET[ $r['page_arg'] ] ) ? intval( $_GET[ $r['page_arg'] ] ) : 1;
    153         $this->pag_num      = isset( $_GET['num']            ) ? intval( $_GET['num']            ) : $r['per_page'];
    154 
     153        $this->pag_arg      = sanitize_key( $r['page_arg'] );
     154        $this->pag_page     = bp_sanitize_pagination_arg( $this->pag_arg, $r['page']     );
     155        $this->pag_num      = bp_sanitize_pagination_arg( 'num',          $r['per_page'] );
    155156        $this->user_id      = $r['user_id'];
    156157        $this->box          = $r['box'];
Note: See TracChangeset for help on using the changeset viewer.