<?php
-global $User, $Db;
+global $User, $Db, $Issue;
require_once 'database.inc.php';
@list ($id, $title) = explode('/', ltrim($Page->path, '/'));
$Page->title .= ': '.htmlspecialchars($Issue->subject);
$Page->teaser = $Issue->body;
- if ($Page->api) return;
$Page->body = $replies; # find image
+ if ($Page->api) return;
print "<h2>{$Page->title}</h2>\n";
print '<aside class="metadata"><dl>'."\n";
return;
}
-if ($_POST) {
+if ($Page->api) return;
+if ($_POST and isset($_POST['subject'])) {
require_once 'upload.inc.php';
+ if (strlen($_POST['subject']) < 2) {
+ throw new Exception('Een minimaal onderwerp is verplicht om een issue aan te maken.');
+ }
$query = $Db->set('issues', [
'page' => $Page->handler,
'subject' => $_POST['subject'],
}
$_POST = [];
}
-if ($Page->api) return;
$subsql = "SELECT count(*) FROM comments WHERE page=i.page||'/'||i.id";
$cols = "*, ($subsql AND message IS NOT NULL) AS replycount";