X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/772961fd4e9be46ad340cad1e55ee5f28cc5b968..0ec5d194ee1838759b2a79c574ebfdca30bc7404:/widget/reply.php diff --git a/widget/reply.php b/widget/reply.php index ca38ce9..685a611 100644 --- a/widget/reply.php +++ b/widget/reply.php @@ -4,12 +4,17 @@ require_once 'database.inc.php'; $journalcol = [ 'assign' => 'Toegewezen aan', + 'subject' => 'Onderwerp', ]; if ($_POST) { require_once 'upload.inc.php'; try { - $html = messagehtml($_POST['reply']); + $reply = []; + if (isset($_POST['reply']) and $body = $_POST['reply']) { + $reply['raw'] = $body; + $reply['message'] = messagehtml($body); + } if ($_FILES and !empty($_FILES['image'])) { $target = 'data/upload'; if (!file_exists($target)) { @@ -17,12 +22,19 @@ if ($_POST) { } $target .= '/' . $User->login; if ($result = userupload($_FILES['image'], $target)) { - $html .= sprintf('
Antwoord niet opgeslagen: {$e->getMessage()}.
\n\n"; } } $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->handler]); +$query = $Db->query("SELECT $cols FROM comments WHERE page = ? ORDER BY created", [$Page->link]); print '\n%s\n", $row->message); + if ($html = $row->message) { + $html = preg_replace('/(?<=
\n%s\n", $html); + } if ($changes = json_decode($row->journal)) { print '