Changeset 6240
- Timestamp:
- 05/18/12 17:47:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r6212 r6240 196 196 { 197 197 $sample = false; 198 if( (isset($this->prefs['preview_msg_subject']) && ($this->prefs['preview_msg_subject'] === '1')) &&198 if( (isset($this->prefs['preview_msg_subject']) && ($this->prefs['preview_msg_subject'] === '1')) || 199 199 (isset($this->prefs['preview_msg_tip'] ) && ($this->prefs['preview_msg_tip'] === '1')) ) 200 200 $sample = true; … … 3075 3075 //////////////////////////////////////////////////////////////////////////////////////////////////// 3076 3076 3077 3078 $this->rfc2397ToEmbeddedAttachment($mailService , $body); 3079 3077 3080 if ($isHTML) 3078 3081 $mailService->setBodyHtml($body); … … 3728 3731 return "application/octet-stream"; 3729 3732 } 3730 3733 3734 3731 3735 function htmlspecialchars_encode($str) 3732 3736 { … … 5271 5275 return $ret; 5272 5276 } 5277 5278 /** 5279 * Método que convert imagens no formato rfc2397 para Embedded Attachment 5280 * 5281 * @license http://www.gnu.org/copyleft/gpl.html GPL 5282 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 5283 * @sponsor Caixa Econômica Federal 5284 * @author Cristiano Corrêa Schmidt 5285 * @param <MailService> <$mailService> <Referencia objeto MailService> 5286 * @param <String> <$body> <Referencia Corpo do email> 5287 * @return <void> 5288 * @access <public> 5289 */ 5290 function rfc2397ToEmbeddedAttachment( &$mailService , &$body ) 5291 { 5292 $matches = array(); 5293 preg_match_all("/src=[\'|\"]+data:([^;]*)(.*);base64,([a-zA-Z0-9\+\/\=]+)[\'|\"]+/i", $body, $matches, PREG_SET_ORDER); //Resgata imagens em rfc2397 5294 5295 foreach ($matches as $i => &$v) 5296 { 5297 $mailService->addStringImage(base64_decode($v[3]), $v[1] , 'EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1])); 5298 $body = str_replace($v[0], 'src="EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1]).'"' , $body); 5299 } 5300 } 5301 5302 /** 5303 * Método que retorna a extensão do arquivo atraves do mime type 5304 * 5305 * @license http://www.gnu.org/copyleft/gpl.html GPL 5306 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 5307 * @sponsor Caixa Econômica Federal 5308 * @author Cristiano Corrêa Schmidt 5309 * @param <String> <$mimeType> <Mime Type do arquivo> 5310 * @return <String> <extensão> 5311 * @access <public> 5312 */ 5313 function mimeToExtension($mimeType) 5314 { 5315 switch ( $mimeType ) 5316 { 5317 case 'image/bmp' : 5318 return 'bmp'; 5319 case 'image/cgm' : 5320 return 'cgm'; 5321 case 'image/vnd.djvu' : 5322 return 'djv'; 5323 case 'image/gif' : 5324 return 'gif'; 5325 case 'image/x-icon' : 5326 return 'ico'; 5327 case 'image/ief' : 5328 return 'ief'; 5329 case 'image/jpeg' : 5330 return 'jpg'; 5331 case 'image/x-macpaint' : 5332 return 'mac'; 5333 case 'image/pict' : 5334 return 'pct'; 5335 case 'image/png' : 5336 return 'png'; 5337 case 'image/x-quicktime' : 5338 return 'qti'; 5339 case 'image/x-rgb' : 5340 return 'rgb'; 5341 case 'image/tiff' : 5342 return 'tif'; 5343 default: 5344 return ''; 5345 } 5346 5347 } 5348 5273 5349 } 5274 5350 ?>
Note: See TracChangeset
for help on using the changeset viewer.