From 712b30dd2de49763f68ee6c8f7b8b24bdadb19d9 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 13 Jun 2008 08:57:52 -0400
Subject: [PATCH] - Added option to display images in messages from known senders (#1484601)

---
 program/steps/mail/show.inc |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 0984973..ed44edd 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -45,6 +45,24 @@
   // 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();

--
Gitblit v1.9.1