diff options
author | thomascube <thomas@roundcube.net> | 2008-06-14 17:35:26 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-06-14 17:35:26 +0000 |
commit | 62e43d2c1a61d26f9a07419f7155a2881cb57332 (patch) | |
tree | fead3e68d123a335592ba48a7b319d747ac50825 /program/steps | |
parent | fca66b0ef41453397cc9f348f412dfd8643745f0 (diff) |
Complete implementation of #1484601: add link for saving sender to address book and reload message
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/show.inc | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index ed44edde0..8b6ce5809 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -47,21 +47,15 @@ if ($_GET['_uid']) { // 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; - } + && !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); } + } // allow caching, unless remote images are present if ((bool)$MESSAGE->is_safe) @@ -85,6 +79,7 @@ if ($_GET['_uid']) { // give message uid to the client $OUTPUT->set_env('uid', $MESSAGE->uid); $OUTPUT->set_env('safemode', $MESSAGE->is_safe); + $OUTPUT->set_env('sender', $MESSAGE->sender['string']); // check for unset disposition notification if ($MESSAGE->headers->mdn_to && !$MESSAGE->headers->mdn_sent && @@ -174,26 +169,24 @@ function rcmail_message_attachments($attrib) function rcmail_remote_objects_msg($attrib) - { - global $CONFIG, $OUTPUT; +{ + global $MESSAGE, $RCMAIL; if (!$attrib['id']) $attrib['id'] = 'rcmremoteobjmsg'; - - // allow the following attributes to be added to the <div> tag - $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id')); - $out = '<div' . $attrib_str . ">"; - - $out .= sprintf('%s <a href="#loadimages" onclick="%s.command(\'load-images\')">%s</a>', - Q(rcube_label('blockedimages')), - JS_OBJECT_NAME, - Q(rcube_label('showimages'))); - $out .= '</div>'; + $msg = Q(rcube_label('blockedimages')) . ' '; + $msg .= html::a(array('href' => "#loadimages", 'onclick' => JS_OBJECT_NAME.".command('load-images')"), Q(rcube_label('showimages'))); - $OUTPUT->add_gui_object('remoteobjectsmsg', $attrib['id']); - return $out; + // add link to save sender in addressbook and reload message + if ($MESSAGE->sender['mailto'] && $RCMAIL->config->get('addrbook_show_images')) { + $msg .= ' ' . html::a(array('href' => "#alwaysload", 'onclick' => JS_OBJECT_NAME.".command('always-load')", 'style' => "white-space:nowrap"), + Q(rcube_label(array('name' => 'alwaysshow', 'vars' => array('sender' => $MESSAGE->sender['mailto']))))); } + + $RCMAIL->output->add_gui_object('remoteobjectsmsg', $attrib['id']); + return html::div($attrib, $msg); +} $OUTPUT->add_handlers(array( |