X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/4acdd7f1c3b2b78933d7953e8777df73af3189aa..8e1d3422ac745d49bcf56152f11d5b07ea45cb38:/widget/reply.php diff --git a/widget/reply.php b/widget/reply.php index 010b1de..0c5d5a3 100644 --- a/widget/reply.php +++ b/widget/reply.php @@ -6,7 +6,7 @@ require_once 'upload.inc.php'; if ($_POST) { try { $newcomment = createcomment($_POST, $Issue); - $target = "/{$Page->link}/$newcomment#$newcomment"; + $target = "/{$Page->link}?last=$newcomment#$newcomment"; abort($target, ($Page->api ? 200 : 303) . ' reply success'); $_POST['reply'] = NULL; } @@ -14,32 +14,47 @@ if ($_POST) { if ($Page->api) { abort(ucfirst($e->getMessage()), '500 reply error'); } - print "

Antwoord niet opgeslagen: {$e->getMessage()}.

\n\n"; + printf("

Antwoord niet opgeslagen: %s.

\n\n", + nl2br(htmlspecialchars($e->getMessage())) + ); } } -$cols = '*, (SELECT json_agg(journal.*) FROM journal WHERE comment_id = comments.id) AS journal'; +$cols = "*, (SELECT json_agg(journal.*) FROM journal WHERE comment_id = comments.id AND property = 'attr') AS journal"; $query = $Db->query("SELECT $cols FROM comments WHERE page = ? ORDER BY created", [$Page->link]); -if ($row = $query->fetch()) { - print $row->message; - $Page->teaser = $row->raw; -} - -print '\n\n"; +print "\n\n";