X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/dc93b0f8e382f9f449051a1b0412ed5fafebf77b..a257ef8b6e9d435938803471bd655be9d9734370:/issue/index.php diff --git a/issue/index.php b/issue/index.php index 0c18142..35a1116 100644 --- a/issue/index.php +++ b/issue/index.php @@ -14,7 +14,6 @@ if ($id and ctype_digit($id)) { $replies = $Page->widget('reply'); # handle updates $Page->title .= ': '.htmlspecialchars($Issue->subject); - $Page->teaser = $Issue->body; $Page->body = $replies; # find image if ($Page->api) return; @@ -36,7 +35,6 @@ if ($id and ctype_digit($id)) { print "\n\n"; print '
'; - print $Issue->body; print $replies; print "
\n"; return; @@ -51,23 +49,33 @@ if ($_POST and isset($_POST['subject'])) { $query = $Db->set('issues', [ 'page' => $Page->handler, 'subject' => $_POST['subject'], - 'body' => messagehtml($_POST['body']), + 'link' => preg_replace('/\b(?:de|het|een)\s+|\W+/', '-', strtolower($_POST['subject'])), 'author' => $User->login, ]); if (!$query->rowCount()) { throw new Exception('Issue niet opgeslagen.'); } + $row = $query->fetch(); + if (!$row->id) { + throw new Exception('Issue niet goed opgeslagen.'); + } + try { + createcomment($_POST, $row); + } + catch (Exception $e) { + throw new Exception("Issueinhoud niet opgeslagen: {$e->getMessage()}."); + } $_POST = []; } $subsql = "SELECT count(*) FROM comments WHERE page=i.page||'/'||i.id"; -$cols = "*, ($subsql AND message IS NOT NULL) AS replycount"; +$cols = "*, ($subsql AND message IS NOT NULL) - 1 AS replycount"; $cols .= ", ($subsql AND message ~ 'query($sql, [$Page->handler]); if ($id == 'feed') {