cleanup WIP

This commit is contained in:
Synox 2018-06-22 23:10:19 +02:00
parent ac67bf1659
commit d1e5551cc2
2 changed files with 99 additions and 98 deletions

View File

@ -20,11 +20,12 @@ $mailIds = array_map(function ($mail) {
}, $emails); }, $emails);
$mailIdsJoinedString = filter_var(join('|', $mailIds), FILTER_SANITIZE_SPECIAL_CHARS); $mailIdsJoinedString = filter_var(join('|', $mailIds), FILTER_SANITIZE_SPECIAL_CHARS);
function niceDate($date){ function niceDate($date) {
// TODO: make nicer
return $date; return $date;
} }
?>
?>
<!doctype html> <!doctype html>
@ -40,9 +41,9 @@ function niceDate($date){
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css"
integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"
crossorigin="anonymous"> crossorigin="anonymous">
<title><?php <title><?php
echo $emails ? "(" . count($emails) . ") " : ""; echo $emails ? "(" . count($emails) . ") " : "";
echo $user->address ?></title> echo $user->address ?></title>
<link rel="stylesheet" href="spinner.css"> <link rel="stylesheet" href="spinner.css">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
@ -79,7 +80,8 @@ function niceDate($date){
<button type="button" class="btn btn-outline-secondary" onclick="location.reload()"> <button type="button" class="btn btn-outline-secondary" onclick="location.reload()">
<i class="fas fa-sync"></i> <i class="fas fa-sync"></i>
Reload!</button> Reload!
</button>
</div> </div>
<!-- move the rest of the page a bit down to show all content --> <!-- move the rest of the page a bit down to show all content -->
@ -97,8 +99,8 @@ function niceDate($date){
<span id="my-address"> <span id="my-address">
<?php echo $user->address ?> <?php echo $user->address ?>
</span>&nbsp;<button class="copy-button" data-clipboard-target="#my-address"> </span>&nbsp;<button class="copy-button" data-clipboard-target="#my-address">
Copy Copy
</button> </button>
</div> </div>
@ -118,8 +120,8 @@ function niceDate($date){
<div class="card-body"> <div class="card-body">
<p> <p>
<a href="?action=random" role="button" class="btn btn-dark"> <a href="?action=random" role="button" class="btn btn-dark">
<i class="fa fa-random"></i> <i class="fa fa-random"></i>
Open random mailbox Open random mailbox
</a> </a>
</p> </p>
@ -139,17 +141,16 @@ function niceDate($date){
<div class="input-group-text">@</div> <div class="input-group-text">@</div>
</div> </div>
<select class="custom-select" id="inlineFormInputGroupUsername" name="domain"> <select class="custom-select" id="inlineFormInputGroupUsername" name="domain">
<?php <?php
foreach ($config['domains'] as $aDomain) { foreach ($config['domains'] as $aDomain) {
$selected = $aDomain === $user->domain ? ' selected ' : ''; $selected = $aDomain === $user->domain ? ' selected ' : '';
print "<option value='$aDomain' $selected>@$aDomain</option>"; print "<option value='$aDomain' $selected>@$aDomain</option>";
} }
?> ?>
</select> </select>
</div> </div>
</div> </div>
<div class="col-auto my-1"> <div class="col-auto my-1">
@ -168,92 +169,93 @@ function niceDate($date){
<div id="email-list" class="list-group"> <div id="email-list" class="list-group">
<?php foreach ($emails as $email) { <?php foreach ($emails as $email) {
$safe_email_id = filter_var($email->id, FILTER_VALIDATE_INT); $safe_email_id = filter_var($email->id, FILTER_VALIDATE_INT);
?> ?>
<a class="list-group-item list-group-item-action email-list-item" data-toggle="collapse" <a class="list-group-item list-group-item-action email-list-item" data-toggle="collapse"
href="#mail-box-<?php echo $email->id?>" href="#mail-box-<?php echo $email->id ?>"
role="button" role="button"
aria-expanded="false" aria-controls="mail-box-<?php echo $email->id?>"> aria-expanded="false" aria-controls="mail-box-<?php echo $email->id ?>">
<div class="media"> <div class="media">
<button class="btn btn-white open-collapse-button"> <button class="btn btn-white open-collapse-button">
<i class="fas fa-caret-right expand-button-closed"></i> <i class="fas fa-caret-right expand-button-closed"></i>
<i class="fas fa-caret-down expand-button-opened"></i> <i class="fas fa-caret-down expand-button-opened"></i>
</button> </button>
<div class="media-body"> <div class="media-body">
<h6 class="list-group-item-heading"><?php echo filter_var($email->fromName, FILTER_SANITIZE_SPECIAL_CHARS)?><span class="text-muted"><?php echo filter_var($email->fromAddress, FILTER_SANITIZE_SPECIAL_CHARS)?></span> <h6 class="list-group-item-heading"><?php echo filter_var($email->fromName, FILTER_SANITIZE_SPECIAL_CHARS) ?>
<small class="float-right"><?php echo niceDate($email->date)?></small> <span class="text-muted"><?php echo filter_var($email->fromAddress, FILTER_SANITIZE_SPECIAL_CHARS) ?></span>
</h6> <small class="float-right"><?php echo niceDate($email->date) ?></small>
<p class="list-group-item-text text-truncate"> </h6>
<?php echo filter_var($email->subject, FILTER_SANITIZE_SPECIAL_CHARS); ?> <p class="list-group-item-text text-truncate">
<?php echo filter_var($email->subject, FILTER_SANITIZE_SPECIAL_CHARS); ?>
<span class="float-right primary"> <span class="float-right primary">
<a class="btn btn-outline-primary btn-sm " download="true" <a class="btn btn-outline-primary btn-sm " download="true"
role="button" role="button"
href="?action=download_email&download_email_id=<?php echo $safe_email_id; ?>&amp;address=<?php echo $user->address ?>">Download href="?action=download_email&download_email_id=<?php echo $safe_email_id; ?>&amp;address=<?php echo $user->address ?>">Download
</a> </a>
<a class="btn btn-outline-danger btn-sm" <a class="btn btn-outline-danger btn-sm"
role="button" role="button"
href="?action=delete_email&email_id=<?php echo $safe_email_id; ?>&amp;address=<?php echo $user->address ?>">Delete href="?action=delete_email&email_id=<?php echo $safe_email_id; ?>&amp;address=<?php echo $user->address ?>">Delete
</a> </a>
</span> </span>
</p> </p>
</div>
</div>
</a>
<div id="mail-box-<?php echo $email->id ?>" role="tabpanel" aria-labelledby="headingCollapse1"
class="card-collapse collapse"
aria-expanded="true">
<div class="card-body">
<div class="card-block email-body">
<?php
$safeHtml = $purifier->purify($email->textHtml);
$safeText = htmlspecialchars($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> </div>
</div> </div>
</a>
<div id="mail-box-<?php echo $email->id?>" role="tabpanel" aria-labelledby="headingCollapse1"
class="card-collapse collapse"
aria-expanded="true">
<div class="card-body">
<div class="card-block email-body">
<?php
$safeHtml = $purifier->purify($email->textHtml);
$safeText = htmlspecialchars($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>
</div>
<?php } ?> <?php } ?>
</div> </div>
<?php <?php
if (empty($emails)) { ?> if (empty($emails)) { ?>
<div id="empty-mailbox"> <div id="empty-mailbox">
<hr> <hr>
<p>Emails will appear here automatically. </p> <p>Emails will appear here automatically. </p>
<div class="spinner"> <div class="spinner">
<div class="rect1"></div> <div class="rect1"></div>
<div class="rect2"></div> <div class="rect2"></div>
<div class="rect3"></div> <div class="rect3"></div>
<div class="rect4"></div> <div class="rect4"></div>
<div class="rect5"></div> <div class="rect5"></div>
</div>
</div> </div>
</div>
<?php } ?> <?php } ?>
</div> </div>
</main> </main>
@ -337,11 +339,10 @@ function niceDate($date){
/** from https://github.com/twbs/bootstrap/blob/c11132351e3e434f6d4ed72e5a418eb692c6a319/assets/js/src/application.js */ /** from https://github.com/twbs/bootstrap/blob/c11132351e3e434f6d4ed72e5a418eb692c6a319/assets/js/src/application.js */
clipboard.on('success', function (e) { clipboard.on('success', function (e) {
$(e.trigger) $(e.trigger)
.attr('title', 'Copied!') .attr('title', 'Copied!')
.tooltip('_fixTitle') .tooltip('_fixTitle')
.tooltip('show') .tooltip('show')
.attr('title', 'Copy to clipboard') .tooltip('_fixTitle');
.tooltip('_fixTitle');
e.clearSelection(); e.clearSelection();
}); });

View File

@ -92,7 +92,7 @@ footer {
} }
#new-content-avalable { #new-content-avalable {
/*display: none;*/ display: none;
text-align: center; text-align: center;
} }