Changeset 828


Ignore:
Timestamp:
05/11/09 11:34:00 (15 years ago)
Author:
niltonneto
Message:

Ticket 432 - Otimização do tempo de resposta na leitura de caixas grandes.

File:
1 edited

Legend:

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

    r708 r828  
    4545        function open_mbox($folder = False) 
    4646        { 
     47                if (is_resource($this->mbox)) 
     48                        return $this->mbox; 
    4749                $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO_8859-1"); 
    4850                $this->mbox = @imap_open("{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$folder, $this->username, $this->password) or die(serialize(array('imap_error' => $this->parse_error(imap_last_error())))); 
     
    7779                $sort_box_reverse = $params['sort_box_reverse']; 
    7880                $search_box_type = $params['search_box_type'] != "ALL" && $params['search_box_type'] != "" ? $params['search_box_type'] : false; 
    79                 $sort_array_msg = $this-> get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse);                                
     81                $sort_array_msg = $this-> get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$msg_range_begin,$msg_range_end); 
    8082                 
    8183                $return = array(); 
    8284                $i = 0; 
    83                 $num_msgs = (is_array($sort_array_msg) ? count($sort_array_msg) : 0); 
    84                 if($num_msgs) {  
    85                         for ($msg_range_begin; (($msg_range_begin <= $msg_range_end) && ($msg_range_begin <= $num_msgs)); $msg_range_begin++) 
    86                         { 
    87                                 $msg_number = $sort_array_msg[$msg_range_begin-1]; 
     85                $num_msgs = imap_num_msg($this->mbox); 
     86                if(is_array($sort_array_msg)){ 
     87                        foreach($sort_array_msg as $msg_number => $value)  
     88                        { 
    8889                                $temp = $this->get_info_head_msg($msg_number); 
    8990                                if(!$temp) 
    9091                                        return false; 
    91          
     92 
    9293                                $return[$i] = $temp; 
    9394                                $i++; 
    9495                        } 
    9596                } 
    96                 $return['num_msgs'] = $num_msgs;                 
    97                  
     97                $return['num_msgs'] = $num_msgs; 
     98 
    9899                return $return; 
    99100        } 
    100          
     101 
    101102        function get_info_head_msg($msg_number) { 
    102103                $head_array = array(); 
    103104                include_once("class.imap_attachment.inc.php"); 
    104105                $imap_attachment = new imap_attachment(); 
    105                  
    106                 /*A função imap_headerinfo não traz o cabeçalho completo, e sim alguns 
    107                 * atributos do cabeçalho. Como eu preciso do atributo Importance  
    108                 * para saber se o email é importante ou não, uso abaixo a função 
    109                 * imap_fetchheader e busco o atributo importance nela para passar 
    110                 * para as funções ajax. Isso faz com que eu acesse o cabeçalho 
    111                 * duas vezes e de duas formas diferentes, mas em contrapartida, eu 
    112                 * não preciso reimplementar o método utilizando o fetchheader. 
    113                 * Como as mensagens são renderizadas de X em X, não parece ter 
    114                 * perda considerável de performance. 
    115                 */ 
     106 
     107                /*Como eu preciso do atributo Importance para saber se o email é  
     108                 * importante ou não, uso abaixo a função imap_fetchheader e busco 
     109                 * o atributo importance nela. Isso faz com que eu acesse o cabeçalho 
     110                 * duas vezes e de duas formas diferentes, mas em contrapartida, eu 
     111                 * não preciso reimplementar o método utilizando o fetchheader. 
     112                 * Como as mensagens são renderizadas em um número pequeno por vez, 
     113                 * não parece ter perda considerável de performance. 
     114                 */ 
    116115                $flag = preg_match('/importance *: *(.*)\r/i', 
    117                                         imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
    118                                         ,$importance);           
     116                        imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)), 
     117                        $importance); 
    119118                $head_array['Importance'] = $flag==0?"Normal":$importance[1]; 
    120119 
    121                  
     120 
    122121                $header = $this->get_header($msg_number); 
    123                         if (!is_object($header)) 
    124                                 return false; 
     122                if (!is_object($header)) 
     123                        return false; 
    125124                $head_array['Recent'] = $header->Recent; 
    126125                $head_array['Unseen'] = $header->Unseen; 
     
    130129                else { 
    131130                        $head_array['Answered'] = $header->Answered; 
    132                         $head_array['Draft']    = $header->Draft;        
     131                        $head_array['Draft']    = $header->Draft; 
    133132                } 
    134133                $head_array['Deleted'] = $header->Deleted; 
    135134                $head_array['Flagged'] = $header->Flagged; 
    136                  
     135 
    137136                $head_array['msg_number'] = $msg_number; 
    138                 //$return[$i]['msg_folder'] = $folder; 
    139                  
     137                //$head_array['msg_folder'] = $folder; 
     138 
    140139                $date_msg = gmdate("d/m/Y",$header->udate); 
    141                 if (date("d/m/Y") == $date_msg) 
     140                if (gmdate("d/m/Y") == $date_msg) 
    142141                        $head_array['udate'] = gmdate("H:i",$header->udate); 
    143142                else 
    144143                        $head_array['udate'] = $date_msg; 
    145                  
     144 
    146145                $head_array['aux_date'] = $date_msg; //Auxiliar apenas para mensagens locais. 
    147                  
     146 
    148147                $from = $header->from; 
    149148                $head_array['from'] = array(); 
     
    161160                        $head_array['to']['name'] = $head_array['to']['email']; 
    162161                $head_array['subject'] = $this->decode_string($header->fetchsubject); 
    163                  
     162 
    164163                $head_array['Size'] = $header->Size; 
    165                  
     164 
    166165                $head_array['attachment'] = array(); 
    167166                $head_array['attachment'] = $imap_attachment->get_attachment_headerinfo($this->mbox, $msg_number); 
    168                  
     167 
    169168                return $head_array; 
    170169        } 
    171          
     170 
    172171        function decode_string($string) 
    173172        {        
     
    337336                        imap_close($this->mbox); 
    338337                        $this->mbox=false; 
    339  
    340  
    341338                        array_push($return,serialize($msg_info)); 
    342  
    343                 } 
    344  
     339                } 
    345340                return $return; 
    346341        } 
     
    361356                } 
    362357                 
    363                 $all_header = explode("\n", imap_fetchheader($this->mbox, $msg_number, FT_UID)); 
     358                $header_ = imap_fetchheader($this->mbox, $msg_number, FT_UID); 
     359 
    364360                $return_get_body = $this->get_body_msg($msg_number, $msg_folder); 
    365361                 
    366362                //Substituição de links em email para abrir no próprio expresso 
    367363                $body = ereg_replace("<a[^>]*href=[\'\"]mailto:([^\"\']+)[\'\"]>([^<]+)</a>","<a href=\"javascript:new_message_to('\\1')\">\\2</a>",$return_get_body['body']); 
    368                  
     364 
    369365                $return['body']                 = $body; 
    370366                $return['attachments']  = $return_get_body['attachments']; 
    371367                $return['thumbs']               = $return_get_body['thumbs']; 
    372368                $return['signature']    = $return_get_body['signature']; 
    373                  
    374                 foreach($all_header as $line) { 
    375                         if (eregi("^Disposition-Notification-To", $line)) { 
    376                                 eregi("^([^:]*): (.*)", $line, &$arg); 
    377                                 $return['DispositionNotificationTo'] = $arg[2]; 
    378                         } 
    379                 } 
     369 
     370                $pattern = '/^[ \t]*Disposition-Notification-To(^:)*:(.+)*@(.+)*$/isUm'; 
     371                if (preg_match($pattern, $header_, $fields)) 
     372                { 
     373                        preg_match('/[[:alnum:]\._\-]+@[[:alnum:]_\-\.]+/',$fields[0], $matches); 
     374                        $return['DispositionNotificationTo'] = "<".$matches[0].">"; 
     375                } 
     376 
    380377                $return['Recent']       = $header->Recent; 
    381378                $return['Unseen']       = $header->Unseen; 
     
    598595                $return['subject'] = $this->decode_string($header->fetchsubject); 
    599596                $return['Size'] = $header->Size; 
    600                 $return['reply_toaddress'] = $header->reply_toaddress;   
    601          
     597                $return['reply_toaddress'] = $header->reply_toaddress; 
     598 
    602599                //All this is to help in local messages 
    603600                $return['timestamp'] = $header->udate; 
    604601                $return['login'] = $_SESSION['phpgw_info']['expressomail']['user']['account_id'];//$GLOBALS['phpgw_info']['user']['account_id']; 
    605602                $return['reply_toaddress'] = $header->reply_toaddress; 
    606                  
     603 
    607604                return $return; 
    608605        } 
     
    858855                // HTML Filter 
    859856                //$body = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=# onclick=\"javascript:new_message('new_by_message', '\\2@\\3')\">\\2@\\3</a>", $body); 
    860         $body = str_replace("\r\n", "\n", $body); 
     857        //$body = str_replace("\r\n", "\n", $body); 
    861858                if ($encoding == 'quoted-printable') 
    862             { 
     859                { 
     860                        /* 
    863861                         
    864862                        for($i=0;$i<256;$i++) { 
     
    869867                                $myqprintb[]=chr($i); 
    870868                        }                
     869                         */ 
    871870                        $body = str_replace($myqprinta,$myqprintb,($body)); 
    872871                        $body = quoted_printable_decode($body); 
     
    880879                $body = base64_decode($body); 
    881880        } 
    882         /*else if ($encoding == '7bit')  
     881        else if ($encoding == '7bit')  
    883882        { 
    884883                $body = quoted_printable_decode($body);                                          
    885         }*/ 
     884        } 
    886885                // All other encodings are returned raw. 
    887886                if (strtolower($charset) == "utf-8") 
     
    10821081                $msgs_in_the_server = array(); 
    10831082                $search_box_type = $params['search_box_type'] != "ALL" && $params['search_box_type'] != "" ? $params['search_box_type'] : false; 
    1084                 $sort_array_msg = $this -> get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse); 
    1085  
    1086                 if(!count($sort_array_msg)) 
     1083                $msgs_in_the_server = $this->get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$msg_range_begin,$msg_range_end); 
     1084                $msgs_in_the_server = array_keys($msgs_in_the_server); 
     1085                if(!count($msgs_in_the_server)) 
    10871086                        return array(); 
    10881087                         
    1089                 $num_msgs = (count($sort_array_msg) - imap_num_recent($this->mbox)); 
    1090                 $msgs_in_the_client = explode(",", $msgs_existent); 
    1091  
    1092                  
    1093                 for ($msg_range_begin; (($msg_range_begin <= $msg_range_end) && ($msg_range_begin <= count($sort_array_msg))); $msg_range_begin++) 
    1094                 { 
    1095                         $msgs_in_the_server[] = $sort_array_msg[$msg_range_begin-1]; 
    1096                 } 
    1097                 if ((count($msgs_in_the_server) < 1) && ($msg_range_begin != 0)) 
    1098                 { 
    1099                         $range = $msg_range_end - $msg_range_begin; 
    1100                         $msg_range_begin = $msg_range_begin - $range; 
    1101                         $msg_range_end = $msg_range_end - $range; 
    1102                         for ($msg_range_begin; (($msg_range_begin <= $msg_range_end) && ($msg_range_begin <= count($sort_array_msg))); $msg_range_begin++) 
    1103                         { 
    1104                                 $msgs_in_the_server[] = $sort_array_msg[$msg_range_begin-1]; 
    1105                         } 
    1106                 } 
    1107                  
     1088                $num_msgs = (count($msgs_in_the_server) - imap_num_recent($this->mbox)); 
     1089                $msgs_in_the_client = explode(",", $msgs_existent);      
     1090 
    11081091                $msg_to_insert  = array_diff($msgs_in_the_server, $msgs_in_the_client); 
    11091092                $msg_to_delete = array_diff($msgs_in_the_client, $msgs_in_the_server); 
     
    11501133                        */ 
    11511134                        $flag = preg_match('/importance *: *(.*)\r/i', 
    1152                                         imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
     1135                                        @imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
    11531136                                        ,$importance);           
    11541137                        $return[$i]['Importance'] = $flag==0?"Normal":$importance[1]; 
     
    11561139                        $header = $this->get_header($msg_number); 
    11571140                        if (!is_object($header)) 
    1158                                 return false; 
    1159                          
     1141                                continue; 
     1142 
    11601143                        $return[$i]['msg_number']       = $msg_number; 
    11611144                        $return[$i]['command']          = $command; 
     
    12081191                if($this->mbox && is_resource($this->mbox)) 
    12091192                        imap_close($this->mbox); 
     1193 
    12101194                return $return; 
    12111195        } 
     
    13921376                                return "The server denied your request to send a mail, you cannot use this mail address."; 
    13931377                } 
    1394                  
     1378 
    13951379                //new_message_to backs to mailto: pattern 
    13961380                $params['body'] = eregi_replace("<a href=\"javascript:new_message_to\('([^>]+)'\)\">[^>]+</a>","<a href='mailto:\\1'>\\1</a>",$params['body']); 
    1397                  
     1381 
    13981382                $toaddress = implode(',',$db->getAddrs(explode(',',$params['input_to']))); 
    13991383                $ccaddress = implode(',',$db->getAddrs(explode(',',$params['input_cc']))); 
     
    15021486                        if( $total_uploaded_size > $upload_max_filesize) 
    15031487                                return $this->parse_error("message file too big");                       
    1504                 }                        
     1488                } 
    15051489                else if(($params['is_local_forward']=="1") && (count($local_attachments))) { //Caso seja forward de mensagens locais 
    1506                          
     1490 
    15071491                        $total_uploaded_size = 0; 
    15081492                        $upload_max_filesize = str_replace("M","",ini_get('upload_max_filesize')) * 1024 * 1024;                         
     
    15171501                        } 
    15181502                        if( $total_uploaded_size > $upload_max_filesize) 
    1519                                 return 'false';  
     1503                                return 'false'; 
    15201504                } 
    15211505//////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    16281612        function get_forwarding_attachment($msg_folder, $msg_number, $msg_part, $encoding) 
    16291613        { 
    1630                 $mbox_stream = $this->open_mbox($msg_folder);                    
     1614                $mbox_stream = $this->open_mbox(utf8_decode(urldecode($msg_folder))); 
    16311615                $fileContent = imap_fetchbody($mbox_stream, $msg_number, $msg_part, FT_UID);             
    16321616                if($encoding == 'base64') 
     
    16541638        } 
    16551639         
    1656         function messages_sort($sort_box_type,$sort_box_reverse, $search_box_type) 
     1640        function messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd) 
    16571641        { 
    16581642                $sort = array(); 
    1659                 $sort_uid = array(); 
    1660                  
     1643                if ($offsetBegin > $offsetEnd) {$temp=$offsetEnd; $offsetEnd=$offsetBegin; $offsetBegin=$temp;} 
    16611644                $num_msgs = imap_num_msg($this->mbox); 
    1662                 for ($i=1; $i<=$num_msgs; $i++) 
    1663                 { 
    1664                         $header = $this->get_header(imap_uid($this->mbox,$i)); 
     1645                if ($offsetEnd >  $num_msgs) {$offsetEnd = $num_msgs;} 
     1646                if ($search_box_type == "" && $sort_box_type == "SORTARRIVAL") 
     1647                { 
     1648                        // If I'm looking for any type of email doesn't need to see all imap box 
     1649                        if ($sort_box_reverse) 
     1650                        { 
     1651                                $numBegin = $num_msgs - $offsetEnd; 
     1652                                if ($numBegin < 0) $numBegin=0; 
     1653                                $numEnd = $num_msgs - ($offsetBegin-1); 
     1654                        } 
     1655                        else 
     1656                        { 
     1657                                $numBegin = ($offsetBegin-1); 
     1658                                $numEnd = $offsetEnd; 
     1659                        } 
     1660                        $slice_array = false; 
     1661                } 
     1662                else 
     1663                { 
     1664                        // If I'm looking for a specific type of email I have to see entire imap box 
     1665                        $numBegin = 0; 
     1666                        $numEnd = $num_msgs; 
     1667                        $slice_array = true; 
     1668                } 
     1669                for ($i=$numBegin+1; $i<=$numEnd; $i++) 
     1670                { 
     1671                        $iuid = @imap_uid($this->mbox,$i); 
     1672                        $header = $this->get_header($iuid); 
    16651673                        // List UNSEEN messages. 
    16661674                        if($search_box_type == "UNSEEN" &&  (!trim($header->Recent) && !trim($header->Unseen))){ 
     
    16891697                                 
    16901698                                if ($tmp[0]->text != "") 
    1691                                         $sort[$i] = $tmp[0]->text; 
     1699                                        $sort[$iuid] = $tmp[0]->text; 
    16921700                                else 
    1693                                         $sort[$i] = $from[0]->mailbox . "@" . $from[0]->host; 
     1701                                        $sort[$iuid] = $from[0]->mailbox . "@" . $from[0]->host; 
    16941702                        } 
    16951703                        else if($sort_box_type=='SORTSUBJECT') { 
    1696                                 $sort[$i] = $header->subject; 
     1704                                $sort[$iuid] = $header->subject; 
    16971705                        } 
    16981706                        else if($sort_box_type=='SORTSIZE') { 
    1699                                 $sort[$i] = $header->Size; 
     1707                                $sort[$iuid] = $header->Size; 
    17001708                        } 
    17011709                        else { 
    1702                                 $sort[$i] = $header->udate; 
    1703                         } 
    1704                          
    1705                 } 
    1706                  
     1710                                $sort[$iuid] = $header->udate; 
     1711                        } 
     1712 
     1713                } 
    17071714                natcasesort($sort); 
    1708                  
    1709                 foreach($sort as $index => $header_msg) 
    1710                 {        
    1711                         $sort_uid[] = imap_uid($this->mbox, $index); 
    1712                 } 
    1713                  
     1715 
    17141716                if ($sort_box_reverse) 
    1715                         $sort_uid = array_reverse($sort_uid); 
    1716                  
    1717                 return $sort_uid; 
    1718  
    1719         } 
    1720          
    1721         /** 
    1722          * Deprecated 
    1723          *  
    1724          * Replaced for the method messages_sort 
    1725          */ 
    1726         function imap_sortfrom($sort_box_reverse, $search_box_type) 
    1727         { 
    1728                 $sortfrom = array(); 
    1729                 $sortfrom_uid = array(); 
    1730                  
    1731                 $num_msgs = imap_num_msg($this->mbox); 
    1732                 for ($i=1; $i<=$num_msgs; $i++) 
    1733                 { 
    1734                         $header = $this->get_header(imap_uid($this->mbox,$i)); 
    1735                         // List UNSEEN messages. 
    1736                         if($search_box_type == "UNSEEN" &&  (!trim($header->Recent) && !trim($header->Unseen))){ 
    1737                                 continue; 
    1738                         } 
    1739                         // List SEEN messages. 
    1740                         elseif($search_box_type == "SEEN" && (trim($header->Recent) || trim($header->Unseen))){ 
    1741                                 continue; 
    1742                         } 
    1743                         // List ANSWERED messages.                       
    1744                         elseif($search_box_type == "ANSWERED" && !trim($header->Answered)){ 
    1745                                 continue;                                
    1746                         } 
    1747                         // List FLAGGED messages.                        
    1748                         elseif($search_box_type == "FLAGGED" && !trim($header->Flagged)){ 
    1749                                 continue; 
    1750                         } 
    1751                                                  
    1752                         if (($header->from[0]->mailbox . "@" . $header->from[0]->host) == $_SESSION['phpgw_info']['expressomail']['user']['email'])                              
    1753                                 $from = $header->to; 
    1754                         else 
    1755                                 $from = $header->from; 
    1756                          
    1757                         $tmp = imap_mime_header_decode($from[0]->personal);                      
    1758                          
    1759                         if ($tmp[0]->text != "") 
    1760                                 $sortfrom[$i] = $tmp[0]->text; 
    1761                         else 
    1762                                 $sortfrom[$i] = $from[0]->mailbox . "@" . $from[0]->host; 
    1763                 } 
    1764                  
    1765                 natcasesort($sortfrom); 
    1766                  
    1767                 foreach($sortfrom as $index => $header_msg) 
    1768                 {        
    1769                         $sortfrom_uid[] = imap_uid($this->mbox, $index); 
    1770                 } 
    1771                  
    1772                 if ($sort_box_reverse) 
    1773                         $sortfrom_uid = array_reverse($sortfrom_uid); 
    1774                  
    1775                 return $sortfrom_uid; 
    1776         } 
    1777  
     1717                        $sort = array_reverse($sort,true); 
     1718 
     1719                if ($slice_array) 
     1720                        $sort = array_slice($sort,$offsetBegin-1,$offsetEnd-($offsetBegin-1),true); 
     1721                return $sort; 
     1722 
     1723        } 
     1724         
    17781725        function move_search_messages($params){          
    17791726                $params['selected_messages'] = urldecode($params['selected_messages']);  
     
    18501797                                        $return['new_folder_name'] = $cn; 
    18511798        } 
    1852                                  
     1799                 
    18531800                // Caso estejamos no box principal, nao eh necessario pegar a informacao da mensagem anterior.           
    18541801                if (($params['get_previous_msg']) && ($params['border_ID'] != 'null') && ($params['border_ID'] != '')) 
     
    20572004            $mail->ContentType = "multipart/alternative"; 
    20582005 
    2059         $mail->error_count = 0; // reset errors 
    2060         $mail->SetMessageType(); 
    2061         $header = $mail->CreateHeader(); 
    2062         $body = $mail->CreateBody(); 
    2063          
     2006                $mail->error_count = 0; // reset errors 
     2007                $mail->SetMessageType(); 
     2008                $header = $mail->CreateHeader(); 
     2009                $body = $mail->CreateBody();  
     2010 
    20642011        if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') 
    20652012                { 
     
    20832030                $return['msg_no'] = $status->uidnext - 1; 
    20842031                $return['folder_id'] = $folder; 
    2085                  
     2032 
    20862033                if($mbox_stream) 
    20872034                        imap_close($mbox_stream); 
    20882035                if (is_array($return_files))               
    2089                 foreach ($return_files as $index => $_attachment) { 
    2090                         if (array_key_exists("name",$_attachment)){ 
     2036                        foreach ($return_files as $index => $_attachment) { 
     2037                                if (array_key_exists("name",$_attachment)){ 
    20912038                                unset($return_files[$index]); 
    20922039                                $return_files[$index] = $_attachment['name']."_SIZE_".$return_files[$index][1] = $_attachment['size']; 
     
    22502197        } 
    22512198         
    2252         function get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse){ 
    2253                  
    2254                 if(!$this->mbox || !is_resource($this->mbox)){ 
     2199        function get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$offsetBegin = 0,$offsetEnd = 0) 
     2200        { 
     2201                if(!$this->mbox || !is_resource($this->mbox)) 
    22552202                        $this->mbox = $this->open_mbox($folder); 
    2256                  
    2257                 } 
    2258  
    2259                 return $this->messages_sort($sort_box_type,$sort_box_reverse, $search_box_type); 
    2260                 /*switch($sort_box_type){ 
    2261                         case 'SORTFROM': 
    2262                                 return $this->imap_sortfrom($sort_box_reverse, $search_box_type);                                
    2263                         case 'SORTSUBJECT': 
    2264                                 return imap_sort($this->mbox, SORTSUBJECT, $sort_box_reverse, SE_UID, $search_box_type);                                 
    2265                         case 'SORTSIZE': 
    2266                                 return imap_sort($this->mbox, SORTSIZE, $sort_box_reverse, SE_UID, $search_box_type);                            
    2267                         default: 
    2268                                 return imap_sort($this->mbox, SORTARRIVAL, $sort_box_reverse, SE_UID, $search_box_type);                                                 
    2269                 }*/ 
    2270         }        
     2203 
     2204                return $this->messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd); 
     2205        } 
    22712206         
    22722207        function get_info_next_msg($params) 
     
    26442579        function get_msg($uid_msg,$name_box, $mbox_stream ) 
    26452580        { 
    2646                 $header = $this->get_header($uid_msg);          
    2647                 $flag = $header->Unseen.$header->Recent.$header->Flagged.$header->Draft; 
     2581                $header = $this->get_header($uid_msg); 
     2582                include_once("class.imap_attachment.inc.php"); 
     2583                $imap_attachment = new imap_attachment(); 
     2584                $attachments =  $imap_attachment->get_attachment_headerinfo($mbox_stream, $uid_msg); 
     2585                $attachments = $attachments['number_attachments'] > 0?"T".$attachments['number_attachments']:""; 
     2586                $flag = $header->Unseen 
     2587                        .$header->Recent 
     2588                        .$header->Flagged 
     2589                        .$header->Draft 
     2590                        .$header->Answered 
     2591                        .$header->Deleted 
     2592                        .$attachments; 
     2593 
     2594 
    26482595                $subject = $this->decode_string($header->fetchsubject); 
    26492596                $from = $header->from[0]->mailbox; 
     
    26532600                return $ret_msg;                     
    26542601        }        
    2655          
     2602 
    26562603        function size_msg($size){ 
    26572604                $var = floor($size/1024); 
Note: See TracChangeset for help on using the changeset viewer.