Changeset 7907 for trunk/expressoMail1_2/inc/class.imap_functions.inc.php
- Timestamp:
- 02/22/13 12:37:16 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r7902 r7907 2174 2174 function delete_msgs($params) 2175 2175 { 2176 2177 2176 $folder = $params['folder']; 2178 2177 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO-8859-1"); 2178 2179 2179 $msgs_number = explode(",",$params['msgs_number']); 2180 2180 2181 if(array_key_exists('border_ID' ,$params)) 2181 2182 $border_ID = $params['border_ID']; … … 2193 2194 $mbox_stream = @imap_open("{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$folder, $this->username, $this->password) or die(serialize(array('imap_error' => $this->parse_error(imap_last_error())))); 2194 2195 2195 foreach ($msgs_number as $msg_number) 2196 2197 2198 foreach ($msgs_number as $msg_number) 2196 2199 { 2197 2200 if (imap_delete($mbox_stream, $msg_number, FT_UID)); … … 2681 2684 return $return; 2682 2685 } 2683 2686 2687 function get_info_msg_archiver($params){ 2688 $folder = "INBOX/Trash"; 2689 $mbox_stream = $this->open_mbox($folder); 2690 2691 foreach($params['idMsgs'] as $i => $id){ 2692 $name = imap_headerinfo($mbox_stream, imap_msgno($mbox_stream ,$id)); 2693 $return[] = array( 2694 'uid' => $id, 2695 'folder' => "archiver", 2696 'type' => "imapMSG", 2697 'name' => base64_encode($name->subject.".eml") 2698 ); 2699 } 2700 2701 return json_encode($return); 2702 } 2703 2684 2704 function send_mail($params) { 2685 2705 require_once dirname(__FILE__) . '/../../services/class.servicelocator.php'; … … 2752 2772 $encrypt = $params['input_return_cripto']; 2753 2773 $signed = $params['input_return_digital']; 2774 2775 2776 //$params['attachments'] = $params['attachments']['imap']; 2754 2777 2755 2778 $params['attachments'] = mb_convert_encoding($params['attachments'], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); … … 2904 2927 $arr_new_folder['base_path'] = $base_path; 2905 2928 2906 $this->create_mailbox($arr_new_folder); 2929 $this->create_mailbox($arr_new_folder); 2907 2930 $has_new_folder = true; 2908 2931 $folder = $newfolder; … … 2953 2976 2954 2977 $header = $this->get_header($msg_numb); 2978 2955 2979 $header_ = imap_fetchheader($this->mbox, $msg_numb, FT_UID); 2956 2980 $pattern = '/^[ \t]*Disposition-Notification-To:.*/mi'; … … 3055 3079 foreach ($attachment as &$value) 3056 3080 { 3081 /*Volta aqui*/ 3057 3082 if((int)$value > 0) //BD attachment 3058 3083 { 3084 ob_start(); 3059 3085 $att = Controller::read(array('id'=> $value , 'concept' => 'mailAttachment')); 3060 3086 … … 3072 3098 else //message attachment 3073 3099 { 3100 3074 3101 $value = json_decode($value, true); 3102 3103 if($value["folder"] == "archiver"){ 3104 $value['folder'] = "INBOX/Trash"; 3105 } 3075 3106 3076 3107 switch ($value['type']) { … … 3080 3111 if(strstr($body,'src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"') !== false)//Embeded IMG 3081 3112 { 3082 $body = str_ireplace('src="./inc/get_archive.php?msgFolder='.$value['folder']. '&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"' , 'src="'.$att['name'].'"', $body);3113 $body = str_ireplace('src="./inc/get_archive.php?msgFolder='.$value['folder']. '&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"' , 'src="'.$att['name'].'"', $body); 3083 3114 $mailService->addStringImage($att['source'], $att['type'],mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1') ); 3084 3115 } … … 3091 3122 case 'imapMSG': 3092 3123 $mbox_stream = $this->open_mbox(mb_convert_encoding($value['folder'] , 'ISO-8859-1' , 'UTF7-IMAP')); 3124 3093 3125 $rawmsg = $this->getRawHeader($value['uid']) . "\r\n\r\n" . $this->getRawBody($value['uid']); 3094 3126 3095 3127 $mailService->addStringAttachment($rawmsg, mb_convert_encoding(base64_decode($value['name']), 'ISO-8859-1' , 'UTF-8,ISO-8859-1'), 'message/rfc822', '7bit', 'attachment' ); 3128 /*envia o anexo para o email*/ 3129 3096 3130 $message_size_total += mb_strlen($rawmsg); //Adiciona o tamanho do anexo a variavel que controlao tamanho da msg. 3097 3131 unset($rawmsg); … … 3176 3210 { 3177 3211 $this->rfc2397ToEmbeddedAttachment($mailService , $body); 3212 3213 3178 3214 3179 3215 $defaultStyle = ''; … … 4863 4899 $error = array(); 4864 4900 4901 4902 4865 4903 foreach($sources as $index=>$src) 4866 4904 { 4867 4905 if($src!="") 4868 4906 { 4907 4908 4909 4869 4910 //If it is a MailArchiver incomming data 4870 4911 if($params['madata']) … … 4878 4919 $insert = $this->insert_email($source,$dest_folder,$timestamps[$index],$flags[$index]); 4879 4920 4921 //volta aqui 4922 $return['idsMsg'] = $insert['msg_no']; 4923 4880 4924 if($insert['error']) 4881 4925 { … … 4884 4928 else 4885 4929 { 4930 // volta aqui 4886 4931 $archived[] = $ids[$index]; 4887 4932 }
Note: See TracChangeset
for help on using the changeset viewer.