Fix folders list sorting on Windows - if php-intl is available (#5732)

pull/5755/head
Aleksander Machniak 8 years ago
parent 30a14911e8
commit 9e56b06e8b

@ -7,6 +7,7 @@ CHANGELOG Roundcube Webmail
- Print error from CLI scripts when system/exec function is disabled (#5744)
- Fix bug where comment notation within style tag would cause the whole style to be ignored (#5747)
- Fix bug where it wasn't possible to scroll folders list in Edge (#5750)
- Fix folders list sorting on Windows - if php-intl is available (#5732)
RELEASE 1.3-rc
--------------

@ -390,6 +390,7 @@ class rcube
);
if (!empty($_SESSION['storage_host'])) {
$options['language'] = $_SESSION['language'];
$options['host'] = $_SESSION['storage_host'];
$options['user'] = $_SESSION['username'];
$options['port'] = $_SESSION['storage_port'];

@ -4262,6 +4262,17 @@ class rcube_imap extends rcube_storage
*/
protected function sort_folder_comparator($str1, $str2)
{
if ($this->sort_folder_collator === null) {
$this->sort_folder_collator = false;
// strcoll() does not work with UTF8 locale on Windows,
// use Collator from the intl extension
if (stripos(PHP_OS, 'win') === 0 && function_exists('collator_compare')) {
$locale = $this->options['language'] ?: 'en_US';
$this->sort_folder_collator = collator_create($locale) ?: false;
}
}
$path1 = explode($this->delimiter, $str1);
$path2 = explode($this->delimiter, $str2);
@ -4272,6 +4283,10 @@ class rcube_imap extends rcube_storage
continue;
}
if ($this->sort_folder_collator) {
return collator_compare($this->sort_folder_collator, $folder1, $folder2);
}
return strcoll($folder1, $folder2);
}
}

@ -42,13 +42,13 @@ abstract class rcube_storage
*/
public static $folder_types = array('drafts', 'sent', 'junk', 'trash');
protected $folder = 'INBOX';
protected $folder = 'INBOX';
protected $default_charset = 'ISO-8859-1';
protected $options = array('auth_type' => 'check', 'language' => 'en_US');
protected $page_size = 10;
protected $list_page = 1;
protected $threading = false;
protected $search_set;
protected $options = array('auth_type' => 'check');
protected $page_size = 10;
protected $list_page = 1;
protected $threading = false;
/**
* All (additional) headers used (in any way) by Roundcube

Loading…
Cancel
Save