X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/621fc2f9638a1a92aa8535310e7852de5542f11e..3671d53f7cdf7bfbf628d7d5adbb2e2847450fb9:/widget/reply.php diff --git a/widget/reply.php b/widget/reply.php index edffaa7..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]); +$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 '
%2$s' : - (!isset($change->value) ? 'verwijderd (
%snaar
%s'), $change->old_value, $change->value ) @@ -106,7 +130,7 @@ while ($row = $query->fetch()) { if ($User->login) { print '