diff --git a/lib/resourcelib.php b/lib/resourcelib.php index a2efe25d5c5..9df4927823c 100644 --- a/lib/resourcelib.php +++ b/lib/resourcelib.php @@ -156,6 +156,11 @@ function resourcelib_guess_url_mimetype($fullurl) { $fullurl = $matches[1].$matches[3]; } + if (preg_match("|^(.*)#.*|", $fullurl, $matches)) { + // ignore all anchors + $fullurl = $matches[1]; + } + if (strpos($fullurl, '.php')){ // we do not really know what is in general php script return 'text/html'; @@ -285,9 +290,17 @@ function resourcelib_embed_flashvideo($fullurl, $title, $clicktoopen) { * @return string html */ function resourcelib_embed_flash($fullurl, $title, $clicktoopen) { + if (preg_match('/[#\?]d=([\d]{1,4}%?)x([\d]{1,4}%?)/', $fullurl, $matches)) { + $width = $matches[1]; + $height = $matches[2]; + } else { + $width = 400; + $height = 300; + } + $code = << - + @@ -295,7 +308,7 @@ function resourcelib_embed_flash($fullurl, $title, $clicktoopen) { - + diff --git a/mod/url/locallib.php b/mod/url/locallib.php index b4e600ce4b8..1949097be1c 100644 --- a/mod/url/locallib.php +++ b/mod/url/locallib.php @@ -311,7 +311,7 @@ function url_get_final_display_type($url) { 'audio/mp3', 'audio/x-realaudio-plugin', 'x-realaudio-plugin', // audio formats, ); - $mimetype = mimeinfo('type', $url->externalurl); + $mimetype = resourcelib_guess_url_mimetype($url->externalurl); if (in_array($mimetype, $download)) { return RESOURCELIB_DISPLAY_DOWNLOAD;