Changeset 42000a5 in github
- Timestamp:
- Aug 4, 2006 9:56:08 AM (7 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 9a52614
- Parents:
- fa4cd20
- Location:
- program
- Files:
-
- 2 edited
-
include/rcube_imap.inc (modified) (1 diff)
-
steps/mail/search.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/include/rcube_imap.inc
rfa4cd20 r42000a5 828 828 * @access public 829 829 */ 830 function search($mbox_name='', $criteria='ALL', $str=NULL )830 function search($mbox_name='', $criteria='ALL', $str=NULL, $charset=NULL) 831 831 { 832 832 $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; 833 833 if ($str && $criteria) 834 834 { 835 $criteria = 'CHARSET UTF-8 '.$criteria.' "'.UTF7EncodeString($str).'"'; 836 return $this->_search_index($mailbox, $criteria); 835 $search = (!empty($charset) ? "CHARSET $charset " : '') . sprintf("%s {%d}\r\n%s", $criteria, strlen($str), $str); 836 $results = $this->_search_index($mailbox, $search); 837 838 // try search without charset (probably not supported by server) 839 if (empty($results)) 840 $results = $this->_search_index($mailbox, "$criteria $str"); 841 842 return $results; 837 843 } 838 844 else -
program/steps/mail/search.inc
rac6b87c r42000a5 9 9 +-----------------------------------------------------------------------+ 10 10 | Author: Benjamin Smith <defitro@gmail.com> | 11 | Thomas Bruederli <roundcube@gmail.com> | 11 12 +-----------------------------------------------------------------------+ 12 13 … … 19 20 $_SESSION['page'] = 1; 20 21 22 // search query comes in with ISO encoding because javascript escape() 23 // uses ISO-8859-1. Better handling for that will follow. 24 $imap_charset = 'ISO-8859-1'; 25 21 26 // get search string 22 27 $str = get_input_value('_search', RCUBE_INPUT_GET); … … 28 33 if (preg_match("/^from:/i", $str)) { 29 34 list(,$srch) = explode(":", $str); 30 $search = $IMAP->search($mbox, " FROM" ,trim($srch));35 $search = $IMAP->search($mbox, "HEADER FROM" ,trim($srch), $imap_charset); 31 36 finish_search($mbox, $search); 32 37 } 33 38 else if (preg_match("/^to:/i", $str)) { 34 39 list(,$srch) = explode(":", $str); 35 $search = $IMAP->search($mbox, " TO", trim($srch));40 $search = $IMAP->search($mbox, "HEADER TO", trim($srch), $imap_charset); 36 41 finish_search($mbox, $search); 37 42 } 38 43 else if (preg_match("/^cc:/i", $str)) { 39 44 list(,$srch) = explode(":", $str); 40 $search = $IMAP->search($mbox, " CC", trim($srch));45 $search = $IMAP->search($mbox, "HEADER CC", trim($srch), $imap_charset); 41 46 finish_search($mbox, $search); 42 47 } 43 48 else if (preg_match("/^subject:/i", $str)) { 44 49 list(,$srch) = explode(":", $str); 45 $search = $IMAP->search($mbox, " SUBJECT", trim($srch));50 $search = $IMAP->search($mbox, "HEADER SUBJECT", trim($srch), $imap_charset); 46 51 finish_search($mbox, $search); 47 52 } 48 53 else if (preg_match("/^body:/i", $str)) { 49 54 list(,$srch) = explode(":", $str); 50 $search = $IMAP->search($mbox, "TEXT", trim($srch) );55 $search = $IMAP->search($mbox, "TEXT", trim($srch), $imap_charset); 51 56 finish_search($mbox, $search); 52 57 } 53 58 // search in subject and sender by default 54 59 else { 55 $search = $IMAP->search($mbox, " SUBJECT", trim($str));56 $search2 = $IMAP->search($mbox, " FROM", trim($str));60 $search = $IMAP->search($mbox, "HEADER SUBJECT", trim($str), $imap_charset); 61 $search2 = $IMAP->search($mbox, "HEADER FROM", trim($str), $imap_charset); 57 62 finish_search($mbox, array_unique(array_merge($search, $search2))); 58 63 }
Note: See TracChangeset
for help on using the changeset viewer.
