summaryrefslogtreecommitdiff
path: root/program/lib
diff options
context:
space:
mode:
Diffstat (limited to 'program/lib')
-rw-r--r--program/lib/Roundcube/html.php19
-rw-r--r--program/lib/Roundcube/rcube.php51
-rw-r--r--program/lib/Roundcube/rcube_browser.php16
-rw-r--r--program/lib/Roundcube/rcube_config.php14
-rw-r--r--program/lib/Roundcube/rcube_db_mysql.php4
-rw-r--r--program/lib/Roundcube/rcube_html2text.php4
-rw-r--r--program/lib/Roundcube/rcube_imap_generic.php36
-rw-r--r--program/lib/Roundcube/rcube_ldap.php2
-rw-r--r--program/lib/Roundcube/rcube_ldap_generic.php4
-rw-r--r--program/lib/Roundcube/rcube_mime.php8
-rw-r--r--program/lib/Roundcube/rcube_plugin.php6
-rw-r--r--program/lib/Roundcube/rcube_result_index.php19
-rw-r--r--program/lib/Roundcube/rcube_result_thread.php35
-rw-r--r--program/lib/Roundcube/rcube_smtp.php14
-rw-r--r--program/lib/Roundcube/rcube_storage.php5
-rw-r--r--program/lib/Roundcube/rcube_utils.php12
-rw-r--r--program/lib/Roundcube/rcube_washtml.php2
17 files changed, 176 insertions, 75 deletions
diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php
index 587b030ce..64324dd8e 100644
--- a/program/lib/Roundcube/html.php
+++ b/program/lib/Roundcube/html.php
@@ -269,19 +269,28 @@ class html
return '';
}
- $allowed_f = array_flip((array)$allowed);
+ $allowed_f = array_flip((array)$allowed);
$attrib_arr = array();
+
foreach ($attrib as $key => $value) {
// skip size if not numeric
if ($key == 'size' && !is_numeric($value)) {
continue;
}
- // ignore "internal" or not allowed attributes
- if ($key == 'nl' || ($allowed && !isset($allowed_f[$key])) || $value === null) {
+ // ignore "internal" or empty attributes
+ if ($key == 'nl' || $value === null) {
continue;
}
+ // ignore not allowed attributes
+ if (!empty($allowed)) {
+ $is_data_attr = substr_compare($key, 'data-', 0, 5) === 0;
+ if (!isset($allowed_f[$key]) && (!$is_data_attr || !isset($allowed_f['data-*']))) {
+ continue;
+ }
+ }
+
// skip empty eventhandlers
if (preg_match('/^on[a-z]+/', $key) && !$value) {
continue;
@@ -880,7 +889,7 @@ class html_table extends html
private function _row_tagname()
{
static $row_tagnames = array('table' => 'tr', 'ul' => 'li', '*' => 'div');
- return $row_tagnames[$this->tagname] ?: $row_tagnames['*'];
+ return $row_tagnames[$this->tagname] ? $row_tagnames[$this->tagname] : $row_tagnames['*'];
}
/**
@@ -889,7 +898,7 @@ class html_table extends html
private function _col_tagname()
{
static $col_tagnames = array('table' => 'td', '*' => 'span');
- return $col_tagnames[$this->tagname] ?: $col_tagnames['*'];
+ return $col_tagnames[$this->tagname] ? $col_tagnames[$this->tagname] : $col_tagnames['*'];
}
}
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index 503e29d6f..69d95f023 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -3,8 +3,8 @@
/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2008-2012, The Roundcube Dev Team |
- | Copyright (C) 2011-2012, Kolab Systems AG |
+ | Copyright (C) 2008-2014, The Roundcube Dev Team |
+ | Copyright (C) 2011-2014, Kolab Systems AG |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -94,6 +94,13 @@ class rcube
*/
public $plugins;
+ /**
+ * Instance of rcube_user class.
+ *
+ * @var rcube_user
+ */
+ public $user;
+
/* private/protected vars */
protected $texts;
@@ -1114,7 +1121,20 @@ class rcube
// log_driver == 'file' is assumed here
$line = sprintf("[%s]: %s\n", $date, $line);
- $log_dir = self::$instance ? self::$instance->config->get('log_dir') : null;
+ $log_dir = null;
+
+ // per-user logging is activated
+ if (self::$instance && self::$instance->config->get('per_user_logging', false) && self::$instance->get_user_id()) {
+ $log_dir = self::$instance->get_user_log_dir();
+ if (empty($log_dir))
+ return false;
+ }
+ else if (!empty($log['dir'])) {
+ $log_dir = $log['dir'];
+ }
+ else if (self::$instance) {
+ $log_dir = self::$instance->config->get('log_dir');
+ }
if (empty($log_dir)) {
$log_dir = RCUBE_INSTALL_PATH . 'logs';
@@ -1289,6 +1309,20 @@ class rcube
self::write_log($dest, sprintf("%s: %0.4f sec", $label, $diff));
}
+ /**
+ * Setter for system user object
+ *
+ * @param rcube_user Current user instance
+ */
+ public function set_user($user)
+ {
+ if (is_object($user)) {
+ $this->user = $user;
+
+ // overwrite config with user preferences
+ $this->config->set_user_prefs((array)$this->user->get_prefs());
+ }
+ }
/**
* Getter for logged user ID.
@@ -1352,6 +1386,17 @@ class rcube
}
}
+ /**
+ * Get the per-user log directory
+ */
+ protected function get_user_log_dir()
+ {
+ $log_dir = $this->config->get('log_dir', RCUBE_INSTALL_PATH . 'logs');
+ $user_name = $this->get_user_name();
+ $user_log_dir = $log_dir . '/' . $user_name;
+
+ return !empty($user_name) && is_writable($user_log_dir) ? $user_log_dir : false;
+ }
/**
* Getter for logged user language code.
diff --git a/program/lib/Roundcube/rcube_browser.php b/program/lib/Roundcube/rcube_browser.php
index e53e31200..b9642d8f9 100644
--- a/program/lib/Roundcube/rcube_browser.php
+++ b/program/lib/Roundcube/rcube_browser.php
@@ -34,14 +34,20 @@ class rcube_browser
$this->linux = strpos($HTTP_USER_AGENT, 'linux') != false;
$this->unix = strpos($HTTP_USER_AGENT, 'unix') != false;
- $this->opera = strpos($HTTP_USER_AGENT, 'opera') !== false;
+ $this->webkit = strpos($HTTP_USER_AGENT, 'applewebkit') !== false;
+ $this->opera = strpos($HTTP_USER_AGENT, 'opera') !== false || ($this->webkit && strpos($HTTP_USER_AGENT, 'opr/') !== false);
$this->ns = strpos($HTTP_USER_AGENT, 'netscape') !== false;
- $this->chrome = strpos($HTTP_USER_AGENT, 'chrome') !== false;
+ $this->chrome = !$this->opera && strpos($HTTP_USER_AGENT, 'chrome') !== false;
$this->ie = !$this->opera && (strpos($HTTP_USER_AGENT, 'compatible; msie') !== false || strpos($HTTP_USER_AGENT, 'trident/') !== false);
- $this->safari = !$this->chrome && (strpos($HTTP_USER_AGENT, 'safari') !== false || strpos($HTTP_USER_AGENT, 'applewebkit') !== false);
- $this->mz = !$this->ie && !$this->safari && !$this->chrome && !$this->ns && strpos($HTTP_USER_AGENT, 'mozilla') !== false;
+ $this->safari = !$this->opera && !$this->chrome && ($this->webkit || strpos($HTTP_USER_AGENT, 'safari') !== false);
+ $this->mz = !$this->ie && !$this->safari && !$this->chrome && !$this->ns && !$this->opera && strpos($HTTP_USER_AGENT, 'mozilla') !== false;
- if (preg_match('/(chrome|msie|opera|version|khtml)(\s*|\/)([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
+ if ($this->opera) {
+ if (preg_match('/(opera|opr)\/([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
+ $this->ver = (float) $regs[2];
+ }
+ }
+ else if (preg_match('/(chrome|msie|version|khtml)(\s*|\/)([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
$this->ver = (float) $regs[3];
}
else if (preg_match('/rv:([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index 0352e4772..afe13e879 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -63,7 +63,7 @@ class rcube_config
$this->paths = explode(PATH_SEPARATOR, $paths);
// make all paths absolute
foreach ($this->paths as $i => $path) {
- if (!$this->_is_absolute($path)) {
+ if (!rcube_utils::is_absolute_path($path)) {
if ($realpath = realpath(RCUBE_INSTALL_PATH . $path)) {
$this->paths[$i] = unslashify($realpath) . '/';
}
@@ -243,8 +243,8 @@ class rcube_config
*/
public function resolve_paths($file, $use_env = true)
{
- $files = array();
- $abs_path = $this->_is_absolute($file);
+ $files = array();
+ $abs_path = rcube_utils::is_absolute_path($file);
foreach ($this->paths as $basepath) {
$realpath = $abs_path ? $file : realpath($basepath . '/' . $file);
@@ -270,14 +270,6 @@ class rcube_config
}
/**
- * Determine whether the given file path is absolute or relative
- */
- private function _is_absolute($path)
- {
- return $path[0] == DIRECTORY_SEPARATOR || preg_match('!^[a-z]:[\\\\/]!i', $path);
- }
-
- /**
* Getter for a specific config parameter
*
* @param string $name Parameter name
diff --git a/program/lib/Roundcube/rcube_db_mysql.php b/program/lib/Roundcube/rcube_db_mysql.php
index d3d0ac5c8..e6417cc0a 100644
--- a/program/lib/Roundcube/rcube_db_mysql.php
+++ b/program/lib/Roundcube/rcube_db_mysql.php
@@ -128,11 +128,11 @@ class rcube_db_mysql extends rcube_db
$result = array();
if (!empty($dsn['key'])) {
- $result[PDO::MYSQL_ATTR_KEY] = $dsn['key'];
+ $result[PDO::MYSQL_ATTR_SSL_KEY] = $dsn['key'];
}
if (!empty($dsn['cipher'])) {
- $result[PDO::MYSQL_ATTR_CIPHER] = $dsn['cipher'];
+ $result[PDO::MYSQL_ATTR_SSL_CIPHER] = $dsn['cipher'];
}
if (!empty($dsn['cert'])) {
diff --git a/program/lib/Roundcube/rcube_html2text.php b/program/lib/Roundcube/rcube_html2text.php
index 01362e6fb..3b4508da9 100644
--- a/program/lib/Roundcube/rcube_html2text.php
+++ b/program/lib/Roundcube/rcube_html2text.php
@@ -616,6 +616,10 @@ class rcube_html2text
break;
}
+ // abort on invalid tag structure (e.g. no closing tag found)
+ else {
+ break;
+ }
}
while ($end || $next);
}
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index f9a62f010..4cb61e95d 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -73,6 +73,7 @@ class rcube_imap_generic
const COMMAND_NORESPONSE = 1;
const COMMAND_CAPABILITY = 2;
const COMMAND_LASTLINE = 4;
+ const COMMAND_ANONYMIZED = 8;
const DEBUG_LINE_LENGTH = 4098; // 4KB + 2B for \r\n
@@ -88,16 +89,28 @@ class rcube_imap_generic
*
* @param string $string Command string
* @param bool $endln True if CRLF need to be added at the end of command
+ * @param bool $anonymized Don't write the given data to log but a placeholder
*
* @param int Number of bytes sent, False on error
*/
- function putLine($string, $endln=true)
+ function putLine($string, $endln=true, $anonymized=false)
{
if (!$this->fp)
return false;
if ($this->_debug) {
- $this->debug('C: '. rtrim($string));
+ // anonymize the sent command for logging
+ $cut = $endln ? 2 : 0;
+ if ($anonymized && preg_match('/^(A\d+ (?:[A-Z]+ )+)(.+)/', $string, $m)) {
+ $log = $m[1] . sprintf('****** [%d]', strlen($m[2]) - $cut);
+ }
+ else if ($anonymized) {
+ $log = sprintf('****** [%d]', strlen($string) - $cut);
+ }
+ else {
+ $log = rtrim($string);
+ }
+ $this->debug('C: ' . $log);
}
$res = fwrite($this->fp, $string . ($endln ? "\r\n" : ''));
@@ -116,10 +129,11 @@ class rcube_imap_generic
*
* @param string $string Command string
* @param bool $endln True if CRLF need to be added at the end of command
+ * @param bool $anonymized Don't write the given data to log but a placeholder
*
* @return int|bool Number of bytes sent, False on error
*/
- function putLineC($string, $endln=true)
+ function putLineC($string, $endln=true, $anonymized=false)
{
if (!$this->fp) {
return false;
@@ -138,7 +152,7 @@ class rcube_imap_generic
$parts[$i+1] = sprintf("{%d+}\r\n", $matches[1]);
}
- $bytes = $this->putLine($parts[$i].$parts[$i+1], false);
+ $bytes = $this->putLine($parts[$i].$parts[$i+1], false, $anonymized);
if ($bytes === false)
return false;
$res += $bytes;
@@ -153,7 +167,7 @@ class rcube_imap_generic
$i++;
}
else {
- $bytes = $this->putLine($parts[$i], false);
+ $bytes = $this->putLine($parts[$i], false, $anonymized);
if ($bytes === false)
return false;
$res += $bytes;
@@ -519,7 +533,7 @@ class rcube_imap_generic
$reply = base64_encode($user . ' ' . $hash);
// send result
- $this->putLine($reply);
+ $this->putLine($reply, true, true);
}
else {
// RFC2831: DIGEST-MD5
@@ -537,7 +551,7 @@ class rcube_imap_generic
base64_decode($challenge), $this->host, 'imap', $user));
// send result
- $this->putLine($reply);
+ $this->putLine($reply, true, true);
$line = trim($this->readReply());
if ($line[0] == '+') {
@@ -577,7 +591,7 @@ class rcube_imap_generic
// RFC 4959 (SASL-IR): save one round trip
if ($this->getCapability('SASL-IR')) {
list($result, $line) = $this->execute("AUTHENTICATE PLAIN", array($reply),
- self::COMMAND_LASTLINE | self::COMMAND_CAPABILITY);
+ self::COMMAND_LASTLINE | self::COMMAND_CAPABILITY | self::COMMAND_ANONYMIZED);
}
else {
$this->putLine($this->nextTag() . " AUTHENTICATE PLAIN");
@@ -588,7 +602,7 @@ class rcube_imap_generic
}
// send result, get reply and process it
- $this->putLine($reply);
+ $this->putLine($reply, true, true);
$line = $this->readReply();
$result = $this->parseResult($line);
}
@@ -619,7 +633,7 @@ class rcube_imap_generic
function login($user, $password)
{
list($code, $response) = $this->execute('LOGIN', array(
- $this->escape($user), $this->escape($password)), self::COMMAND_CAPABILITY);
+ $this->escape($user), $this->escape($password)), self::COMMAND_CAPABILITY | self::COMMAND_ANONYMIZED);
// re-set capabilities list if untagged CAPABILITY response provided
if (preg_match('/\* CAPABILITY (.+)/i', $response, $matches)) {
@@ -3419,7 +3433,7 @@ class rcube_imap_generic
}
// Send command
- if (!$this->putLineC($query)) {
+ if (!$this->putLineC($query, true, ($options & self::COMMAND_ANONYMIZED))) {
$this->setError(self::ERROR_COMMAND, "Unable to send command: $query");
return $noresp ? self::ERROR_COMMAND : array(self::ERROR_COMMAND, '');
}
diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index 0da3e2c87..de3790e5c 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -554,7 +554,7 @@ class rcube_ldap extends rcube_addressbook
}
else {
$prop = $this->group_id ? $this->group_data : $this->prop;
- $base_dn = $this->group_id ? $this->group_base_dn : $this->base_dn;
+ $base_dn = $this->group_id ? $prop['base_dn'] : $this->base_dn;
// use global search filter
if (!empty($this->filter))
diff --git a/program/lib/Roundcube/rcube_ldap_generic.php b/program/lib/Roundcube/rcube_ldap_generic.php
index 923a12a41..b85afe4ce 100644
--- a/program/lib/Roundcube/rcube_ldap_generic.php
+++ b/program/lib/Roundcube/rcube_ldap_generic.php
@@ -240,7 +240,7 @@ class rcube_ldap_generic
$method = 'DIGEST-MD5';
}
- $this->_debug("C: SASL Bind [mech: $method, authc: $authc, authz: $authz, pass: $pass]");
+ $this->_debug("C: SASL Bind [mech: $method, authc: $authc, authz: $authz, pass: **** [" . strlen($pass) . "]");
if (ldap_sasl_bind($this->conn, NULL, $pass, $method, NULL, $authc, $authz)) {
$this->_debug("S: OK");
@@ -271,7 +271,7 @@ class rcube_ldap_generic
return false;
}
- $this->_debug("C: Bind $dn [pass: $pass]");
+ $this->_debug("C: Bind $dn, pass: **** [" . strlen($pass) . "]");
if (@ldap_bind($this->conn, $dn, $pass)) {
$this->_debug("S: OK");
diff --git a/program/lib/Roundcube/rcube_mime.php b/program/lib/Roundcube/rcube_mime.php
index a931c27c1..091b2fae8 100644
--- a/program/lib/Roundcube/rcube_mime.php
+++ b/program/lib/Roundcube/rcube_mime.php
@@ -366,6 +366,9 @@ class rcube_mime
$address = 'MAILER-DAEMON';
$name = substr($val, 0, -strlen($m[1]));
}
+ else if (preg_match('/('.$email_rx.')/', $val, $m)) {
+ $name = $m[1];
+ }
else {
$name = $val;
}
@@ -378,11 +381,16 @@ class rcube_mime
}
if ($decode) {
$name = self::decode_header($name, $fallback);
+ // some clients encode addressee name with quotes around it
+ if ($name[0] == '"' && $name[strlen($name)-1] == '"') {
+ $name = substr($name, 1, -1);
+ }
}
}
if (!$address && $name) {
$address = $name;
+ $name = '';
}
if ($address) {
diff --git a/program/lib/Roundcube/rcube_plugin.php b/program/lib/Roundcube/rcube_plugin.php
index aa6d8376e..f0af95332 100644
--- a/program/lib/Roundcube/rcube_plugin.php
+++ b/program/lib/Roundcube/rcube_plugin.php
@@ -125,13 +125,17 @@ abstract class rcube_plugin
$fpath = $this->home.'/'.$fname;
$rcube = rcube::get_instance();
- if (is_file($fpath) && !$rcube->config->load_from_file($fpath)) {
+ if (($is_local = is_file($fpath)) && !$rcube->config->load_from_file($fpath)) {
rcube::raise_error(array(
'code' => 527, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "Failed to load config from $fpath"), true, false);
return false;
}
+ else if (!$is_local) {
+ // Search plugin_name.inc.php file in any configured path
+ return $rcube->config->load_from_file($this->ID . '.inc.php');
+ }
return true;
}
diff --git a/program/lib/Roundcube/rcube_result_index.php b/program/lib/Roundcube/rcube_result_index.php
index 5f592c54f..058f25c6f 100644
--- a/program/lib/Roundcube/rcube_result_index.php
+++ b/program/lib/Roundcube/rcube_result_index.php
@@ -231,29 +231,13 @@ class rcube_result_index
/**
- * Filters data set. Removes elements listed in $ids list.
+ * Filters data set. Removes elements not listed in $ids list.
*
* @param array $ids List of IDs to remove.
*/
public function filter($ids = array())
{
$data = $this->get();
- $data = array_diff($data, $ids);
-
- $this->meta = array();
- $this->meta['count'] = count($data);
- $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data);
- }
-
-
- /**
- * Filters data set. Removes elements not listed in $ids list.
- *
- * @param array $ids List of IDs to keep.
- */
- public function intersect($ids = array())
- {
- $data = $this->get();
$data = array_intersect($data, $ids);
$this->meta = array();
@@ -332,6 +316,7 @@ class rcube_result_index
if (empty($this->raw_data)) {
return array();
}
+
return explode(self::SEPARATOR_ELEMENT, $this->raw_data);
}
diff --git a/program/lib/Roundcube/rcube_result_thread.php b/program/lib/Roundcube/rcube_result_thread.php
index 7657550be..ceaaf59a6 100644
--- a/program/lib/Roundcube/rcube_result_thread.php
+++ b/program/lib/Roundcube/rcube_result_thread.php
@@ -453,7 +453,7 @@ class rcube_result_thread
// when sorting search result it's good to make the index smaller
if ($index->count() != $this->count_messages()) {
- $index->intersect($this->get());
+ $index->filter($this->get());
}
$result = array_fill_keys($index->get(), null);
@@ -606,33 +606,39 @@ class rcube_result_thread
// arrays handling is much more expensive
// For the following structure: THREAD (2)(3 6 (4 23)(44 7 96))
// -- 2
- //
// -- 3
// \-- 6
// |-- 4
// | \-- 23
// |
// \-- 44
- // \-- 7
- // \-- 96
+ // \-- 7
+ // \-- 96
//
// The output will be: 2,3^1:6^2:4^3:23^2:44^3:7^4:96
if ($str[$begin] != '(') {
- $stop = $begin + strspn($str, '1234567890', $begin, $end - $begin);
- $msg = substr($str, $begin, $stop - $begin);
- if (!$msg) {
+ // find next bracket
+ $stop = $begin + strcspn($str, '()', $begin, $end - $begin);
+ $messages = explode(' ', trim(substr($str, $begin, $stop - $begin)));
+
+ if (empty($messages)) {
return $node;
}
- $this->meta['messages']++;
-
- $node .= ($depth ? self::SEPARATOR_ITEM.$depth.self::SEPARATOR_LEVEL : '').$msg;
+ foreach ($messages as $msg) {
+ if ($msg) {
+ $node .= ($depth ? self::SEPARATOR_ITEM.$depth.self::SEPARATOR_LEVEL : '').$msg;
+ $this->meta['messages']++;
+ $depth++;
+ }
+ }
- if ($stop + 1 < $end) {
- $node .= $this->parse_thread($str, $stop + 1, $end, $depth + 1);
+ if ($stop < $end) {
+ $node .= $this->parse_thread($str, $stop, $end, $depth);
}
- } else {
+ }
+ else {
$off = $begin;
while ($off < $end) {
$start = $off;
@@ -649,7 +655,8 @@ class rcube_result_thread
if ($p1 !== false && $p1 < $p) {
$off = $p1 + 1;
$n++;
- } else {
+ }
+ else {
$off = $p + 1;
$n--;
}
diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php
index 60b1389ea..70f15dc7b 100644
--- a/program/lib/Roundcube/rcube_smtp.php
+++ b/program/lib/Roundcube/rcube_smtp.php
@@ -29,6 +29,7 @@ class rcube_smtp
private $conn = null;
private $response;
private $error;
+ private $anonymize_log = 0;
// define headers delimiter
const SMTP_MIME_CRLF = "\r\n";
@@ -67,6 +68,7 @@ class rcube_smtp
'smtp_auth_type' => $rcube->config->get('smtp_auth_type'),
'smtp_helo_host' => $rcube->config->get('smtp_helo_host'),
'smtp_timeout' => $rcube->config->get('smtp_timeout'),
+ 'smtp_conn_options' => $rcube->config->get('smtp_conn_options'),
'smtp_auth_callbacks' => array(),
));
@@ -106,10 +108,11 @@ class rcube_smtp
// IDNA Support
$smtp_host = rcube_utils::idn_to_ascii($smtp_host);
- $this->conn = new Net_SMTP($smtp_host, $smtp_port, $helo_host);
+ $this->conn = new Net_SMTP($smtp_host, $smtp_port, $helo_host, false, 0, $CONFIG['smtp_conn_options']);
if ($rcube->config->get('smtp_debug')) {
$this->conn->setDebug(true, array($this, 'debug_handler'));
+ $this->anonymize_log = 0;
}
// register authentication methods
@@ -329,6 +332,15 @@ class rcube_smtp
*/
public function debug_handler(&$smtp, $message)
{
+ // catch AUTH commands and set anonymization flag for subsequent sends
+ if (preg_match('/^Send: AUTH ([A-Z]+)/', $message, $m)) {
+ $this->anonymize_log = $m[1] == 'LOGIN' ? 2 : 1;
+ }
+ // anonymize this log entry
+ else if ($this->anonymize_log > 0 && strpos($message, 'Send:') === 0 && --$this->anonymize_log == 0) {
+ $message = sprintf('Send: ****** [%d]', strlen($message) - 8);
+ }
+
if (($len = strlen($message)) > self::DEBUG_LINE_LENGTH) {
$diff = $len - self::DEBUG_LINE_LENGTH;
$message = substr($message, 0, self::DEBUG_LINE_LENGTH)
diff --git a/program/lib/Roundcube/rcube_storage.php b/program/lib/Roundcube/rcube_storage.php
index ca65af1cb..c09f05328 100644
--- a/program/lib/Roundcube/rcube_storage.php
+++ b/program/lib/Roundcube/rcube_storage.php
@@ -613,7 +613,7 @@ abstract class rcube_storage
/**
* Parse message UIDs input
*
- * @param mixed $uids UIDs array or comma-separated list or '*' or '1:*'
+ * @param mixed $uids UIDs array or comma-separated list or '*' or '1:*'
*
* @return array Two elements array with UIDs converted to list and ALL flag
*/
@@ -633,6 +633,9 @@ abstract class rcube_storage
if (is_array($uids)) {
$uids = join(',', $uids);
}
+ else if (strpos($uids, ':')) {
+ $uids = join(',', rcube_imap_generic::uncompressMessageSet($uids));
+ }
if (preg_match('/[^0-9,]/', $uids)) {
$uids = '';
diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
index c48cd80e8..46d53ac91 100644
--- a/program/lib/Roundcube/rcube_utils.php
+++ b/program/lib/Roundcube/rcube_utils.php
@@ -1045,4 +1045,16 @@ class rcube_utils
return !in_array($str, array('false', '0', 'no', 'off', 'nein', ''), true);
}
+ /**
+ * OS-dependent absolute path detection
+ */
+ public static function is_absolute_path($path)
+ {
+ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
+ return (bool) preg_match('!^[a-z]:[\\\\/]!i', $path);
+ }
+ else {
+ return $path[0] == DIRECTORY_SEPARATOR;
+ }
+ }
}
diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php
index 5a5b3dc55..51f7930aa 100644
--- a/program/lib/Roundcube/rcube_washtml.php
+++ b/program/lib/Roundcube/rcube_washtml.php
@@ -184,7 +184,7 @@ class rcube_washtml
'|rgb\(\s*[0-9]+\s*,\s*[0-9]+\s*,\s*[0-9]+\s*\)'.
'|-?[0-9.]+\s*(em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)?'.
'|#[0-9a-f]{3,6}'.
- '|[a-z0-9", -]+'.
+ '|[a-z0-9"\', -]+'.
')\s*/i', $str, $match)
) {
if ($match[2]) {