Fix attachment filename decoding (#2994865)
[squirrelmail.git] / src / right_main.php
index aea8db2565ccea61e9db35547f9f39d19e5b0995..94bd618ea01aa0babdaa388c8d21d6a964214d48 100644 (file)
@@ -6,7 +6,7 @@
  * This is where the mailboxes are listed. This controls most of what
  * goes on in SquirrelMail.
  *
- * @copyright © 1999-2009 The SquirrelMail Project Team
+ * @copyright 1999-2010 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -17,7 +17,6 @@ define('PAGE_NAME', 'right_main');
 
 //xdebug_start_profiling("/var/spool/xdebug/right_main.txt");
 
-
 /**
  * Include the SquirrelMail initialization file.
  */
@@ -264,8 +263,10 @@ if (isset($aMailbox['FORWARD_SESSION'])) {
             $compose_height = '550';
         }
         // do not use &, it will break the query string and $session will not be detected!!!
-        $comp_uri = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
-                    '&session='.urlencode($aMailbox['FORWARD_SESSION']);
+        $comp_uri = $base_uri . 'src/compose.php?mailbox='. urlencode($mailbox)
+                  . '&session='.urlencode($aMailbox['FORWARD_SESSION']['SESSION_NUMBER'])
+                  . '&smaction=forward_as_attachment'
+                  . '&fwduid=' . implode('_', $aMailbox['FORWARD_SESSION']['UIDS']);
         $onload = "comp_in_new('$comp_uri', $compose_width, $compose_height);";
     } else {
         $mailbox_cache[$account.'_'.$aMailbox['NAME']] = $aMailbox;
@@ -275,8 +276,10 @@ if (isset($aMailbox['FORWARD_SESSION'])) {
         sqsession_register($aMailbox,'aLastSelectedMailbox');
         session_write_close();
         // we have to redirect to the compose page
-        $location = SM_PATH . 'src/compose.php?mailbox='. urlencode($mailbox).
-                    '&session='.$aMailbox['FORWARD_SESSION'];
+        $location = $base_uri . 'src/compose.php?mailbox='. urlencode($mailbox)
+                  . '&session='.$aMailbox['FORWARD_SESSION']['SESSION_NUMBER']
+                  . '&smaction=forward_as_attachment'
+                  . '&fwduid=' . implode('_', $aMailbox['FORWARD_SESSION']['UIDS']);
         header("Location: $location");
         exit;
     }