X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fcompose.php;h=f3324d620092fd0d919a5fcede5ae83d32d3f65b;hp=8f578972f353781a92b70d311cc0623670eed56c;hb=429f8906ba14dd45dc3dd2c6d15d74bfcebd6703;hpb=469eb37bf814b159beaea58bdf08d88c1439fda0 diff --git a/src/compose.php b/src/compose.php index 8f578972..f3324d62 100644 --- a/src/compose.php +++ b/src/compose.php @@ -1,4 +1,4 @@ - +
\n"; - $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0); - displayPageHeader($color, "None"); + include("../src/load_prefs.php"); // This function is used when not sending or adding attachments function newMail () { global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body, - $reply_id, $send_to, $send_to_cc, $mailbox; + $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc; - if ($forward_id) { - selectMailbox($imapConnection, $mailbox, $numMessages); - $msg = fetchMessage($imapConnection, $forward_id, $mailbox); - - if (containsType($msg, "text", "html", $ent_num)) { - $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]); - } else if (containsType($msg, "text", "plain", $ent_num)) { - $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]); - } - // add other primary displaying msg types here - else { - // find any type that's displayable - if (containsType($msg, "text", "any_type", $ent_num)) { - $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]); - } else if (containsType($msg, "msg", "any_type", $ent_num)) { - $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]); - } else { - $body = _("No Message"); - } + $send_to = decodeHeader($send_to); + $send_to_cc = decodeHeader($send_to_cc); + + if ($forward_id) + $id = $forward_id; + else if ($reply_id) + $id = $reply_id; + + if ($id) { + sqimap_mailbox_select($imapConnection, $mailbox); + $message = sqimap_get_message($imapConnection, $id, $mailbox); + $message = getEntity($message, $ent_num); + + if ($message->header->type0 == "text" || $message->header->type1 == "message") { + $body = decodeBody(mime_fetch_body($imapConnection, $id, $message->header->entity_id), $message->header->encoding); + } else { + $body = ""; } - $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"]; - - $tmp = _("-------- Original Message ---------\n"); + if ($forward_id) + $tmp = _("-------- Original Message ---------\n"); + if ($message->header->type1 == "html") + $body = strip_tags($body); + $body_ary = explode("\n", $body); $body = ""; - for ($i=0;$i < count($body_ary);$i++) { - if ($type1 == "html") - $tmp .= strip_tags($body_ary[$i]); + for ($i=0; $i < count($body_ary); $i++) { + $tmp = $body_ary[$i]; + + if ($forward_id) + $body = "$body$tmp\n"; else - $tmp .= $body_ary[$i]; - $body = "$body$tmp\n"; - $tmp = ""; + $body = "$body> $tmp\n"; } + } - - if ($reply_id) { - selectMailbox($imapConnection, $mailbox, $numMessages); - $msg = fetchMessage($imapConnection, $reply_id, $mailbox); - - if (containsType($msg, "text", "html", $ent_num)) { - $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false); - } else if (containsType($msg, "text", "plain", $ent_num)) { - $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false); - } - // add other primary displaying msg types here - else { - // find any type that's displayable - if (containsType($msg, "text", "any_type", $ent_num)) { - $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false); - } else if (containsType($msg, "msg", "any_type", $ent_num)) { - $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false); - } else { - $body = _("No Message"); - } - } - - $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"]; - - $body_ary = explode("\n", $body); - $body = ""; - for ($i=0;$i < count($body_ary);$i++) { - if ($type1 == "html") - $tmp = strip_tags($body_ary[$i]); - else - $tmp = $body_ary[$i]; - $body = "$body> $tmp\n"; - } + + if (!$send_to) { + $send_to = sqimap_find_email($send_to); } - - // Add some decoding information - $send_to = encodeEmailAddr($send_to); - // parses the field and returns only the email address - $send_to = decodeEmailAddr($send_to); - - $send_to = strtolower($send_to); + $send_to = ereg_replace("\"", "", $send_to); $send_to = stripslashes($send_to); @@ -118,14 +88,9 @@ if ($sendcc[$i] == "") continue; - $sendcc[$i] = encodeEmailAddr($sendcc[$i]); - $sendcc[$i] = decodeEmailAddr($sendcc[$i]); - - $whofrom = encodeEmailAddr($msg["HEADER"]["FROM"]); - $whofrom = decodeEmailAddr($whofrom); - - $whoreplyto = encodeEmailAddr($msg["HEADER"]["REPLYTO"]); - $whoreplyto = decodeEmailAddr($whoreplyto); + $sendcc[$i] = sqimap_find_email($sendcc[$i]); + $whofrom = sqimap_find_displayable_name($msg["HEADER"]["FROM"]); + $whoreplyto = sqimap_find_email($msg["HEADER"]["REPLYTO"]); if ((strtolower(trim($sendcc[$i])) != strtolower(trim($whofrom))) && (strtolower(trim($sendcc[$i])) != strtolower(trim($whoreplyto))) && @@ -143,49 +108,65 @@ function showInputForm () { global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body, $passed_body, $color, $use_signature, $signature, $editor_size, - $attachments, $subject; + $attachments, $subject, $newmail, $use_javascript_addr_book, + $send_to_bcc, $reply_id, $mailbox; - echo "\n