- Timestamp:
- 05/16/11 11:44:10 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.2.0.2/expressoMail1_2/inc/class.exporteml.inc.php
r4348 r4416 304 304 $body = $this-> getBody($id_number); 305 305 306 $file = "source_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]." .eml";306 $file = "source_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]."_".time().".php"; //source_[sessao]_[timestamp].php 307 307 $f = fopen($tempDir.'/'.$file,"w"); 308 308 fputs($f,$header ."\r\n\r\n". $body); … … 351 351 $return_attachments = array(); 352 352 353 $id_number = $params['num_msg']; 353 $id_number = $params['num_msg']; 354 354 $attachments =unserialize(rawurldecode($params['s_attachments'])); 355 356 $tempDir = $_SESSION['phpgw_info']['server']['temp_dir']; 355 356 $tempDir = dirname( __FILE__ ) . '/../tmpLclAtt'; 357 $tempSubDir = md5(microtime()); 358 exec('mkdir ' . $tempDir . '/'.$tempSubDir.'; cd ' . $tempDir . '/'.$tempSubDir); 359 357 360 $this-> folder = $params['folder']; 358 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP"," ISO_8859-1");361 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8"); 359 362 $this->connectImap(); 360 363 … … 366 369 if($i && $i == 'names') 367 370 continue; 368 369 $fileName = $_SESSION[ 'phpgw_session' ][ 'session_id' ].md5($attachment['name'].microtime()); 371 $fileNameReal = $this->remove_accents($attachment['name']); 370 372 $ContentType = $this->getFileType($fileNameReal); 371 $f = fopen($tempDir . '/'.$fileName,"wb"); 373 $fileName = $fileNameReal . ".php"; 374 $f = fopen($tempDir . '/'.$tempSubDir.'/'.$fileName,"wb"); 372 375 if(!$f) 373 return false;376 return $tempDir . '/'.$tempSubDir.'/'.$fileName; 374 377 375 378 $fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachment['pid'], FT_UID); 376 379 $urlPath = 'tmpLclAtt/'.$tempSubDir.'/'.$fileName; 380 381 $headers = "<?php header('Content-Type: ".$ContentType."'); 382 header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 383 header('Pragma: public'); 384 header('Expires: 0'); // set expiration time 385 header('Content-Disposition: attachment; filename=\"". addslashes($fileNameReal) ."\"');\n echo "; 386 377 387 if($attachment['encoding'] == 'base64') { 378 $headers =imap_base64($fileContent);388 $headers.=" imap_base64('".$fileContent."');?>"; 379 389 } 380 390 else if($attachment['encoding'] == 'quoted_printable_decode') { 381 $headers =quoted_printable_decode($fileContent);391 $headers.=" quoted_printable_decode('".$fileContent."');?>"; 382 392 } 383 393 else { 384 $headers =$fileContent;385 } 386 394 $headers.=" '".$fileContent."';?>"; 395 } 396 387 397 fputs($f,$headers); 388 398 389 $url = "inc/gotodownload.php?idx_file=".$tempDir .'/'.$fileName."&newfilename=".$attachment['name']; 390 array_push($return_attachments,array('name' => $fileName,'url' => $url,'pid' =>$attachment['pid'])); 399 array_push($return_attachments,array('name' => $fileName,'url' => $urlPath,'pid' =>$attachment['pid'])); 391 400 fclose($f); 392 401 }
Note: See TracChangeset
for help on using the changeset viewer.