Changeset 414 for trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php
- Timestamp:
- 09/12/08 11:39:24 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php
r396 r414 12 12 var $imap_server; 13 13 var $imap_port; 14 var $imap_trashfolder; 15 var $imap_sentfolder; 16 var $imap_draftsfolder; 17 var $imap_spamfolder; 14 18 15 19 function imap_functions(){ … … 18 22 $this->imap_server = $_SESSION['phpgw_info']['expresso']['email_server']['imapServer']; 19 23 $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']; 20 28 $this->imapDelimiter= $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']; 21 29 $this->imap = imap_open('{'.$this->imap_server.':'.$this->imap_port.'/novalidate-cert}', $this->imap_admin, $this->imap_passwd, OP_HALFOPEN); … … 28 36 { 29 37 $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 55 81 if (!imap_set_quota($this->imap,"user" . $this->imapDelimiter . $uid, ($mailquota*1024))) 56 82 { 57 83 $error = imap_errors(); 58 84 $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]; 60 86 return $result; 61 87 } … … 100 126 { 101 127 $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(); 103 129 } 104 130 … … 122 148 { 123 149 $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(); 125 151 } 126 152 else … … 138 164 { 139 165 $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'); 141 167 return $result; 142 168 } … … 159 185 if ($return_setacl) 160 186 { 161 //$mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options.'/user="'.$uid.'"}', $this->imap_admin, $this->imap_passwd);162 187 $mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options .'}user'. $this->imapDelimiter . $uid, $this->imap_admin, $this->imap_passwd); 163 188 … … 180 205 { 181 206 $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(); 189 214 } 190 215 return $result;
Note: See TracChangeset
for help on using the changeset viewer.