Opened 4 years ago

Closed 4 years ago

#1485597 closed Feature Patches (fixed)

always display images

Reported by: ldeviator Owned by: alec
Priority: 5 Milestone: 0.2-stable
Component: Core functionality Version: git-master
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 (4)

func.inc.patch.txt (1.1 KB) - added by ldeviator 4 years ago.
main.inc.php.dist.patch.txt (569 bytes) - added by ldeviator 4 years ago.
save_prefs.inc.patch.txt (210 bytes) - added by ldeviator 4 years ago.
show.inc.patch.txt (1.1 KB) - added by ldeviator 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 4 years 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.

comment:2 Changed 4 years 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 4 years ago by ldeviator

Changed 4 years ago by ldeviator

Changed 4 years ago by ldeviator

Changed 4 years ago by ldeviator

comment:3 Changed 4 years ago by alec

  • Milestone changed from later to 0.2-stable
  • Owner set to alec

comment:4 Changed 4 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Added in [2a413557]

Note: See TracTickets for help on using tickets.