Changeset 4484097 in github


Ignore:
Timestamp:
Nov 12, 2010 5:47:04 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:
310fc2d
Parents:
d2b27d1
Message:
  • Fix handling of folders with name "0" (#1487119)
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r00290a6 r4484097  
    6767- Fix operations on messages in unsubscribed folder (#1487107) 
    6868- Add support for shared folders (#1403507) 
     69- Fix handling of folders with name "0" (#1487119) 
    6970 
    7071RELEASE 0.4.2 
  • program/include/html.php

    r5c461ba r4484097  
    7676 
    7777        $tagname = self::$lc_tags ? strtolower($tagname) : $tagname; 
    78         if ($content || in_array($tagname, self::$containers)) { 
     78        if (isset($content) || in_array($tagname, self::$containers)) { 
    7979            $templ = $attrib['noclose'] ? "<%s%s>%s" : "<%s%s>%s</%s>%s"; 
    8080            unset($attrib['noclose']); 
  • program/include/main.inc

    rd2b27d1 r4484097  
    13491349 
    13501350    // sometimes folder has a delimiter as the last character 
    1351     if (empty($subFolders)) 
     1351    if (!strlen($subFolders)) 
    13521352      $virtual = false; 
    13531353    else if (!isset($arrFolders[$currentFolder])) 
     
    13791379    $arrFolders[$currentFolder]['virtual'] = $virtual; 
    13801380 
    1381   if (!empty($subFolders)) 
     1381  if (strlen($subFolders)) 
    13821382    rcmail_build_folder_tree($arrFolders[$currentFolder]['folders'], $subFolders, $delm, $path.$delm); 
    13831383} 
  • program/include/rcmail.php

    r00290a6 r4484097  
    783783      $this->imap->set_default_mailboxes($default_folders); 
    784784    } 
    785     if (!empty($_SESSION['mbox'])) { 
     785    if (isset($_SESSION['mbox'])) { 
    786786      $this->imap->set_mailbox($_SESSION['mbox']); 
    787787    } 
  • program/include/rcube_imap.php

    rad58811 r4484097  
    566566    function messagecount($mbox_name='', $mode='ALL', $force=false, $status=true) 
    567567    { 
    568         $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
     568        $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    569569        return $this->_messagecount($mailbox, $mode, $force, $status); 
    570570    } 
     
    587587        $mode = strtoupper($mode); 
    588588 
    589         if (empty($mailbox)) 
     589        if (!strlen($mailbox)) 
    590590            $mailbox = $this->mailbox; 
    591591 
     
    25522552        $tbox = $to_mbox; 
    25532553        $to_mbox = $this->mod_mailbox($to_mbox); 
    2554         $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; 
     2554        $from_mbox = strlen($from_mbox) ? $this->mod_mailbox($from_mbox) : $this->mailbox; 
    25552555 
    25562556        list($uids, $all_mode) = $this->_parse_uids($uids, $from_mbox); 
     
    27222722    function clear_mailbox($mbox_name=NULL) 
    27232723    { 
    2724         $mailbox = !empty($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
     2724        $mailbox = strlen($mbox_name) ? $this->mod_mailbox($mbox_name) : $this->mailbox; 
    27252725 
    27262726        // SELECT will set messages count for clearFolder() 
     
    28752875 
    28762876        foreach ($a_mboxes as $idx => $mbox_row) { 
    2877             if ($name = $this->mod_mailbox($mbox_row, 'out')) 
     2877            if (strlen($name = $this->mod_mailbox($mbox_row, 'out'))) 
    28782878                $a_out[] = $name; 
    28792879            unset($a_mboxes[$idx]); 
     
    29792979        // modify names with root dir 
    29802980        foreach ($a_mboxes as $idx => $mbox_name) { 
    2981             if ($name = $this->mod_mailbox($mbox_name, 'out')) 
     2981            if (strlen($name = $this->mod_mailbox($mbox_name, 'out'))) 
    29822982                $a_folders[] = $name; 
    29832983            unset($a_mboxes[$idx]); 
     
    31953195    function mailbox_exists($mbox_name, $subscription=false) 
    31963196    { 
    3197         if ($mbox_name) { 
    3198             if ($mbox_name == 'INBOX') 
    3199                 return true; 
    3200  
    3201             $key  = $subscription ? 'subscribed' : 'existing'; 
    3202             $mbox = $this->mod_mailbox($mbox_name); 
    3203  
    3204             if (is_array($this->icache[$key]) && in_array($mbox, $this->icache[$key])) 
    3205                 return true; 
    3206  
    3207             if ($subscription) { 
    3208                 $a_folders = $this->conn->listSubscribed('', $mbox); 
    3209             } 
    3210             else { 
    3211                 $a_folders = $this->conn->listMailboxes('', $mbox); 
    3212                 } 
    3213  
    3214             if (is_array($a_folders) && in_array($mbox, $a_folders)) { 
    3215                 $this->icache[$key][] = $mbox; 
    3216                 return true; 
    3217             } 
     3197        if ($mbox_name == 'INBOX') 
     3198            return true; 
     3199 
     3200        $key  = $subscription ? 'subscribed' : 'existing'; 
     3201        $mbox = $this->mod_mailbox($mbox_name); 
     3202 
     3203        if (is_array($this->icache[$key]) && in_array($mbox, $this->icache[$key])) 
     3204            return true; 
     3205 
     3206        if ($subscription) { 
     3207            $a_folders = $this->conn->listSubscribed('', $mbox); 
     3208        } 
     3209        else { 
     3210            $a_folders = $this->conn->listMailboxes('', $mbox); 
     3211       } 
     3212 
     3213        if (is_array($a_folders) && in_array($mbox, $a_folders)) { 
     3214            $this->icache[$key][] = $mbox; 
     3215            return true; 
    32183216        } 
    32193217 
     
    32313229    function mod_mailbox($mbox_name, $mode='in') 
    32323230    { 
    3233         if (empty($mbox_name)) 
     3231        if (!strlen($mbox_name)) 
    32343232            return ''; 
    32353233 
     
    34613459            $mailbox = $this->mod_mailbox($mailbox); 
    34623460 
    3463         if ($this->get_capability('METADATA') ||  
    3464             empty($mailbox) && $this->get_capability('METADATA-SERVER') 
     3461        if ($this->get_capability('METADATA') || 
     3462            (!strlen($mailbox) && $this->get_capability('METADATA-SERVER')) 
    34653463        ) { 
    34663464            return $this->conn->setMetadata($mailbox, $entries); 
     
    34953493 
    34963494        if ($this->get_capability('METADATA') ||  
    3497             empty($mailbox) && $this->get_capability('METADATA-SERVER') 
     3495            (!strlen($mailbox) && $this->get_capability('METADATA-SERVER')) 
    34983496        ) { 
    34993497            return $this->conn->deleteMetadata($mailbox, $entries); 
     
    35293527 
    35303528        if ($this->get_capability('METADATA') ||  
    3531             empty($mailbox) && $this->get_capability('METADATA-SERVER') 
     3529            !strlen(($mailbox) && $this->get_capability('METADATA-SERVER')) 
    35323530        ) { 
    35333531            return $this->conn->getMetadata($mailbox, $entries, $options); 
  • program/include/rcube_imap_generic.php

    rad3c273 r4484097  
    802802    function select($mailbox) 
    803803    { 
    804             if (empty($mailbox)) { 
     804            if (!strlen($mailbox)) { 
    805805                    return false; 
    806806            } 
     
    853853    function status($mailbox, $items=array()) 
    854854    { 
    855             if (empty($mailbox)) { 
     855            if (!strlen($mailbox)) { 
    856856                    return false; 
    857857            } 
     
    887887    function checkForRecent($mailbox) 
    888888    { 
    889             if (empty($mailbox)) { 
     889            if (!strlen($mailbox)) { 
    890890                    $mailbox = 'INBOX'; 
    891891            } 
    892892 
    893893            $this->select($mailbox); 
     894 
    894895            if ($this->selected == $mailbox) { 
    895896                    return $this->data['RECENT']; 
     
    16191620    function copy($messages, $from, $to) 
    16201621    { 
    1621             if (empty($from) || empty($to)) { 
    1622                 return false; 
    1623             } 
    1624  
    16251622            if (!$this->select($from)) { 
    16261623                return false; 
     
    16391636    function move($messages, $from, $to) 
    16401637    { 
    1641         if (!$from || !$to) { 
    1642             return false; 
    1643         } 
    1644  
    16451638        $r = $this->copy($messages, $from, $to); 
    16461639 
     
    18821875        $status_opts=array(), $select_opts=array()) 
    18831876    { 
    1884                 if (empty($mailbox)) { 
     1877                if (!strlen($mailbox)) { 
    18851878                $mailbox = '*'; 
    18861879            } 
  • program/steps/mail/func.inc

    rcb105aa r4484097  
    4747 
    4848// set imap properties and session vars 
    49 if ($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC)) 
     49if (strlen(trim($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC)))) 
    5050  $IMAP->set_mailbox(($_SESSION['mbox'] = $mbox)); 
    5151else if ($IMAP) 
  • program/steps/mail/move_del.inc

    rc50d887 r4484097  
    2929 
    3030// move messages 
    31 if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) { 
     31if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { 
    3232    $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); 
    3333    $target = get_input_value('_target_mbox', RCUBE_INPUT_POST); 
     
    117117  } 
    118118 
    119   if ($RCMAIL->action=='moveto' && $target) { 
     119  if ($RCMAIL->action=='moveto' && strlen($target)) { 
    120120    rcmail_send_unread_count($target, true); 
    121121  } 
  • program/steps/settings/manage_folders.inc

    r36ed9d7 r4484097  
    2828if ($RCMAIL->action=='subscribe') 
    2929  { 
    30   if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) 
     30  $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP'); 
     31  if (strlen($mbox)) 
    3132    $IMAP->subscribe(array($mbox)); 
    3233  } 
     
    3536else if ($RCMAIL->action=='unsubscribe') 
    3637  { 
    37   if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) 
     38  $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP'); 
     39  if (strlen($mbox)) 
    3840    $IMAP->unsubscribe(array($mbox)); 
    3941  } 
     
    4244else if ($RCMAIL->action=='enable-threading') 
    4345  { 
    44   if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) 
     46  $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP'); 
     47  if (strlen($mbox)) 
    4548    rcube_set_threading($mbox, true); 
    4649  } 
     
    4952else if ($RCMAIL->action=='disable-threading') 
    5053  { 
    51   if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) 
     54  $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP'); 
     55  if (strlen($mbox)) 
    5256    rcube_set_threading($mbox, false); 
    5357  } 
     
    5660else if ($RCMAIL->action=='create-folder') 
    5761  { 
    58   if (!empty($_POST['_name'])) 
     62  if (strlen(trim($_POST['_name']))) 
    5963    { 
    6064    $name = trim(get_input_value('_name', RCUBE_INPUT_POST, FALSE, 'UTF7-IMAP')); 
     
    8488else if ($RCMAIL->action=='rename-folder') 
    8589  { 
    86   if (!empty($_POST['_folder_oldname']) && !empty($_POST['_folder_newname'])) 
     90  if (strlen(trim($_POST['_folder_oldname'])) && strlen(trim($_POST['_folder_newname']))) 
    8791    { 
    8892    $name_utf8 = trim(get_input_value('_folder_newname', RCUBE_INPUT_POST)); 
     
    102106      if ($key == $oldname) { 
    103107        unset($a_threaded[$key]); 
    104         $a_threaded[$name] = true; 
     108            $a_threaded[$name] = true; 
    105109        } 
    106110      else if (preg_match($oldprefix, $key)) { 
    107111        unset($a_threaded[$key]); 
    108         $a_threaded[preg_replace($oldprefix, $name.$delimiter, $key)] = true;       
     112            $a_threaded[preg_replace($oldprefix, $name.$delimiter, $key)] = true; 
    109113      } 
    110        
     114 
    111115    $RCMAIL->user->save_prefs(array('message_threading' => $a_threaded)); 
    112116    } 
     
    164168  $mboxes = rcube_charset_convert($mboxes_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); 
    165169 
    166   if ($mboxes) 
     170  if (strlen($mboxes)) 
    167171    $deleted = $IMAP->delete_mailbox(array($mboxes)); 
    168172 
     
    285289    $classes = array($i%2 ? 'even' : 'odd'); 
    286290    $folder_js = JQ($folder['id']); 
    287     $display_folder = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $folder['level']) . ($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); 
     291    $display_folder = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $folder['level']) . Q($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); 
    288292    $folder_utf8 = rcube_charset_convert($folder['id'], 'UTF7-IMAP'); 
    289293     
     
    299303    $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes))); 
    300304     
    301     $table->add('name', Q($display_folder)); 
     305    $table->add('name', $display_folder); 
    302306    $table->add('msgcount', (($folder['virtual'] || $noselect) ? '' : $IMAP->messagecount($folder['id'], 'ALL', false, false))); 
    303307    $table->add('subscribed', $checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''), 
     
    321325  } 
    322326 
    323   rcmail::get_instance()->plugins->exec_hook('folders_list', array('table'=>$table)); 
     327  rcmail::get_instance()->plugins->exec_hook('folders_list', array('table' => $table)); 
    324328 
    325329  $OUTPUT->add_gui_object('subscriptionlist', $attrib['id']); 
Note: See TracChangeset for help on using the changeset viewer.