summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-12-04 10:21:34 +0000
committeralecpl <alec@alec.pl>2008-12-04 10:21:34 +0000
commit2a41355776b1c1bc82255b5712267b0368b51d10 (patch)
tree7fb2afa1b96928a8bfed8ae542dee4082f3a5d49 /program/steps
parentf94629e62b97b8f7cd31ff0339c8d443eea8610f (diff)
- Added 'show_images' option, removed 'addrbook_show_images' (#1485597)
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/show.inc27
-rw-r--r--program/steps/settings/func.inc17
-rw-r--r--program/steps/settings/save_prefs.inc4
3 files changed, 28 insertions, 20 deletions
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 89da3b11d..99eeb39b0 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -42,15 +42,22 @@ if ($_GET['_uid']) {
$mbox_name = $IMAP->get_mailbox_name();
- // check known senders to display images
- if (!$MESSAGE->is_safe
- && !empty($MESSAGE->sender['mailto'])
- && $RCMAIL->config->get('addrbook_show_images')
- && $MESSAGE->has_html_part()) {
- $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
-
- if ($CONTACTS->search('email', $MESSAGE->sender['mailto'], true, false)->count) {
- $MESSAGE->set_safe(true);
+ // show images?
+ $show_images = $RCMAIL->config->get('show_images');
+ if(!$MESSAGE->is_safe
+ && !empty($show_images)
+ && $MESSAGE->has_html_part())
+ {
+ switch($show_images) {
+ case '1': // known senders only
+ $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
+ if ($CONTACTS->search('email', $MESSAGE->sender['mailto'], true, false)->count) {
+ $MESSAGE->set_safe(true);
+ }
+ break;
+ case '2': // always
+ $MESSAGE->set_safe(true);
+ break;
}
}
@@ -204,7 +211,7 @@ function rcmail_remote_objects_msg($attrib)
$msg .= html::a(array('href' => "#loadimages", 'onclick' => JS_OBJECT_NAME.".command('load-images')"), Q(rcube_label('showimages')));
// add link to save sender in addressbook and reload message
- if ($MESSAGE->sender['mailto'] && $RCMAIL->config->get('addrbook_show_images')) {
+ if ($MESSAGE->sender['mailto'] && $RCMAIL->config->get('show_images') == 1) {
$msg .= ' ' . html::a(array('href' => "#alwaysload", 'onclick' => JS_OBJECT_NAME.".command('always-load')", 'style' => "white-space:nowrap"),
Q(rcube_label(array('name' => 'alwaysshow', 'vars' => array('sender' => $MESSAGE->sender['mailto'])))));
}
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 6a158b9e9..e25a1879f 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -210,14 +210,15 @@ function rcmail_user_prefs_form($attrib)
$table->add(null, $input_preferhtml->show($config['prefer_html']?1:0));
}
- // show checkbox for displaying images from people in the addressbook
- if (!isset($no_override['addrbook_show_images'])) {
- $field_id = 'rcmfd_addrbook_show_images';
- $input_addrbook_show_images = new html_checkbox(array('name' => '_addrbook_show_images', 'id' => $field_id,
- 'value' => 1, 'disabled' => $config['prefer_html']?0:1));
-
- $table->add('title', html::label($field_id, Q(rcube_label('showknownimages'))));
- $table->add(null, $input_addrbook_show_images->show($config['addrbook_show_images']?1:0));
+ if (!isset($no_override['show_images'])) {
+ $field_id = 'rcmfd_show_images';
+ $input_show_images = new html_select(array('name' => '_show_images', 'id' => $field_id));
+ $input_show_images->add(rcube_label('never'), 0);
+ $input_show_images->add(rcube_label('fromknownsenders'), 1);
+ $input_show_images->add(rcube_label('always'), 2);
+
+ $table->add('title', html::label($field_id, Q(rcube_label('showremoteimages'))));
+ $table->add(null, $input_show_images->show($config['show_images']));
}
if (!isset($no_override['inline_images'])) {
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 023ffff36..09cf63d6f 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -26,7 +26,6 @@ $a_user_prefs = array(
'pagesize' => is_numeric($_POST['_pagesize']) ? max(2, intval($_POST['_pagesize'])) : $CONFIG['pagesize'],
'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE,
'prefer_html' => isset($_POST['_prefer_html']) ? TRUE : FALSE,
- 'addrbook_show_images' => isset($_POST['_addrbook_show_images']) ? TRUE : FALSE,
'htmleditor' => isset($_POST['_htmleditor']) ? TRUE : FALSE,
'inline_images' => isset($_POST['_inline_images']) ? TRUE : FALSE,
'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
@@ -37,6 +36,7 @@ $a_user_prefs = array(
'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE,
'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0,
+ 'show_images' => isset($_POST['_show_images']) ? intval($_POST['_show_images']) : 0,
'keep_alive' => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'],
'check_all_folders' => isset($_POST['_check_all_folders']) ? TRUE : FALSE,
'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0,
@@ -87,10 +87,10 @@ if (isset($a_user_prefs['keep_alive'])) {
$a_user_prefs['keep_alive'] = min($CONFIG['session_lifetime']*60, $a_user_prefs['keep_alive']);
}
+
if ($USER->save_prefs($a_user_prefs))
$OUTPUT->show_message('successfullysaved', 'confirmation');
-
// go to next step
rcmail_overwrite_action('preferences');