Index: inc/document.class.php =================================================================== --- inc/document.class.php (révision 23462) +++ inc/document.class.php (copie de travail) @@ -906,15 +906,8 @@ } // Local file : try to detect mime type - if (function_exists('finfo_open') - && ($finfo = finfo_open(FILEINFO_MIME))) { - $input['mime'] = finfo_file($finfo, $fullpath); - finfo_close($finfo); + $input['mime'] = Toolbox::getMime($fullpath); - } else if (function_exists('mime_content_type')) { - $input['mime'] = mime_content_type($fullpath); - } - if (is_writable(GLPI_UPLOAD_DIR) && is_writable ($fullpath)) { // Move if allowed Index: inc/ticket.class.php =================================================================== --- inc/ticket.class.php (révision 23462) +++ inc/ticket.class.php (copie de travail) @@ -5576,19 +5576,8 @@ $mime = ''; if (isset($image['filepath'])) { $fullpath = GLPI_DOC_DIR."/".$image['filepath']; - if (function_exists('finfo_open') - && ($finfo = finfo_open(FILEINFO_MIME))) { - $mime = finfo_file($finfo, $fullpath); - finfo_close($finfo); - - } else if (function_exists('mime_content_type')) { - $mime = mime_content_type($fullpath); - } - switch (substr($mime, 0, strrpos($mime, ';'))) { - case 'image/gif':case 'image/jpg':case 'image/jpeg':case 'image/png' : - $ok = true; - break; - } + $mime = Toolbox::getMime($fullpath); + $ok = Toolbox::getMime($fullpath, 'image'); } if (isset($image['tag'])) { if ($ok || empty($mime)) { Index: inc/toolbox.class.php =================================================================== --- inc/toolbox.class.php (révision 23462) +++ inc/toolbox.class.php (copie de travail) @@ -976,6 +976,21 @@ } echo ""; + // Test for fileinfo extension loaded or not + echo "