Ignore:
Timestamp:
02/22/13 12:37:16 (11 years ago)
Author:
marcosw
Message:

Ticket #3331 - Melhoria inserida no repositório trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r7902 r7907  
    21742174        function delete_msgs($params) 
    21752175        { 
    2176  
    21772176                $folder = $params['folder']; 
    21782177                $folder =  mb_convert_encoding($folder, "UTF7-IMAP","ISO-8859-1"); 
     2178 
    21792179                $msgs_number = explode(",",$params['msgs_number']); 
     2180 
    21802181                if(array_key_exists('border_ID' ,$params)) 
    21812182                $border_ID = $params['border_ID']; 
     
    21932194                $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())))); 
    21942195 
    2195                 foreach ($msgs_number as $msg_number) 
     2196         
     2197 
     2198        foreach ($msgs_number as $msg_number) 
    21962199                { 
    21972200                        if (imap_delete($mbox_stream, $msg_number, FT_UID)); 
     
    26812684                return $return; 
    26822685        } 
    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 
    26842704        function send_mail($params) { 
    26852705            require_once dirname(__FILE__) . '/../../services/class.servicelocator.php'; 
     
    27522772            $encrypt = $params['input_return_cripto']; 
    27532773            $signed = $params['input_return_digital']; 
     2774 
     2775 
     2776            //$params['attachments'] = $params['attachments']['imap']; 
    27542777 
    27552778                        $params['attachments'] = mb_convert_encoding($params['attachments'], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 
     
    29042927                                        $arr_new_folder['base_path'] = $base_path; 
    29052928 
    2906                                         $this->create_mailbox($arr_new_folder);                                  
     2929                                        $this->create_mailbox($arr_new_folder);  
    29072930                                        $has_new_folder = true; 
    29082931                    $folder = $newfolder; 
     
    29532976 
    29542977            $header = $this->get_header($msg_numb); 
     2978 
    29552979            $header_ = imap_fetchheader($this->mbox, $msg_numb, FT_UID); 
    29562980            $pattern = '/^[ \t]*Disposition-Notification-To:.*/mi'; 
     
    30553079            foreach ($attachment as &$value)  
    30563080            { 
     3081                /*Volta aqui*/ 
    30573082                if((int)$value > 0) //BD attachment 
    30583083                { 
     3084                    ob_start(); 
    30593085                     $att = Controller::read(array('id'=> $value , 'concept' => 'mailAttachment')); 
    30603086 
     
    30723098                else //message attachment 
    30733099                { 
     3100 
    30743101                    $value = json_decode($value, true); 
     3102 
     3103                    if($value["folder"] == "archiver"){ 
     3104                        $value['folder'] = "INBOX/Trash"; 
     3105                    } 
    30753106 
    30763107                    switch ($value['type']) { 
     
    30803111                                if(strstr($body,'src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"') !== false)//Embeded IMG 
    30813112                                {     
    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); 
    30833114                                    $mailService->addStringImage($att['source'], $att['type'],mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1') ); 
    30843115                                } 
     
    30913122                            case 'imapMSG': 
    30923123                                $mbox_stream = $this->open_mbox(mb_convert_encoding($value['folder'] , 'ISO-8859-1' , 'UTF7-IMAP')); 
     3124 
    30933125                                $rawmsg = $this->getRawHeader($value['uid']) . "\r\n\r\n" . $this->getRawBody($value['uid']); 
    30943126                                 
    30953127                                $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 
    30963130                                $message_size_total += mb_strlen($rawmsg); //Adiciona o tamanho do anexo a variavel que controlao tamanho da msg. 
    30973131                                unset($rawmsg); 
     
    31763210            { 
    31773211                $this->rfc2397ToEmbeddedAttachment($mailService , $body); 
     3212                 
     3213 
    31783214 
    31793215                $defaultStyle = ''; 
     
    48634899        $error = array(); 
    48644900 
     4901 
     4902 
    48654903        foreach($sources as $index=>$src) 
    48664904        { 
    48674905            if($src!="") 
    48684906            { 
     4907                     
     4908                 
     4909 
    48694910                //If it is a MailArchiver incomming data 
    48704911                if($params['madata']) 
     
    48784919                                $insert = $this->insert_email($source,$dest_folder,$timestamps[$index],$flags[$index]); 
    48794920 
     4921                //volta aqui 
     4922                $return['idsMsg'] = $insert['msg_no']; 
     4923 
    48804924                if($insert['error']) 
    48814925                { 
     
    48844928                else  
    48854929                { 
     4930                    // volta aqui 
    48864931                    $archived[] = $ids[$index]; 
    48874932                } 
Note: See TracChangeset for help on using the changeset viewer.