Changeset 6171 for trunk/prototype/services/ImapServiceAdapter.php
- Timestamp:
- 05/14/12 12:29:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/services/ImapServiceAdapter.php
r6132 r6171 66 66 { 67 67 68 $context = $justthese['context']; 69 $URI = $URI['concept']; 70 71 switch( $URI ) 68 $context = isset($justthese['context']) ? $justthese['context'] : '' ; 69 70 switch( $URI['concept'] ) 72 71 { 73 72 case 'folder': … … 90 89 { 91 90 //begin: for grid 92 $page = $criteria['page']; //{1} get the requested page93 $limit = $criteria['rows']; //{10} get how many rows we want to have into the grid94 $sidx = $criteria['sidx']; //{id} get index row - i.e. user click to sort95 $sord = $criteria['sord']; //{desc} get the direction91 $page = isset($criteria['page']) ? $criteria['page'] : 1 ; //{1} get the requested page 92 $limit = isset($criteria['rows']) ? $criteria['rows'] : 10 ; //{10} get how many rows we want to have into the grid 93 $sidx = isset($criteria['sidx']) ? $criteria['sidx'] : 0; //{id} get index row - i.e. user click to sort 94 $sord = isset($criteria['sord']) ? $criteria['sord'] : ''; //{desc} get the direction 96 95 97 96 $filter = $criteria['filter']; … … 99 98 if( !$sidx ) $sidx = 1; 100 99 101 $folder_name = str_replace( '.', $this->imap_delimiter, $context['folder']);102 100 $folder_name = isset($URI['folder']) ? $URI['folder'] : str_replace( '.', $this->imap_delimiter, $context ); 101 103 102 $count = imap_num_msg( $this->open_mbox( $folder_name ) ); 104 103 … … 150 149 $headers = imap_fetch_overview($this->mbox, $messages, $sequenceType); 151 150 foreach ($headers as $h) { 152 $result[] = array ( 'messageId' => $h->message_id ); 151 if(isset($h->message_id )) 152 $result[] = array ( 'messageId' => $h->message_id ); 153 153 } 154 155 imap_close($this->mbox); 156 $this->mbox = false; 154 157 155 } 158 156 return $result; … … 298 296 } 299 297 } 300 301 imap_close($this->mbox); 302 $this->mbox = false; 298 303 299 } 304 300 } … … 363 359 * passados no filtro, se houverem. 364 360 */ 365 if (!empty($map['messageNumber'])) { 361 if (!empty($map['messageNumber']) && is_array($messages)) { 362 366 363 foreach ($messages as $k => $m) 367 364 if (!in_array($m, $map['messageNumber'])) … … 372 369 * Adicionar demais atributos às mensagens para retorno 373 370 */ 374 371 if(is_array($messages)) 375 372 foreach ($messages as $k => $m) { 376 373 $headers = imap_fetch_overview($this->mbox, $m, FT_UID); … … 383 380 } 384 381 385 imap_close($this->mbox);386 $this->mbox = false;387 382 388 383 /** … … 394 389 } 395 390 396 if ($this->mbox) {397 imap_close($this->mbox);398 $this->mbox = false;399 }400 391 401 392 return $result; … … 440 431 ); 441 432 } 442 imap_close($this->mbox); 443 $this->mbox = false; 433 444 434 } 445 435 … … 474 464 ); 475 465 } 476 477 imap_close($this->mbox);478 $this->mbox = false;479 466 480 467 } else { … … 511 498 break; 512 499 } 513 514 imap_close($this->mbox); 515 $this->mbox = false; 516 } 517 } 518 519 if ($this->mbox) { 520 imap_close($this->mbox); 521 $this->mbox = false; 522 } 500 501 } 502 } 503 523 504 524 505 return $result; … … 537 518 imap_setflag_full($this->mbox, $data['messageNumber'], '$Label' . $data['labelId'], ST_UID); 538 519 539 imap_close($this->mbox);540 $this->mbox = false;541 542 520 return array ('id' => $data['folderName'].'/'.$data['messageNumber'].'#'.$data['labelId']); 543 521 } … … 557 535 $data['messageId'] = $headers[0]->message_id; 558 536 559 imap_close($this->mbox);560 $this->mbox = false;561 537 562 538 return ($s) ? $data : array(); … … 583 559 584 560 $s = imap_setflag_full($this->mbox, $messages[0], '$Followupflagged', ST_UID); 585 586 imap_close($this->mbox); 587 $this->mbox = false; 588 561 589 562 /** 590 563 * Stop searching in all folders … … 593 566 } 594 567 595 imap_close($this->mbox);596 $this->mbox = false;597 568 } 598 569 } … … 702 673 } 703 674 704 if($mbox_stream) imap_close($mbox_stream);705 706 675 return $return; 707 676 } … … 723 692 imap_clearflag_full($this->mbox, $messageNumber, '$Label' . $labelId, ST_UID); 724 693 725 imap_close($this->mbox);726 $this->mbox = false;727 694 } 728 695 } … … 791 758 } 792 759 793 imap_close($this->mbox);794 $this->mbox = false;795 796 760 /** 797 761 * Se é uma busca por messageId e todos os messageIds foram econstrados:
Note: See TracChangeset
for help on using the changeset viewer.