Changeset 4781
- Timestamp:
- 07/18/11 11:30:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r4777 r4781 671 671 $content .= $this->builderMsgHeader($part); 672 672 673 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body,$part->ctype_parameters['charset'] )).'</pre>';673 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body,$part->ctype_parameters['charset'],false)).'</pre>'; 674 674 } 675 675 … … 696 696 { 697 697 $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 698 $content .= '<pre>'. $this->decodeMailPart($part->body, $structure->ctype_parameters['charset']).'</pre>';698 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body, $structure->ctype_parameters['charset'],false)).'</pre>'; 699 699 $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 700 700 } … … 731 731 $content .= $this->builderMsgHeader($part); 732 732 733 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body,$part->ctype_parameters['charset'] )).'</pre>';733 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body,$part->ctype_parameters['charset'],false)).'</pre>'; 734 734 } 735 735 … … 750 750 { 751 751 $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 752 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body, $structure->ctype_parameters['charset'] )).'</pre>';752 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body, $structure->ctype_parameters['charset'],false)).'</pre>'; 753 753 $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 754 754 } … … 1093 1093 } 1094 1094 1095 /* 1096 * Converte textos utf8 para o padrão html. 1097 * @link http://php.net/manual/en/function.utf8-decode.php 1098 * @author luka8088 <luka8088@gmail.com> 1099 */ 1100 function utf8_to_html ($data) 1101 { 1102 return preg_replace("/([\\xC0-\\xF7]{1,1}[\\x80-\\xBF]+)/e", '$this->_utf8_to_html("\\1")', $data); 1103 } 1104 1105 function _utf8_to_html ($data) 1106 { 1107 $ret = 0; 1108 foreach((str_split(strrev(chr((ord($data{0}) % 252 % 248 % 240 % 224 % 192) + 128) . substr($data, 1)))) as $k => $v) 1109 $ret += (ord($v) % 128) * pow(64, $k); 1110 return "&#$ret;"; 1111 } 1112 //------------------------------------------------------------------------------// 1113 1114 1115 1116 1095 1117 /** 1096 1118 * Decodifica uma part da mensagem para iso-8859-1 … … 1099 1121 * @return <type> string decodificada 1100 1122 */ 1101 function decodeMailPart($part, $encode )1123 function decodeMailPart($part, $encode, $html = true) 1102 1124 { 1103 1125 switch (strtolower($encode)) … … 1108 1130 1109 1131 case 'utf-8': 1110 return utf8_decode($part); 1132 if ($html) 1133 return $this->utf8_to_html($part); 1134 else 1135 return utf8_decode ($part); 1111 1136 break; 1112 1137 … … 1186 1211 if(($msg_subtype == "html" || $msg_subtype == 'plain') && ($disposition != 'attachment')) 1187 1212 { 1188 $content = $this->decodeMailPart($structure->body, $structure->ctype_parameters['charset']) ;1213 1189 1214 1190 1215 if(strtolower($msg_subtype) == 'plain') 1191 1216 { 1192 $content = str_replace(array('<', '>'), array(' #$<$# ', ' #$>$# '), $content); 1217 $content = $this->decodeMailPart($structure->body, $structure->ctype_parameters['charset'],false); 1218 $content = str_replace(array('<', '>'), array(' #$<$# ', ' #$>$# '), $content); 1193 1219 $content = htmlentities($content); 1194 1220 $content = $this -> replace_links($content); … … 1198 1224 return $return; 1199 1225 } 1226 $content = $this->decodeMailPart($structure->body, $structure->ctype_parameters['charset']); 1200 1227 } 1201 1228 … … 1211 1238 { 1212 1239 $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 1213 $content .= '<pre>'. $this->decodeMailPart($structure->body, $structure->ctype_parameters['charset']).'</pre>';1240 $content .= '<pre>'.htmlentities($this->decodeMailPart($structure->body, $structure->ctype_parameters['charset'],false)).'</pre>'; 1214 1241 $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 1215 1242 }
Note: See TracChangeset
for help on using the changeset viewer.