- Patch #415710 by dixon_, JohnAlbin, BMDan: fix favicon mime-type handling.

merge-requests/26/head
Dries Buytaert 2009-05-17 10:42:16 +00:00
parent 556f62f81a
commit d4a7074294
3 changed files with 15 additions and 3 deletions

View File

@ -1798,7 +1798,7 @@ function file_get_mimetype($filename, $mapping = NULL) {
'cdr' => 'image/x-coreldraw',
'pat' => 'image/x-coreldrawpattern',
'cdt' => 'image/x-coreldrawtemplate',
'ico' => 'image/x-icon',
'ico' => 'image/vnd.microsoft.icon',
'art' => 'image/x-jg',
'jng' => 'image/x-jng',
'bmp' => 'image/x-ms-bmp',

View File

@ -1769,7 +1769,13 @@ function template_preprocess_page(&$variables) {
// Add favicon.
if (theme_get_setting('toggle_favicon')) {
drupal_add_html_head('<link rel="shortcut icon" href="' . check_url(theme_get_setting('favicon')) . '" type="image/x-icon" />');
$favicon = theme_get_setting('favicon');
$type = file_get_mimetype($favicon);
// Use the genereic MIME type for favicons if no other was found.
if ($type == 'application/octet-stream') {
$type = 'image/x-icon';
}
drupal_add_html_head('<link rel="shortcut icon" href="' . check_url($favicon) . '" type="' . check_plain($type) . '" />');
}
// Set up layout variable.

View File

@ -206,7 +206,13 @@ function theme_update_page($content, $show_messages = TRUE) {
function template_preprocess_maintenance_page(&$variables) {
// Add favicon
if (theme_get_setting('toggle_favicon')) {
drupal_add_html_head('<link rel="shortcut icon" href="' . check_url(theme_get_setting('favicon')) . '" type="image/x-icon" />');
$favicon = theme_get_setting('favicon');
$type = file_get_mimetype($favicon);
// Use the genereic MIME type for favicons if no other was found.
if ($type == 'application/octet-stream') {
$type = 'image/x-icon';
}
drupal_add_html_head('<link rel="shortcut icon" href="' . check_url($favicon) . '" type="' . check_plain($type) . '" />');
}
global $theme;