summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.htaccess5
-rw-r--r--CHANGELOG5
-rw-r--r--program/lib/Roundcube/rcube_charset.php14
-rw-r--r--program/lib/Roundcube/rcube_session.php4
-rw-r--r--program/lib/Roundcube/rcube_string_replacer.php2
-rw-r--r--program/lib/Roundcube/rcube_washtml.php19
-rw-r--r--program/steps/mail/compose.inc8
-rw-r--r--program/steps/mail/func.inc3
-rw-r--r--program/steps/mail/get.inc7
-rw-r--r--tests/Framework/StringReplacer.php2
10 files changed, 47 insertions, 22 deletions
diff --git a/.htaccess b/.htaccess
index 481bd091a..dc6e62f38 100644
--- a/.htaccess
+++ b/.htaccess
@@ -21,16 +21,13 @@ php_flag session.auto_start Off
php_value session.gc_maxlifetime 21600
php_value session.gc_divisor 500
php_value session.gc_probability 1
-
-# http://bugs.php.net/bug.php?id=30766
-php_value mbstring.func_overload 0
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^favicon\.ico$ skins/larry/images/favicon.ico
# security rules
-RewriteRule .git - [F]
+RewriteRule \.git - [F]
RewriteRule ^/?(README(.md)?|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ - [F]
RewriteRule ^/?(SQL|bin) - [F]
</IfModule>
diff --git a/CHANGELOG b/CHANGELOG
index b779086e0..ab5d125cc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,11 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix rewrite rule in .htaccess (#1489240)
+- Fix detecting Turkish language in ISO-8859-9 encoding (#1489252)
+- Fix identity-selection using Return-Path headers (#1489241)
+- Fix parsing of links with ... in URL (#1489192)
+- Fix compose priority selector when opening in new window (#1489257)
- Respect HTTP_X_FORWARDED_FOR and HTTP_X_REAL_IP variables for session IP check
- Simplified configuration by merging it into one file + defaults (#1487311)
- Make message list header stay on top when scrolling (#1295420)
diff --git a/program/lib/Roundcube/rcube_charset.php b/program/lib/Roundcube/rcube_charset.php
index a7f26a3f4..19dbf6cbc 100644
--- a/program/lib/Roundcube/rcube_charset.php
+++ b/program/lib/Roundcube/rcube_charset.php
@@ -674,23 +674,27 @@ class rcube_charset
// Prioritize charsets according to current language (#1485669)
switch ($language) {
- case 'ja_JP': // for Japanese
+ case 'ja_JP':
$prio = array('ISO-2022-JP', 'JIS', 'UTF-8', 'EUC-JP', 'eucJP-win', 'SJIS', 'SJIS-win');
break;
- case 'zh_CN': // for Chinese (Simplified)
- case 'zh_TW': // for Chinese (Traditional)
+ case 'zh_CN':
+ case 'zh_TW':
$prio = array('UTF-8', 'BIG-5', 'GB2312', 'EUC-TW');
break;
- case 'ko_KR': // for Korean
+ case 'ko_KR':
$prio = array('UTF-8', 'EUC-KR', 'ISO-2022-KR');
break;
- case 'ru_RU': // for Russian
+ case 'ru_RU':
$prio = array('UTF-8', 'WINDOWS-1251', 'KOI8-R');
break;
+ case 'tr_TR':
+ $prio = array('UTF-8', 'ISO-8859-9', 'WINDOWS-1254');
+ break;
+
default:
$prio = array('UTF-8', 'SJIS', 'GB2312',
'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
diff --git a/program/lib/Roundcube/rcube_session.php b/program/lib/Roundcube/rcube_session.php
index 646933b71..67072df41 100644
--- a/program/lib/Roundcube/rcube_session.php
+++ b/program/lib/Roundcube/rcube_session.php
@@ -333,9 +333,9 @@ class rcube_session
$newvars = $oldvars !== null ? $this->_fixvars($vars, $oldvars) : $vars;
- if ($newvars !== $oldvars || $ts - $this->changed > $this->lifetime / 2) {
+ if ($newvars !== $oldvars || $ts - $this->changed > $this->lifetime / 3) {
return $this->memcache->set($key, serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $newvars)),
- MEMCACHE_COMPRESSED, $this->lifetime);
+ MEMCACHE_COMPRESSED, $this->lifetime + 60);
}
return true;
diff --git a/program/lib/Roundcube/rcube_string_replacer.php b/program/lib/Roundcube/rcube_string_replacer.php
index 0fc90a55a..d1f1f4dbc 100644
--- a/program/lib/Roundcube/rcube_string_replacer.php
+++ b/program/lib/Roundcube/rcube_string_replacer.php
@@ -39,7 +39,7 @@ class rcube_string_replacer
$url1 = '.:;,';
$url2 = 'a-zA-Z0-9%=#$@+?!&\\/_~\\[\\]\\(\\){}\*-';
- $this->link_pattern = "/([\w]+:\/\/|\W[Ww][Ww][Ww]\.|^[Ww][Ww][Ww]\.)($utf_domain([$url1]?[$url2]+)*)/";
+ $this->link_pattern = "/([\w]+:\/\/|\W[Ww][Ww][Ww]\.|^[Ww][Ww][Ww]\.)($utf_domain([$url1]*[$url2]+)*)/";
$this->mailto_pattern = "/("
."[-\w!\#\$%&\'*+~\/^`|{}=]+(?:\.[-\w!\#\$%&\'*+~\/^`|{}=]+)*" // local-part
."@$utf_domain" // domain-part
diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php
index 6b2efcc78..8f7fe9749 100644
--- a/program/lib/Roundcube/rcube_washtml.php
+++ b/program/lib/Roundcube/rcube_washtml.php
@@ -410,6 +410,25 @@ class rcube_washtml
);
$html = preg_replace($html_search, $html_replace, trim($html));
+ //-> Replace all of those weird MS Word quotes and other high characters
+ $badwordchars=array(
+ "\xe2\x80\x98", // left single quote
+ "\xe2\x80\x99", // right single quote
+ "\xe2\x80\x9c", // left double quote
+ "\xe2\x80\x9d", // right double quote
+ "\xe2\x80\x94", // em dash
+ "\xe2\x80\xa6" // elipses
+ );
+ $fixedwordchars=array(
+ "'",
+ "'",
+ '"',
+ '"',
+ '&mdash;',
+ '...'
+ );
+ $html = str_replace($badwordchars,$fixedwordchars, $html);
+
// PCRE errors handling (#1486856), should we use something like for every preg_* use?
if ($html === null && ($preg_error = preg_last_error()) != PREG_NO_ERROR) {
$errstr = "Could not clean up HTML message! PCRE Error: $preg_error.";
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 9ffde8a57..2330bc040 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -1450,17 +1450,17 @@ function rcmail_priority_selector($attrib)
rcube_label('normal'),
rcube_label('high'),
rcube_label('highest')),
- array(5, 4, 0, 2, 1));
+ array('5', '4', '0', '2', '1'));
if (isset($_POST['_priority']))
$sel = $_POST['_priority'];
- else if (intval($MESSAGE->headers->priority) != 3)
- $sel = intval($MESSAGE->headers->priority);
+ else if (isset($MESSAGE->headers->priority) && intval($MESSAGE->headers->priority) != 3)
+ $sel = $MESSAGE->headers->priority;
else
$sel = 0;
$out = $form_start ? "$form_start\n" : '';
- $out .= $selector->show($sel);
+ $out .= $selector->show(strval($sel));
$out .= $form_end ? "\n$form_end" : '';
return $out;
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index ae23d4a6d..a41e3ffeb 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1783,9 +1783,8 @@ function rcmail_identity_select($MESSAGE, $identities = null, $compose_mode = 'r
// Try Return-Path
if ($from_idx === null && ($return_path = $MESSAGE->headers->others['return-path'])) {
foreach ($identities as $idx => $ident) {
- $ident = str_replace('@', '=', $ident['email_ascii']) . '@';
foreach ((array)$return_path as $path) {
- if (strpos($path, $ident) !== false) {
+ if (stripos($path, $ident['email_ascii']) !== false) {
$from_idx = $idx;
break 2;
}
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index a27e788a3..3334caa8b 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -134,7 +134,7 @@ else if (strlen($part_id)) {
$valid = $file_extension && in_array($file_extension, (array)$extensions) || !empty($_REQUEST['_mimeclass']);
// 2. detect the real mimetype of the attachment part and compare it with the stated mimetype and filename extension
- if ($valid || !$file_extension || $mimetype == 'application/octet-stream' || $mimetype == 'text/plain') {
+ if ($valid || !$file_extension || $mimetype == 'application/octet-stream' || stripos($mimetype, 'text/') === 0) {
if ($part->body) // part body is already loaded
$body = $part->body;
else if ($part->size && $part->size < 1024*1024) // load the entire part if it's small enough
@@ -189,8 +189,8 @@ else if (strlen($part_id)) {
rcube_label(array(
'name' => 'attachmentvalidationerror',
'vars' => array(
- 'expected' => $mimetype . ($file_extension ? "(.$file_extension)" : ''),
- 'detected' => $real_mimetype . ($extensions[0] ? "(.$extensions[0])" : ''),
+ 'expected' => $mimetype . ($file_extension ? " (.$file_extension)" : ''),
+ 'detected' => $real_mimetype . ($extensions[0] ? " (.$extensions[0])" : ''),
)
)) .
html::p(array('class' => 'rcmail-inline-buttons'),
@@ -233,7 +233,6 @@ else if (strlen($part_id)) {
header("Content-Transfer-Encoding: binary");
}
-
// deliver part content
if ($ctype_primary == 'text' && $ctype_secondary == 'html' && empty($plugin['download'])) {
// Check if we have enough memory to handle the message in it
diff --git a/tests/Framework/StringReplacer.php b/tests/Framework/StringReplacer.php
index dc7638734..8f6eaf4b9 100644
--- a/tests/Framework/StringReplacer.php
+++ b/tests/Framework/StringReplacer.php
@@ -27,6 +27,7 @@ class Framework_StringReplacer extends PHPUnit_Framework_TestCase
array('http://domain.tld/path*path2', '<a href="http://domain.tld/path*path2">http://domain.tld/path*path2</a>'),
array("Click this link:\nhttps://mail.xn--brderli-o2a.ch/rc/ EOF", "Click this link:\n<a href=\"https://mail.xn--brderli-o2a.ch/rc/\">https://mail.xn--brderli-o2a.ch/rc/</a> EOF"),
array('Start http://localhost/?foo End', 'Start <a href="http://localhost/?foo">http://localhost/?foo</a> End'),
+ array('http://localhost/?foo=bar. Period', '<a href="http://localhost/?foo=bar">http://localhost/?foo=bar</a>. Period'),
array('www.domain.tld', '<a href="http://www.domain.tld">www.domain.tld</a>'),
array('WWW.DOMAIN.TLD', '<a href="http://WWW.DOMAIN.TLD">WWW.DOMAIN.TLD</a>'),
array('[http://link.com]', '[<a href="http://link.com">http://link.com</a>]'),
@@ -35,6 +36,7 @@ class Framework_StringReplacer extends PHPUnit_Framework_TestCase
array('(http://link.com)', '(<a href="http://link.com">http://link.com</a>)'),
array('http://link.com?a(b)c', '<a href="http://link.com?a(b)c">http://link.com?a(b)c</a>'),
array('http://link.com?(link)', '<a href="http://link.com?(link)">http://link.com?(link)</a>'),
+ array('https://github.com/a/b/compare/3a0f82...1f4b2a after', '<a href="https://github.com/a/b/compare/3a0f82...1f4b2a">https://github.com/a/b/compare/3a0f82...1f4b2a</a> after'),
array('http://<test>', 'http://<test>'),
array('http://', 'http://'),
array('1@1.com www.domain.tld', '<a href="mailto:1@1.com">1@1.com</a> <a href="http://www.domain.tld">www.domain.tld</a>'),