fix duplicate attachment and regression with audio file upload
(cherry picked from commit 4cfb965881df2be181aab6020c9df78c0a86fd9f)
This commit is contained in:
parent
64c6e25896
commit
873b20677e
@ -817,11 +817,6 @@ class Item extends Controller {
|
|||||||
'revision' => $r['data']['revision']
|
'revision' => $r['data']['revision']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$ext = substr($r['data']['filename'],strrpos($r['data']['filename'],'.'));
|
|
||||||
if(strpos($r['data']['filetype'],'audio/') !== false)
|
|
||||||
$attach_link = '[audio]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/audio]';
|
|
||||||
elseif(strpos($r['data']['filetype'],'video/') !== false)
|
|
||||||
$attach_link = '[video]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/video]';
|
|
||||||
$body = str_replace($match[1][$i],$attach_link,$body);
|
$body = str_replace($match[1][$i],$attach_link,$body);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class Wall_attach extends \Zotlabs\Web\Controller {
|
|||||||
$def_attach = get_pconfig($channel['channel_id'],'system','attach_path');
|
$def_attach = get_pconfig($channel['channel_id'],'system','attach_path');
|
||||||
|
|
||||||
$r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),'', array('source' => 'editor', 'visible' => 0, 'album' => $def_album, 'directory' => $def_attach, 'allow_cid' => '<' . $channel['channel_hash'] . '>'));
|
$r = attach_store($channel,(($observer) ? $observer['xchan_hash'] : ''),'', array('source' => 'editor', 'visible' => 0, 'album' => $def_album, 'directory' => $def_attach, 'allow_cid' => '<' . $channel['channel_hash'] . '>'));
|
||||||
|
|
||||||
if(! $r['success']) {
|
if(! $r['success']) {
|
||||||
notice( $r['message'] . EOL);
|
notice( $r['message'] . EOL);
|
||||||
killme();
|
killme();
|
||||||
@ -111,7 +111,7 @@ class Wall_attach extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
if(strpos($r['data']['filetype'],'audio') === 0) {
|
if(strpos($r['data']['filetype'],'audio') === 0) {
|
||||||
$url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
|
$url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
|
||||||
echo "\n\n" . '[zaudio]' . $url . '[/zaudio]' . "\n\n";
|
$s = "\n\n" . '[zaudio]' . $url . '[/zaudio]' . "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$s .= "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n";
|
$s .= "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n";
|
||||||
|
Reference in New Issue
Block a user