diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-04-28 19:30:03 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-04-28 19:30:03 +0000 |
| commit | 105e9ba3d660fcfc1c40b338e06343d021f2fad4 (patch) | |
| tree | 2fab50468114fa77febab0253dbc062eefa11e32 /roundcubemail/program | |
| parent | e1ba71f11d53eefb3a770ac0900bb7edd324b54a (diff) | |
- Fix fatal error after last commit in rcube_imap (#1485825)
git-svn-id: https://svn.roundcube.net/trunk@2436 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index 6226c28c2..323979b77 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -1124,15 +1124,8 @@ class rcube_imap // set message charset from message headers if ($headers->charset) $this->struct_charset = $headers->charset; - // ... or from first part headers - else if (is_array($structure[2]) && $structure[2][0] == 'charset') - $this->struct_charset = $structure[2][1]; - else if (is_array($structure[0][2]) && $structure[0][2][0] == 'charset') - $this->struct_charset = $structure[0][2][1]; - else if (is_array($structure[0][0][2]) && $structure[0][0][2][0] == 'charset') - $this->struct_charset = $structure[0][0][2][1]; else - $this->struct_charset = null; + $this->struct_charset = $this->_structure_charset($structure); $struct = &$this->_structure_part($structure); $struct->headers = get_object_vars($headers); @@ -1390,8 +1383,25 @@ class rcube_imap $part->filename = rcube_charset_convert(urldecode($filename_encoded), $filename_charset); } } - - + + + /** + * Get charset name from message structure (first part) + * + * @access private + * @param array Message structure + * @return string Charset name + */ + function _structure_charset($structure) + { + while (is_array($structure)) { + if (is_array($structure[2]) && $structure[2][0] == 'charset') + return $structure[2][1]; + $structure = $structure[0]; + } + } + + /** * Fetch message body of a specific message from the server * |
