diff --git a/lib/horde/framework/Horde/Idna.php b/lib/horde/framework/Horde/Idna.php index 6b73a066ee1..1380682cbc1 100644 --- a/lib/horde/framework/Horde/Idna.php +++ b/lib/horde/framework/Horde/Idna.php @@ -88,6 +88,9 @@ class Horde_Idna */ protected static function _checkForError($info) { + if (!isset($info['errors'])) { + return; + } switch (true) { case $info['errors'] & IDNA_ERROR_EMPTY_LABEL: throw new Horde_Idna_Exception(Horde_Idna_Translation::t( diff --git a/lib/horde/framework/Horde/Imap/Client/Data/Thread.php b/lib/horde/framework/Horde/Imap/Client/Data/Thread.php index 0970c8ff1ba..0fc857e9c09 100644 --- a/lib/horde/framework/Horde/Imap/Client/Data/Thread.php +++ b/lib/horde/framework/Horde/Imap/Client/Data/Thread.php @@ -120,6 +120,53 @@ class Horde_Imap_Client_Data_Thread implements Countable, Serializable return array(); } + /** + * Returns array of all threads. + * + * @return array Keys of thread arrays are indices, values are objects with the following + * properties: + * - base: (integer) Base ID of the thread. If null, thread is a single + * message. + * - last: (boolean) If true, this is the last index in the sublevel. + * - level: (integer) The sublevel of the index. + */ + public function getThreads() + { + $data = array(); + foreach ($this->_thread as $v) { + reset($v); + + $ob = new stdClass; + $ob->base = (count($v) > 1) ? key($v) : null; + $ob->last = false; + + $levels = $out = array(); + $last = 0; + + while (($v2 = current($v)) !== false) { + $k2 = key($v); + $ob2 = clone $ob; + $ob2->level = $v2; + $out[$k2] = $ob2; + + if (($last < $v2) && isset($levels[$v2])) { + $out[$levels[$v2]]->last = true; + } + $levels[$v2] = $k2; + $last = $v2; + next($v); + } + + foreach ($levels as $v) { + $out[$v]->last = true; + } + + $data[] = $out; + } + + return $data; + } + /* Countable methods. */ /** diff --git a/lib/horde/framework/Horde/Imap/Client/Search/Query.php b/lib/horde/framework/Horde/Imap/Client/Search/Query.php index b8c23496b2e..0a4307d3d1a 100644 --- a/lib/horde/framework/Horde/Imap/Client/Search/Query.php +++ b/lib/horde/framework/Horde/Imap/Client/Search/Query.php @@ -595,7 +595,7 @@ class Horde_Imap_Client_Search_Query implements Serializable * Search for text in either the entire message, or just the body. * * @param string $text The search text. - * @param string $bodyonly If true, only search in the body of the + * @param boolean $bodyonly If true, only search in the body of the * message. If false, also search in the headers. * @param boolean $not If true, do a 'NOT' search of $text. * @param array $opts Additional options: diff --git a/lib/horde/framework/Horde/Imap/Client/Socket.php b/lib/horde/framework/Horde/Imap/Client/Socket.php index 240c773d6bb..f9864b0074a 100644 --- a/lib/horde/framework/Horde/Imap/Client/Socket.php +++ b/lib/horde/framework/Horde/Imap/Client/Socket.php @@ -1543,12 +1543,9 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base /* Add in STATUS return, if needed. */ if (!empty($options['status']) && $this->_capability('LIST-STATUS')) { - foreach ($pattern as $val) { - $val_utf8 = Horde_Imap_Client_Utf7imap::Utf7ImapToUtf8($val); - if (isset($lr[$val_utf8])) { - $lr[$val_utf8]['status'] = $this->_prepareStatusResponse($status_opts, $val_utf8); - } - } + foreach($lr as $val_utf8 => $tmp) { + $lr[$val_utf8]['status'] = $this->_prepareStatusResponse($status_opts, $val_utf8); + } } return $lr; diff --git a/lib/horde/framework/Horde/Imap/Client/Socket/ClientSort.php b/lib/horde/framework/Horde/Imap/Client/Socket/ClientSort.php index 4030492a8bd..a93853abbeb 100644 --- a/lib/horde/framework/Horde/Imap/Client/Socket/ClientSort.php +++ b/lib/horde/framework/Horde/Imap/Client/Socket/ClientSort.php @@ -110,7 +110,7 @@ class Horde_Imap_Client_Socket_ClientSort } $mbox = $this->_socket->currentMailbox(); - $fetch_res = $this->_socket->fetch($mbox['mailbox'], $query, array( + $fetch_res = $this->_socket->fetch(isset($mbox['mailbox']) ? $mbox['mailbox'] : null, $query, array( 'ids' => $res )); diff --git a/lib/horde/framework/Horde/Mime/Mail.php b/lib/horde/framework/Horde/Mime/Mail.php index 75064b5bf8b..cbec8ea2274 100644 --- a/lib/horde/framework/Horde/Mime/Mail.php +++ b/lib/horde/framework/Horde/Mime/Mail.php @@ -394,10 +394,10 @@ class Horde_Mime_Mail /** * Sends this message. * - * @param Mail $mailer A Mail object. - * @param boolean $resend If true, the message id and date are re-used; - * If false, they will be updated. - * @param boolean $flowed Send message in flowed text format. + * @param Horde_Mail_Transport $mailer A Horde_Mail_Transport object. + * @param boolean $resend If true, the message id and date are re-used; + * If false, they will be updated. + * @param boolean $flowed Send message in flowed text format. * * @throws Horde_Mime_Exception */ @@ -488,7 +488,7 @@ class Horde_Mime_Mail * @param boolean $stream If true, return a stream resource, otherwise * a string is returned. * - * @return stream|string The raw email data. + * @return resource|string The raw email data. * @since 2.4.0 */ public function getRaw($stream = true) diff --git a/lib/horde/framework/Horde/Socket/Client.php b/lib/horde/framework/Horde/Socket/Client.php index a7fde63a676..a38d2233b2e 100644 --- a/lib/horde/framework/Horde/Socket/Client.php +++ b/lib/horde/framework/Horde/Socket/Client.php @@ -91,7 +91,7 @@ class Client $secure = false; } - $context = array_merge_recursive( + $context = array_replace_recursive( array( 'ssl' => array( 'verify_peer' => false, diff --git a/lib/horde/framework/Horde/Util.php b/lib/horde/framework/Horde/Util.php index 4d16bb86916..d6d111d47be 100644 --- a/lib/horde/framework/Horde/Util.php +++ b/lib/horde/framework/Horde/Util.php @@ -114,7 +114,7 @@ class Horde_Util public static function dispelMagicQuotes($var) { if (is_null(self::$_magicquotes)) { - self::$_magicquotes = get_magic_quotes_gpc(); + self::$_magicquotes = function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc(); } if (self::$_magicquotes) { @@ -304,7 +304,7 @@ class Horde_Util /* Get the first 8 characters of a random string to use as a temporary directory name. */ do { - $new_dir = $temp_dir . '/' . substr(base_convert(uniqid(mt_rand()), 10, 36), 0, 8); + $new_dir = $temp_dir . '/' . substr(base_convert(uniqid(mt_rand()), 16, 36), 0, 8); } while (file_exists($new_dir)); $old_umask = umask(0000); diff --git a/lib/horde/readme_moodle.txt b/lib/horde/readme_moodle.txt index c31e9808f95..d4bcaa61718 100644 --- a/lib/horde/readme_moodle.txt +++ b/lib/horde/readme_moodle.txt @@ -12,10 +12,6 @@ Description of import of Horde libraries # Copy the following script and store it on /tmp, change it's execute bit(chmod 777), and run it, passing in your path to Horde (the directory you've cloned the repository): /tmp/copyhorde.sh ~/git/base/directory/from/step/2 -# Verify that these patches have been applied in the imported version. Apply them locally if not: - - https://github.com/horde/Mail/pull/1 (Mail component). - - https://github.com/horde/Imap_Client/pull/6 (IMAP Client component). - - https://github.com/horde/Crypt_Blowfish/pull/1 (PHP 7.4 compatibility, Crypt_Blowfish) ==== #!/bin/sh diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml index 32ca880ea1d..1e638891013 100644 --- a/lib/thirdpartylibs.xml +++ b/lib/thirdpartylibs.xml @@ -179,7 +179,7 @@ horde Horde LGPL/BSD - 5.2.22 + 5.2.23 2.1 diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 9f0d6165360..499aedabe96 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -2,6 +2,7 @@ This files describes API changes in core libraries and APIs, information provided here is intended especially for developers. === 3.11 === +* The horde library has been updated to version 5.2.23. * New optional parameter $extracontent for print_collapsible_region_start(). This allows developers to add interactive HTML elements (e.g. a help icon) after the collapsible region's toggle link. * Final deprecation i_dock_block() in behat_deprecated.php