X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/4e8cf4634404ed80dfa8dcb9fb56a577897b9da1..8e1d3422ac745d49bcf56152f11d5b07ea45cb38:/widget/reply.php
diff --git a/widget/reply.php b/widget/reply.php
index da993c9..0c5d5a3 100644
--- a/widget/reply.php
+++ b/widget/reply.php
@@ -23,32 +23,38 @@ if ($_POST) {
$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()) {
- print $row->message;
- $Page->teaser = $row->raw;
-}
-
-print '
';
+print '';
$imagecount = 0;
-while ($row = $query->fetch()) {
+for ($i = 0; $row = $query->fetch(); $i++) {
$rowuser = new User("profile/{$row->author}");
- printf('- ', $row->id);
- printf('%s', $rowuser->html);
+ printf('', $row->id);
+ if ($i) {
+ # subsequent reply header
+ printf('%s', $rowuser->html);
+ }
+ else {
+ $Page->teaser = $row->raw;
+ }
$rowdate = showdate(preg_split('/\D/', $row->created));
- if ($User->admin('beheer') and $row->updated) {
- $rowdate = "
$rowdate " . showdate(preg_split('/\D/', $row->updated));
+ if ($User->admin('beheer')) {
+ if ($row->updated) {
+ $rowdate = "$rowdate " . showdate(preg_split('/\D/', $row->updated));
+ }
+ if ($User->admin('user') || $User->login === $row->author) {
+ $rowdate .= sprintf(' %s',
+ "/{$Page->link}/{$row->id}", 'reactie aanpassen', "\u{270D}");
+ }
}
printf(' %s', $rowdate);
- if ($User->admin('beheer') and $User->admin('user') || $User->login === $row->author) {
- printf(' %s',
- "/{$Page->link}/{$row->id}", 'reactie aanpassen', "\u{270D}");
- }
if ($html = $row->message) {
$html = preg_replace('/(?<= 2 ? 'loading="lazy" ' : '', $html, -1, $found);
$imagecount += $found;
- printf("\n%s
\n", $html);
+ if ($i) {
+ $html = "\n$html
\n";
+ }
+ print $html;
}
if ($changes = json_decode($row->journal)) {
print '';
@@ -71,11 +77,11 @@ while ($row = $query->fetch()) {
}
print "
\n";
}
- print " \n";
+ print "\n";
}
if ($User->login) {
- print '- ';
+ print '
';
print '";
print '';
- print " \n";
+ print "\n";
}
-print "
\n\n";
+print "\n\n";