summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_shared.inc
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-05-28 09:38:41 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-05-28 09:38:41 +0000
commit18767e67edcc30982d41298a12cd70f9048c0f81 (patch)
treedec375fd5d240f43506798e26b08c18f947e2572 /roundcubemail/program/include/rcube_shared.inc
parent2f4ff8ded256ee0e4f73f365c774c2b01857b057 (diff)
- Fix forwarding of messages with winmail attachments
- Remove some redundant code for winmail handling in get.inc, move tnef_decode() to rcube_message - Fix handling of uuencoded attachments in message body (#1485839) - Extend rc_mime_content_type() to work with string buffer git-svn-id: https://svn.roundcube.net/trunk@3680 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_shared.inc')
-rw-r--r--roundcubemail/program/include/rcube_shared.inc18
1 files changed, 11 insertions, 7 deletions
diff --git a/roundcubemail/program/include/rcube_shared.inc b/roundcubemail/program/include/rcube_shared.inc
index 2c3e63933..3ab76917d 100644
--- a/roundcubemail/program/include/rcube_shared.inc
+++ b/roundcubemail/program/include/rcube_shared.inc
@@ -430,16 +430,17 @@ function abbreviate_string($str, $maxlength, $place_holder='...')
/**
* A method to guess the mime_type of an attachment.
*
- * @param string $path Path to the file.
- * @param string $name File name (with suffix)
- * @param string $failover Mime type supplied for failover.
+ * @param string $path Path to the file.
+ * @param string $name File name (with suffix)
+ * @param string $failover Mime type supplied for failover.
+ * @param string $is_stream Set to True if $path contains file body
*
* @return string
* @author Till Klampaeckel <till@php.net>
* @see http://de2.php.net/manual/en/ref.fileinfo.php
* @see http://de2.php.net/mime_content_type
*/
-function rc_mime_content_type($path, $name, $failover = 'application/octet-stream')
+function rc_mime_content_type($path, $name, $failover = 'application/octet-stream', $is_stream=false)
{
$mime_type = null;
$mime_magic = rcmail::get_instance()->config->get('mime_magic');
@@ -453,13 +454,16 @@ function rc_mime_content_type($path, $name, $failover = 'application/octet-strea
// try fileinfo extension if available
if (!$mime_type && function_exists('finfo_open')) {
if ($finfo = finfo_open(FILEINFO_MIME, $mime_magic)) {
- $mime_type = finfo_file($finfo, $path);
+ if ($is_stream)
+ $mime_type = finfo_buffer($finfo, $path);
+ else
+ $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);
+ if (!$mime_type && !$is_stream && function_exists('mime_content_type')) {
+ $mime_type = @mime_content_type($path);
}
// fall back to user-submitted string
if (!$mime_type) {