/**
* 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
*/
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
* @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) ) {
}
$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");
}
if (!$success) {
$msg = $deliver->dlv_msg . '<br />' .
- _("Server replied: ") . $deliver->dlv_ret_nr . ' '.
+ _("Server replied:") . ' ' . $deliver->dlv_ret_nr . ' ' .
$deliver->dlv_server_msg;
require_once(SM_PATH . 'functions/display_messages.php');
plain_error_message($msg, $color);
$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;
// Prev/Next links for regular messages
} else if ( true ) { //!(isset($where) && isset($what)) ) {
- /**
- * Check if cache is still valid
- */
- if (!is_array($aMailbox['UIDSET'][$what])) {
- fetchMessageHeaders($imapConnection, $aMailbox);
- }
$prev = findPreviousMessage($aMailbox['UIDSET'][$what], $passed_id);
$next = findNextMessage($aMailbox['UIDSET'][$what],$passed_id);
if (!sqgetGlobalVar('where', $where, SQ_GET) ) {
$where = 'right_main.php';
}
+/*
+ * Used as entry key to the list of uid's cached in the mailbox cache
+ * we use the cached uid's to get the next and prev message.
+ */
if (!sqgetGlobalVar('what', $what, SQ_GET) ){
$what = 0;
}
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$aMailbox = sqm_api_mailbox_select($imapConnection, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array());
+
/**
- * Check if cache is still valid
+ 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
+*/
+
+/**
+ * Replace From => To in case it concerns a draft or sent folder
*/
-$iSetIndex = $aMailbox['SETINDEX'];
-$aMailbox['CURRENT_MSG'][$iSetIndex] = $passed_id;
-//$aMailbox['OFFSET'] = $startMessage -1;
+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
+*/
-sqgetGlobalVar('aFetchColumns',$aFetchColumns,SQ_SESSION);
+
+
+/**
+ * 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, $aFetchColumns);
+ fetchMessageHeaders($imapConnection, $aMailbox);
}
+$iSetIndex = $aMailbox['SETINDEX'];
+$aMailbox['CURRENT_MSG'][$iSetIndex] = $passed_id;
+
/**
* Update the seen state
* and ignore in_array('\\seen',$aMailbox['PERMANENTFLAGS'],true)
$message->is_mdnsent = true;
$aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message;
}
- ClearAttachments();
}
}
/***********************************************/
}
}
-displayPageHeader($color, $mailbox);
+displayPageHeader($color, $mailbox,'','');
formatMenuBar($aMailbox, $passed_id, $passed_ent_id, $message,false);
formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
echo '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
echo ' <table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
echo ' <tr bgcolor="'.$color[4].'"><td>';
// echo ' <table cellpadding="1" cellspacing="5" align="left" border="0">';
-echo html_tag( 'table' ,'' , 'left', '', 'cellpadding="1" cellspacing="5" border="0"' );
+echo html_tag( 'table' ,'' , 'left', '', 'width="100%" cellpadding="1" cellspacing="5" border="0"' );
echo ' <tr>' . html_tag( 'td', '<br />'. $messagebody."\n", 'left')
. '</tr>';
echo ' </table>';
*/
$mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox;
sqsession_register($mailbox_cache,'mailbox_cache');
+
?>
-</body></html>
\ No newline at end of file
+</body></html>