summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-09-19 16:20:39 +0000
committeralecpl <alec@alec.pl>2008-09-19 16:20:39 +0000
commit20a25197f3e2c51fb42db0832dc22d493334f20f (patch)
tree1e4a25ab0c6596339354e7248bae06227c3368c6 /program/include
parent25c35c81e1648c49291218fdf0162d82b7e692ca (diff)
applied tensor's patch: incorrect handling of filename of second and subsequent long non-ASCII attachments
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 0a90fedbe..ad56a3a74 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1198,9 +1198,10 @@ class rcube_imap
}
// some servers (eg. dovecot-1.x) have no support for parameter value continuations
// we must fetch and parse headers "manually"
+ //TODO: fetching headers for a second time is not effecient, this code should be moved somewhere earlier --tensor
if ($i<2) {
// TODO: fetch only Content-Type/Content-Disposition header
- $headers = iil_C_FetchPartBody($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id.'.HEADER');
+ $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $part->mime_id);
$filename_mime = '';
$i = 0;
while (preg_match('/filename\*'.$i.'\s*=\s*"*([^"\n;]+)[";]*/', $headers, $matches)) {
@@ -1216,9 +1217,9 @@ class rcube_imap
$filename_encoded .= $part->d_parameters['filename*'.$i.'*'];
}
if ($i<2) {
- $headers = iil_C_FetchPartBody($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id.'.HEADER');
+ $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $part->mime_id);
$filename_encoded = '';
- $i = 0;
+ $i = 0; $matches = array();
while (preg_match('/filename\*'.$i.'\*\s*=\s*"*([^"\n;]+)[";]*/', $headers, $matches)) {
$filename_encoded .= $matches[1];
$i++;
@@ -1232,9 +1233,9 @@ class rcube_imap
$filename_mime .= $part->ctype_parameters['name*'.$i];
}
if ($i<2) {
- $headers = iil_C_FetchPartBody($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id.'.HEADER');
+ $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $part->mime_id);
$filename_mime = '';
- $i = 0;
+ $i = 0; $matches = array();
while (preg_match('/\s+name\*'.$i.'\s*=\s*"*([^"\n;]+)[";]*/', $headers, $matches)) {
$filename_mime .= $matches[1];
$i++;
@@ -1248,9 +1249,9 @@ class rcube_imap
$filename_encoded .= $part->ctype_parameters['name*'.$i.'*'];
}
if ($i<2) {
- $headers = iil_C_FetchPartBody($this->conn, $this->mailbox, $this->_msg_id, $struct->mime_id.'.HEADER');
+ $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, $part->mime_id);
$filename_encoded = '';
- $i = 0;
+ $i = 0; $matches = array();
while (preg_match('/\s+name\*'.$i.'\*\s*=\s*"*([^"\n;]+)[";]*/', $headers, $matches)) {
$filename_encoded .= $matches[1];
$i++;