- Added option to display images in messages from known senders (#1484601)

release-0.6
alecpl 16 years ago
parent 991e15c3ae
commit 712b30dd2d

@ -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)

@ -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;

@ -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

@ -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 *********/

@ -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';

@ -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';

@ -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';

@ -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();

@ -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

@ -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,

Loading…
Cancel
Save