Changeset 1384 for trunk/expressoMail1_2
- Timestamp:
- 09/01/09 14:59:15 (15 years ago)
- Location:
- trunk/expressoMail1_2/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.functions.inc.php
r1059 r1384 1 1 <?php 2 2 class Functions{ 3 4 5 3 function CallVoipConnect($params){ 6 4 $fromNumber = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['telephone_number']; … … 112 110 return $_SESSION['phpgw_info']['user']['preferences']['expressoMail']; 113 111 } 114 } 112 // Unicode Conversor: convert everything from UTF-8 into an NCR[Numeric Character Reference] 113 function utf8_to_ncr($content) { 114 $result = ""; 115 while ($strlen = mb_strlen($content)) { 116 $c = mb_substr($content, 0, 1, "UTF-8"); 117 $h = ord($c{0}); 118 if ($h <= 0x7F || $h < 0xC2) { 119 $result .= $c; 120 } 121 else if ($h <= 0xDF) { 122 $h = ($h & 0x1F) << 6 | (ord($c{1}) & 0x3F); 123 $result .= "&#" . $h . ";"; 124 } else if ($h <= 0xEF) { 125 $h = ($h & 0x0F) << 12 | (ord($c{1}) & 0x3F) << 6 | (ord($c{2}) & 0x3F); 126 $result .= "&#" . $h . ";"; 127 } else if ($h <= 0xF4) { 128 $h = ($h & 0x0F) << 18 | (ord($c{1}) & 0x3F) << 12 | (ord($c{2}) & 0x3F) << 6 | (ord($c{3}) & 0x3F); 129 $result .= "&#" . $h . ";"; 130 } 131 $content = mb_substr( $content, 1, $strlen, "UTF-8"); 132 } 133 return mb_convert_encoding($result,"UTF-8"); 134 } 135 } 115 136 ?> -
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.