X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/483761be2d405d4a69c005bd407f12e6d81445b1..170f16e2dd3a643423ea3681bf4ea42d320e1cf4:/widget/reply.php diff --git a/widget/reply.php b/widget/reply.php index 879b53d..fd01a94 100644 --- a/widget/reply.php +++ b/widget/reply.php @@ -7,12 +7,11 @@ $journalcol = [ ]; if ($_POST) { + require_once 'upload.inc.php'; try { - $html = nl2br(htmlspecialchars($_POST['reply'])); - $html = "

$html

"; $query = $Db->set('comments', [ 'page' => $Page, - 'message' => $html, + 'message' => messagehtml($_POST['reply']), 'author' => $User->login, ]); if (!$query->rowCount()) { @@ -47,6 +46,7 @@ if ($_POST) { 'value' => $updated->$col, ]); } + $Issue = $updated; } } $_POST['reply'] = NULL; @@ -56,7 +56,8 @@ if ($_POST) { } } -$query = $Db->query('SELECT * FROM comments WHERE page = ? ORDER BY created', [$Page]); +$cols = '*, (SELECT json_agg(journal.*) FROM journal WHERE comment_id = comments.id) AS journal'; +$query = $Db->query("SELECT $cols FROM comments WHERE page = ? ORDER BY created", [$Page]); print '