X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/772961fd4e9be46ad340cad1e55ee5f28cc5b968..e64861a7760cfe34596e193a6a3ed2ef39b25892:/widget/reply.php diff --git a/widget/reply.php b/widget/reply.php index ca38ce9..1f6d0e2 100644 --- a/widget/reply.php +++ b/widget/reply.php @@ -21,7 +21,7 @@ if ($_POST) { } } $query = $Db->set('comments', [ - 'page' => $Page->handler, + 'page' => $Page->link, 'message' => $html, 'author' => $User->login, ]); @@ -60,15 +60,22 @@ if ($_POST) { $Issue = $updated; } } + + if ($Page->api) { + abort("/{$Page->link}", '200 reply success'); + } $_POST['reply'] = NULL; } catch (Exception $e) { + if ($Page->api) { + abort(ucfirst($e->getMessage()), '500 reply error'); + } print "

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\n";