Changeset 4617
- Timestamp:
- 06/16/11 15:12:20 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/z-push/backend/imap.php
r4613 r4617 205 205 // if this is a multipart message with a boundary, we must use the original body 206 206 if ($use_orgbody) { 207 list(,$body) = $mobj->_splitBodyHeader($rfc822); 208 $repl_body = $this->getBody($message); 207 list(,$body) = $mobj->_splitBodyHeader($rfc822); 208 $repl_body = $this->getBody($message); 209 if ($message->parts[0]->headers["content-transfer-encoding"] == "base64") $multipart_text_cte_base64 = true; 210 else $multipart_text_cte_base64 = false; 209 211 } 210 212 else … … 216 218 // receive entire mail (header + body) to decode body correctly 217 219 $origmail = @imap_fetchheader($this->_mbox, $reply, FT_UID) . @imap_body($this->_mbox, $reply, FT_PEEK | FT_UID); 220 218 221 $mobj2 = new Mail_mimeDecode($origmail); 219 222 // receive only body … … 284 287 //$body is quoted-printable encoded while $repl_body and $nbody are plain text, 285 288 //so we need to decode $body in order replace to take place 286 $body = str_replace($repl_body, $nbody, quoted_printable_decode($body)); 289 if (!$multipart_text_cte_base64) { 290 $body = str_replace($repl_body, $nbody, quoted_printable_decode($body)); 291 } else { 292 $body = str_replace(base64_encode($repl_body), base64_encode($nbody), $body); } 287 293 } 288 294 else … … 771 777 $output = new SyncMail(); 772 778 773 $body = $this->getBody($message );779 $body = $this->getBody($message, true); // true - Truncate body due to celular memory limit 774 780 // truncate body, if requested 775 781 if(strlen($body) > $truncsize) { … … 968 974 /* Parse the message and return only the plaintext body 969 975 */ 970 function getBody($message ) {976 function getBody($message, $trunc = false) { 971 977 $body = ""; 972 978 $htmlbody = ""; … … 976 982 if(!isset($body) or $body === '') { 977 983 $this->getBodyRecursive($message, "html", $body); 984 978 985 // remove css-style tags 979 986 $body = preg_replace("/<style.*?<\/style>/is", "a", $body); … … 1026 1033 // End change block - Remove the HTML tags using the 'html2text' Linux application 1027 1034 } 1035 1028 1036 return $body; 1029 1037 } … … 1037 1045 1038 1046 if(strcasecmp($message->ctype_primary,"multipart")==0 && isset($message->parts) && is_array($message->parts)) { 1039 1047 foreach($message->parts as $part) { 1040 1048 if(!isset($part->disposition) || strcasecmp($part->disposition,"attachment")) { 1041 1049 $this->getBodyRecursive($part, $subtype, $body);
Note: See TracChangeset
for help on using the changeset viewer.