X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/8f05d49e133e9ca27d20bfc3835fc08812a683cb..e2e6d4c1c37aff2e6b50331cb31af9d59536624f:/issue/index.php diff --git a/issue/index.php b/issue/index.php index ff99064..f950861 100644 --- a/issue/index.php +++ b/issue/index.php @@ -7,16 +7,16 @@ if ($id) { $Article->title = "Issue #$id"; $Issue = $Db->query( - 'SELECT * FROM issues WHERE id = ?', [$id] + 'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page, $id] )->fetch(); if (!$Issue) throw new Exception('Issuenummer niet gevonden'); $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,27 @@ if ($_POST) { $_POST = []; } -$sql = 'SELECT * FROM issues'; +$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 .= ' WHERE closed IS NULL'; + $sql .= ' AND closed IS NULL'; } $sql .= ' ORDER BY closed IS NOT NULL, updated DESC'; -$query = $Db->query($sql); +$query = $Db->query($sql, [$Page]); ob_start(); print '