Changeset 1384 for trunk/expressoMail1_2/inc/class.imap_functions.inc.php
- Timestamp:
- 09/01/09 14:59:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r1382 r1384 162 162 $from = $header->from; 163 163 $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); 165 165 $head_array['from']['email'] = $this->decode_string($from[0]->mailbox) . "@" . $from[0]->host; 166 166 if(!$head_array['from']['name']) … … 185 185 function decode_string($string) 186 186 { 187 187 188 if ((strpos(strtolower($string), '=?iso-8859-1') !== false) || (strpos(strtolower($string), '=?windows-1252') !== false)) 188 189 { … … 190 191 foreach ($tmp as $tmp1) 191 192 $return .= $this->htmlspecialchars_encode($tmp1->text); 193 192 194 return $return; 193 195 } 194 196 else if (strpos(strtolower($string), '=?utf-8') !== false) 195 197 { 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 } 206 209 return $decoded; 207 210 } … … 503 506 $from = $header->from; 504 507 $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); 507 509 $return['from']['email'] = $this->decode_string($from[0]->mailbox . "@" . $from[0]->host); 508 510 if ($return['from']['name']) … … 518 520 // Sender attribute 519 521 $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); 523 524 $return['sender']['email'] = $this->decode_string($sender[0]->mailbox . "@" . $sender[0]->host); 524 525 if ($return['sender']['name'])
Note: See TracChangeset
for help on using the changeset viewer.