X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/2aeb3486d5598fec6a6b58c37abead5a829678ad..621fc2f9638a1a92aa8535310e7852de5542f11e:/widget/reply.php diff --git a/widget/reply.php b/widget/reply.php index 53fe34f..edffaa7 100644 --- a/widget/reply.php +++ b/widget/reply.php @@ -7,9 +7,19 @@ $journalcol = [ ]; if ($_POST) { + require_once 'upload.inc.php'; try { - $html = nl2br(htmlspecialchars($_POST['reply'])); - $html = "

$html

"; + $html = messagehtml($_POST['reply']); + if ($_FILES and !empty($_FILES['image'])) { + $target = 'data/upload'; + if (!file_exists($target)) { + throw new Exception("er is geen uploadmap aanwezig op $target"); + } + $target .= '/' . $User->login; + if ($result = userupload($_FILES['image'], $target)) { + $html .= sprintf('

', $result); + } + } $query = $Db->set('comments', [ 'page' => $Page, 'message' => $html, @@ -47,6 +57,7 @@ if ($_POST) { 'value' => $updated->$col, ]); } + $Issue = $updated; } } $_POST['reply'] = NULL; @@ -67,7 +78,7 @@ while ($row = $query->fetch()) { printf('%s %s', $rowuser->html, showdate(preg_split('/\D/', $row->created)) ); - printf("
%s
\n", $row->message); + printf("
\n%s
\n", $row->message); if ($changes = json_decode($row->journal)) { print '