X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/8dfcd9f98a316599cae7d94f56069c4ba79d2c93..3b7350299c92ff6de3b7980791657de1f5269e48:/issue/index.php diff --git a/issue/index.php b/issue/index.php index 388db5d..cc17f03 100644 --- a/issue/index.php +++ b/issue/index.php @@ -5,44 +5,48 @@ require_once 'database.inc.php'; if ($id and ctype_digit($id)) { $Article->title = "Issue #$id"; - + $Args = "/$id"; # minimal reference $Issue = $Db->query( 'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page, $id] )->fetch(); if (!$Issue) throw new Exception('Issuenummer niet gevonden'); + $replies = placeholder_include('reply'); # handle updates + $Article->title .= ': '.htmlspecialchars($Issue->subject); + $Article->teaser = $Issue->body; + $Article->body = $replies; # find image + print "

{$Article->title}

\n"; - $author = $Issue->author ? new User('profile/'.$Issue->author, FALSE) : NULL; - printf('

%s%s %s

'."\n", - 'Geplaatst', - $author ? " door {$author->name}" : '', - showdate(preg_split('/\D/', $Issue->created)) - ); + print '\n\n"; + + print '
'; print $Issue->body; - $Args = "/$id"; # minimal reference - print placeholder_include('reply'); + print $replies; + print "
\n"; return; } if ($_POST) { - $html = nl2br(htmlspecialchars($_POST['body'])); - $html = empty($html) ? NULL : "

$html

"; + require_once 'upload.inc.php'; $query = $Db->set('issues', [ 'page' => $Page, 'subject' => $_POST['subject'], - 'body' => $html, + 'body' => messagehtml($_POST['body']), 'author' => $User->login, ]); if (!$query->rowCount()) { @@ -51,8 +55,9 @@ if ($_POST) { $_POST = []; } -$cols = "*, (SELECT count(*) FROM comments WHERE" - . " page=i.page||'/'||i.id AND message IS NOT NULL) AS replycount"; +$subsql = "SELECT count(*) FROM comments WHERE page=i.page||'/'||i.id"; +$cols = "*, ($subsql AND message IS NOT NULL) AS replycount"; +$cols .= ", ($subsql AND message ~ ''; while ($row = $query->fetch()) { - printf('%s %s%s', + printf('
', $row->closed ? ' class="disabled"' : '', - "/$Page/{$row->id}/{$row->link}", - sprintf($row->closed ? '%s' : '%s', - htmlspecialchars($row->subject)), - showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3)), - implode(' ', [ - $row->replycount ? sprintf('+%d', $row->replycount) : '', - isset($row->assign) ? ''.$row->assign.'' : '', - ]) + "/$Page/{$row->id}/{$row->link}" ); - print "\n"; + printf($row->closed ? '%s' : '%s', htmlspecialchars($row->subject)); + { + printf(' %s', + showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3)) + ); + } + if ($row->replycount) { + printf(' %s %d', + '🗨', + $row->replycount + ); + } + if ($row->imagecount) { + print ' 📷'; + } + if (isset($row->assign)) { + print ' '.$row->assign.''; + } + print "
\n"; } print "\n"; $Place['issuelist'] = ob_get_clean();