X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fread_body.php;h=09c41347ee2a2b9e322615fe859f63a7295902b3;hb=f7cd8eb4e788b45f94c494836eae2ac63522a672;hp=f3bb0fcd8460f0c5ec939387607637bd6b22d333;hpb=a2b193bc8c1cefe3db9f4b38ce346f0527a0ec0e;p=squirrelmail.git diff --git a/src/read_body.php b/src/read_body.php index f3bb0fcd..09c41347 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -3,12 +3,11 @@ /** * read_body.php * - * Copyright (c) 1999-2005 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * This file is used for reading the msgs array and displaying * the resulting emails in the right frame. * + * @copyright © 1999-2006 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail */ @@ -30,7 +29,7 @@ require_once(SM_PATH . 'functions/html.php'); require_once(SM_PATH . 'functions/global.php'); require_once(SM_PATH . 'functions/identity.php'); include_once(SM_PATH . 'functions/arrays.php'); -require_once(SM_PATH . 'functions/mailbox_display.php'); +include_once(SM_PATH . 'functions/mailbox_display.php'); /** * Given an IMAP message id number, this will look it up in the cached @@ -81,7 +80,7 @@ function findPreviousMessage($uidset, $passed_id) { * @param int $passed_id */ function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) { - global $javascript_on; + global $javascript_on, $show_html_default; /* hackydiehack */ if( !sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET) ) { @@ -91,8 +90,9 @@ function printer_friendly_link($mailbox, $passed_id, $passed_ent_id) { } $params = '?passed_ent_id=' . urlencode($passed_ent_id) . '&mailbox=' . urlencode($mailbox) . - '&passed_id=' . urlencode($passed_id). - '&view_unsafe_images='. (bool) $view_unsafe_images; + '&passed_id=' . urlencode($passed_id) . + '&view_unsafe_images='. (bool) $view_unsafe_images . + '&show_html_default=' . $show_html_default; $print_text = _("View Printable Version"); @@ -289,27 +289,6 @@ function ToggleMDNflag ($set ,$imapConnection, $mailbox, $passed_id) { $readmessage, TRUE); } -function ClearAttachments() { - global $username, $attachments, $attachment_dir; - - $hashed_attachment_dir = getHashedDir($username, $attachment_dir); - - $rem_attachments = array(); - if (isset($attachments)) { - foreach ($attachments as $info) { - if ($info['session'] == -1) { - $attached_file = "$hashed_attachment_dir/$info[localfilename]"; - if (file_exists($attached_file)) { - unlink($attached_file); - } - } else { - $rem_attachments[] = $info; - } - } - } - $attachments = $rem_attachments; -} - function formatRecipientString($recipients, $item ) { global $show_more_cc, $show_more, $show_more_bcc, $PHP_SELF; @@ -827,15 +806,57 @@ global $sqimap_capabilities, $lastTargetMailbox; $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $aMailbox = sqm_api_mailbox_select($imapConnection, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array()); + +/** + Start code to set the columns to fetch in case of hitting the next/prev link + The reason for this is the fact that the cache can be invalidated which means that the headers + to fetch aren't there anymore. Before they got calculated when the messagelist was shown. + + Todo, better central handling of setting the mailbox options so we do not need to do the stuff below +*/ + /** - * Check if cache is still valid, $what contains the key - * which gives us acces to the array with uid's. At this moment - * 0 is used for a normal message list and search uses 1 as key. This can be - * changed / extended in the future. - * If on a select of a mailbox we detect that the cache should be invalidated due to - * the delete of messages or due to new messages we empty the list with uid's and - * that's what we detect below. - */ + * Replace From => To in case it concerns a draft or sent folder + */ +if (($mailbox == $sent_folder || $mailbox == $draft_folder) && + !in_array(SQM_COL_TO,$index_order)) { + $aNewOrder = array(); // nice var name ;) + foreach($index_order as $iCol) { + if ($iCol == SQM_COL_FROM) { + $iCol = SQM_COL_TO; + } + $aNewOrder[] = $iCol; + } + $aColumns = $aNewOrder; +} else { + $aColumns = $index_order; +} + +$aProps = array( + 'columns' => $aColumns, // columns bound settings + 'config' => array( + 'highlight_list' => $message_highlight_list, // row highlighting rules + 'trash_folder' => $trash_folder, + 'sent_folder' => $sent_folder, + 'draft_folder' => $draft_folder)); + +calcFetchColumns($aMailbox,$aProps); + +/** + End code to set the columns to fetch in case of hitting the next/prev link +*/ + + + +/** + * Check if cache is still valid, $what contains the key + * which gives us acces to the array with uid's. At this moment + * 0 is used for a normal message list and search uses 1 as key. This can be + * changed / extended in the future. + * If on a select of a mailbox we detect that the cache should be invalidated due to + * the delete of messages or due to new messages we empty the list with uid's and + * that's what we detect below. + */ if (!is_array($aMailbox['UIDSET'][$what])) { fetchMessageHeaders($imapConnection, $aMailbox); } @@ -913,7 +934,6 @@ if (isset($sendreceipt)) { $message->is_mdnsent = true; $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message; } - ClearAttachments(); } } /***********************************************/ @@ -1011,4 +1031,4 @@ $mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox; sqsession_register($mailbox_cache,'mailbox_cache'); ?> - \ No newline at end of file +