summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-01-03 09:57:14 +0000
committeralecpl <alec@alec.pl>2012-01-03 09:57:14 +0000
commita128fafbe8ba5657f0c2cbc6dd2caeba79d4ad4c (patch)
tree4f9f0f69851c6e6c25bcfe2d4c8e44c16525f637
parentbc8437b71c440a605497a6af363811351b1aa147 (diff)
- Backport r5689 from trunk
-rw-r--r--program/include/rcube_imap_generic.php32
1 files changed, 17 insertions, 15 deletions
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index a4e921fe6..94211210d 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -3232,29 +3232,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;
- }
}
/**