X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fread_body.php;h=826324aa5d6dea41ab26d310275e2e59553fa517;hp=ec9a7623abd140a69ba9e96520bc51bd1e549390;hb=f557f53eac769aa1bb266621bae1961d6a2aeab4;hpb=78db15831566120a387428bdb3fb18a8bac49da3 diff --git a/src/read_body.php b/src/read_body.php index ec9a7623..826324aa 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -28,10 +28,14 @@ require_once('../functions/smtp.php'); */ function findNextMessage() { global $msort, $currentArrayIndex, $msgs, $sort, - $allow_thread_sort, $allow_server_sort, + $thread_sort_messages, $allow_server_sort, $server_sort_array; + if (!is_array($server_sort_array)) { + $thread_sort_messages = 0; + $allow_server_sort = FALSE; + } $result = -1; - if ($allow_thread_sort == true || $allow_server_sort == true) { + if ($thread_sort_messages == 1 || $allow_server_sort == TRUE) { reset($server_sort_array); while(list($key, $value) = each ($server_sort_array)) { if ($currentArrayIndex == $value) { @@ -44,13 +48,13 @@ function findNextMessage() { } } } - elseif ($sort == 6 && $allow_server_sort != true && - $allow_thread_sort != true) { + elseif ($sort == 6 && $allow_server_sort != TRUE && + $thread_sort_messages != 1) { if ($currentArrayIndex != 1) { $result = $currentArrayIndex - 1; } } - elseif ($allow_server_sort != true && $allow_thread_sort != true) { + elseif ($allow_server_sort != TRUE && $thread_sort_messages != 1 ) { if (!is_array($msort)) { return -1; } @@ -86,10 +90,14 @@ function RemoveAddress(&$addr_list, $addr) { /** returns the index of the previous message from the array. */ function findPreviousMessage() { global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection, - $mailbox, $data_dir, $username, $allow_thread_sort, + $mailbox, $data_dir, $username, $thread_sort_messages, $allow_server_sort, $server_sort_array; $result = -1; - if ($allow_thread_sort == true || $allow_server_sort == TRUE) { + if (!is_array($server_sort_array)) { + $thread_sort_messages = 0; + $allow_server_sort = FALSE; + } + if ($thread_sort_messages == 1 || $allow_server_sort == TRUE) { reset($server_sort_array); while(list($key, $value) = each ($server_sort_array)) { if ($currentArrayIndex == $value) { @@ -103,13 +111,13 @@ function findPreviousMessage() { } } elseif ($sort == 6 && $allow_server_sort != TRUE && - $allow_thread_sort != true) { + $thread_sort_messages != 1) { $numMessages = sqimap_get_num_messages($imapConnection, $mailbox); if ($currentArrayIndex != $numMessages) { $result = $currentArrayIndex + 1; } } - elseif ($allow_thread_sort != true && $allow_server_sort != TRUE) { + elseif ($thread_sort_messages != 1 && $allow_server_sort != TRUE) { if (!is_array($msort)) { return -1; } @@ -253,7 +261,6 @@ function SendMDN ( $recipient , $sender) { function ToggleMDNflag ( $set ) { global $imapConnection, $passed_id, $mailbox; sqimap_mailbox_select($imapConnection, $mailbox); - $sg = $set?'+':'-'; $cmd = 'STORE ' . $passed_id . ' ' . $sg . 'FLAGS ($MDNSent)'; $read = sqimap_run_command ($imapConnection, $cmd, true, $response, @@ -267,7 +274,7 @@ function ClearAttachments() { $rem_attachments = array(); foreach ($attachments as $info) { - if ($info->session == -1) { + if ($info['session'] == -1) { $attached_file = "$hashed_attachment_dir/$info[localfilename]"; if (file_exists($attached_file)) { unlink($attached_file); @@ -276,7 +283,7 @@ function ClearAttachments() { $rem_attachments[] = $info; } } - $attachments = rem_attachments; + $attachments = $rem_attachments; } function formatRecipientString($recipients, $item ) { @@ -576,8 +583,44 @@ $dateString = getLongDateString($message->header->date); /** * What do we reply to -- text only, if possible */ -$ent_num = findDisplayEntity($message); + +$body = ''; +/* experimental */ +/* +if ($message->header->type0 == 'multipart' && $message->header->type1 == 'digest') { + listEntities($message); + for ($i = 0; $i < count($message->entities); $i++) { + + $msg = $message->entities[$i]; + $body .= $msg->header->type0 .'/'.$msg->header->type1 .'
'; + + $msg->header->type0 = 'message'; + $msg->header->type1 = 'rfc822'; + $ent_ar = findDisplayEntity($msg, false); + for ($i = 0; $i < count($ent_ar); $i++) { + $body .= formatBody($imapConnection, $msg, $color, $wrap_at, $ent_ar[$i]); + } + $i++; + } +} else { +*/ + $ent_ar = findDisplayEntity($message, false); + $i = 0; + for ($i = 0; $i < count($ent_ar); $i++) { + $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i]); + } +/* +} +*/ + +/* first step in displaying multiple entities */ +$ent_ar = findDisplayEntity($message,true); + +$ent_num = $ent_ar[0]; +for ($i = 1 ; $i < count($ent_ar); $i++) { + $ent_num .= '_'.$ent_ar[$i]; +} /** TEXT STRINGS DEFINITIONS **/ $echo_more = _("more"); $echo_less = _("less"); @@ -682,19 +725,31 @@ if ($where && $what) { } echo _("Delete") . ' '; if (($mailbox == $draft_folder) && ($save_as_draft)) { - echo '| '. _("Resume Draft") . ''; } if ($mailbox == $sent_folder) { - echo '| '. _("Edit Message as New") . ''; @@ -729,31 +784,49 @@ if ( !($where && $what) ) { echo '' . '' . - '' . - '' ; + +$comp_uri = $base_uri . "src/compose.php?forward_id=$passed_id&". + "forward_subj=$url_subj&". + ($default_use_priority?"mailprio=$priority_level&":''). + "mailbox=$urlMailbox&ent_num=$ent_num"; + +if ($compose_new_win == '1') { + echo "'. _("Forward") . - ' | ' . - ' | '; + +$comp_uri = $base_uri . "src/compose.php?send_to=$url_replyto&". + "reply_subj=$url_subj&". + ($default_use_priority?"mailprio=$priority_level&":''). + "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num"; + +if ($compose_new_win == '1') { + echo "'. _("Reply") . - ' | ' . - ' | '; + +$comp_uri = $base_uri . "src/compose.php?send_to=$url_replytoall&". + "send_to_cc=$url_replytoallcc&reply_subj=$url_subj&". + ($default_use_priority?"mailprio=$priority_level&":''). + "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num"; + +if ($compose_new_win == '1') { + echo "'. _("Reply All") . '  ' . @@ -882,7 +955,6 @@ if ($default_use_mdn) { $read = sqimap_run_command ($imapConnection, "FETCH $passed_id FLAGS", true, $response, $readmessage); - $MDN_flag_present = preg_match( '/.*\$MDNSent/i', $read[0]); if (trim($MDN_to) && @@ -949,8 +1021,7 @@ if ($default_use_mdn) { " if (window.confirm(\"" . _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") . "\")) { \n" . - " window.location=($url); \n" . - ' window.reload()' . "\n" . + ' window.open('.$url.',"right");' . "\n" . ' }' . "\n" . '// -->' . "\n" . '' . "\n"; @@ -984,6 +1055,7 @@ if ($default_use_mdn) { if ( SendMDN( $MDN_to, $final_recipient ) > 0 && $supportMDN ) { ToggleMDNflag( true); } + ClearAttachments(); } $sendreceipt = 'removeMDN'; $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\""; @@ -1035,12 +1107,12 @@ echo '' . ' ' . ''; flush(); - echo "\n" . "
\n" . - '
'. - formatBody($imapConnection, $message, $color, $wrap_at). - '
' . + '
'; +echo $body; + +echo '' . '' . "\n" . " " . '
 
' . "\n";