Skip to:
Content

BuddyPress.org


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

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

File:
1 edited

Legend:

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

    r9351 r9413  
    200200        public function __construct( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg = 'bpage', $update_meta_cache = true, $include_blog_ids = false ) {
    201201
    202                 $this->pag_page = isset( $_REQUEST[ $page_arg ] ) ? intval( $_REQUEST[ $page_arg ] ) : $page;
    203                 $this->pag_num  = isset( $_REQUEST['num']       ) ? intval( $_REQUEST['num']       ) : $per_page;
     202                $this->pag_arg  = sanitize_key( $page_arg );
     203                $this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $page     );
     204                $this->pag_num  = bp_sanitize_pagination_arg( 'num',          $per_page );
    204205
    205206                // Backwards compatibility support for blogs by first letter
    … …  
    243244                if ( ! empty( $this->total_blog_count ) && ! empty( $this->pag_num ) ) {
    244245                        $this->pag_links = paginate_links( array(
    245                                 'base'      => add_query_arg( $page_arg, '%#%' ),
     246                                'base'      => add_query_arg( $this->pag_arg, '%#%' ),
    246247                                'format'    => '',
    247248                                'total'     => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
Note: See TracChangeset for help on using the changeset viewer.