X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=functions%2Fmime.php;h=27c0e00846b72973e20f7a3835846073596f45eb;hb=33aab559e47bc6c36748eb7d105b47dbdd6d89c1;hp=b17eb5b2cc7737c24fdd6b2e1913d724eadd0b82;hpb=dfc64d149b23ad2e06a10ff4f187ea9ce664bbc9;p=squirrelmail.git diff --git a/functions/mime.php b/functions/mime.php index b17eb5b2..27c0e008 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -6,7 +6,7 @@ * This contains the functions necessary to detect and decode MIME * messages. * - * @copyright 1999-2019 The SquirrelMail Project Team + * @copyright 1999-2024 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -71,7 +71,7 @@ function mime_structure ($bodystructure, $flags=array()) { if (count($flags)) { foreach ($flags as $flag) { //FIXME: please document why it is we have to check the first char of the flag but we then go ahead and do a full string comparison anyway. Is this a speed enhancement? If not, let's keep it simple and just compare the full string and forget the switch block. - $char = strtoupper($flag{1}); + $char = strtoupper($flag[1]); switch ($char) { case 'S': if (strtolower($flag) == '\\seen') { @@ -151,7 +151,7 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) { /* There is some information in the content info header that could be important * in order to parse html messages. Let's get them here. */ -// if ($ret{0} == '<') { +// if ($ret[0] == '<') { // $data = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent_id.MIME]", true, $response, $message, TRUE); // } } else if (preg_match('/"([^"]*)"/', $topline, $regs)) { @@ -190,7 +190,8 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) { return $ret; } -function mime_print_body_lines ($imap_stream, $id, $ent_id=1, $encoding, $rStream='php://stdout', $force_crlf='') { +// TODO: Needs documentation. $ent_id default is usually 1 +function mime_print_body_lines ($imap_stream, $id, $ent_id, $encoding, $rStream='php://stdout', $force_crlf='') { /* Don't kill the connection if the browser is over a dialup * and it would take over 30 seconds to download it. @@ -395,18 +396,38 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma */ if ($body_message->header->type1 == 'html') { - if ($show_html_default <> 1) { + // Do we need to make an HTML part viewable as non-HTML plain text? + if ($show_html_default != 1) { $entity_conv = array(' ' => ' ', - '

' => "\n", - '

' => "\n", - '
' => "\n", - '
' => "\n", - '
' => "\n", - '
' => "\n", + // These are better done by regex (below) + // '

' => "\n", + // '

' => "\n", + // '
' => "\n", + // '
' => "\n", + // '
' => "\n", + // '
' => "\n", + // '' => "\n", + // '

' => "\n", '>' => '>', - '<' => '<'); + '<' => '<', + '&' => '&', + '©' => '©'); + // first, completely remove