From 0dba507d6187a44f0ecb642c2add01be1260b0cf Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 12 Nov 2008 22:59:54 -0700 Subject: [PATCH] Correctly use mimeIdArithmetic(). --- imp/lib/Mime/Viewer/alternative.php | 5 +++-- imp/lib/Mime/Viewer/mdn.php | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/imp/lib/Mime/Viewer/alternative.php b/imp/lib/Mime/Viewer/alternative.php index 490b4438a..a5790aeb1 100644 --- a/imp/lib/Mime/Viewer/alternative.php +++ b/imp/lib/Mime/Viewer/alternative.php @@ -70,7 +70,8 @@ class IMP_Horde_Mime_Viewer_alternative extends Horde_Mime_Viewer_Driver } /* Get the list of IDs directly under the subpart. */ - $id = Horde_Mime::mimeIdArithmetic($base_id, 'down'); + reset($subparts); + list($id,) = each($subparts); do { $base_ids[] = $id; $id = Horde_Mime::mimeIdArithmetic($id, 'next'); @@ -80,7 +81,7 @@ class IMP_Horde_Mime_Viewer_alternative extends Horde_Mime_Viewer_Driver * base multipart and display all viewable parts in that multipart. * Else, display the single part. */ $disp_id = end($display_ids); - while (!is_null($disp_id) && !in_array($disp_id, $base_ids)) { + while (!is_null($disp_id) && !in_array($disp_id, $base_ids, true)) { $disp_id = Horde_Mime::mimeIdArithmetic($disp_id, 'up'); } diff --git a/imp/lib/Mime/Viewer/mdn.php b/imp/lib/Mime/Viewer/mdn.php index 56666bb72..459161201 100644 --- a/imp/lib/Mime/Viewer/mdn.php +++ b/imp/lib/Mime/Viewer/mdn.php @@ -51,6 +51,10 @@ class IMP_Horde_Mime_Viewer_mdn extends Horde_Mime_Viewer_Driver $mdn_id = $this->_mimepart->getMimeId(); $parts = $this->_mimepart->contentTypeMap(); + /* Set the pointer to the 2nd item. */ + reset($parts); + next($parts); + $status = array( array( 'icon' => Horde::img('info_icon.png', _("Info"), null, $GLOBALS['registry']->getImageDir('horde')), @@ -65,7 +69,7 @@ class IMP_Horde_Mime_Viewer_mdn extends Horde_Mime_Viewer_Driver * (3) Original message (optional) */ /* Print the human readable message. */ - $curr_id = $first_id = Horde_Mime::mimeIdArithmetic($this->_mimepart->getMIMEId(), 'down'); + $curr_id = $first_id = key($parts); $first_part = $this->_params['contents']->renderMIMEPart($curr_id, 'inlineauto', array('params' => $this->_params)); /* Display a link to more detailed message. */ -- 2.11.0