Getting ready for 1.2.0 release.
[squirrelmail.git] / functions / smtp.php
index 4ef0c611332539a7dfa514b38379d8a4fedf9a67..9b2c7ea521f829985ec10dee3b2871e45e59df2f 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * smtp.php
  *
- * Copyright (c) 1999-2001 The SquirrelMail Development Team
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains all the functions needed to send messages through
@@ -30,6 +30,7 @@
 
 require_once('../functions/addressbook.php');
 require_once('../functions/plugin.php');
+require_once('../functions/prefs.php');
 
 global $username, $popuser, $domain;
 
@@ -116,10 +117,11 @@ global $username, $popuser, $domain;
 
    // Attach the files that are due to be attached
    function attachFiles ($fp) {
-      global $attachments, $attachment_dir;
+      global $attachments, $attachment_dir, $username;
 
       $length = 0;
 
+      $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
       if (isMultipart()) {
          foreach ($attachments as $info)
         {
@@ -136,7 +138,9 @@ global $username, $popuser, $domain;
             
            // Use 'rb' for NT systems -- read binary
            // Unix doesn't care -- everything's binary!  :-)
-            $file = fopen ($attachment_dir . $info['localfilename'], 'rb');
+             
+            $filename = $hashed_attachment_dir . '/' . $info['localfilename'];
+            $file = fopen ($filename, 'rb');
            if (substr($filetype, 0, 5) == 'text/' ||
                $filetype == 'message/rfc822') {
               $header .= "\r\n";
@@ -172,12 +176,14 @@ global $username, $popuser, $domain;
    function deleteAttachments() {
       global $attachments, $attachment_dir;
 
+      $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
       if (isMultipart()) {
          reset($attachments);
          while (list($localname, $remotename) = each($attachments)) {
             if (!ereg ("\\/", $localname)) {
-               unlink ($attachment_dir.$localname);
-               unlink ($attachment_dir.$localname.'.info');
+               $filename = $hashed_attachment_dir . '/' . $localname;
+               unlink ($filename);
+               unlink ("$filename.info");
             }
          }
       }