if ($id and ctype_digit($id)) {
$Page->title = "Issue #$id";
- $Page->path = "/$id"; # minimal reference
+ $Page->link = $Page->handler . ($Page->path = "/$id"); # minimal reference
$Issue = $Db->query(
'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page->handler, $id]
)->fetch();
}
function trackupload(input) {
+ if (!input.value) {
+ return true; // default form action
+ }
+
var progress = document.getElementById('progress');
if (!progress) {
progress = document.createElement('DIV');
if (e.target.status == 200) {
progress.textContent = 'voltooid';
progress.innerHTML += ' <small>(' + showsize(input.files[0].size) + ' MB)</small>';
- input.value = '';
+ window.location.assign(e.target.response);
}
else {
progress.textContent = 'fout';
cancel.onclick = function () { ajax.abort() };
cancel.style.float = 'left';
input.parentNode.insertBefore(cancel, progress.parentNode);
+ return false;
}
document.addEventListener('DOMContentLoaded', e => {
for (let row of document.forms[0].elements) {
if (row.type == 'file') {
row.form.onsubmit = () => {
- trackupload(row);
- return false;
+ return trackupload(row);
};
}
}
}
}
- if ($Page->api) {
- abort("/{$Page->link}", '200 reply success');
- }
+ $target = "/{$Page->link}/$newcomment#$newcomment";
+ abort($target, ($Page->api ? 200 : 303) . ' reply success');
$_POST['reply'] = NULL;
}
catch (Exception $e) {
while ($row = $query->fetch()) {
$rowuser = new User("profile/{$row->author}");
- print '<li>';
+ printf('<li id="%d">', $row->id);
printf('<strong>%s</strong> <small class=date>%s</small>',
$rowuser->html, showdate(preg_split('/\D/', $row->created))
);