From: Michael M Slusarz Date: Fri, 21 Nov 2008 07:39:46 +0000 (-0700) Subject: 'start' parameter is a CID, not a MIME ID. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=eb0ec7aa0e431729d1e4bbe0436cbfdf304a7240;p=horde.git 'start' parameter is a CID, not a MIME ID. --- diff --git a/imp/lib/Mime/Viewer/related.php b/imp/lib/Mime/Viewer/related.php index 7fd20f462..741127cf8 100644 --- a/imp/lib/Mime/Viewer/related.php +++ b/imp/lib/Mime/Viewer/related.php @@ -57,11 +57,27 @@ class IMP_Horde_Mime_Viewer_related extends Horde_Mime_Viewer_Driver $ids = array_keys($this->_mimepart->contentTypeMap()); $related_id = $this->_mimepart->getMimeId(); + $cids = $ret = array(); + $id = null; + + /* Build a list of parts -> CIDs. */ + foreach ($ids as $val) { + $ret[$val] = null; + if (strcmp($related_id, $val) !== 0) { + $part = $this->_mimepart->getPart($val); + $cids[$val] = $part->getContentId(); + } + } + /* Look at the 'start' parameter to determine which part to start * with. If no 'start' parameter, use the first part. RFC 2387 * [3.1] */ - $id = $this->_mimepart->getContentTypeParameter('start'); - if (is_null($id)) { + $start = $this->_mimepart->getContentTypeParameter('start'); + if (!empty($start)) { + $id = array_search($id, $cids); + } + + if (empty($id)) { reset($ids); $id = next($ids); } @@ -73,16 +89,6 @@ class IMP_Horde_Mime_Viewer_related extends Horde_Mime_Viewer_Driver return array(); } - $cids = $ret = array(); - - /* Build a list of parts -> CIDs. */ - foreach ($ids as $val) { - $ret[$val] = null; - if (strcmp($related_id, $val) !== 0) { - $part = $this->_mimepart->getPart($val); - $cids[$val] = $part->getContentId(); - } - } $render = $this->_params['contents']->renderMIMEPart($id, $inline ? IMP_Contents::RENDER_INLINE : IMP_Contents::RENDER_FULL, array('params' => array_merge($this->_params, array('related_id' => $id, 'related_cids' => $cids))));