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
|
- fixed problem where only one domain is defined
|
||||||
- horizontal spacing for header (from @Spegeli) and style
|
- horizontal spacing for header (from @Spegeli) and style
|
||||||
- fix: restore focus on reload
|
- fix: restore focus on reload
|
||||||
|
- Added $config['prefer_plaintext'] = true; Prefer HTML or Text and removed toggle buttons.
|
||||||
|
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added multiple domain support (https://github.com/synox/disposable-mailbox/issues/21)
|
- 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:
|
// Mails to those usernames can not be accessed:
|
||||||
$config['blocked_usernames'] = array('root', 'admin', 'administrator', 'hostmaster', 'postmaster', 'webmaster');
|
$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);
|
}, 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) {
|
function copyToClipboard(text) {
|
||||||
var inp = document.createElement('input');
|
var inp = document.createElement('input');
|
||||||
document.body.appendChild(inp);
|
document.body.appendChild(inp);
|
||||||
|
@ -188,19 +172,6 @@ $purifier = new HTMLPurifier($purifier_config);
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 text-right">
|
<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"
|
<a class="btn btn-sm btn-outline-primary " download="true"
|
||||||
role="button"
|
role="button"
|
||||||
href="?download_email_id=<?php echo $safe_email_id; ?>&address=<?php echo $user->address ?>">Download
|
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">
|
<div class="mt-2 card-text">
|
||||||
<!-- show plaintext or html -->
|
<div>
|
||||||
<div id="email-<?php echo $safe_email_id; ?>-plain"
|
<?php
|
||||||
style="display: block;">
|
$safeHtml = $purifier->purify($email->textHtml);
|
||||||
<?php $text = filter_var($email->textPlain, FILTER_SANITIZE_SPECIAL_CHARS);
|
|
||||||
// Keep newlines
|
$safeText = $purifier->purify($email->textPlain);
|
||||||
$text = str_replace(' ', '<br />', $text);
|
$safeText = nl2br($safeText);
|
||||||
echo \AutoLinkExtension::auto_link_text($text)
|
$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>
|
||||||
<div id="email-<?php echo $safe_email_id; ?>-html"
|
<div>
|
||||||
style="display: none;">
|
<?php ?>
|
||||||
<?php echo $purifier->purify($email->textHtml); ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue