logging
[squirrelmail.git] / src / retrievalerror.php
index 7911f416d9c799093739c32f710d759e25abecd5..712fcee264fba799336e769291bd42d8ec3e3370 100644 (file)
@@ -1,23 +1,40 @@
 <?php
-   /**
-    **  retrievalerror.php
-    **
-    **  Copyright (c) 1999-2000 The SquirrelMail development team
-    **  Licensed under the GNU GPL. For full terms see the file COPYING.
-    **
-    **  Submits a message which Squirrelmail couldn't handle
-    **  because of malformedness of the message
-    **  sends it to retrievalerror@squirrelmail.org
-    **  Of course, this only happens when the end user has chosen to do so
-    **
-    **  $Id$
-    **/
-
-   require_once('../src/validate.php');
-   require_once("../functions/imap.php");
-   require_once("../functions/smtp.php");
-   require_once("../functions/page_header.php");
-   require_once("../src/load_prefs.php");
+
+/**
+ * retrievalerror.php
+ *
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Submits a message which Squirrelmail couldn't handle
+ * because of malformedness of the message
+ * sends it to retrievalerror@squirrelmail.org
+ * Of course, this only happens when the end user has chosen to do so
+ *
+ * $Id$
+ */
+
+/*****************************************************************/
+/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!!           ***/
+/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION.             ***/
+/***    + Base level indent should begin at left margin, as    ***/
+/***      the require_once below looks.                        ***/
+/***    + All identation should consist of four space blocks   ***/
+/***    + Tab characters are evil.                             ***/
+/***    + all comments should use "slash-star ... star-slash"  ***/
+/***      style -- no pound characters, no slash-slash style   ***/
+/***    + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD      ***/
+/***      ALWAYS USE { AND } CHARACTERS!!!                     ***/
+/***    + Please use ' instead of ", when possible. Note "     ***/
+/***      should always be used in _( ) function calls.        ***/
+/*** Thank you for your help making the SM code more readable. ***/
+/*****************************************************************/
+
+require_once('../src/validate.php');
+require_once("../functions/imap.php");
+require_once("../functions/smtp.php");
+require_once("../functions/page_header.php");
+require_once("../src/load_prefs.php");
 
    $destination = "retrievalerror@squirrelmail.org";
 
 
 
    function ClearAttachments() {
-       global $attachments, $attachment_dir;
+       global $attachments, $attachment_dir, $username;
 
+       $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
        foreach ($attachments as $info) {
-           if (file_exists($attachment_dir . $info['localfilename'])) {
-               unlink($attachment_dir . $info['localfilename']);
+           $attached_file = "$hashed_attachment_dir/$info[localfilename]";
+           if (file_exists($attached_file)) {
+               unlink($attached_file);
            }
        }
 
    $thebastard = implode('', $data);
 
 
-
+   $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
    $localfilename = GenerateRandomString(32, '', 7);
-   while (file_exists($attachment_dir . $localfilename))
+   $full_localfilename = "$hashed_attachment_dir/$localfilename";
+   while (file_exists($full_localfilename)) {
        $localfilename = GenerateRandomString(32, '', 7);
+       $full_localfilename = "$hashed_attachment_dir/$localfilename";
+   }
+
    // Write Attachment to file
-   $fp = fopen ($attachment_dir.$localfilename, 'w');
+   $fp = fopen ($full_localfilename, 'w');
    fputs ($fp, $thebastard);
    fclose ($fp);