X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fcompose.php;h=82fa2392e550dfd8fc52f2c79f6d14a55603b0c8;hb=0037f04821b088de88f51ee46a34f8b7fbdf7d63;hp=84bbbc33a912059e69cee23b0eb843b78004c579;hpb=00793a259a025bf2d973cfa71aed3d0459e9be7b;p=squirrelmail.git
diff --git a/src/compose.php b/src/compose.php
index 84bbbc33..82fa2392 100644
--- a/src/compose.php
+++ b/src/compose.php
@@ -35,23 +35,34 @@ if (!isset($mailbox) || $mailbox == '' || ($mailbox == 'None')) {
}
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 {
+ } 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 {
+ 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();
+ }
}
}
}
@@ -69,13 +80,13 @@ if (isset($send)) {
}
/*
* 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);
@@ -84,7 +95,7 @@ if (isset($send)) {
* 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 = '';
@@ -94,44 +105,50 @@ if (isset($send)) {
}
if (strlen($line) <= $editor_size + 1) {
$newBody .= $line . "\n";
- }
- else {
+ } else {
sqWordWrap($line, $editor_size) . "\n";
$newBody .= $line;
}
}
$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);
- }
- else {
+ $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");
- }
- else {
+ 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);
@@ -141,9 +158,13 @@ if (isset($send)) {
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) {
@@ -168,8 +189,7 @@ elseif (isset($html_addr_search_done)) {
}
}
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') {
@@ -182,16 +202,42 @@ elseif (isset($html_addr_search)) {
* 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)) {
@@ -204,15 +250,19 @@ elseif (isset($do_delete)) {
}
showInputForm();
-}
-else {
+} else {
/*
* This handles the default case as well as the error case
* (they had the same code) --> if (isset($smtpErrors))
*/
$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;
@@ -243,9 +293,9 @@ function newMail () {
$reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size,
$draft_id, $use_signature;
- $send_to = decodeHeader($send_to);
- $send_to_cc = decodeHeader($send_to_cc);
- $send_to_bcc = decodeHeader($send_to_bcc);
+ $send_to = decodeHeader($send_to, false);
+ $send_to_cc = decodeHeader($send_to_cc, false);
+ $send_to_bcc = decodeHeader($send_to_bcc, false);
if ($forward_id) {
$id = $forward_id;
@@ -276,8 +326,7 @@ function newMail () {
mime_fetch_body($imapConnection, $id, 1),
$message->header->encoding);
}
- }
- else {
+ } else {
$body = '';
}
@@ -297,8 +346,7 @@ function newMail () {
if ($reply_id) {
if (ereg('^[ >]+', $body_ary[$i])) {
$body_ary[$i] = '>' . $body_ary[$i];
- }
- else {
+ } else {
$body_ary[$i] = '> ' . $body_ary[$i];
}
}
@@ -324,7 +372,7 @@ function newMail () {
$body = $bodyTop . $body;
}
elseif ($reply_id) {
- $orig_from = decodeHeader($orig_header->from);
+ $orig_from = decodeHeader($orig_header->from, false);
$body = getReplyCitation($orig_from) . $body;
}
@@ -338,7 +386,7 @@ function newMail () {
/* 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 = '';
@@ -372,8 +420,7 @@ function getAttachments($message) {
if (isset($draft_id)) {
$id = $draft_id;
- }
- else {
+ } else {
$id = $forward_id;
}
@@ -413,8 +460,7 @@ function getAttachments($message) {
$attachments[] = $newAttachment;
}
- }
- else {
+ } else {
for ($i = 0; $i < count($message->entities); $i++) {
getAttachments($message->entities[$i]);
}
@@ -429,11 +475,12 @@ function showInputForm () {
$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);
- $reply_subj = decodeHeader($reply_subj);
- $forward_subj = decodeHeader($forward_subj);
+ $subject = decodeHeader($subject, false);
+ $reply_subj = decodeHeader($reply_subj, false);
+ $forward_subj = decodeHeader($forward_subj, false);
if ($use_javascript_addr_book) {
echo "\n". '\n";
- }
- else {
+ echo " \n";
+ } else {
echo " ";
}
@@ -637,25 +710,13 @@ function showComposeButtonRow()
if ($save_as_draft) {
echo '\n";
}
- if ($default_use_priority) {
- if(!isset($mailprio)) {
- $mailprio = "3";
- }
- echo "\n\t". _("Priority") .':";
- }
do_hook('compose_button_row');
- echo " \n";
- echo " \n\n";
+ echo " \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
@@ -704,6 +765,8 @@ function saveAttachedFiles() {
}
+
+
function ClearAttachments()
{
global $username, $attachments, $attachment_dir;
@@ -734,8 +797,7 @@ function getReplyCitation($orig_from)
$orig_from = trim(substr($orig_from, 0, strpos($orig_from, '<')));
$orig_from = str_replace('"', '', $orig_from);
$orig_from = str_replace("'", '', $orig_from);
- }
- else {
+ } else {
$end_parpos = strrpos($orig_from, ')');
$end_parpos -= ($end_parpos === false ? $end_parpos : $parpos + 1);
$orig_from = trim(substr($orig_from, $parpos + 1, $end_parpos));