- Timestamp:
- 09/21/12 10:11:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/newExpressoMail/prototype/services/ImapServiceAdapter.php
r7209 r7265 76 76 case 'folder': 77 77 { 78 79 $result = $this->getFolders(); 78 79 if($context != '') 80 $result = $this->getFolderInfo($context['folder']); 81 else 82 $result = $this->getFolders(); 80 83 81 84 foreach ($result as $res) { … … 86 89 'commonName' => mb_convert_encoding( $res['folder_name'], 'UTF-8' , 'UTF7-IMAP' ), 87 90 'parentFolder' => mb_convert_encoding( $res['folder_parent'], 'UTF-8' , 'UTF7-IMAP' ), 88 'messageCount' => array('unseen' => isset($res['folder_unseen']) ? $res['folder_unseen'] : null, 'total' => null)91 'messageCount' => array('unseen' => isset($res['folder_unseen']) ? $res['folder_unseen'] : null, 'total' => $res['folder_total']) 89 92 ); 90 93 … … 104 107 $limit = isset($criteria['rows']) ? $criteria['rows'] : 10 ; //{10} get how many rows we want to have into the grid 105 108 $sidx = isset($criteria['sidx']) ? $criteria['sidx'] : 0; //{id} get index row - i.e. user click to sort 106 $sord = isset($criteria['sord']) ? $criteria['sord'] : ''; //{desc} get the direction 109 $sord = $criteria['sord'] == "asc"? "0" : '1'; //{desc} get the direction 110 //$flag = $criteria['_search'] ? $criteria['_search'] : 'ALL'; 107 111 108 112 $filter = isset($criteria['filter']) ? $criteria['filter'] : ''; 109 113 110 if( !$sidx ) $sidx = 1;114 if( !$sidx ) $sidx = 'SORTARRIVAL'; 111 115 112 116 $folder_name = isset($URI['folder']) ? $URI['folder'] : str_replace( '.', $this->imap_delimiter, isset($context['folder']) ? $context['folder'] : 'INBOX'); … … 207 211 'msg_range_begin' => $start + 1, //?? 208 212 'msg_range_end' => $start + $limit, //$limit = $_GET['rows']; // get how many rows we want to have into the grid 209 'sort_box_type' => 'SORTARRIVAL',213 'sort_box_type' => $sidx, 210 214 'search_box_type' => 'ALL', 211 'sort_box_reverse' => 1215 'sort_box_reverse' => $sord 212 216 ) 213 217 ); … … 698 702 case 'folder': 699 703 { 700 701 } 704 $mbox_stream = $this->open_mbox(); 705 $path = ($data['path'] != "" ? $data['path'] : "INBOX") .$this->imap_delimiter; 706 $folders = explode($this->imap_delimiter,$data['name']); 707 $return = true; 708 for($i =0; $i < count($folders); $i++){ 709 $path .= $folders[$i] != "" ? $folders[$i] : 'Nova Pasta'; 710 $newFolder = mb_convert_encoding($path, "UTF7-IMAP","UTF-8"); 711 $serverString = "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$newFolder; 712 if(imap_createmailbox($mbox_stream,$serverString)) 713 { 714 $return = false; 715 } 716 $path .= $this->imap_delimiter; 717 } 718 return $return; 719 } 702 720 } 703 721 } … … 790 808 break; 791 809 } 792 793 810 return $s; 794 811 } 812 case 'folder':{ 813 $newFolder = mb_convert_encoding($URI['id'], "UTF7-IMAP","UTF-8"); 814 $serverString = "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$newFolder; 815 $mbox_stream = $this->open_mbox(); 816 if(imap_deletemailbox($mbox_stream,$serverString)) 817 { 818 return true; 819 }else{ 820 return false; 821 } 822 } 795 823 } 796 824 … … 822 850 * atributos gravados no banco de dados e nunca no IMAP. 823 851 */ 852 switch( $URI['concept'] ) 853 { 854 case 'folder': 855 { 856 $mbox_stream = $this->open_mbox(); 857 $oldFolderName = mb_convert_encoding($data['id'], "UTF7-IMAP","UTF-8"); 858 $newFolderName = mb_convert_encoding($data['new'], "UTF7-IMAP","UTF-8"); 859 $serverString = "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}"; 860 if(imap_renamemailbox($mbox_stream,$serverString.$oldFolderName, $serverString.$newFolderName)) 861 { 862 return true; 863 }else{ 864 return false; 865 } 866 } 867 } 824 868 } 825 869
Note: See TracChangeset
for help on using the changeset viewer.