aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-04-17 07:45:20 +0000
committerMario <mario@mariovavti.com>2024-04-17 07:45:20 +0000
commit2e15207d0bdbe147f9d1f21030f4c36b02c3dedf (patch)
tree4bde0c01f0948b05be5cb4eae44fab1a3f41fdf8
parent716013633ecb09b1c8fd950275f0cbf272b1fe43 (diff)
downloadvolse-hubzilla-2e15207d0bdbe147f9d1f21030f4c36b02c3dedf.tar.gz
volse-hubzilla-2e15207d0bdbe147f9d1f21030f4c36b02c3dedf.tar.bz2
volse-hubzilla-2e15207d0bdbe147f9d1f21030f4c36b02c3dedf.zip
fix spacing issues in mod wall_attach and make save_chunk() deal with userfile and file array keys
-rw-r--r--Zotlabs/Module/Wall_attach.php14
-rw-r--r--include/api_zot.php3
-rw-r--r--include/attach.php14
3 files changed, 19 insertions, 12 deletions
diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php
index 0d5c9e983..3c57d4b94 100644
--- a/Zotlabs/Module/Wall_attach.php
+++ b/Zotlabs/Module/Wall_attach.php
@@ -104,32 +104,32 @@ class Wall_attach extends \Zotlabs\Web\Controller {
}
if(intval($r['data']['is_photo'])) {
- $s = "\n\n" . $r['body'] . "\n\n";
+ $s = $r['body'];
}
else {
- if(strpos($r['data']['filetype'],'video') === 0) {
+ if(strpos($r['data']['filetype'], 'video') === 0) {
// give a wee bit of time for the background thumbnail processor to do its thing
// or else we'll never see a video poster
sleep(3);
$url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
$thumb = Linkinfo::get_video_poster($url);
if($thumb) {
- $s = "\n\n" . '[zvideo poster=\'' . $thumb . '\']' . $url . '[/zvideo]' . "\n\n";
+ $s = '[zvideo poster=\'' . $thumb . '\']' . $url . '[/zvideo]';
}
else {
- $s = "\n\n" . '[zvideo]' . $url . '[/zvideo]' . "\n\n";
+ $s = '[zvideo]' . $url . '[/zvideo]';
}
}
if(strpos($r['data']['filetype'],'audio') === 0) {
$url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
- $s = "\n\n" . '[zaudio]' . $url . '[/zaudio]' . "\n\n";
+ $s = '[zaudio]' . $url . '[/zaudio]';
}
if ($r['data']['filetype'] === 'image/svg+xml') {
$x = @file_get_contents('store/' . $channel['channel_address'] . '/' . $r['data']['os_path']);
if ($x) {
$bb = svg2bb($x);
if ($bb) {
- $s .= "\n\n" . $bb;
+ $s .= $bb;
}
else {
logger('empty return from svgbb');
@@ -140,7 +140,7 @@ class Wall_attach extends \Zotlabs\Web\Controller {
}
}
- $s .= "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n";
+ $s .= '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]';
}
$sync = attach_export_data($channel,$r['data']['hash']);
diff --git a/include/api_zot.php b/include/api_zot.php
index 22692b962..56cec005d 100644
--- a/include/api_zot.php
+++ b/include/api_zot.php
@@ -546,6 +546,7 @@
return false;
}
+
logger('api_red_item_store: REQUEST ' . print_r($_REQUEST,true));
logger('api_red_item_store: FILES ' . print_r($_FILES,true));
@@ -561,7 +562,7 @@
$mod = new Zotlabs\Module\Wall_attach();
$media = $mod->post();
if($media)
- $_REQUEST['body'] = $media . "\n\n" . $_REQUEST['body'];
+ $_REQUEST['body'] = $media . "\n" . $_REQUEST['body'];
}
$mod = new Zotlabs\Module\Item();
diff --git a/include/attach.php b/include/attach.php
index efefc73a4..2283da1c6 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -2982,11 +2982,17 @@ function save_chunk($channel,$start,$end,$len) {
$result = [];
- $tmp_path = $_FILES['files']['tmp_name'];
+ $file = $_FILES['files'] ?? $_FILES['userfile'] ?? [];
+
+ if (!$file) {
+ return $result;
+ }
+
+ $tmp_path = $file['tmp_name'];
$new_base = 'store/[data]/' . $channel['channel_address'] . '/tmp';
os_mkdir($new_base,STORAGE_DEFAULT_PERMISSIONS,true);
- $new_path = $new_base . '/' . $_FILES['files']['name'];
+ $new_path = $new_base . '/' . $file['name'];
if(file_exists($new_path) && intval($start) === 0) {
$result['partial'] = true;
@@ -3008,8 +3014,8 @@ function save_chunk($channel,$start,$end,$len) {
}
if(($len - 1) == $end) {
unlink($tmp_path);
- $result['name'] = $_FILES['files']['name'];
- $result['type'] = $_FILES['files']['type'];
+ $result['name'] = $file['name'];
+ $result['type'] = $file['type'];
$result['tmp_name'] = $new_path;
$result['error'] = 0;
$result['size'] = $len;