summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-06-13 12:57:52 +0000
committeralecpl <alec@alec.pl>2008-06-13 12:57:52 +0000
commit712b30dd2de49763f68ee6c8f7b8b24bdadb19d9 (patch)
treed0a23d11f386324ca160fa787988d1136912bee3 /program/steps
parent991e15c3aed6f065ad49159fea3c91e47677fbd8 (diff)
- Added option to display images in messages from known senders (#1484601)
Diffstat (limited to 'program/steps')
-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
3 files changed, 35 insertions, 2 deletions
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,