Skip to content

Commit

Permalink
Merge branch 'MDL-70298-311' of git://github.com/ilyatregubov/moodle …
Browse files Browse the repository at this point in the history
…into MOODLE_311_STABLE
  • Loading branch information
sarjona committed Jan 12, 2021
2 parents 33da471 + b12594d commit 3d7d18a
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 21 deletions.
3 changes: 3 additions & 0 deletions lib/horde/framework/Horde/Idna.php
Expand Up @@ -88,6 +88,9 @@ public static function decode($data)
*/
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(
Expand Down
47 changes: 47 additions & 0 deletions lib/horde/framework/Horde/Imap/Client/Data/Thread.php
Expand Up @@ -120,6 +120,53 @@ public function getThread($index)
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. */

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/horde/framework/Horde/Imap/Client/Search/Query.php
Expand Up @@ -595,7 +595,7 @@ public function headerText($header, $text, $not = false,
* 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:
Expand Down
9 changes: 3 additions & 6 deletions lib/horde/framework/Horde/Imap/Client/Socket.php
Expand Up @@ -1543,12 +1543,9 @@ protected function _getMailboxList($pattern, $mode, $options,

/* 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;
Expand Down
Expand Up @@ -110,7 +110,7 @@ public function clientSort($res, $opts)
}

$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
));

Expand Down
10 changes: 5 additions & 5 deletions lib/horde/framework/Horde/Mime/Mail.php
Expand Up @@ -394,10 +394,10 @@ public function clearRecipients()
/**
* 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
*/
Expand Down Expand Up @@ -488,7 +488,7 @@ public function send($mailer, $resend = false, $flowed = true)
* @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)
Expand Down
2 changes: 1 addition & 1 deletion lib/horde/framework/Horde/Socket/Client.php
Expand Up @@ -91,7 +91,7 @@ public function __construct(
$secure = false;
}

$context = array_merge_recursive(
$context = array_replace_recursive(
array(
'ssl' => array(
'verify_peer' => false,
Expand Down
4 changes: 2 additions & 2 deletions lib/horde/framework/Horde/Util.php
Expand Up @@ -114,7 +114,7 @@ public static function pformInput($append_session = 0)
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) {
Expand Down Expand Up @@ -304,7 +304,7 @@ public static function createTempDir($delete = true, $temp_dir = null)
/* 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);
Expand Down
4 changes: 0 additions & 4 deletions lib/horde/readme_moodle.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/thirdpartylibs.xml
Expand Up @@ -179,7 +179,7 @@
<location>horde</location>
<name>Horde</name>
<license>LGPL/BSD</license>
<version>5.2.22</version>
<version>5.2.23</version>
<licenseversion>2.1</licenseversion>
</library>
<library>
Expand Down
1 change: 1 addition & 0 deletions lib/upgrade.txt
Expand Up @@ -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
Expand Down

0 comments on commit 3d7d18a

Please sign in to comment.