Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/22/2016 08:29:52 PM (9 years ago)
Author:
djpaul
Message:

Avatars: improve robustness of crop process by confirming crop data.

For the 2.3 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/src/bp-core/classes/class-bp-attachment-avatar.php

    r10144 r11321  
    199199        }
    200200
     201        if ( ! bp_attachments_current_user_can( 'edit_avatar', $args ) ) {
     202            return false;
     203        }
     204
     205        if ( 'user' === $args['object'] ) {
     206            $avatar_dir = 'avatars';
     207        } else {
     208            $avatar_dir = sanitize_key( $args['object'] ) . '-avatars';
     209        }
     210
     211        $args['item_id'] = (int) $args['item_id'];
     212
    201213        /**
    202214         * Original file is a relative path to the image
    203215         * eg: /avatars/1/avatar.jpg
    204216         */
    205         $relative_path = $args['original_file'];
     217        $relative_path = sprintf( '/%s/%s/%s', $avatar_dir, $args['item_id'], basename( $args['original_file'] ) );
    206218        $absolute_path = $this->upload_path . $relative_path;
    207219
Note: See TracChangeset for help on using the changeset viewer.