Changeset 660 for trunk/expressoMail1_2/inc/class.imap_functions.inc.php
- Timestamp:
- 02/05/09 16:48:28 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r659 r660 187 187 * com .emls gerados pelo expresso, e o arquivo pode ser um zip contendo vários emls ou um .eml. 188 188 */ 189 function import_msgs() { 190 191 if(!$this->mbox) 192 $this->mbox = $this->open_mbox($params["folder"]); 189 function import_msgs($params) { 190 if(!$this->mbox) 191 $this->mbox = $this->open_mbox(); 193 192 $errors = array(); 194 193 $invalid_format = false; 195 $filename = $_FILES['arquivo']['name']; 194 $filename = $params['FILES'][0]['name']; 195 $quota = imap_get_quotaroot($this->mbox, $params["folder"]); 196 if((($quota['limit'] - $quota['usage'])*1024) <= $params['FILES'][0]['size']){ 197 return array( 'error' => $this->functions->getLang("fail in import:"). 198 " ".$this->functions->getLang("Over quota")); 199 } 196 200 if(substr($filename,strlen($filename)-4)==".zip") { 197 $zip = zip_open($ _FILES['arquivo']['tmp_name']);201 $zip = zip_open($params['FILES'][0]['tmp_name']); 198 202 199 203 if ($zip) { … … 203 207 $email = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); 204 208 $status = @imap_append($this->mbox, 205 "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}". "INBOX",209 "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$params["folder"], 206 210 $email 207 211 ); … … 211 215 } 212 216 } 213 214 } 215 216 zip_close($zip); 217 zip_close($zip); 218 } 217 219 } 218 220 else if(substr($filename,strlen($filename)-4)==".eml") { 219 $email = implode("",file($ _FILES['arquivo']['tmp_name']));221 $email = implode("",file($params['FILES'][0]['tmp_name'])); 220 222 $status = @imap_append($this->mbox, 221 "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}". "INBOX",223 "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$params["folder"], 222 224 $email 223 225 ); 224 if(!$status) 226 if(!$status){ 225 227 array_push($errors,zip_entry_name($zip_entry)); 226 zip_entry_close($zip_entry); 228 zip_entry_close($zip_entry); 229 } 227 230 } 228 231 else 229 232 { 230 echo "<script>alert(\"".lang("wrong file format")."\")</script>";233 return array("error" => $this->functions->getLang("wrong file format")); 231 234 $invalid_format = true; 232 235 } … … 234 237 if(!$invalid_format) { 235 238 if(count($errors)>0) { 236 $message = lang("fail in import:")."\n";239 $message = $this->functions->getLang("fail in import:")."\n"; 237 240 foreach($errors as $arquivo) { 238 241 $message.=$arquivo."\n"; 239 242 } 240 echo "<script>alert(\"$message\")</script>";243 return array("error" => $message); 241 244 } 242 245 else 243 echo "<script>alert(\"".lang("messages imported successfully")."\")</script>"; 244 } 245 echo "<script>location.href='/expressoMail1_2/index.php'</script>"; 246 } 247 246 return $this->functions->getLang("The import was executed successfully."); 247 } 248 } 248 249 /* 249 250 Remove os anexos de uma mensagem. A estratégia para isso é criar uma mensagem nova sem os anexos, mantendo apenas
Note: See TracChangeset
for help on using the changeset viewer.