Changeset 5765 in subversion


Ignore:
Timestamp:
Jan 13, 2012 3:44:36 AM (16 months ago)
Author:
alec
Message:
  • CS fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-framework/roundcubemail/program/include/rcube_imap.php

    r5759 r5765  
    66 |                                                                       | 
    77 | This file is part of the Roundcube Webmail client                     | 
    8  | Copyright (C) 2005-2011, 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                             | 
    1010 | Licensed under the GNU GPL                                            | 
    1111 |                                                                       | 
    1212 | PURPOSE:                                                              | 
    13  |   IMAP Engine                                                         | 
     13 |   IMAP Storage Engine                                                 | 
    1414 |                                                                       | 
    1515 +-----------------------------------------------------------------------+ 
     
    9090        // Set namespace and delimiter from session, 
    9191        // so some methods would work before connection 
    92         if (isset($_SESSION['imap_namespace'])) 
     92        if (isset($_SESSION['imap_namespace'])) { 
    9393            $this->namespace = $_SESSION['imap_namespace']; 
    94         if (isset($_SESSION['imap_delimiter'])) 
     94        } 
     95        if (isset($_SESSION['imap_delimiter'])) { 
    9596            $this->delimiter = $_SESSION['imap_delimiter']; 
     97        } 
    9698    } 
    9799 
     
    111113    { 
    112114        // check for OpenSSL support in PHP build 
    113         if ($use_ssl && extension_loaded('openssl')) 
     115        if ($use_ssl && extension_loaded('openssl')) { 
    114116            $this->options['ssl_mode'] = $use_ssl == 'imaps' ? 'ssl' : $use_ssl; 
     117        } 
    115118        else if ($use_ssl) { 
    116119            raise_error(array('code' => 403, 'type' => 'imap', 
     
    140143                    'attempt' => ++$attempt))); 
    141144 
    142             if (!empty($data['pass'])) 
     145            if (!empty($data['pass'])) { 
    143146                $pass = $data['pass']; 
     147            } 
    144148 
    145149            $this->conn->connect($data['host'], $data['user'], $pass, $data); 
     
    294298    public function set_folder($folder) 
    295299    { 
    296         if ($this->folder == $folder) 
     300        if ($this->folder == $folder) { 
    297301            return; 
     302        } 
    298303 
    299304        $this->folder = $folder; 
     
    540545        // count search set 
    541546        if ($this->search_string && $folder == $this->folder && ($mode == 'ALL' || $mode == 'THREADS') && !$force) { 
    542             if ($mode == 'ALL') 
     547            if ($mode == 'ALL') { 
    543548                return $this->search_set->countMessages(); 
    544             else 
     549            } 
     550            else { 
    545551                return $this->search_set->count(); 
     552            } 
    546553        } 
    547554 
     
    549556 
    550557        // 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])) { 
    552559            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])) { 
    555563            $a_folder_cache[$folder] = array(); 
     564        } 
    556565 
    557566        if ($mode == 'THREADS') { 
     
    608617        } 
    609618        else { 
    610             if ($mode == 'UNSEEN') 
     619            if ($mode == 'UNSEEN') { 
    611620                $count = $this->conn->countUnseen($folder); 
     621            } 
    612622            else { 
    613623                $count = $this->conn->countMessages($folder); 
     
    691701        $index->slice($from, $to - $from); 
    692702 
    693         if ($slice) 
     703        if ($slice) { 
    694704            $index->slice(-$slice, $slice); 
     705        } 
    695706 
    696707        // fetch reqested messages headers 
     
    715726    { 
    716727        // get all threads (not sorted) 
    717         if ($mcache = $this->get_mcache_engine()) 
     728        if ($mcache = $this->get_mcache_engine()) { 
    718729            $threads = $mcache->get_thread($folder); 
    719         else 
     730        } 
     731        else { 
    720732            $threads = $this->fetch_threads($folder); 
     733        } 
    721734 
    722735        return $this->fetch_thread_headers($folder, $threads, $page, $slice); 
     
    775788        $threads->slice($from, $to - $from); 
    776789 
    777         if ($slice) 
     790        if ($slice) { 
    778791            $threads->slice(-$slice, $slice); 
     792        } 
    779793 
    780794        // Get UIDs of all messages in all threads 
     
    855869 
    856870        // return empty array if no messages found 
    857         if ($index->isEmpty()) 
     871        if ($index->isEmpty()) { 
    858872            return array(); 
     873        } 
    859874 
    860875        // quickest method (default sorting) 
     
    939954                $from, min($cnt-$to, $this->page_size)); 
    940955 
    941             if ($slice) 
     956            if ($slice) { 
    942957                $a_msg_headers = array_slice($a_msg_headers, -$slice, $slice); 
     958            } 
    943959 
    944960            return $a_msg_headers; 
     
    961977        // update search_set if previous data was fetched with disabled threading 
    962978        if (!$this->search_threads) { 
    963             if ($this->search_set->isEmpty()) 
     979            if ($this->search_set->isEmpty()) { 
    964980                return array(); 
     981            } 
    965982            $this->search('', $this->search_string, $this->search_charset, $this->sort_field); 
    966983        } 
     
    982999    function fetch_headers($folder, $msgs, $sort = true, $force = false) 
    9831000    { 
    984         if (empty($msgs)) 
     1001        if (empty($msgs)) { 
    9851002            return array(); 
     1003        } 
    9861004 
    9871005        if (!$force && ($mcache = $this->get_mcache_engine())) { 
     
    9971015        } 
    9981016 
    999         if (empty($headers)) 
     1017        if (empty($headers)) { 
    10001018            return array(); 
     1019        } 
    10011020 
    10021021        foreach ($headers as $h) { 
     
    10441063 
    10451064        // got new messages 
    1046         if ($new['maxuid'] > $old['maxuid']) 
     1065        if ($new['maxuid'] > $old['maxuid']) { 
    10471066            $result += 1; 
     1067        } 
    10481068        // some messages has been deleted 
    1049         if ($new['cnt'] < $old['cnt']) 
     1069        if ($new['cnt'] < $old['cnt']) { 
    10501070            $result += 2; 
     1071        } 
    10511072 
    10521073        // @TODO: optional checking for messages flags changes (?) 
     
    10801101    protected function get_folder_stats($folder) 
    10811102    { 
    1082         if ($_SESSION['folders'][$folder]) 
     1103        if ($_SESSION['folders'][$folder]) { 
    10831104            return (array) $_SESSION['folders'][$folder]; 
    1084         else 
    1085             return array(); 
     1105        } 
     1106 
     1107        return array(); 
    10861108    } 
    10871109 
     
    13541376            // Error, try with US-ASCII (RFC5256: SORT/THREAD must support US-ASCII and UTF-8, 
    13551377            // 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') { 
    13571379                $threads = $this->conn->thread($folder, $this->threading, 
    13581380                    $this->convert_criteria($criteria, $charset), true, 'US-ASCII'); 
     1381            } 
    13591382 
    13601383            return $threads; 
     
    13671390            // Error, try with US-ASCII (RFC5256: SORT/THREAD must support US-ASCII and UTF-8, 
    13681391            // 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') { 
    13701393                $messages = $this->conn->sort($folder, $sort_field, 
    13711394                    $this->convert_criteria($criteria, $charset), true, 'US-ASCII'); 
     1395            } 
    13721396 
    13731397            if (!$messages->isError()) { 
     
    13811405 
    13821406        // 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') { 
    13841408            $messages = $this->conn->search($folder, 
    13851409                $this->convert_criteria($criteria, $charset), true); 
     1410        } 
    13861411 
    13871412        $this->search_sorted = false; 
     
    14091434                $string = substr($str, $string_offset - 1, $m[0]); 
    14101435                $string = rcube_charset_convert($string, $charset, $dest_charset); 
    1411                 if ($string === false) 
     1436                if ($string === false) { 
    14121437                    continue; 
     1438                } 
    14131439                $res .= substr($str, $last, $m[1] - $last - 1) . rcube_imap_generic::escape($string); 
    14141440                $last = $m[0] + $string_offset - 1; 
    14151441            } 
    1416             if ($last < strlen($str)) 
     1442            if ($last < strlen($str)) { 
    14171443                $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 { 
    14201448            $res = $str; 
     1449        } 
    14211450 
    14221451        return $res; 
     
    14951524 
    14961525        // message doesn't exist? 
    1497         if (empty($headers)) 
     1526        if (empty($headers)) { 
    14981527            return null; 
     1528        } 
    14991529 
    15001530        // structure might be cached 
     
    15201550 
    15211551        // set message charset from message headers 
    1522         if ($headers->charset) 
     1552        if ($headers->charset) { 
    15231553            $this->struct_charset = $headers->charset; 
    1524         else 
     1554        } 
     1555        else { 
    15251556            $this->struct_charset = $this->structure_charset($structure); 
     1557        } 
    15261558 
    15271559        $headers->ctype = strtolower($headers->ctype); 
     
    15391571                $structure[1] = $m[2]; 
    15401572            } 
    1541             else 
     1573            else { 
    15421574                return $headers; 
     1575            } 
    15431576        } 
    15441577 
     
    15981631            // build parts list for headers pre-fetching 
    15991632            for ($i=0; $i<count($part); $i++) { 
    1600                 if (!is_array($part[$i])) 
     1633                if (!is_array($part[$i])) { 
    16011634                    break; 
     1635                } 
    16021636                // fetch message headers if message/rfc822 
    16031637                // or named part (could contain Content-Location header) 
     
    16231657            $struct->parts = array(); 
    16241658            for ($i=0, $count=0; $i<count($part); $i++) { 
    1625                 if (!is_array($part[$i])) 
     1659                if (!is_array($part[$i])) { 
    16261660                    break; 
     1661                } 
    16271662                $tmp_part_id = $struct->mime_id ? $struct->mime_id.'.'.($i+1) : $i+1; 
    16281663                $struct->parts[] = $this->structure_part($part[$i], ++$count, $struct->mime_id, 
     
    16621697        if (is_array($part[2])) { 
    16631698            $struct->ctype_parameters = array(); 
    1664             for ($i=0; $i<count($part[2]); $i+=2) 
     1699            for ($i=0; $i<count($part[2]); $i+=2) { 
    16651700                $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'])) { 
    16681704                $struct->charset = $struct->ctype_parameters['charset']; 
     1705            } 
    16691706        } 
    16701707 
     
    16811718 
    16821719        // get part size 
    1683         if (!empty($part[6])) 
     1720        if (!empty($part[6])) { 
    16841721            $struct->size = intval($part[6]); 
     1722        } 
    16851723 
    16861724        // read part disposition 
    16871725        $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        } 
    16901732 
    16911733        if (is_array($part[$di]) && count($part[$di]) == 2) { 
    16921734            $struct->disposition = strtolower($part[$di][0]); 
    16931735 
    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) { 
    16961738                    $struct->d_parameters[strtolower($part[$di][1][$n])] = $part[$di][1][$n+1]; 
     1739                } 
     1740            } 
    16971741        } 
    16981742 
     
    17011745            $struct->parts = array(); 
    17021746            for ($i=0, $count=0; $i<count($part[8]); $i++) { 
    1703                 if (!is_array($part[8][$i])) 
     1747                if (!is_array($part[8][$i])) { 
    17041748                    break; 
     1749                } 
    17051750                $struct->parts[] = $this->structure_part($part[8][$i], ++$count, $struct->mime_id); 
    17061751            } 
     
    17121757            $struct->headers['content-id'] = $part[3]; 
    17131758 
    1714             if (empty($struct->disposition)) 
     1759            if (empty($struct->disposition)) { 
    17151760                $struct->disposition = 'inline'; 
     1761            } 
    17161762        } 
    17171763 
     
    17231769            } 
    17241770 
    1725             if (is_string($mime_headers)) 
     1771            if (is_string($mime_headers)) { 
    17261772                $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)) { 
    17281775                $struct->headers = get_object_vars($mime_headers) + $struct->headers; 
     1776            } 
    17291777 
    17301778            // get real content-type of message/rfc822 
    17311779            if ($struct->mimetype == 'message/rfc822') { 
    17321780                // single-part 
    1733                 if (!is_array($part[8][0])) 
     1781                if (!is_array($part[8][0])) { 
    17341782                    $struct->real_mimetype = strtolower($part[8][0] . '/' . $part[8][1]); 
     1783                } 
    17351784                // multi-part 
    17361785                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])) { 
    17391788                            break; 
     1789                        } 
     1790                    } 
    17401791                    $struct->real_mimetype = 'multipart/' . strtolower($part[8][$n]); 
    17411792                } 
     
    17431794 
    17441795            if ($struct->ctype_primary == 'message' && empty($struct->parts)) { 
    1745                 if (is_array($part[8]) && $di != 8) 
     1796                if (is_array($part[8]) && $di != 8) { 
    17461797                    $struct->parts[] = $this->structure_part($part[8], ++$count, $struct->mime_id); 
     1798                } 
    17471799            } 
    17481800        } 
     
    17631815    protected function set_part_filename(&$part, $headers=null) 
    17641816    { 
    1765         if (!empty($part->d_parameters['filename'])) 
     1817        if (!empty($part->d_parameters['filename'])) { 
    17661818            $filename_mime = $part->d_parameters['filename']; 
    1767         else if (!empty($part->d_parameters['filename*'])) 
     1819        } 
     1820        else if (!empty($part->d_parameters['filename*'])) { 
    17681821            $filename_encoded = $part->d_parameters['filename*']; 
    1769         else if (!empty($part->ctype_parameters['name*'])) 
     1822        } 
     1823        else if (!empty($part->ctype_parameters['name*'])) { 
    17701824            $filename_encoded = $part->ctype_parameters['name*']; 
     1825        } 
    17711826        // RFC2231 value continuations 
    17721827        // TODO: this should be rewrited to support RFC2231 4.1 combinations 
     
    18501905        } 
    18511906        // 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'])) { 
    18531908            $filename_mime = $part->ctype_parameters['name']; 
     1909        } 
    18541910        // Content-Disposition 
    1855         else if (!empty($part->headers['content-description'])) 
     1911        else if (!empty($part->headers['content-description'])) { 
    18561912            $filename_mime = $part->headers['content-description']; 
    1857         else 
     1913        } 
     1914        else { 
    18581915            return; 
     1916        } 
    18591917 
    18601918        // decode filename 
    18611919        if (!empty($filename_mime)) { 
    1862             if (!empty($part->charset)) 
     1920            if (!empty($part->charset)) { 
    18631921                $charset = $part->charset; 
    1864             else if (!empty($this->struct_charset)) 
     1922            } 
     1923            else if (!empty($this->struct_charset)) { 
    18651924                $charset = $this->struct_charset; 
    1866             else 
     1925            } 
     1926            else { 
    18671927                $charset = rc_detect_encoding($filename_mime, $this->default_charset); 
     1928            } 
    18681929 
    18691930            $part->filename = rcube_mime::decode_mime_string($filename_mime, $charset); 
     
    18911952    { 
    18921953        while (is_array($structure)) { 
    1893             if (is_array($structure[2]) && $structure[2][0] == 'charset') 
     1954            if (is_array($structure[2]) && $structure[2][0] == 'charset') { 
    18941955                return $structure[2][1]; 
     1956            } 
    18951957            $structure = $structure[0]; 
    18961958        } 
     
    19472009                if (!$o_part->charset || strtoupper($o_part->charset) == 'US-ASCII') { 
    19482010                    // 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)) { 
    19502012                        $o_part->charset = strtoupper($m[1]); 
    1951                     else 
     2013                    } 
     2014                    else { 
    19522015                        $o_part->charset = $this->default_charset; 
     2016                    } 
    19532017                } 
    19542018                $body = rcube_charset_convert($body, $o_part->charset); 
     
    20322096        list($uids, $all_mode) = $this->parse_uids($uids); 
    20332097 
    2034         if (strpos($flag, 'UN') === 0) 
     2098        if (strpos($flag, 'UN') === 0) { 
    20352099            $result = $this->conn->unflag($folder, $uids, substr($flag, 2)); 
    2036         else 
     2100        } 
     2101        else { 
    20372102            $result = $this->conn->flag($folder, $uids, $flag); 
     2103        } 
    20382104 
    20392105        if ($result) { 
     
    20792145        // make sure folder exists 
    20802146        if ($this->folder_exists($folder)) { 
    2081             if ($is_file) 
     2147            if ($is_file) { 
    20822148                $saved = $this->conn->appendFromFile($folder, $message, $headers); 
    2083             else 
     2149            } 
     2150            else { 
    20842151                $saved = $this->conn->append($folder, $message); 
     2152            } 
    20852153        } 
    20862154 
     
    21672235            if ($this->search_set && $from_mbox == $this->folder) { 
    21682236                // threads are too complicated to just remove messages from set 
    2169                 if ($this->search_threads || $all_mode) 
     2237                if ($this->search_threads || $all_mode) { 
    21702238                    $this->refresh_search(); 
    2171                 else 
     2239                } 
     2240                else { 
    21722241                    $this->search_set->filter(explode(',', $uids)); 
     2242                } 
    21732243            } 
    21742244 
     
    22712341            if ($this->search_set && $folder == $this->folder) { 
    22722342                // threads are too complicated to just remove messages from set 
    2273                 if ($this->search_threads || $all_mode) 
     2343                if ($this->search_threads || $all_mode) { 
    22742344                    $this->refresh_search(); 
    2275                 else 
     2345                } 
     2346                else { 
    22762347                    $this->search_set->filter(explode(',', $uids)); 
     2348                } 
    22772349            } 
    22782350 
     
    22962368    public function expunge_message($uids, $folder = null, $clear_cache = true) 
    22972369    { 
    2298         if ($uids && $this->get_capability('UIDPLUS')) 
     2370        if ($uids && $this->get_capability('UIDPLUS')) { 
    22992371            list($uids, $all_mode) = $this->parse_uids($uids); 
    2300         else 
     2372        } 
     2373        else { 
    23012374            $uids = null; 
     2375        } 
    23022376 
    23032377        if (!strlen($folder)) { 
     
    23232397 
    23242398        // CLOSE(+SELECT) should be faster than EXPUNGE 
    2325         if (empty($uids) || $all_mode) 
     2399        if (empty($uids) || $all_mode) { 
    23262400            $result = $this->conn->close(); 
    2327         else 
     2401        } 
     2402        else { 
    23282403            $result = $this->conn->expunge($folder, $uids); 
     2404        } 
    23292405 
    23302406        if ($result && $clear_cache) { 
     
    26152691        foreach ($a_folders as $idx => $folder) { 
    26162692            $myrights = join('', (array)$this->my_rights($folder)); 
    2617             if ($myrights !== null && !preg_match($regex, $myrights)) 
     2693            if ($myrights !== null && !preg_match($regex, $myrights)) { 
    26182694                unset($a_folders[$idx]); 
     2695            } 
    26192696        } 
    26202697 
     
    26552732        $result = $this->conn->fetchHeaderIndex($folder, '1:*', 'SIZE', false); 
    26562733 
    2657         if (is_array($result)) 
     2734        if (is_array($result)) { 
    26582735            $result = array_sum($result); 
     2736        } 
    26592737 
    26602738        return $result; 
     
    27112789            $this->clear_cache('mailboxes', true); 
    27122790 
    2713             if ($subscribe) 
     2791            if ($subscribe) { 
    27142792                $this->subscribe($folder); 
     2793            } 
    27152794        } 
    27162795 
     
    27952874 
    27962875        // get list of folders 
    2797         if ((strpos($folder, '%') === false) && (strpos($folder, '*') === false)) 
     2876        if ((strpos($folder, '%') === false) && (strpos($folder, '*') === false)) { 
    27982877            $sub_mboxes = $this->list_unsubscribed('', $folder . $delm . '*'); 
    2799         else 
     2878        } 
     2879        else { 
    28002880            $sub_mboxes = $this->list_unsubscribed(); 
     2881        } 
    28012882 
    28022883        // send delete command to server 
     
    28322913        // create default folders if they do not exist 
    28332914        foreach ($this->default_folders as $folder) { 
    2834             if (!$this->folder_exists($folder)) 
     2915            if (!$this->folder_exists($folder)) { 
    28352916                $this->create_folder($folder, true); 
    2836             else if (!$this->folder_exists($folder, true)) 
     2917            } 
     2918            else if (!$this->folder_exists($folder, true)) { 
    28372919                $this->subscribe($folder); 
     2920            } 
    28382921        } 
    28392922    } 
     
    28562939        $key  = $subscription ? 'subscribed' : 'existing'; 
    28572940 
    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])) { 
    28592942            return true; 
     2943        } 
    28602944 
    28612945        if (!$this->check_connection()) { 
     
    29923076    public function folder_data($folder) 
    29933077    { 
    2994         if (!strlen($folder)) 
     3078        if (!strlen($folder)) { 
    29953079            $folder = $this->folder !== null ? $this->folder : 'INBOX'; 
     3080        } 
    29963081 
    29973082        if ($this->conn->selected != $folder) { 
     
    29993084                return array(); 
    30003085            } 
    3001             if ($this->conn->select($folder)) 
     3086 
     3087            if ($this->conn->select($folder)) { 
    30023088                $this->folder = $folder; 
    3003             else 
     3089            } 
     3090            else { 
    30043091                return null; 
     3092            } 
    30053093        } 
    30063094 
     
    33533441 
    33543442            // @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)) { 
    33573445                    $res = array_merge_recursive($res, $result); 
     3446                } 
     3447            } 
    33583448 
    33593449            return $res; 
     
    34013491        } 
    34023492        else { 
    3403             if ($this->cache) 
     3493            if ($this->cache) { 
    34043494                $this->cache->close(); 
     3495            } 
    34053496            $this->cache   = null; 
    34063497            $this->caching = false; 
     
    34783569        } 
    34793570        else { 
    3480             if ($this->mcache) 
     3571            if ($this->mcache) { 
    34813572                $this->mcache->close(); 
     3573            } 
    34823574            $this->mcache = null; 
    34833575            $this->messages_caching = false; 
     
    35293621    protected function set_sort_order($sort_field, $sort_order) 
    35303622    { 
    3531         if ($sort_field != null) 
     3623        if ($sort_field != null) { 
    35323624            $this->sort_field = asciiwords($sort_field); 
    3533         if ($sort_order != null) 
     3625        } 
     3626        if ($sort_order != null) { 
    35343627            $this->sort_order = strtoupper($sort_order) == 'DESC' ? 'DESC' : 'ASC'; 
     3628        } 
    35353629    } 
    35363630 
     
    35493643        // find default folders and skip folders starting with '.' 
    35503644        foreach ($a_folders as $i => $folder) { 
    3551             if ($folder[0] == '.') 
     3645            if ($folder[0] == '.') { 
    35523646                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]) { 
    35553650                $a_defaults[$p] = $folder; 
    3556             else 
     3651            } 
     3652            else { 
    35573653                $folders[$folder] = rcube_charset_convert($folder, 'UTF7-IMAP'); 
     3654            } 
    35583655        } 
    35593656 
     
    36403737                $folders[$i] = $folder; 
    36413738 
    3642                 if ($mode == 'subscribe') 
     3739                if ($mode == 'subscribe') { 
    36433740                    $updated = $this->conn->subscribe($folder); 
    3644                 else if ($mode == 'unsubscribe') 
     3741                } 
     3742                else if ($mode == 'unsubscribe') { 
    36453743                    $updated = $this->conn->unsubscribe($folder); 
     3744                } 
    36463745            } 
    36473746        } 
     
    36613760    protected function set_messagecount($folder, $mode, $increment) 
    36623761    { 
     3762        if (!is_numeric($increment)) { 
     3763            return false; 
     3764        } 
     3765 
    36633766        $mode = strtoupper($mode); 
    36643767        $a_folder_cache = $this->get_cache('messagecount'); 
    36653768 
    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])) { 
    36673770            return false; 
     3771        } 
    36683772 
    36693773        // add incremental value to messagecount 
     
    36713775 
    36723776        // there's something wrong, delete from cache 
    3673         if ($a_folder_cache[$folder][$mode] < 0) 
     3777        if ($a_folder_cache[$folder][$mode] < 0) { 
    36743778            unset($a_folder_cache[$folder][$mode]); 
     3779        } 
    36753780 
    36763781        // write back to cache 
Note: See TracChangeset for help on using the changeset viewer.