Added missing ';' in ISO-8859-1
[squirrelmail.git] / functions / mime.php
index 2ae23b00a7477e88030a61f3814ab5ac38308364..13a453a9ef89983746d790814344a98011d778c9 100644 (file)
 
       fputs ($imap_stream, "a001 FETCH $id BODY[$ent_id]\r\n");
       $topline = fgets ($imap_stream, 1024);
-      $size = substr ($topline, strpos($topline, "{")+1); 
-      $size = substr ($size, 0, strpos($size, "}"));
-      $read = fread ($imap_stream, $size);
-      return $read;
+      if (ereg('\{([^\}]*)\}', $topline, $regs)) {
+         return fread ($imap_stream, $regs[1]);
+      }
+      else if (ereg('"([^"]*)"', $topline, $regs)) {
+         return $regs[1];
+      }
+      return "Body retrival error, please report this bug!\n\nTop line is \"$topline\"\n";
    }
 
    /* -[ END MIME DECODING ]----------------------------------------------------------- */
    
          // If there are other types that shouldn't be formatted, add
          // them here 
-         if ($message->header->type1 != "html") {   
+         if ($body_message->header->type1 != "html") {   
             translateText($body, $wrap_at, $body_message->header->charset);
          }