issue: derive page metadata from row data
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 1 Jan 2020 11:06:15 +0000 (12:06 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 1 Jan 2020 11:07:59 +0000 (12:07 +0100)
issue/index.php
widget/reply.php

index 332179ef90ebaf24f9b26b2044169f74f57d79e0..3f665db3456ea9e859dbc5b1d44b66aa6512bedf 100644 (file)
@@ -14,6 +14,9 @@ if ($id and ctype_digit($id)) {
        $replies = placeholder_include('reply');  # handle updates
 
        $Article->title .= ': '.htmlspecialchars($Issue->subject);
+       $Article->teaser = $Issue->body;
+       $Article->body = $replies;  # find image
+
        print "<h2>{$Article->title}</h2>\n";
        print "<dl class=\"aside right sidebar\">\n";
        print '<dt>Geplaatst</dt>';
@@ -54,7 +57,7 @@ if ($_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 ~ 'img') AS imagecount";
+$cols .= ", ($subsql AND message ~ '<img') AS imagecount";
 $sql = "SELECT $cols FROM issues i WHERE page = ?";
 if (isset($_GET['open'])) {
        $sql .= ' AND closed IS NULL';
index fd01a947f81acb6748fb300b2bac7f00788216ef..9e1c7e33757337ebb4d63858cf833e0f22565d10 100644 (file)
@@ -67,7 +67,7 @@ while ($row = $query->fetch()) {
        printf('<strong>%s</strong> <small class=date>%s</small>',
                $rowuser->html, showdate(preg_split('/\D/', $row->created))
        );
-       printf("<blockquote>%s</blockquote>\n", $row->message);
+       printf("<blockquote>\n%s</blockquote>\n", $row->message);
        if ($changes = json_decode($row->journal)) {
                print '<ul>';
                foreach ($changes as $change) {