- print '<li>';
- printf('<strong>%s</strong> <small class=date>%s</small>',
- $rowuser->html, showdate(preg_split('/\D/', $row->created))
- );
- printf("<blockquote>%s</blockquote>\n", $row->message);
- print "</li>\n";
+ printf('<article id="%d">', $row->id);
+ if ($i) {
+ # subsequent reply header
+ printf('<strong>%s</strong>', $rowuser->html);
+ }
+ else {
+ $Page->teaser = $row->raw;
+ }
+ $rowdate = showdate(preg_split('/\D/', $row->created));
+ if ($User->admin('beheer')) {
+ if ($row->updated) {
+ $rowdate = "<s>$rowdate</s> " . showdate(preg_split('/\D/', $row->updated));
+ }
+ if ($User->admin('user') || $User->login === $row->author) {
+ $rowdate .= sprintf(' <a href="%s" title="%s" class=icon>%s</a>',
+ "/{$Page->link}/{$row->id}", 'reactie aanpassen', "\u{270D}");
+ }
+ }
+ printf(' <small class=date>%s</small>', $rowdate);
+ if ($html = $row->message) {
+ $html = preg_replace('/(?<=<img )/',
+ $imagecount > 2 ? 'loading="lazy" ' : '', $html, -1, $found);
+ $imagecount += $found;
+ if ($i) {
+ $html = "<blockquote>\n$html</blockquote>\n";
+ }
+ print $html;
+ }
+ if ($changes = json_decode($row->journal)) {
+ print '<ul>';
+ foreach ($changes as $change) {
+ print '<li>';
+ if ($change->col == 'closed') {
+ printf('<em>%s</em>', isset($change->value) ? 'Gesloten' : 'Heropend');
+ }
+ else {
+ printf("<em>%s</em> %s",
+ $journalcol[$change->col], sprintf(
+ !isset($change->old_value) ? 'gewijzigd naar <q>%2$s</q>' :
+ (!isset($change->value) ? 'verwijderd (<s>%s</s>)' :
+ 'gewijzigd van <q>%s</q> naar <q>%s</q>'),
+ $change->old_value, $change->value
+ )
+ );
+ }
+ print "</li>\n";
+ }
+ print "</ul>\n";
+ }
+ print "</article>\n";