Skip to content

Commit

Permalink
Message of another user could be deleted #1441
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasse committed Jun 15, 2023
1 parent f20c8ec commit 3b248b7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions adm_program/modules/messages/messages.php
Expand Up @@ -38,14 +38,17 @@
$delMessage = new TableMessage($gDb);
$delMessage->readDataByUuid($getMsgUuid);

// Function to delete message
$returnCode = $delMessage->delete();

if ($returnCode) {
echo 'done';
} else {
echo 'delete not OK';
// only delete messages of the current user is allowed
if ($delMessage->getValue('msg_usr_id_sender') === $gCurrentUserId) {
$returnCode = $delMessage->delete();

if ($returnCode) {
echo 'done';
exit();
}
}

echo 'delete not OK';
exit();
}

Expand Down

0 comments on commit 3b248b7

Please sign in to comment.