Changeset 2781


Ignore:
Timestamp:
05/14/10 11:14:07 (14 years ago)
Author:
niltonneto
Message:

Ticket #1076 - Corrigido exibição de text/plain. Removido nl2br e incluído tag <PRE>.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r2777 r2781  
    818818                                { 
    819819                                        $content = str_replace( array( '<', '>' ), array( ' #$<$# ', ' #$>$# ' ), $content ); 
    820                                         $content = nl2br( htmlentities( $content ) ); 
     820                                        $content = htmlentities( $content ); 
    821821                                        $content = $this -> replace_links( $content ); 
    822822                                        $content = str_replace( array( ' #$&lt;$# ', ' #$&gt;$# ' ), array( '&lt;', '&gt;' ), $content ); 
    823                                         $content = '<span style="font-family: monospace">' . $content . '</span>'; 
    824          
     823                                        $content = '<pre style="font-family: monospace">' . $content . '</pre>'; 
     824 
    825825                                        $return[ 'body' ] = $content; 
    826          
     826 
    827827                                        return $return; 
    828828                                } 
    829829                        } 
    830830                } 
    831                 else 
     831                else  
    832832                { //Complicated message, multiple parts 
    833833                        $html_body = ''; 
     
    835835                        $has_multipart = true; 
    836836                        $this->has_cid = false; 
    837  
     837                         
    838838                        if (strtolower($msg->structure[$msg_number]->subtype) == "related") 
    839839                                $this->has_cid = true; 
    840  
     840                         
    841841                        if (strtolower($msg->structure[$msg_number]->subtype) == "alternative") { 
    842842                                $show_only_html = false; 
     
    844844                                        $file_type = strtolower($msg->file_type[$msg_number][$values]); 
    845845                                        if($file_type == "text/html") 
    846                                                 $show_only_html = true; 
     846                                                $show_only_html = true;                  
    847847                                } 
    848848                        } 
     
    852852                        foreach($msg->pid[$msg_number] as $values => $msg_part) 
    853853                        { 
    854  
    855                                 $file_type = strtolower($msg->file_type[$msg_number][$values]); 
     854                                $file_type = strtolower($msg->file_type[$msg_number][$values]);  
    856855                                if($file_type == "message/rfc822" || $file_type == "multipart/alternative") 
    857856                                { 
     
    864863                                        } 
    865864                                } 
    866  
    867                                 if(($file_type == "text/plain" 
     865                                                                 
     866                                if(($file_type == "text/plain"  
    868867                                        || $file_type == "text/html") 
    869868                                        && $file_type != 'attachment') 
    870                                 { 
     869                                {                                        
    871870                                        if($file_type == "text/plain" && !$show_only_html && $has_multipart) 
    872871                                        { 
    873872                                                // if TXT file size > 100kb, then it will not expand. 
    874873                                                if(!($file_type == "text/plain" && $msg->fsize[$msg_number][$values] > 102400)) { 
    875                                                         $content .= nl2br(htmlentities($this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values]))); 
     874                                                        $content .= htmlentities($this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values])); 
     875                                                        $content = '<pre style="font-family: monospace">' . $content . '</pre>';                                                         
    876876                                                } 
    877877                                        } 
     
    879879                                        else if($file_type == "text/html"  && $msg->fsize[$msg_number][$values] < 307200) 
    880880                                        { 
    881                                                 $content .= $this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values]); 
     881                                                $content .= $this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values]);                                           
    882882                                                $show_only_html = true; 
    883883                                        } 
     884                                         
    884885                                } 
    885886                                else if($file_type == "message/delivery-status" || $file_type == "message/feedback-report"){ 
    886887                                        $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 
    887                                         $content .= nl2br($this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values])); 
     888                                        $content .= $this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values]); 
     889                                        $content = '<pre style="font-family: monospace">' . $content . '</pre>'; 
    888890 
    889891                                } 
    890892                                else if($file_type == "message/rfc822" || $file_type == "text/rfc822-headers"){ 
    891  
     893                                         
    892894                                        include_once("class.imap_attachment.inc.php"); 
    893895                                        $att = new imap_attachment(); 
     
    946948                                                                { 
    947949                                                                        $body = str_replace( array( '<', '>' ), array( ' #$<$# ', ' #$>$# ' ), $body ); 
    948                                                                         $body = nl2br( htmlentities( $body ) ); 
     950                                                                        $body = htmlentities( $body ); 
    949951                                                                        $body = $this -> replace_links( $body ); 
    950952                                                                        $body = str_replace( array( ' #$&lt;$# ', ' #$&gt;$# ' ), array( '&lt;', '&gt;' ), $body ); 
    951                                                                         $body = '<span style="font-family: monospace">' . $body . '</span>'; 
     953                                                                        $body = '<pre style="font-family: monospace">' . $body . '</pre>'; 
    952954                                                                } 
    953955 
Note: See TracChangeset for help on using the changeset viewer.