From 38dc510b2dba02dba5a60fbc00947aac4fd24aab Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Wed, 29 Feb 2012 06:53:52 -0500 Subject: [PATCH] - Fix warning when properties array is empty --- program/include/rcube_imap_generic.php | 46 ++++++++++++++++++++++++++++------------------ 1 files changed, 28 insertions(+), 18 deletions(-) diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php index 3482439..2d636f0 100644 --- a/program/include/rcube_imap_generic.php +++ b/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) { @@ -1450,7 +1453,7 @@ // Invoke SEARCH as a fallback $index = $this->search($mailbox, 'ALL UNSEEN', false, array('COUNT')); - if (!$index->isError()) { + if (!$index->is_error()) { return $index->count(); } @@ -1554,6 +1557,11 @@ if (!$this->select($mailbox)) { return new rcube_result_index($mailbox); + } + + // RFC 5957: SORT=DISPLAY + if (($field == 'FROM' || $field == 'TO') && $this->getCapability('SORT=DISPLAY')) { + $field = 'DISPLAY' . $field; } // message IDs @@ -3249,28 +3257,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; } } -- Gitblit v1.9.1