diff --git a/Rocksolid_Light/rocksolid/mail.php b/Rocksolid_Light/rocksolid/mail.php
index 16c30a5..ae25cf8 100644
--- a/Rocksolid_Light/rocksolid/mail.php
+++ b/Rocksolid_Light/rocksolid/mail.php
@@ -48,14 +48,28 @@ include "head.inc";
echo '
';
if(isset($_POST['username'])) {
@@ -90,6 +104,26 @@ echo '';
}
$user = strtolower($_POST['username']);
+
+ if(isset($_POST['command']) && $_POST['command'] == 'Delete') {
+ $database = $spooldir.'/mail.db3';
+ $dbh = mail_db_open($database);
+ $query = $dbh->prepare('SELECT * FROM messages where id=:id');
+ $query->execute(['id' => $_POST['id']]);
+ while (($row = $query->fetch()) !== false) {
+ if(($row['mail_from'] != $user) && ($row['rcpt_to'] != $user)) {
+ continue;
+ }
+ if($row['mail_from'] == $user) {
+ $sql_update = $dbh->prepare('UPDATE messages SET from_hide=? WHERE id=?');
+ } elseif($row['rcpt_to'] == $user) {
+ $sql_update = $dbh->prepare('UPDATE messages SET to_hide=? WHERE id=?');
+ }
+ $sql_update->execute(array('true', $row['id']));
+ }
+ $dbh = null;
+ }
+
if(isset($_POST['command']) && $_POST['command'] == 'Message') {
$database = $spooldir.'/mail.db3';
$dbh = mail_db_open($database);
@@ -164,7 +198,7 @@ echo '';
$stmt = $dbh->prepare($sql);
// For possible future use
$target = "local";
- $mail_viewed = "1";
+ $mail_viewed = "true";
$rcpt_viewed = null;
$q = $stmt->execute([$msgid, $from, $to, $target, $date, $subject, $message, null, null, $mail_viewed, $rcpt_viewed]);
if ($q) {
@@ -224,6 +258,12 @@ echo '';
echo 'Subject | From | To | Date |
';
$i=1;
while (($row = $query->fetch()) !== false) {
+ if(($row['mail_from'] == $user) && ($row['from_hide'] == 'true')) {
+ continue;
+ }
+ if(($row['rcpt_to'] == $user) && ($row['to_hide'] == 'true')) {
+ continue;
+ }
if(($i % 2) != 0){
echo '';
} else {
|