Changeset 6561


Ignore:
Timestamp:
06/21/12 10:08:27 (7 years ago)
Author:
brunocosta
Message:

Ticket #2780 - Exclue msg do arquivamento local ao desarquivar - ajuste.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php

    r6516 r6561  
    41414141        $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort']; 
    41424142        $imap_options = '/notls/novalidate-cert'; 
    4143         $mbox_stream = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$folder, $username, $password); 
    4144                 if(imap_last_error() && imap_last_error() != "SECURITY PROBLEM: insecure server advertised AUTH=PLAIN") 
     4143        $mbox_stream = $this->open_mbox($folder); 
     4144        //$mbox_stream = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$folder, $username, $password); 
     4145        if($folder == "INBOX/decifradas" && imap_last_error() && imap_last_error() != "SECURITY PROBLEM: insecure server advertised AUTH=PLAIN") 
    41454146        { 
    41464147            imap_createmailbox($mbox_stream,imap_utf7_encode("{".$imap_server."}".$folder)); 
    41474148        } 
    4148          
    4149         // string date ( string $format [, int $timestamp = time() ] ) 
    4150         // bool imap_append ( resource $imap_stream , string $mailbox , string $message [, string $options = NULL [, string $internal_date = NULL ]] ) 
    4151         // 'd-M-Y H:i:s O' 
    4152          
    41534149        $return = array(); 
    41544150        if($timestamp){ 
    4155             $tempDir = $_SESSION['phpgw_info']['server']['temp_dir']; 
    4156             $file = $tempDir."/imap_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]; 
    4157                 $f = fopen($file,"w"); 
    4158                 fputs($f,base64_encode($source)); 
    4159             fclose($f); 
    4160             $command = "python ".$_SERVER['DOCUMENT_ROOT']."/expressoMail1_2/imap.py ".escapeshellarg($imap_server)." ".escapeshellarg($imap_port)." ".escapeshellarg($username)." ".escapeshellarg($password)." ".escapeshellarg($timestamp)." ".escapeshellarg($folder)." ".escapeshellarg($file); 
    4161             $return['command']=exec(escapeshellcmd($command)); 
     4151            if(version_compare(PHP_VERSION, '5.3.2', '>=')){ 
     4152                $return['append'] = imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".mb_convert_encoding($folder, "UTF7-IMAP","ISO_8859-1"), $source,'',date('d-M-Y H:i:s O',$timestamp)); 
     4153            }else{ 
     4154                $tempDir = $_SESSION['phpgw_info']['server']['temp_dir']; 
     4155                $file = $tempDir."/imap_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]; 
     4156                    $f = fopen($file,"w"); 
     4157                    fputs($f,base64_encode($source)); 
     4158                fclose($f); 
     4159                $command = "python ".$_SERVER['DOCUMENT_ROOT']."/expressoMail1_2/imap.py ".escapeshellarg($imap_server)." ".escapeshellarg($imap_port)." ".escapeshellarg($username)." ".escapeshellarg($password)." ".escapeshellarg($timestamp)." '".$folder."' ".escapeshellarg($file); 
     4160                $return['command']=exec(escapeshellcmd($command)); 
     4161            } 
    41624162        }else{ 
    4163             $return['append'] = imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$folder, $source, "\\Seen"); 
     4163            $return['append'] = imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".mb_convert_encoding($folder, "UTF7-IMAP","ISO_8859-1"), $source, "\\Seen"); 
    41644164        } 
    41654165         
     
    41744174        } 
    41754175         
    4176         $status = imap_status($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$folder, SA_UIDNEXT); 
     4176        $status = imap_status($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".mb_convert_encoding($folder, "UTF7-IMAP","ISO_8859-1"), SA_UIDNEXT); 
    41774177 
    41784178        $return['msg_no'] = $status->uidnext - 1; 
     
    42844284    function unarchive_mail($params) 
    42854285    { 
    4286         $dest_folder = $params['folder']; 
     4286        $dest_folder = urldecode($params['folder']); 
    42874287        $sources = explode("#@#@#@",$params['source']); 
    42884288        $timestamps = explode("#@#@#@",$params['timestamp']); 
Note: See TracChangeset for help on using the changeset viewer.