Ignore:
Timestamp:
09/09/10 15:34:47 (14 years ago)
Author:
amuller
Message:

Ticket #428 - Implementação da paginação da busca

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php

    r3192 r3223  
    727727 
    728728                $return = "";  
    729                 if( (!isset($this->preferences['preview_msg_subject']) || ($this->preferences['preview_msg_subject'] != "1")) &&   
    730                         (!isset($this->preferences['preview_msg_tip']    ) || ($this->preferences['preview_msg_tip']     != "1")) )  
     729                if( (!isset($this->prefs['preview_msg_subject']) || ($this->prefs['preview_msg_subject'] != "1")) &&   
     730                        (!isset($this->prefs['preview_msg_tip']    ) || ($this->prefs['preview_msg_tip']     != "1")) )  
    731731                {  
    732732                        $return['body'] = "";  
     
    32373237        function search_msg($params = ''){ 
    32383238            $mbox_stream = ""; 
    3239             if(strpos($params['condition'],"#")===false) { //local messages 
     3239            if(strpos($params['condition'],"#")===false) { //local messages? It shouldn't be necessary, should it? FIXME 
    32403240                    $search=false; 
    32413241            } 
    32423242            else { 
    32433243                    $search = explode(",",$params['condition']); 
    3244             } 
     3244            } 
     3245            $params['page'] = $params['page']*1; 
    32453246 
    32463247            if(is_array($search)){ 
     
    33113312                            $search_criteria = imap_search($mbox_stream, $_filter, SE_UID); 
    33123313 
    3313                             if(is_array($search_criteria)) //&& count($search_criteria) < 50) 
     3314                            if(is_array($search_criteria)) 
    33143315                            { 
    33153316                                foreach($search_criteria as $new_search) 
     
    33193320                                    $elem['uid'] = $new_search;  
    33203321                                    $retorno[] = $elem;  
    3321  
    3322                                     /* NOTE: This code was lost on 2.2 merge  
    3323                                     if ($search_result_number != '65536' && $sum == $search_result_number) 
    3324                                     { 
    3325                                         return $retorno ? $sum . "=sumResults=" . $retorno : "none"; 
    3326                                     } 
    3327  
    3328                                     $m_token = trim("##".mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--".$new_search."##"."\n"); 
    3329                                     if(!@strstr($retorno,$m_token)) 
    3330                                     { 
    3331                                         $retorno .= $m_token; 
    3332                                         $sum ++; 
    3333                                     } 
    3334                                      */ 
    3335                                 } 
    3336                             } 
     3322                                } 
     3323                            } 
    33373324                        } 
    33383325                    } 
     
    33463333                                    $elem['boxname'] = mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" );  
    33473334                                    $elem['uid'] = $new_search;  
    3348                                     $retorno[] = $elem;  
    3349                                 //  NOTE: This code was lost on 2.2 merge  
    3350                                 /*if ($search_result_number != '65536' && $sum == $search_result_number) 
    3351                                 { 
    3352                                     return $retorno ? $sum . "=sumResults=" . $retorno : "none"; 
    3353                                 } 
    3354                                 $retorno .= trim("##".mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ) . "--" . $this->get_msg($new_search,$name_box,$mbox_stream) . "--" . $new_search."##"."\n"); 
    3355                                 $sum++;*/ 
     3335                                    $retorno[] = $elem; 
    33563336                            } 
    33573337                        } 
    3358                     } 
     3338                    } 
    33593339                } 
    33603340            } 
     
    33623342            { 
    33633343                imap_close($mbox_stream); 
    3364             } 
    3365  
    3366             if ($retorno) 
     3344            } 
     3345            $num_msgs = count($retorno); 
     3346 
     3347            /* Comparison functions, descendent is ascendent with parms inverted */ 
     3348            function SORTDATE($a, $b) { return ($a['udate'] < $b['udate']); } 
     3349            function SORTDATE_REVERSE($b, $a) { return SORTDATE($a,$b); } 
     3350 
     3351            function SORTWHO($a, $b) { return (strtoupper($a['from']) > strtoupper($b['from'])); } 
     3352            function SORTWHO_REVERSE($b, $a) { return SORTWHO($a,$b); } 
     3353 
     3354            function SORTSUBJECT($a, $b) { return (strtoupper($a['subject']) > strtoupper($b['subject'])); } 
     3355            function SORTSUBJECT_REVERSE($b, $a) { return SORTSUBJECT($a,$b); } 
     3356 
     3357            function SORTBOX($a, $b) { return ($a['boxname'] > $b['boxname']); } 
     3358            function SORTBOX_REVERSE($b, $a) { return SORTBOX($a,$b); } 
     3359 
     3360            function SORTSIZE($a, $b) { return ($a['size'] > $b['size']); } 
     3361            function SORTSIZE_REVERSE($b, $a) { return SORTSIZE($a,$b); } 
     3362 
     3363            usort($retorno, $params['sort_type']); 
     3364            $pageret = array_slice($retorno, $params['page'] * $this->prefs['max_email_per_page'], $this->prefs['max_email_per_page']); 
     3365            $arrayRetorno['num_msgs'] =  $num_msgs; 
     3366            $arrayRetorno['data'] =  $pageret; 
     3367 
     3368            if ($pageret) 
    33673369            { 
    3368                 return $retorno; 
     3370                return $arrayRetorno; 
    33693371            } 
    33703372            else 
Note: See TracChangeset for help on using the changeset viewer.