Ignore:
Timestamp:
08/19/09 11:10:14 (15 years ago)
Author:
niltonneto
Message:

Ticket #561 - Correção das diferenças entre versão publicada e branch 1.2

Location:
branches/1.2/expressoMail1_2/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/expressoMail1_2/inc/class.exporteml.inc.php

    r711 r1342  
    186186        } 
    187187 
    188         function export_to_archive($id_msg,$folder) { 
    189                 $this->folder = $folder; 
    190                 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8"); 
    191                 $tempDir = dirname( __FILE__ ) . '/../tmpLclAtt'; 
    192                  
    193                 $phpheader = "<?php header('Content-Type: text/plain'); 
    194                                 header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
    195                                 header('Pragma: public'); 
    196                                 header('Expires: 0'); // set expiration time 
    197                                 header('Content-Disposition: attachment; filename=\"fonte_da_mensagem.txt\"');?>"; 
    198                  
    199                 $this->connectImap(); 
    200                 $header         = $this-> getHeader($id_msg); 
    201                 $body           = $this-> getBody($id_msg); 
    202                  
    203                 $file = "source_".md5(microtime()).".php"; 
    204                 $f = fopen($tempDir.'/'.$file,"w"); 
    205                 fputs($f,$phpheader.$header ."\r\n\r\n". $body); 
    206                 fclose($f); 
    207                 $urlPath = 'tmpLclAtt/'.$file; 
    208                  
    209                 imap_close($this->mbox_stream); 
    210                 return $urlPath; 
    211         } 
    212  
    213188        function remove_accents($string) { 
    214189                /* 
     
    220195                        "áàâãäéèêëíìîïóòôõöúùûüç?\"!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ", 
    221196                        "aaaaaeeeeiiiiooooouuuuc__________________________________________AAAAAEEEEIIIIOOOOOUUUUC"); 
    222         } 
    223          
    224         function get_attachments_in_array($params) { 
    225                 $return_attachments = array(); 
    226  
    227                 $id_number = $params['num_msg'];                 
    228                 $attachments =unserialize(rawurldecode($params['s_attachments'])); 
    229                  
    230                 $tempDir = dirname( __FILE__ ) . '/../tmpLclAtt'; 
    231 //              $tempDir = $_SERVER["DOCUMENT_ROOT"]."tmpLclAtt"; 
    232                 $tempSubDir = md5(microtime()); 
    233                 exec('mkdir ' . $tempDir . '/'.$tempSubDir.'; cd ' . $tempDir . '/'.$tempSubDir); 
    234                  
    235                 $this-> folder = $params['folder']; 
    236                 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8"); 
    237                 $this->connectImap(); 
    238  
    239                 include_once("class.imap_attachment.inc.php"); 
    240  
    241                 $imap_attachment = new imap_attachment(); 
    242                 $attachments = $imap_attachment->download_attachment($this->mbox_stream, $id_number); 
    243                  
    244  
    245                  
    246                 foreach($attachments as $i => $attachment){ 
    247                         if($i && $i == 'names') 
    248                                 continue; 
    249                         $fileNameReal = $this->remove_accents($attachment['name']); 
    250                         $ContentType = $this->getFileType($fileNameReal); 
    251                         $fileName = $fileNameReal . ".php"; 
    252                         $f = fopen($tempDir . '/'.$tempSubDir.'/'.$fileName,"wb"); 
    253                         if(!$f) 
    254                                 return $tempDir . '/'.$tempSubDir.'/'.$fileName;                         
    255  
    256                         $fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachment['pid'], FT_UID); 
    257                         $urlPath = 'tmpLclAtt/'.$tempSubDir.'/'.$fileName; 
    258                          
    259                         $headers = "<?php header('Content-Type: ".$ContentType."'); 
    260                                 header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
    261                                 header('Pragma: public'); 
    262                                 header('Expires: 0'); // set expiration time 
    263                                 header('Content-Disposition: attachment; filename=\"". addslashes($fileNameReal) ."\"');\n echo "; 
    264                          
    265                         if($attachment['encoding'] == 'base64') { 
    266                                 $headers.=" imap_base64('".$fileContent."');?>"; 
    267                         } 
    268                         else if($attachment['encoding'] == 'quoted_printable_decode') { 
    269                                 $headers.=" quoted_printable_decode('".$fileContent."');?>"; 
    270                         } 
    271                         else { 
    272                                 $headers.=" '".$fileContent."';?>"; 
    273                         } 
    274                          
    275                         fputs($f,$headers); 
    276  
    277                         array_push($return_attachments,array('name' => $fileName,'url' => $urlPath,'pid' =>$attachment['pid'])); 
    278                         fclose($f); 
    279                 } 
    280                 imap_close($this->mbox_stream); 
    281                 return $return_attachments; 
    282         } 
    283          
    284         private function getFileType($nameFile) { 
    285                 $strFileType = strrev(substr(strrev(strtolower($nameFile)),0,4)); 
    286                 $ContentType = "application/octet-stream"; 
    287                 if ($strFileType == ".asf")  
    288                         $ContentType = "video/x-ms-asf"; 
    289                 if ($strFileType == ".avi") 
    290                         $ContentType = "video/avi"; 
    291                 if ($strFileType == ".doc") 
    292                         $ContentType = "application/msword"; 
    293                 if ($strFileType == ".zip") 
    294                         $ContentType = "application/zip"; 
    295                 if ($strFileType == ".xls") 
    296                         $ContentType = "application/vnd.ms-excel"; 
    297                 if ($strFileType == ".gif") 
    298                         $ContentType = "image/gif"; 
    299                 if ($strFileType == ".jpg" || $strFileType == "jpeg") 
    300                         $ContentType = "image/jpeg"; 
    301                 if ($strFileType == ".wav") 
    302                         $ContentType = "audio/wav"; 
    303                 if ($strFileType == ".mp3") 
    304                         $ContentType = "audio/mpeg3"; 
    305                 if ($strFileType == ".mpg" || $strFileType == "mpeg") 
    306                         $ContentType = "video/mpeg"; 
    307                 if ($strFileType == ".rtf") 
    308                         $ContentType = "application/rtf"; 
    309                 if ($strFileType == ".htm" || $strFileType == "html") 
    310                         $ContentType = "text/html"; 
    311                 if ($strFileType == ".xml")  
    312                         $ContentType = "text/xml"; 
    313                 if ($strFileType == ".xsl")  
    314                         $ContentType = "text/xsl"; 
    315                 if ($strFileType == ".css")  
    316                         $ContentType = "text/css"; 
    317                 if ($strFileType == ".php")  
    318                         $ContentType = "text/php"; 
    319                 if ($strFileType == ".asp")  
    320                         $ContentType = "text/asp"; 
    321                 if ($strFileType == ".pdf") 
    322                         $ContentType = "application/pdf"; 
    323                 if ($strFileType == ".txt") 
    324                         $ContentType = "text/plain"; 
    325                 if ($strFileType == ".log") 
    326                         $ContentType = "text/plain"; 
    327                 if ($strFileType == ".wmv") 
    328                         $ContentType = "video/x-ms-wmv"; 
    329                 if ($strFileType == ".sxc") 
    330                         $ContentType = "application/vnd.sun.xml.calc"; 
    331                 if ($strFileType == ".odt") 
    332                         $ContentType = "application/vnd.oasis.opendocument.text"; 
    333                 if ($strFileType == ".stc") 
    334                         $ContentType = "application/vnd.sun.xml.calc.template"; 
    335                 if ($strFileType == ".sxd") 
    336                         $ContentType = "application/vnd.sun.xml.draw"; 
    337                 if ($strFileType == ".std") 
    338                         $ContentType = "application/vnd.sun.xml.draw.template"; 
    339                 if ($strFileType == ".sxi") 
    340                         $ContentType = "application/vnd.sun.xml.impress"; 
    341                 if ($strFileType == ".sti") 
    342                         $ContentType = "application/vnd.sun.xml.impress.template"; 
    343                 if ($strFileType == ".sxm") 
    344                         $ContentType = "application/vnd.sun.xml.math"; 
    345                 if ($strFileType == ".sxw") 
    346                         $ContentType = "application/vnd.sun.xml.writer"; 
    347                 if ($strFileType == ".sxq") 
    348                         $ContentType = "application/vnd.sun.xml.writer.global"; 
    349                 if ($strFileType == ".stw") 
    350                         $ContentType = "application/vnd.sun.xml.writer.template"; 
    351                 if ($strFileType == ".ps") 
    352                         $ContentType = "application/postscript"; 
    353                 if ($strFileType == ".pps") 
    354                         $ContentType = "application/vnd.ms-powerpoint"; 
    355                 if ($strFileType == ".odt") 
    356                         $ContentType = "application/vnd.oasis.opendocument.text"; 
    357                 if ($strFileType == ".ott") 
    358                         $ContentType = "application/vnd.oasis.opendocument.text-template"; 
    359                 if ($strFileType == ".oth") 
    360                         $ContentType = "application/vnd.oasis.opendocument.text-web"; 
    361                 if ($strFileType == ".odm") 
    362                         $ContentType = "application/vnd.oasis.opendocument.text-master"; 
    363                 if ($strFileType == ".odg") 
    364                         $ContentType = "application/vnd.oasis.opendocument.graphics"; 
    365                 if ($strFileType == ".otg") 
    366                         $ContentType = "application/vnd.oasis.opendocument.graphics-template"; 
    367                 if ($strFileType == ".odp") 
    368                         $ContentType = "application/vnd.oasis.opendocument.presentation"; 
    369                 if ($strFileType == ".otp") 
    370                         $ContentType = "application/vnd.oasis.opendocument.presentation-template"; 
    371                 if ($strFileType == ".ods") 
    372                         $ContentType = "application/vnd.oasis.opendocument.spreadsheet"; 
    373                 if ($strFileType == ".ots") 
    374                         $ContentType = "application/vnd.oasis.opendocument.spreadsheet-template"; 
    375                 if ($strFileType == ".odc") 
    376                         $ContentType = "application/vnd.oasis.opendocument.chart"; 
    377                 if ($strFileType == ".odf") 
    378                         $ContentType = "application/vnd.oasis.opendocument.formula"; 
    379                 if ($strFileType == ".odi") 
    380                         $ContentType = "application/vnd.oasis.opendocument.image"; 
    381                 if ($strFileType == ".ndl") 
    382                         $ContentType = "application/vnd.lotus-notes"; 
    383                 return $ContentType; 
    384197        } 
    385198         
  • branches/1.2/expressoMail1_2/inc/class.imap_functions.inc.php

    r708 r1342  
    1010                'get_range_msgs'                                => True, 
    1111                'get_info_msg'                                  => True, 
    12                 'get_info_msgs'                                 => True, 
    1312                'get_folders_list'                              => True, 
    1413                'import_msgs'                                   => True 
     
    7170        function get_range_msgs2($params) 
    7271        { 
     72                include("class.imap_attachment.inc.php"); 
     73                $imap_attachment = new imap_attachment(); 
    7374                $folder = $params['folder']; 
    7475                $msg_range_begin = $params['msg_range_begin']; 
     
    8485                if($num_msgs) {  
    8586                        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]; 
    88                                 $temp = $this->get_info_head_msg($msg_number); 
    89                                 if(!$temp) 
    90                                         return false; 
    91          
    92                                 $return[$i] = $temp; 
    93                                 $i++; 
    94                         } 
    95                 } 
    96                 $return['num_msgs'] = $num_msgs;                 
    97                  
    98                 return $return; 
    99         } 
    100          
    101         function get_info_head_msg($msg_number) { 
    102                 $head_array = array(); 
    103                 include_once("class.imap_attachment.inc.php"); 
    104                 $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                 */ 
    116                 $flag = preg_match('/importance *: *(.*)\r/i', 
     87                { 
     88                        $msg_number = $sort_array_msg[$msg_range_begin-1]; 
     89 
     90                        /*A função imap_headerinfo não traz o cabeçalho completo, e sim alguns 
     91                        * atributos do cabeçalho. Como eu preciso do atributo Importance  
     92                        * para saber se o email é importante ou não, uso abaixo a função 
     93                        * imap_fetchheader e busco o atributo importance nela para passar 
     94                        * para as funções ajax. Isso faz com que eu acesse o cabeçalho 
     95                        * duas vezes e de duas formas diferentes, mas em contrapartida, eu 
     96                        * não preciso reimplementar o método utilizando o fetchheader. 
     97                        * Como as mensagens são renderizadas em um número pequeno por vez, 
     98                        * não parece ter perda considerável de performance. 
     99                        */ 
     100                        $flag = preg_match('/importance *: *(.*)\r/i', 
    117101                                        imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
    118102                                        ,$importance);           
    119                 $head_array['Importance'] = $flag==0?"Normal":$importance[1]; 
    120  
    121                  
    122                 $header = $this->get_header($msg_number); 
     103                        $return[$i]['Importance'] = $flag==0?"":$importance[1]; 
     104                         
     105                         
     106                        $header = $this->get_header($msg_number); 
    123107                        if (!is_object($header)) 
    124                                 return false; 
    125                 $head_array['Recent'] = $header->Recent; 
    126                 $head_array['Unseen'] = $header->Unseen; 
    127                 if($header->Answered =='A' && $header->Draft == 'X'){ 
    128                         $head_array['Forwarded'] = 'F'; 
    129                 } 
    130                 else { 
    131                         $head_array['Answered'] = $header->Answered; 
    132                         $head_array['Draft']    = $header->Draft;        
    133                 } 
    134                 $head_array['Deleted'] = $header->Deleted; 
    135                 $head_array['Flagged'] = $header->Flagged; 
    136                  
    137                 $head_array['msg_number'] = $msg_number; 
    138                 //$return[$i]['msg_folder'] = $folder; 
    139                  
    140                 $date_msg = gmdate("d/m/Y",$header->udate); 
    141                 if (date("d/m/Y") == $date_msg) 
    142                         $head_array['udate'] = gmdate("H:i",$header->udate); 
    143                 else 
    144                         $head_array['udate'] = $date_msg; 
    145                  
    146                 $head_array['aux_date'] = $date_msg; //Auxiliar apenas para mensagens locais. 
    147                  
    148                 $from = $header->from; 
    149                 $head_array['from'] = array(); 
    150                 $tmp = imap_mime_header_decode($from[0]->personal); 
    151                 $head_array['from']['name'] = $this->decode_string($tmp[0]->text); 
    152                 $head_array['from']['email'] = $this->decode_string($from[0]->mailbox) . "@" . $from[0]->host; 
    153                 if(!$head_array['from']['name']) 
    154                         $head_array['from']['name'] = $head_array['from']['email']; 
    155                 $to = $header->to; 
    156                 $head_array['to'] = array(); 
    157                 $tmp = imap_mime_header_decode($to[0]->personal); 
    158                 $head_array['to']['name'] = $this->decode_string($this->decode_string($tmp[0]->text)); 
    159                 $head_array['to']['email'] = $this->decode_string($to[0]->mailbox) . "@" . $to[0]->host; 
    160                 if(!$head_array['to']['name']) 
    161                         $head_array['to']['name'] = $head_array['to']['email']; 
    162                 $head_array['subject'] = $this->decode_string($header->fetchsubject); 
    163                  
    164                 $head_array['Size'] = $header->Size; 
    165                  
    166                 $head_array['attachment'] = array(); 
    167                 $head_array['attachment'] = $imap_attachment->get_attachment_headerinfo($this->mbox, $msg_number); 
    168                  
    169                 return $head_array; 
     108                                return false;                    
     109                         
     110                        $return[$i]['Recent'] = $header->Recent; 
     111                        $return[$i]['Unseen'] = $header->Unseen; 
     112                        if($header->Answered =='A' && $header->Draft == 'X'){ 
     113                                $return[$i]['Forwarded'] = 'F'; 
     114                        } 
     115                        else { 
     116                                $return[$i]['Answered'] = $header->Answered; 
     117                                $return[$i]['Draft']    = $header->Draft;        
     118                        } 
     119                        $return[$i]['Deleted'] = $header->Deleted; 
     120                        $return[$i]['Flagged'] = $header->Flagged; 
     121                         
     122                        $return[$i]['msg_number'] = $msg_number; 
     123                        //$return[$i]['msg_folder'] = $folder; 
     124                         
     125                        $date_msg = gmdate("d/m/Y",$header->udate); 
     126                        if (gmdate("d/m/Y") == $date_msg) 
     127                                $return[$i]['udate'] = gmdate("H:i",$header->udate); 
     128                        else 
     129                                $return[$i]['udate'] = $date_msg; 
     130                         
     131                        $from = $header->from; 
     132                        $return[$i]['from'] = array(); 
     133                        $tmp = imap_mime_header_decode($from[0]->personal); 
     134                        $return[$i]['from']['name'] = $this->decode_string($tmp[0]->text); 
     135                        $return[$i]['from']['email'] = $this->decode_string($from[0]->mailbox) . "@" . $from[0]->host; 
     136                        if(!$return[$i]['from']['name']) 
     137                                $return[$i]['from']['name'] = $return[$i]['from']['email']; 
     138                        $to = $header->to; 
     139                        $return[$i]['to'] = array(); 
     140                        $tmp = imap_mime_header_decode($to[0]->personal); 
     141                        $return[$i]['to']['name'] = $this->decode_string($this->decode_string($tmp[0]->text)); 
     142                        $return[$i]['to']['email'] = $this->decode_string($to[0]->mailbox) . "@" . $to[0]->host; 
     143                        if(!$return[$i]['to']['name']) 
     144                                $return[$i]['to']['name'] = $return[$i]['to']['email']; 
     145                        $return[$i]['subject'] = $this->decode_string($header->fetchsubject); 
     146 
     147                        $return[$i]['Size'] = $header->Size; 
     148                         
     149                        $return[$i]['attachment'] = array(); 
     150                        $return[$i]['attachment'] = $imap_attachment->get_attachment_headerinfo($this->mbox, $msg_number);                       
     151                        $i++; 
     152                } 
     153                } 
     154                $return['num_msgs'] = $num_msgs;                 
     155                 
     156                return $return; 
    170157        } 
    171158         
     
    310297        } 
    311298 
    312 /** 
    313          *  
    314          * @return  
    315          * @param $params Object 
    316          */ 
    317         function get_info_msgs($params) { 
    318                 include_once("class.exporteml.inc.php"); 
    319                 $return = array(); 
    320                 $new_params = array(); 
    321                 $attach_params = array(); 
    322                 $new_params["msg_folder"]=$params["folder"]; 
    323                 $attach_params["folder"] = $params["folder"]; 
    324                 $msgs = explode(",",$params["msgs_number"]); 
    325                 $exporteml = new ExportEml(); 
    326                 foreach($msgs as $msg_number) { 
    327                         $new_params["msg_number"] = $msg_number; 
    328                         //ini_set("display_errors","1"); 
    329                         $msg_info = $this->get_info_msg($new_params); 
    330  
    331                         $this->mbox = $this->open_mbox($params['folder']); //Não sei porque, mas se não abrir de novo a caixa dá erro. 
    332                         $msg_info['header'] = $this->get_info_head_msg($msg_number); 
    333  
    334                         $attach_params["num_msg"] = $msg_number; 
    335                         $msg_info['array_attach'] = $exporteml->get_attachments_in_array($attach_params); 
    336                         $msg_info['url_export_file'] = $exporteml->export_to_archive($msg_number,$params["folder"]); 
    337                         imap_close($this->mbox); 
    338                         $this->mbox=false; 
    339  
    340  
    341                         array_push($return,serialize($msg_info)); 
    342  
    343                 } 
    344  
    345                 return $return; 
    346         } 
    347  
    348299        function get_info_msg($params) 
    349300        { 
     
    366317                //Substituição de links em email para abrir no próprio expresso 
    367318                $body = ereg_replace("<a[^>]*href=[\'\"]mailto:([^\"\']+)[\'\"]>([^<]+)</a>","<a href=\"javascript:new_message_to('\\1')\">\\2</a>",$return_get_body['body']); 
    368                  
     319                         
    369320                $return['body']                 = $body; 
    370321                $return['attachments']  = $return_get_body['attachments']; 
     
    598549                $return['subject'] = $this->decode_string($header->fetchsubject); 
    599550                $return['Size'] = $header->Size; 
    600                 $return['reply_toaddress'] = $header->reply_toaddress;   
    601          
    602                 //All this is to help in local messages 
    603                 $return['timestamp'] = $header->udate; 
    604                 $return['login'] = $_SESSION['phpgw_info']['expressomail']['user']['account_id'];//$GLOBALS['phpgw_info']['user']['account_id']; 
    605                 $return['reply_toaddress'] = $header->reply_toaddress; 
    606                  
     551                $return['reply_toaddress'] = $header->reply_toaddress;           
    607552                return $return; 
    608553        } 
     
    10721017        function refresh($params) 
    10731018        { 
    1074                 include_once("class.imap_attachment.inc.php"); 
     1019                include("class.imap_attachment.inc.php"); 
    10751020                $imap_attachment = new imap_attachment();                
    10761021                $folder = $params['folder']; 
     
    11521097                                        imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
    11531098                                        ,$importance);           
    1154                         $return[$i]['Importance'] = $flag==0?"Normal":$importance[1]; 
     1099                        $return[$i]['Importance'] = $flag==0?"":$importance[1]; 
    11551100                         
    11561101                        $header = $this->get_header($msg_number); 
     
    13921337                                return "The server denied your request to send a mail, you cannot use this mail address."; 
    13931338                } 
    1394                  
    1395                 //new_message_to backs to mailto: pattern 
    1396                 $params['body'] = eregi_replace("<a href=\"javascript:new_message_to\('([^>]+)'\)\">[^>]+</a>","<a href='mailto:\\1'>\\1</a>",$params['body']); 
    1397                  
    13981339                $toaddress = implode(',',$db->getAddrs(explode(',',$params['input_to']))); 
    13991340                $ccaddress = implode(',',$db->getAddrs(explode(',',$params['input_cc']))); 
     
    14071348                $attachments = $params['FILES']; 
    14081349                $forwarding_attachments = $params['forwarding_attachments']; 
    1409                 $local_attachments = $params['local_attachments']; 
    14101350                  
    14111351                $folder =$params['folder']; 
     
    14911431//////////////////////////////////////////////////////////////////////////////////////////////////// 
    14921432                //      Build Uploading Attachments!!! 
    1493                 if ((count($attachments)) && ($params['is_local_forward']!="1")) //Caso seja forward normal... 
     1433                if (count($attachments)) 
    14941434                { 
    14951435                        $total_uploaded_size = 0; 
     
    15031443                                return $this->parse_error("message file too big");                       
    15041444                }                        
    1505                 else if(($params['is_local_forward']=="1") && (count($local_attachments))) { //Caso seja forward de mensagens locais 
    1506                          
    1507                         $total_uploaded_size = 0; 
    1508                         $upload_max_filesize = str_replace("M","",ini_get('upload_max_filesize')) * 1024 * 1024;                         
    1509                         foreach($local_attachments as $local_attachment) { 
    1510                                 $file_description = unserialize(rawurldecode($local_attachment)); 
    1511                                 $tmp = array_values($file_description); 
    1512                                 foreach($file_description as $i => $descriptor){                                 
    1513                                         $tmp[$i]  = eregi_replace('\'*\'','',$descriptor); 
    1514                                 } 
    1515                                 $mail->AddAttachment($_FILES[$tmp[1]]['tmp_name'], $tmp[2], "base64", $this->get_file_type($tmp[2]));  // optional name 
    1516                                 $total_uploaded_size = $total_uploaded_size + $_FILES[$tmp[1]]['size']; 
    1517                         } 
    1518                         if( $total_uploaded_size > $upload_max_filesize) 
    1519                                 return 'false';  
    1520                 } 
    15211445//////////////////////////////////////////////////////////////////////////////////////////////////// 
    15221446                //      Build Forwarding Attachments!!! 
     
    17191643        } 
    17201644         
    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  
    17781645        function move_search_messages($params){          
    17791646                $params['selected_messages'] = urldecode($params['selected_messages']);  
     
    25652432                $retorno = ""; 
    25662433                $mbox_stream = ""; 
    2567                 if(strpos($params['condition'],"#")===false) { //local messages 
    2568                         $search=false; 
    2569                 } 
    2570                 else { 
    2571                         $search = explode(",",$params['condition']);                     
    2572                 } 
    2573  
     2434                $search = explode(",",$params['condition']); 
    25742435                if($search){ 
    25752436                        $search_criteria = ''; 
     
    28322693                $array_parts_attachments = array();              
    28332694                $array_parts_attachments['names'] = ''; 
    2834                 include_once("class.imap_attachment.inc.php"); 
     2695                include("class.imap_attachment.inc.php"); 
    28352696                $imap_attachment = new imap_attachment();                
    28362697                 
Note: See TracChangeset for help on using the changeset viewer.