diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-05 21:01:58 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-05 21:01:58 +0200 |
commit | 6ef498b49946ba74d610b3805fb908b163a7f03a (patch) | |
tree | 7c0239269a92a6887f43cc36020258616bfec434 /system/libraries/Upload.php | |
parent | f4a53ce71feadb867b3ea462cb5a5b3f5052a035 (diff) |
Added get_mimes() function to system/core/Commons.php.The MIMEs array from config/mimes.php is used by multiple core classes, libraries and helpers and each of them has implemented an own way of getting it, which is not needed and is hard to maintain. This also fixes issue #1411
Diffstat (limited to 'system/libraries/Upload.php')
-rw-r--r-- | system/libraries/Upload.php | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index e31029e49..c1e07de7a 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -78,6 +78,8 @@ class CI_Upload { $this->initialize($props); } + $this->mimes =& get_mimes(); + log_message('debug', 'Upload Class Initialized'); } @@ -113,7 +115,6 @@ class CI_Upload { 'image_type' => '', 'image_size_str' => '', 'error_msg' => array(), - 'mimes' => array(), 'remove_spaces' => TRUE, 'xss_clean' => FALSE, 'temp_prefix' => 'temp_file_', @@ -924,24 +925,6 @@ class CI_Upload { */ public function mimes_types($mime) { - global $mimes; - - if (count($this->mimes) === 0) - { - if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) - { - $this->mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); - } - elseif (is_file(APPPATH.'config/mimes.php')) - { - $this->mimes = include(APPPATH.'config/mimes.php'); - } - else - { - return FALSE; - } - } - return isset($this->mimes[$mime]) ? $this->mimes[$mime] : FALSE; } |