More fixes.
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 13 Nov 2008 07:24:06 +0000 (00:24 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 13 Nov 2008 07:24:06 +0000 (00:24 -0700)
framework/Mime/lib/Horde/Mime.php
imp/lib/Mime/Viewer/related.php

index 23a9d3d..377a59d 100644 (file)
@@ -466,13 +466,13 @@ class Horde_Mime
         $pos = strrpos($id, '.');
 
         /* Check the boundary case (ID = 0). */
-        if (($pos === false) && ($id == '0')) {
+        if (($pos === false) && ($id === '0')) {
             return in_array($action, array('prev', 'up')) ? null : 1;
         }
 
         switch ($action) {
         case 'down':
-            $id = (substr($id, $pos + 1) == '0')
+            $id = (substr($id, $pos + 1) === '0')
                 ? substr_replace($id, '1', $pos + 1)
                 : $id . '.0';
             break;
@@ -488,7 +488,7 @@ class Horde_Mime
             if ($pos === false) {
                 $id = 0;
             } else {
-                $id = (substr($id, $pos + 1) == '0')
+                $id = (substr($id, $pos + 1) === '0')
                     ? substr($id, 0, $pos)
                     : substr_replace($id, '0', $pos + 1);
             }
index fc168c9..ef44ab2 100644 (file)
@@ -54,6 +54,7 @@ class IMP_Horde_Mime_Viewer_related extends Horde_Mime_Viewer_Driver
      */
     protected function _IMPrender($inline)
     {
+        $ids = array_keys($this->_mimepart->contentTypeMap());
         $related_id = $this->_mimepart->getMimeId();
 
         /* Look at the 'start' parameter to determine which part to start
@@ -61,7 +62,9 @@ class IMP_Horde_Mime_Viewer_related extends Horde_Mime_Viewer_Driver
          * [3.1] */
         $id = $this->_mimepart->getContentTypeParameter('start');
         if (is_null($id)) {
-            $id = Horde_Mime::mimeidArithmetic($related_id, 'down');
+            reset($ids);
+            next($ids);
+            $id = key($ids);
         }
 
         /* Only display if the start part (normally text/html) can be
@@ -72,7 +75,6 @@ class IMP_Horde_Mime_Viewer_related extends Horde_Mime_Viewer_Driver
         }
 
         $cids = $ret = array();
-        $ids = array_keys($this->_mimepart->contentTypeMap());
 
         /* Build a list of parts -> CIDs. */
         foreach ($ids as $val) {