summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-01-29 14:55:12 +0000
committerthomascube <thomas@roundcube.net>2011-01-29 14:55:12 +0000
commit98cb0f179206843ceaa87df6bfb3d1da045ed8ad (patch)
treeade6196094997c24b48e8a432383bd2da9f6bc5c /program/steps
parenta32679e69f7d6c265f85015677743272740dcc8e (diff)
Apply bug fixes and localization updated from trunk for release 0.5.1
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/save.inc12
-rw-r--r--program/steps/mail/func.inc36
-rw-r--r--program/steps/settings/folders.inc17
-rw-r--r--program/steps/settings/func.inc1
-rw-r--r--program/steps/settings/save_prefs.inc2
5 files changed, 52 insertions, 16 deletions
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index f074f18a4..1c70b89b6 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -121,6 +121,18 @@ else {
if ($insert_id) {
+ // add new contact to the specified group
+ if ($CONTACTS->group_id) {
+ $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $CONTACTS->group_id, 'ids' => $insert_id, 'source' => $source));
+
+ if (!$plugin['abort']) {
+ if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + 1 > $maxnum))
+ $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
+
+ $CONTACTS->add_to_group($gid, $plugin['ids']);
+ }
+ }
+
// add contact row or jump to the page where it should appear
$CONTACTS->reset();
$result = $CONTACTS->search($CONTACTS->primary_key, $insert_id);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index abf112212..b62e8a86c 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -273,7 +273,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
if (in_array($col, array('from', 'to', 'cc', 'replyto')))
$cont = Q(rcmail_address_string($header->$col, 3), 'show');
else if ($col=='subject') {
- $cont = abbreviate_string(trim($IMAP->decode_header($header->$col)), 160);
+ $cont = trim($IMAP->decode_header($header->$col));
if (!$cont) $cont = rcube_label('nosubject');
$cont = Q($cont);
}
@@ -665,7 +665,8 @@ function rcmail_print_body($part, $p = array())
// trigger plugin hook
$data = $RCMAIL->plugins->exec_hook('message_part_before',
- array('type' => $part->ctype_secondary, 'body' => $part->body) + $p + array('safe' => false, 'plain' => false, 'inline_html' => true));
+ array('type' => $part->ctype_secondary, 'body' => $part->body, 'id' => $part->mime_id)
+ + $p + array('safe' => false, 'plain' => false, 'inline_html' => true));
// convert html to text/plain
if ($data['type'] == 'html' && $data['plain']) {
@@ -698,7 +699,8 @@ function rcmail_print_body($part, $p = array())
$body = rcmail_plain_body($body, $part->ctype_parameters['format'] == 'flowed');
// allow post-processing of the message body
- $data = $RCMAIL->plugins->exec_hook('message_part_after', array('type' => $part->ctype_secondary, 'body' => $body) + $data);
+ $data = $RCMAIL->plugins->exec_hook('message_part_after',
+ array('type' => $part->ctype_secondary, 'body' => $body, 'id' => $part->mime_id) + $data);
return $data['type'] == 'html' ? $data['body'] : html::tag('pre', array(), $data['body']);
}
@@ -827,10 +829,10 @@ function rcmail_washtml_callback($tagname, $attrib, $content)
case 'style':
// decode all escaped entities and reduce to ascii strings
- $stripped = preg_replace('/[^a-zA-Z\(:]/', '', rcmail_xss_entity_decode($content));
+ $stripped = preg_replace('/[^a-zA-Z\(:;]/', '', rcmail_xss_entity_decode($content));
// now check for evil strings like expression, behavior or url()
- if (!preg_match('/expression|behavior|url\(|import/', $stripped)) {
+ if (!preg_match('/expression|behavior|url\(|import[^a]/', $stripped)) {
$out = html::tag('style', array('type' => 'text/css'), $content);
break;
}
@@ -940,16 +942,25 @@ function rcmail_message_headers($attrib, $headers=NULL)
$table->add(array('class' => 'header '.$hkey), Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show')));
}
- // all headers division
- $table->add(array('colspan' => 2, 'class' => "more-headers show-headers", 'onclick' => "return ".JS_OBJECT_NAME.".command('load-headers','',this)"), '');
- $table->add_row(array('id' => "all-headers"));
- $table->add(array('colspan' => 2, 'class' => "all"), html::div(array('id' => 'headers-source'), ''));
+ return $table->show($attrib);
+}
+
+
+/**
+ * return block to show full message headers
+ */
+function rcmail_message_full_headers($attrib, $headers=NULL)
+{
+ global $OUTPUT;
+
+ $html = html::div(array('class' => "more-headers show-headers", 'onclick' => "return ".JS_OBJECT_NAME.".command('load-headers','',this)"), '');
+ $html .= html::div(array('id' => "all-headers", 'class' => "all", 'style' => 'display:none'), html::div(array('id' => 'headers-source'), ''));
$OUTPUT->add_gui_object('all_headers_row', 'all-headers');
$OUTPUT->add_gui_object('all_headers_box', 'headers-source');
-
- return $table->show($attrib);
- }
+
+ return html::div($attrib, $html);
+}
/**
@@ -1749,6 +1760,7 @@ $OUTPUT->add_handlers(array(
'quotadisplay' => 'rcmail_quota_display',
'mailboxname' => 'rcmail_mailbox_name_display',
'messageheaders' => 'rcmail_message_headers',
+ 'messagefullheaders' => 'rcmail_message_full_headers',
'messagebody' => 'rcmail_message_body',
'messagecontentframe' => 'rcmail_messagecontent_frame',
'messagepartframe' => 'rcmail_message_part_frame',
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 7ae4fb35d..3494ba99a 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -42,8 +42,16 @@ if ($RCMAIL->action == 'subscribe')
}
}
- if ($result)
+ if ($result) {
+ // Handle subscription of protected folder (#1487656)
+ if ($CONFIG['protect_default_folders'] == true
+ && in_array($mbox, $CONFIG['default_imap_folders'])
+ ) {
+ $OUTPUT->command('disable_subscription', $mbox);
+ }
+
$OUTPUT->show_message('foldersubscribed', 'confirmation');
+ }
else
rcmail_display_server_error('errorsaving');
}
@@ -294,13 +302,16 @@ function rcube_subscription_form($attrib)
$noselect = in_array('\\Noselect', $opts);
}
+ $disabled = (($protected && $subscribed) || $noselect);
+
$table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes)));
$table->add('name', $display_folder);
$table->add('subscribed', $checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''),
- array('value' => $folder_utf8, 'disabled' => ($protected || $noselect) ? 'disabled' : '')));
+ array('value' => $folder_utf8, 'disabled' => $disabled ? 'disabled' : '')));
- $a_js_folders['rcmrow'.$idx] = array($folder_utf8, Q($display_folder), $protected || $folder['virtual']);
+ $a_js_folders['rcmrow'.$idx] = array($folder_utf8,
+ Q($display_folder), $protected || $folder['virtual']);
}
$RCMAIL->plugins->exec_hook('folders_list', array('table' => $table));
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index fb48e926b..3a3d690bf 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -756,7 +756,6 @@ function rcmail_get_skins()
return $skins;
}
-
// register UI objects
$OUTPUT->add_handlers(array(
'prefsframe' => 'rcmail_preferences_frame',
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 265c37e90..feeb18341 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -129,6 +129,8 @@ switch ($CURR_SECTION)
if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['pagesize'] > $CONFIG['max_pagesize']))
$a_user_prefs['pagesize'] = (int) $CONFIG['max_pagesize'];
+ $a_user_prefs['timezone'] = $_SESSION['timezone'] = (string) $a_user_prefs['timezone'];
+
break;
case 'mailbox':