diff --git a/main/document/document.inc.php b/main/document/document.inc.php
index 124a2706f1..4d9b7549b8 100755
--- a/main/document/document.inc.php
+++ b/main/document/document.inc.php
@@ -237,15 +237,15 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
//target="'.$target.'"
if ($filetype == 'file') {
//Sound preview with jplayer
- if ( preg_match('/mp3$/', urldecode($url)) ||
- preg_match('/wav$/', urldecode($url)) ||
- preg_match('/ogg$/', urldecode($url))) {
+ if ( preg_match('/mp3$/i', urldecode($url)) ||
+ preg_match('/wav$/i', urldecode($url)) ||
+ preg_match('/ogg$/i', urldecode($url))) {
return ''.$title.''.$force_download_html.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
} elseif (
//Show preview sith yoxview
- preg_match('/swf$/', urldecode($url)) ||
- preg_match('/html$/', urldecode($url)) ||
- preg_match('/htm$/', urldecode($url)) //|| (preg_match('/wav$/', urldecode($url)) && api_get_setting('enable_nanogong') == 'true')
+ preg_match('/swf$/i', urldecode($url)) ||
+ preg_match('/html$/i', urldecode($url)) ||
+ preg_match('/htm$/i', urldecode($url)) //|| (preg_match('/wav$/', urldecode($url)) && api_get_setting('enable_nanogong') == 'true')
) {
$url = 'showinframesmin.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid;
return ''.$title.''.$force_download_html.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
@@ -262,16 +262,16 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
if (preg_match('/shared_folder/', urldecode($url)) && preg_match('/shared_folder$/', urldecode($url))==false && preg_match('/shared_folder_session_'.$current_session_id.'$/', urldecode($url))==false){
if ($filetype == 'file') {
//Sound preview with jplayer
- if ( preg_match('/mp3$/', urldecode($url)) ||
- preg_match('/wav$/', urldecode($url)) ||
- preg_match('/ogg$/', urldecode($url))) {
+ if ( preg_match('/mp3$/i', urldecode($url)) ||
+ preg_match('/wav$/i', urldecode($url)) ||
+ preg_match('/ogg$/i', urldecode($url))) {
$sound_preview = DocumentManager::generate_mp3_preview($counter);
return $sound_preview ;
} elseif (
//Show preview sith yoxview
- preg_match('/swf$/', urldecode($url)) ||
- preg_match('/html$/', urldecode($url)) ||
- preg_match('/htm$/', urldecode($url)) //|| (preg_match('/wav$/', urldecode($url)) && api_get_setting('enable_nanogong') == 'true')
+ preg_match('/swf$/i', urldecode($url)) ||
+ preg_match('/html$/i', urldecode($url)) ||
+ preg_match('/htm$/i', urldecode($url)) //|| (preg_match('/wav$/', urldecode($url)) && api_get_setting('enable_nanogong') == 'true')
) {
$url = 'showinframesmin.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid;
return ''.build_document_icon_tag($filetype, $path).Display::return_icon('shared.png', get_lang('ResourceShared'), array('hspace' => '5', 'align' => 'middle', 'height' => 22, 'width' => 22)).'';
diff --git a/main/document/document.php b/main/document/document.php
index a21d231128..721b2e26ad 100755
--- a/main/document/document.php
+++ b/main/document/document.php
@@ -254,7 +254,6 @@ if ($current_session_id == 0) {
}
}
-
/* MAIN SECTION */
if (isset($_GET['action']) && $_GET['action'] == 'download') {
@@ -371,7 +370,6 @@ if (isset($_GET['createdir'])) {
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('CreateDir'));
}
-
//jquery thickbox already called from main/inc/header.inc.php
$htmlHeadXtra[] = api_get_jquery_js();
@@ -395,21 +393,23 @@ $docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath
$file_list = $format_list = '';
$count = 1;
+
if (!empty($docs_and_folders))
foreach ($docs_and_folders as $file) {
if ($file['filetype'] == 'file') {
- $path_info = pathinfo($file['path']);
+ $path_info = pathinfo($file['path']);
+ $extension = strtolower($path_info['extension']);
//@todo use a js loop to autogenerate this code
- if (in_array($path_info['extension'], array('ogg', 'mp3', 'wav'))) {
+ if (in_array($extension, array('ogg', 'mp3', 'wav'))) {
$document_data = DocumentManager::get_document_data_by_id($file['id'], api_get_course_id());
- if ($path_info['extension'] == 'ogg') {
- $path_info['extension'] = 'oga';
+ if ($extension == 'ogg') {
+ $extension = 'oga';
}
$jquery .= ' $("#jquery_jplayer_'.$count.'").jPlayer({
ready: function() {
$(this).jPlayer("setMedia", {
- '.$path_info['extension'].' : "'.$document_data['direct_url'].'"
+ '.$extension.' : "'.$document_data['direct_url'].'"
});
},
swfPath: "'.$js_path.'jquery-jplayer",
@@ -421,7 +421,6 @@ foreach ($docs_and_folders as $file) {
}
}
}
-
$htmlHeadXtra[] = '';
-
-
Display::display_header('','Doc');
-?>
-
-