From a2bfcbce2e1620762431cd34cd51513eb403633a Mon Sep 17 00:00:00 2001 From: kink Date: Tue, 28 Dec 2004 13:12:28 +0000 Subject: [PATCH] Add param 'clean' to formatBody to prevent irrelevant stuff like 'download this as a file' being output in printer friendly. I guess formatBody is a bit too much of an all-in-one function and it might be cleaner to split it up at some time in the future. Also add colons to the printer friendly mailheaders and make them bold. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8488 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 14 +++++++++++--- src/printer_friendly_bottom.php | 14 +++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/functions/mime.php b/functions/mime.php index f8eb09b0..ab9935f2 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -331,12 +331,14 @@ function translateText(&$body, $wrap_at, $charset) { $body = '
' . implode("\n", $body_ary) . '
'; } -/* This returns a parsed string called $body. That string can then +/** + * This returns a parsed string called $body. That string can then * be displayed as the actual message in the HTML. It contains * everything needed, including HTML Tags, Attachments at the * bottom, etc. + * @param clean Do not output stuff that's irrelevant for the printable version. */ -function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox='INBOX') { +function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox='INBOX', $clean=FALSE) { /* This if statement checks for the entity to show as the * primary message. To add more of them, just put them in the * order that is their priority. @@ -392,6 +394,12 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma translateText($body, $wrap_at, $body_message->header->getParameter('charset')); } + + // if this is the clean display (i.e. printer friendly), stop here. + if ( $clean ) { + return $body; + } + $link = 'passed_id=' . $id . '&ent_id='.$ent_num. '&mailbox=' . $urlmailbox .'&sort=' . $sort . '&startMessage=' . $startMessage . '&show_more=0'; @@ -2066,4 +2074,4 @@ function magicHTML($body, $id, $message, $mailbox = 'INBOX') { } // end fn SendDownloadHeaders -?> \ No newline at end of file +?> diff --git a/src/printer_friendly_bottom.php b/src/printer_friendly_bottom.php index 24113c8e..e90b134f 100644 --- a/src/printer_friendly_bottom.php +++ b/src/printer_friendly_bottom.php @@ -70,7 +70,7 @@ if ($show_html_default == 1) { $body = ''; if ($ent_ar[0] != '') { for ($i = 0; $i < count($ent_ar); $i++) { - $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox); + $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox, TRUE); $body .= '
'; } $hookResults = do_hook('message_body', $body); @@ -116,24 +116,24 @@ echo ''._("From").': ', 'left' ,'','valign="top"') . html_tag( 'td', $from, 'left' ) ) . "\n" . html_tag( 'tr', - html_tag( 'td', _("Subject").' ', 'left','','valign="top"' ) . + html_tag( 'td', ''._("Subject").': ', 'left','','valign="top"' ) . html_tag( 'td', $subject, 'left' ) ) . "\n" . html_tag( 'tr', - html_tag( 'td', _("Date").' ', 'left' ) . + html_tag( 'td', ''._("Date").': ', 'left' ) . html_tag( 'td', htmlspecialchars($date), 'left' ) ) . "\n" . html_tag( 'tr', - html_tag( 'td', _("To").' ', 'left','','valign="top"' ) . + html_tag( 'td', ''._("To").': ', 'left','','valign="top"' ) . html_tag( 'td', $to, 'left' ) ) . "\n"; if ( strlen($cc) > 0 ) { /* only show Cc: if it's there... */ echo html_tag( 'tr', - html_tag( 'td', _("Cc").' ', 'left','','valign="top"' ) . + html_tag( 'td', ''._("Cc").': ', 'left','','valign="top"' ) . html_tag( 'td', $cc, 'left' ) ); } @@ -194,4 +194,4 @@ function pf_clean_string ( $unclean_string, $num_leading_spaces ) { } /* end pf_clean_string() function */ /* --end pf-specific functions */ -?> \ No newline at end of file +?> -- 2.25.1