Reinstating fix for the "to" addresses. Hopefully won't need them for CC
[squirrelmail.git] / functions / mime.php
index ffb9c59a3f7a7543504678cb89ac5d3d956fbd7d..d299d3ee0799e22a353c92005f962f53c5d27b75 100644 (file)
@@ -25,8 +25,8 @@
       /** could be in a header.                                 **/
       
       var $type0 = '', $type1 = '', $boundary = '', $charset = '';
-      var $encoding = '', $size = 0, $to = '', $from = '', $date = '';
-      var $cc = '', $bcc = '', $reply_to = '', $subject = '';
+      var $encoding = '', $size = 0, $to = array(), $from = '', $date = '';
+      var $cc = array(), $bcc = array(), $reply_to = '', $subject = '';
       var $id = 0, $mailbox = '', $description = '', $filename = '';
       var $entity_id = 0, $message_id = 0;
    }
@@ -38,7 +38,7 @@
           a better description of how this works.
        **/   
       var $header = '';
-      var $entities = '';
+      var $entities = array();
       
       function addEntity ($msg) {
          $this->entities[] = $msg;
       } else {
          // parse the elements
          if ($debug_mime) echo "<br><font color=0000aa><tt>$structure</tt></font><br>";
-         $msg = mime_get_element (&$structure, $msg, $ent_id);
+         $msg = mime_get_element ($structure, $msg, $ent_id);
          if ($debug_mime) echo "<br>";
       }
       return $msg;
    /** This is the first function called.  It decides if this is a multipart
        message or if it should be handled as a single entity
     **/
-   function decodeMime ($imap_stream, $header) {
+   function decodeMime ($imap_stream, &$header) {
       global $username, $key, $imapServerAddress, $imapPort;
       return mime_structure ($imap_stream, $header);
    }
    
          /** Display the ATTACHMENTS: message if there's more than one part **/
          $body .= "</TD></TR></TABLE>";
-         if (isset($message->entities)) {
+         if (isset($message->entities[0])) {
             $body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id);
          }
       } else {
    function formatAttachments ($message, $ent_id, $mailbox, $id) {
       global $where, $what;
       global $startMessage, $color;
-      static $ShownHTML;
+      static $ShownHTML = 0;
       
          $body = "";
       if ($ShownHTML == 0)
             
             $body .= "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR=\"$color[0]\"><TR>\n";
             $body .= "<TH ALIGN=\"left\" BGCOLOR=\"$color[9]\"><B>\n";
-            $body .= _('Attachments') . ':';
+            $body .= _("Attachments") . ':';
             $body .= "</B></TH></TR><TR><TD>\n";
             
             $body .= "<TABLE CELLSPACING=0 CELLPADDING=1 BORDER=0>\n";
                   "../src/download.php?startMessage=$startMessage&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
                if ($where && $what)
                   $DefaultLink .= '&where=' . urlencode($where) . '&what=' . urlencode($what);
-               $Links['download link']['text'] = _('download');
+               $Links['download link']['text'] = _("download");
                $Links['download link']['href'] = 
                    "../src/download.php?absolute_dl=true&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
                $ImageURL = '';