Changeset 5766 in subversion
- Timestamp:
- Jan 13, 2012 4:25:11 AM (17 months ago)
- Location:
- branches/devel-framework/roundcubemail/program
- Files:
-
- 5 edited
-
include/rcube_imap.php (modified) (19 diffs)
-
include/rcube_imap_cache.php (modified) (7 diffs)
-
include/rcube_result_index.php (modified) (9 diffs)
-
include/rcube_result_thread.php (modified) (21 diffs)
-
steps/mail/pagenav.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-framework/roundcubemail/program/include/rcube_imap.php
r5765 r5766 546 546 if ($this->search_string && $folder == $this->folder && ($mode == 'ALL' || $mode == 'THREADS') && !$force) { 547 547 if ($mode == 'ALL') { 548 return $this->search_set->count Messages();548 return $this->search_set->count_messages(); 549 549 } 550 550 else { … … 569 569 570 570 if ($status) { 571 $msg_count = $res->count Messages();571 $msg_count = $res->count_messages(); 572 572 $this->set_folder_stats($folder, 'cnt', $msg_count); 573 573 $this->set_folder_stats($folder, 'maxuid', $msg_count ? $this->id2uid($msg_count, $folder) : 0); … … 692 692 $index = $this->index($folder, $this->sort_field, $this->sort_order); 693 693 694 if ($index->is Empty()) {694 if ($index->is_empty()) { 695 695 return array(); 696 696 } … … 820 820 $parents = array(); 821 821 822 list ($msg_depth, $msg_children) = $threads->get ThreadData();822 list ($msg_depth, $msg_children) = $threads->get_thread_data(); 823 823 824 824 foreach ($headers as $uid => $header) { … … 850 850 protected function list_search_messages($folder, $page, $slice=0) 851 851 { 852 if (!strlen($folder) || empty($this->search_set) || $this->search_set->is Empty()) {852 if (!strlen($folder) || empty($this->search_set) || $this->search_set->is_empty()) { 853 853 return array(); 854 854 } … … 869 869 870 870 // return empty array if no messages found 871 if ($index->is Empty()) {871 if ($index->is_empty()) { 872 872 return array(); 873 873 } … … 887 887 888 888 // return empty array if no messages found 889 if ($index->is Empty()) {889 if ($index->is_empty()) { 890 890 return array(); 891 891 } … … 894 894 895 895 if ($got_index) { 896 if ($this->sort_order != $index->get Parameters('ORDER')) {896 if ($this->sort_order != $index->get_parameters('ORDER')) { 897 897 $index->revert(); 898 898 } … … 977 977 // update search_set if previous data was fetched with disabled threading 978 978 if (!$this->search_threads) { 979 if ($this->search_set->is Empty()) {979 if ($this->search_set->is_empty()) { 980 980 return array(); 981 981 } … … 1151 1151 } 1152 1152 1153 if ($this->sort_order != $index->get Parameters('ORDER')) {1153 if ($this->sort_order != $index->get_parameters('ORDER')) { 1154 1154 $index->revert(); 1155 1155 } … … 1191 1191 else if (!$sort_field) { 1192 1192 if ($this->options['skip_deleted'] && !empty($this->icache['undeleted_idx']) 1193 && $this->icache['undeleted_idx']->get Parameters('MAILBOX') == $folder1193 && $this->icache['undeleted_idx']->get_parameters('MAILBOX') == $folder 1194 1194 ) { 1195 1195 $index = $this->icache['undeleted_idx']; … … 1213 1213 } 1214 1214 1215 if (empty($index) || $index->is Error()) {1215 if (empty($index) || $index->is_error()) { 1216 1216 $index = $this->conn->index($folder, "1:*", $sort_field, 1217 1217 $this->options['skip_deleted'], false, true); … … 1219 1219 } 1220 1220 1221 if ($sort_order != $index->get Parameters('ORDER')) {1221 if ($sort_order != $index->get_parameters('ORDER')) { 1222 1222 $index->revert(); 1223 1223 } … … 1265 1265 protected function sort_threads($threads) 1266 1266 { 1267 if ($threads->is Empty()) {1267 if ($threads->is_empty()) { 1268 1268 return; 1269 1269 } … … 1276 1276 $index = $this->index_direct($this->folder, $this->sort_field, $this->sort_order, false); 1277 1277 1278 if (!$index->is Empty()) {1278 if (!$index->is_empty()) { 1279 1279 $threads->sort($index); 1280 1280 } 1281 1281 } 1282 1282 else { 1283 if ($this->sort_order != $threads->get Parameters('ORDER')) {1283 if ($this->sort_order != $threads->get_parameters('ORDER')) { 1284 1284 $threads->revert(); 1285 1285 } … … 1376 1376 // Error, try with US-ASCII (RFC5256: SORT/THREAD must support US-ASCII and UTF-8, 1377 1377 // but I've seen that Courier doesn't support UTF-8) 1378 if ($threads->is Error() && $charset && $charset != 'US-ASCII') {1378 if ($threads->is_error() && $charset && $charset != 'US-ASCII') { 1379 1379 $threads = $this->conn->thread($folder, $this->threading, 1380 1380 $this->convert_criteria($criteria, $charset), true, 'US-ASCII'); … … 1390 1390 // Error, try with US-ASCII (RFC5256: SORT/THREAD must support US-ASCII and UTF-8, 1391 1391 // but I've seen Courier with disabled UTF-8 support) 1392 if ($messages->is Error() && $charset && $charset != 'US-ASCII') {1392 if ($messages->is_error() && $charset && $charset != 'US-ASCII') { 1393 1393 $messages = $this->conn->sort($folder, $sort_field, 1394 1394 $this->convert_criteria($criteria, $charset), true, 'US-ASCII'); 1395 1395 } 1396 1396 1397 if (!$messages->is Error()) {1397 if (!$messages->is_error()) { 1398 1398 $this->search_sorted = true; 1399 1399 return $messages; … … 1405 1405 1406 1406 // Error, try with US-ASCII (some servers may support only US-ASCII) 1407 if ($messages->is Error() && $charset && $charset != 'US-ASCII') {1407 if ($messages->is_error() && $charset && $charset != 'US-ASCII') { 1408 1408 $messages = $this->conn->search($folder, 1409 1409 $this->convert_criteria($criteria, $charset), true); … … 3097 3097 // add (E)SEARCH result for ALL UNDELETED query 3098 3098 if (!empty($this->icache['undeleted_idx']) 3099 && $this->icache['undeleted_idx']->get Parameters('MAILBOX') == $folder3099 && $this->icache['undeleted_idx']->get_parameters('MAILBOX') == $folder 3100 3100 ) { 3101 3101 $data['UNDELETED'] = $this->icache['undeleted_idx']; -
branches/devel-framework/roundcubemail/program/include/rcube_imap_cache.php
r5759 r5766 136 136 else if ($sort_field == 'ANY' || $this->icache[$mailbox]['index']['sort_field'] == $sort_field) { 137 137 $result = $this->icache[$mailbox]['index']['object']; 138 if ($result->get Parameters('ORDER') != $sort_order) {138 if ($result->get_parameters('ORDER') != $sort_order) { 139 139 $result->revert(); 140 140 } … … 179 179 $data = $index['object']; 180 180 // revert the order if needed 181 if ($data->get Parameters('ORDER') != $sort_order) {181 if ($data->get_parameters('ORDER') != $sort_order) { 182 182 $data->revert(); 183 183 } … … 758 758 // Folder is empty but cache isn't 759 759 if (empty($mbox_data['EXISTS'])) { 760 if (!$object->is Empty()) {760 if (!$object->is_empty()) { 761 761 $this->clear($mailbox); 762 762 $exists = false; … … 765 765 } 766 766 // Folder is not empty but cache is 767 else if ($object->is Empty()) {767 else if ($object->is_empty()) { 768 768 unset($this->icache[$mailbox][$is_thread ? 'thread' : 'index']); 769 769 return false; … … 797 797 if ($is_thread) { 798 798 // check messages number... 799 if (!$this->skip_deleted && $mbox_data['EXISTS'] != $object->count Messages()) {799 if (!$this->skip_deleted && $mbox_data['EXISTS'] != $object->count_messages()) { 800 800 return false; 801 801 } … … 831 831 rcube_imap_generic::compressMessageSet($object->get())); 832 832 833 if (!$ids->is Empty()) {833 if (!$ids->is_empty()) { 834 834 return false; 835 835 } … … 1009 1009 1010 1010 $sort_field = $index['sort_field']; 1011 $sort_order = $index['object']->get Parameters('ORDER');1011 $sort_order = $index['object']->get_parameters('ORDER'); 1012 1012 $exists = true; 1013 1013 -
branches/devel-framework/roundcubemail/program/include/rcube_result_index.php
r5622 r5766 28 28 class rcube_result_index 29 29 { 30 pr ivate$raw_data;31 pr ivate$mailbox;32 pr ivate$meta = array();33 pr ivate$params = array();34 pr ivate$order = 'ASC';30 protected $raw_data; 31 protected $mailbox; 32 protected $meta = array(); 33 protected $params = array(); 34 protected $order = 'ASC'; 35 35 36 36 const SEPARATOR_ELEMENT = ' '; … … 127 127 * @return bool True if the result is an error, False otherwise 128 128 */ 129 public function is Error()129 public function is_error() 130 130 { 131 131 return $this->raw_data === null ? true : false; … … 138 138 * @return bool True if the result is empty, False otherwise 139 139 */ 140 public function is Empty()140 public function is_empty() 141 141 { 142 142 return empty($this->raw_data) ? true : false; … … 172 172 * @return int Number of elements 173 173 */ 174 public function count Messages()174 public function count_messages() 175 175 { 176 176 return $this->count(); … … 306 306 $idx = 1 + substr_count($this->raw_data, self::SEPARATOR_ELEMENT, 0, $m[0][1]); 307 307 } 308 // cache position of this element, so we can use it in get Element()308 // cache position of this element, so we can use it in get_element() 309 309 $this->meta['pos'][$idx] = (int)$m[0][1]; 310 310 … … 337 337 * @return array List of message IDs 338 338 */ 339 public function get Compressed()339 public function get_compressed() 340 340 { 341 341 if (empty($this->raw_data)) { … … 354 354 * @return int Element value 355 355 */ 356 public function get Element($index)356 public function get_element($index) 357 357 { 358 358 $count = $this->count(); … … 415 415 * @return array|string Response parameters or parameter value 416 416 */ 417 public function get Parameters($param=null)417 public function get_parameters($param=null) 418 418 { 419 419 $params = $this->params; … … 434 434 * @return int Data length 435 435 */ 436 pr ivatefunction length()436 protected function length() 437 437 { 438 438 if (!isset($this->meta['length'])) { -
branches/devel-framework/roundcubemail/program/include/rcube_result_thread.php
r5622 r5766 28 28 class rcube_result_thread 29 29 { 30 pr ivate$raw_data;31 pr ivate$mailbox;32 pr ivate$meta = array();33 pr ivate$order = 'ASC';30 protected $raw_data; 31 protected $mailbox; 32 protected $meta = array(); 33 protected $order = 'ASC'; 34 34 35 35 const SEPARATOR_ELEMENT = ' '; … … 78 78 $data = preg_replace('/\s+/', ' ', $data); 79 79 80 $this->raw_data = $this->parse Thread($data);80 $this->raw_data = $this->parse_thread($data); 81 81 } 82 82 … … 87 87 * @return bool True if the result is an error, False otherwise 88 88 */ 89 public function is Error()89 public function is_error() 90 90 { 91 91 return $this->raw_data === null ? true : false; … … 98 98 * @return bool True if the result is empty, False otherwise 99 99 */ 100 public function is Empty()100 public function is_empty() 101 101 { 102 102 return empty($this->raw_data) ? true : false; … … 133 133 * @return int Number of elements 134 134 */ 135 public function count Messages()135 public function count_messages() 136 136 { 137 137 if ($this->meta['messages'] !== null) … … 301 301 + substr_count($this->raw_data, self::SEPARATOR_ITEM, 0, $m[0][1]+1); 302 302 } 303 // cache position of this element, so we can use it in get Element()303 // cache position of this element, so we can use it in get_element() 304 304 $this->meta['pos'][$idx] = (int)$m[0][1]; 305 305 … … 337 337 * @return array List of message identifiers 338 338 */ 339 public function get Compressed()339 public function get_compressed() 340 340 { 341 341 if (empty($this->raw_data)) { … … 354 354 * @return int Element value 355 355 */ 356 public function get Element($index)356 public function get_element($index) 357 357 { 358 358 $count = $this->count(); … … 424 424 * @return array|string Response parameters or parameter value 425 425 */ 426 public function get Parameters($param=null)426 public function get_parameters($param=null) 427 427 { 428 428 $params = $this->params; … … 445 445 public function sort($index) 446 446 { 447 $this->sort_order = $index->get Parameters('ORDER');447 $this->sort_order = $index->get_parameters('ORDER'); 448 448 449 449 if (empty($this->raw_data)) { … … 452 452 453 453 // when sorting search result it's good to make the index smaller 454 if ($index->count() != $this->count Messages()) {454 if ($index->count() != $this->count_messages()) { 455 455 $index->intersect($this->get()); 456 456 } … … 511 511 * @return array Data tree 512 512 */ 513 public function get Tree()513 public function get_tree() 514 514 { 515 515 $datalen = strlen($this->raw_data); … … 523 523 $elem = substr($this->raw_data, $start, $len); 524 524 $items = explode(self::SEPARATOR_ITEM, $elem); 525 $result[array_shift($items)] = $this->build Thread($items);525 $result[array_shift($items)] = $this->build_thread($items); 526 526 $start = $pos + 1; 527 527 } … … 536 536 * @return array Thread data 537 537 */ 538 public function get ThreadData()539 { 540 $data = $this->get Tree();538 public function get_thread_data() 539 { 540 $data = $this->get_tree(); 541 541 $depth = array(); 542 542 $children = array(); 543 543 544 $this->build ThreadData($data, $depth, $children);544 $this->build_thread_data($data, $depth, $children); 545 545 546 546 return array($depth, $children); … … 551 551 * Creates 'depth' and 'children' arrays from stored thread 'tree' data. 552 552 */ 553 pr ivate function buildThreadData($data, &$depth, &$children, $level = 0)553 protected function build_thread_data($data, &$depth, &$children, $level = 0) 554 554 { 555 555 foreach ((array)$data as $key => $val) { … … 557 557 $depth[$key] = $level; 558 558 if (!empty($val)) 559 $this->build ThreadData($val, $depth, $children, $level + 1);559 $this->build_thread_data($val, $depth, $children, $level + 1); 560 560 } 561 561 } … … 565 565 * Converts part of the raw thread into an array 566 566 */ 567 pr ivate function buildThread($items, $level = 1, &$pos = 0)567 protected function build_thread($items, $level = 1, &$pos = 0) 568 568 { 569 569 $result = array(); … … 573 573 if ($level == $lv) { 574 574 $pos++; 575 $result[$id] = $this->build Thread($items, $level+1, $pos);575 $result[$id] = $this->build_thread($items, $level+1, $pos); 576 576 } 577 577 else { … … 588 588 * IMAP THREAD response parser 589 589 */ 590 pr ivate function parseThread($str, $begin = 0, $end = 0, $depth = 0)590 protected function parse_thread($str, $begin = 0, $end = 0, $depth = 0) 591 591 { 592 592 // Don't be tempted to change $str to pass by reference to speed this up - it will slow it down by about … … 626 626 627 627 if ($stop + 1 < $end) { 628 $node .= $this->parse Thread($str, $stop + 1, $end, $depth + 1);628 $node .= $this->parse_thread($str, $stop + 1, $end, $depth + 1); 629 629 } 630 630 } else { … … 651 651 } 652 652 653 $thread = $this->parse Thread($str, $start + 1, $off - 1, $depth);653 $thread = $this->parse_thread($str, $start + 1, $off - 1, $depth); 654 654 if ($thread) { 655 655 if (!$depth) { -
branches/devel-framework/roundcubemail/program/steps/mail/pagenav.inc
r5758 r5766 22 22 $uid = get_input_value('_uid', RCUBE_INPUT_GET); 23 23 $index = $RCMAIL->storage->index(null, $_SESSION['sort_col'], $_SESSION['sort_order']); 24 $cnt = $index->count Messages();24 $cnt = $index->count_messages(); 25 25 26 26 if ($cnt && ($pos = $index->exists($uid, true)) !== false) { 27 $prev = $pos ? $index->get Element($pos-1) : 0;28 $first = $pos ? $index->get Element('FIRST') : 0;29 $next = $pos < $cnt-1 ? $index->get Element($pos+1) : 0;30 $last = $pos < $cnt-1 ? $index->get Element('LAST') : 0;27 $prev = $pos ? $index->get_element($pos-1) : 0; 28 $first = $pos ? $index->get_element('FIRST') : 0; 29 $next = $pos < $cnt-1 ? $index->get_element($pos+1) : 0; 30 $last = $pos < $cnt-1 ? $index->get_element('LAST') : 0; 31 31 } 32 32
Note: See TracChangeset
for help on using the changeset viewer.
