Changeset 5900


Ignore:
Timestamp:
04/09/12 17:21:34 (12 years ago)
Author:
gustavo
Message:

Ticket #2601 - Ordenação errada de mensagens

File:
1 edited

Legend:

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

    r5864 r5900  
    31973197        function messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd,$folder) 
    31983198        { 
     3199                $sort = array(); 
    31993200                if ($sort_box_type != "SORTFROM" && $search_box_type!= "FLAGGED"){ 
    32003201                        $imapsort = imap_sort($this->mbox,constant($sort_box_type),$sort_box_reverse,SE_UID,$search_box_type); 
    3201                         foreach($imapsort as $iuid) 
    3202                                 $sort[$iuid] = ""; 
    3203                          
     3202                        foreach($imapsort as $iuid){ 
     3203                                $sort[$iuid] = $iuid; 
     3204                        } 
    32043205                        if ($offsetBegin == -1 && $offsetEnd ==-1 ) 
    32053206                                $slice_array = false; 
     
    32093210                else 
    32103211                { 
    3211                         $sort = array(); 
    32123212                        if ($offsetBegin > $offsetEnd) {$temp=$offsetEnd; $offsetEnd=$offsetBegin; $offsetBegin=$temp;} 
    32133213                        $num_msgs = imap_num_msg($this->mbox); 
    32143214                        if ($offsetEnd >  $num_msgs) {$offsetEnd = $num_msgs;} 
    32153215                        $slice_array = true; 
    3216             $from_to_sent = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['from_to_sent'];      
     3216            $from_to_sent = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['from_to_sent'];   
     3217                        $dates = array(); 
    32173218                        for ($i=$num_msgs; $i>0; $i--) 
    32183219                        { 
     
    32213222                                $iuid = @imap_uid($this->mbox,$i); 
    32223223                                $header = $this->get_header($iuid); 
     3224                                 
    32233225                                // List UNSEEN messages. 
    32243226                                if($search_box_type == "UNSEEN" &&  (!trim($header->Recent) && !trim($header->Unseen))){ 
     
    32543256                                        $sort[$iuid] = $header->udate; 
    32553257                                } 
    3256  
    3257                         } 
    3258                         natcasesort($sort); 
    3259  
     3258                                $dates[$iuid] = $header->udate; 
     3259                        } 
     3260                        $keys = array_keys($sort); 
     3261                        array_multisort($sort, SORT_ASC, $keys, SORT_DESC, $dates, SORT_DESC); 
     3262                        $sort = array_combine($keys, $sort); 
    32603263                        if ($sort_box_reverse) 
    32613264                                $sort = array_reverse($sort,true); 
     
    32643267                        $sort = array(); 
    32653268                } 
    3266                  
    3267                          
    3268  
    3269  
    32703269                if ($slice_array) 
    32713270                        $sort = array_slice($sort,$offsetBegin-1,$offsetEnd-($offsetBegin-1),true); 
    3272  
    3273  
    32743271                return $sort; 
    32753272 
Note: See TracChangeset for help on using the changeset viewer.