X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fread_body.php;h=826324aa5d6dea41ab26d310275e2e59553fa517;hp=1c193400c0fca8f1a76f5390a5eadfb643364bca;hb=f557f53eac769aa1bb266621bae1961d6a2aeab4;hpb=e0e55568ad7913c7b7b438d5fa57f772aeac4e0d diff --git a/src/read_body.php b/src/read_body.php index 1c193400..826324aa 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -20,35 +20,65 @@ require_once('../functions/url_parser.php'); require_once('../functions/smtp.php'); /** -* Given an IMAP message id number, this will look it up in the cached -* and sorted msgs array and return the index. Used for finding the next -* and previous messages. -* -* returns the index of the next valid message from the array -*/ + * Given an IMAP message id number, this will look it up in the cached + * and sorted msgs array and return the index. Used for finding the next + * and previous messages. + * + * @return the index of the next valid message from the array + */ function findNextMessage() { - global $msort, $currentArrayIndex, $msgs, $sort; + global $msort, $currentArrayIndex, $msgs, $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 ($sort == 6) { + if ($thread_sort_messages == 1 || $allow_server_sort == TRUE) { + reset($server_sort_array); + while(list($key, $value) = each ($server_sort_array)) { + if ($currentArrayIndex == $value) { + if ($key == (count($server_sort_array) - 1)) { + $result = -1; + break; + } + $result = $server_sort_array[$key + 1]; + break; + } + } + } + elseif ($sort == 6 && $allow_server_sort != TRUE && + $thread_sort_messages != 1) { if ($currentArrayIndex != 1) { $result = $currentArrayIndex - 1; } - } else { + } + elseif ($allow_server_sort != TRUE && $thread_sort_messages != 1 ) { + if (!is_array($msort)) { + return -1; + } for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) { if ($currentArrayIndex == $msgs[$key]['ID']) { next($msort); $key = key($msort); - if (isset($key)) + if (isset($key)){ $result = $msgs[$key]['ID']; break; + } } } } return ($result); } -/** Removes just one address from the list of addresses. */ +/** + * Removes just one address from the list of addresses. + * + * @param &$addr_list a by-ref array of addresses + * @param $addr an address to remove + * @return void, since it operates on a by-ref param + */ function RemoveAddress(&$addr_list, $addr) { if ($addr != '') { foreach (array_keys($addr_list, $addr) as $key_to_delete) { @@ -60,16 +90,37 @@ 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; - + $mailbox, $data_dir, $username, $thread_sort_messages, + $allow_server_sort, $server_sort_array; $result = -1; - - if ($sort == 6) { + 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) { + if ($key == 0) { + $result = -1; + break; + } + $result = $server_sort_array[$key -1]; + break; + } + } + } + elseif ($sort == 6 && $allow_server_sort != TRUE && + $thread_sort_messages != 1) { $numMessages = sqimap_get_num_messages($imapConnection, $mailbox); if ($currentArrayIndex != $numMessages) { $result = $currentArrayIndex + 1; } - } else { + } + elseif ($thread_sort_messages != 1 && $allow_server_sort != TRUE) { + if (!is_array($msort)) { + return -1; + } for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) { if ($currentArrayIndex == $msgs[$key]['ID']) { prev($msort); @@ -85,9 +136,9 @@ function findPreviousMessage() { } /** -* Displays a link to a page where the message is displayed more -* "printer friendly". -*/ + * Displays a link to a page where the message is displayed more + * "printer friendly". + */ function printer_friendly_link() { global $passed_id, $mailbox, $ent_num, $color, $pf_subtle_link, @@ -98,17 +149,17 @@ function printer_friendly_link() { } $params = '?passed_ent_id=' . $ent_num . - '&mailbox=' . urlencode($mailbox) . - '&passed_id=' . $passed_id; + '&mailbox=' . urlencode($mailbox) . + '&passed_id=' . $passed_id; $print_text = _("View Printable Version"); if (!$pf_subtle_link) { /* The link is large, on the bottom of the header panel. */ - $result = '' . - '' . - ' ' . - ''."\n"; + $result = '' . + '' . + ' ' . + ''."\n"; } else { /* The link is subtle, below "view full header". */ $result = "
\n"; @@ -116,7 +167,7 @@ function printer_friendly_link() { /* Output the link. */ if ($javascript_on) { - $result .= '' . "\n"; @@ -886,11 +1055,12 @@ 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\""; - $sendreceipt=""; - + $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\""; + $sendreceipt=''; + /* if ($MDNDebug && $supportMDN) { echo " \n" . " \n" . @@ -900,6 +1070,7 @@ if ($default_use_mdn) { ' ' . "\n" . ' ' . "\n"; } else { + */ echo " \n" . " \n" . " "._("Read receipt").": \n". @@ -907,13 +1078,15 @@ if ($default_use_mdn) { ' '._("send").''. "\n" . ' ' . "\n" . ' ' . "\n"; + /* } + */ } elseif ($sendreceipt == 'removeMDN' ) { ToggleMDNflag ( false ); $sendreceipt = 'send'; - $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\""; + $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\""; echo ''. "" . _("Read receipt") . ': ' . @@ -934,12 +1107,12 @@ echo '' . ' ' . ''; flush(); - echo "\n" . "
\n" . - '
'. - formatBody($imapConnection, $message, $color, $wrap_at). - '
' . + '
'; +echo $body; + +echo '' . '' . "\n" . " " . '
 
' . "\n"; @@ -952,9 +1125,9 @@ if (($attachment_common_show_images) && $imgurl = '../src/download.php' . '?' . 'passed_id=' . urlencode($img['passed_id']) . - '&mailbox=' . urlencode($mailbox) . - '&passed_ent_id=' . urlencode($img['ent_id']) . - '&absolute_dl=true'; + '&mailbox=' . urlencode($mailbox) . + '&passed_ent_id=' . urlencode($img['ent_id']) . + '&absolute_dl=true'; echo "\n" . '' .