X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/084f4a795fb5874eecd7b17b3999f716432ad41c..483761be2d405d4a69c005bd407f12e6d81445b1:/issue/index.php diff --git a/issue/index.php b/issue/index.php index 10efc5e..f950861 100644 --- a/issue/index.php +++ b/issue/index.php @@ -6,25 +6,31 @@ require_once 'database.inc.php'; if ($id) { $Article->title = "Issue #$id"; - $row = $Db->query( - 'SELECT * FROM issues WHERE id = ?', [$id] + $Issue = $Db->query( + 'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page, $id] )->fetch(); - if (!$row) throw new Exception('Issuenummer niet gevonden'); + if (!$Issue) throw new Exception('Issuenummer niet gevonden'); - $Article->title .= ': '.htmlspecialchars($row->subject); + $Article->title .= ': '.htmlspecialchars($Issue->subject); print "

{$Article->title}

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

%s%s %s

'."\n", 'Geplaatst', - $row->author ? " door {$row->author}" : '', - showdate(preg_split('/\D/', $row->created)) + $author ? " door {$author->name}" : '', + showdate(preg_split('/\D/', $Issue->created)) ); - if ($row->closed) { + if ($Issue->assign) { + printf('

%s aan %s

'."\n", + 'Toegewezen', htmlspecialchars($Issue->assign) + ); + } + if ($Issue->closed) { printf('

%s%s %s

'."\n", 'Opgelost', '', - showdate(preg_split('/\D/', $row->closed)) + showdate(preg_split('/\D/', $Issue->closed)) ); } + print $Issue->body; $Args = "/$id"; # minimal reference print placeholder_include('reply'); return; @@ -45,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 '