Fixed attachments issue... Seemed that the session wasn't getting the new
[squirrelmail.git] / src / read_body.php
index 1358b3109752aa4a39896dc37224869bdae988e9..465c2e9428f73b5050f336a2be225c00fcb327d3 100644 (file)
@@ -17,6 +17,7 @@ define('SM_PATH','../');
 
 /* SquirrelMail required files. */
 require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/global.php');
 require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/mime.php');
 require_once(SM_PATH . 'functions/date.php');
@@ -369,7 +370,7 @@ function formatRecipientString($recipients, $item ) {
 
         $cnt = count($recipients);
         foreach($recipients as $r) {
-            $add = htmlspecialchars(decodeHeader($r->getAddress()));
+            $add = decodeHeader($r->getAddress(true));
             if ($string) {
                 $string .= '<BR>' . $add;
             } else {
@@ -397,7 +398,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
 
     $header = $message->rfc822_header;
     $env = array();
-    $env[_("Subject")] = htmlspecialchars(decodeHeader($header->subject));
+    $env[_("Subject")] = decodeHeader($header->subject);
     $from_name = $header->getAddr_s('from');
     if (!$from_name) {
         $from_name = $header->getAddr_s('sender');
@@ -405,7 +406,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
             $from_name = _("Unknown sender");
         }
     }
-    $env[_("From")] = htmlspecialchars(decodeHeader($from_name));
+    $env[_("From")] = decodeHeader($from_name);
     $env[_("Date")] = getLongDateString($header->date);
     $env[_("To")] = formatRecipientString($header->to, "to");
     $env[_("Cc")] = formatRecipientString($header->cc, "cc");
@@ -414,7 +415,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
         $env[_("Priority")] = htmlspecialchars(getPriorityStr($header->priority));
     }
     if ($show_xmailer_default) {
-        $env[_("Mailer")] = htmlspecialchars(decodeHeader($header->xmailer));
+        $env[_("Mailer")] = decodeHeader($header->xmailer);
     }
     if ($default_use_mdn) {
         if ($mdn_user_support) {
@@ -601,7 +602,7 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
         $s .= $link_open . $comp_action_uri . $link_close . _("Forward as Attachment") . '</a>';
     }
 
-    $comp_action_uri = decodeHeader($comp_uri . '&amp;action=reply');
+    $comp_action_uri = $comp_uri . '&amp;action=reply';
     $s .= $topbar_delimiter;
     $s .= $link_open . $comp_action_uri . $link_close . _("Reply") . '</a>';
 
@@ -643,12 +644,12 @@ function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
 
 /* get the globals we may need */
 
-/** SESSION VARS */
+sqgetGlobalVar('key',       $key,           SQ_COOKIE);
 sqgetGlobalVar('username',  $username,      SQ_SESSION);
 sqgetGlobalVar('onetimepad',$onetimepad,    SQ_SESSION);
-sqgetGlobalVar('msgs',      $msgs,          SQ_SESSION);
-sqgetGlobalVar('base_uri',  $base_uri,      SQ_SESSION);
 sqgetGlobalVar('delimiter', $delimiter,     SQ_SESSION);
+sqgetGlobalVar('base_uri',  $base_uri,      SQ_SESSION);
+
 sqgetGlobalVar('msgs',      $msgs,          SQ_SESSION);
 sqgetGlobalVar('msort',     $msort,         SQ_SESSION);
 sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION);
@@ -657,9 +658,6 @@ if (!sqgetGlobalVar('messages', $messages, SQ_SESSION) ) {
     $messages = array();
 }
 
-/** COOKIE VARS */
-sqgetGlobalVar('key',       $key,           SQ_COOKIE);
-
 /** GET VARS */
 sqgetGlobalVar('sendreceipt',   $sendreceipt,   SQ_GET);
 sqgetGlobalVar('where',         $where,         SQ_GET);
@@ -697,10 +695,6 @@ if ( sqgetGlobalVar('startMessage', $temp) ) {
 /* end of get globals */
 global $uid_support, $sqimap_capabilities;
 
-if (isset($mailbox)) {
-    $mailbox = urldecode( $mailbox );
-}
-
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 $mbx_response   = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);