issue: resolve author logins to full names
[minimedit.git] / issue / index.php
index 835f1f0ec14bec32682cee4f72dc2adaae865baf..6e13b13c99e7a54c84524f404f3c7daa4849a174 100644 (file)
@@ -7,18 +7,24 @@ if ($id) {
        $Article->title = "Issue #$id";
 
        $Issue = $Db->query(
-               'SELECT * FROM issues WHERE id = ?', [$id]
+               'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page, $id]
        )->fetch();
        if (!$Issue) throw new Exception('Issuenummer niet gevonden');
 
        $Article->title .= ': '.htmlspecialchars($Issue->subject);
        print "<h2>{$Article->title}</h2>\n";
        print $Issue->body;
+       $author = $Issue->author ? new User('profile/'.$Issue->author, FALSE) : NULL;
        printf('<p><em>%s</em>%s <small class=date>%s</small></p>'."\n",
                'Geplaatst',
-               $Issue->author ? " door <strong>{$Issue->author}</strong>" : '',
+               $author ? " door <strong>{$author->name}</strong>" : '',
                showdate(preg_split('/\D/', $Issue->created))
        );
+       if ($Issue->assign) {
+               printf('<p><em>%s</em> aan <strong>%s</strong></p>'."\n",
+                       'Toegewezen', htmlspecialchars($Issue->assign)
+               );
+       }
        if ($Issue->closed) {
                printf('<p><em>%s</em>%s <small class=date>%s</small></p>'."\n",
                        'Opgelost', '',
@@ -45,12 +51,12 @@ if ($_POST) {
                $_POST = [];
 }
 
-$sql = 'SELECT * FROM issues';
+$sql = 'SELECT * FROM issues WHERE page = ?';
 if (isset($_GET['open'])) {
-       $sql .= ' WHERE closed IS NULL';
+       $sql .= ' AND closed IS NULL';
 }
 $sql .= ' ORDER BY closed IS NOT NULL, updated DESC';
-$query = $Db->query($sql);
+$query = $Db->query($sql, [$Page]);
 
 ob_start();
 print '<ul>';