|
@@ -33,7 +33,8 @@
|
|
// This function is used when not sending or adding attachments
|
|
// This function is used when not sending or adding attachments
|
|
function newMail () {
|
|
function newMail () {
|
|
global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
|
|
global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
|
|
- $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size;
|
|
|
|
|
|
+ $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size,
|
|
|
|
+ $draft_id, $use_signature;
|
|
|
|
|
|
$send_to = decodeHeader($send_to);
|
|
$send_to = decodeHeader($send_to);
|
|
$send_to_cc = decodeHeader($send_to_cc);
|
|
$send_to_cc = decodeHeader($send_to_cc);
|
|
@@ -44,6 +45,10 @@
|
|
elseif ($reply_id)
|
|
elseif ($reply_id)
|
|
$id = $reply_id;
|
|
$id = $reply_id;
|
|
|
|
|
|
|
|
+ if ($draft_id){
|
|
|
|
+ $id = $draft_id;
|
|
|
|
+ $use_signature = FALSE;
|
|
|
|
+ }
|
|
|
|
|
|
if (isset($id)) {
|
|
if (isset($id)) {
|
|
sqimap_mailbox_select($imapConnection, $mailbox);
|
|
sqimap_mailbox_select($imapConnection, $mailbox);
|
|
@@ -73,7 +78,7 @@
|
|
}
|
|
}
|
|
$body = "";
|
|
$body = "";
|
|
for ($i=0; isset($body_ary[$i]); $i++) {
|
|
for ($i=0; isset($body_ary[$i]); $i++) {
|
|
- if (! $forward_id)
|
|
|
|
|
|
+ if ($reply_id)
|
|
{
|
|
{
|
|
if (ereg('^[ >]+', $body_ary[$i]))
|
|
if (ereg('^[ >]+', $body_ary[$i]))
|
|
{
|
|
{
|
|
@@ -147,11 +152,16 @@
|
|
|
|
|
|
function getAttachments($message) {
|
|
function getAttachments($message) {
|
|
global $mailbox, $attachments, $attachment_dir, $imapConnection,
|
|
global $mailbox, $attachments, $attachment_dir, $imapConnection,
|
|
- $ent_num, $forward_id;
|
|
|
|
|
|
+ $ent_num, $forward_id, $draft_id;
|
|
|
|
+
|
|
|
|
+ if (isset($draft_id))
|
|
|
|
+ $id = $draft_id;
|
|
|
|
+ else
|
|
|
|
+ $id = $forward_id;
|
|
|
|
|
|
if (!$message) {
|
|
if (!$message) {
|
|
sqimap_mailbox_select($imapConnection, $mailbox);
|
|
sqimap_mailbox_select($imapConnection, $mailbox);
|
|
- $message = sqimap_get_message($imapConnection, $forward_id,
|
|
|
|
|
|
+ $message = sqimap_get_message($imapConnection, $id,
|
|
$mailbox);
|
|
$mailbox);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -175,7 +185,7 @@
|
|
// Write Attachment to file
|
|
// Write Attachment to file
|
|
$fp = fopen ($attachment_dir.$localfilename, 'w');
|
|
$fp = fopen ($attachment_dir.$localfilename, 'w');
|
|
fputs ($fp, decodeBody(mime_fetch_body($imapConnection,
|
|
fputs ($fp, decodeBody(mime_fetch_body($imapConnection,
|
|
- $forward_id, $message->header->entity_id),
|
|
|
|
|
|
+ $id, $message->header->entity_id),
|
|
$message->header->encoding));
|
|
$message->header->encoding));
|
|
fclose ($fp);
|
|
fclose ($fp);
|
|
|
|
|
|
@@ -195,7 +205,7 @@
|
|
$editor_size, $attachments, $subject, $newmail,
|
|
$editor_size, $attachments, $subject, $newmail,
|
|
$use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
|
|
$use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
|
|
$from_htmladdr_search, $location_of_buttons, $attachment_dir,
|
|
$from_htmladdr_search, $location_of_buttons, $attachment_dir,
|
|
- $username, $data_dir, $identity;
|
|
|
|
|
|
+ $username, $data_dir, $identity, $draft_id;
|
|
|
|
|
|
$subject = decodeHeader($subject);
|
|
$subject = decodeHeader($subject);
|
|
$reply_subj = decodeHeader($reply_subj);
|
|
$reply_subj = decodeHeader($reply_subj);
|
|
@@ -216,6 +226,9 @@
|
|
do_hook("compose_form");
|
|
do_hook("compose_form");
|
|
echo ">\n";
|
|
echo ">\n";
|
|
|
|
|
|
|
|
+ if ( isset($draft_id))
|
|
|
|
+ echo "<input type=\"hidden\" name=\"delete_draft\" value=\"$draft_id\">\n";
|
|
|
|
+
|
|
echo "<TABLE WIDTH=\"100%\" ALIGN=center CELLSPACING=0 BORDER=0>\n";
|
|
echo "<TABLE WIDTH=\"100%\" ALIGN=center CELLSPACING=0 BORDER=0>\n";
|
|
|
|
|
|
if ($location_of_buttons == 'top') showComposeButtonRow();
|
|
if ($location_of_buttons == 'top') showComposeButtonRow();
|
|
@@ -355,7 +368,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
function showComposeButtonRow() {
|
|
function showComposeButtonRow() {
|
|
- global $use_javascript_addr_book;
|
|
|
|
|
|
+ global $use_javascript_addr_book, $save_as_draft;
|
|
|
|
|
|
echo " <TR><td>\n </td><td>\n";
|
|
echo " <TR><td>\n </td><td>\n";
|
|
if ($use_javascript_addr_book) {
|
|
if ($use_javascript_addr_book) {
|
|
@@ -369,6 +382,10 @@
|
|
}
|
|
}
|
|
echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
|
|
echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
|
|
|
|
|
|
|
|
+ if ($save_as_draft == true)
|
|
|
|
+ echo "<input type=\"submit\" name =\"draft\" value=\"Save Draft\">\n";
|
|
|
|
+
|
|
|
|
+
|
|
do_hook("compose_button_row");
|
|
do_hook("compose_button_row");
|
|
|
|
|
|
echo " </TD>\n";
|
|
echo " </TD>\n";
|
|
@@ -419,6 +436,17 @@
|
|
if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
|
|
if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
|
|
$mailbox = "INBOX";
|
|
$mailbox = "INBOX";
|
|
|
|
|
|
|
|
+ if (isset($draft)) {
|
|
|
|
+ require_once ('../src/draft_actions.php');
|
|
|
|
+ if(! saveMessagetoDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $$reply_id)) {
|
|
|
|
+ showInputForm();
|
|
|
|
+ exit();
|
|
|
|
+ } else {
|
|
|
|
+ Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort&startMessage=1¬e=Draft%20Email%20Saved");
|
|
|
|
+ exit();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (isset($send)) {
|
|
if (isset($send)) {
|
|
if (isset($HTTP_POST_FILES['attachfile']) &&
|
|
if (isset($HTTP_POST_FILES['attachfile']) &&
|
|
$HTTP_POST_FILES['attachfile']['tmp_name'] &&
|
|
$HTTP_POST_FILES['attachfile']['tmp_name'] &&
|
|
@@ -461,6 +489,11 @@
|
|
showInputForm();
|
|
showInputForm();
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
|
|
+ if ( isset($delete_draft)) {
|
|
|
|
+ Header("Location: delete_message.php?mailbox=$draft_folder&message=$delete_draft&sort=$sort&startMessage=1"$
|
|
|
|
+ exit();
|
|
|
|
+ }
|
|
|
|
+
|
|
Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");
|
|
Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");
|
|
} else {
|
|
} else {
|
|
//$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
|
|
//$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
|
|
@@ -541,6 +574,9 @@
|
|
if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num)
|
|
if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num)
|
|
getAttachments(0);
|
|
getAttachments(0);
|
|
|
|
|
|
|
|
+ if (isset($draft_id) && $draft_id && isset($ent_num) && $ent_num)
|
|
|
|
+ getAttachments(0);
|
|
|
|
+
|
|
newMail();
|
|
newMail();
|
|
showInputForm();
|
|
showInputForm();
|
|
sqimap_logout($imapConnection);
|
|
sqimap_logout($imapConnection);
|
|
@@ -586,4 +622,4 @@
|
|
/* Build and return the citation string. */
|
|
/* Build and return the citation string. */
|
|
return ($start . $orig_from . $end . "\n");
|
|
return ($start . $orig_from . $end . "\n");
|
|
}
|
|
}
|
|
-?>
|
|
|
|
|
|
+?>
|