<?php
- /** smtp.php
- **
- ** This contains all the functions needed to send messages through
- ** an smtp server or sendmail.
- **
- ** $Id$
- **/
- if (defined('smtp_php'))
- return;
- define('smtp_php', true);
-
- require_once('../functions/addressbook.php');
- require_once('../functions/plugin.php');
-
- global $username, $popuser, $domain;
+/**
+ * smtp.php
+ *
+ * Copyright (c) 1999-2001 The SquirrelMail Development Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This contains all the functions needed to send messages through
+ * an smtp server or sendmail.
+ *
+ * $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 and global lines below. ***/
+/*** + 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('../functions/addressbook.php');
+require_once('../functions/plugin.php');
+require_once('../functions/prefs.php');
+
+global $username, $popuser, $domain;
// This should most probably go to some initialization...
if (ereg("^([^@%/]+)[@%/](.+)$", $username, $usernamedata)) {
$popuser = $usernamedata[1];
$domain = $usernamedata[2];
- unset($usernamedata);
+ unset($usernamedata);
} else {
$popuser = $username;
}
// 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)
{
// 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";
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");
}
}
}