Fixes #754 Be able to delete emails from control center

This commit is contained in:
cytopia 2022-01-30 14:27:08 +01:00
parent 2ea5ff59e0
commit bbc6a661ed
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
2 changed files with 26 additions and 1 deletions

View File

@ -24,6 +24,17 @@ require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'mimeDeco
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mail.php';
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Sort.php';
if (isset($_GET['delete']) && is_numeric($_GET['delete'])) {
$message = $_GET['delete'];
$MyMbox = new \devilbox\Mail('/var/mail/devilbox');
$MyMbox->delete($message);
header('Location: /mail.php');
exit();
}
//
// Setup Sort/Order
//
@ -152,6 +163,7 @@ $messages = $MyMbox->get($sortOrderArr);
<th>From <?php echo $orderFrom;?></th>
<th>To <?php echo $orderTo;?></th>
<th>Subject <?php echo $orderSubj;?></th>
<th>Action</th>
</tr>
</thead>
<tbody>
@ -180,11 +192,12 @@ $messages = $MyMbox->get($sortOrderArr);
<td><?php echo htmlentities($structure->headers['from']);?></td>
<td><?php echo htmlentities($structure->headers['x-original-to']);?></td>
<td><?php echo htmlentities($structure->headers['subject']);?></td>
<td><a href="/mail.php?delete=<?php echo $data['num']-1;?>" title="Delete Email"><i class="fa fa-trash"></i></a></td>
</tr>
<tr></tr>
<tr id="mail-<?php echo $data['num'];?>" style="display:none">
<td></td>
<td colspan="4">
<td colspan="5">
<?php if ($body !== null): ?>
<template id="mail-body-<?=$data['num']?>"><?=$body?></template>
<html-email data-template-id="mail-body-<?=$data['num']?>"></html-email>

View File

@ -58,6 +58,18 @@ class Mail
}
/**
* Deletes an emails
*
* Note: messages start with 0.
*
* @param int $message The number of the message to remove, or array of message ids to remove
*/
public function delete($message) {
$this->_Mbox->remove($message);
}
/**
* Retrieve emails.
*