alecpl
2010-01-29 2b35c5d8f6526c86d356913f151af7e6df3c2976
program/include/rcube_shared.inc
@@ -444,20 +444,15 @@
        $mime_type = $mime_ext[$suffix];
    }
    // try fileinfo extension if available
    if (!$mime_type) {
        if (!extension_loaded('fileinfo')) {
            @dl('fileinfo.' . PHP_SHLIB_SUFFIX);
        }
        if (function_exists('finfo_open')) {
            if ($finfo = finfo_open(FILEINFO_MIME, $mime_magic)) {
                $mime_type = finfo_file($finfo, $path);
                finfo_close($finfo);
            }
    if (!$mime_type && function_exists('finfo_open')) {
        if ($finfo = finfo_open(FILEINFO_MIME, $mime_magic)) {
            $mime_type = finfo_file($finfo, $path);
            finfo_close($finfo);
        }
    }
    // try PHP's mime_content_type
    if (!$mime_type && function_exists('mime_content_type')) {
      $mime_type = mime_content_type($path);
      $mime_type = mime_content_type($path);
    }
    // fall back to user-submitted string
    if (!$mime_type) {
@@ -578,7 +573,9 @@
{
  $input = rc_utf8_clean($input);
  return json_encode($input);
  // sometimes even using rc_utf8_clean() the input contains invalid UTF-8 sequences
  // that's why we have @ here
  return @json_encode($input);
}