Ignore:
Timestamp:
Jan 13, 2012 6:23:17 AM (16 months ago)
Author:
alec
Message:
  • Backported r5769 from trunk
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/release-0.7/program/include/rcube_shared.inc

    r5715 r5770  
    363363    $mime_magic = rcmail::get_instance()->config->get('mime_magic'); 
    364364    $mime_ext = @include(RCMAIL_CONFIG_DIR . '/mimetypes.php'); 
    365     $suffix = $name ? substr($name, strrpos($name, '.')+1) : '*'; 
    366365 
    367366    // use file name suffix with hard-coded mime-type map 
    368     if (is_array($mime_ext)) { 
    369         $mime_type = $mime_ext[$suffix]; 
    370     } 
     367    if (is_array($mime_ext) && $name) { 
     368        if ($suffix = substr($name, strrpos($name, '.')+1)) { 
     369            $mime_type = $mime_ext[strtolower($suffix)]; 
     370        } 
     371    } 
     372 
    371373    // try fileinfo extension if available 
    372374    if (!$mime_type && function_exists('finfo_open')) { 
     
    379381        } 
    380382    } 
     383 
    381384    // try PHP's mime_content_type 
    382385    if (!$mime_type && !$is_stream && function_exists('mime_content_type')) { 
    383386      $mime_type = @mime_content_type($path); 
    384387    } 
     388 
    385389    // fall back to user-submitted string 
    386390    if (!$mime_type) { 
Note: See TracChangeset for help on using the changeset viewer.