Ticket #1485597 (closed Feature Patches: fixed)

Opened 21 months ago

Last modified 21 months ago

always display images

Reported by: ldeviator Owned by: alec
Priority: 5 Milestone: 0.2-stable
Component: Core functionality Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

my users don't like to add people to their address book in order to get rid of the display images privacy warning, so I've added an option for them that I thought I'd share

adding this effectively disables the image privacy

program/steps/mail/show.inc

44a45
>   // always show images? if not
46c47,51
<   if (!$MESSAGE->is_safe
---
>   if(!$MESSAGE->is_safe
>      && $RCMAIL->config->get('always_show_images')) {
>     $MESSAGE->set_safe(true);
>   }
>   else if (!$MESSAGE->is_safe

and in config/main.inc.php

// display images in mail from all senders
$rcmail_config['always_show_images'] = true;

Attachments

func.inc.patch.txt (1.1 KB) - added by ldeviator 21 months ago.
main.inc.php.dist.patch.txt (0.6 KB) - added by ldeviator 21 months ago.
save_prefs.inc.patch.txt (210 bytes) - added by ldeviator 21 months ago.
show.inc.patch.txt (1.1 KB) - added by ldeviator 21 months ago.

Change History

Changed 21 months ago by alec

The idea is good, but in my opinion we should create one option 'show_images' with values: 0-never (ask me first), 1-from known senders, 2-always. When you provide such patch with changes in settings tab it will be included.

Changed 21 months ago by ldeviator

program/steps/settings/func.inc

206,210c206,212
<   // 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));
---
>   // show checkbox for displaying images
>   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('Never - Always Ask', 0);
>     $input_show_images->add('Only From Senders in Address Book', 1);
>     $input_show_images->add('Always Show Images', 2);
212,213c214,215
<     $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));
---
>     $table->add('title', html::label($field_id, Q('Show Remote Inline Images')));
>     $table->add(null, $input_show_images->show($config['show_images']));

program/steps/settings/save_prefs.inc

29c29
<   'addrbook_show_images' => isset($_POST['_addrbook_show_images']) ? TRUE : FALSE,
---
>   'show_images'  => isset($_POST['_show_images']) ? intval($_POST['_show_images']) : $CONFIG['show_images'],

config/main.php.dist

// display remote inline images
// 0 - Never, always ask
// 1 - Ask if sender not in address book
// 2 - Always show inline images
$rcmail_config['show_images'] = 0;

program/steps/mail/show.inc

44a45
>   // always show images? if not
46,53c47,60
<   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 = $RCMAIL->config->get('show_images');
>   if(!$MESSAGE->is_safe
>      && !empty($show_images)
>      && $MESSAGE->has_html_part()) {
>     switch($show_images) {
>       case '1':
>         $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':
>         $MESSAGE->set_safe(true);
>       break;
207c214
<   if ($MESSAGE->sender['mailto'] && $RCMAIL->config->get('addrbook_show_images')) {
---
>   if ($MESSAGE->sender['mailto'] && $RCMAIL->config->get('show_images') == 1) {

Changed 21 months ago by ldeviator

Changed 21 months ago by ldeviator

Changed 21 months ago by ldeviator

Changed 21 months ago by ldeviator

Changed 21 months ago by alec

  • owner set to alec
  • milestone changed from later to 0.2-stable

Changed 21 months ago by alec

  • status changed from new to closed
  • resolution set to fixed

Added in r2115

Note: See TracTickets for help on using tickets.