X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/5adffaba1226d6a75a1937e1ef836f34c991f7fd..6b1d603f5f5265dcfaf005b9c45cc6aaac2f0bc6:/issue/index.php diff --git a/issue/index.php b/issue/index.php index 835f1f0..b34da6d 100644 --- a/issue/index.php +++ b/issue/index.php @@ -3,40 +3,46 @@ global $User, $Db; require_once 'database.inc.php'; @list ($id, $title) = explode('/', ltrim($Args, '/')); -if ($id) { +if ($id and ctype_digit($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 "

{$Article->title}

\n"; - print $Issue->body; - printf('

%s%s %s

'."\n", - 'Geplaatst', - $Issue->author ? " door {$Issue->author}" : '', - showdate(preg_split('/\D/', $Issue->created)) - ); + print "
\n"; + print '
Geplaatst
'; + printf('
%s
'."\n", showdate(preg_split('/\D/', $Issue->created))); + if ($Issue->author and $author = new User('profile/'.$Issue->author, FALSE)) { + printf('
%s
'."\n", $author->html); + } + if ($Issue->assign) { + print '
Toegewezen aan
'; + printf('
%s
'."\n", htmlspecialchars($Issue->assign)); + } if ($Issue->closed) { - printf('

%s%s %s

'."\n", - 'Opgelost', '', - showdate(preg_split('/\D/', $Issue->closed)) - ); + print '
Opgelost
'; + printf('
%s
'."\n", showdate(preg_split('/\D/', $Issue->closed))); } + print "
\n\n"; + + print '
'; + print $Issue->body; $Args = "/$id"; # minimal reference print placeholder_include('reply'); + print "
\n"; return; } if ($_POST) { - $html = nl2br(htmlspecialchars($_POST['body'])); - $html = empty($html) ? NULL : "

$html

"; + require_once 'upload.inc.php'; $query = $Db->set('issues', [ 'page' => $Page, 'subject' => $_POST['subject'], - 'body' => $html, + 'body' => messagehtml($_POST['body']), 'author' => $User->login, ]); if (!$query->rowCount()) { @@ -45,21 +51,32 @@ if ($_POST) { $_POST = []; } -$sql = 'SELECT * FROM issues'; +$cols = "*, (SELECT count(*) FROM comments WHERE" + . " page=i.page||'/'||i.id AND message IS NOT NULL) AS replycount"; +$sql = "SELECT $cols FROM issues i 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]); + +if ($id == 'feed') { + require 'issue/feed.inc.php'; +} ob_start(); print '