Changeset 5133 for trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php
- Timestamp:
- 11/03/11 13:24:14 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php
r4059 r5133 23 23 $this->imap_server = $_SESSION['phpgw_info']['expresso']['email_server']['imapServer']; 24 24 $this->imap_port = $_SESSION['phpgw_info']['expresso']['email_server']['imapPort']; 25 $this->imap_createspamfolder = $_SESSION['phpgw_info']['expresso']['email_server']['imapCreateSpamFolder'];26 $this->imap_cyrususerspam = $_SESSION['phpgw_info']['expresso']['email_server']['imapCyrusUserPostSpam'] ? $_SESSION['phpgw_info']['expresso']['email_server']['imapCyrusUserPostSpam'] : "anonymous";27 25 $this->imap_trashfolder = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultTrashFolder'] ? $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultTrashFolder'] : str_replace("*","", $this->functions->lang("trash")); 28 26 $this->imap_sentfolder = $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSentFolder'] ? $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSentFolder'] : str_replace("*","", $this->functions->lang("sent")); … … 70 68 return $result; 71 69 } 72 if (!empty($this->imap_spamfolder) && $this->imap_createspamfolder == 'yes') 70 /* Esperando correção do william (prognus) sobre a utilização do DSPAM 71 if (!empty($this->imap_sentfolder)) 73 72 { 74 73 if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_spamfolder)) … … 78 77 $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_spamfolder."):" . $error[0]; 79 78 return $result; 80 } else {81 imap_setacl($this->imap, "user" . $this->imapDelimiter . $uid. $this->imapDelimiter . $this->imap_spamfolder , $this->imap_cyrususerspam, 'p');82 79 } 83 80 } 81 */ 84 82 85 83 if (!imap_set_quota($this->imap,"user" . $this->imapDelimiter . $uid, ($mailquota*1024))) … … 97 95 function get_user_info($uid) 98 96 { 99 $get_quota = @imap_get_quota ($this->imap,"user" . $this->imapDelimiter . $uid);97 $get_quota = @imap_get_quotaroot($this->imap,"user" . $this->imapDelimiter . $uid); 100 98 101 99 if (count($get_quota) == 0) … … 148 146 $result['status'] = true; 149 147 150 if (!$quota = @imap_get_quota ($this->imap, 'user' . $this->imapDelimiter . $old_mailbox))148 if (!$quota = @imap_get_quotaroot($this->imap, 'user' . $this->imapDelimiter . $old_mailbox)) 151 149 { 152 150 $result['status'] = false; … … 253 251 $result['inbox_size'] = $inbox_size; 254 252 255 $get_user_quota = @imap_get_quota ($this->imap,"user" . $this->imapDelimiter . $uid);253 $get_user_quota = @imap_get_quotaroot($this->imap,"user" . $this->imapDelimiter . $uid); 256 254 $result['mailquota_used'] = (string)(round(($get_user_quota['usage']/1024), 2)); 257 255 } … … 317 315 } 318 316 } 317 318 if( $result['status'] ) 319 $this->sendACLAdvice( $user, $acl, $mailbox ); 320 319 321 return $result; 320 322 } … … 373 375 return $result; 374 376 } 375 file_put_contents("/tmp/saida", "old ".print_r($owners_acl_old, true)."remove ".print_r($owners_to_remove, true)."add ".print_r($owners_to_add, true)."update ".print_r($owners_to_update, true));377 //file_put_contents("/tmp/saida", "old ".print_r($owners_acl_old, true)."remove ".print_r($owners_to_remove, true)."add ".print_r($owners_to_add, true)."update ".print_r($owners_to_update, true)); 376 378 if( is_array($owners_acl_new)){ 377 379 foreach($owners_to_remove as $user => $acl){ … … 397 399 return $result; 398 400 } 401 402 function sendACLAdvice( $user, $acls, $shared_account ) 403 { 404 //acl treat 405 $acl_labels = array( 'lrs' => 'read messages from this shared account', 406 'd' => 'delete/move messages from this shared account', 407 'wi' => 'create/add messages in this shared account', 408 'a' => 'send message by this shared account', 409 'p' => 'save sent messages in this shared account', 410 'c' => 'create or delete folders on this shared account' ); 411 412 $acl_found = array(); 413 414 foreach( $acl_labels as $acl => $label ) 415 { 416 if( strpos( $acls, $acl ) !== false ) 417 { 418 $acl_found[] = $this->functions->lang( $label ); 419 } 420 } 421 422 $acl = implode( "<br/>", $acl_found ); 423 424 if( empty( $acl ) ) 425 return; 426 427 //body mail template generation 428 $body = $this->getTemplate( "body_email.tpl", array( "user" => $user, 429 "acl" => $acl, 430 "shared_account" => $shared_account ) ); 431 432 //ldap fetch mail to 433 require_once('class.ldap_functions.inc.php'); 434 435 if( !$ldap ) 436 { 437 $ldap = new ldap_functions(); 438 } 439 440 $to = $ldap->uid2mailforwardingaddress( $user ); 441 $to = $to['mail']; 442 443 //mail send service 444 $mail = ServiceLocator::getService( 'mail' ); 445 $mail->sendMail( $to, false, $this->functions->lang("Your user was add/updated in the shared account"), $body ); 446 } 447 448 function getTemplate( $tpls, $macros, $target = false ) 449 { 450 require_once( ROOT.'header.inc.php' ); 451 452 $template = CreateObject( 'phpgwapi.Template', PHPGW_APP_TPL ); 453 454 if( !is_array( $tpls ) ) 455 { 456 $tpls = array( $tpls ); 457 } 458 459 $keys = array_keys( $tpls ); 460 461 if( !array_diff_key( $tpl, array_keys( $keys ) ) ) 462 { 463 $newTpls = array(); 464 465 foreach( $tpls as $tpl ) 466 { 467 $key = basename( $tpl ); 468 469 $dot = strrpos( $key, '.' ); 470 471 if( $dot !== false ) 472 { 473 $key = substr( $key, 0, $dot ); 474 } 475 476 $newTpls[ $key ] = $tpl; 477 } 478 479 $tpls = $newTpls; 480 481 $keys = array_keys( $tpls ); 482 } 483 484 $template->set_file( $tpls ); 485 486 $target = $target ? $tpls[ $target ] : $keys[0]; 487 488 $template->set_var( $this->functions->make_dinamic_lang( $template, $target ) ); 489 $template->set_var( $macros ); 490 491 return $template->fp( 'out', $target ); 492 } 399 493 }
Note: See TracChangeset
for help on using the changeset viewer.