get rid of getting the mime_structure of a message. HTML-messages with for
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 28 May 2002 14:26:28 +0000 (14:26 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 28 May 2002 14:26:28 +0000 (14:26 +0000)
example 15 small inline-images caused 15 times a call to mime_get_structure.

Getting the mime-header is enough in most cases.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2884 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/download.php

index f6235fab658b2418a3e32700ae317b541c09aebe..22f9c60557d1e3921e90b0f36fd0564ed537492c 100644 (file)
@@ -56,14 +56,18 @@ function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at) {
          "</TT></TD></TR></TABLE>";
 }
 
-function viewMessage($imapConnection, $id, $mailbox, $ent_id, $msg, $color, $wrap_at) {
+function viewMessage($imapConnection, $id, $mailbox, $ent_id, $color, $wrap_at) {
     global $startMessage;
+
+
+    $msg  = sqimap_get_message($imapConnection, $id, $mailbox);    
+    $msg = getEntity($msg, $ent_id);    
+
     $header = sqimap_get_ent_header($imapConnection,$id,$mailbox,$ent_id);
     $msg->header = $header;
     $msg->header->id = $id;
     $body = formatBody($imapConnection, $msg, $color, $wrap_at);
     $bodyheader = viewHeader($header, $color);
-
     displayPageHeader($color, 'None');
 
     echo "<BR><TABLE WIDTH=\"100%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
@@ -236,22 +240,18 @@ function formatRecipientString($recipients, $item ) {
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 sqimap_mailbox_select($imapConnection, $mailbox);
 
-/*
- * $message contains all information about the message
- * including header and body
- */
-$message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
-
-$top_header = $message->header;
-
+if (isset($showHeaders)) {
+  $top_header = sqimap_get_message_header ($imapConnection, $passed_id, $mailbox);
+}
 /*
  * lets redefine message as this particular entity that we wish to display.
  * it should hold only the header for this entity.  We need to fetch the body
  * yet before we can display anything.
  */
-$message = getEntity($message, $passed_ent_id);
 
-$header = $message->header;
+$header = sqimap_get_mime_ent_header ($imapConnection, $passed_id, $mailbox, $passed_ent_id);
+$header->entity_id = $passed_ent_id;
+$header->mailbox = $mailbox;
 
 $charset = $header->charset;
 $type0 = $header->type0;
@@ -345,7 +345,7 @@ if (isset($absolute_dl) && $absolute_dl == 'true') {
         break;
     case 'message':
        if ($type1 == 'rfc822' ) {
-           viewMessage($imapConnection, $passed_id, $mailbox, $passed_ent_id, $message, $color, $wrap_at);
+           viewMessage($imapConnection, $passed_id, $mailbox, $passed_ent_id, $color, $wrap_at);
        } else {
            $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);
            $body = decodeBody($body, $msgheader->encoding);