summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-11-09 10:03:54 +0000
committeralecpl <alec@alec.pl>2011-11-09 10:03:54 +0000
commit51f7a5b2a09777d3a279757af620e42985ff9a86 (patch)
tree1b4700d4e4f3e5277dcb9877118acc1ee9098b74 /program/steps
parent69cb80b0594add4d18f8de6b5c676f1dc4d0a835 (diff)
- Apply fixes from trunk up to r5401
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/func.inc13
-rw-r--r--program/steps/mail/autocomplete.inc7
-rw-r--r--program/steps/mail/compose.inc12
-rw-r--r--program/steps/mail/func.inc2
-rw-r--r--program/steps/mail/sendmail.inc31
-rw-r--r--program/steps/settings/edit_folder.inc3
-rw-r--r--program/steps/settings/folders.inc4
7 files changed, 40 insertions, 32 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 2082dbd1f..2f1fbb70f 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -619,7 +619,7 @@ function rcmail_contact_form($form, $record, $attrib = null)
$RCMAIL->output->set_env('month_names', $month_names);
}
$colprop['class'] .= ($colprop['class'] ? ' ' : '') . 'datepicker';
- $val = format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'));
+ $val = format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'), false);
}
$val = rcmail_get_edit_field($col, $val, $colprop, $colprop['type']);
@@ -728,7 +728,7 @@ function rcmail_contact_photo($attrib)
function rcmail_format_date_col($val)
{
global $RCMAIL;
- return format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'));
+ return format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'), false);
}
@@ -758,9 +758,12 @@ function rcmail_get_cids()
foreach ($cid as $id) {
// if _source is not specified we'll find it from decoded ID
if (!$got_source) {
- list ($c, $s) = explode('-', $id, 2);
- if (strlen($s)) {
- $result[(string)$s][] = $c;
+ if ($sep = strrpos($id, '-')) {
+ $contact_id = substr($id, 0, $sep);
+ $source_id = substr($id, $sep+1);
+ if (strlen($source_id)) {
+ $result[(string)$source_id][] = $contact_id;
+ }
}
}
else {
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index 5b935ad2c..8b13f574d 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -32,7 +32,8 @@ if ($RCMAIL->action == 'group-expand') {
$members[] = format_email_recipient($email, $sql_arr['name']);
}
- $OUTPUT->command('replace_group_recipients', $gid, join(', ', $members));
+ $separator = trim($RCMAIL->config->get('recipients_separator', ',')) . ' ';
+ $OUTPUT->command('replace_group_recipients', $gid, join($separator, array_unique($members)));
}
$OUTPUT->send();
@@ -70,8 +71,8 @@ if (!empty($book_types) && strlen($search)) {
if ($email_cnt > 1 && stripos($contact, $search) === false) {
continue;
}
- // when we've got more than one book, we need to skip duplicates
- if ($books_num == 1 || !in_array($contact, $contacts)) {
+ // skip duplicates
+ if (!in_array($contact, $contacts)) {
$contacts[] = $contact;
if (count($contacts) >= $MAXNUM)
break 2;
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index c31ec9b2b..6961bf86a 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -5,7 +5,7 @@
| program/steps/mail/compose.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
+ | Copyright (C) 2005-2011, The Roundcube Dev Team |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
@@ -122,8 +122,9 @@ if (!empty($CONFIG['drafts_mbox'])) {
}
// set current mailbox in client environment
$OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name());
-$OUTPUT->set_env('sig_above', $CONFIG['sig_above']);
-$OUTPUT->set_env('top_posting', $CONFIG['top_posting']);
+$OUTPUT->set_env('sig_above', $RCMAIL->config->get('sig_above', false));
+$OUTPUT->set_env('top_posting', $RCMAIL->config->get('top_posting', false));
+$OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ',')));
// get reference message and set compose mode
if ($msg_uid = $_SESSION['compose']['param']['draft_uid']) {
@@ -324,6 +325,7 @@ else if (count($MESSAGE->identities)) {
// Set other headers
$a_recipients = array();
$parts = array('to', 'cc', 'bcc', 'replyto', 'followupto');
+$separator = trim($RCMAIL->config->get('recipients_separator', ',')) . ' ';
foreach ($parts as $header) {
$fvalue = '';
@@ -367,7 +369,7 @@ foreach ($parts as $header) {
if ($v = $MESSAGE->headers->to)
$fvalue .= $v;
if ($v = $MESSAGE->headers->cc)
- $fvalue .= (!empty($fvalue) ? ', ' : '') . $v;
+ $fvalue .= (!empty($fvalue) ? $separator : '') . $v;
}
}
else if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT))) {
@@ -410,7 +412,7 @@ foreach ($parts as $header) {
}
}
- $fvalue = implode(', ', $fvalue);
+ $fvalue = implode($separator, $fvalue);
}
$MESSAGE->compose[$header] = $fvalue;
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 69724c554..39c25f19c 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -766,7 +766,7 @@ function rcmail_plain_body($body, $flowed=false)
// previous line is flowed?
if (isset($body[$last]) && $body[$n]
- && $last != $last_sig
+ && $last !== $last_sig
&& $body[$last][strlen($body[$last])-1] == ' '
) {
$body[$last] .= $body[$n];
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 5022444a7..0fdcd78cd 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -5,7 +5,7 @@
| program/steps/mail/sendmail.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2010, The Roundcube Dev Team |
+ | Copyright (C) 2005-2011, The Roundcube Dev Team |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
@@ -138,22 +138,30 @@ function rcmail_fix_emoticon_paths(&$mime_message)
return $body;
}
-// parse email address input (and count addresses)
+/**
+ * Parse and cleanup email address input (and count addresses)
+ *
+ * @param string Address input
+ * @param boolean Do count recipients (saved in global $RECIPIENT_COUNT)
+ * @param boolean Validate addresses (errors saved in global $EMAIL_FORMAT_ERROR)
+ * @return string Canonical recipients string separated by comma
+ */
function rcmail_email_input_format($mailto, $count=false, $check=true)
{
- global $EMAIL_FORMAT_ERROR, $RECIPIENT_COUNT;
+ global $RCMAIL, $EMAIL_FORMAT_ERROR, $RECIPIENT_COUNT;
// simplified email regexp, supporting quoted local part
$email_regexp = '(\S+|("[^"]+"))@\S+';
- $regexp = array('/[,;]\s*[\r\n]+/', '/[\r\n]+/', '/[,;]\s*$/m', '/;/', '/(\S{1})(<'.$email_regexp.'>)/U');
- $replace = array(', ', ', ', '', ',', '\\1 \\2');
+ $delim = trim($RCMAIL->config->get('recipients_separator', ','));
+ $regexp = array("/[,;$delim]\s*[\r\n]+/", '/[\r\n]+/', "/[,;$delim]\s*\$/m", '/;/', '/(\S{1})(<'.$email_regexp.'>)/U');
+ $replace = array($delim.' ', ', ', '', $delim, '\\1 \\2');
// replace new lines and strip ending ', ', make address input more valid
$mailto = trim(preg_replace($regexp, $replace, $mailto));
$result = array();
- $items = rcube_explode_quoted_string(',', $mailto);
+ $items = rcube_explode_quoted_string($delim, $mailto);
foreach($items as $item) {
$item = trim($item);
@@ -168,16 +176,9 @@ function rcmail_email_input_format($mailto, $count=false, $check=true)
// address with name (handle name)
} else if (preg_match('/<*'.$email_regexp.'>*$/', $item, $matches)) {
$address = $matches[0];
- $name = str_replace($address, '', $item);
- $name = trim($name);
- if ($name && ($name[0] != '"' || $name[strlen($name)-1] != '"')
- && preg_match('/[\(\)\<\>\\\.\[\]@,;:"]/', $name)) {
- $name = '"'.addcslashes($name, '"').'"';
- }
+ $name = trim(str_replace($address, '', $item), '" ');
$address = rcube_idn_to_ascii(trim($address, '<>'));
- $address = '<' . $address . '>';
-
- $result[] = $name.' '.$address;
+ $result[] = format_email_recipient($address, $name);
$item = $address;
} else if (trim($item)) {
continue;
diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc
index 36a4b28ba..e9566f7aa 100644
--- a/program/steps/settings/edit_folder.inc
+++ b/program/steps/settings/edit_folder.inc
@@ -119,7 +119,8 @@ function rcmail_folder_form($attrib)
'realnames' => false,
'maxlength' => 150,
'unsubscribed' => true,
- 'exceptions' => array($mbox_imap),
+ 'skip_noinferiors' => true,
+ 'exceptions' => array($mbox_imap),
));
$form['props']['fieldsets']['location']['content']['path'] = array(
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 206f62c60..77cbb5571 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -283,8 +283,8 @@ function rcube_subscription_form($attrib)
}
if (!$protected) {
- $opts = $IMAP->mailbox_options($folder['id']);
- $noselect = in_array('\\Noselect', $opts);
+ $attrs = $IMAP->mailbox_attributes($folder['id']);
+ $noselect = in_array('\\Noselect', $attrs);
}
$disabled = (($protected && $subscribed) || $noselect);