Testing code removed.
[squirrelmail.git] / src / retrievalerror.php
index c5242fe96a04f29dda7ab111d29f0d1a70b0bb92..712fcee264fba799336e769291bd42d8ec3e3370 100644 (file)
@@ -1,21 +1,54 @@
 <?php
-   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@gm44c.xs4all.nl";
+/**
+ * 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";
 
    $attachments = array();
 
 
    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);
 
         'Please submit every message only once<BR>' .
         "<A HREF=\"../src/read_body.php?$par\">View the message</A><BR>";
 
-?>
\ No newline at end of file
+?>