summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG4
-rw-r--r--config/main.inc.php.dist3
-rw-r--r--program/include/rcube_message.php10
-rw-r--r--program/js/app.js8
-rw-r--r--program/localization/en_US/labels.inc1
-rw-r--r--program/localization/nl_NL/labels.inc1
-rw-r--r--program/localization/pl_PL/labels.inc1
-rw-r--r--program/steps/mail/show.inc18
-rw-r--r--program/steps/settings/func.inc18
-rw-r--r--program/steps/settings/save_prefs.inc1
10 files changed, 63 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 8333d0903..9f4ed982b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
CHANGELOG RoundCube Webmail
---------------------------
+2008/06/13 (alec)
+----------
+- Added option to display images in messages from known senders (#1484601)
+
2008/06/12 (alec)
----------
- Fix corrupted MIME headers of messages in Sent folder (#1485111)
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 0be6d478d..14ce518be 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -312,6 +312,9 @@ $rcmail_config['dst_active'] = (bool)date('I');
// prefer displaying HTML messages
$rcmail_config['prefer_html'] = TRUE;
+// display images in mail from known senders
+$rcmail_config['addrbook_show_images'] = FALSE;
+
// compose html formatted messages by default
$rcmail_config['htmleditor'] = FALSE;
diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php
index 4d3cb6ca9..d810ef3fa 100644
--- a/program/include/rcube_message.php
+++ b/program/include/rcube_message.php
@@ -86,6 +86,16 @@ class rcube_message
return $raw ? $value : $this->imap->decode_header($value);
}
+ /**
+ * Set is_safe var and session data
+ *
+ * @param bool enable/disable
+ */
+ public function set_safe($safe = true)
+ {
+ $this->is_safe = $safe;
+ $_SESSION['safe_messages'][$this->uid] = $this->is_safe;
+ }
/**
* Compose a valid URL for getting a message part
diff --git a/program/js/app.js b/program/js/app.js
index 96c9ec39d..667b9fbbf 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3399,6 +3399,14 @@ function rcube_webmail()
};
+ this.toggle_prefer_html = function(checkbox)
+ {
+ var addrbook_show_images;
+ if (addrbook_show_images = document.getElementById('rcmfd_addrbook_show_images'))
+ addrbook_show_images.disabled = !checkbox.checked;
+ }
+
+
/********************************************************/
/********* remote request methods *********/
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index e917caa8f..1b69ec598 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -66,6 +66,7 @@ $labels['filesize'] = 'File size';
$labels['preferhtml'] = 'Display HTML';
$labels['htmlmessage'] = 'HTML Message';
+$labels['showknownimages'] = 'Show images from known senders';
$labels['prettydate'] = 'Pretty dates';
$labels['addtoaddressbook'] = 'Add to address book';
diff --git a/program/localization/nl_NL/labels.inc b/program/localization/nl_NL/labels.inc
index 66a03abe3..fa8525a78 100644
--- a/program/localization/nl_NL/labels.inc
+++ b/program/localization/nl_NL/labels.inc
@@ -52,6 +52,7 @@ $labels['filename'] = 'Bestandsnaam';
$labels['filesize'] = 'Bestandsgrootte';
$labels['preferhtml'] = 'Toon HTML';
$labels['htmlmessage'] = 'HTML Bericht';
+$labels['showknownimages'] = 'Toon afbeeldingen van bekende afzenders';
$labels['prettydate'] = 'Opgemaakte datums';
$labels['addtoaddressbook'] = 'Toevoegen aan adresboek';
$labels['sun'] = 'Zo';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index 5c9570d65..fcee15031 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -57,6 +57,7 @@ $labels['filename'] = 'Nazwa pliku';
$labels['filesize'] = 'Rozmiar pliku';
$labels['preferhtml'] = 'Domyślny HTML';
$labels['htmlmessage'] = 'Wiadomość HTML';
+$labels['showknownimages'] = 'Wyświetlaj obrazki od znanych nadawców';
$labels['prettydate'] = 'Ładne daty';
$labels['addtoaddressbook'] = 'Dodaj do książki adresowej ';
$labels['sun'] = 'Nd';
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 09849734e..ed44edde0 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -45,6 +45,24 @@ if ($_GET['_uid']) {
// calculate Etag for this request
$etag = md5($MESSAGE->uid.$mbox_name.session_id().intval($MESSAGE->headers->mdn_sent).intval($MESSAGE->is_safe).intval($PRINT_MODE));
+ // check known senders to display images
+ if (!$MESSAGE->is_safe
+ && !$_SESSION['safe_messages'][$MESSAGE->uid]
+ && !isset($_GET['_safe'])
+ && $RCMAIL->config->get('addrbook_show_images')
+ && $MESSAGE->has_html_part())
+ {
+ $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
+ $senders = $IMAP->decode_address_list($MESSAGE->headers->from);
+
+ foreach ($senders as $sender)
+ if ($sender['mailto'] && $CONTACTS->search('email', $sender['mailto'], true, false)->count)
+ {
+ $MESSAGE->set_safe();
+ break;
+ }
+ }
+
// allow caching, unless remote images are present
if ((bool)$MESSAGE->is_safe)
send_nocacheing_headers();
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 5c6485734..e35a27a02 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -150,12 +150,26 @@ function rcmail_user_prefs_form($attrib)
if (!isset($no_override['prefer_html']))
{
$field_id = 'rcmfd_htmlmsg';
- $input_pagesize = new html_checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1));
+ $input_preferhtml = new html_checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1,
+ 'onchange' => JS_OBJECT_NAME.'.toggle_prefer_html(this)'));
$out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
$field_id,
Q(rcube_label('preferhtml')),
- $input_pagesize->show($config['prefer_html']?1:0));
+ $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));
+
+ $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
+ $field_id,
+ Q(rcube_label('showknownimages')),
+ $input_addrbook_show_images->show($config['addrbook_show_images']?1:0));
}
// Show checkbox for HTML Editor
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index f8cf26795..08e5eec47 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -25,6 +25,7 @@ $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,
'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE,