Ignore:
Timestamp:
08/03/12 15:32:43 (12 years ago)
Author:
gustavo
Message:

Ticket #2954 - Merge de algumas novas funcionalidades da nova versão, #2953, #2971

File:
1 edited

Legend:

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

    r6922 r6930  
    128128                $result = true; 
    129129                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 
    132133                imap_close($mbox);  
    133134                return $result; 
     
    23952396                        $decifrada = mb_convert_encoding('INBOX'.$this->imap_delimiter.'decifradas','UTF7-IMAP','ISO-8859-1'); //Ignorar esta pasta decifrada 
    23962397                        $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 
    24022449                unset($folders_list); //destroy array de objetos desnecessarios 
    24032450                 
     
    24172464                                $append['folder_hasChildren'] = (($vv['attributes'] == 32) && ($vv['name'] != 'INBOX')) ? 1 : 0; 
    24182465                                $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                                } 
    24192471                                $return[] = $append; 
    24202472                        } 
     
    24232475                $quotaInfo =  (!isset($params['noQuotaInfo'])) ? $this->get_quota( array('folder_id' => $currentFolder)) : false; //VERIFICA SE O USUARIO TEM COTA 
    24242476 
    2425                 return ( ( is_array($quotaInfo) ) ?  array_merge($return, $quotaInfo) : $return );         
     2477                return ( ( is_array($quotaInfo) ) ?  array_merge($return, $quotaInfo) : $return ); 
    24262478        } 
    24272479     
     
    24432495                        if(!imap_createmailbox($mbox_stream,"{".$imap_server."}".$namebox)) 
    24442496                        { 
    2445                                 $result = implode("<br />\n", imap_errors()); 
     2497                                $result = imap_last_error(); 
    24462498                        } 
    24472499                }else{ 
     
    24542506                                if(!imap_createmailbox($mbox_stream,"{".$imap_server."}$namebox")) 
    24552507                                { 
    2456                                         $result = implode("<br />\n", imap_errors());                                            
     2508                                        $result = imap_last_error();                                             
    24572509                                } 
    24582510                                $child .=$this->imap_delimiter; 
     
    24962548                if(!imap_deletemailbox($mbox_stream,"{".$imap_server."}$namebox")) 
    24972549                { 
    2498                         $result = implode("<br />\n", imap_errors()); 
     2550                        $result = imap_last_error(); 
    24992551                } 
    25002552                /* 
     
    25192571                if(!imap_renamemailbox($mbox_stream,"{".$imap_server."}$namebox","{".$imap_server."}$new_box")) 
    25202572                { 
    2521                         $result = imap_errors(); 
     2573                        $result = imap_last_error(); 
    25222574                } 
    25232575                if($mbox_stream) 
     
    37063758                        $this->mbox = $this->open_mbox($folder); 
    37073759 
     3760                if($offsetEnd == 0 && $offsetBegin == 0){ 
     3761                        $offsetEnd = imap_num_msg($this->mbox); 
     3762                        $offsetBegin = 1; 
     3763                } 
    37083764                return $this->messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd,$folder); 
    37093765        } 
     
    38533909        function empty_folder($params) 
    38543910        { 
    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']]; 
    38563912                $mbox_stream = $this->open_mbox($folder); 
    38573913                $return = imap_delete($mbox_stream,'1:*'); 
     3914                $return = imap_errors(); 
    38583915                if($mbox_stream) 
    38593916                        imap_close($mbox_stream, CL_EXPUNGE); 
Note: See TracChangeset for help on using the changeset viewer.