X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/7f191935501429b51d0b220ba32eda8b3a747655..6793210f7eeaadd0c0906173846a1b87d8fb0754:/issue/index.php diff --git a/issue/index.php b/issue/index.php index 3d62ced..419156f 100644 --- a/issue/index.php +++ b/issue/index.php @@ -1,24 +1,37 @@ 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; - if ($row->closed) { - printf('

%s %s

'."\n", - 'Opgelost', showdate(preg_split('/\D/', $row->closed)) + print $Issue->body; + $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)) + ); + 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/', $Issue->closed)) ); } + $Args = "/$id"; # minimal reference print placeholder_include('reply'); return; } @@ -26,7 +39,7 @@ if ($id) { if ($_POST) { $html = nl2br(htmlspecialchars($_POST['body'])); $html = empty($html) ? NULL : "

$html

"; - $query = $Db->insert('issues', [ + $query = $Db->set('issues', [ 'page' => $Page, 'subject' => $_POST['subject'], 'body' => $html, @@ -38,16 +51,22 @@ if ($_POST) { $_POST = []; } -$query = $Db->query('SELECT * FROM issues ORDER BY created DESC'); +$sql = 'SELECT * FROM issues 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]); ob_start(); print '