Changeset 4875 in subversion


Ignore:
Timestamp:
Jun 23, 2011 1:43:44 PM (2 years ago)
Author:
alec
Message:
  • Add rcube_imap::mailbox_info()
Location:
trunk/roundcubemail/program
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_imap.php

    r4799 r4875  
    34903490 
    34913491    /** 
     3492     * Returns extended information about the folder 
     3493     * 
     3494     * @param string $mailbox Folder name 
     3495     * 
     3496     * @return array Data 
     3497     */ 
     3498    function mailbox_info($mailbox) 
     3499    { 
     3500        $acl       = $this->get_capability('ACL'); 
     3501        $namespace = $this->get_namespace(); 
     3502        $options   = array(); 
     3503 
     3504        // check if the folder is a namespace prefix 
     3505        if (!empty($namespace)) { 
     3506            $mbox = $mailbox . $this->delimiter; 
     3507            foreach ($namespace as $ns) { 
     3508                foreach ($ns as $item) { 
     3509                    if ($item[0] === $mbox) { 
     3510                        $options['is_root'] = true; 
     3511                        break; 
     3512                    } 
     3513                } 
     3514            } 
     3515        } 
     3516 
     3517        $options['name']      = $mailbox; 
     3518        $options['options']   = $this->mailbox_options($mailbox, true); 
     3519        $options['namespace'] = $this->mailbox_namespace($mailbox); 
     3520        $options['rights']    = $acl && !$options['is_root'] ? (array)$this->my_rights($mailbox) : array(); 
     3521        $options['special']   = in_array($mailbox, $this->default_folders); 
     3522 
     3523        if (is_array($options['options'])) { 
     3524            foreach ($options['options'] as $opt) { 
     3525                $opt = strtolower($opt); 
     3526                if ($opt == '\noselect' || $opt == '\nonexistent') { 
     3527                    $options['noselect'] = true; 
     3528                } 
     3529            } 
     3530        } 
     3531        else { 
     3532            $options['noselect'] = true; 
     3533        } 
     3534 
     3535        if (!empty($options['rights'])) { 
     3536            $options['norename'] = !in_array('x', $options['rights']) && 
     3537                (!in_array('c', $options['rights']) || !in_array('d', $options['rights'])); 
     3538            if (!$options['noselect']) { 
     3539                $options['noselect'] = !in_array('r', $options['rights']); 
     3540            } 
     3541        } 
     3542 
     3543        return $options; 
     3544    } 
     3545 
     3546 
     3547    /** 
    34923548     * Get message header names for rcube_imap_generic::fetchHeader(s) 
    34933549     * 
  • trunk/roundcubemail/program/steps/settings/func.inc

    r4860 r4875  
    789789    global $RCMAIL; 
    790790 
    791     $acl             = $RCMAIL->imap->get_capability('ACL'); 
    792     $default_folders = (array) $RCMAIL->config->get('default_imap_folders'); 
    793     $delimiter       = $RCMAIL->imap->get_hierarchy_delimiter(); 
    794     $namespace       = $RCMAIL->imap->get_namespace(); 
    795     $options         = array(); 
    796  
    797     // check if the folder is a namespace prefix 
    798     if (!empty($namespace)) { 
    799         $mbox = $mailbox . $delimiter; 
    800         foreach ($namespace as $ns) { 
    801             foreach ($ns as $item) { 
    802                 if ($item[0] === $mbox) { 
    803                     $options['is_root'] = true; 
    804                     break; 
    805                 } 
    806             } 
    807         } 
    808     } 
    809  
    810     $options['name']      = $mailbox; 
    811     $options['options']   = $RCMAIL->imap->mailbox_options($mailbox, true); 
    812     $options['namespace'] = $RCMAIL->imap->mailbox_namespace($mailbox); 
    813     $options['rights']    = $acl && !$options['is_root'] ? (array)$RCMAIL->imap->my_rights($mailbox) : array(); 
    814     $options['special']   = in_array($mailbox, $default_folders); 
     791    $options = $RCMAIL->imap->mailbox_info($mailbox); 
    815792    $options['protected'] = $options['is_root'] || ($options['special'] && $RCMAIL->config->get('protect_default_folders')); 
    816  
    817     if (is_array($options['options'])) { 
    818         foreach ($options['options'] as $opt) { 
    819             $opt = strtolower($opt); 
    820             if ($opt == '\noselect' || $opt == '\nonexistent') { 
    821                 $options['noselect'] = true; 
    822             } 
    823         } 
    824     } 
    825     else { 
    826         $options['noselect'] = true; 
    827     } 
    828  
    829     if (!empty($options['rights'])) { 
    830         $options['norename'] = !in_array('x', $options['rights']) && 
    831             (!in_array('c', $options['rights']) || !in_array('d', $options['rights'])); 
    832         if (!$options['noselect']) { 
    833             $options['noselect'] = !in_array('r', $options['rights']); 
    834         } 
    835     } 
    836793 
    837794    return $options; 
Note: See TracChangeset for help on using the changeset viewer.