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";
10 'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page, $id]
12 if (!$Issue) throw new Exception('Issuenummer niet gevonden');
14 $Article->title .= ': '.htmlspecialchars($Issue->subject);
15 print "<h2>{$Article->title}</h2>\n";
16 $author = $Issue->author ? new User('profile/'.$Issue->author, FALSE) : NULL;
17 printf('<p><em>%s</em>%s <small class=date>%s</small></p>'."\n",
19 $author ? " door <strong>{$author->name}</strong>" : '',
20 showdate(preg_split('/\D/', $Issue->created))
23 printf('<p><em>%s</em> aan <strong>%s</strong></p>'."\n",
24 'Toegewezen', htmlspecialchars($Issue->assign)
28 printf('<p><em>%s</em>%s <small class=date>%s</small></p>'."\n",
30 showdate(preg_split('/\D/', $Issue->closed))
34 $Args = "/$id"; # minimal reference
35 print placeholder_include('reply');
40 $html = nl2br(htmlspecialchars($_POST['body']));
41 $html = empty($html) ? NULL : "<p>$html</p>";
42 $query = $Db->set('issues', [
44 'subject' => $_POST['subject'],
46 'author' => $User->login,
48 if (!$query->rowCount()) {
49 throw new Exception('Issue niet opgeslagen.');
54 $cols = "*, (SELECT count(*) FROM comments WHERE"
55 . " page=i.page||'/'||i.id AND message IS NOT NULL) AS replycount";
56 $sql = "SELECT $cols FROM issues i WHERE page = ?";
57 if (isset($_GET['open'])) {
58 $sql .= ' AND closed IS NULL';
60 $sql .= ' ORDER BY closed IS NOT NULL, updated DESC';
61 $query = $Db->query($sql, [$Page]);
64 require 'issue/feed.inc.php';
69 while ($row = $query->fetch()) {
70 printf('<li><a href="%s">%s <small class="date">%s</small>%s</a>',
71 "/$Page/{$row->id}/{$row->link}",
72 sprintf($row->closed ? '<strike>%s</strike>' : '%s',
73 htmlspecialchars($row->subject)),
74 showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3)),
76 $row->replycount ? sprintf('<span class=right>+%d</span>', $row->replycount) : '',
77 isset($row->assign) ? ' <em class="right">'.$row->assign.'</em>' : '',
83 $Place['issuelist'] = ob_get_clean();