Changeset c435173 in github


Ignore:
Timestamp:
May 19, 2010 2:41:02 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
b62a0d2
Parents:
98ef63c
Message:
  • Fix handling errors of folder deletion (#1486705)
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r1d51658 rc435173  
    22=========================== 
    33 
     4- Fix handling errors of folder deletion (#1486705) 
    45- Parse untagged CAPABILITY response for LOGIN command (#1486742) 
    56- Renamed all php-cli scripts to use .sh extension 
  • program/include/rcube_imap.php

    r677e1f2 rc435173  
    2727 * @package    Mail 
    2828 * @author     Thomas Bruederli <roundcube@gmail.com> 
    29  * @author     Aleksander Machniak <alec@alec.pl>  
     29 * @author     Aleksander Machniak <alec@alec.pl> 
    3030 * @version    2.0 
    3131 */ 
     
    5454    private $icache = array(); 
    5555    private $cache = array(); 
    56     private $cache_keys = array();   
     56    private $cache_keys = array(); 
    5757    private $cache_changes = array(); 
    5858    private $uid_id_map = array(); 
     
    109109            $data = rcmail::get_instance()->plugins->exec_hook('imap_connect', 
    110110                array('host' => $host, 'user' => $user, 'attempt' => ++$attempt)); 
    111              
     111 
    112112            if (!empty($data['pass'])) 
    113113                $pass = $data['pass']; 
     
    155155     */ 
    156156    function close() 
    157     {     
     157    { 
    158158        if ($this->conn && $this->conn->connected()) 
    159159            $this->conn->close(); 
     
    172172        $this->close(); 
    173173        $this->connect($this->host, $this->user, $this->pass, $this->port, $this->ssl); 
    174      
     174 
    175175        // issue SELECT command to restore connection status 
    176176        if ($this->mailbox) 
     
    202202        $this->root_dir = $root; 
    203203        $this->options['rootdir'] = $root; 
    204      
     204 
    205205        if (empty($this->delimiter)) 
    206206            $this->get_hierarchy_delimiter(); 
     
    284284        $this->page_size = (int)$size; 
    285285    } 
    286      
     286 
    287287 
    288288    /** 
     
    359359    { 
    360360        $this->threading = false; 
    361      
     361 
    362362        if ($enable) { 
    363363            if ($this->get_capability('THREAD=REFS')) 
     
    445445                return count((array)$this->search_set); 
    446446        } 
    447      
     447 
    448448        $a_mailbox_cache = $this->get_cache('messagecount'); 
    449      
     449 
    450450        // return cached value 
    451451        if (!$force && is_array($a_mailbox_cache[$mailbox]) && isset($a_mailbox_cache[$mailbox][$mode])) 
     
    481481            $index = $this->_search_index($mailbox, $search_str); 
    482482            $this->threading = $threads; 
    483        
     483 
    484484            $count = is_array($index) ? count($index) : 0; 
    485485 
     
    520520        if (!empty($this->icache['threads'])) 
    521521            return count($this->icache['threads']['tree']); 
    522      
     522 
    523523        list ($thread_tree, $msg_depth, $has_children) = $this->_fetch_threads($mailbox); 
    524      
     524 
    525525        $msg_count = count($msg_depth); 
    526526 
    527527//    $this->update_thread_cache($mailbox, $thread_tree, $msg_depth, $has_children); 
    528         return count($thread_tree);   
     528        return count($thread_tree); 
    529529    } 
    530530 
     
    540540     * @param   boolean  Number of slice items to extract from result array 
    541541     * @return  array    Indexed array with message header objects 
    542      * @access  public    
     542     * @access  public 
    543543     */ 
    544544    function list_headers($mbox_name='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $slice=0) 
     
    655655        if (!is_array($a_msg_headers) || empty($a_msg_headers)) 
    656656            return array(); 
    657      
     657 
    658658        // use this class for message sorting 
    659659        $sorter = new rcube_header_sorter(); 
     
    662662 
    663663        if ($this->sort_order == 'DESC') 
    664             $a_msg_headers = array_reverse($a_msg_headers);          
     664            $a_msg_headers = array_reverse($a_msg_headers); 
    665665 
    666666        return array_values($a_msg_headers); 
     
    708708            list ($thread_tree, $msg_depth, $has_children) = $this->conn->thread( 
    709709                $mailbox, $this->threading, $this->skip_deleted ? 'UNDELETED' : ''); 
    710     
     710 
    711711            // add to internal (fast) cache 
    712712            $this->icache['threads'] = array(); 
     
    757757        if (!is_array($a_msg_headers) || empty($a_msg_headers)) 
    758758            return array(); 
    759      
     759 
    760760        // use this class for message sorting 
    761761        $sorter = new rcube_header_sorter(); 
     
    826826        if ($this->search_threads) 
    827827            $this->search('', $this->search_string, $this->search_charset, $sort_field); 
    828      
     828 
    829829        $msgs = $this->search_set; 
    830830        $a_msg_headers = array(); 
     
    910910                // for small result set we can fetch all messages headers 
    911911                $this->_fetch_headers($mailbox, join(',', $msgs), $a_msg_headers, NULL); 
    912      
     912 
    913913                // return empty array if no messages found 
    914914                if (!is_array($a_msg_headers) || empty($a_msg_headers)) 
     
    978978    { 
    979979        $start_msg = ($page-1) * $this->page_size; 
    980      
     980 
    981981        if ($page=='all') { 
    982982            $begin  = 0; 
     
    995995        if ($end < 0) $end = $max; 
    996996        if ($end > $max) $end = $max; 
    997      
     997 
    998998        return array($begin, $end); 
    999999    } 
    1000      
     1000 
    10011001 
    10021002    /** 
     
    10401040        return count($a_msg_headers); 
    10411041    } 
    1042    
     1042 
    10431043 
    10441044    /** 
     
    10561056        $old = $this->get_folder_stats($mailbox); 
    10571057 
    1058         // refresh message count -> will update  
     1058        // refresh message count -> will update 
    10591059        $this->_messagecount($mailbox, 'ALL', true); 
    10601060 
     
    11511151                $a_index = $this->conn->fetchHeaderIndex($mailbox, 
    11521152                        join(',', $this->search_set), $this->sort_field, $this->skip_deleted); 
    1153                  
     1153 
    11541154                if (is_array($a_index)) { 
    11551155                    if ($this->sort_order=="ASC") 
     
    12001200                if ($this->sort_order == 'DESC') 
    12011201                    $a_index = array_reverse($a_index); 
    1202          
     1202 
    12031203                $this->cache[$key] = $a_index; 
    12041204                } 
     
    12101210            else if ($this->sort_order=="DESC") 
    12111211                arsort($a_index); 
    1212          
     1212 
    12131213            $this->cache[$key] = array_keys($a_index); 
    12141214        } 
     
    12591259 
    12601260        $this->cache[$key] = $this->_flatten_threads($mailbox, $thread_tree); 
    1261      
     1261 
    12621262        return $this->cache[$key]; 
    12631263    } 
     
    12841284        if ($this->sort_order == 'DESC') 
    12851285            $msg_index = array_reverse($msg_index); 
    1286            
     1286 
    12871287        // flatten threads array 
    12881288        $all_ids = array(); 
     
    13071307        // fetch complete message index 
    13081308        $a_message_index = $this->conn->fetchHeaderIndex($mailbox, "1:*", 'UID', $this->skip_deleted); 
    1309      
     1309 
    13101310        if ($a_message_index === false) 
    13111311            return false; 
    1312          
     1312 
    13131313        foreach ($a_message_index as $id => $uid) { 
    13141314            // message in cache at correct position 
     
    13221322                unset($cache_index[$id]); 
    13231323            } 
    1324        
     1324 
    13251325            // other message at this position 
    13261326            if (isset($cache_index[$id])) { 
     
    13281328                unset($cache_index[$id]); 
    13291329            } 
    1330          
     1330 
    13311331            $for_update[] = $id; 
    13321332        } 
    13331333 
    1334         // clear messages at wrong positions and those deleted that are still in cache_index       
     1334        // clear messages at wrong positions and those deleted that are still in cache_index 
    13351335        if (!empty($for_remove)) 
    13361336            $cache_index = array_merge($cache_index, $for_remove); 
    1337      
     1337 
    13381338        if (!empty($cache_index)) 
    13391339            $this->remove_message_cache($cache_key, $cache_index); 
     
    13661366        if (!$str) 
    13671367            return false; 
    1368      
     1368 
    13691369        $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    13701370 
     
    14561456//      $a_mailbox_cache[$mailbox][$criteria] = sizeof($a_messages); 
    14571457//      $this->update_cache('messagecount', $a_mailbox_cache); 
    1458          
     1458 
    14591459        return $a_messages; 
    14601460    } 
    1461      
     1461 
    14621462 
    14631463    /** 
     
    14751475        if (!$str) 
    14761476            return false; 
    1477      
     1477 
    14781478        $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    14791479 
     
    14811481    } 
    14821482 
    1483    
     1483 
    14841484    /** 
    14851485     * Sort thread 
     
    15411541        if (empty($tree)) 
    15421542            return array(); 
    1543      
     1543 
    15441544        $index = array_combine(array_values($index), $index); 
    15451545 
     
    15541554        } 
    15551555 
    1556         $index = array_values($index);   
     1556        $index = array_values($index); 
    15571557 
    15581558        // create sorted array of roots 
     
    15881588        return $this->get_search_set(); 
    15891589    } 
    1590    
    1591    
     1590 
     1591 
    15921592    /** 
    15931593     * Check if the given message ID is part of the current search set 
     
    16121612     * 
    16131613     * @param int     Message ID 
    1614      * @param string  Mailbox to read from  
     1614     * @param string  Mailbox to read from 
    16151615     * @param boolean True if $id is the message UID 
    16161616     * @param boolean True if we need also BODYSTRUCTURE in headers 
     
    16761676            $this->struct_charset = $this->_structure_charset($structure); 
    16771677 
    1678         // Here we can recognize malformed BODYSTRUCTURE and  
     1678        // Here we can recognize malformed BODYSTRUCTURE and 
    16791679        // 1. [@TODO] parse the message in other way to create our own message structure 
    16801680        // 2. or just show the raw message body. 
     
    17041704    } 
    17051705 
    1706    
     1706 
    17071707    /** 
    17081708     * Build message part object 
     
    17181718        if (is_array($part[0])) { 
    17191719            $struct->ctype_primary = 'multipart'; 
    1720        
     1720 
    17211721            // find first non-array entry 
    17221722            for ($i=1; $i<count($part); $i++) { 
     
    17261726                } 
    17271727            } 
    1728              
     1728 
    17291729            $struct->mimetype = 'multipart/'.$struct->ctype_secondary; 
    17301730 
     
    17461746                } 
    17471747            } 
    1748          
     1748 
    17491749            // pre-fetch headers of all parts (in one command for better performance) 
    17501750            // @TODO: we could do this before _structure_part() call, to fetch 
     
    17811781            for ($i=0; $i<count($part[2]); $i+=2) 
    17821782                $struct->ctype_parameters[strtolower($part[2][$i])] = $part[2][$i+1]; 
    1783          
     1783 
    17841784            if (isset($struct->ctype_parameters['charset'])) 
    17851785                $struct->charset = $struct->ctype_parameters['charset']; 
    17861786        } 
    1787      
     1787 
    17881788        // read content encoding 
    17891789        if (!empty($part[5]) && $part[5]!='NIL') { 
     
    17911791            $struct->headers['content-transfer-encoding'] = $struct->encoding; 
    17921792        } 
    1793      
     1793 
    17941794        // get part size 
    17951795        if (!empty($part[6]) && $part[6]!='NIL') 
     
    18061806                    $struct->d_parameters[strtolower($part[$di][1][$n])] = $part[$di][1][$n+1]; 
    18071807        } 
    1808        
     1808 
    18091809        // get child parts 
    18101810        if (is_array($part[8]) && $di != 8) { 
     
    18191819            $struct->content_id = $part[3]; 
    18201820            $struct->headers['content-id'] = $part[3]; 
    1821      
     1821 
    18221822            if (empty($struct->disposition)) 
    18231823                $struct->disposition = 'inline'; 
    18241824        } 
    1825      
     1825 
    18261826        // fetch message headers if message/rfc822 or named part (could contain Content-Location header) 
    18271827        if ($struct->ctype_primary == 'message' || ($struct->ctype_parameters['name'] && !$struct->content_id)) { 
     
    18431843                if (preg_match('/^([a-z0-9_\/-]+)/i', $struct->real_headers['content-type'], $matches)) { 
    18441844                    $struct->real_mimetype = strtolower($matches[1]); 
    1845                 }                                                     
     1845                } 
    18461846            } 
    18471847        } 
     
    18571857        return $struct; 
    18581858    } 
    1859      
    1860  
    1861     /** 
    1862      * Set attachment filename from message part structure  
     1859 
     1860 
     1861    /** 
     1862     * Set attachment filename from message part structure 
    18631863     * 
    18641864     * @access private 
     
    19651965        // decode filename 
    19661966        if (!empty($filename_mime)) { 
    1967             $part->filename = rcube_imap::decode_mime_string($filename_mime,  
     1967            $part->filename = rcube_imap::decode_mime_string($filename_mime, 
    19681968                $part->charset ? $part->charset : ($this->struct_charset ? $this->struct_charset : 
    19691969                rc_detect_encoding($filename_mime, $this->default_charset))); 
    1970         }  
     1970        } 
    19711971        else if (!empty($filename_encoded)) { 
    19721972            // decode filename according to RFC 2231, Section 4 
     
    19941994            $structure = $structure[0]; 
    19951995        } 
    1996     }  
     1996    } 
    19971997 
    19981998 
     
    20112011        // get part encoding if not provided 
    20122012        if (!is_object($o_part)) { 
    2013             $structure_str = $this->conn->fetchStructureString($this->mailbox, $uid, true);  
     2013            $structure_str = $this->conn->fetchStructureString($this->mailbox, $uid, true); 
    20142014            $structure = new rcube_mime_struct(); 
    20152015            // error or message not found 
     
    20232023            $o_part->charset       = $structure->getPartCharset($part); 
    20242024        } 
    2025        
     2025 
    20262026        // TODO: Add caching for message parts 
    20272027 
     
    20422042            $body = rcube_charset_convert($body, $o_part->charset); 
    20432043        } 
    2044      
     2044 
    20452045        return $body; 
    20462046    } 
     
    20842084        return $this->conn->fetchPartHeader($this->mailbox, $uid, true); 
    20852085    } 
    2086      
     2086 
    20872087 
    20882088    /** 
     
    20902090     * 
    20912091     * @param int  Message UID 
    2092      */  
     2092     */ 
    20932093    function print_raw_body($uid) 
    20942094    { 
     
    23392339            // unset threads internal cache 
    23402340            unset($this->icache['threads']); 
    2341        
     2341 
    23422342            // remove message ids from search set 
    23432343            if ($this->search_set && $mailbox == $this->mailbox) { 
     
    23752375        $mailbox = !empty($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    23762376        $msg_count = $this->_messagecount($mailbox, 'ALL'); 
    2377      
     2377 
    23782378        if (!$msg_count) { 
    23792379            return 0; 
    23802380        } 
    2381          
     2381 
    23822382        $cleared = $this->conn->clearFolder($mailbox); 
    2383        
     2383 
    23842384        // make sure the message count cache is cleared as well 
    23852385        if ($cleared) { 
    2386             $this->clear_message_cache($mailbox.'.msg');       
     2386            $this->clear_message_cache($mailbox.'.msg'); 
    23872387            $a_mailbox_cache = $this->get_cache('messagecount'); 
    23882388            unset($a_mailbox_cache[$mailbox]); 
    23892389            $this->update_cache('messagecount', $a_mailbox_cache); 
    23902390        } 
    2391          
     2391 
    23922392        return $cleared; 
    23932393    } 
     
    24202420    private function _expunge($mailbox, $clear_cache=true, $uids=NULL) 
    24212421    { 
    2422         if ($uids && $this->get_capability('UIDPLUS'))  
     2422        if ($uids && $this->get_capability('UIDPLUS')) 
    24232423            $a_uids = is_array($uids) ? join(',', $uids) : $uids; 
    24242424        else 
     
    24312431            $this->_clear_messagecount($mailbox); 
    24322432        } 
    2433        
     2433 
    24342434        return $result; 
    24352435    } 
     
    24412441     * @param mixed  UIDs array or comma-separated list or '*' or '1:*' 
    24422442     * @param string Mailbox name 
    2443      * @return array Two elements array with UIDs converted to list and ALL flag  
     2443     * @return array Two elements array with UIDs converted to list and ALL flag 
    24442444     * @access private 
    24452445     */ 
     
    24582458                else 
    24592459                    $uids = $this->conn->fetchUIDs($mailbox, $this->search_set); 
    2460        
     2460 
    24612461                // save ID-to-UID mapping in local cache 
    24622462                if (is_array($uids)) 
     
    24862486     * @return int   Message ID 
    24872487     */ 
    2488     function get_id($uid, $mbox_name=NULL)  
     2488    function get_id($uid, $mbox_name=NULL) 
    24892489    { 
    24902490        $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
     
    25542554    { 
    25552555        $a_defaults = $a_out = array(); 
    2556      
    2557         // get cached folder list     
     2556 
     2557        // get cached folder list 
    25582558        $a_mboxes = $this->get_cache('mailboxes'); 
    25592559        if (is_array($a_mboxes)) 
     
    25632563        $data = rcmail::get_instance()->plugins->exec_hook('list_mailboxes', 
    25642564            array('root'=>$root,'filter'=>$filter)); 
    2565      
     2565 
    25662566        if (isset($data['folders'])) { 
    25672567            $a_folders = $data['folders']; 
     
    25712571            $a_folders = $this->conn->listSubscribed($this->mod_mailbox($root), $filter); 
    25722572        } 
    2573      
     2573 
    25742574        if (!is_array($a_folders) || !sizeof($a_folders)) 
    25752575            $a_folders = array(); 
     
    25772577        // write mailboxlist to cache 
    25782578        $this->update_cache('mailboxes', $a_folders); 
    2579      
     2579 
    25802580        return $a_folders; 
    25812581    } 
     
    25842584    /** 
    25852585     * Get a list of all folders available on the IMAP server 
    2586      *  
     2586     * 
    25872587     * @param string IMAP root dir 
    25882588     * @return array Indexed array with folder names 
     
    25912591    { 
    25922592        static $a_folders; 
    2593      
     2593 
    25942594        if (is_array($a_folders)) 
    25952595            return $a_folders; 
    2596        
     2596 
    25972597        // retrieve list of folders from IMAP server 
    25982598        $a_mboxes = $this->conn->listMailboxes($this->mod_mailbox($root), '*'); 
     
    26182618     * Get mailbox quota information 
    26192619     * added by Nuny 
    2620      *  
     2620     * 
    26212621     * @return mixed Quota info or False if not supported 
    26222622     */ 
     
    26252625        if ($this->get_capability('QUOTA')) 
    26262626            return $this->conn->getQuota(); 
    2627          
     2627 
    26282628        return false; 
    26292629    } 
     
    26352635     * @param array Mailbox name(s) 
    26362636     * @return boolean True on success 
    2637      */  
     2637     */ 
    26382638    function subscribe($a_mboxes) 
    26392639    { 
     
    26722672    { 
    26732673        $result = false; 
    2674      
     2674 
    26752675        // reduce mailbox name to 100 chars 
    26762676        $name = substr($name, 0, 100); 
     
    27032703        $mailbox = $this->mod_mailbox($mbox_name); 
    27042704        $abs_name = $this->mod_mailbox($name); 
    2705      
     2705 
    27062706        // check if mailbox is subscribed 
    27072707        $a_subscribed = $this->_list_mailboxes(); 
    27082708        $subscribed = in_array($mailbox, $a_subscribed); 
    2709      
     2709 
    27102710        // unsubscribe folder 
    27112711        if ($subscribed) 
     
    27652765                // send delete command to server 
    27662766                $result = $this->conn->deleteFolder($mailbox); 
    2767                 if ($result >= 0) { 
     2767                if ($result) { 
    27682768                    $deleted = true; 
    27692769                    $this->clear_message_cache($mailbox.'.msg'); 
     
    27742774                        $this->conn->unsubscribe($c_mbox); 
    27752775                        $result = $this->conn->deleteFolder($c_mbox); 
    2776                         if ($result >= 0) { 
     2776                        if ($result) { 
    27772777                            $deleted = true; 
    27782778                            $this->clear_message_cache($c_mbox.'.msg'); 
     
    28292829                $a_folders = $this->conn->listMailboxes($this->mod_mailbox(''), $mbox_name); 
    28302830                } 
    2831                  
     2831 
    28322832            if (is_array($a_folders) && in_array($this->mod_mailbox($mbox_name), $a_folders)) { 
    28332833                $this->icache[$key][] = $mbox_name; 
     
    28582858                $mbox_name = substr($mbox_name, strlen($this->root_dir)+1); 
    28592859        } 
    2860      
     2860 
    28612861        return $mbox_name; 
    28622862    } 
     
    28872887            return $this->_read_cache_record($key); 
    28882888        } 
    2889      
     2889 
    28902890        return $this->cache[$key]; 
    28912891    } 
     
    29212921        if (!$this->caching_enabled) 
    29222922            return; 
    2923      
     2923 
    29242924        if ($key===NULL) { 
    29252925            foreach ($this->cache as $key => $data) 
     
    30163016            $_SESSION['user_id'], 
    30173017            'IMAP.'.$key); 
    3018        
     3018 
    30193019        unset($this->cache_keys[$key]); 
    30203020    } 
     
    30253025     *   message caching methods 
    30263026     * --------------------------------*/ 
    3027     
     3027 
    30283028    /** 
    30293029     * Checks if the cache is up-to-date 
     
    30723072                $uid = $this->conn->ID2UID($mailbox, $msg_count); 
    30733073                $cache_uid = array_pop($cache_index); 
    3074        
     3074 
    30753075                // uids of highest message matches -> cache seems OK 
    30763076                if ($cache_uid == $uid) 
     
    30933093    { 
    30943094        $cache_key = "$key:$from:$to:$sort_field:$sort_order"; 
    3095      
     3095 
    30963096        // use idx sort as default sorting 
    30973097        if (!$sort_field || !in_array($sort_field, $this->db_header_fields)) { 
    30983098            $sort_field = 'idx'; 
    30993099        } 
    3100      
     3100 
    31013101        if ($this->caching_enabled && !isset($this->cache[$cache_key])) { 
    31023102            $this->cache[$cache_key] = array(); 
     
    31323132    { 
    31333133        $internal_key = 'message'; 
    3134      
     3134 
    31353135        if ($this->caching_enabled && !isset($this->icache[$internal_key][$uid])) { 
    31363136            $sql_result = $this->db->query( 
     
    31573157    /** 
    31583158     * @access private 
    3159      */   
     3159     */ 
    31603160    private function get_message_cache_index($key, $force=false, $sort_field='idx', $sort_order='ASC') 
    31613161    { 
    31623162        static $sa_message_index = array(); 
    3163      
     3163 
    31643164        // empty key -> empty array 
    31653165        if (!$this->caching_enabled || empty($key)) 
    31663166            return array(); 
    3167      
     3167 
    31683168        if (!empty($sa_message_index[$key]) && !$force) 
    31693169            return $sa_message_index[$key]; 
     
    31723172        if (!$sort_field || !in_array($sort_field, $this->db_header_fields)) 
    31733173            $sort_field = 'idx'; 
    3174      
     3174 
    31753175        $sa_message_index[$key] = array(); 
    31763176        $sql_result = $this->db->query( 
     
    31853185        while ($sql_arr = $this->db->fetch_assoc($sql_result)) 
    31863186            $sa_message_index[$key][$sql_arr['idx']] = $sql_arr['uid']; 
    3187        
     3187 
    31883188        return $sa_message_index[$key]; 
    31893189    } 
     
    32043204        if (!$this->caching_enabled) 
    32053205            return; 
    3206      
     3206 
    32073207        // check for an existing record (probably headers are cached but structure not) 
    32083208        if (!$force) { 
     
    32563256        } 
    32573257    } 
    3258      
     3258 
    32593259    /** 
    32603260     * @access private 
     
    32643264        if (!$this->caching_enabled) 
    32653265            return; 
    3266      
     3266 
    32673267        $this->db->query( 
    32683268            "DELETE FROM ".get_table_name('messages'). 
     
    32813281        if (!$this->caching_enabled) 
    32823282            return; 
    3283      
     3283 
    32843284        $this->db->query( 
    32853285            "DELETE FROM ".get_table_name('messages'). 
     
    32973297        if (!$this->caching_enabled) 
    32983298            return; 
    3299      
     3299 
    33003300        if (!empty($uids) && !is_array($uids)) { 
    33013301            if ($uids == '*' || $uids == '1:*') 
     
    33173317            return $sql_arr['minidx']; 
    33183318        else 
    3319             return 0;   
     3319            return 0; 
    33203320    } 
    33213321 
     
    33393339        // Special chars as defined by RFC 822 need to in quoted string (or escaped). 
    33403340        $special_chars = '[\(\)\<\>\\\.\[\]@,;:"]'; 
    3341      
     3341 
    33423342        if (!is_array($a)) 
    33433343            return $out; 
     
    33603360            else if ($name) 
    33613361                $string = $name; 
    3362        
     3362 
    33633363            $out[$j] = array('name' => $name, 
    33643364                'mailto' => $address, 
     
    33693369                break; 
    33703370        } 
    3371      
     3371 
    33723372        return $out; 
    33733373    } 
    3374    
    3375    
     3374 
     3375 
    33763376    /** 
    33773377     * Decode a Microsoft Outlook TNEF part (winmail.dat) 
     
    33913391        $tnef_parts = array(); 
    33923392        $tnef_arr = tnef_decode($part->body); 
    3393      
     3393 
    33943394        foreach ($tnef_arr as $winatt) { 
    33953395            $tpart = new rcube_message_part; 
     
    34233423        if ($str{0}=='"' && $remove_quotes) 
    34243424            $str = str_replace('"', '', $str); 
    3425      
     3425 
    34263426        return $str; 
    34273427    } 
     
    34433443 
    34443444        // Iterate instead of recursing, this way if there are too many values we don't have stack overflows 
    3445         // rfc: all line breaks or other characters not found  
     3445        // rfc: all line breaks or other characters not found 
    34463446        // in the Base64 Alphabet must be ignored by decoding software 
    3447         // delete all blanks between MIME-lines, differently we can  
     3447        // delete all blanks between MIME-lines, differently we can 
    34483448        // receive unnecessary blanks and broken utf-8 symbols 
    34493449        $input = preg_replace("/\?=\s+=\?/", '?==?', $input); 
     
    34513451        // Check if there is stuff to decode 
    34523452        if (strpos($input, '=?') !== false) { 
    3453             // Loop through the string to decode all occurences of =? ?= into the variable $out  
     3453            // Loop through the string to decode all occurences of =? ?= into the variable $out 
    34543454            while(($pos = strpos($input, '=?')) !== false) { 
    34553455                // Append everything that is before the text to be decoded 
     
    34793479 
    34803480        // no encoding information, use fallback 
    3481         return rcube_charset_convert($input,  
     3481        return rcube_charset_convert($input, 
    34823482            !empty($fallback) ? $fallback : rcmail::get_instance()->config->get('default_charset', 'ISO-8859-1')); 
    34833483    } 
     
    35093509        } 
    35103510 
    3511         // we dont' know what to do with this   
     3511        // we dont' know what to do with this 
    35123512        return $str; 
    35133513    } 
     
    35993599        $folders = array_merge($a_defaults, array_keys($folders)); 
    36003600 
    3601         // finally we must rebuild the list to move  
     3601        // finally we must rebuild the list to move 
    36023602        // subfolders of default folders to their place... 
    36033603        // ...also do this for the rest of folders because 
    36043604        // asort() is not properly sorting case sensitive names 
    36053605        while (list($key, $folder) = each($folders)) { 
    3606             // set the type of folder name variable (#1485527)  
     3606            // set the type of folder name variable (#1485527) 
    36073607            $a_out[] = (string) $folder; 
    36083608            unset($folders[$key]); 
    3609             $this->_rsort($folder, $delimiter, $folders, $a_out);        
     3609            $this->_rsort($folder, $delimiter, $folders, $a_out); 
    36103610        } 
    36113611 
     
    36213621        while (list($key, $name) = each($list)) { 
    36223622                if (strpos($name, $folder.$delimiter) === 0) { 
    3623                     // set the type of folder name variable (#1485527)  
     3623                    // set the type of folder name variable (#1485527) 
    36243624                $out[] = (string) $name; 
    36253625                    unset($list[$key]); 
     
    36273627                } 
    36283628        } 
    3629         reset($list);    
     3629        reset($list); 
    36303630    } 
    36313631 
     
    36383638        if (!$mbox_name) 
    36393639            $mbox_name = $this->mailbox; 
    3640        
     3640 
    36413641        if (!isset($this->uid_id_map[$mbox_name][$uid])) 
    36423642            $this->uid_id_map[$mbox_name][$uid] = $this->conn->UID2ID($mbox_name, $uid); 
     
    36583658        $uid = $this->conn->ID2UID($mbox_name, $id); 
    36593659        $this->uid_id_map[$mbox_name][$uid] = $id; 
    3660      
     3660 
    36613661        return $uid; 
    36623662    } 
     
    37133713 
    37143714        $a_mailbox_cache = $this->get_cache('messagecount'); 
    3715      
     3715 
    37163716        if (!is_array($a_mailbox_cache[$mailbox]) || !isset($a_mailbox_cache[$mailbox][$mode]) || !is_numeric($increment)) 
    37173717            return false; 
    3718      
     3718 
    37193719        // add incremental value to messagecount 
    37203720        $a_mailbox_cache[$mailbox][$mode] += $increment; 
    3721      
     3721 
    37223722        // there's something wrong, delete from cache 
    37233723        if ($a_mailbox_cache[$mailbox][$mode] < 0) 
     
    37263726        // write back to cache 
    37273727        $this->update_cache('messagecount', $a_mailbox_cache); 
    3728      
     3728 
    37293729        return true; 
    37303730    } 
     
    37683768            } 
    37693769        } 
    3770      
     3770 
    37713771        return $a_headers; 
    37723772    } 
     
    37943794                    $result[$key]['name'] .= (empty($result[$key]['name'])?'':' ').str_replace("\"",'',stripslashes($v)); 
    37953795            } 
    3796          
     3796 
    37973797            if (empty($result[$key]['name'])) 
    3798                 $result[$key]['name'] = $result[$key]['address'];         
     3798                $result[$key]['name'] = $result[$key]['address']; 
    37993799            elseif (empty($result[$key]['address'])) 
    38003800                $result[$key]['address'] = $result[$key]['name']; 
    38013801        } 
    3802      
     3802 
    38033803        return $result; 
    38043804    } 
     
    38463846{ 
    38473847    var $sequence_numbers = array(); 
    3848     
     3848 
    38493849    /** 
    38503850     * Set the predetermined sort order. 
     
    38683868        * the keys are the UIDs.  We'll use uasort instead and dereference the value 
    38693869        * to get the sequence number (in the "id" field). 
    3870         *  
    3871         * uksort($headers, array($this, "compare_seqnums"));  
     3870        * 
     3871        * uksort($headers, array($this, "compare_seqnums")); 
    38723872        */ 
    38733873        uasort($headers, array($this, "compare_seqnums")); 
    38743874    } 
    3875   
     3875 
    38763876    /** 
    38773877     * Sort method called by uasort() 
     
    38823882        $seqa = $a->id; 
    38833883        $seqb = $b->id; 
    3884        
     3884 
    38853885        // then find each sequence number in my ordered list 
    38863886        $posa = isset($this->sequence_numbers[$seqa]) ? intval($this->sequence_numbers[$seqa]) : -1; 
    38873887        $posb = isset($this->sequence_numbers[$seqb]) ? intval($this->sequence_numbers[$seqb]) : -1; 
    3888        
     3888 
    38893889        // return the relative position as the comparison value 
    38903890        return $posa - $posb; 
Note: See TracChangeset for help on using the changeset viewer.