}
if (isset($draft)) {
- require_once ('../src/draft_actions.php');
- if (!saveMessageAsDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id)) {
+ include_once ('../src/draft_actions.php');
+ if (! isset($reply_id)) {
+ $reply_id = 0;
+ }
+ if (! isset($MDN)) {
+ $MDN = 'False';
+ }
+ if (!saveMessageAsDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id, $MDN)) {
showInputForm();
exit();
} else {
$draft_message = _("Draft Email Saved");
/* If this is a resumed draft, then delete the original */
if(isset($delete_draft)) {
- Header("Location: delete_message.php?mailbox=$draft_folder".
- "&message=$delete_draft&sort=$sort&startMessage=1");
+ Header("Location: delete_message.php?mailbox=" . urlencode($draft_folder) .
+ "&message=$delete_draft&sort=$sort&startMessage=1&saved_draft=yes");
exit();
- } else {
+ }
+ else {
+ if ($compose_new_win == '1') {
+ Header("Location: compose.php?saved_draft=yes");
+ exit();
+ }
+ else {
Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort".
"&startMessage=1¬e=$draft_message");
exit();
+ }
}
}
}
}
/*
* Set $default_charset to correspond with the user's selection
- * of language interface.
+ * of language interface.
*/
set_my_charset();
/*
* This is to change all newlines to \n
- * We'll change them to \r\n later (in the sendMessage function)
+ * We'll change them to \r\n later (in the sendMessage function)
*/
$body = str_replace("\r\n", "\n", $body);
$body = str_replace("\r", "\n", $body);
* Rewrap $body so that no line is bigger than $editor_size
* This should only really kick in the sqWordWrap function
* if the browser doesn't support "HARD" as the wrap type
- * Or, in Opera's case, something goes wrong.
+ * Or, in Opera's case, something goes wrong.
*/
$body = explode("\n", $body);
$newBody = '';
}
$body = $newBody;
- do_hook("compose_send");
+ do_hook('compose_send');
+ $MDN = False; // we are not sending a mdn response
if (! isset($mailprio)) {
$Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
- $subject, $body, $reply_id);
+ $subject, $body, $reply_id, $MDN);
} else {
$Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
- $subject, $body, $reply_id, $mailprio);
+ $subject, $body, $reply_id, $MDN, $mailprio);
}
if (! $Result) {
showInputForm();
exit();
}
if ( isset($delete_draft)) {
- Header("Location: delete_message.php?mailbox=$draft_folder".
- "&message=$delete_draft&sort=$sort&startMessage=1");
+ Header("Location: delete_message.php?mailbox=" . urlencode( $draft_folder ).
+ "&message=$delete_draft&sort=$sort&startMessage=1&mail_sent=yes");
exit();
}
-
- Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort".
- "&startMessage=1");
+ if ($compose_new_win == '1') {
+ Header("Location: compose.php?mail_sent=yes");
+ }
+ else {
+ Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort".
+ "&startMessage=1");
+ }
} else {
/*
*$imapConnection = sqimap_login($username, $key, $imapServerAddress,
* $imapPort, 0);
*/
- displayPageHeader($color, $mailbox);
-
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
if (isset($AttachFailure)) {
plain_error_message(_("Could not move/copy file. File not attached"),
$color);
showInputForm();
/* sqimap_logout($imapConnection); */
}
-}
-elseif (isset($html_addr_search_done)) {
- displayPageHeader($color, $mailbox);
+} elseif (isset($html_addr_search_done)) {
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
if (isset($send_to_search) && is_array($send_to_search)) {
foreach ($send_to_search as $k => $v) {
}
}
showInputForm();
-}
-elseif (isset($html_addr_search)) {
+} elseif (isset($html_addr_search)) {
if (isset($HTTP_POST_FILES['attachfile']) &&
$HTTP_POST_FILES['attachfile']['tmp_name'] &&
$HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') {
* click. If you can think of a better way, please implement it.
*/
include_once('./addrbook_search_html.php');
-}
-elseif (isset($attach)) {
+} elseif (isset($attach)) {
if (saveAttachedFiles()) {
plain_error_message(_("Could not move/copy file. File not attached"), $color);
}
- displayPageHeader($color, $mailbox);
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
showInputForm();
}
-elseif (isset($do_delete)) {
- displayPageHeader($color, $mailbox);
+elseif (isset($sigappend)) {
+ $idents = getPref($data_dir, $username, 'identities', 0);
+ if ($idents > 1) {
+ if ($identity == 'default') {
+ $no = 'g';
+ } else {
+ $no = $identity;
+ }
+ $signature = getSig($data_dir, $username, $no);
+ }
+ $body .= "\n\n".($prefix_sig==true? "-- \n":'').$signature;
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ } else {
+ displayPageHeader($color, $mailbox);
+ }
+ showInputForm();
+} elseif (isset($do_delete)) {
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
$hashed_attachment_dir = getHashedDir($username, $attachment_dir);
if (isset($delete) && is_array($delete)) {
*/
$imapConnection = sqimap_login($username, $key, $imapServerAddress,
$imapPort, 0);
- displayPageHeader($color, $mailbox);
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
$newmail = true;
/* This formats a CC string if they hit "reply all" */
if ($send_to_cc != '') {
$send_to_cc = ereg_replace('"[^"]*"', '', $send_to_cc);
- $send_to_cc = ereg_replace(';', ',', $send_to_cc);
+ $send_to_cc = str_replace(';', ',', $send_to_cc);
$sendcc = explode(',', $send_to_cc);
$send_to_cc = '';
$use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
$from_htmladdr_search, $location_of_buttons, $attachment_dir,
$username, $data_dir, $identity, $draft_id, $delete_draft,
- $mailprio;
+ $mailprio, $default_use_mdn, $mdn_user_support, $compose_new_win,
+ $saved_draft, $mail_sent;
$subject = decodeHeader($subject, false);
$reply_subj = decodeHeader($reply_subj, false);
echo "\n" . '<FORM name=compose action="compose.php" METHOD=POST ' .
'ENCTYPE="multipart/form-data"';
do_hook("compose_form");
+
+
echo ">\n";
if (isset($draft_id)) {
if (isset($delete_draft)) {
echo '<input type="hidden" name="delete_draft" value="' . $delete_draft. "\">\n";
}
-
+ if ($saved_draft == 'yes') {
+ echo '<BR><CENTER><B>'. _("Draft Saved").'</CENTER></B>';
+ }
+ if ($mail_sent == 'yes') {
+ echo '<BR><CENTER><B>'. _("Your Message has been sent").'</CENTER></B>';
+ }
echo '<TABLE WIDTH="100%" ALIGN=center CELLSPACING=0 BORDER=0>' . "\n";
-
+ if ($compose_new_win == '1') {
+ echo ' <TR><TD></TD><TD ALIGN="RIGHT"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE='._("Close").'></TD></TR>'."\n";
+ }
if ($location_of_buttons == 'top') {
showComposeButtonRow();
}
- $idents = getPref($data_dir, $username, 'identities');
- if ($idents != '' && $idents > 1) {
+ $idents = getPref($data_dir, $username, 'identities', 0);
+ if ($idents > 1) {
echo ' <TR>' . "\n" .
' <TD BGCOLOR="' . $color[4] . '" WIDTH="10%" ALIGN=RIGHT>' .
"\n" .
if ($em != '') {
echo htmlspecialchars(' <' . $em . '>') . "\n";
}
+ echo '</option>';
}
echo '</select>' . "\n" .
' </TD>' . "\n" .
if ($location_of_buttons == 'bottom') {
showComposeButtonRow();
} else {
- echo ' <TR><TD> </TD><TD ALIGN=LEFT><INPUT TYPE=SUBMIT ' .
- 'NAME=send VALUE="' . _("Send") . '"></TD></TR>' . "\n";
+ echo ' <TR><TD COLSPAN=2 ALIGN=LEFT>';
+ echo ' <INPUT TYPE=SUBMIT NAME=send VALUE="' . _("Send") . '"></TD></TR>' . "\n";
}
-
+
/* This code is for attachments */
echo ' <TR>' . "\n" .
' <TD VALIGN=MIDDLE ALIGN=RIGHT>' . "\n" .
' value="' . _("Add") .'">' . "\n" .
' </TD>' . "\n" .
' </TR>' . "\n";
+
if (count($attachments)) {
$hashed_attachment_dir = getHashedDir($username, $attachment_dir);
echo '<tr><td bgcolor="' . $color[0] . '" align=right>' . "\n" .
echo '<INPUT TYPE=hidden NAME=mailbox VALUE="' . htmlspecialchars($mailbox) .
"\">\n" .
'</FORM>';
- do_hook("compose_bottom");
+ do_hook('compose_bottom');
echo '</BODY></HTML>' . "\n";
}
-function showComposeButtonRow()
-{
+function showComposeButtonRow() {
global $use_javascript_addr_book, $save_as_draft,
- $default_use_priority, $mailprio;
+ $default_use_priority, $mailprio, $default_use_mdn,
+ $data_dir, $username;
+
+ echo " <TR><TD>\n</TD><TD>\n";
+ if ($default_use_priority) {
+ if(!isset($mailprio)) {
+ $mailprio = "3";
+ }
+ echo _("Priority") .': <select name="mailprio">'.
+ '<option value="1"'.($mailprio=='1'?' selected':'').'>'. _("High") .'</option>'.
+ '<option value="3"'.($mailprio=='3'?' selected':'').'>'. _("Normal") .'</option>'.
+ '<option value="5"'.($mailprio=='5'?' selected':'').'>'. _("Low").'</option>'.
+ "</select>";
+ }
+ $mdn_user_support=getPref($data_dir, $username, 'mdn_user_support',$default_use_mdn);
+ if ($default_use_mdn) {
+ if ($mdn_user_support) {
+ echo "\n\t". _("Receipt") .': '.
+ '<input type="checkbox" name="request_mdn" value=1>'. _("On read").
+ ' <input type="checkbox" name="request_dr" value=1>'. _("On Delivery");
+ }
+ }
echo " <TR><td>\n </td><td>\n";
+ echo "\n <INPUT TYPE=SUBMIT NAME=\"sigappend\" VALUE=\"". _("Signature") . "\">\n";
if ($use_javascript_addr_book) {
- echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"";
- echo " <input type=button value=\\\""._("Addresses").
- "\\\" onclick='javascript:open_abook();'>\");";
- echo " // --></SCRIPT><NOSCRIPT>\n";
- echo " <input type=submit name=\"html_addr_search\" value=\"".
- _("Addresses")."\">";
- echo " </NOSCRIPT>\n";
+ echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"".
+ " <input type=button value=\\\""._("Addresses").
+ "\\\" onclick='javascript:open_abook();'>\");".
+ " // --></SCRIPT><NOSCRIPT>\n".
+ " <input type=submit name=\"html_addr_search\" value=\"".
+ _("Addresses")."\">".
+ " </NOSCRIPT>\n";
} else {
echo " <input type=submit name=\"html_addr_search\" value=\"".
_("Addresses")."\">";
if ($save_as_draft) {
echo '<input type="submit" name ="draft" value="' . _("Save Draft") . "\">\n";
}
- if ($default_use_priority) {
- if(!isset($mailprio)) {
- $mailprio = "3";
- }
- echo "\n\t". _("Priority") .':<select name="mailprio">'.
- "\n\t\t<option value=1".($mailprio=='1'?' selected':'').'>'. _("High") .'</option>'.
- "\n\t\t<option value=3".($mailprio=='3'?' selected':'').'>'. _("Normal") .'</option>'.
- "\n\t\t<option value=5".($mailprio=='5'?' selected':'').'>'. _("Low").'</option>'.
- "\n\t</select>";
- }
do_hook('compose_button_row');
- echo " </TD>\n";
- echo " </TR>\n\n";
+ echo " </TD></TR>\n\n";
}
-function checkInput ($show)
-{
+function checkInput ($show) {
/*
* I implemented the $show variable because the error messages
* were getting sent before the page header. So, I check once
}
+
+
function ClearAttachments()
{
global $username, $attachments, $attachment_dir;