Ignore:
Timestamp:
09/12/08 11:39:24 (16 years ago)
Author:
niltonneto
Message:

Alterações feitas por João Alfredo.
Email: jakjr@…

File:
1 edited

Legend:

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

    r396 r414  
    1212        var $imap_server; 
    1313        var $imap_port; 
     14    var $imap_trashfolder; 
     15    var $imap_sentfolder; 
     16    var $imap_draftsfolder; 
     17    var $imap_spamfolder; 
    1418         
    1519        function imap_functions(){ 
     
    1822                $this->imap_server      = $_SESSION['phpgw_info']['expresso']['email_server']['imapServer']; 
    1923                $this->imap_port        = $_SESSION['phpgw_info']['expresso']['email_server']['imapPort']; 
     24                $this->imap_trashfolder         = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultTrashFolder']; 
     25                $this->imap_sentfolder          = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSentFolder']; 
     26                $this->imap_draftsfolder        = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultDraftsFolder']; 
     27                $this->imap_spamfolder          = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSpamFolder']; 
    2028                $this->imapDelimiter= $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']; 
    2129                $this->imap             = imap_open('{'.$this->imap_server.':'.$this->imap_port.'/novalidate-cert}', $this->imap_admin, $this->imap_passwd, OP_HALFOPEN); 
     
    2836                { 
    2937                        $error = imap_errors(); 
    30                         $result['status'] = false; 
    31                         $result['msg'] = 'Erro na funcao imap_function->create(INBOX): ' . $error[0]; 
    32                         return $result; 
    33                 } 
    34                 if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . "Enviados")) 
    35                 { 
    36                         $error = imap_errors(); 
    37                         $result['status'] = false; 
    38                         $result['msg'] = 'Erro na funcao imap_function->create(Enviados): ' . $error[0]; 
    39                         return $result; 
    40                 } 
    41                 if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . "Rascunhos")) 
    42                 { 
    43                         $error = imap_errors(); 
    44                         $result['status'] = false; 
    45                         $result['msg'] = 'Erro na funcao imap_function->create(Rascunho): ' . $error[0]; 
    46                         return $result; 
    47                 } 
    48                 if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . "Lixeira")) 
    49                 { 
    50                         $error = imap_errors(); 
    51                         $result['status'] = false; 
    52                         $result['msg'] = 'Erro na funcao imap_function->create(Lixeira): ' . $error[0]; 
    53                         return $result; 
    54                 } 
     38                        if ($error[0] == 'Mailbox already exists') 
     39                        { 
     40                                $result['status'] = true; 
     41                        } 
     42                        else 
     43                        { 
     44                                $result['status'] = false; 
     45                                $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(INBOX) ($uid):" . $error[0]; 
     46                        } 
     47                        return $result; 
     48                } 
     49                if ( (!empty($this->imap_sentfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_sentfolder)) ) 
     50                { 
     51                        $error = imap_errors(); 
     52                        $result['status'] = false; 
     53                        $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_sentfolder."):" . $error[0]; 
     54                        return $result; 
     55                } 
     56                if ( (!empty($this->imap_draftsfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_draftsfolder)) ) 
     57                { 
     58                        $error = imap_errors(); 
     59                        $result['status'] = false; 
     60                        $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_draftsfolder."):" . $error[0]; 
     61                        return $result; 
     62                } 
     63                if ( (!empty($this->imap_trashfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_trashfolder)) ) 
     64                { 
     65                        $error = imap_errors(); 
     66                        $result['status'] = false; 
     67                        $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_trashfolder."):" . $error[0]; 
     68                        return $result; 
     69                } 
     70                if (!empty($this->imap_sentfolder)) 
     71                { 
     72                    if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_spamfolder)) 
     73                        { 
     74                            $error = imap_errors(); 
     75                            $result['status'] = false; 
     76                            $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_spamfolder."):" . $error[0]; 
     77                            return $result; 
     78                        } 
     79                } 
     80 
    5581                if (!imap_set_quota($this->imap,"user" . $this->imapDelimiter . $uid, ($mailquota*1024)))  
    5682                { 
    5783                        $error = imap_errors(); 
    5884                        $result['status'] = false; 
    59                         $result['msg'] = 'Erro na funcao imap_function->create(set_quota): ' . $error[0]; 
     85                        $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(imap_set_quota):" . $error[0]; 
    6086                        return $result; 
    6187                } 
     
    100126                { 
    101127                        $result['status'] = false; 
    102                         $result['msg'] = "Erro na funcao imap_function->delete_user.\nRetorno do servidor: " . imap_last_error(); 
     128                        $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->delete_user.\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error(); 
    103129                } 
    104130                 
     
    122148                { 
    123149                        $result['status'] = false; 
    124                         $result['msg'] = "Erro na funcao imap_function->rename_mailbox.\nRetorno do servidor: " . imap_last_error(); 
     150                        $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->rename_mailbox.\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error(); 
    125151                } 
    126152                else 
     
    138164                { 
    139165                        $result['status'] = false; 
    140                         $result['msg'] = 'Você não tem acesso para executar esta operação.'; 
     166                        $result['msg'] = $this->functions->lang('You do not have access to clean an user inbox'); 
    141167                        return $result; 
    142168                } 
     
    159185                if ($return_setacl) 
    160186                { 
    161                         //$mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options.'/user="'.$uid.'"}', $this->imap_admin, $this->imap_passwd); 
    162187                        $mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options .'}user'. $this->imapDelimiter . $uid, $this->imap_admin, $this->imap_passwd); 
    163188                         
     
    180205                        { 
    181206                                $result['status'] = false; 
    182                                 $result['msg'] = "Nao foi possivel esvaziar a caixa postal do usuario:\n" . imap_last_error(); 
    183                         } 
    184                 } 
    185                 else 
    186                 { 
    187                         $result['status'] = false; 
    188                         $result['msg'] = "Nao foi possivel modificar a acl do usuario:\n" . imap_last_error(); 
     207                                $result['msg'] = $this->functions->lang('It was not possible clean the users inbox') . ".\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error(); 
     208                        } 
     209                } 
     210                else 
     211                { 
     212                        $result['status'] = false; 
     213                        $result['msg'] = $this->functions->lang('It was not possible to modify the users acl') . ".\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error(); 
    189214                } 
    190215                return $result; 
Note: See TracChangeset for help on using the changeset viewer.