Ignore:
Timestamp:
09/01/09 14:59:15 (15 years ago)
Author:
niltonneto
Message:

Ticket #528 - Adição de novo método para correção desse ticket.

File:
1 edited

Legend:

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

    r1382 r1384  
    162162                $from = $header->from; 
    163163                $head_array['from'] = array(); 
    164                 $head_array['from']['name'] = $this->decode_string( trim( $header -> fetchfrom ) ); 
     164                $head_array['from']['name'] = $this->decode_string($from[0]->personal); 
    165165                $head_array['from']['email'] = $this->decode_string($from[0]->mailbox) . "@" . $from[0]->host; 
    166166                if(!$head_array['from']['name']) 
     
    185185        function decode_string($string) 
    186186        {        
     187                 
    187188                if ((strpos(strtolower($string), '=?iso-8859-1') !== false) || (strpos(strtolower($string), '=?windows-1252') !== false)) 
    188189                { 
     
    190191                        foreach ($tmp as $tmp1) 
    191192                                $return .= $this->htmlspecialchars_encode($tmp1->text); 
     193                                 
    192194                        return $return; 
    193195                } 
    194196                else if (strpos(strtolower($string), '=?utf-8') !== false) 
    195197                { 
    196                         $elements = imap_mime_header_decode($string); 
    197                         for($i = 0;$i < count($elements);$i++) { 
    198                                 $charset = $elements[$i]->charset; 
    199                                 $text =$elements[$i]->text; 
    200                                 if(!strcasecmp($charset, "utf-8") || 
    201                                 !strcasecmp($charset, "utf-7")) { 
    202                                 $text = iconv($charset, "ISO-8859-1", $text); 
    203                         } 
    204                                 $decoded .= $this->htmlspecialchars_encode($text); 
    205                         } 
     198                        $elements = imap_mime_header_decode($string);                    
     199                        for($i = 0;$i < count($elements);$i++) { 
     200                                $charset = strtolower($elements[$i]->charset); 
     201                                $text =$elements[$i]->text; 
     202                                if(!strcasecmp($charset, "utf-8") || 
     203                                !strcasecmp($charset, "utf-7")) { 
     204                                $decoded .= $this->functions->utf8_to_ncr($text); 
     205                        } 
     206                                else 
     207                                        $decoded .= $this->htmlspecialchars_encode(iconv($charset, "iso-8859-1", $text)); 
     208                        } 
    206209                        return $decoded; 
    207210                } 
     
    503506                $from = $header->from; 
    504507                $return['from'] = array(); 
    505                 $tmp = imap_mime_header_decode($from[0]->personal); 
    506                 $return['from']['name'] = $this->decode_string($tmp[0]->text); 
     508                $return['from']['name'] = $this->decode_string($from[0]->personal); 
    507509                $return['from']['email'] = $this->decode_string($from[0]->mailbox . "@" . $from[0]->host); 
    508510                if ($return['from']['name']) 
     
    518520                // Sender attribute 
    519521                $sender = $header->sender; 
    520                 $return['sender'] = array(); 
    521                 $tmp = imap_mime_header_decode($sender[0]->personal); 
    522                 $return['sender']['name'] = $this->decode_string($tmp[0]->text); 
     522                $return['sender'] = array();             
     523                $return['sender']['name'] = $this->decode_string($sender[0]->personal); 
    523524                $return['sender']['email'] = $this->decode_string($sender[0]->mailbox . "@" . $sender[0]->host); 
    524525                if ($return['sender']['name']) 
Note: See TracChangeset for help on using the changeset viewer.