From fab8e10c8f59d59185e24bbbddf6c37862ac7d49 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Fri, 28 Sep 2007 17:27:29 +0000 Subject: [PATCH] Make message_details actually show the correct entity when viewing details of attached messages git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12701 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 2 ++ .../message_details/message_details_bottom.php | 16 ++++++++++++---- .../message_details/message_details_main.php | 17 +++++++++++------ plugins/message_details/message_details_top.php | 4 +++- plugins/message_details/setup.php | 4 ++-- 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e075d18..d7bc8374 100644 --- a/ChangeLog +++ b/ChangeLog @@ -218,6 +218,8 @@ Version 1.5.2 - SVN - Removed "Include CCs when Forwarding Messages", which had no functionality whatsoever. - Added "preselected" query argument to mailbox list. + - Make the Message Details plugin actually show the correct entity when + viewing details of attached messages. Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/plugins/message_details/message_details_bottom.php b/plugins/message_details/message_details_bottom.php index e4bb3971..b9cd0f6a 100644 --- a/plugins/message_details/message_details_bottom.php +++ b/plugins/message_details/message_details_bottom.php @@ -13,6 +13,7 @@ * @package plugins * @subpackage message_details */ +//FIXME: this file uses HTML extensively and eventually needs to be "templatized" (don't echo HTML directly) /** * Include the SquirrelMail initialization file. @@ -33,12 +34,15 @@ $msgd_8bit_in_hex=false; if (!empty($md_action)) { sqgetGlobalVar('passed_id', $passed_id, SQ_GET); + if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) + $passed_ent_id = 0; sqgetGlobalVar('mailbox', $mailbox, SQ_GET); /* - * add third function argument, if you want to see + * change $unformatted to TRUE if you want to see * message source without formating */ - echo get_message_details($mailbox, $passed_id); + $unformatted = FALSE; + echo get_message_details($mailbox, $passed_id, $passed_ent_id, $unformatted); } @@ -100,20 +104,24 @@ function CalcEntity($entString, $direction) { * Returns actual message details * @param string $mailbox * @param string $passed_id + * @param string $passed_ent_id * @param boolean $stripHTML If TRUE, only plain text is returned, * default is FALSE, wherein output contains * pretty-HTMLification of message body * @return string The formatted message details * @access public */ -function get_message_details($mailbox, $passed_id, $stripHTML=FALSE) { +function get_message_details($mailbox, $passed_id, $passed_ent_id=0, $stripHTML=FALSE) { global $imapServerAddress, $imapPort, $color,$msgd_8bit_in_hex, $username; $returnValue = ''; $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0); $read = sqimap_mailbox_select($imapConnection, $mailbox); - $body = sqimap_run_command($imapConnection, "FETCH $passed_id RFC822",true, $response, $readmessage, TRUE); + if (!empty($passed_ent_id)) + $body = sqimap_run_command($imapConnection, "FETCH $passed_id BODY[$passed_ent_id]",true, $response, $readmessage, TRUE); + else + $body = sqimap_run_command($imapConnection, "FETCH $passed_id RFC822",true, $response, $readmessage, TRUE); $message_body = ''; $header = false; $mimepart = false; diff --git a/plugins/message_details/message_details_main.php b/plugins/message_details/message_details_main.php index cfe0139f..72f309e0 100644 --- a/plugins/message_details/message_details_main.php +++ b/plugins/message_details/message_details_main.php @@ -23,12 +23,17 @@ displayHtmlHeader( _("Message Details"), '', FALSE ); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqgetGlobalVar('passed_id', $passed_id, SQ_GET); +if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) + $passed_ent_id = 0; +//FIXME: Don't echo HTML directly - need to "templatize" this echo "\n"; -echo ''; -echo ''; +echo ''; +echo ''; echo ''."\n"."\n"; -?> \ No newline at end of file +?> diff --git a/plugins/message_details/message_details_top.php b/plugins/message_details/message_details_top.php index aa08a472..3263d258 100644 --- a/plugins/message_details/message_details_top.php +++ b/plugins/message_details/message_details_top.php @@ -31,6 +31,8 @@ displayHtmlHeader( _("Message Details"), "\n", FALSE ); sqgetGlobalVar('passed_id', $passed_id, SQ_GET); +if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) + $passed_ent_id = 0; sqgetGlobalVar('mailbox', $mailbox, SQ_GET); echo "\n" . @@ -38,7 +40,7 @@ echo "  '. diff --git a/plugins/message_details/setup.php b/plugins/message_details/setup.php index 0b2c1341..d5a8a131 100644 --- a/plugins/message_details/setup.php +++ b/plugins/message_details/setup.php @@ -30,13 +30,13 @@ function squirrelmail_plugin_init_message_details() * @access private */ function show_message_details(&$links) { - global $passed_id, $mailbox, $ent_num; + global $passed_id, $mailbox, $passed_ent_id; if (strlen(trim($mailbox)) < 1) { $mailbox = 'INBOX'; } - $params = '?passed_ent_id=' . $ent_num . + $params = '?passed_ent_id=' . $passed_ent_id . '&mailbox=' . urlencode($mailbox) . '&passed_id=' . $passed_id; -- 2.25.1