summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorCory <ckdarby@gmail.com>2012-06-06 18:46:40 +0200
committerCory <ckdarby@gmail.com>2012-06-06 18:46:40 +0200
commit61fb9c1596ea220a0a8106160c5c68f9343ff9df (patch)
tree136126cc057bc58000f020990e32685c89adf399 /system/helpers
parent037944e6c2083ce82ef5785947fddbf671362006 (diff)
parent47b673324f06236264ca64f8c3155aab51762609 (diff)
Merge branch 'develop' of https://github.com/EllisLab/CodeIgniter into issue_1374
Conflicts: user_guide_src/source/changelog.rst
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/download_helper.php9
-rw-r--r--system/helpers/file_helper.php25
2 files changed, 7 insertions, 27 deletions
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 3c677055f..5efbc4930 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -73,14 +73,7 @@ if ( ! function_exists('force_download'))
}
// Load the mime types
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
- {
- $mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
- }
- elseif (is_file(APPPATH.'config/mimes.php'))
- {
- $mimes = include(APPPATH.'config/mimes.php');
- }
+ $mimes =& get_mimes();
// Only change the default MIME if we can find one
if (isset($mimes[$extension]))
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 068706c30..d53d986f9 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -353,32 +353,19 @@ if ( ! function_exists('get_mime_by_extension'))
if ( ! is_array($mimes))
{
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
- {
- $mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
- }
- elseif (is_file(APPPATH.'config/mimes.php'))
- {
- $mimes = include(APPPATH.'config/mimes.php');
- }
+ $mimes =& get_mimes();
- if ( ! is_array($mimes))
+ if (empty($mimes))
{
return FALSE;
}
}
- if (array_key_exists($extension, $mimes))
+ if (isset($mimes[$extension]))
{
- if (is_array($mimes[$extension]))
- {
- // Multiple mime types, just give the first one
- return current($mimes[$extension]);
- }
- else
- {
- return $mimes[$extension];
- }
+ return is_array($mimes[$extension])
+ ? current($mimes[$extension]) // Multiple mime types, just give the first one
+ : $mimes[$extension];
}
return FALSE;