Add a page to list redirects to the own mailbox
This commit is contained in:
parent
dda397074c
commit
4dc50750c9
3 changed files with 57 additions and 0 deletions
|
@ -6,4 +6,8 @@
|
|||
|
||||
<div class="buttons buttons-horizontal button-large">
|
||||
<a class="button" href="<?php echo url('private/changepass'); ?>">Change your password</a>
|
||||
</div>
|
||||
|
||||
<div class="buttons buttons-horizontal button-large">
|
||||
<a class="button" href="<?php echo url('private/yourredirects'); ?>">Redirects to your mailbox</a>
|
||||
</div>
|
52
include/php/pages/private/yourredirects.php
Normal file
52
include/php/pages/private/yourredirects.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
$ownEmail = Auth::getUser()->getEmail();
|
||||
|
||||
$redirects = AbstractRedirect::findMultiWhere(
|
||||
array(DBC_ALIASES_DESTINATION, 'LIKE', '%'.$ownEmail.'%')
|
||||
);
|
||||
|
||||
function anonymizeEmails($emails, $ownEmail){
|
||||
if(is_string($emails) || count($emails) === 1){
|
||||
return $ownEmail;
|
||||
}
|
||||
|
||||
return array($ownEmail, '…');
|
||||
}
|
||||
?>
|
||||
|
||||
<h1>Redirects to your mailbox</h1>
|
||||
|
||||
<div class="buttons">
|
||||
<a class="button" href="<?php echo url('private'); ?>">❬ Back to personal dashboard</a>
|
||||
</div>
|
||||
|
||||
<?php output_messages(); ?>
|
||||
|
||||
<?php if($redirects->count() > 0): ?>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Source</th>
|
||||
<th>Destination</th>
|
||||
<tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($redirects as $redirect): /** @var AbstractRedirect $redirect */ ?>
|
||||
<tr>
|
||||
<td><?php echo formatEmails($redirect->getSource(), str_replace(PHP_EOL, '<br>', FRONTEND_EMAIL_SEPARATOR_TEXT)); ?></td>
|
||||
<td><?php echo formatEmails(anonymizeEmails($redirect->getDestination(), $ownEmail), str_replace(PHP_EOL, '<br>', FRONTEND_EMAIL_SEPARATOR_TEXT)); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th><?php echo ($redirects->count() > 1) ? $redirects->count().' Redirects' : '1 Redirect'; ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<div class="notification notification-warning">
|
||||
There are currently no redirects to your mailbox.
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -18,6 +18,7 @@ Router::addGet('/logout', function(){
|
|||
*/
|
||||
Router::addGet('/private', 'include/php/pages/private/start.php', User::ROLE_USER);
|
||||
Router::addMixed('/private/changepass', 'include/php/pages/private/changepass.php', User::ROLE_USER);
|
||||
Router::addGet('/private/yourredirects', 'include/php/pages/private/yourredirects.php', User::ROLE_USER);
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue