Changeset a961838 in github
- Timestamp:
- Mar 4, 2010 2:39:53 AM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- bbc8565
- Parents:
- 40353f1
- Files:
-
- 4 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_imap.php (modified) (21 diffs)
-
program/js/app.js (modified) (4 diffs)
-
program/steps/mail/compose.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
rb975da2 ra961838 2 2 =========================== 3 3 4 - Changed signature separator when top-posting (#1486330) 4 5 - Let the admin define defaults for search modifiers (#1485897) 5 6 - Fix long e-mail addresses validation (#1486453) -
program/include/rcube_imap.php
rd15d594 ra961838 600 600 if ($this->skip_deleted) { 601 601 // @TODO: this could be cached 602 if ($msg_index = $this->_search_index($mailbox, 'ALL UNDELETED')) {602 if ($msg_index = $this->_search_index($mailbox, 'ALL UNDELETED')) { 603 603 $max = max($msg_index); 604 604 list($begin, $end) = $this->_get_message_range(count($msg_index), $page); 605 605 $msg_index = array_slice($msg_index, $begin, $end-$begin); 606 } 607 } else if ($max = iil_C_CountMessages($this->conn, $mailbox)) { 606 } 607 } 608 else if ($max = iil_C_CountMessages($this->conn, $mailbox)) { 608 609 list($begin, $end) = $this->_get_message_range($max, $page); 609 $msg_index = range($begin+1, $end); 610 } else 611 $msg_index = array(); 610 $msg_index = range($begin+1, $end); 611 } 612 else 613 $msg_index = array(); 612 614 613 615 if ($slice) … … 615 617 616 618 // fetch reqested headers from server 617 if ($msg_index)619 if ($msg_index) 618 620 $this->_fetch_headers($mailbox, join(",", $msg_index), $a_msg_headers, $cache_key); 619 621 } … … 750 752 if (($cnt > 300 && $cnt > $this->page_size) || ($this->index_sort && $this->sort_field == 'date')) { 751 753 // use memory less expensive (and quick) method for big result set 752 $a_index = $this->message_index('', $this->sort_field, $this->sort_order);754 $a_index = $this->message_index('', $this->sort_field, $this->sort_order); 753 755 // get messages uids for one page... 754 756 $msgs = array_slice($a_index, $start_msg, min($cnt-$start_msg, $this->page_size)); 755 757 if ($slice) 756 758 $msgs = array_slice($msgs, -$slice, $slice); 757 // ...and fetch headers759 // ...and fetch headers 758 760 $this->_fetch_headers($mailbox, join(',', $msgs), $a_msg_headers, NULL); 759 761 … … 767 769 768 770 return array_values($a_msg_headers); 769 }771 } 770 772 else { 771 773 // for small result set we can fetch all messages headers … … 780 782 781 783 // only return the requested part of the set 782 $a_msg_headers = array_slice(array_values($a_msg_headers), $start_msg, min($cnt-$start_msg, $this->page_size));784 $a_msg_headers = array_slice(array_values($a_msg_headers), $start_msg, min($cnt-$start_msg, $this->page_size)); 783 785 if ($slice) 784 786 $a_msg_headers = array_slice($a_msg_headers, -$slice, $slice); … … 849 851 foreach ($a_header_index as $i => $headers) { 850 852 if ($this->caching_enabled && $cache_index[$headers->id] != $headers->uid) { 851 // prevent index duplicates852 if ($cache_index[$headers->id]) {853 $this->remove_message_cache($cache_key, $headers->id, true);854 unset($cache_index[$headers->id]);855 }853 // prevent index duplicates 854 if ($cache_index[$headers->id]) { 855 $this->remove_message_cache($cache_key, $headers->id, true); 856 unset($cache_index[$headers->id]); 857 } 856 858 // add message to cache 857 $this->add_message_cache($cache_key, $headers->id, $headers, NULL,858 !in_array($headers->uid, $cache_index));859 }859 $this->add_message_cache($cache_key, $headers->id, $headers, NULL, 860 !in_array($headers->uid, $cache_index)); 861 } 860 862 861 863 $a_msg_headers[$headers->uid] = $headers; … … 913 915 // use message index sort for sorting by Date 914 916 if ($this->index_sort && $this->sort_field == 'date') 915 {916 $msgs = $this->search_set;917 918 if ($this->search_sort_field != 'date')919 sort($msgs);920 917 { 918 $msgs = $this->search_set; 919 920 if ($this->search_sort_field != 'date') 921 sort($msgs); 922 921 923 if ($this->sort_order == 'DESC') 922 924 $this->cache[$key] = array_reverse($msgs); 923 925 else 924 926 $this->cache[$key] = $msgs; 925 }927 } 926 928 // sort with SORT command 927 929 else if ($this->get_capability('sort')) 928 {930 { 929 931 if ($this->sort_field && $this->search_sort_field != $this->sort_field) 930 932 $this->search('', $this->search_string, $this->search_charset, $this->sort_field); … … 934 936 else 935 937 $this->cache[$key] = $this->search_set; 936 }938 } 937 939 else 938 {940 { 939 941 $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, join(',', $this->search_set), $this->sort_field, $this->skip_deleted); 940 942 … … 945 947 946 948 $this->cache[$key] = array_keys($a_index); 947 }949 } 948 950 } 949 951 … … 1033 1035 if (isset($cache_index[$id])) 1034 1036 { 1035 $for_remove[] = $cache_index[$id];1037 $for_remove[] = $cache_index[$id]; 1036 1038 unset($cache_index[$id]); 1037 1039 } 1038 1040 1039 $for_update[] = $id;1041 $for_update[] = $id; 1040 1042 } 1041 1043 … … 1052 1054 foreach ($headers as $header) 1053 1055 $this->add_message_cache($cache_key, $header->id, $header, NULL, 1054 in_array($header->uid, (array)$for_remove));1056 in_array($header->uid, (array)$for_remove)); 1055 1057 } 1056 1058 } … … 1079 1081 // only if UTF-8 search is not supported 1080 1082 if (empty($results) && !is_array($results) && !empty($charset) && $charset != 'US-ASCII') 1081 {1082 // convert strings to US_ASCII1083 if(preg_match_all('/\{([0-9]+)\}\r\n/', $str, $matches, PREG_OFFSET_CAPTURE))1084 {1085 $last = 0; $res = '';1086 foreach($matches[1] as $m)1087 {1088 $string_offset = $m[1] + strlen($m[0]) + 4; // {}\r\n1089 $string = substr($str, $string_offset - 1, $m[0]);1090 $string = rcube_charset_convert($string, $charset, 'US-ASCII');1091 if (!$string) continue;1092 $res .= sprintf("%s{%d}\r\n%s", substr($str, $last, $m[1] - $last - 1), strlen($string), $string);1093 $last = $m[0] + $string_offset - 1;1094 }1095 if ($last < strlen($str))1096 $res .= substr($str, $last, strlen($str)-$last);1097 }1098 else // strings for conversion not found1099 $res = $str;1100 1101 $results = $this->search($mbox_name, $res, NULL, $sort_field);1102 }1083 { 1084 // convert strings to US_ASCII 1085 if(preg_match_all('/\{([0-9]+)\}\r\n/', $str, $matches, PREG_OFFSET_CAPTURE)) 1086 { 1087 $last = 0; $res = ''; 1088 foreach($matches[1] as $m) 1089 { 1090 $string_offset = $m[1] + strlen($m[0]) + 4; // {}\r\n 1091 $string = substr($str, $string_offset - 1, $m[0]); 1092 $string = rcube_charset_convert($string, $charset, 'US-ASCII'); 1093 if (!$string) continue; 1094 $res .= sprintf("%s{%d}\r\n%s", substr($str, $last, $m[1] - $last - 1), strlen($string), $string); 1095 $last = $m[0] + $string_offset - 1; 1096 } 1097 if ($last < strlen($str)) 1098 $res .= substr($str, $last, strlen($str)-$last); 1099 } 1100 else // strings for conversion not found 1101 $res = $str; 1102 1103 $results = $this->search($mbox_name, $res, NULL, $sort_field); 1104 } 1103 1105 1104 1106 $this->set_search_set($str, $results, $charset, $sort_field); … … 1250 1252 // ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 2154 70 NIL NIL NIL) 1251 1253 if ($headers->ctype && $headers->ctype != 'text/plain' 1252 && $structure[0] == 'text' && $structure[1] == 'plain') {1253 return false; 1254 }1254 && $structure[0] == 'text' && $structure[1] == 'plain') { 1255 return false; 1256 } 1255 1257 1256 1258 $struct = &$this->_structure_part($structure); … … 1303 1305 if (is_array($part[$i]) && count($part[$i]) > 3) { 1304 1306 // fetch message headers if message/rfc822 or named part (could contain Content-Location header) 1305 if (!is_array($part[$i][0])) {1307 if (!is_array($part[$i][0])) { 1306 1308 $tmp_part_id = $struct->mime_id ? $struct->mime_id.'.'.($i+1) : $i+1; 1307 1309 if (strtolower($part[$i][0]) == 'message' && strtolower($part[$i][1]) == 'rfc822') { 1308 $raw_part_headers[] = $tmp_part_id;1309 $mime_part_headers[] = $tmp_part_id;1310 }1310 $raw_part_headers[] = $tmp_part_id; 1311 $mime_part_headers[] = $tmp_part_id; 1312 } 1311 1313 else if (in_array('name', (array)$part[$i][2]) && (empty($part[$i][3]) || $part[$i][3]=='NIL')) { 1312 $mime_part_headers[] = $tmp_part_id; 1313 } 1314 $mime_part_headers[] = $tmp_part_id; 1314 1315 } 1315 1316 } 1317 } 1316 1318 1317 1319 // pre-fetch headers of all parts (in one command for better performance) … … 1331 1333 $tmp_part_id = $struct->mime_id ? $struct->mime_id.'.'.($i+1) : $i+1; 1332 1334 $struct->parts[] = $this->_structure_part($part[$i], ++$count, $struct->mime_id, 1333 $mime_part_headers[$tmp_part_id], $raw_part_headers[$tmp_part_id]);1334 }1335 $mime_part_headers[$tmp_part_id], $raw_part_headers[$tmp_part_id]); 1336 } 1335 1337 1336 1338 return $struct; … … 1453 1455 // we must fetch and parse headers "manually" 1454 1456 if ($i<2) { 1455 if (!$headers)1457 if (!$headers) 1456 1458 $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $part->mime_id); 1457 1459 $filename_mime = ''; … … 1470 1472 } 1471 1473 if ($i<2) { 1472 if (!$headers)1474 if (!$headers) 1473 1475 $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $part->mime_id); 1474 1476 $filename_encoded = ''; … … 1487 1489 } 1488 1490 if ($i<2) { 1489 if (!$headers)1491 if (!$headers) 1490 1492 $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $part->mime_id); 1491 1493 $filename_mime = ''; … … 1504 1506 } 1505 1507 if ($i<2) { 1506 if (!$headers)1508 if (!$headers) 1507 1509 $headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $this->_msg_id, false, $part->mime_id); 1508 1510 $filename_encoded = ''; … … 1526 1528 if (!empty($filename_mime)) { 1527 1529 $part->filename = rcube_imap::decode_mime_string($filename_mime, 1528 $part->charset ? $part->charset : $this->struct_charset ? $this->struct_charset :1529 rc_detect_encoding($filename_mime, $this->default_charset));1530 $part->charset ? $part->charset : ($this->struct_charset ? $this->struct_charset : 1531 rc_detect_encoding($filename_mime, $this->default_charset))); 1530 1532 } 1531 1533 else if (!empty($filename_encoded)) { … … 1550 1552 { 1551 1553 while (is_array($structure)) { 1552 if (is_array($structure[2]) && $structure[2][0] == 'charset')1553 return $structure[2][1];1554 $structure = $structure[0];1555 }1554 if (is_array($structure[2]) && $structure[2][0] == 'charset') 1555 return $structure[2][1]; 1556 $structure = $structure[0]; 1557 } 1556 1558 } 1557 1559 -
program/js/app.js
r7910c0f ra961838 2317 2317 var message = input_message.val(); 2318 2318 var is_html = ($("input[name='_is_html']").val() == '1'); 2319 var sig_separator = this.env.sig_above && (this.env.compose_mode == 'reply' || this.env.compose_mode == 'forward') ? '---' : '-- '; 2319 2320 var sig, cursor_pos, p = -1; 2320 2321 … … 2334 2335 2335 2336 if (sig.indexOf('-- ') != 0) 2336 sig = '-- \n'+sig;2337 sig = sig_separator + '\n' + sig; 2337 2338 2338 2339 p = this.env.sig_above ? message.indexOf(sig) : message.lastIndexOf(sig); … … 2345 2346 sig = this.env.signatures[id]['is_html'] ? this.env.signatures[id]['plain_text'] : this.env.signatures[id]['text']; 2346 2347 if (sig.indexOf('-- ') != 0) 2347 sig = '-- \n'+sig;2348 sig = sig_separator + '\n' + sig; 2348 2349 2349 2350 if (this.env.sig_above) { … … 2414 2415 sig = this.env.signatures[id].text; 2415 2416 if (this.env.signatures[id].plain_text.indexOf('-- ') != 0) 2416 sig = '--<br />' + sig;2417 sig = sig_separator + '<br />' + sig; 2417 2418 } 2418 2419 else { 2419 2420 sig = this.env.signatures[id].text; 2420 2421 if (sig.indexOf('-- ') != 0) 2421 sig = '--\n' + sig;2422 sig = sig_separator + '\n' + sig; 2422 2423 sig = '<pre>' + sig + '</pre>'; 2423 2424 } -
program/steps/mail/compose.inc
r3b1426a ra961838 152 152 if (!empty($_SESSION['compose']['param']['all'])) 153 153 $MESSAGE->reply_all = 1; 154 155 $OUTPUT->set_env('compose_mode', 'reply'); 154 156 } 155 157 else if ($compose_mode == RCUBE_COMPOSE_DRAFT) … … 167 169 { 168 170 $_SESSION['compose']['forward_uid'] = $msg_uid; 171 $OUTPUT->set_env('compose_mode', 'forward'); 169 172 } 170 173 }
Note: See TracChangeset
for help on using the changeset viewer.
