mirror of
https://github.com/cytopia/devilbox.git
synced 2024-12-19 04:47:52 +00:00
Fixes #754 Be able to delete emails from control center
This commit is contained in:
parent
2ea5ff59e0
commit
bbc6a661ed
@ -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>
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user