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

pull/193/merge
Aleksander Machniak 8 years ago
parent 836f938e1a
commit 5804ef8aa2

@ -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);
}
}

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

Loading…
Cancel
Save