Changeset 6930 for trunk/expressoMail1_2/inc/class.imap_functions.inc.php
- Timestamp:
- 08/03/12 15:32:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r6922 r6930 128 128 $result = true; 129 129 if(!imap_renamemailbox($mbox, '{'.$this->imap_server.":".$this->imap_port.$this->imap_options.'}'.$old_folder, '{'.$this->imap_server.":".$this->imap_port.$this->imap_options.'}'.$to_folder.$this->imap_delimiter.$new_folder[count($new_folder)-1])){ 130 $result = false; 131 } 130 $result = imap_last_error(); 131 } 132 132 133 imap_close($mbox); 133 134 return $result; … … 2395 2396 $decifrada = mb_convert_encoding('INBOX'.$this->imap_delimiter.'decifradas','UTF7-IMAP','ISO-8859-1'); //Ignorar esta pasta decifrada 2396 2397 $parent = ($nameCount > 1 && $nameArray[($nameCount - 2)] !== 'INBOX') ? implode($this->imap_delimiter, array_slice($nameArray, 0, ($nameCount - 1))): ''; //Pega folder pai 2397 if($nameArray[0] === 'user') 2398 $folders[$prefixShared.$this->imap_delimiter.$nameArray[1]][] = array('id' => $folderId , 'stream' => $v->name , 'attributes' => $v->attributes , 'name' => $nameArray[($nameCount-1)] , 'user' => $nameArray[1] ,'parent' => $parent); 2399 else if( $folderId !== $decifrada) //Escapa pasta decifrada 2400 $folders['INBOX'][strtolower($folderId)] = array('id' => $folderId , 'stream' => $v->name , 'attributes' => $v->attributes ,'name' => $nameArray[($nameCount-1)] , 'parent' => $parent); 2401 } 2398 2399 if($nameArray[0] === 'user'){ 2400 2401 //variaveis utilizadas para definição das permissões das pastas compartilhadas 2402 $acl_share_create = 0; 2403 $acl_share_rename = 0; 2404 $acl_share_delete = 0; 2405 2406 //recuperando as permissões (ACLs) aplicadas na pasta 2407 $imap_getacl = imap_getacl($mboxStream, $folderId); 2408 2409 //Se existe ACLs aplicadas a respectiva pasta (para o usuario corrente) 2410 if(isset($imap_getacl[ $this->username ])){ 2411 $aclImap = $imap_getacl[ $this->username ]; 2412 2413 //A partir dos atributos da ACL definir permissões para cada ação (create, delete e rename): 2414 //http://www.ietf.org/rfc/rfc4314.txt 2415 $acl_share_create = (stripos($aclImap,'w') !== false && stripos($aclImap,'i') !== false && stripos($aclImap,'k') !== false) ? 1 : 0; 2416 $acl_share_delete = (stripos($aclImap,'x') !== false && stripos($aclImap,'t') !== false && stripos($aclImap,'e') !== false) ? 1 : 0; 2417 2418 $acl_share_rename = ($acl_share_create && $acl_share_delete) ? 1 : 0; 2419 } 2420 2421 $folders[$prefixShared.$this->imap_delimiter.$nameArray[1]][] = array( 2422 'id' => $folderId , 2423 'stream' => $v->name , 2424 'attributes' => $v->attributes , 2425 'name' => $nameArray[($nameCount-1)] , 2426 'user' => $nameArray[1] , 2427 'parent' => $parent , 2428 2429 //Acrescentando ACLs configuradas a cada pasta compartilhada 2430 'acl_share' => array( 2431 'create' => $acl_share_create, 2432 'rename' => $acl_share_rename, 2433 'delete' => $acl_share_delete 2434 ) 2435 ); 2436 2437 } 2438 else if( $folderId !== $decifrada){ //Escapa pasta decifrada 2439 $folders['INBOX'][strtolower($folderId)] = array( 2440 'id' => $folderId , 2441 'stream' => $v->name , 2442 'attributes' => $v->attributes , 2443 'name' => $nameArray[($nameCount-1)] , 2444 'parent' => $parent 2445 ); 2446 } 2447 } 2448 2402 2449 unset($folders_list); //destroy array de objetos desnecessarios 2403 2450 … … 2417 2464 $append['folder_hasChildren'] = (($vv['attributes'] == 32) && ($vv['name'] != 'INBOX')) ? 1 : 0; 2418 2465 $append['folder_parent'] = $vv['parent']; 2466 2467 //Preparando o array de retorno para conter as ACLs configuradas para cada pasta 2468 if(isset($vv['acl_share'])){ 2469 $append['acl_share'] = $vv['acl_share']; 2470 } 2419 2471 $return[] = $append; 2420 2472 } … … 2423 2475 $quotaInfo = (!isset($params['noQuotaInfo'])) ? $this->get_quota( array('folder_id' => $currentFolder)) : false; //VERIFICA SE O USUARIO TEM COTA 2424 2476 2425 return ( ( is_array($quotaInfo) ) ? array_merge($return, $quotaInfo) : $return ); 2477 return ( ( is_array($quotaInfo) ) ? array_merge($return, $quotaInfo) : $return ); 2426 2478 } 2427 2479 … … 2443 2495 if(!imap_createmailbox($mbox_stream,"{".$imap_server."}".$namebox)) 2444 2496 { 2445 $result = im plode("<br />\n", imap_errors());2497 $result = imap_last_error(); 2446 2498 } 2447 2499 }else{ … … 2454 2506 if(!imap_createmailbox($mbox_stream,"{".$imap_server."}$namebox")) 2455 2507 { 2456 $result = im plode("<br />\n", imap_errors());2508 $result = imap_last_error(); 2457 2509 } 2458 2510 $child .=$this->imap_delimiter; … … 2496 2548 if(!imap_deletemailbox($mbox_stream,"{".$imap_server."}$namebox")) 2497 2549 { 2498 $result = im plode("<br />\n", imap_errors());2550 $result = imap_last_error(); 2499 2551 } 2500 2552 /* … … 2519 2571 if(!imap_renamemailbox($mbox_stream,"{".$imap_server."}$namebox","{".$imap_server."}$new_box")) 2520 2572 { 2521 $result = imap_ errors();2573 $result = imap_last_error(); 2522 2574 } 2523 2575 if($mbox_stream) … … 3706 3758 $this->mbox = $this->open_mbox($folder); 3707 3759 3760 if($offsetEnd == 0 && $offsetBegin == 0){ 3761 $offsetEnd = imap_num_msg($this->mbox); 3762 $offsetBegin = 1; 3763 } 3708 3764 return $this->messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd,$folder); 3709 3765 } … … 3853 3909 function empty_folder($params) 3854 3910 { 3855 $folder = 'INBOX'. $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server'][$params['clean_folder']];3911 $folder = (isset($params['shared']) ? $params['shared'] : 'INBOX') . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server'][$params['clean_folder']]; 3856 3912 $mbox_stream = $this->open_mbox($folder); 3857 3913 $return = imap_delete($mbox_stream,'1:*'); 3914 $return = imap_errors(); 3858 3915 if($mbox_stream) 3859 3916 imap_close($mbox_stream, CL_EXPUNGE);
Note: See TracChangeset
for help on using the changeset viewer.