diff options
author | mrjive <mrjive@mrjive.it> | 2015-11-11 16:51:48 +0100 |
---|---|---|
committer | mrjive <mrjive@mrjive.it> | 2015-11-11 16:51:48 +0100 |
commit | 53a796afcc0cff6f9e3f51457df4506a43db1945 (patch) | |
tree | a2366c48e0dae047b052283cc44284224369c8cd /include/attach.php | |
parent | a4c3058f845a1c38d06b2201a10700c5f878366d (diff) | |
parent | bc7c0ed844711e81c4bc642e3024849195a48421 (diff) | |
download | volse-hubzilla-53a796afcc0cff6f9e3f51457df4506a43db1945.tar.gz volse-hubzilla-53a796afcc0cff6f9e3f51457df4506a43db1945.tar.bz2 volse-hubzilla-53a796afcc0cff6f9e3f51457df4506a43db1945.zip |
Merge pull request #8 from redmatrix/master
get fresh code from HZ base
Diffstat (limited to 'include/attach.php')
-rw-r--r-- | include/attach.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/include/attach.php b/include/attach.php index f5d2c69b6..36b971712 100644 --- a/include/attach.php +++ b/include/attach.php @@ -64,7 +64,10 @@ function z_mime_content_type($filename) { 'wav' => 'audio/wav', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', - 'ogg' => 'application/ogg', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'flac' => 'audio/flac', 'opus' => 'audio/ogg', 'webm' => 'video/webm', // 'webm' => 'audio/webm', @@ -105,9 +108,9 @@ function z_mime_content_type($filename) { 'oth' => 'application/vnd.oasis.opendocument.text-web' ); - $dot = strpos($filename, '.'); - if ($dot !== false) { - $ext = strtolower(substr($filename, $dot + 1)); + $last_dot = strrpos($filename, '.'); + if ($last_dot !== false) { + $ext = strtolower(substr($filename, $last_dot + 1)); if (array_key_exists($ext, $mime_types)) { return $mime_types[$ext]; } @@ -719,7 +722,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { intval($filesize), intval(1), intval($is_photo), - dbesc($os_relpath), + dbesc($os_basepath . $os_relpath), dbesc($created), intval($existing_id), intval($channel_id) @@ -739,7 +742,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { intval($x[0]['revision'] + 1), intval(1), intval($is_photo), - dbesc($os_relpath), + dbesc($os_basepath . $os_relpath), dbesc($created), dbesc($created), dbesc($x[0]['allow_cid']), @@ -780,7 +783,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { intval(0), intval(1), intval($is_photo), - dbesc($os_relpath), + dbesc($os_basepath . $os_relpath), dbesc($created), dbesc($created), dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : $str_contact_allow), @@ -1267,9 +1270,13 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { ); if($y) { - $f = 'store/' . $channel_address . '/' . $y[0]['data']; - if(is_dir($y[0]['data'])) - @rmdir($y[0]['data']); + if(strpos($y[0]['data'],'store') === false) + $f = 'store/' . $channel_address . '/' . $y[0]['data']; + else + $f = $y[0]['data']; + + if(is_dir($f)) + @rmdir($f); elseif(file_exists($f)) unlink($f); } |