If mailto: string isn't double URL encoded, the values don't correctly get
[squirrelmail.git] / src / redirect.php
index 963ce226781cafde0f8bfcce9405e130f94954c1..9a9a0086d37dce76a0ba4077f8eb2bf73a87c454 100644 (file)
@@ -4,7 +4,7 @@
 * redirect.php
 * Derived from webmail.php by Ralf Kraudelt <kraude@wiwi.uni-rostock.de>
 *
-* Copyright (c) 1999-2004 The SquirrelMail Project Team
+* Copyright (c) 1999-2005 The SquirrelMail Project Team
 * Licensed under the GNU GPL. For full terms see the file COPYING.
 *
 * Prevents users from reposting their form data after a successful logout.
@@ -50,7 +50,7 @@ sqsession_register ($base_uri, 'base_uri');
 sqGetGlobalVar('login_username', $login_username);
 sqGetGlobalVar('secretkey', $secretkey);
 if(!sqGetGlobalVar('squirrelmail_language', $squirrelmail_language) || $squirrelmail_language == '') {
-       $squirrelmail_language = $squirrelmail_default_language;
+    $squirrelmail_language = $squirrelmail_default_language;
 }
 if (!sqgetGlobalVar('mailto', $mailto)) {
     $mailto = '';
@@ -60,12 +60,12 @@ if (!sqgetGlobalVar('mailto', $mailto)) {
 
 set_up_language($squirrelmail_language, true);
 /* Refresh the language cookie. */
-setcookie('squirrelmail_language', $squirrelmail_language, time()+2592000, 
+setcookie('squirrelmail_language', $squirrelmail_language, time()+2592000,
           $base_uri);
 
 if (!isset($login_username)) {
     include_once(SM_PATH .  'functions/display_messages.php' );
-    logout_error( _("You must be logged in to access this page.") );    
+    logout_error( _("You must be logged in to access this page.") );
     exit;
 }
 
@@ -141,7 +141,7 @@ if ( sqgetGlobalVar('session_expired_location', $session_expired_location, SQ_SE
 }
 if($mailto != '') {
     $redirect_url  = $location . '/webmail.php?right_frame=compose.php&mailto=';
-    $redirect_url .= $mailto;
+    $redirect_url .= urlencode($mailto);
 }
 
 /* Write session data and send them off to the appropriate page. */
@@ -154,13 +154,13 @@ function attachment_common_parse($str, $debug) {
     global $attachment_common_types, $attachment_common_types_parsed;
 
     $attachment_common_types_parsed[$str] = true;
-    
-    /* 
-     * Replace ", " with "," and explode on that as Mozilla 1.x seems to  
+
+    /*
+     * Replace ", " with "," and explode on that as Mozilla 1.x seems to
      * use "," to seperate whilst IE, and earlier versions of Mozilla use
      * ", " to seperate
      */
-    
+
     $str = str_replace( ', ' , ',' , $str );
     $types = explode(',', $str);