import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -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: Count.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Count.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -100,8 +100,7 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
|
||||
* 'min': Minimum filecount
|
||||
* 'max': Maximum filecount
|
||||
*
|
||||
* @param integer|array $options Options for the adapter
|
||||
* @param integer $max (Deprecated) Maximum value (implies $options is the minimum)
|
||||
* @param integer|array|Zend_Config $options Options for the adapter
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($options)
|
||||
@ -116,7 +115,8 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract
|
||||
}
|
||||
|
||||
if (1 < func_num_args()) {
|
||||
trigger_error('Multiple arguments are deprecated in favor of an array of named arguments', E_USER_NOTICE);
|
||||
// @todo: Preperation for 2.0... needs to be cleared with the dev-team
|
||||
// trigger_error('Multiple arguments are deprecated in favor of an array of named arguments', E_USER_NOTICE);
|
||||
$options['min'] = func_get_arg(0);
|
||||
$options['max'] = func_get_arg(1);
|
||||
}
|
||||
|
@ -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: Crc32.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Crc32.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -60,7 +60,7 @@ class Zend_Validate_File_Crc32 extends Zend_Validate_File_Hash
|
||||
/**
|
||||
* Sets validator options
|
||||
*
|
||||
* @param string|array $options
|
||||
* @param string|array|Zend_Config $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($options)
|
||||
|
@ -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: ExcludeMimeType.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: ExcludeMimeType.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -51,20 +51,38 @@ class Zend_Validate_File_ExcludeMimeType extends Zend_Validate_File_MimeType
|
||||
*/
|
||||
public function isValid($value, $file = null)
|
||||
{
|
||||
if ($file === null) {
|
||||
$file = array(
|
||||
'type' => null,
|
||||
'name' => $value
|
||||
);
|
||||
}
|
||||
|
||||
// Is file readable ?
|
||||
require_once 'Zend/Loader.php';
|
||||
if (!Zend_Loader::isReadable($value)) {
|
||||
return $this->_throw($file, self::NOT_READABLE);
|
||||
}
|
||||
|
||||
if ($file !== null) {
|
||||
if (class_exists('finfo', false) && defined('MAGIC')) {
|
||||
$mime = new finfo(FILEINFO_MIME);
|
||||
$this->_type = $mime->file($value);
|
||||
unset($mime);
|
||||
} elseif (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
|
||||
$this->_type = mime_content_type($value);
|
||||
$mimefile = $this->getMagicFile();
|
||||
if (class_exists('finfo', false)) {
|
||||
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
|
||||
if (!empty($mimefile)) {
|
||||
$mime = new finfo($const, $mimefile);
|
||||
} else {
|
||||
$mime = new finfo($const);
|
||||
}
|
||||
|
||||
if ($mime !== false) {
|
||||
$this->_type = $mime->file($value);
|
||||
}
|
||||
unset($mime);
|
||||
}
|
||||
|
||||
if (empty($this->_type)) {
|
||||
if (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
|
||||
$this->_type = mime_content_type($value);
|
||||
} elseif ($this->_headerCheck) {
|
||||
$this->_type = $file['type'];
|
||||
}
|
||||
}
|
||||
|
@ -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: Exists.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Exists.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ class Zend_Validate_File_Exists extends Zend_Validate_Abstract
|
||||
/**
|
||||
* Sets validator options
|
||||
*
|
||||
* @param string|array $directory
|
||||
* @param string|array|Zend_Config $directory
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($directory = array())
|
||||
|
@ -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: Extension.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Extension.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -71,8 +71,7 @@ class Zend_Validate_File_Extension extends Zend_Validate_Abstract
|
||||
/**
|
||||
* Sets validator options
|
||||
*
|
||||
* @param string|array $extension
|
||||
* @param boolean $case If true validation is done case sensitive
|
||||
* @param string|array|Zend_Config $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($options)
|
||||
@ -82,7 +81,8 @@ class Zend_Validate_File_Extension extends Zend_Validate_Abstract
|
||||
}
|
||||
|
||||
if (1 < func_num_args()) {
|
||||
trigger_error('Multiple arguments to constructor are deprecated in favor of options array', E_USER_NOTICE);
|
||||
// @todo: Preperation for 2.0... needs to be cleared with the dev-team
|
||||
// trigger_error('Multiple arguments to constructor are deprecated in favor of options array', E_USER_NOTICE);
|
||||
$case = func_get_arg(1);
|
||||
$this->setCase($case);
|
||||
}
|
||||
|
@ -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: FilesSize.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: FilesSize.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -63,9 +63,7 @@ class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size
|
||||
* Min limits the used diskspace for all files, when used with max=null it is the maximum filesize
|
||||
* It also accepts an array with the keys 'min' and 'max'
|
||||
*
|
||||
* @param integer|array $min Minimum diskspace for all files
|
||||
* @param integer $max Maximum diskspace for all files (deprecated)
|
||||
* @param boolean $bytestring Use bytestring or real size ? (deprecated)
|
||||
* @param integer|array|Zend_Config $options Options for this validator
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($options)
|
||||
@ -73,16 +71,18 @@ class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size
|
||||
$this->_files = array();
|
||||
$this->_setSize(0);
|
||||
|
||||
if ($options instanceof Zend_Config) {
|
||||
$options = $options->toArray();
|
||||
} elseif (is_scalar($options)) {
|
||||
$options = array('max' => $options);
|
||||
} elseif (!is_array($options)) {
|
||||
require_once 'Zend/Validate/Exception.php';
|
||||
throw new Zend_Validate_Exception('Invalid options to validator provided');
|
||||
}
|
||||
|
||||
if (1 < func_num_args()) {
|
||||
trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
|
||||
if ($options instanceof Zend_Config) {
|
||||
$options = $options->toArray();
|
||||
} elseif (is_scalar($options)) {
|
||||
$options = array('min' => $options);
|
||||
} elseif (!is_array($options)) {
|
||||
require_once 'Zend/Validate/Exception.php';
|
||||
throw new Zend_Validate_Exception('Invalid options to validator provided');
|
||||
}
|
||||
// @todo: Preperation for 2.0... needs to be cleared with the dev-team
|
||||
// trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
|
||||
|
||||
$argv = func_get_args();
|
||||
array_shift($argv);
|
||||
|
@ -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: Hash.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Hash.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -75,7 +75,8 @@ class Zend_Validate_File_Hash extends Zend_Validate_Abstract
|
||||
}
|
||||
|
||||
if (1 < func_num_args()) {
|
||||
trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
|
||||
// @todo: Preperation for 2.0... needs to be cleared with the dev-team
|
||||
// trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
|
||||
$options['algorithm'] = func_get_arg(1);
|
||||
}
|
||||
|
||||
|
@ -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: ImageSize.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: ImageSize.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -124,15 +124,11 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract
|
||||
*/
|
||||
public function __construct($options)
|
||||
{
|
||||
$minwidth = 0;
|
||||
$minheight = 0;
|
||||
$maxwidth = null;
|
||||
$maxheight = null;
|
||||
|
||||
if ($options instanceof Zend_Config) {
|
||||
$options = $options->toArray();
|
||||
} elseif (1 < func_num_args()) {
|
||||
trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
|
||||
// @todo: Preperation for 2.0... needs to be cleared with the dev-team
|
||||
// trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
|
||||
if (!is_array($options)) {
|
||||
$options = array('minwidth' => $options);
|
||||
}
|
||||
|
@ -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: IsCompressed.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: IsCompressed.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -53,12 +53,14 @@ class Zend_Validate_File_IsCompressed extends Zend_Validate_File_MimeType
|
||||
/**
|
||||
* Sets validator options
|
||||
*
|
||||
* @param string|array $compression
|
||||
* @param string|array|Zend_Config $compression
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($mimetype = array())
|
||||
{
|
||||
if (empty($mimetype)) {
|
||||
if ($mimetype instanceof Zend_Config) {
|
||||
$mimetype = $mimetype->toArray();
|
||||
} else if (empty($mimetype)) {
|
||||
$mimetype = array(
|
||||
'application/x-tar',
|
||||
'application/x-cpio',
|
||||
@ -81,53 +83,4 @@ class Zend_Validate_File_IsCompressed extends Zend_Validate_File_MimeType
|
||||
|
||||
$this->setMimeType($mimetype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Validate_Interface
|
||||
*
|
||||
* Returns true if and only if the file is compression with the set compression types
|
||||
*
|
||||
* @param string $value Real file to check for compression
|
||||
* @param array $file File data from Zend_File_Transfer
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValid($value, $file = null)
|
||||
{
|
||||
// Is file readable ?
|
||||
require_once 'Zend/Loader.php';
|
||||
if (!Zend_Loader::isReadable($value)) {
|
||||
return $this->_throw($file, self::NOT_READABLE);
|
||||
}
|
||||
|
||||
if ($file !== null) {
|
||||
if (class_exists('finfo', false) && defined('MAGIC')) {
|
||||
$mime = new finfo(FILEINFO_MIME);
|
||||
$this->_type = $mime->file($value);
|
||||
unset($mime);
|
||||
} elseif (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
|
||||
$this->_type = mime_content_type($value);
|
||||
} else {
|
||||
$this->_type = $file['type'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->_type)) {
|
||||
return $this->_throw($file, self::NOT_DETECTED);
|
||||
}
|
||||
|
||||
$compressions = $this->getMimeType(true);
|
||||
if (in_array($this->_type, $compressions)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$types = explode('/', $this->_type);
|
||||
$types = array_merge($types, explode('-', $this->_type));
|
||||
foreach ($compressions as $mime) {
|
||||
if (in_array($mime, $types)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_throw($file, self::FALSE_TYPE);
|
||||
}
|
||||
}
|
||||
|
@ -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: IsImage.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: IsImage.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -53,12 +53,14 @@ class Zend_Validate_File_IsImage extends Zend_Validate_File_MimeType
|
||||
/**
|
||||
* Sets validator options
|
||||
*
|
||||
* @param string|array $mimetype
|
||||
* @param string|array|Zend_Config $mimetype
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($mimetype = array())
|
||||
{
|
||||
if (empty($mimetype)) {
|
||||
if ($mimetype instanceof Zend_Config) {
|
||||
$mimetype = $mimetype->toArray();
|
||||
} else if (empty($mimetype)) {
|
||||
$mimetype = array(
|
||||
'image/x-quicktime',
|
||||
'image/jp2',
|
||||
@ -85,53 +87,4 @@ class Zend_Validate_File_IsImage extends Zend_Validate_File_MimeType
|
||||
|
||||
$this->setMimeType($mimetype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Validate_Interface
|
||||
*
|
||||
* Returns true if and only if the file is compression with the set compression types
|
||||
*
|
||||
* @param string $value Real file to check for compression
|
||||
* @param array $file File data from Zend_File_Transfer
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValid($value, $file = null)
|
||||
{
|
||||
// Is file readable ?
|
||||
require_once 'Zend/Loader.php';
|
||||
if (!Zend_Loader::isReadable($value)) {
|
||||
return $this->_throw($file, self::NOT_READABLE);
|
||||
}
|
||||
|
||||
if ($file !== null) {
|
||||
if (class_exists('finfo', false) && defined('MAGIC')) {
|
||||
$mime = new finfo(FILEINFO_MIME);
|
||||
$this->_type = $mime->file($value);
|
||||
unset($mime);
|
||||
} elseif (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
|
||||
$this->_type = mime_content_type($value);
|
||||
} else {
|
||||
$this->_type = $file['type'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->_type)) {
|
||||
return $this->_throw($file, self::NOT_DETECTED);
|
||||
}
|
||||
|
||||
$compressions = $this->getMimeType(true);
|
||||
if (in_array($this->_type, $compressions)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$types = explode('/', $this->_type);
|
||||
$types = array_merge($types, explode('-', $this->_type));
|
||||
foreach($compressions as $mime) {
|
||||
if (in_array($mime, $types)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_throw($file, self::FALSE_TYPE);
|
||||
}
|
||||
}
|
||||
|
@ -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 17203 2009-07-27 19:37:18Z thomas $
|
||||
* @version $Id: MimeType.php 18513 2009-10-12 16:17:35Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -79,6 +79,29 @@ 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
|
||||
*/
|
||||
protected $_headerCheck = false;
|
||||
|
||||
/**
|
||||
* Sets validator options
|
||||
*
|
||||
@ -102,16 +125,28 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
|
||||
$this->setMagicFile($mimetype['magicfile']);
|
||||
}
|
||||
|
||||
if (isset($mimetype['headerCheck'])) {
|
||||
$this->enableHeaderCheck(true);
|
||||
}
|
||||
|
||||
$this->setMimeType($mimetype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returna the actual set magicfile
|
||||
* Returns the actual set magicfile
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@ -136,6 +171,29 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Header Check option
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getHeaderCheck()
|
||||
{
|
||||
return $this->_headerCheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if the http header should be used
|
||||
* Note that this is unsave and therefor the default value is false
|
||||
*
|
||||
* @param boolean $checkHeader
|
||||
* @return Zend_Validate_File_MimeType Provides fluid interface
|
||||
*/
|
||||
public function enableHeaderCheck($headerCheck = true)
|
||||
{
|
||||
$this->_headerCheck = (boolean) $headerCheck;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set mimetypes
|
||||
*
|
||||
@ -220,35 +278,39 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
|
||||
*/
|
||||
public function isValid($value, $file = null)
|
||||
{
|
||||
if ($file === null) {
|
||||
$file = array(
|
||||
'type' => null,
|
||||
'name' => $value
|
||||
);
|
||||
}
|
||||
|
||||
// Is file readable ?
|
||||
require_once 'Zend/Loader.php';
|
||||
if (!Zend_Loader::isReadable($value)) {
|
||||
return $this->_throw($file, self::NOT_READABLE);
|
||||
}
|
||||
|
||||
if ($file !== null) {
|
||||
$mimefile = $this->getMagicFile();
|
||||
if (class_exists('finfo', false)) {
|
||||
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
|
||||
if (!empty($mimefile)) {
|
||||
$mime = new finfo($const, $mimefile);
|
||||
} else {
|
||||
$mime = new finfo($const);
|
||||
}
|
||||
|
||||
if ($mime !== false) {
|
||||
$this->_type = $mime->file($value);
|
||||
}
|
||||
|
||||
unset($mime);
|
||||
$mimefile = $this->getMagicFile();
|
||||
if (class_exists('finfo', false)) {
|
||||
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
|
||||
if (!empty($mimefile)) {
|
||||
$mime = new finfo($const, $mimefile);
|
||||
} else {
|
||||
$mime = new finfo($const);
|
||||
}
|
||||
|
||||
if (empty($this->_type)) {
|
||||
if (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
|
||||
$this->_type = mime_content_type($value);
|
||||
} else {
|
||||
$this->_type = $file['type'];
|
||||
}
|
||||
if ($mime !== false) {
|
||||
$this->_type = $mime->file($value);
|
||||
}
|
||||
unset($mime);
|
||||
}
|
||||
|
||||
if (empty($this->_type)) {
|
||||
if (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
|
||||
$this->_type = mime_content_type($value);
|
||||
} elseif ($this->_headerCheck) {
|
||||
$this->_type = $file['type'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,10 +343,7 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract
|
||||
*/
|
||||
protected function _throw($file, $errorType)
|
||||
{
|
||||
if ($file !== null) {
|
||||
$this->_value = $file['name'];
|
||||
}
|
||||
|
||||
$this->_value = $file['name'];
|
||||
$this->_error($errorType);
|
||||
return false;
|
||||
}
|
||||
|
@ -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: Size.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Size.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -112,7 +112,8 @@ class Zend_Validate_File_Size extends Zend_Validate_Abstract
|
||||
}
|
||||
|
||||
if (1 < func_num_args()) {
|
||||
trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
|
||||
// @todo: Preperation for 2.0... needs to be cleared with the dev-team
|
||||
// trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
|
||||
$argv = func_get_args();
|
||||
array_shift($argv);
|
||||
$options['max'] = array_shift($argv);
|
||||
|
@ -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: Upload.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Upload.php 18148 2009-09-16 19:27:43Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -78,11 +78,15 @@ class Zend_Validate_File_Upload extends Zend_Validate_Abstract
|
||||
* If no files are given the $_FILES array will be used automatically.
|
||||
* NOTE: This validator will only work with HTTP POST uploads!
|
||||
*
|
||||
* @param array $files Array of files in syntax of Zend_File_Transfer
|
||||
* @param array|Zend_Config $files Array of files in syntax of Zend_File_Transfer
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($files = array())
|
||||
{
|
||||
if ($files instanceof Zend_Config) {
|
||||
$files = $files->toArray();
|
||||
}
|
||||
|
||||
$this->setFiles($files);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user