[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Initial Developer of the Original Code is FOSS Labs. 6 * Portions created by FOSS Labs are Copyright (C) FOSS Labs. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * 10 ********************************************************************************/ 11 12 global $current_user; 13 require_once ('include/utils/utils.php'); 14 require_once ('include/utils/UserInfoUtil.php'); 15 require_once ('modules/Webmails/Webmail.php'); 16 require_once ('modules/Webmails/MailBox.php'); 17 18 if(!isset($_SESSION["authenticated_user_id"]) || $_SESSION["authenticated_user_id"] != $current_user->id) {echo "ajax failed";flush();exit();} 19 $mailid=$_REQUEST["mailid"]; 20 if(isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "") {$mailbox=$_REQUEST["mailbox"];} else {$mailbox="INBOX";} 21 $MailBox = new MailBox($mailbox); 22 $email = new Webmail($MailBox->mbox,$mailid); 23 24 ?> 25 <script type="text/javascript"> 26 function show_inline(num) { 27 var el = document.getElementById("block_"+num); 28 if(el.style.display == 'block') 29 el.style.display='none'; 30 else 31 el.style.display='block'; 32 } 33 </script> 34 <? 35 $email->loadMail(); 36 echo $email->body; 37 echo "<br><br>"; 38 if(is_array($email->inline)) { 39 $inline = $email->downloadInlineAttachments(); 40 $num=sizeof($inline); 41 echo "<p style='border-bottom:1px solid black;font-weight:bold'>Inline Attachments:</p>"; 42 for($i=0;$i<$num;$i++) { 43 //var_dump($inline[$i]); 44 // PLAIN TEXT 45 if($inline[$i]["subtype"] == "RFC822") { 46 echo ($i+1).") <a href='javascript:show_inline(".$i.");'>".$inline[$i]["filename"]."</a><blockquote id='block_".$i."' style='border:1px solid gray;padding:6px;background-color:#FFFFCC;display:none'>"; 47 echo nl2br($inline[$i]["filedata"]); 48 echo "</blockquote>"; 49 } elseif($inline[$i]["subtype"] == "JPEG" || $inline[$i]["subtype"] == "GIF") { 50 echo ($i+1).") <a href='javascript:show_inline(".$i.");'>".$inline[$i]["filename"]."</a><br><br><div id='block_".$i."' style='border:1px solid gray;padding:6px;background-color:#FFFFCC;display:none;width:95%;overflow:auto'>"; 51 global $root_directory; 52 $save_path=$root_directory.'/modules/Webmails/tmp'; 53 if(!is_dir($save_path)) 54 mkdir($save_path); 55 $save_dir=$save_path."/cache"; 56 if(!is_dir($save_dir)) 57 mkdir($save_dir); 58 59 $fp = fopen($save_dir.'/'.$inline[$i]["filename"], "w") or die("Can't open file"); 60 fputs($fp, base64_decode($inline[$i]["filedata"])); 61 $filename = 'modules/Webmails/tmp/cache/'.$inline[$i]['filename']; 62 fclose($fp); 63 echo '<img src="'.$filename.'" border="0" >'; 64 echo '</div> <br>'; 65 } else 66 echo ($i+1).") <a target='_BLANK' href='index.php?module=Webmails&action=dlAttachments&inline=true&num=".$i."&mailid=".$mailid."'>".$inline[$i]["filename"]."</a> <br>"; 67 } 68 } 69 imap_close($MailBox->mbox); 70 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |