Ignore:
Timestamp:
08/16/11 14:15:18 (13 years ago)
Author:
rafaelraymundo
Message:

Ticket #2182 - Pesquisa de mensagem por data e importante.

File:
1 edited

Legend:

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

    r4870 r4927  
    35843584                                } 
    35853585                                else{ 
    3586                                         $search_criteria = imap_search($mbox_stream, $filter, SE_UID); 
    3587                                         if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag']) 
    3588                                         { 
    3589                                             if((!strpos($filter,"FLAGGED") === false) || (!strpos($filter,"UNFLAGGED") === false)) 
     3586                                    if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag']) 
     3587                                    { 
     3588                                        if((!strpos($filter,"FLAGGED") === false) || (!strpos($filter,"UNFLAGGED") === false)) 
     3589                                        { 
     3590                                            $num_msgs = imap_num_msg($mbox_stream); 
     3591                                            $flagged_msgs = array(); 
     3592                                            for ($i=$num_msgs; $i>0; $i--) 
    35903593                                            { 
    3591                                                 $num_msgs = imap_num_msg($mbox_stream); 
    3592                                                 $flagged_msgs = array(); 
    3593                                                 for ($i=$num_msgs; $i>0; $i--) 
    3594                                                 { 
    3595                                                         $iuid = @imap_uid($this->mbox,$i); 
    3596                                                         $header = $this->get_header($iuid); 
    3597                                                         if(trim($header->Flagged)) 
    3598                                                         { 
    3599                                                                 $flagged_msgs[$i] = $iuid; 
    3600                                                         } 
    3601                                                 } 
    3602                                                 if((count($flagged_msgs) >0) && (strpos($filter,"UNFLAGGED") === false)) 
    3603                                                 { 
    3604                                                     $arry_diff = is_array($search_criteria) ? array_diff($flagged_msgs,$search_criteria):$flagged_msgs; 
    3605                                                     foreach($arry_diff as $msg) 
    3606                                                     { 
    3607                                                         $search_criteria[] = $msg; 
    3608                                                     } 
    3609                                                 } 
    3610                                                 else if((count($flagged_msgs) >0) && (is_array($search_criteria)) && (!strpos($filter,"UNFLAGGED") === false)) 
    3611                                                 { 
    3612                                                     $search_criteria = array_diff($search_criteria,$flagged_msgs); 
    3613                                                 } 
     3594                                                $iuid = @imap_uid($this->mbox,$i); 
     3595                                                $header = $this->get_header($iuid); 
     3596                                                if(trim($header->Flagged)) 
     3597                                                { 
     3598                                                        $flagged_msgs[$i] = $iuid; 
     3599                                                } 
    36143600                                            } 
    3615                                         } 
    3616  
    3617                                         if( is_array( $search_criteria) ) 
    3618                                         { 
    3619                                                 foreach($search_criteria as $new_search) 
    3620                                                 { 
    3621                                                         $elem = $this->get_msg_detail($new_search,$name_box,$mbox_stream);  
    3622                                                         $elem['boxname'] = mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" );  
    3623                                                         $elem['uid'] = $new_search; 
    3624                                                         /* compare dates in ordering */ 
    3625                                                         $elem['udatecomp'] = substr ($elem['udate'], -4) ."-". substr ($elem['udate'], 3, 2) ."-". substr ($elem['udate'], 0, 2); 
    3626                                                         $retorno[] = $elem; 
    3627                                                 } 
    3628                                         } 
     3601 
     3602                                            $new_filter = trim(preg_replace('/UNFLAGGED|FLAGGED/','',$filter)); 
     3603 
     3604                                            $search_without_flagged = imap_search($mbox_stream, $new_filter, SE_UID); 
     3605 
     3606                                            if (strpos($filter,"UNFLAGGED") === false) 
     3607                                            { 
     3608                                                $search_criteria = array_intersect($search_without_flagged, $flagged_msgs); 
     3609                                            } 
     3610                                            else 
     3611                                            { 
     3612                                                $search_criteria = array_diff($search_without_flagged,$flagged_msgs); 
     3613                                            } 
     3614                                        } 
     3615                                        else 
     3616                                        { 
     3617                                            $search_criteria = imap_search($mbox_stream, $filter, SE_UID); 
     3618                                        } 
     3619                                    } 
     3620                                    else 
     3621                                    { 
     3622                                        $search_criteria = imap_search($mbox_stream, $filter, SE_UID); 
     3623                                    } 
     3624 
     3625                                    if( is_array( $search_criteria) ) 
     3626                                    { 
     3627                                        foreach($search_criteria as $new_search) 
     3628                                        { 
     3629                                            $elem = $this->get_msg_detail($new_search,$name_box,$mbox_stream); 
     3630                                            $elem['boxname'] = mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ); 
     3631                                            $elem['uid'] = $new_search; 
     3632                                            /* compare dates in ordering */ 
     3633                                            $elem['udatecomp'] = substr ($elem['udate'], -4) ."-". substr ($elem['udate'], 3, 2) ."-". substr ($elem['udate'], 0, 2); 
     3634                                            $retorno[] = $elem; 
     3635                                        } 
     3636                                    } 
    36293637                                } 
    36303638                        } 
Note: See TracChangeset for help on using the changeset viewer.