thomascube
2012-01-18 7fe3811c65a7c63154f03610e289a6d196f3ae2e
program/include/rcube_imap_generic.php
@@ -7,7 +7,10 @@
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2010, The Roundcube Dev Team                       |
 | Copyright (C) 2011, Kolab Systems AG                                  |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
 | See the README file for a full license statement.                     |
 |                                                                       |
 | PURPOSE:                                                              |
 |   Provide alternative IMAP library that doesn't rely on the standard  |
@@ -1231,7 +1234,7 @@
    {
        $num_in_trash = $this->countMessages($mailbox);
        if ($num_in_trash > 0) {
            $res = $this->delete($mailbox, '1:*');
            $res = $this->flag($mailbox, '1:*', 'DELETED');
        }
        if ($res) {
@@ -3249,28 +3252,30 @@
       if (!is_array($a)) {
            return false;
        }
        if (empty($part)) {
          return $a;
       }
        $ctype = is_string($a[0]) && is_string($a[1]) ? $a[0] . '/' . $a[1] : '';
        if (strcasecmp($ctype, 'message/rfc822') == 0) {
            $a = $a[8];
        }
       if (strpos($part, '.') > 0) {
          $original_part = $part;
          $pos = strpos($part, '.');
          $rest = substr($original_part, $pos+1);
          $part = substr($original_part, 0, $pos);
          if ((strcasecmp($a[0], 'message') == 0) && (strcasecmp($a[1], 'rfc822') == 0)) {
             $a = $a[8];
          }
          $orig_part = $part;
          $pos       = strpos($part, '.');
          $rest      = substr($orig_part, $pos+1);
          $part      = substr($orig_part, 0, $pos);
          return self::getStructurePartArray($a[$part-1], $rest);
       }
        else if ($part>0) {
          if (!is_array($a[0]) && (strcasecmp($a[0], 'message') == 0)
                && (strcasecmp($a[1], 'rfc822') == 0)) {
             $a = $a[8];
          }
        else if ($part > 0) {
          if (is_array($a[$part-1]))
                return $a[$part-1];
          else
                return $a;
       }
        else if (($part == 0) || (empty($part))) {
          return $a;
       }
    }