Skip to:
Content

Changeset 4169


Ignore:
Timestamp:
04/06/11 21:41:28 (3 years ago)
Author:
djpaul
Message:

Update regex to match case insensitive file extensions when checking avatar uploads. Fixes #3087, props r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-avatars.php

    r4107 r4169  
    5555 * default, but can be extended to include your own custom components too. 
    5656 * 
    57  * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()  
    58  * @global $current_blog WordPress global containing information and settings for the current blog being viewed.  
     57 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 
     58 * @global $current_blog WordPress global containing information and settings for the current blog being viewed. 
    5959 * @param array $args Determine the output of this function 
    6060 * @return string Formatted HTML <img> element, or raw avatar URL based on $html arg 
     
    270270    } else { 
    271271        // No avatar was found, and we've been told not to use a gravatar. 
    272         $gravatar = apply_filters( "bp_core_default_avatar_$object", BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg', $params );  
     272        $gravatar = apply_filters( "bp_core_default_avatar_$object", BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg', $params ); 
    273273    } 
    274274 
     
    527527        return !empty( $avatar ) ? $avatar : $default; 
    528528 
    529     if ( !$alt )  
    530         $alt = __( 'Avatar of %s', 'buddypress' );  
     529    if ( !$alt ) 
     530        $alt = __( 'Avatar of %s', 'buddypress' ); 
    531531 
    532532    // Let BuddyPress handle the fetching of the avatar 
     
    553553 
    554554function bp_core_check_avatar_type($file) { 
    555     if ( ( !empty( $file['file']['type'] ) && !preg_match('/(jpe?g|gif|png)$/', $file['file']['type'] ) ) || !preg_match( '/(jpe?g|gif|png)$/', $file['file']['name'] ) ) 
     555    if ( ( !empty( $file['file']['type'] ) && !preg_match('/(jpe?g|gif|png)$/i', $file['file']['type'] ) ) || !preg_match( '/(jpe?g|gif|png)$/i', $file['file']['name'] ) ) 
    556556        return false; 
    557557 
Note: See TracChangeset for help on using the changeset viewer.