Correctly use mimeIdArithmetic().
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 13 Nov 2008 05:59:54 +0000 (22:59 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 13 Nov 2008 05:59:54 +0000 (22:59 -0700)
imp/lib/Mime/Viewer/alternative.php
imp/lib/Mime/Viewer/mdn.php

index 490b443..a5790ae 100644 (file)
@@ -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');
         }
 
index 56666bb..4591612 100644 (file)
@@ -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. */