- Timestamp:
- 02/14/13 16:20:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.5.1-expresso1/expressoMail1_2/inc/class.imap_functions.inc.php
r7779 r7885 2170 2170 function delete_msgs($params) 2171 2171 { 2172 2173 2172 $folder = $params['folder']; 2174 2173 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO-8859-1"); 2174 2175 2175 $msgs_number = explode(",",$params['msgs_number']); 2176 2176 2177 if(array_key_exists('border_ID' ,$params)) 2177 2178 $border_ID = $params['border_ID']; … … 2189 2190 $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())))); 2190 2191 2191 foreach ($msgs_number as $msg_number) 2192 2193 2194 foreach ($msgs_number as $msg_number) 2192 2195 { 2193 2196 if (imap_delete($mbox_stream, $msg_number, FT_UID)); … … 2678 2681 } 2679 2682 2683 function delete_msg_archive_by_flag($params){ 2684 $folder = "INBOX/Trash"; 2685 2686 $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())))); 2687 2688 $messages = imap_search($mbox_stream, 'KEYWORD "$archiverMsg"', SE_UID); 2689 2690 foreach($messages as $i => $id){ 2691 if(imap_delete($mbox_stream, $id, FT_UID)){ 2692 2693 } 2694 } 2695 2696 $return = array( 2697 "result" => "ok" 2698 ); 2699 2700 return json_encode($return); 2701 } 2702 2703 function get_last_msg_by_id($params){ 2704 $folder = "INBOX/Trash"; 2705 $mbox_stream = $this->open_mbox($folder); 2706 2707 $messages = imap_search($mbox_stream, 'KEYWORD "$archiverMsg"', SE_UID); 2708 2709 foreach($messages as $i => $id){ 2710 $name = imap_headerinfo($mbox_stream, imap_msgno($mbox_stream ,$id)); 2711 2712 $return[] = array( 2713 'uid' => $id, 2714 'folder' => "archiver", 2715 'type' => "imapMSG", 2716 'name' => base64_encode($name->subject.".eml") 2717 ); 2718 } 2719 //volta aqui 2720 2721 return json_encode($return); 2722 } 2723 2680 2724 function send_mail($params) { 2681 2725 require_once dirname(__FILE__) . '/../../services/class.servicelocator.php'; … … 2748 2792 $encrypt = $params['input_return_cripto']; 2749 2793 $signed = $params['input_return_digital']; 2794 2795 2796 //$params['attachments'] = $params['attachments']['imap']; 2750 2797 2751 2798 $params['attachments'] = mb_convert_encoding($params['attachments'], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); … … 2900 2947 $arr_new_folder['base_path'] = $base_path; 2901 2948 2902 $this->create_mailbox($arr_new_folder); 2949 $this->create_mailbox($arr_new_folder); 2903 2950 $has_new_folder = true; 2904 2951 $folder = $newfolder; … … 3051 3098 foreach ($attachment as &$value) 3052 3099 { 3100 /*Volta aqui*/ 3053 3101 if((int)$value > 0) //BD attachment 3054 3102 { 3103 ob_start(); 3055 3104 $att = Controller::read(array('id'=> $value , 'concept' => 'mailAttachment')); 3056 3105 … … 3068 3117 else //message attachment 3069 3118 { 3119 3070 3120 $value = json_decode($value, true); 3121 3122 if($value["folder"] == "archiver"){ 3123 $value['folder'] = "INBOX/Trash"; 3124 } 3071 3125 3072 3126 switch ($value['type']) { … … 3076 3130 if(strstr($body,'src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"') !== false)//Embeded IMG 3077 3131 { 3078 $body = str_ireplace('src="./inc/get_archive.php?msgFolder='.$value['folder']. '&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"' , 'src="'.$att['name'].'"', $body);3132 $body = str_ireplace('src="./inc/get_archive.php?msgFolder='.$value['folder']. '&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"' , 'src="'.$att['name'].'"', $body); 3079 3133 $mailService->addStringImage($att['source'], $att['type'],mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1') ); 3080 3134 } … … 3087 3141 case 'imapMSG': 3088 3142 $mbox_stream = $this->open_mbox(mb_convert_encoding($value['folder'] , 'ISO-8859-1' , 'UTF7-IMAP')); 3143 3089 3144 $rawmsg = $this->getRawHeader($value['uid']) . "\r\n\r\n" . $this->getRawBody($value['uid']); 3090 3145 3091 3146 $mailService->addStringAttachment($rawmsg, mb_convert_encoding(base64_decode($value['name']), 'ISO-8859-1' , 'UTF-8,ISO-8859-1'), 'message/rfc822', '7bit', 'attachment' ); 3147 /*envia o anexo para o email*/ 3148 3092 3149 $message_size_total += mb_strlen($rawmsg); //Adiciona o tamanho do anexo a variavel que controlao tamanho da msg. 3093 3150 unset($rawmsg); … … 3172 3229 { 3173 3230 $this->rfc2397ToEmbeddedAttachment($mailService , $body); 3231 3232 3174 3233 3175 3234 $defaultStyle = ''; … … 4874 4933 $insert = $this->insert_email($source,$dest_folder,$timestamps[$index],$flags[$index]); 4875 4934 4935 //volta aqui 4936 4937 $this->mbox = $this->open_mbox($dest_folder); 4938 imap_setflag_full($this->mbox, $insert['msg_no'], '$archiverMsg' , ST_UID); 4939 4876 4940 if($insert['error']) 4877 4941 { … … 4880 4944 else 4881 4945 { 4946 // volta aqui 4882 4947 $archived[] = $ids[$index]; 4883 4948 }
Note: See TracChangeset
for help on using the changeset viewer.