diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/compose.inc | 5 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 21 | ||||
-rw-r--r-- | program/steps/mail/list.inc | 36 | ||||
-rw-r--r-- | program/steps/mail/list_contacts.inc | 7 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 31 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 3 |
6 files changed, 65 insertions, 38 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 24cd5e425..2d45105c2 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1539,6 +1539,11 @@ function rcmail_check_sent_folder($folder, $create=false) { global $RCMAIL; + // we'll not save the message, so it doesn't matter + if ($RCMAIL->config->get('no_save_sent_messages')) { + return true; + } + if ($RCMAIL->storage->folder_exists($folder, true)) { return true; } diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index c18d2cd13..47d1a484a 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -374,6 +374,8 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null */ function rcmail_message_list_head($attrib, $a_show_cols) { + global $RCMAIL; + $skin_path = $_SESSION['skin_path']; $image_tag = html::img(array('src' => "%s%s", 'alt' => "%s")); @@ -381,8 +383,18 @@ function rcmail_message_list_head($attrib, $a_show_cols) $sort_col = $_SESSION['sort_col']; $sort_order = $_SESSION['sort_order']; + $dont_override = (array)$RCMAIL->config->get('dont_override'); + $disabled_sort = in_array('message_sort_col', $dont_override); + $disabled_order = in_array('message_sort_order', $dont_override); + + $RCMAIL->output->set_env('disabled_sort_col', $disabled_sort); + $RCMAIL->output->set_env('disabled_sort_order', $disabled_order); + // define sortable columns - $a_sort_cols = array('subject', 'date', 'from', 'to', 'fromto', 'size', 'cc'); + if ($disabled_sort) + $a_sort_cols = $sort_col && !$disabled_order ? array($sort_col) : array(); + else + $a_sort_cols = array('subject', 'date', 'from', 'to', 'fromto', 'size', 'cc'); if (!empty($attrib['optionsmenuicon'])) { $onclick = 'return ' . JS_OBJECT_NAME . ".command('menu-open', 'messagelistmenu')"; @@ -432,7 +444,7 @@ function rcmail_message_list_head($attrib, $a_show_cols) else if ($col_name[0] != '<') $col_name = '<span class="' . $col .'">' . $col_name . '</span>'; - $sort_class = $col == $sort_col ? " sorted$sort_order" : ''; + $sort_class = $col == $sort_col && !$disabled_order ? " sorted$sort_order" : ''; $class_name = $col.$sort_class; // put it all together @@ -779,9 +791,8 @@ function rcmail_plain_body($body, $flowed=false) // make links and email-addresses clickable $replacer = new rcube_string_replacer; - // search for patterns like links and e-mail addresses - $body = preg_replace_callback($replacer->link_pattern, array($replacer, 'link_callback'), $body); - $body = preg_replace_callback($replacer->mailto_pattern, array($replacer, 'mailto_callback'), $body); + // search for patterns like links and e-mail addresses and replace with tokens + $body = $replacer->replace($body); // split body into single lines $body = preg_split('/\r?\n/', $body); diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index b5d579d7d..b433f81fc 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -23,27 +23,33 @@ if (!$OUTPUT->ajax_call) { return; } +$save_arr = array(); +$dont_override = (array) $RCMAIL->config->get('dont_override'); + // is there a sort type for this request? -if ($sort = get_input_value('_sort', RCUBE_INPUT_GET)) -{ +if ($sort = get_input_value('_sort', RCUBE_INPUT_GET)) { // yes, so set the sort vars list($sort_col, $sort_order) = explode('_', $sort); // set session vars for sort (so next page and task switch know how to sort) - $save_arr = array(); - $_SESSION['sort_col'] = $save_arr['message_sort_col'] = $sort_col; - $_SESSION['sort_order'] = $save_arr['message_sort_order'] = $sort_order; + if (!in_array('message_sort_col', $dont_override)) { + $_SESSION['sort_col'] = $save_arr['message_sort_col'] = $sort_col; + } + if (!in_array('message_sort_order', $dont_override)) { + $_SESSION['sort_order'] = $save_arr['message_sort_order'] = $sort_order; + } } // is there a set of columns for this request? -if ($cols = get_input_value('_cols', RCUBE_INPUT_GET)) -{ - $save_arr = array(); - $save_arr['list_cols'] = explode(',', $cols); +if ($cols = get_input_value('_cols', RCUBE_INPUT_GET)) { + if (!in_array('list_cols', $dont_override)) { + $save_arr['list_cols'] = explode(',', $cols); + } } -if ($save_arr) +if (!empty($save_arr)) { $RCMAIL->user->save_prefs($save_arr); +} $mbox_name = $RCMAIL->storage->get_folder(); $threading = (bool) $RCMAIL->storage->get_threading(); @@ -52,8 +58,7 @@ $threading = (bool) $RCMAIL->storage->get_threading(); $RCMAIL->storage->folder_sync($mbox_name); // initialize searching result if search_filter is used -if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') -{ +if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { $search_request = md5($mbox_name.$_SESSION['search_filter']); $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, rcmail_sort_column()); $_SESSION['search'] = $RCMAIL->storage->get_search_set(); @@ -76,7 +81,6 @@ else if (empty($_REQUEST['_search']) && isset($_SESSION['search'])) { $RCMAIL->session->remove('search'); } - // empty result? we'll skip UNSEEN counting in rcmail_send_unread_count() if (empty($search_request) && empty($a_headers)) { $unseen = 0; @@ -96,10 +100,10 @@ $OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text()); // add message rows rcmail_js_message_list($a_headers, FALSE, $cols); -if (isset($a_headers) && count($a_headers)) -{ - if ($search_request) +if (isset($a_headers) && count($a_headers)) { + if ($search_request) { $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $count)); + } } else { // handle IMAP errors (e.g. #1486905) diff --git a/program/steps/mail/list_contacts.inc b/program/steps/mail/list_contacts.inc index 7c99a1309..9347190da 100644 --- a/program/steps/mail/list_contacts.inc +++ b/program/steps/mail/list_contacts.inc @@ -69,11 +69,14 @@ if ($CONTACTS && $CONTACTS->ready) { $name = rcube_addressbook::compose_list_name($row); // add record for every email address of the contact - foreach ($CONTACTS->get_col_values('email', $row, true) as $i => $email) { + $emails = $CONTACTS->get_col_values('email', $row, true); + foreach ($emails as $i => $email) { $row_id = $row['ID'].$i; $jsresult[$row_id] = format_email_recipient($email, $name); $OUTPUT->command('add_contact_row', $row_id, array( - 'contact' => html::span(array('title' => $email), Q($name ? $name : $email))), 'person'); + 'contact' => html::span(array('title' => $email), Q($name ? $name : $email) . + ($name && count($emails) > 1 ? ' ' . html::span('email', Q($email)) : '') + )), 'person'); } } } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index a0c049682..4fac872d1 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -49,7 +49,7 @@ if (!$savedraft) { if(!empty($CONFIG['sendmail_delay'])) { $wait_sec = time() - intval($CONFIG['sendmail_delay']) - intval($CONFIG['last_message_time']); - if($wait_sec < 0) { + if ($wait_sec < 0) { $OUTPUT->show_message('senttooquickly', 'error', array('sec' => $wait_sec * -1)); $OUTPUT->send('iframe'); } @@ -72,13 +72,19 @@ function rcmail_encrypt_header($what) // get identity record function rcmail_get_identity($id) { - global $RCMAIL, $OUTPUT; + global $RCMAIL, $message_charset; + global $RCMAIL; if ($sql_arr = $RCMAIL->user->get_identity($id)) { $out = $sql_arr; + + if ($message_charset != RCMAIL_CHARSET) { + foreach ($out as $k => $v) + $out[$k] = rcube_charset_convert($v, RCMAIL_CHARSET, $message_charset); + } + $out['mailto'] = $sql_arr['email']; - $out['string'] = format_email_recipient($sql_arr['email'], - rcube_charset_convert($sql_arr['name'], RCMAIL_CHARSET, $OUTPUT->get_charset())); + $out['string'] = format_email_recipient($sql_arr['email'], $sql_arr['name']); return $out; } @@ -96,7 +102,7 @@ function rcmail_get_identity($id) */ function rcmail_fix_emoticon_paths($mime_message) { - global $CONFIG; + global $RCMAIL; $body = $mime_message->getHTMLBody(); @@ -121,8 +127,9 @@ function rcmail_fix_emoticon_paths($mime_message) if (! in_array($image_name, $included_images)) { // add the image to the MIME message - if (! $mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name)) - $OUTPUT->show_message("emoticonerror", 'error'); + if (!$mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name)) { + $RCMAIL->output->show_message("emoticonerror", 'error'); + } array_push($included_images, $image_name); } @@ -468,6 +475,7 @@ if (!$savedraft) { if ($CONFIG['spellcheck_before_send'] && $CONFIG['enable_spellcheck'] && empty($COMPOSE['spell_checked']) && !empty($message_body) ) { + $message_body = str_replace("\r\n", "\n", $message_body); $spellchecker = new rcube_spellchecker(get_input_value('_lang', RCUBE_INPUT_GPC)); $spell_result = $spellchecker->check($message_body, $isHtml); @@ -668,19 +676,18 @@ if (!$savedraft) $smtp_error, $mailbody_file, $smtp_opts); // return to compose page if sending failed - if (!$sent) - { + if (!$sent) { // remove temp file if ($mailbody_file) { unlink($mailbody_file); - } + } if ($smtp_error) $OUTPUT->show_message($smtp_error['label'], 'error', $smtp_error['vars']); else $OUTPUT->show_message('sendingfailed', 'error'); $OUTPUT->send('iframe'); - } + } // save message sent time if (!empty($CONFIG['sendmail_delay'])) @@ -698,7 +705,7 @@ if (!$savedraft) // Determine which folder to save message if ($savedraft) $store_target = $CONFIG['drafts_mbox']; -else +else if (!$RCMAIL->config->get('no_save_sent_messages')) $store_target = isset($_POST['_store_target']) ? get_input_value('_store_target', RCUBE_INPUT_POST) : $CONFIG['sent_mbox']; if ($store_target) { diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index e94630635..d5ccbb2d7 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -198,9 +198,6 @@ function rcmail_user_prefs($current=null) $select_timezone->add('(GMT ' . $offset . ') ' . strtr($tzs, '_', ' '), $tzs); } - if (is_numeric($config['timezone'])) - timezone_name_from_abbr("", $config['timezone'] * 3600, 0); - $blocks['main']['options']['timezone'] = array( 'title' => html::label($field_id, Q(rcube_label('timezone'))), 'content' => $select_timezone->show((string)$config['timezone']), |