parent
d60228b177
commit
9f6c762c18
3 changed files with 31 additions and 39 deletions
|
@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|||
- fixed problem where only one domain is defined
|
||||
- horizontal spacing for header (from @Spegeli) and style
|
||||
- fix: restore focus on reload
|
||||
- Added $config['prefer_plaintext'] = true; Prefer HTML or Text and removed toggle buttons.
|
||||
|
||||
|
||||
### Added
|
||||
- Added multiple domain support (https://github.com/synox/disposable-mailbox/issues/21)
|
||||
|
|
|
@ -31,3 +31,6 @@ $config['delete_messages_older_than'] = '30 days ago';
|
|||
// Mails to those usernames can not be accessed:
|
||||
$config['blocked_usernames'] = array('root', 'admin', 'administrator', 'hostmaster', 'postmaster', 'webmaster');
|
||||
|
||||
// Mails are usually show as Text and only if not available as HTML. You can turn this around to prefer HTML over text.
|
||||
$config['prefer_plaintext'] = true;
|
||||
|
||||
|
|
|
@ -63,22 +63,6 @@ $purifier = new HTMLPurifier($purifier_config);
|
|||
}, 15000);
|
||||
|
||||
|
||||
function showHtml(id) {
|
||||
document.getElementById('email-' + id + '-html').style.display = 'block';
|
||||
document.getElementById('email-' + id + '-plain').style.display = 'none';
|
||||
document.getElementById('show-html-button-' + id).style.display = 'none';
|
||||
document.getElementById('show-plain-button-' + id).style.display = 'inline-block';
|
||||
return false;
|
||||
}
|
||||
|
||||
function showPlain(id) {
|
||||
document.getElementById('email-' + id + '-html').style.display = 'none';
|
||||
document.getElementById('email-' + id + '-plain').style.display = 'block';
|
||||
document.getElementById('show-html-button-' + id).style.display = 'inline-block';
|
||||
document.getElementById('show-plain-button-' + id).style.display = 'none';
|
||||
return false;
|
||||
}
|
||||
|
||||
function copyToClipboard(text) {
|
||||
var inp = document.createElement('input');
|
||||
document.body.appendChild(inp);
|
||||
|
@ -188,19 +172,6 @@ $purifier = new HTMLPurifier($purifier_config);
|
|||
</h3>
|
||||
</div>
|
||||
<div class="col-sm-4 text-right">
|
||||
<button type="button" class="btn btn-outline-info btn-sm"
|
||||
style="display: inline-block"
|
||||
id="show-html-button-<?php echo $safe_email_id; ?>"
|
||||
onclick="showHtml(<?php echo $safe_email_id; ?>)">
|
||||
Show Html
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-info btn-sm"
|
||||
style="display: none"
|
||||
id="show-plain-button-<?php echo $safe_email_id; ?>"
|
||||
onclick="showPlain(<?php echo $safe_email_id; ?>)">
|
||||
Show Text
|
||||
</button>
|
||||
|
||||
<a class="btn btn-sm btn-outline-primary " download="true"
|
||||
role="button"
|
||||
href="?download_email_id=<?php echo $safe_email_id; ?>&address=<?php echo $user->address ?>">Download
|
||||
|
@ -244,18 +215,34 @@ $purifier = new HTMLPurifier($purifier_config);
|
|||
?>
|
||||
|
||||
<div class="mt-2 card-text">
|
||||
<!-- show plaintext or html -->
|
||||
<div id="email-<?php echo $safe_email_id; ?>-plain"
|
||||
style="display: block;">
|
||||
<?php $text = filter_var($email->textPlain, FILTER_SANITIZE_SPECIAL_CHARS);
|
||||
// Keep newlines
|
||||
$text = str_replace(' ', '<br />', $text);
|
||||
echo \AutoLinkExtension::auto_link_text($text)
|
||||
<div>
|
||||
<?php
|
||||
$safeHtml = $purifier->purify($email->textHtml);
|
||||
|
||||
$safeText = $purifier->purify($email->textPlain);
|
||||
$safeText = nl2br($safeText);
|
||||
$safeText = \AutoLinkExtension::auto_link_text($safeText);
|
||||
|
||||
$hasHtml = strlen(trim($safeHtml)) > 0;
|
||||
$hasText = strlen(trim($safeText)) > 0;
|
||||
|
||||
if ($config['prefer_plaintext']) {
|
||||
if ($hasText) {
|
||||
echo $safeText;
|
||||
} else {
|
||||
echo $safeHtml;
|
||||
}
|
||||
} else {
|
||||
if ($hasHtml) {
|
||||
echo $safeHtml;
|
||||
} else {
|
||||
echo $safeText;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div id="email-<?php echo $safe_email_id; ?>-html"
|
||||
style="display: none;">
|
||||
<?php echo $purifier->purify($email->textHtml); ?>
|
||||
<div>
|
||||
<?php ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue