summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_addressbook.php2
-rw-r--r--program/include/rcube_db.php18
-rw-r--r--program/include/rcube_imap.php7
-rw-r--r--program/include/rcube_imap_generic.php15
-rw-r--r--program/include/rcube_message.php7
-rw-r--r--program/include/rcube_utils.php4
6 files changed, 36 insertions, 17 deletions
diff --git a/program/include/rcube_addressbook.php b/program/include/rcube_addressbook.php
index 069ea5715..f4f255322 100644
--- a/program/include/rcube_addressbook.php
+++ b/program/include/rcube_addressbook.php
@@ -465,7 +465,7 @@ abstract class rcube_addressbook
$fn = $contact['name'];
if (!$fn) // default display name composition according to vcard standard
- $fn = join(' ', array_filter(array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix'])));
+ $fn = trim(join(' ', array_filter(array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix']))));
// use email address part for name
$email = is_array($contact['email']) ? $contact['email'][0] : $contact['email'];
diff --git a/program/include/rcube_db.php b/program/include/rcube_db.php
index f97d70ab3..eb1ad31b2 100644
--- a/program/include/rcube_db.php
+++ b/program/include/rcube_db.php
@@ -388,13 +388,19 @@ class rcube_db
$idx = 0;
while ($pos = strpos($query, '?', $pos)) {
- $val = $this->quote($params[$idx++]);
- unset($params[$idx-1]);
- $query = substr_replace($query, $val, $pos, 1);
- $pos += strlen($val);
+ if ($query[$pos+1] == '?') { // skip escaped ?
+ $pos += 2;
+ }
+ else {
+ $val = $this->quote($params[$idx++]);
+ unset($params[$idx-1]);
+ $query = substr_replace($query, $val, $pos, 1);
+ $pos += strlen($val);
+ }
}
- $query = rtrim($query, ';');
+ // replace escaped ? back to normal
+ $query = rtrim(strtr($query, array('??' => '?')), ';');
$this->debug($query);
@@ -591,7 +597,7 @@ class rcube_db
'integer' => PDO::PARAM_INT,
);
$type = isset($map[$type]) ? $map[$type] : PDO::PARAM_STR;
- return $this->dbh->quote($input, $type);
+ return strtr($this->dbh->quote($input, $type), array('?' => '??')); // escape ?
}
return 'NULL';
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 0b2f84d4f..ebf31d578 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -3297,11 +3297,8 @@ class rcube_imap extends rcube_storage
}
// Get folder rights (MYRIGHTS)
- if ($acl && !$options['noselect']) {
- // skip shared roots
- if (!$options['is_root'] || $options['namespace'] == 'personal') {
- $options['rights'] = (array)$this->my_rights($folder);
- }
+ if ($acl && ($rights = $this->my_rights($folder))) {
+ $options['rights'] = $rights;
}
// Set 'norename' flag
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index 25e6fc421..cce53aedc 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -2402,10 +2402,13 @@ class rcube_imap_generic
$mode = 0;
}
+ // Use BINARY extension when possible (and safe)
+ $binary = $mode && preg_match('/^[0-9.]+$/', $part) && $this->hasCapability('BINARY');
+ $fetch_mode = $binary ? 'BINARY' : 'BODY';
+
// format request
- $reply_key = '* ' . $id;
$key = $this->nextTag();
- $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])";
+ $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id ($fetch_mode.PEEK[$part])";
// send request
if (!$this->putLine($request)) {
@@ -2413,6 +2416,10 @@ class rcube_imap_generic
return false;
}
+ if ($binary) {
+ $mode = -1;
+ }
+
// receive reply line
do {
$line = rtrim($this->readLine(1024));
@@ -2457,13 +2464,13 @@ class rcube_imap_generic
$prev = '';
while ($bytes > 0) {
- $line = $this->readLine(4096);
+ $line = $this->readLine(8192);
if ($line === NULL) {
break;
}
- $len = strlen($line);
+ $len = strlen($line);
if ($len > $bytes) {
$line = substr($line, 0, $bytes);
diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php
index 6af1d0133..fe2fcf354 100644
--- a/program/include/rcube_message.php
+++ b/program/include/rcube_message.php
@@ -494,8 +494,13 @@ class rcube_message
}
// list as attachment as well
- if (!empty($mail_part->filename))
+ if (!empty($mail_part->filename)) {
+ $this->attachments[] = $mail_part;
+ }
+ // list html part as attachment (here the part is most likely inside a multipart/related part)
+ else if ($this->parse_alternative && ($secondary_type == 'html' && !$this->opt['prefer_html'])) {
$this->attachments[] = $mail_part;
+ }
}
// part message/*
else if ($primary_type == 'message') {
diff --git a/program/include/rcube_utils.php b/program/include/rcube_utils.php
index 23bf556e4..b278431a6 100644
--- a/program/include/rcube_utils.php
+++ b/program/include/rcube_utils.php
@@ -221,6 +221,10 @@ class rcube_utils
static $js_rep_table = false;
static $xml_rep_table = false;
+ if (!is_string($str)) {
+ $str = strval($str);
+ }
+
// encode for HTML output
if ($enctype == 'html') {
if (!$html_encode_arr) {