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 $Article->teaser = $Issue->body;
18 $Article->body = $replies; # find image
20 print "<h2>{$Article->title}</h2>\n";
21 print '<aside class="metadata"><dl>'."\n";
22 print '<dt>Geplaatst</dt>';
23 printf('<dd>%s</dd>'."\n", showdate(preg_split('/\D/', $Issue->created)));
24 if ($Issue->author and $author = new User('profile/'.$Issue->author, FALSE)) {
25 printf('<dd>%s</dd>'."\n", $author->html);
28 print '<dt>Toegewezen aan</dt>';
29 printf('<dd>%s</dd>'."\n", htmlspecialchars($Issue->assign));
32 print '<dt>Opgelost</dt>';
33 printf('<dd>%s</dd>'."\n", showdate(preg_split('/\D/', $Issue->closed)));
35 print "</dl></aside>\n\n";
45 require_once 'upload.inc.php';
46 $query = $Db->set('issues', [
48 'subject' => $_POST['subject'],
49 'body' => messagehtml($_POST['body']),
50 'author' => $User->login,
52 if (!$query->rowCount()) {
53 throw new Exception('Issue niet opgeslagen.');
58 $subsql = "SELECT count(*) FROM comments WHERE page=i.page||'/'||i.id";
59 $cols = "*, ($subsql AND message IS NOT NULL) AS replycount";
60 $cols .= ", ($subsql AND message ~ '<img') AS imagecount";
61 $sql = "SELECT $cols FROM issues i WHERE page = ?";
62 if (isset($_GET['open'])) {
63 $sql .= ' AND closed IS NULL';
65 $sql .= ' ORDER BY closed IS NOT NULL, updated DESC';
66 $query = $Db->query($sql, [$Page]);
69 require 'issue/feed.inc.php';
74 while ($row = $query->fetch()) {
75 printf('<li%s><div><a href="%s">',
76 $row->closed ? ' class="disabled"' : '',
77 "/$Page/{$row->id}/{$row->link}"
79 printf($row->closed ? '<s>%s</s>' : '%s', htmlspecialchars($row->subject));
81 printf(' <small class="date">%s</small>',
82 showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3))
85 if ($row->replycount) {
86 printf(' <span class=right>%s %d</span>',
87 '<span class="icon icon-comment" title="reacties">🗨</span>',
91 if ($row->imagecount) {
92 print ' <span class="right icon icon-camera" title="afbeeldingen">📷</span>';
94 if (isset($row->assign)) {
95 print ' <em class="right">'.$row->assign.'</em>';
97 print "</a></div></li>\n";
100 $Place['issuelist'] = ob_get_clean();