-function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
- $passed_ent_id='', $imapConnection) {
- global $attachment_dir, $username;
-
- $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
- if (!$passed_ent_id) {
- $body_a = sqimap_run_command($imapConnection,
- 'FETCH '.$passed_id.' RFC822',
- TRUE, $response, $readmessage,
- TRUE);
- } else {
- $body_a = sqimap_run_command($imapConnection,
- 'FETCH '.$passed_id.' BODY['.$passed_ent_id.']',
- TRUE, $response, $readmessage,TRUE);
- $message = $message->parent;
- }
- if ($response == 'OK') {
- array_shift($body_a);
- $body = implode('', $body_a) . "\r\n";
-
- $localfilename = GenerateRandomString(32, 'FILE', 7);
- $full_localfilename = "$hashed_attachment_dir/$localfilename";
- $fp = fopen( $full_localfilename, 'w');
- fwrite ($fp, $body);
- fclose($fp);
-
- /* dirty relative dir fix */
- if (substr($attachment_dir,0,3) == '../') {
- $attachment_dir = substr($attachment_dir,3);
- $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
- }
- $full_localfilename = "$hashed_attachment_dir/$localfilename";
-
- $composeMessage->initAttachment('message/rfc822','email.txt',
- $full_localfilename);
- }
- return $composeMessage;
-}
-
+require('../../include/init.php');
+/* IMAP functions depend on date and mime */
+include_once(SM_PATH . 'functions/date.php');
+include_once(SM_PATH . 'functions/mime.php');
+/* IMAP functions */
+include_once(SM_PATH . 'functions/imap_general.php');
+include_once(SM_PATH . 'functions/imap_messages.php');
+/* plugin functions */
+include_once(SM_PATH . 'plugins/spamcop/functions.php');
+
+include_once(SM_PATH . 'functions/compose.php');