Skip to content

Commit

Permalink
Remove preview config option for audio formats
Browse files Browse the repository at this point in the history
Fixes #26095
  • Loading branch information
vboctor committed Oct 17, 2019
1 parent 094f536 commit 34af70d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
9 changes: 0 additions & 9 deletions config_defaults_inc.php
Expand Up @@ -2307,14 +2307,6 @@
'bmp', 'png', 'gif', 'jpg', 'jpeg'
);

/**
* Extensions for audio files that can be played inline.
* @global array $g_preview_audio_extensions
*/
$g_preview_audio_extensions = array(
'mp3', 'wav', 'ogg'
);

/**
* Specifies the maximum width for the auto-preview feature. If no maximum
* width should be imposed then it should be set to 0.
Expand Down Expand Up @@ -4601,7 +4593,6 @@
'plugins_enabled',
'plugins_force_installed',
'preview_attachments_inline_max_size',
'preview_audio_extensions',
'preview_image_extensions',
'preview_max_height',
'preview_max_width',
Expand Down
7 changes: 3 additions & 4 deletions core/file_api.php
Expand Up @@ -372,7 +372,6 @@ function file_get_visible_attachments( $p_bug_id ) {

$t_preview_text_ext = config_get( 'preview_text_extensions' );
$t_preview_image_ext = config_get( 'preview_image_extensions' );
$t_preview_audio_ext = config_get( 'preview_audio_extensions' );

$t_image_previewed = false;
for( $i = 0;$i < $t_attachments_count;$i++ ) {
Expand Down Expand Up @@ -420,13 +419,13 @@ function file_get_visible_attachments( $p_bug_id ) {
$t_attachment['alt'] = $t_ext;

if( $t_attachment['exists'] && $t_attachment['can_download'] && $t_filesize != 0 && $t_filesize <= config_get( 'preview_attachments_inline_max_size' ) ) {
if( in_array( $t_ext, $t_preview_text_ext, true ) ) {
if( stripos( $t_attachment['file_type'], 'text/' ) === 0 || in_array( $t_ext, $t_preview_text_ext, true ) ) {
$t_attachment['preview'] = true;
$t_attachment['type'] = 'text';
} else if( in_array( $t_ext, $t_preview_image_ext, true ) ) {
} else if( stripos( $t_attachment['file_type'], 'image/' ) === 0 || in_array( $t_ext, $t_preview_image_ext, true ) ) {
$t_attachment['preview'] = true;
$t_attachment['type'] = 'image';
} else if( in_array( $t_ext, $t_preview_audio_ext, true ) ) {
} else if( stripos( $t_attachment['file_type'], 'audio/' ) === 0 ) {
$t_attachment['preview'] = true;
$t_attachment['type'] = 'audio';
}
Expand Down
7 changes: 0 additions & 7 deletions docbook/Admin_Guide/en-US/config/uploads.xml
Expand Up @@ -114,13 +114,6 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>$g_preview_audio_extensions</term>
<listitem>
<para>An array of file extensions (not including dots) for audio files that can be played inline.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>$g_fileinfo_magic_db_file</term>
<listitem>
Expand Down

0 comments on commit 34af70d

Please sign in to comment.