Changeset 177


Ignore:
Timestamp:
02/26/08 17:03:46 (16 years ago)
Author:
niltonneto
Message:

Correção de bug ao exportar mensagens.

File:
1 edited

Legend:

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

    r113 r177  
    4444         
    4545        // create EML File. 
    46         function createFileEml($sEMLData, $tempDir, $id)  
    47         { 
    48                 if($id){ 
    49                         $header = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $id), 80, 255); 
    50                         $subject = $this->decode_subject($header->fetchsubject); 
    51                         $subject = ereg_replace('/', '\'', $subject);                    
    52                         $file = $subject."_".$id.".eml"; 
    53                 }        
    54                 else{ 
    55                         $file = "email_".md5(microtime()).".eml"; 
    56                 } 
    57                 $f = fopen($tempDir.'/'.$file,"w"); 
    58                  
    59                 if(!$f) 
    60                         return False; 
    61                  
    62                 fputs($f,$sEMLData); 
    63                 fclose($f); 
    64  
    65                 return $file;    
    66         } 
    67          
     46    function createFileEml($sEMLData, $tempDir, $id)   
     47    { 
     48        if($id) 
     49        { 
     50            $header    = imap_headerinfo($this->mbox_stream, imap_msgno($this->mbox_stream, $id), 80, 255); 
     51            $subject = $this->decode_subject($header->fetchsubject); 
     52             
     53            if (strlen($subject) > 60) 
     54                $subject = substr($subject, 0, 59); 
     55  
     56            $subject = ereg_replace('/', '\'', $subject);             
     57            $file =    $subject."_".$id.".eml"; 
     58        }     
     59        else{ 
     60            $file =    "email_".md5(microtime()).".eml"; 
     61        } 
     62         
     63        $f = fopen($tempDir.'/'.$file,"w"); 
     64        if(!$f) 
     65            return False; 
     66         
     67        fputs($f,$sEMLData); 
     68        fclose($f); 
     69         
     70        return $file; 
     71    }  
     72 
    6873        function createFileZip($files, $tempDir){                
    6974                $tmp_zip_filename =     "email_".md5(microtime()).".zip"; 
     
    182187 
    183188        function remove_accents($string) { 
    184                         return strtr($string,  
    185                         "?Ó??ó?Ý?úÁÀÃÂÄÇÉÈÊËÍÌ?ÎÏÑÕÔÓÒÖÚÙ?ÛÜ?áàãâäçéèêëíì?îïñóòõôöúù?ûüýÿ:'\"", 
    186                         "SOZsozYYuAAAAACEEEEIIIIINOOOOOUUUUUsaaaaaceeeeiiiiinooooouuuuuyy____"); 
     189                /* 
     190                        $array1 = array("á", "à", "â", "ã", "ä", "é", "è", "ê", "ë", "í", "ì", "î", "ï", "ó", "ò", "ô", "õ", "ö", "ú", "ù", "û", "ü", "ç" , "?", "\"", "!", "@", "#", "$", "%", "š", "&", "*", "(", ")", "-", "=", "+", "Ž", "`", "[", "]", "{", "}", "~", "^", ",", "<", ">", ";", ":", "/", "?", "\\", "|", "¹", "²", "³", "£", "¢", "¬", "§", "ª", "º", "°", "Á", "À", "Â", "Ã", "Ä", "É", "È", "Ê", "Ë", "Í", "Ì", "Î", "Ï", "Ó", "Ò", "Ô", "Õ", "Ö", "Ú", "Ù", "Û", "Ü", "Ç"); 
     191                        $array2 = array("a", "a", "a", "a", "a", "e", "e", "e", "e", "i", "i", "i", "i", "o", "o", "o", "o", "o", "u", "u", "u", "u", "c" , "" , ""  , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,  "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "A", "A", "A", "A", "A", "E", "E", "E", "E", "I", "I", "I", "I", "O", "O", "O", "O", "O", "U", "U", "U", "U", "C"); 
     192                        return str_replace( $array1, $array2, $string ); 
     193                */ 
     194                return strtr($string, 
     195                        "áàâãäéèêëíìîïóòôõöúùûüç?\"!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ", 
     196                        "aaaaaeeeeiiiiooooouuuuc__________________________________________AAAAAEEEEIIIIOOOOOUUUUC"); 
    187197        } 
    188198         
Note: See TracChangeset for help on using the changeset viewer.