X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/ed1cd294e32647b117688b25a465889e4664fe03..4e8cf4634404ed80dfa8dcb9fb56a577897b9da1:/widget/reply.php diff --git a/widget/reply.php b/widget/reply.php index b740c2a..da993c9 100644 --- a/widget/reply.php +++ b/widget/reply.php @@ -6,7 +6,7 @@ require_once 'upload.inc.php'; if ($_POST) { try { $newcomment = createcomment($_POST, $Issue); - $target = "/{$Page->link}/$newcomment#$newcomment"; + $target = "/{$Page->link}?last=$newcomment#$newcomment"; abort($target, ($Page->api ? 200 : 303) . ' reply success'); $_POST['reply'] = NULL; } @@ -14,11 +14,13 @@ if ($_POST) { if ($Page->api) { abort(ucfirst($e->getMessage()), '500 reply error'); } - print "

Antwoord niet opgeslagen: {$e->getMessage()}.

\n\n"; + printf("

Antwoord niet opgeslagen: %s.

\n\n", + nl2br(htmlspecialchars($e->getMessage())) + ); } } -$cols = '*, (SELECT json_agg(journal.*) FROM journal WHERE comment_id = comments.id) AS journal'; +$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()) { @@ -32,9 +34,16 @@ $imagecount = 0; while ($row = $query->fetch()) { $rowuser = new User("profile/{$row->author}"); printf('
  • ', $row->id); - printf('%s %s', - $rowuser->html, showdate(preg_split('/\D/', $row->created)) - ); + printf('%s', $rowuser->html); + $rowdate = showdate(preg_split('/\D/', $row->created)); + if ($User->admin('beheer') and $row->updated) { + $rowdate = "$rowdate " . showdate(preg_split('/\D/', $row->updated)); + } + 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); @@ -69,6 +78,17 @@ if ($User->login) { print '
  • '; print '
    '; if (isset($Issue) and $User->admin("edit {$Page->link}")) { + print "\n"; + } + { + print '

    '; + printf( + '' + . "Geplaatste berichten zijn hier direct zichtbaar voor bewoners.\n" + . '' + . ''."\n", + 'announce', + '1', + ($_POST['announce'] ?? TRUE) ? ' checked' : '', + ' onclick="this.nextSibling.hidden = !this.checked"', + "De eerste regel wordt ook weergegeven op het scherm in de hal." + ); + print "

    \n"; } if (isset($Issue)) { printf(