parent
e34ef6cb4f
commit
ae45a8cfee
1 changed files with 3 additions and 1 deletions
|
@ -163,13 +163,15 @@ function getMimeType($url) {
|
||||||
static $mime = null;
|
static $mime = null;
|
||||||
|
|
||||||
if (is_null($mime)) {
|
if (is_null($mime)) {
|
||||||
|
// Default values, overriden by /etc/mime.types when present
|
||||||
$mime = array(
|
$mime = array(
|
||||||
'jpg' => 'image/jpeg',
|
'jpg' => 'image/jpeg',
|
||||||
'gif' => 'image/gif',
|
'gif' => 'image/gif',
|
||||||
'png' => 'image/png',
|
'png' => 'image/png',
|
||||||
'image' => 'image/*'
|
'image' => 'image/*'
|
||||||
);
|
);
|
||||||
if (is_file('/etc/mime.types')) {
|
// '@' is used to mute open_basedir warning, see issue #818
|
||||||
|
if (@is_readable('/etc/mime.types')) {
|
||||||
$file = fopen('/etc/mime.types', 'r');
|
$file = fopen('/etc/mime.types', 'r');
|
||||||
while(($line = fgets($file)) !== false) {
|
while(($line = fgets($file)) !== false) {
|
||||||
$line = trim(preg_replace('/#.*/', '', $line));
|
$line = trim(preg_replace('/#.*/', '', $line));
|
||||||
|
|
Loading…
Reference in a new issue