Changeset 1000 for trunk/expressoMail1_2/inc/class.exporteml.inc.php
- Timestamp:
- 06/16/09 18:29:16 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.exporteml.inc.php
r711 r1000 44 44 45 45 // create EML File. 46 function createFileEml($sEMLData, $tempDir, $id) 46 // Funcao alterada para tratar a exportacao 47 // de mensagens arquivadas localmente. 48 // Rommel Cysne (rommel.cysne@serpro.gov.br) 49 // em 17/12/2008. 50 function createFileEml($sEMLData, $tempDir, $id, $subject=false, $i) 47 51 { 48 52 if($id) … … 54 58 $subject = substr($subject, 0, 59); 55 59 56 $subject = ereg_replace('/', '\'', $subject); 60 //$subject = ereg_replace('/', '\'', $subject); 61 $from = "áàâãäéèêëíìîïóòôõöúùûüç?\"!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ"; 62 $to = "aaaaaeeeeiiiiooooouuuuc__________________________________________AAAAAEEEEIIIIOOOOOUUUUC"; 63 $subject = strtr($subject,$from,$to); 57 64 $file = $subject."_".$id.".eml"; 65 } else{ 66 // Se mensagem for arquivada localmente, $subject (assunto da mensagem) 67 // sera passado para compor o nome do arquivo .eml; 68 69 if($subject){ 70 $from = "áàâãäéèêëíìîïóòôõöúùûüç?\"!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ"; 71 $to = "aaaaaeeeeiiiiooooouuuuc__________________________________________AAAAAEEEEIIIIOOOOOUUUUC"; 72 $subject = strtr($subject,$from,$to); 73 //$subject = ereg_replace(':', '_', $subject); 74 //$subject = ereg_replace('/', '_', $subject); 75 $file = $subject."_".$i.".eml"; 76 } else{ 77 $file = "email_".md5(microtime()).".eml"; 58 78 } 59 else{60 $file = "email_".md5(microtime()).".eml";61 79 } 62 80 … … 124 142 } 125 143 144 // Funcao alterada para tratar a exportacao 145 // de mensagens arquivadas localmente. 146 // Rommel Cysne (rommel.cysne@serpro.gov.br) 147 // em 17/12/2008. 126 148 function makeAll($params) { 127 128 $this-> folder = $params['folder']; 129 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8"); 130 $array_ids = explode(',', $params['msgs_to_export']); 131 $error = False; 132 $fileNames = ""; 133 $tempDir = ini_get("session.save_path"); 134 $this->connectImap(); 135 136 for($i = 0; $i < count($array_ids); $i++) { 137 149 // Exportacao de mensagens arquivadas localmente 150 if($params['l_msg'] == "t"){ 151 // Recebe todos os subjects e bodies das mensagens locais selecionadas para exportacao 152 // e gera arrays com os conteudos separados; 153 $array_mesgs = explode('@@',$params['mesgs']); 154 $array_subjects = explode('@@',$params['subjects']); 155 $array_ids = explode(',', $params['msgs_to_export']); 156 $tempDir = ini_get("session.save_path"); 157 // Para cada mensagem selecionada sera gerado um arquivo .eml cujo titulo sera o assunto (subject) da mesma; 158 include_once("class.imap_functions.inc.php"); 159 $imapf = new imap_functions(); 160 foreach($array_ids as $i=>$id) { 161 $sEMLData=$imapf->treat_base64_from_post($array_mesgs[$i]); 162 $fileName=$this->CreateFileEml($sEMLData, $tempDir,'',$array_subjects[$i],$i); 163 if(!$fileName){ 164 $error = True; 165 break; 166 } else{ 167 $fileNames .= "\"".$fileName."\" "; 168 } 169 } 170 $nameFileZip = 'False'; 171 if($fileNames && !$error) { 172 $nameFileZip = $this -> createFileZip($fileNames, $tempDir); 173 if($nameFileZip){ 174 $file = $tempDir.'/'.$nameFileZip; 175 } else{ 176 $file = false; 177 } 178 179 } else{ 180 $file = false; 181 } 182 183 return $file; 184 185 // Exportacao de mensagens da caixa de entrada (imap) - processo original do Expresso 186 } else{ 187 $this-> folder = $params['folder']; 188 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8"); 189 $array_ids = explode(',', $params['msgs_to_export']); 190 $error = False; 191 $fileNames = ""; 192 $tempDir = ini_get("session.save_path"); 193 $this->connectImap(); 194 for($i = 0; $i < count($array_ids); $i++) { 138 195 $header = $this-> getHeader($array_ids[$i]); 139 196 $body = $this-> getBody($array_ids[$i]); … … 165 222 166 223 return $file; 167 } 224 } 225 } 168 226 169 227 function export_msg($params) { … … 209 267 imap_close($this->mbox_stream); 210 268 return $urlPath; 211 269 } 212 270 213 271 function remove_accents($string) { … … 241 299 $imap_attachment = new imap_attachment(); 242 300 $attachments = $imap_attachment->download_attachment($this->mbox_stream, $id_number); 243 244 245 246 301 foreach($attachments as $i => $attachment){ 247 302 if($i && $i == 'names') … … 280 335 imap_close($this->mbox_stream); 281 336 return $return_attachments; 282 337 } 283 338 284 339 private function getFileType($nameFile) {
Note: See TracChangeset
for help on using the changeset viewer.