diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-01-03 09:55:38 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-01-03 09:55:38 +0000 |
| commit | cbef63721dc384b091d6e9c3e8bd087bdaf062a5 (patch) | |
| tree | d2ca91fa1113c72a63758c442c52eb399b46c9df /roundcubemail/program/include | |
| parent | 53a82cb645e38cb50445298e90ef4d877443e1f5 (diff) | |
- Prevent from PHP warnings
git-svn-id: https://svn.roundcube.net/trunk@5689 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap_generic.php | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/roundcubemail/program/include/rcube_imap_generic.php b/roundcubemail/program/include/rcube_imap_generic.php index 9768b4a1f..4d4698f87 100644 --- a/roundcubemail/program/include/rcube_imap_generic.php +++ b/roundcubemail/program/include/rcube_imap_generic.php @@ -3249,29 +3249,31 @@ class rcube_imap_generic if (!is_array($a)) { return false; } + + if (empty($part)) { + return $a; + } + + $ctype = is_string($a[0]) && is_string($a[1]) ? $a[0] . '/' . $a[1] : ''; + + if (strcasecmp($ctype, 'message/rfc822') == 0) { + $a = $a[8]; + } + if (strpos($part, '.') > 0) { - $original_part = $part; - $pos = strpos($part, '.'); - $rest = substr($original_part, $pos+1); - $part = substr($original_part, 0, $pos); - if ((strcasecmp($a[0], 'message') == 0) && (strcasecmp($a[1], 'rfc822') == 0)) { - $a = $a[8]; - } + $orig_part = $part; + $pos = strpos($part, '.'); + $rest = substr($orig_part, $pos+1); + $part = substr($orig_part, 0, $pos); + return self::getStructurePartArray($a[$part-1], $rest); } - else if ($part>0) { - if (!is_array($a[0]) && (strcasecmp($a[0], 'message') == 0) - && (strcasecmp($a[1], 'rfc822') == 0)) { - $a = $a[8]; - } + else if ($part > 0) { if (is_array($a[$part-1])) return $a[$part-1]; else return $a; } - else if (($part == 0) || (empty($part))) { - return $a; - } } /** |
