issue: message editing feature
[minimedit.git] / widget / reply.php
index 6fe9eb1fc5eadcf5b3a098734ab2dde733277a9d..f9248512105bda05860bf691d212bbf7d1e0e3b3 100644 (file)
@@ -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,11 +14,13 @@ if ($_POST) {
                if ($Page->api) {
                        abort(ucfirst($e->getMessage()), '500 reply error');
                }
-               print "<p class=warn>Antwoord niet opgeslagen: {$e->getMessage()}.</p>\n\n";
+               printf("<p class=warn>Antwoord niet opgeslagen: %s.</p>\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()) {