Added missing ';' in ISO-8859-1
[squirrelmail.git] / functions / mime.php
index ff5bf65baae0d6ec67251461ee4c9ec61027c258..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);
          }   
    
                
                $HookResults = do_hook("attachment $type0/$type1", $Links,
                    $startMessage, $id, $urlMailbox, $ent, $DefaultLink, 
-                   $where, $what);
+                   $display_filename, $where, $what);
 
                $Links = $HookResults[1];
                $DefaultLink = $HookResults[6];
 
                $body .= '<TR><TD>&nbsp;&nbsp;</TD><TD>';
                $body .= "<A HREF=\"$DefaultLink\">$display_filename</A>&nbsp;</TD>";
-               $size = $message->header->size / 1024;
-               settype($size, "integer");
-               $body .= "<TD><SMALL><b>" . $size . "k</b>&nbsp;&nbsp;</small></TD>";
+               $body .= '<TD><SMALL><b>' . show_readable_size($message->header->size) . 
+                   '</b>&nbsp;&nbsp;</small></TD>';
                $body .= "<TD><SMALL>[ $type0/$type1 ]&nbsp;</SMALL></TD>";
                $body .= '<TD><SMALL>';
                if ($message->header->description)
       global $default_charset;
 
       // Encode only if the string contains 8-bit characters or =?
-      if (ereg("([\200-\377])|=\\?", $string)) {
+      if (ereg("([\200-\377]|=\\?)", $string)) {
          $newstring = "=?$default_charset?Q?";
          
          // First the special characters