Changeset 64 for trunk/expressoMail1_2/inc/class.exporteml.inc.php
- Timestamp:
- 09/05/07 11:18:58 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.exporteml.inc.php
r51 r64 44 44 45 45 // create EML File. 46 function createFileEml($sEMLData, $tempDir )46 function createFileEml($sEMLData, $tempDir, $id) 47 47 { 48 $file = "email_".md5(microtime()).".eml"; 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 } 49 57 $f = fopen($tempDir.'/'.$file,"w"); 50 58 … … 58 66 } 59 67 60 function createFileZip($files, $tempDir){ 61 68 function createFileZip($files, $tempDir){ 62 69 $tmp_zip_filename = "email_".md5(microtime()).".zip"; 63 70 $command = "cd " . $tempDir . "; nice zip -m " . $tmp_zip_filename . " " . $files; … … 85 92 $body = $this-> getBody($nMsgs); 86 93 $sEMLData = $this -> parseEml($header, $body); 87 $fileName = $this -> CreateFileEml($sEMLData, $tempDir );94 $fileName = $this -> CreateFileEml($sEMLData, $tempDir,$nMsgs); 88 95 if(!$fileName) { 89 96 $error = True; … … 91 98 } 92 99 else 93 $fileNames .= $fileName.' ';100 $fileNames .= "\"".$fileName."\" "; 94 101 95 102 } … … 124 131 for($i = 0; $i < count($array_ids); $i++) { 125 132 126 $header = $this-> getHeader($array_ids[$i]); 133 $header = $this-> getHeader($array_ids[$i]); 127 134 $body = $this-> getBody($array_ids[$i]); 128 $sEMLData = $this -> parseEml($header, $body); 129 $fileName = $this -> CreateFileEml($sEMLData, $tempDir );135 $sEMLData = $this -> parseEml($header, $body); 136 $fileName = $this -> CreateFileEml($sEMLData, $tempDir, $array_ids[$i]); 130 137 131 138 if(!$fileName) { … … 134 141 } 135 142 else 136 $fileNames .= $fileName.' ';143 $fileNames .= "\"".$fileName."\" "; 137 144 138 145 } … … 241 248 } 242 249 250 function decode_subject($string){ 251 if ((strpos(strtolower($string), '=?iso-8859-1') !== false) 252 || (strpos(strtolower($string), '=?windows-1252') !== false)){ 253 $elements = imap_mime_header_decode($string); 254 foreach ($elements as $el) 255 $return .= $el->text; 256 } 257 else if (strpos(strtolower($string), '=?utf-8') !== false) { 258 $elements = imap_mime_header_decode($string); 259 foreach ($elements as $el){ 260 $charset = $el->charset; 261 $text = $el->text; 262 if(!strcasecmp($charset, "utf-8") || 263 !strcasecmp($charset, "utf-7")) { 264 $text = iconv($charset, "ISO-8859-1", $text); 265 } 266 $return .= $text; 267 } 268 } 269 else 270 $return = $string; 271 272 return $this->remove_accents($return); 273 } 243 274 } 244 275 // END CLASS
Note: See TracChangeset
for help on using the changeset viewer.