summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-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
-rw-r--r--program/js/app.js8
-rw-r--r--program/steps/addressbook/edit.inc3
-rw-r--r--program/steps/addressbook/import.inc22
-rw-r--r--program/steps/addressbook/save.inc1
-rw-r--r--program/steps/mail/compose.inc18
11 files changed, 66 insertions, 39 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) {
diff --git a/program/js/app.js b/program/js/app.js
index 48de21764..cf942e291 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -208,7 +208,7 @@ function rcube_webmail()
this.gui_objects.messagelist.parentNode.onmousedown = function(e){ return p.click_on_list(e); };
this.message_list.init();
- this.enable_command('toggle_status', 'toggle_flag', 'menu-open', 'menu-save', true);
+ this.enable_command('toggle_status', 'toggle_flag', 'menu-open', 'menu-save', 'sort', true);
// load messages
this.command('list');
@@ -669,7 +669,7 @@ function rcube_webmail()
this.load_identity(props, 'edit-identity');
else if (this.task == 'mail' && (cid = this.get_single_uid())) {
url = { _mbox: this.env.mailbox };
- url[this.env.mailbox == this.env.drafts_mailbox ? '_draft_uid' : '_uid'] = cid;
+ url[this.env.mailbox == this.env.drafts_mailbox && props != 'new' ? '_draft_uid' : '_uid'] = cid;
this.goto_url('compose', url, true);
}
break;
@@ -6114,7 +6114,7 @@ function rcube_webmail()
this.show_contentframe(false);
// disable commands useless when mailbox is empty
this.enable_command(this.env.message_commands, 'purge', 'expunge',
- 'select-all', 'select-none', 'sort', 'expand-all', 'expand-unread', 'collapse-all', false);
+ 'select-all', 'select-none', 'expand-all', 'expand-unread', 'collapse-all', false);
}
if (this.message_list)
this.triggerEvent('listupdate', { folder:this.env.mailbox, rowcount:this.message_list.rowcount });
@@ -6127,7 +6127,7 @@ function rcube_webmail()
this.env.qsearch = null;
case 'list':
if (this.task == 'mail') {
- this.enable_command('show', 'expunge', 'select-all', 'select-none', 'sort', (this.env.messagecount > 0));
+ this.enable_command('show', 'expunge', 'select-all', 'select-none', (this.env.messagecount > 0));
this.enable_command('purge', this.purge_mailbox_test());
this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading && this.env.messagecount);
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index 0f1fd6697..90069a7eb 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -117,9 +117,6 @@ function rcmail_contact_editform($attrib)
$record = rcmail_get_edit_record();
- // add some labels to client
- $RCMAIL->output->add_label('noemailwarning', 'nonamewarning');
-
// copy (parsed) address template to client
if (preg_match_all('/\{([a-z0-9]+)\}([^{]*)/i', $RCMAIL->config->get('address_template', ''), $templ, PREG_SET_ORDER))
$RCMAIL->output->set_env('address_template', $templ);
diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index 654a33602..15e04b82a 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -189,32 +189,36 @@ if (is_array($_FILES['_file'])) {
$IMPORT_STATS->names = array();
$IMPORT_STATS->skipped_names = array();
$IMPORT_STATS->count = count($vcards);
- $IMPORT_STATS->inserted = $IMPORT_STATS->skipped = $IMPORT_STATS->nomail = $IMPORT_STATS->errors = 0;
+ $IMPORT_STATS->inserted = $IMPORT_STATS->skipped = $IMPORT_STATS->invalid = $IMPORT_STATS->errors = 0;
if ($replace) {
$CONTACTS->delete_all();
}
foreach ($vcards as $vcard) {
- $email = $vcard->email[0];
$a_record = $vcard->get_assoc();
- // skip entries without an e-mail address or invalid
- if (empty($email) || !$CONTACTS->validate($a_record, true)) {
- $IMPORT_STATS->nomail++;
+ // skip invalid (incomplete) entries
+ if (!$CONTACTS->validate($a_record, true)) {
+ $IMPORT_STATS->invalid++;
continue;
}
// We're using UTF8 internally
+ $email = $vcard->email[0];
$email = rcube_idn_to_utf8($email);
- if (!$replace && $email) {
+ if (!$replace) {
+ $existing = null;
// compare e-mail address
- $existing = $CONTACTS->search('email', $email, 1, false);
- if (!$existing->count && $vcard->displayname) { // compare display name
+ if ($email) {
+ $existing = $CONTACTS->search('email', $email, 1, false);
+ }
+ // compare display name if email not found
+ if ((!$existing || !$existing->count) && $vcard->displayname) {
$existing = $CONTACTS->search('name', $vcard->displayname, 1, false);
}
- if ($existing->count) {
+ if ($existing && $existing->count) {
$IMPORT_STATS->skipped++;
$IMPORT_STATS->skipped_names[] = $vcard->displayname ? $vcard->displayname : $email;
continue;
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 3bfce3b4d..887e49827 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -161,7 +161,6 @@ else {
$source = $orig_source;
// show notice if existing contacts with same e-mail are found
- $existing = false;
foreach ($CONTACTS->get_col_values('email', $a_record, true) as $email) {
if ($email && ($res = $CONTACTS->search('email', $email, 1, false, true)) && $res->count) {
$OUTPUT->show_message('contactexists', 'notice', null, false);
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 29e12675e..04efe7df5 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -1047,15 +1047,23 @@ function rcmail_remove_signature($body)
function rcmail_write_compose_attachments(&$message, $bodyIsHtml)
{
- global $RCMAIL, $COMPOSE;
+ global $RCMAIL, $COMPOSE, $compose_mode;
$cid_map = $messages = array();
foreach ((array)$message->mime_parts as $pid => $part)
{
- if (($part->ctype_primary != 'message' || !$bodyIsHtml) && $part->ctype_primary != 'multipart' &&
- ($part->disposition == 'attachment' || ($part->disposition == 'inline' && $bodyIsHtml) || $part->filename)
- && $part->mimetype != 'application/ms-tnef'
- ) {
+ if ($part->disposition == 'attachment' || ($part->disposition == 'inline' && $bodyIsHtml) || $part->filename) {
+ if ($part->ctype_primary == 'message' || $part->ctype_primary == 'multipart') {
+ continue;
+ }
+ if ($part->mimetype == 'application/ms-tnef') {
+ continue;
+ }
+ // skip inline images when forwarding in plain text
+ if ($part->content_id && !$bodyIsHtml && $compose_mode == RCUBE_COMPOSE_FORWARD) {
+ continue;
+ }
+
$skip = false;
if ($part->mimetype == 'message/rfc822') {
$messages[] = $part->mime_id;