Ignore:
Timestamp:
02/14/13 16:20:44 (11 years ago)
Author:
thiago
Message:

Ticket #3331 - Quase tudo pronto, apenas alguns detalhes no arquivamento.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.5.1-expresso1/expressoMail1_2/inc/class.imap_functions.inc.php

    r7779 r7885  
    21702170        function delete_msgs($params) 
    21712171        { 
    2172  
    21732172                $folder = $params['folder']; 
    21742173                $folder =  mb_convert_encoding($folder, "UTF7-IMAP","ISO-8859-1"); 
     2174 
    21752175                $msgs_number = explode(",",$params['msgs_number']); 
     2176 
    21762177                if(array_key_exists('border_ID' ,$params)) 
    21772178                $border_ID = $params['border_ID']; 
     
    21892190                $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())))); 
    21902191 
    2191                 foreach ($msgs_number as $msg_number) 
     2192         
     2193 
     2194        foreach ($msgs_number as $msg_number) 
    21922195                { 
    21932196                        if (imap_delete($mbox_stream, $msg_number, FT_UID)); 
     
    26782681        } 
    26792682         
     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 
    26802724        function send_mail($params) { 
    26812725            require_once dirname(__FILE__) . '/../../services/class.servicelocator.php'; 
     
    27482792            $encrypt = $params['input_return_cripto']; 
    27492793            $signed = $params['input_return_digital']; 
     2794 
     2795 
     2796            //$params['attachments'] = $params['attachments']['imap']; 
    27502797 
    27512798                        $params['attachments'] = mb_convert_encoding($params['attachments'], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 
     
    29002947                                        $arr_new_folder['base_path'] = $base_path; 
    29012948 
    2902                                         $this->create_mailbox($arr_new_folder);                                  
     2949                                        $this->create_mailbox($arr_new_folder);  
    29032950                                        $has_new_folder = true; 
    29042951                    $folder = $newfolder; 
     
    30513098            foreach ($attachment as &$value)  
    30523099            { 
     3100                /*Volta aqui*/ 
    30533101                if((int)$value > 0) //BD attachment 
    30543102                { 
     3103                    ob_start(); 
    30553104                     $att = Controller::read(array('id'=> $value , 'concept' => 'mailAttachment')); 
    30563105 
     
    30683117                else //message attachment 
    30693118                { 
     3119 
    30703120                    $value = json_decode($value, true); 
     3121 
     3122                    if($value["folder"] == "archiver"){ 
     3123                        $value['folder'] = "INBOX/Trash"; 
     3124                    } 
    30713125 
    30723126                    switch ($value['type']) { 
     
    30763130                                if(strstr($body,'src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'"') !== false)//Embeded IMG 
    30773131                                {     
    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); 
    30793133                                    $mailService->addStringImage($att['source'], $att['type'],mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1') ); 
    30803134                                } 
     
    30873141                            case 'imapMSG': 
    30883142                                $mbox_stream = $this->open_mbox(mb_convert_encoding($value['folder'] , 'ISO-8859-1' , 'UTF7-IMAP')); 
     3143 
    30893144                                $rawmsg = $this->getRawHeader($value['uid']) . "\r\n\r\n" . $this->getRawBody($value['uid']); 
    30903145                                 
    30913146                                $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 
    30923149                                $message_size_total += mb_strlen($rawmsg); //Adiciona o tamanho do anexo a variavel que controlao tamanho da msg. 
    30933150                                unset($rawmsg); 
     
    31723229            { 
    31733230                $this->rfc2397ToEmbeddedAttachment($mailService , $body); 
     3231                 
     3232 
    31743233 
    31753234                $defaultStyle = ''; 
     
    48744933                                $insert = $this->insert_email($source,$dest_folder,$timestamps[$index],$flags[$index]); 
    48754934 
     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 
    48764940                if($insert['error']) 
    48774941                { 
     
    48804944                else  
    48814945                { 
     4946                    // volta aqui 
    48824947                    $archived[] = $ids[$index]; 
    48834948                } 
Note: See TracChangeset for help on using the changeset viewer.