Changeset 6bfac4c in github for program/include/rcube_imap.php
- Timestamp:
- Jun 27, 2009 10:28:04 AM (4 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- b44cd3a8
- Parents:
- 6b2ce28
- File:
-
- 1 edited
-
program/include/rcube_imap.php (modified) (47 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/include/rcube_imap.php
r41caad8 r6bfac4c 255 255 function set_mailbox($new_mbox) 256 256 { 257 $mailbox = $this-> _mod_mailbox($new_mbox);257 $mailbox = $this->mod_mailbox($new_mbox); 258 258 259 259 if ($this->mailbox == $mailbox) … … 331 331 function get_mailbox_name() 332 332 { 333 return $this->conn ? $this-> _mod_mailbox($this->mailbox, 'out') : '';333 return $this->conn ? $this->mod_mailbox($this->mailbox, 'out') : ''; 334 334 } 335 335 … … 399 399 foreach ($a_mboxes as $mbox_row) 400 400 { 401 $name = $this-> _mod_mailbox($mbox_row, 'out');401 $name = $this->mod_mailbox($mbox_row, 'out'); 402 402 if (strlen($name)) 403 403 $a_out[] = $name; … … 422 422 * @access private 423 423 */ 424 function _list_mailboxes($root='', $filter='*')424 private function _list_mailboxes($root='', $filter='*') 425 425 { 426 426 $a_defaults = $a_out = array(); … … 438 438 else{ 439 439 // retrieve list of folders from IMAP server 440 $a_folders = iil_C_ListSubscribed($this->conn, $this-> _mod_mailbox($root), $filter);440 $a_folders = iil_C_ListSubscribed($this->conn, $this->mod_mailbox($root), $filter); 441 441 } 442 442 … … 463 463 function messagecount($mbox_name='', $mode='ALL', $force=FALSE) 464 464 { 465 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;465 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 466 466 return $this->_messagecount($mailbox, $mode, $force); 467 467 } … … 474 474 * @see rcube_imap::messagecount() 475 475 */ 476 function _messagecount($mailbox='', $mode='ALL', $force=FALSE)476 private function _messagecount($mailbox='', $mode='ALL', $force=FALSE) 477 477 { 478 478 $a_mailbox_cache = FALSE; … … 543 543 function list_headers($mbox_name='', $page=NULL, $sort_field=NULL, $sort_order=NULL) 544 544 { 545 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;545 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 546 546 return $this->_list_headers($mailbox, $page, $sort_field, $sort_order); 547 547 } … … 554 554 * @see rcube_imap::list_headers 555 555 */ 556 function _list_headers($mailbox='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $recursive=FALSE)556 private function _list_headers($mailbox='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $recursive=FALSE) 557 557 { 558 558 if (!strlen($mailbox)) … … 646 646 * @see rcube_imap::list_header_set() 647 647 */ 648 function _list_header_set($mailbox, $page=NULL, $sort_field=NULL, $sort_order=NULL)648 private function _list_header_set($mailbox, $page=NULL, $sort_field=NULL, $sort_order=NULL) 649 649 { 650 650 if (!strlen($mailbox) || empty($this->search_set)) … … 732 732 * @access private 733 733 */ 734 function _get_message_range($max, $page)734 private function _get_message_range($max, $page) 735 735 { 736 736 $start_msg = ($page-1) * $this->page_size; … … 771 771 * @access private 772 772 */ 773 function _fetch_headers($mailbox, $msgs, &$a_msg_headers, $cache_key)773 private function _fetch_headers($mailbox, $msgs, &$a_msg_headers, $cache_key) 774 774 { 775 775 // fetch reqested headers from server … … 818 818 $this->_set_sort_order($sort_field, $sort_order); 819 819 820 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;820 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 821 821 $key = "{$mailbox}:{$this->sort_field}:{$this->sort_order}:{$this->search_string}.msgi"; 822 822 … … 959 959 return false; 960 960 961 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;961 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 962 962 963 963 $results = $this->_search_index($mailbox, $str, $charset, $sort_field); … … 1002 1002 * @see rcube_imap::search() 1003 1003 */ 1004 function _search_index($mailbox, $criteria='ALL', $charset=NULL, $sort_field=NULL)1004 private function _search_index($mailbox, $criteria='ALL', $charset=NULL, $sort_field=NULL) 1005 1005 { 1006 1006 $orig_criteria = $criteria; … … 1073 1073 function get_headers($id, $mbox_name=NULL, $is_uid=TRUE, $bodystr=FALSE) 1074 1074 { 1075 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;1075 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 1076 1076 $uid = $is_uid ? $id : $this->_id2uid($id); 1077 1077 … … 1288 1288 * @param string Part's raw headers 1289 1289 */ 1290 function _set_part_filename(&$part, $headers=null)1290 private function _set_part_filename(&$part, $headers=null) 1291 1291 { 1292 1292 if (!empty($part->d_parameters['filename'])) … … 1532 1532 function set_flag($uids, $flag, $mbox_name=NULL) 1533 1533 { 1534 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;1534 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 1535 1535 1536 1536 $flag = strtoupper($flag); … … 1582 1582 function save_message($mbox_name, &$message) 1583 1583 { 1584 $mailbox = $this-> _mod_mailbox($mbox_name);1584 $mailbox = $this->mod_mailbox($mbox_name); 1585 1585 1586 1586 // make sure mailbox exists … … 1608 1608 function move_message($uids, $to_mbox, $from_mbox='') 1609 1609 { 1610 $to_mbox = $this-> _mod_mailbox($to_mbox);1611 $from_mbox = $from_mbox ? $this-> _mod_mailbox($from_mbox) : $this->mailbox;1610 $to_mbox = $this->mod_mailbox($to_mbox); 1611 $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; 1612 1612 1613 1613 // make sure mailbox exists … … 1668 1668 function delete_message($uids, $mbox_name='') 1669 1669 { 1670 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;1670 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 1671 1671 1672 1672 // convert the list of uids to array … … 1714 1714 function clear_mailbox($mbox_name=NULL) 1715 1715 { 1716 $mailbox = !empty($mbox_name) ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;1716 $mailbox = !empty($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; 1717 1717 $msg_count = $this->_messagecount($mailbox, 'ALL'); 1718 1718 … … 1746 1746 function expunge($mbox_name='', $clear_cache=TRUE) 1747 1747 { 1748 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;1748 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 1749 1749 return $this->_expunge($mailbox, $clear_cache); 1750 1750 } … … 1761 1761 * @access private 1762 1762 */ 1763 function _expunge($mailbox, $clear_cache=TRUE, $uids=NULL)1763 private function _expunge($mailbox, $clear_cache=TRUE, $uids=NULL) 1764 1764 { 1765 1765 if ($uids && $this->get_capability('UIDPLUS')) … … 1799 1799 1800 1800 // retrieve list of folders from IMAP server 1801 $a_mboxes = iil_C_ListMailboxes($this->conn, $this-> _mod_mailbox($root), '*');1801 $a_mboxes = iil_C_ListMailboxes($this->conn, $this->mod_mailbox($root), '*'); 1802 1802 1803 1803 // modify names with root dir 1804 1804 foreach ($a_mboxes as $mbox_name) 1805 1805 { 1806 $name = $this-> _mod_mailbox($mbox_name, 'out');1806 $name = $this->mod_mailbox($mbox_name, 'out'); 1807 1807 if (strlen($name)) 1808 1808 $a_folders[] = $name; … … 1876 1876 $name = substr($name, 0, 100); 1877 1877 1878 $abs_name = $this-> _mod_mailbox($name);1878 $abs_name = $this->mod_mailbox($name); 1879 1879 $a_mailbox_cache = $this->get_cache('mailboxes'); 1880 1880 … … 1905 1905 1906 1906 // make absolute path 1907 $mailbox = $this-> _mod_mailbox($mbox_name);1908 $abs_name = $this-> _mod_mailbox($name);1907 $mailbox = $this->mod_mailbox($mbox_name); 1908 $abs_name = $this->mod_mailbox($name); 1909 1909 1910 1910 // check if mailbox is subscribed … … 1959 1959 $a_mboxes = explode(',', $mbox_name); 1960 1960 1961 $all_mboxes = iil_C_ListMailboxes($this->conn, $this-> _mod_mailbox($root), '*');1961 $all_mboxes = iil_C_ListMailboxes($this->conn, $this->mod_mailbox($root), '*'); 1962 1962 1963 1963 if (is_array($a_mboxes)) 1964 1964 foreach ($a_mboxes as $mbox_name) 1965 1965 { 1966 $mailbox = $this-> _mod_mailbox($mbox_name);1966 $mailbox = $this->mod_mailbox($mbox_name); 1967 1967 1968 1968 // unsubscribe mailbox before deleting … … 2005 2005 function create_default_folders() 2006 2006 { 2007 $a_folders = iil_C_ListMailboxes($this->conn, $this-> _mod_mailbox(''), '*');2008 $a_subscribed = iil_C_ListSubscribed($this->conn, $this-> _mod_mailbox(''), '*');2007 $a_folders = iil_C_ListMailboxes($this->conn, $this->mod_mailbox(''), '*'); 2008 $a_subscribed = iil_C_ListSubscribed($this->conn, $this->mod_mailbox(''), '*'); 2009 2009 2010 2010 // create default folders if they do not exist 2011 2011 foreach ($this->default_folders as $folder) 2012 2012 { 2013 $abs_name = $this-> _mod_mailbox($folder);2013 $abs_name = $this->mod_mailbox($folder); 2014 2014 if (!in_array_nocase($abs_name, $a_folders)) 2015 2015 $this->create_mailbox($folder, TRUE); … … 2103 2103 * @access private 2104 2104 */ 2105 function _read_cache_record($key)2105 private function _read_cache_record($key) 2106 2106 { 2107 2107 if ($this->db) … … 2129 2129 * @access private 2130 2130 */ 2131 function _write_cache_record($key, $data)2131 private function _write_cache_record($key, $data) 2132 2132 { 2133 2133 if (!$this->db) … … 2179 2179 * @access private 2180 2180 */ 2181 function _clear_cache_record($key)2181 private function _clear_cache_record($key) 2182 2182 { 2183 2183 $this->db->query( … … 2632 2632 * @access private 2633 2633 */ 2634 function _decode_mime_string_part($str)2634 private function _decode_mime_string_part($str) 2635 2635 { 2636 2636 $a = explode('?', $str); … … 2664 2664 * @param string Part encoding 2665 2665 * @return string Decoded string 2666 * @access private2667 2666 */ 2668 2667 function mime_decode($input, $encoding='7bit') … … 2718 2717 function get_id($uid, $mbox_name=NULL) 2719 2718 { 2720 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;2719 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 2721 2720 return $this->_uid2id($uid, $mailbox); 2722 2721 } … … 2732 2731 function get_uid($id,$mbox_name=NULL) 2733 2732 { 2734 $mailbox = $mbox_name ? $this-> _mod_mailbox($mbox_name) : $this->mailbox;2733 $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 2735 2734 return $this->_id2uid($id, $mailbox); 2736 2735 } 2737 2736 2738 2737 2739 2740 /* -------------------------------- 2741 * private methods 2742 * --------------------------------*/ 2743 2744 2745 /** 2746 * @access private 2747 */ 2748 function _mod_mailbox($mbox_name, $mode='in') 2738 /** 2739 * Modify folder name for input/output according to root dir and namespace 2740 * 2741 * @param string Folder name 2742 * @param string Mode 2743 * @return string Folder name 2744 */ 2745 function mod_mailbox($mbox_name, $mode='in') 2749 2746 { 2750 2747 if ((!empty($this->root_ns) && $this->root_ns == $mbox_name) || $mbox_name == 'INBOX') … … 2759 2756 } 2760 2757 2758 2759 /* -------------------------------- 2760 * private methods 2761 * --------------------------------*/ 2762 2761 2763 /** 2762 2764 * Validate the given input and save to local properties 2763 2765 * @access private 2764 2766 */ 2765 function _set_sort_order($sort_field, $sort_order)2767 private function _set_sort_order($sort_field, $sort_order) 2766 2768 { 2767 2769 if ($sort_field != null) … … 2775 2777 * @access private 2776 2778 */ 2777 function _sort_mailbox_list($a_folders)2779 private function _sort_mailbox_list($a_folders) 2778 2780 { 2779 2781 $a_out = $a_defaults = $folders = array(); … … 2816 2818 * @access private 2817 2819 */ 2818 function _rsort($folder, $delimiter, &$list, &$out)2820 private function _rsort($folder, $delimiter, &$list, &$out) 2819 2821 { 2820 2822 while (list($key, $name) = each($list)) { … … 2833 2835 * @access private 2834 2836 */ 2835 function _uid2id($uid, $mbox_name=NULL)2837 private function _uid2id($uid, $mbox_name=NULL) 2836 2838 { 2837 2839 if (!$mbox_name) … … 2847 2849 * @access private 2848 2850 */ 2849 function _id2uid($id, $mbox_name=NULL)2851 private function _id2uid($id, $mbox_name=NULL) 2850 2852 { 2851 2853 if (!$mbox_name) … … 2869 2871 * @access private 2870 2872 */ 2871 function _change_subscription($a_mboxes, $mode)2873 private function _change_subscription($a_mboxes, $mode) 2872 2874 { 2873 2875 $updated = FALSE; … … 2876 2878 foreach ($a_mboxes as $i => $mbox_name) 2877 2879 { 2878 $mailbox = $this-> _mod_mailbox($mbox_name);2880 $mailbox = $this->mod_mailbox($mbox_name); 2879 2881 $a_mboxes[$i] = $mailbox; 2880 2882 … … 2913 2915 * @access private 2914 2916 */ 2915 function _set_messagecount($mbox_name, $mode, $increment)2917 private function _set_messagecount($mbox_name, $mode, $increment) 2916 2918 { 2917 2919 $a_mailbox_cache = FALSE; … … 2942 2944 * @access private 2943 2945 */ 2944 function _clear_messagecount($mbox_name='')2946 private function _clear_messagecount($mbox_name='') 2945 2947 { 2946 2948 $a_mailbox_cache = FALSE; … … 2961 2963 * @access private 2962 2964 */ 2963 function _parse_headers($headers)2965 private function _parse_headers($headers) 2964 2966 { 2965 2967 $a_headers = array(); … … 2984 2986 * @access private 2985 2987 */ 2986 function _parse_address_list($str, $decode=true)2988 private function _parse_address_list($str, $decode=true) 2987 2989 { 2988 2990 // remove any newlines and carriage returns before
Note: See TracChangeset
for help on using the changeset viewer.
