Changeset 1899 in subversion


Ignore:
Timestamp:
Sep 29, 2008 7:46:21 AM (5 years ago)
Author:
alec
Message:
  • small improvement: don't use implode to check array elements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/lib/imap.inc

    r1800 r1899  
    701701 
    702702function iil_ExplodeQuotedString($delimiter, $string) { 
    703         $quotes=explode('"', $string); 
     703        $quotes = explode('"', $string); 
    704704        while ( list($key, $val) = each($quotes)) { 
    705705                if (($key % 2) == 1) { 
     
    707707                } 
    708708        } 
    709         $string=implode('"', $quotes); 
    710          
    711         $result=explode($delimiter, $string); 
     709        $string = implode('"', $quotes); 
     710         
     711        $result = explode($delimiter, $string); 
    712712        while ( list($key, $val) = each($result) ) { 
    713713                $result[$key] = str_replace('_!@!_', $delimiter, $result[$key]); 
     
    20202020        $index = iil_C_Search($conn, $folder, 'ALL UNSEEN'); 
    20212021        if (is_array($index)) { 
    2022                 $str = implode(',', $index); 
    2023                 if (empty($str)) { 
    2024                     return false; 
    2025                 } 
    2026                 return count($index); 
     2022                if (($cnt = count($index)) && $index[0] != '') { 
     2023                        return $cnt; 
     2024                } 
    20272025        } 
    20282026        return false; 
     
    20322030        if ($uid > 0) { 
    20332031                $id_a = iil_C_Search($conn, $folder, "UID $uid"); 
    2034                 if (is_array($id_a)) { 
    2035                         $count = count($id_a); 
    2036                         if ($count > 1) { 
    2037                             return false; 
    2038                         } 
     2032                if (is_array($id_a) && count($id_a) == 1) { 
    20392033                        return $id_a[0]; 
    20402034                } 
Note: See TracChangeset for help on using the changeset viewer.