From eb04a484ab96f6b407e8eef5fdac99229f1d38a1 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Sat, 28 Aug 2021 19:41:33 +0200 Subject: [PATCH] Add decryption of messages to view_publicnotes - fixes #115 --- chat.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chat.php b/chat.php index 61bf412..9a1b856 100644 --- a/chat.php +++ b/chat.php @@ -1924,6 +1924,13 @@ function view_publicnotes(){ $query = $db->query('SELECT notes.lastedited, notes.editedby, notes.text FROM ' . PREFIX . 'notes INNER JOIN (SELECT MAX(id) AS latest FROM notes WHERE type=3 GROUP BY editedby) AS t ON t.latest = notes.id;'); while($result = $query->fetch(PDO::FETCH_OBJ)){ if (!empty($result->text)) { + if(MSGENCRYPTED){ + try { + $result->text = sodium_crypto_aead_aes256gcm_decrypt(base64_decode($result->text), null, AES_IV, ENCRYPTKEY); + } catch (SodiumException $e){ + send_error($e->getMessage()); + } + } echo '
'; printf($I['lastedited'], htmlspecialchars($result->editedby), date($dateformat, $result->lastedited)); echo '
';