* Added much better support for the mailto stuff
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 12 Jun 2001 21:29:42 +0000 (21:29 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 12 Jun 2001 21:29:42 +0000 (21:29 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1413 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/login.php
src/redirect.php

index 4b7218e97bca7c53247490f6adcc584010f4fcfe..e48c691f28b0170fac6caee4e5e5b3eb8f18d46a 100644 (file)
          $rcptaddress = substr($emailaddress, 7);
       else
          $rcptaddress = $emailaddress;
+        
+      if (($pos = strpos($rcptaddress, '?')) !== false)
+      {
+         $a = substr($rcptaddress, $pos + 1);
+        $rcptaddress = substr($rcptaddress, 0, $pos);
+        $a = explode('=', $a, 2);
+        if (isset($a[1])) {
+           $name = urldecode($a[0]);
+           $val = urldecode($a[1]);
+           global $$name;
+           $$name = $val;
+        }
+      }
+      
+      // At this point, we have parsed a lot of the mailto stuff.  Let's
+      // do the rest -- CC, BCC, Subject, Body
+      // Note:  They can all be case insensitive
+      foreach ($GLOBALS as $k => $v)
+      {
+          $key = strtolower($k);
+         $value = urlencode($v);
+         if ($key == 'cc')
+            $rcptaddress .= '&send_to_cc=' . $value;
+         elseif ($key == 'bcc')
+            $rcptaddress .= '&send_to_bcc=' . $value;
+         elseif ($key == 'subject')
+            $rcptaddress .= '&subject=' . $value;
+         elseif ($key == 'body')
+            $rcptaddress .= '&body=' . $value;
+      }
+      
+      // Double-encode in this fashion to get past redirect.php properly
+      $rcptaddress = urlencode($rcptaddress);
    }
 
    include("../functions/strings.php");
index 22fd737cb6f3fe82055afee73c03471f22bd6f5c..12adb1c3e885a78a8d3d2eef646bc1e8d1d095af 100644 (file)
@@ -92,7 +92,8 @@
    session_register ('just_logged_in');
 
    if(isset($rcptemail))
-      header("Location: webmail.php?right_frame=compose.php&rcptaddress=$rcptemail");
+      header("Location: webmail.php?right_frame=compose.php&rcptaddress=" .
+         urlencode($rcptemail));
    else
       header("Location: webmail.php");
 ?>