Changeset 5765 in subversion
- Timestamp:
- Jan 13, 2012 3:44:36 AM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-framework/roundcubemail/program/include/rcube_imap.php
r5759 r5765 6 6 | | 7 7 | This file is part of the Roundcube Webmail client | 8 | Copyright (C) 2005-201 1, The Roundcube Dev Team |9 | Copyright (C) 2011 , Kolab Systems AG|8 | Copyright (C) 2005-2012, The Roundcube Dev Team | 9 | Copyright (C) 2011-2012, Kolab Systems AG | 10 10 | Licensed under the GNU GPL | 11 11 | | 12 12 | PURPOSE: | 13 | IMAP Engine|13 | IMAP Storage Engine | 14 14 | | 15 15 +-----------------------------------------------------------------------+ … … 90 90 // Set namespace and delimiter from session, 91 91 // so some methods would work before connection 92 if (isset($_SESSION['imap_namespace'])) 92 if (isset($_SESSION['imap_namespace'])) { 93 93 $this->namespace = $_SESSION['imap_namespace']; 94 if (isset($_SESSION['imap_delimiter'])) 94 } 95 if (isset($_SESSION['imap_delimiter'])) { 95 96 $this->delimiter = $_SESSION['imap_delimiter']; 97 } 96 98 } 97 99 … … 111 113 { 112 114 // check for OpenSSL support in PHP build 113 if ($use_ssl && extension_loaded('openssl')) 115 if ($use_ssl && extension_loaded('openssl')) { 114 116 $this->options['ssl_mode'] = $use_ssl == 'imaps' ? 'ssl' : $use_ssl; 117 } 115 118 else if ($use_ssl) { 116 119 raise_error(array('code' => 403, 'type' => 'imap', … … 140 143 'attempt' => ++$attempt))); 141 144 142 if (!empty($data['pass'])) 145 if (!empty($data['pass'])) { 143 146 $pass = $data['pass']; 147 } 144 148 145 149 $this->conn->connect($data['host'], $data['user'], $pass, $data); … … 294 298 public function set_folder($folder) 295 299 { 296 if ($this->folder == $folder) 300 if ($this->folder == $folder) { 297 301 return; 302 } 298 303 299 304 $this->folder = $folder; … … 540 545 // count search set 541 546 if ($this->search_string && $folder == $this->folder && ($mode == 'ALL' || $mode == 'THREADS') && !$force) { 542 if ($mode == 'ALL') 547 if ($mode == 'ALL') { 543 548 return $this->search_set->countMessages(); 544 else 549 } 550 else { 545 551 return $this->search_set->count(); 552 } 546 553 } 547 554 … … 549 556 550 557 // return cached value 551 if (!$force && is_array($a_folder_cache[$folder]) && isset($a_folder_cache[$folder][$mode])) 558 if (!$force && is_array($a_folder_cache[$folder]) && isset($a_folder_cache[$folder][$mode])) { 552 559 return $a_folder_cache[$folder][$mode]; 553 554 if (!is_array($a_folder_cache[$folder])) 560 } 561 562 if (!is_array($a_folder_cache[$folder])) { 555 563 $a_folder_cache[$folder] = array(); 564 } 556 565 557 566 if ($mode == 'THREADS') { … … 608 617 } 609 618 else { 610 if ($mode == 'UNSEEN') 619 if ($mode == 'UNSEEN') { 611 620 $count = $this->conn->countUnseen($folder); 621 } 612 622 else { 613 623 $count = $this->conn->countMessages($folder); … … 691 701 $index->slice($from, $to - $from); 692 702 693 if ($slice) 703 if ($slice) { 694 704 $index->slice(-$slice, $slice); 705 } 695 706 696 707 // fetch reqested messages headers … … 715 726 { 716 727 // get all threads (not sorted) 717 if ($mcache = $this->get_mcache_engine()) 728 if ($mcache = $this->get_mcache_engine()) { 718 729 $threads = $mcache->get_thread($folder); 719 else 730 } 731 else { 720 732 $threads = $this->fetch_threads($folder); 733 } 721 734 722 735 return $this->fetch_thread_headers($folder, $threads, $page, $slice); … … 775 788 $threads->slice($from, $to - $from); 776 789 777 if ($slice) 790 if ($slice) { 778 791 $threads->slice(-$slice, $slice); 792 } 779 793 780 794 // Get UIDs of all messages in all threads … … 855 869 856 870 // return empty array if no messages found 857 if ($index->isEmpty()) 871 if ($index->isEmpty()) { 858 872 return array(); 873 } 859 874 860 875 // quickest method (default sorting) … … 939 954 $from, min($cnt-$to, $this->page_size)); 940 955 941 if ($slice) 956 if ($slice) { 942 957 $a_msg_headers = array_slice($a_msg_headers, -$slice, $slice); 958 } 943 959 944 960 return $a_msg_headers; … … 961 977 // update search_set if previous data was fetched with disabled threading 962 978 if (!$this->search_threads) { 963 if ($this->search_set->isEmpty()) 979 if ($this->search_set->isEmpty()) { 964 980 return array(); 981 } 965 982 $this->search('', $this->search_string, $this->search_charset, $this->sort_field); 966 983 } … … 982 999 function fetch_headers($folder, $msgs, $sort = true, $force = false) 983 1000 { 984 if (empty($msgs)) 1001 if (empty($msgs)) { 985 1002 return array(); 1003 } 986 1004 987 1005 if (!$force && ($mcache = $this->get_mcache_engine())) { … … 997 1015 } 998 1016 999 if (empty($headers)) 1017 if (empty($headers)) { 1000 1018 return array(); 1019 } 1001 1020 1002 1021 foreach ($headers as $h) { … … 1044 1063 1045 1064 // got new messages 1046 if ($new['maxuid'] > $old['maxuid']) 1065 if ($new['maxuid'] > $old['maxuid']) { 1047 1066 $result += 1; 1067 } 1048 1068 // some messages has been deleted 1049 if ($new['cnt'] < $old['cnt']) 1069 if ($new['cnt'] < $old['cnt']) { 1050 1070 $result += 2; 1071 } 1051 1072 1052 1073 // @TODO: optional checking for messages flags changes (?) … … 1080 1101 protected function get_folder_stats($folder) 1081 1102 { 1082 if ($_SESSION['folders'][$folder]) 1103 if ($_SESSION['folders'][$folder]) { 1083 1104 return (array) $_SESSION['folders'][$folder]; 1084 else 1085 return array(); 1105 } 1106 1107 return array(); 1086 1108 } 1087 1109 … … 1354 1376 // Error, try with US-ASCII (RFC5256: SORT/THREAD must support US-ASCII and UTF-8, 1355 1377 // but I've seen that Courier doesn't support UTF-8) 1356 if ($threads->isError() && $charset && $charset != 'US-ASCII') 1378 if ($threads->isError() && $charset && $charset != 'US-ASCII') { 1357 1379 $threads = $this->conn->thread($folder, $this->threading, 1358 1380 $this->convert_criteria($criteria, $charset), true, 'US-ASCII'); 1381 } 1359 1382 1360 1383 return $threads; … … 1367 1390 // Error, try with US-ASCII (RFC5256: SORT/THREAD must support US-ASCII and UTF-8, 1368 1391 // but I've seen Courier with disabled UTF-8 support) 1369 if ($messages->isError() && $charset && $charset != 'US-ASCII') 1392 if ($messages->isError() && $charset && $charset != 'US-ASCII') { 1370 1393 $messages = $this->conn->sort($folder, $sort_field, 1371 1394 $this->convert_criteria($criteria, $charset), true, 'US-ASCII'); 1395 } 1372 1396 1373 1397 if (!$messages->isError()) { … … 1381 1405 1382 1406 // Error, try with US-ASCII (some servers may support only US-ASCII) 1383 if ($messages->isError() && $charset && $charset != 'US-ASCII') 1407 if ($messages->isError() && $charset && $charset != 'US-ASCII') { 1384 1408 $messages = $this->conn->search($folder, 1385 1409 $this->convert_criteria($criteria, $charset), true); 1410 } 1386 1411 1387 1412 $this->search_sorted = false; … … 1409 1434 $string = substr($str, $string_offset - 1, $m[0]); 1410 1435 $string = rcube_charset_convert($string, $charset, $dest_charset); 1411 if ($string === false) 1436 if ($string === false) { 1412 1437 continue; 1438 } 1413 1439 $res .= substr($str, $last, $m[1] - $last - 1) . rcube_imap_generic::escape($string); 1414 1440 $last = $m[0] + $string_offset - 1; 1415 1441 } 1416 if ($last < strlen($str)) 1442 if ($last < strlen($str)) { 1417 1443 $res .= substr($str, $last, strlen($str)-$last); 1418 } 1419 else // strings for conversion not found 1444 } 1445 } 1446 // strings for conversion not found 1447 else { 1420 1448 $res = $str; 1449 } 1421 1450 1422 1451 return $res; … … 1495 1524 1496 1525 // message doesn't exist? 1497 if (empty($headers)) 1526 if (empty($headers)) { 1498 1527 return null; 1528 } 1499 1529 1500 1530 // structure might be cached … … 1520 1550 1521 1551 // set message charset from message headers 1522 if ($headers->charset) 1552 if ($headers->charset) { 1523 1553 $this->struct_charset = $headers->charset; 1524 else 1554 } 1555 else { 1525 1556 $this->struct_charset = $this->structure_charset($structure); 1557 } 1526 1558 1527 1559 $headers->ctype = strtolower($headers->ctype); … … 1539 1571 $structure[1] = $m[2]; 1540 1572 } 1541 else 1573 else { 1542 1574 return $headers; 1575 } 1543 1576 } 1544 1577 … … 1598 1631 // build parts list for headers pre-fetching 1599 1632 for ($i=0; $i<count($part); $i++) { 1600 if (!is_array($part[$i])) 1633 if (!is_array($part[$i])) { 1601 1634 break; 1635 } 1602 1636 // fetch message headers if message/rfc822 1603 1637 // or named part (could contain Content-Location header) … … 1623 1657 $struct->parts = array(); 1624 1658 for ($i=0, $count=0; $i<count($part); $i++) { 1625 if (!is_array($part[$i])) 1659 if (!is_array($part[$i])) { 1626 1660 break; 1661 } 1627 1662 $tmp_part_id = $struct->mime_id ? $struct->mime_id.'.'.($i+1) : $i+1; 1628 1663 $struct->parts[] = $this->structure_part($part[$i], ++$count, $struct->mime_id, … … 1662 1697 if (is_array($part[2])) { 1663 1698 $struct->ctype_parameters = array(); 1664 for ($i=0; $i<count($part[2]); $i+=2) 1699 for ($i=0; $i<count($part[2]); $i+=2) { 1665 1700 $struct->ctype_parameters[strtolower($part[2][$i])] = $part[2][$i+1]; 1666 1667 if (isset($struct->ctype_parameters['charset'])) 1701 } 1702 1703 if (isset($struct->ctype_parameters['charset'])) { 1668 1704 $struct->charset = $struct->ctype_parameters['charset']; 1705 } 1669 1706 } 1670 1707 … … 1681 1718 1682 1719 // get part size 1683 if (!empty($part[6])) 1720 if (!empty($part[6])) { 1684 1721 $struct->size = intval($part[6]); 1722 } 1685 1723 1686 1724 // read part disposition 1687 1725 $di = 8; 1688 if ($struct->ctype_primary == 'text') $di += 1; 1689 else if ($struct->mimetype == 'message/rfc822') $di += 3; 1726 if ($struct->ctype_primary == 'text') { 1727 $di += 1; 1728 } 1729 else if ($struct->mimetype == 'message/rfc822') { 1730 $di += 3; 1731 } 1690 1732 1691 1733 if (is_array($part[$di]) && count($part[$di]) == 2) { 1692 1734 $struct->disposition = strtolower($part[$di][0]); 1693 1735 1694 if (is_array($part[$di][1])) 1695 for ($n=0; $n<count($part[$di][1]); $n+=2) 1736 if (is_array($part[$di][1])) { 1737 for ($n=0; $n<count($part[$di][1]); $n+=2) { 1696 1738 $struct->d_parameters[strtolower($part[$di][1][$n])] = $part[$di][1][$n+1]; 1739 } 1740 } 1697 1741 } 1698 1742 … … 1701 1745 $struct->parts = array(); 1702 1746 for ($i=0, $count=0; $i<count($part[8]); $i++) { 1703 if (!is_array($part[8][$i])) 1747 if (!is_array($part[8][$i])) { 1704 1748 break; 1749 } 1705 1750 $struct->parts[] = $this->structure_part($part[8][$i], ++$count, $struct->mime_id); 1706 1751 } … … 1712 1757 $struct->headers['content-id'] = $part[3]; 1713 1758 1714 if (empty($struct->disposition)) 1759 if (empty($struct->disposition)) { 1715 1760 $struct->disposition = 'inline'; 1761 } 1716 1762 } 1717 1763 … … 1723 1769 } 1724 1770 1725 if (is_string($mime_headers)) 1771 if (is_string($mime_headers)) { 1726 1772 $struct->headers = rcube_mime::parse_headers($mime_headers) + $struct->headers; 1727 else if (is_object($mime_headers)) 1773 } 1774 else if (is_object($mime_headers)) { 1728 1775 $struct->headers = get_object_vars($mime_headers) + $struct->headers; 1776 } 1729 1777 1730 1778 // get real content-type of message/rfc822 1731 1779 if ($struct->mimetype == 'message/rfc822') { 1732 1780 // single-part 1733 if (!is_array($part[8][0])) 1781 if (!is_array($part[8][0])) { 1734 1782 $struct->real_mimetype = strtolower($part[8][0] . '/' . $part[8][1]); 1783 } 1735 1784 // multi-part 1736 1785 else { 1737 for ($n=0; $n<count($part[8]); $n++) 1738 if (!is_array($part[8][$n])) 1786 for ($n=0; $n<count($part[8]); $n++) { 1787 if (!is_array($part[8][$n])) { 1739 1788 break; 1789 } 1790 } 1740 1791 $struct->real_mimetype = 'multipart/' . strtolower($part[8][$n]); 1741 1792 } … … 1743 1794 1744 1795 if ($struct->ctype_primary == 'message' && empty($struct->parts)) { 1745 if (is_array($part[8]) && $di != 8) 1796 if (is_array($part[8]) && $di != 8) { 1746 1797 $struct->parts[] = $this->structure_part($part[8], ++$count, $struct->mime_id); 1798 } 1747 1799 } 1748 1800 } … … 1763 1815 protected function set_part_filename(&$part, $headers=null) 1764 1816 { 1765 if (!empty($part->d_parameters['filename'])) 1817 if (!empty($part->d_parameters['filename'])) { 1766 1818 $filename_mime = $part->d_parameters['filename']; 1767 else if (!empty($part->d_parameters['filename*'])) 1819 } 1820 else if (!empty($part->d_parameters['filename*'])) { 1768 1821 $filename_encoded = $part->d_parameters['filename*']; 1769 else if (!empty($part->ctype_parameters['name*'])) 1822 } 1823 else if (!empty($part->ctype_parameters['name*'])) { 1770 1824 $filename_encoded = $part->ctype_parameters['name*']; 1825 } 1771 1826 // RFC2231 value continuations 1772 1827 // TODO: this should be rewrited to support RFC2231 4.1 combinations … … 1850 1905 } 1851 1906 // read 'name' after rfc2231 parameters as it may contains truncated filename (from Thunderbird) 1852 else if (!empty($part->ctype_parameters['name'])) 1907 else if (!empty($part->ctype_parameters['name'])) { 1853 1908 $filename_mime = $part->ctype_parameters['name']; 1909 } 1854 1910 // Content-Disposition 1855 else if (!empty($part->headers['content-description'])) 1911 else if (!empty($part->headers['content-description'])) { 1856 1912 $filename_mime = $part->headers['content-description']; 1857 else 1913 } 1914 else { 1858 1915 return; 1916 } 1859 1917 1860 1918 // decode filename 1861 1919 if (!empty($filename_mime)) { 1862 if (!empty($part->charset)) 1920 if (!empty($part->charset)) { 1863 1921 $charset = $part->charset; 1864 else if (!empty($this->struct_charset)) 1922 } 1923 else if (!empty($this->struct_charset)) { 1865 1924 $charset = $this->struct_charset; 1866 else 1925 } 1926 else { 1867 1927 $charset = rc_detect_encoding($filename_mime, $this->default_charset); 1928 } 1868 1929 1869 1930 $part->filename = rcube_mime::decode_mime_string($filename_mime, $charset); … … 1891 1952 { 1892 1953 while (is_array($structure)) { 1893 if (is_array($structure[2]) && $structure[2][0] == 'charset') 1954 if (is_array($structure[2]) && $structure[2][0] == 'charset') { 1894 1955 return $structure[2][1]; 1956 } 1895 1957 $structure = $structure[0]; 1896 1958 } … … 1947 2009 if (!$o_part->charset || strtoupper($o_part->charset) == 'US-ASCII') { 1948 2010 // try to extract charset information from HTML meta tag (#1488125) 1949 if ($o_part->ctype_secondary == 'html' && preg_match('/<meta[^>]+charset=([a-z0-9-_]+)/i', $body, $m)) 2011 if ($o_part->ctype_secondary == 'html' && preg_match('/<meta[^>]+charset=([a-z0-9-_]+)/i', $body, $m)) { 1950 2012 $o_part->charset = strtoupper($m[1]); 1951 else 2013 } 2014 else { 1952 2015 $o_part->charset = $this->default_charset; 2016 } 1953 2017 } 1954 2018 $body = rcube_charset_convert($body, $o_part->charset); … … 2032 2096 list($uids, $all_mode) = $this->parse_uids($uids); 2033 2097 2034 if (strpos($flag, 'UN') === 0) 2098 if (strpos($flag, 'UN') === 0) { 2035 2099 $result = $this->conn->unflag($folder, $uids, substr($flag, 2)); 2036 else 2100 } 2101 else { 2037 2102 $result = $this->conn->flag($folder, $uids, $flag); 2103 } 2038 2104 2039 2105 if ($result) { … … 2079 2145 // make sure folder exists 2080 2146 if ($this->folder_exists($folder)) { 2081 if ($is_file) 2147 if ($is_file) { 2082 2148 $saved = $this->conn->appendFromFile($folder, $message, $headers); 2083 else 2149 } 2150 else { 2084 2151 $saved = $this->conn->append($folder, $message); 2152 } 2085 2153 } 2086 2154 … … 2167 2235 if ($this->search_set && $from_mbox == $this->folder) { 2168 2236 // threads are too complicated to just remove messages from set 2169 if ($this->search_threads || $all_mode) 2237 if ($this->search_threads || $all_mode) { 2170 2238 $this->refresh_search(); 2171 else 2239 } 2240 else { 2172 2241 $this->search_set->filter(explode(',', $uids)); 2242 } 2173 2243 } 2174 2244 … … 2271 2341 if ($this->search_set && $folder == $this->folder) { 2272 2342 // threads are too complicated to just remove messages from set 2273 if ($this->search_threads || $all_mode) 2343 if ($this->search_threads || $all_mode) { 2274 2344 $this->refresh_search(); 2275 else 2345 } 2346 else { 2276 2347 $this->search_set->filter(explode(',', $uids)); 2348 } 2277 2349 } 2278 2350 … … 2296 2368 public function expunge_message($uids, $folder = null, $clear_cache = true) 2297 2369 { 2298 if ($uids && $this->get_capability('UIDPLUS')) 2370 if ($uids && $this->get_capability('UIDPLUS')) { 2299 2371 list($uids, $all_mode) = $this->parse_uids($uids); 2300 else 2372 } 2373 else { 2301 2374 $uids = null; 2375 } 2302 2376 2303 2377 if (!strlen($folder)) { … … 2323 2397 2324 2398 // CLOSE(+SELECT) should be faster than EXPUNGE 2325 if (empty($uids) || $all_mode) 2399 if (empty($uids) || $all_mode) { 2326 2400 $result = $this->conn->close(); 2327 else 2401 } 2402 else { 2328 2403 $result = $this->conn->expunge($folder, $uids); 2404 } 2329 2405 2330 2406 if ($result && $clear_cache) { … … 2615 2691 foreach ($a_folders as $idx => $folder) { 2616 2692 $myrights = join('', (array)$this->my_rights($folder)); 2617 if ($myrights !== null && !preg_match($regex, $myrights)) 2693 if ($myrights !== null && !preg_match($regex, $myrights)) { 2618 2694 unset($a_folders[$idx]); 2695 } 2619 2696 } 2620 2697 … … 2655 2732 $result = $this->conn->fetchHeaderIndex($folder, '1:*', 'SIZE', false); 2656 2733 2657 if (is_array($result)) 2734 if (is_array($result)) { 2658 2735 $result = array_sum($result); 2736 } 2659 2737 2660 2738 return $result; … … 2711 2789 $this->clear_cache('mailboxes', true); 2712 2790 2713 if ($subscribe) 2791 if ($subscribe) { 2714 2792 $this->subscribe($folder); 2793 } 2715 2794 } 2716 2795 … … 2795 2874 2796 2875 // get list of folders 2797 if ((strpos($folder, '%') === false) && (strpos($folder, '*') === false)) 2876 if ((strpos($folder, '%') === false) && (strpos($folder, '*') === false)) { 2798 2877 $sub_mboxes = $this->list_unsubscribed('', $folder . $delm . '*'); 2799 else 2878 } 2879 else { 2800 2880 $sub_mboxes = $this->list_unsubscribed(); 2881 } 2801 2882 2802 2883 // send delete command to server … … 2832 2913 // create default folders if they do not exist 2833 2914 foreach ($this->default_folders as $folder) { 2834 if (!$this->folder_exists($folder)) 2915 if (!$this->folder_exists($folder)) { 2835 2916 $this->create_folder($folder, true); 2836 else if (!$this->folder_exists($folder, true)) 2917 } 2918 else if (!$this->folder_exists($folder, true)) { 2837 2919 $this->subscribe($folder); 2920 } 2838 2921 } 2839 2922 } … … 2856 2939 $key = $subscription ? 'subscribed' : 'existing'; 2857 2940 2858 if (is_array($this->icache[$key]) && in_array($folder, $this->icache[$key])) 2941 if (is_array($this->icache[$key]) && in_array($folder, $this->icache[$key])) { 2859 2942 return true; 2943 } 2860 2944 2861 2945 if (!$this->check_connection()) { … … 2992 3076 public function folder_data($folder) 2993 3077 { 2994 if (!strlen($folder)) 3078 if (!strlen($folder)) { 2995 3079 $folder = $this->folder !== null ? $this->folder : 'INBOX'; 3080 } 2996 3081 2997 3082 if ($this->conn->selected != $folder) { … … 2999 3084 return array(); 3000 3085 } 3001 if ($this->conn->select($folder)) 3086 3087 if ($this->conn->select($folder)) { 3002 3088 $this->folder = $folder; 3003 else 3089 } 3090 else { 3004 3091 return null; 3092 } 3005 3093 } 3006 3094 … … 3353 3441 3354 3442 // @TODO: Honor MAXSIZE and DEPTH options 3355 foreach ($queries as $attrib => $entry) 3356 if ($result = $this->conn->getAnnotation($folder, $entry, $attrib)) 3443 foreach ($queries as $attrib => $entry) { 3444 if ($result = $this->conn->getAnnotation($folder, $entry, $attrib)) { 3357 3445 $res = array_merge_recursive($res, $result); 3446 } 3447 } 3358 3448 3359 3449 return $res; … … 3401 3491 } 3402 3492 else { 3403 if ($this->cache) 3493 if ($this->cache) { 3404 3494 $this->cache->close(); 3495 } 3405 3496 $this->cache = null; 3406 3497 $this->caching = false; … … 3478 3569 } 3479 3570 else { 3480 if ($this->mcache) 3571 if ($this->mcache) { 3481 3572 $this->mcache->close(); 3573 } 3482 3574 $this->mcache = null; 3483 3575 $this->messages_caching = false; … … 3529 3621 protected function set_sort_order($sort_field, $sort_order) 3530 3622 { 3531 if ($sort_field != null) 3623 if ($sort_field != null) { 3532 3624 $this->sort_field = asciiwords($sort_field); 3533 if ($sort_order != null) 3625 } 3626 if ($sort_order != null) { 3534 3627 $this->sort_order = strtoupper($sort_order) == 'DESC' ? 'DESC' : 'ASC'; 3628 } 3535 3629 } 3536 3630 … … 3549 3643 // find default folders and skip folders starting with '.' 3550 3644 foreach ($a_folders as $i => $folder) { 3551 if ($folder[0] == '.') 3645 if ($folder[0] == '.') { 3552 3646 continue; 3553 3554 if (($p = array_search($folder, $this->default_folders)) !== false && !$a_defaults[$p]) 3647 } 3648 3649 if (($p = array_search($folder, $this->default_folders)) !== false && !$a_defaults[$p]) { 3555 3650 $a_defaults[$p] = $folder; 3556 else 3651 } 3652 else { 3557 3653 $folders[$folder] = rcube_charset_convert($folder, 'UTF7-IMAP'); 3654 } 3558 3655 } 3559 3656 … … 3640 3737 $folders[$i] = $folder; 3641 3738 3642 if ($mode == 'subscribe') 3739 if ($mode == 'subscribe') { 3643 3740 $updated = $this->conn->subscribe($folder); 3644 else if ($mode == 'unsubscribe') 3741 } 3742 else if ($mode == 'unsubscribe') { 3645 3743 $updated = $this->conn->unsubscribe($folder); 3744 } 3646 3745 } 3647 3746 } … … 3661 3760 protected function set_messagecount($folder, $mode, $increment) 3662 3761 { 3762 if (!is_numeric($increment)) { 3763 return false; 3764 } 3765 3663 3766 $mode = strtoupper($mode); 3664 3767 $a_folder_cache = $this->get_cache('messagecount'); 3665 3768 3666 if (!is_array($a_folder_cache[$folder]) || !isset($a_folder_cache[$folder][$mode]) || !is_numeric($increment))3769 if (!is_array($a_folder_cache[$folder]) || !isset($a_folder_cache[$folder][$mode])) { 3667 3770 return false; 3771 } 3668 3772 3669 3773 // add incremental value to messagecount … … 3671 3775 3672 3776 // there's something wrong, delete from cache 3673 if ($a_folder_cache[$folder][$mode] < 0) 3777 if ($a_folder_cache[$folder][$mode] < 0) { 3674 3778 unset($a_folder_cache[$folder][$mode]); 3779 } 3675 3780 3676 3781 // write back to cache
Note: See TracChangeset
for help on using the changeset viewer.
