diff options
author | robocoder <anthon.pang@gmail.com> | 2009-10-17 16:56:40 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2009-10-17 16:56:40 +0400 |
commit | 20779ae9dd2c6e3cba3385fb75c69f8b23490860 (patch) | |
tree | 32daa3d203f1dfdbce8437436ea2145e72b07102 /libs/Zend/Validate | |
parent | 37ac90de294baa32cf232dd866e19d2323f4246c (diff) |
Update to Zend Framework 1.9.4
git-svn-id: http://dev.piwik.org/svn/trunk@1506 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/Zend/Validate')
-rw-r--r-- | libs/Zend/Validate/File/MimeType.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/libs/Zend/Validate/File/MimeType.php b/libs/Zend/Validate/File/MimeType.php index 5b9cba2b77..2bf372c4fc 100644 --- a/libs/Zend/Validate/File/MimeType.php +++ b/libs/Zend/Validate/File/MimeType.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: MimeType.php 18148 2009-09-16 19:27:43Z thomas $ + * @version $Id: MimeType.php 18513 2009-10-12 16:17:35Z matthew $ */ /** @@ -80,6 +80,22 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract protected $_magicfile; /** + * If no $_ENV['MAGIC'] is set, try and autodiscover it based on common locations + * @var array + */ + protected $_magicFiles = array( + '/usr/share/misc/magic', + '/usr/share/misc/magic.mime', + '/usr/share/misc/magic.mgc', + '/usr/share/mime/magic', + '/usr/share/mime/magic.mime', + '/usr/share/mime/magic.mgc', + '/usr/share/file/magic', + '/usr/share/file/magic.mime', + '/usr/share/file/magic.mgc', + ); + + /** * Option to allow header check * * @var boolean @@ -123,6 +139,14 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract */ public function getMagicFile() { + if (null === $this->_magicfile && empty($_ENV['MAGIC'])) { + foreach ($this->_magicFiles as $file) { + if (file_exists($file)) { + $this->setMagicFile($file); + break; + } + } + } return $this->_magicfile; } |