diff options
Diffstat (limited to 'include/attach.php')
-rw-r--r-- | include/attach.php | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/include/attach.php b/include/attach.php index f95feed2d..1bba88c63 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]; } @@ -815,6 +818,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { if($arr['item']) $args['item'] = $arr['item']; + if($arr['body']) + $args['body'] = $arr['body']; + + if($arr['description']) + $args['description'] = $arr['description']; + $p = photo_upload($channel,$observer,$args); if($p['success']) { $ret['body'] = $p['body']; @@ -1282,12 +1291,11 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { ); if($x) { drop_item($x[0]['id'],false,(($x[0]['item_hidden']) ? DROPITEM_NORMAL : DROPITEM_PHASE1),true); - - q("DELETE FROM photo WHERE uid = %d AND resource_id = '%s'", - intval($channel_id), - dbesc($resource) - ); } + q("DELETE FROM photo WHERE uid = %d AND resource_id = '%s'", + intval($channel_id), + dbesc($resource) + ); } // update the parent folder's lastmodified timestamp |