3 require_once 'database.inc.php';
4 @list ($id, $title) = explode('/', ltrim($Args, '/'));
6 if ($id and ctype_digit($id)) {
7 $Article->title = "Issue #$id";
8 $Args = "/$id"; # minimal reference
10 'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page, $id]
12 if (!$Issue) throw new Exception('Issuenummer niet gevonden');
14 $replies = placeholder_include('reply'); # handle updates
16 $Article->title .= ': '.htmlspecialchars($Issue->subject);
17 print "<h2>{$Article->title}</h2>\n";
18 print "<dl class=\"aside right sidebar\">\n";
19 print '<dt>Geplaatst</dt>';
20 printf('<dd>%s</dd>'."\n", showdate(preg_split('/\D/', $Issue->created)));
21 if ($Issue->author and $author = new User('profile/'.$Issue->author, FALSE)) {
22 printf('<dd>%s</dd>'."\n", $author->html);
25 print '<dt>Toegewezen aan</dt>';
26 printf('<dd>%s</dd>'."\n", htmlspecialchars($Issue->assign));
29 print '<dt>Opgelost</dt>';
30 printf('<dd>%s</dd>'."\n", showdate(preg_split('/\D/', $Issue->closed)));
42 require_once 'upload.inc.php';
43 $query = $Db->set('issues', [
45 'subject' => $_POST['subject'],
46 'body' => messagehtml($_POST['body']),
47 'author' => $User->login,
49 if (!$query->rowCount()) {
50 throw new Exception('Issue niet opgeslagen.');
55 $subsql = "SELECT count(*) FROM comments WHERE page=i.page||'/'||i.id";
56 $cols = "*, ($subsql AND message IS NOT NULL) AS replycount";
57 $cols .= ", ($subsql AND message ~ 'img') AS imagecount";
58 $sql = "SELECT $cols FROM issues i WHERE page = ?";
59 if (isset($_GET['open'])) {
60 $sql .= ' AND closed IS NULL';
62 $sql .= ' ORDER BY closed IS NOT NULL, updated DESC';
63 $query = $Db->query($sql, [$Page]);
66 require 'issue/feed.inc.php';
71 while ($row = $query->fetch()) {
72 printf('<li%s><div><a href="%s">',
73 $row->closed ? ' class="disabled"' : '',
74 "/$Page/{$row->id}/{$row->link}"
76 printf($row->closed ? '<s>%s</s>' : '%s', htmlspecialchars($row->subject));
78 printf(' <small class="date">%s</small>',
79 showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3))
82 if ($row->imagecount) {
83 print ' <span class="right icon icon-camera" title="afbeeldingen">📷</span>';
85 if ($row->replycount) {
86 printf(' <span class=right>%s %d</span>',
87 '<span class="icon icon-comment" title="reacties">🗨</span>',
91 if (isset($row->assign)) {
92 print ' <em class="right">'.$row->assign.'</em>';
94 print "</a></div></li>\n";
97 $Place['issuelist'] = ob_get_clean();