X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/621fc2f9638a1a92aa8535310e7852de5542f11e..d9e768059d2a10c2c5eb5b908a998fb496b4e4cf:/widget/reply.php?ds=inline
diff --git a/widget/reply.php b/widget/reply.php
index edffaa7..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,11 +18,18 @@ if ($_POST) {
}
$target .= '/' . $User->login;
if ($result = userupload($_FILES['image'], $target)) {
- $html .= sprintf('
![](/thumb/640x/%s)
', $result);
+ if (preg_match('(^image/)', $_FILES['image']['type'])) {
+ $html .= sprintf('![](/thumb/640x/%s)
', $result);
+ }
+ else {
+ $html .= sprintf('Bijgevoegd bestand: %s
',
+ $result, basename($result)
+ );
+ }
}
}
$query = $Db->set('comments', [
- 'page' => $Page,
+ 'page' => $Page->link,
'message' => $html,
'author' => $User->login,
]);
@@ -60,21 +68,27 @@ 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";
}
}
$cols = '*, (SELECT json_agg(journal.*) FROM journal WHERE comment_id = comments.id) AS journal';
-$query = $Db->query("SELECT $cols FROM comments WHERE page = ? ORDER BY created", [$Page]);
+$query = $Db->query("SELECT $cols FROM comments WHERE page = ? ORDER BY created", [$Page->link]);
print '';
while ($row = $query->fetch()) {
$rowuser = new User("profile/{$row->author}");
- print '- ';
+ printf('
- ', $row->id);
printf('%s %s',
$rowuser->html, showdate(preg_split('/\D/', $row->created))
);
@@ -90,7 +104,7 @@ while ($row = $query->fetch()) {
printf("%s %s",
$journalcol[$change->col], sprintf(
!isset($change->old_value) ? 'gewijzigd naar
%2$s
' :
- (!isset($change->value) ? 'verwijderd (%s)' :
+ (!isset($change->value) ? 'verwijderd (%s)' :
'gewijzigd van %s
naar %s
'),
$change->old_value, $change->value
)
@@ -106,7 +120,7 @@ while ($row = $query->fetch()) {
if ($User->login) {
print ' - ';
print '
\n";
+ print "";
+ print '';
+ print "\n";
}
print "
\n\n";