X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/f547127c637332119b42329ca78d0e1a659d9739..d9e768059d2a10c2c5eb5b908a998fb496b4e4cf:/widget/reply.php diff --git a/widget/reply.php b/widget/reply.php index d305fc7..0a0e4e5 100644 --- a/widget/reply.php +++ b/widget/reply.php @@ -4,6 +4,7 @@ require_once 'database.inc.php'; $journalcol = [ 'assign' => 'Toegewezen aan', + 'subject' => 'Onderwerp', ]; if ($_POST) { @@ -17,7 +18,14 @@ if ($_POST) { } $target .= '/' . $User->login; if ($result = userupload($_FILES['image'], $target)) { - $html .= sprintf('

', $result); + if (preg_match('(^image/)', $_FILES['image']['type'])) { + $html .= sprintf('

', $result); + } + else { + $html .= sprintf('

Bijgevoegd bestand: %s

', + $result, basename($result) + ); + } } } $query = $Db->set('comments', [ @@ -60,9 +68,15 @@ if ($_POST) { $Issue = $updated; } } + + $target = "/{$Page->link}/$newcomment#$newcomment"; + abort($target, ($Page->api ? 200 : 303) . ' reply success'); $_POST['reply'] = NULL; } catch (Exception $e) { + if ($Page->api) { + abort(ucfirst($e->getMessage()), '500 reply error'); + } print "

Antwoord niet opgeslagen: {$e->getMessage()}.

\n\n"; } } @@ -74,7 +88,7 @@ print '\n\n";