Note a bug
[squirrelmail.git] / plugins / spamcop / functions.php
index 2379a8fb55722d9212f8a8403911d0f98008bc1f..f133484d9c3e13edf15d47472cc78c44d2bd5a37 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * SpamCop plugin - functions
  *
- * @copyright 1999-2010 The SquirrelMail Project Team
+ * @copyright 1999-2012 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
@@ -180,6 +180,8 @@ function spamcop_enable_disable($option,$disable_action,$enable_action) {
  */
 function spamcop_getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
                                       $passed_ent_id='', $imapConnection) {
+                                          
+    global $username, $attachment_dir;
 
     if (!$passed_ent_id) {
         $body_a = sqimap_run_command($imapConnection,
@@ -197,11 +199,14 @@ function spamcop_getMessage_RFC822_Attachment($message, $composeMessage, $passed
         $body = implode('', $body_a) . "\r\n";
 
         $filename = sq_get_attach_tempfile();
-        $fp = fopen($filename, 'wb');
+        $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
+        
+        $fp = fopen("$hashed_attachment_dir/$filename", 'wb');
         fwrite ($fp, $body);
         fclose($fp);
         $composeMessage->initAttachment('message/rfc822','email.txt',
                          $filename);
     }
+    
     return $composeMessage;
 }