Changeset 3289 for branches/2.2
- Timestamp:
- 09/24/10 16:20:17 (14 years ago)
- Location:
- branches/2.2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/expressoMail1_2/inc/class.exporteml.inc.php
r3273 r3289 91 91 function createFileZip($files, $tempDir){ 92 92 $tmp_zip_filename = "email_".$_SESSION[ 'phpgw_session' ][ 'session_id' ].".zip"; 93 $command = "cd " . escapeshellarg($tempDir) . " && nice zip -m9 " . escapeshellarg($tmp_zip_filename) . " " . escapeshellcmd($files); 93 94 if (!empty($files)) 95 { 96 if (is_array($files)) 97 { 98 for ($i=0; $i < count($files); $i++) 99 { 100 $files[$i] = escapeshellarg($files[$i]); 101 } 102 $files = implode(' ', $files); 103 } 104 else 105 { 106 $files = escapeshellcmd($files); 107 } 108 } 109 110 $command = "cd " . escapeshellarg($tempDir) . " && nice zip -m9 " . escapeshellarg($tmp_zip_filename) . " " . $files; 94 111 if(!exec($command)) { 95 $command = "cd " . escapeshellarg($tempDir) . " && rm ". escapeshellcmd($files)." ". escapeshellarg($tmp_zip_filename);112 $command = "cd " . escapeshellarg($tempDir) . " && rm ".$files." ". escapeshellarg($tmp_zip_filename); 96 113 exec($command); 97 114 return null; … … 464 481 $imap_attachment = new imap_attachment(); 465 482 $attachments = $imap_attachment->download_attachment($this->mbox_stream, $id_number); 466 foreach($attachments as $i => $attachment){ 467 if($i && $i == 'names') 468 continue; 469 483 484 $fileNames = Array(); 470 485 471 $fileName = $this->remove_accents($attachment['name']); 486 for ($i = 0; $i < count($attachments); $i++) 487 { 488 $attachments[$i]['name'] = $this->remove_accents($attachments[$i]['name']); 489 $fileNames[$i] = $attachments[$i]['name']; 490 } 491 492 for ($i = 0; $i < count($attachments); $i++) 493 { 494 $fileName = $attachments[$i]['name']; 495 $result = array_keys($fileNames, $fileName); 496 497 // Detecta duplicatas 498 if (count($result) > 1) 499 { 500 for ($j = 1; $j < count($result); $j++) 501 { 502 $replacement = '('.$j.')$0'; 503 if (preg_match('/\.\w{2,4}$/', $fileName)) 504 { 505 $fileNames[$result[$j]] = preg_replace('/\.\w{2,4}$/', $replacement, $fileName); 506 } 507 else 508 { 509 $fileNames[$result[$j]] .= "($j)"; 510 } 511 $attachments[$result[$j]]['name'] = $fileNames[$result[$j]]; 512 } 513 } 514 // Fim detecta duplicatas 515 472 516 $f = fopen($tempDir . '/'.$tempSubDir.'/'.$fileName,"wb"); 473 517 if(!$f) 474 518 return False; 475 519 476 $fileNames .= "'".$fileName."' "; 477 $fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachment['pid'], FT_UID); 478 if($attachment['encoding'] == 'base64') 520 $fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachments[$i]['pid'], FT_UID); 521 if($attachments[$i]['encoding'] == 'base64') 479 522 fputs($f,imap_base64($fileContent)); 480 523 else … … 487 530 $nameFileZip = ''; 488 531 489 if( $fileNames) {532 if(!empty($fileNames)) { 490 533 $nameFileZip = $this -> createFileZip($fileNames, $tempDir . '/'.$tempSubDir); 491 534 if($nameFileZip) -
branches/2.2/expressoMail1_2/inc/class.imap_attachment.inc.php
r1059 r3289 53 53 $msg->fetch_structure($msgno); 54 54 $array_parts_attachments = array(); 55 $array_parts_attachments['names'] = '';55 //$array_parts_attachments['names'] = ''; 56 56 57 57 //print_r($msg->fname[$msgno]); … … 67 67 $array_parts_attachments[$i]['name'] = $array_parts_attachments[$i]['name'] ? $array_parts_attachments[$i]['name'] : "attachment.bin"; 68 68 $array_parts_attachments[$i]['encoding'] = $msg->encoding[$msgno][$index]; 69 $array_parts_attachments['names'] .= $array_parts_attachments[$i]['name'] . ', ';69 //$array_parts_attachments['names'] .= $array_parts_attachments[$i]['name'] . ', '; 70 70 $array_parts_attachments[$i]['fsize'] = $msg->fsize[$msgno][$index]; 71 71 $i++; 72 72 } 73 73 } 74 $array_parts_attachments['names'] = substr($array_parts_attachments['names'],0,(strlen($array_parts_attachments['names']) - 2));74 //$array_parts_attachments['names'] = substr($array_parts_attachments['names'],0,(strlen($array_parts_attachments['names']) - 2)); 75 75 return $array_parts_attachments; 76 76 } -
branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php
r3271 r3289 3560 3560 { 3561 3561 $array_parts_attachments = array(); 3562 $array_parts_attachments['names'] = '';3562 //$array_parts_attachments['names'] = ''; 3563 3563 include_once("class.imap_attachment.inc.php"); 3564 3564 $imap_attachment = new imap_attachment(); … … 3573 3573 $array_parts_attachments[$i]['name'] = $array_parts_attachments[$i]['name'] ? $array_parts_attachments[$i]['name'] : "attachment.bin"; 3574 3574 $array_parts_attachments[$i]['encoding'] = $msg->encoding[$msgno][$index]; 3575 $array_parts_attachments['names'] .= $array_parts_attachments[$i]['name'] . ', ';3575 //$array_parts_attachments['names'] .= $array_parts_attachments[$i]['name'] . ', '; 3576 3576 $array_parts_attachments[$i]['fsize'] = $msg->fsize[$msgno][$index]; 3577 3577 $i++; 3578 3578 } 3579 3579 } 3580 $array_parts_attachments['names'] = substr($array_parts_attachments['names'],0,(strlen($array_parts_attachments['names']) - 2));3580 //$array_parts_attachments['names'] = substr($array_parts_attachments['names'],0,(strlen($array_parts_attachments['names']) - 2)); 3581 3581 return $array_parts_attachments; 3582 3582 } -
branches/2.2/mobile/inc/class.ui_mobilemail.inc.php
r3248 r3289 203 203 $p->set_var('reply_all', "index.php?menuaction=mobile.ui_mobilemail.new_msg&msg_number=$msg_number&msg_folder=$msg_folder&reply_all=true"); 204 204 $p->set_var('forward', "index.php?menuaction=mobile.ui_mobilemail.new_msg&msg_number=$msg_number&msg_folder=$msg_folder&forward=true"); 205 if (!empty($msg['attachments']) && !empty($msg['attachments']['names']))205 if (!empty($msg['attachments'])) 206 206 { 207 207 $attachs = "<br>".lang("This message has the follow attachments:")."<br>";
Note: See TracChangeset
for help on using the changeset viewer.