git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d780bb7
)
reply: accept image uploads with messages
author
Mischa POSLAWSKY
<perl@shiar.org>
Sun, 5 Jan 2020 21:21:25 +0000
(22:21 +0100)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 9 Jan 2020 10:31:55 +0000
(11:31 +0100)
widget/reply.php
patch
|
blob
|
history
diff --git
a/widget/reply.php
b/widget/reply.php
index 9e1c7e33757337ebb4d63858cf833e0f22565d10..cedcc4919699194fe60926bf5a67adf316dfa38c 100644
(file)
--- a/
widget/reply.php
+++ b/
widget/reply.php
@@
-9,9
+9,19
@@
$journalcol = [
if ($_POST) {
require_once 'upload.inc.php';
try {
if ($_POST) {
require_once 'upload.inc.php';
try {
+ $html = messagehtml($_POST['reply']);
+ if ($_FILES and isset($_FILES['image'])) {
+ $target = 'data/upload';
+ if (!file_exists($target)) {
+ throw new Exception("er is geen uploadmap aanwezig op $target");
+ }
+ $target .= '/' . $User->login;
+ $result = userupload($_FILES['image'], $target);
+ $html .= sprintf('<p><img src="/thumb/640x/%s" /></p>', $result);
+ }
$query = $Db->set('comments', [
'page' => $Page,
$query = $Db->set('comments', [
'page' => $Page,
- 'message' =>
messagehtml($_POST['reply'])
,
+ 'message' =>
$html
,
'author' => $User->login,
]);
if (!$query->rowCount()) {
'author' => $User->login,
]);
if (!$query->rowCount()) {
@@
-94,7
+104,7
@@
while ($row = $query->fetch()) {
if ($User) {
print '<li>';
if ($User) {
print '<li>';
- print '<form method="post" action="">';
+ print '<form method="post" action=""
enctype="multipart/form-data"
>';
if (isset($Issue) and $User->admin("edit $Page")) {
print '<p>';
printf(
if (isset($Issue) and $User->admin("edit $Page")) {
print '<p>';
printf(
@@
-115,6
+125,13
@@
if ($User) {
);
print "</p>\n";
}
);
print "</p>\n";
}
+ if (isset($Issue)) {
+ printf(
+ '<p><label for="%s">%s:</label> '
+ . '<input id="%1$s" name="%1$s" value=""%s /></p>'."\n",
+ 'image', 'Beeldmateriaal', ' type="file" accept="image/*"'
+ );
+ }
printf('<textarea id="%s" name="%1$s" cols=60 rows=3 placeholder="%s">%s</textarea>'."\n",
'reply',
"Bericht van {$User->login}",
printf('<textarea id="%s" name="%1$s" cols=60 rows=3 placeholder="%s">%s</textarea>'."\n",
'reply',
"Bericht van {$User->login}",