<?php
global $User, $Db;
require_once 'database.inc.php';
-$id = trim($Args, '/');
+@list ($id, $title) = explode('/', ltrim($Args, '/'));
if ($id) {
$Article->title = "Issue #$id";
$Article->title .= ': '.htmlspecialchars($row->subject);
print "<h2>{$Article->title}</h2>\n";
print $row->body;
+ printf('<p><em>%s</em>%s <small class=date>%s</small></p>'."\n",
+ 'Geplaatst',
+ $row->author ? " door <strong>{$row->author}</strong>" : '',
+ showdate(preg_split('/\D/', $row->created))
+ );
if ($row->closed) {
- printf('<p><strong>%s</strong> <small class=date>%s</small></p>'."\n",
- 'Opgelost', showdate(preg_split('/\D/', $row->closed))
+ printf('<p><em>%s</em>%s <small class=date>%s</small></p>'."\n",
+ 'Opgelost', '',
+ showdate(preg_split('/\D/', $row->closed))
);
}
+ $Args = "/$id"; # minimal reference
print placeholder_include('reply');
return;
}
if ($_POST) {
$html = nl2br(htmlspecialchars($_POST['body']));
$html = empty($html) ? NULL : "<p>$html</p>";
- $query = $Db->insert('issues', [
+ $query = $Db->set('issues', [
'page' => $Page,
'subject' => $_POST['subject'],
'body' => $html,
$_POST = [];
}
-$query = $Db->query('SELECT * FROM issues ORDER BY created DESC');
+$sql = 'SELECT * FROM issues';
+if (isset($_GET['open'])) {
+ $sql .= ' WHERE closed IS NULL';
+}
+$sql .= ' ORDER BY closed IS NOT NULL, updated DESC';
+$query = $Db->query($sql);
ob_start();
print '<ul>';
while ($row = $query->fetch()) {
printf('<li><a href="%s">%s <small class="date">%s</small></a>',
- "/$Page/{$row->id}",
+ "/$Page/{$row->id}/{$row->link}",
sprintf($row->closed ? '<strike>%s</strike>' : '%s',
htmlspecialchars($row->subject)),
- showdate(array_slice(preg_split('/\D/', $row->created), 0, 3))
+ showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3))
);
print "</li>\n";
}