X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fread_body.php;h=cedc34328b61780dda5f50eba39185c6eb1e7bf9;hp=866422d54163c0119445eaa163172c725d95fbb6;hb=34a6b7c2cede50f12a9ce43fef49e28ce324d3b6;hpb=cd7b8833879bcf92e21ba7f2da527493358fdda5;ds=sidebyside diff --git a/src/read_body.php b/src/read_body.php index 866422d5..cedc3432 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -17,37 +17,68 @@ require_once('../functions/imap.php'); require_once('../functions/mime.php'); require_once('../functions/date.php'); 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) { @@ -58,16 +89,38 @@ function RemoveAddress(&$addr_list, $addr) { /** returns the index of the previous message from the array. */ function findPreviousMessage() { - global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection; - global $mailbox, $data_dir, $username; + global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection, + $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); @@ -83,30 +136,30 @@ 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; - global $pf_subtle_link; - global $javascript_on; + global $passed_id, $mailbox, $ent_num, $color, + $pf_subtle_link, + $javascript_on; if (strlen(trim($mailbox)) < 1) { $mailbox = 'INBOX'; } - $params = '?passed_ent_id=' . $ent_num; - $params .= '&mailbox=' . urlencode($mailbox); - $params .= '&passed_id=' . $passed_id; + $params = '?passed_ent_id=' . $ent_num . + '&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" . - ' ' . "\n" . - '  ' . "\n" . - ' '."\n"; + $result = '' . + '' . + ' ' . + ''."\n"; } else { /* The link is subtle, below "view full header". */ $result = "
\n"; @@ -114,7 +167,7 @@ function printer_friendly_link() { /* Output the link. */ if ($javascript_on) { - $result .= '' . "\n"; + } + echo '' . + "" . + _("Read receipt") . ': ' . + "" . + '' . _("requested") . "  " . '[' . + _("Send read receipt now") . '] ' ." \n" . + '' . + '' . "\n"; + $sendreceipt = ''; + } + } + + if ( !isset( $sendreceipt ) || $sendreceipt == '' ) { + } else if ( $sendreceipt == 'send' ) { + if ( !$MDN_flag_present) { + if (isset($identity) ) { + $final_recipient = getPref($data_dir, $username, 'email_address' . '0', '' ); + } else { + $final_recipient = getPref($data_dir, $username, 'email_address', '' ); + } + + $final_recipient = trim($final_recipient); + if ($final_recipient == '' ) { + $final_recipient = getPref($data_dir, $username, 'email_address', '' ); + } + + 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=''; + /* + if ($MDNDebug && $supportMDN) { + echo " \n" . + " \n" . + " "._("Read receipt").": \n". + " \n" . + ' '._("send").''." " . '[' . _("Remove MDN flag") . '] ' . "\n" . + ' ' . "\n" . + ' ' . "\n"; + } else { + */ + echo " \n" . + " \n" . + " "._("Read receipt").": \n". + " \n" . + ' '._("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\""; + echo ''. + "" . + _("Read receipt") . ': ' . + "" . + '' . _("requested") . + "   [" . _("Send read receipt now") . "]" . + '' . + '' . "\n"; + $sendreceipt = ''; + + } + } +} + do_hook('read_body_header'); + echo '' . ' ' . ''; @@ -648,7 +1076,7 @@ echo "\n" "
\n" . '
'. formatBody($imapConnection, $message, $color, $wrap_at). - '
' . + '' . '' . "\n" . " " . '
 
' . "\n"; @@ -659,18 +1087,18 @@ if (($attachment_common_show_images) && foreach ($attachment_common_show_images_list as $img) { $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" . - " \n" . - " \n" . - " \n" . + '' . + '\n" . + "\n" . "
\n" . - " \n" . - "
' . + "\n" . + "
\n"; }