X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/23d1415e31c8cb5db2756959e8951ca5f28c476d..8dfcd9f98a316599cae7d94f56069c4ba79d2c93:/issue/index.php diff --git a/issue/index.php b/issue/index.php index d07a786..388db5d 100644 --- a/issue/index.php +++ b/issue/index.php @@ -3,7 +3,7 @@ global $User, $Db; require_once 'database.inc.php'; @list ($id, $title) = explode('/', ltrim($Args, '/')); -if ($id) { +if ($id and ctype_digit($id)) { $Article->title = "Issue #$id"; $Issue = $Db->query( @@ -13,10 +13,10 @@ if ($id) { $Article->title .= ': '.htmlspecialchars($Issue->subject); print "

{$Article->title}

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

%s%s %s

'."\n", 'Geplaatst', - $Issue->author ? " door {$Issue->author}" : '', + $author ? " door {$author->name}" : '', showdate(preg_split('/\D/', $Issue->created)) ); if ($Issue->assign) { @@ -30,6 +30,7 @@ if ($id) { showdate(preg_split('/\D/', $Issue->closed)) ); } + print $Issue->body; $Args = "/$id"; # minimal reference print placeholder_include('reply'); return; @@ -50,21 +51,32 @@ if ($_POST) { $_POST = []; } -$sql = 'SELECT * FROM issues WHERE page = ?'; +$cols = "*, (SELECT count(*) FROM comments WHERE" + . " page=i.page||'/'||i.id AND message IS NOT NULL) AS replycount"; +$sql = "SELECT $cols FROM issues i WHERE page = ?"; if (isset($_GET['open'])) { $sql .= ' AND closed IS NULL'; } $sql .= ' ORDER BY closed IS NOT NULL, updated DESC'; $query = $Db->query($sql, [$Page]); +if ($id == 'feed') { + require 'issue/feed.inc.php'; +} + ob_start(); print '