import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @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: $
* @version $Id: Transfer.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/**
@ -24,7 +24,7 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_File_Transfer

View File

@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @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: $
* @version $Id: Abstract.php 17616 2009-08-15 03:28:29Z yoshida@zend.co.jp $
*/
/**
@ -24,13 +24,13 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_File_Transfer_Adapter_Abstract
{
/**@+
* @const string Plugin loader Constants
* Plugin loader Constants
*/
const FILTER = 'FILTER';
const VALIDATE = 'VALIDATE';
@ -246,7 +246,9 @@ abstract class Zend_File_Transfer_Adapter_Abstract
*
* Otherwise, the path prefix is set on the appropriate plugin loader.
*
* @param string $prefix
* @param string $path
* @param string $type
* @return Zend_File_Transfer_Adapter_Abstract
* @throws Zend_File_Transfer_Exception for invalid type
*/
@ -550,11 +552,19 @@ abstract class Zend_File_Transfer_Adapter_Abstract
if (is_array($options)) {
foreach ($options as $name => $value) {
foreach ($file as $key => $content) {
if (array_key_exists($name, $this->_options)) {
$this->_files[$key]['options'][$name] = (boolean) $value;
} else {
require_once 'Zend/File/Transfer/Exception.php';
throw new Zend_File_Transfer_Exception("Unknown option: $name = $value");
switch ($name) {
case 'magicFile' :
$this->_files[$key]['options'][$name] = (string) $value;
break;
case 'ignoreNoFile' :
case 'useByteString' :
$this->_files[$key]['options'][$name] = (boolean) $value;
break;
default:
require_once 'Zend/File/Transfer/Exception.php';
throw new Zend_File_Transfer_Exception("Unknown option: $name = $value");
}
}
}
@ -616,7 +626,7 @@ abstract class Zend_File_Transfer_Adapter_Abstract
foreach ($check as $key => $content) {
$fileerrors = array();
if (array_key_exists('validator', $content) && $content['validated']) {
if (array_key_exists('validators', $content) && $content['validated']) {
continue;
}
@ -1010,7 +1020,7 @@ abstract class Zend_File_Transfer_Adapter_Abstract
}
} else {
$files = $this->_getFiles($files, true, true);
if (empty($this->_files) and is_string($orig)) {
if (empty($files) and is_string($orig)) {
$this->_files[$orig]['destination'] = $destination;
}
@ -1030,8 +1040,18 @@ abstract class Zend_File_Transfer_Adapter_Abstract
*/
public function getDestination($files = null)
{
$files = $this->_getFiles($files, false);
$orig = $files;
$files = $this->_getFiles($files, false, true);
$destinations = array();
if (empty($files) and is_string($orig)) {
if (isset($this->_files[$orig]['destination'])) {
$destinations[$orig] = $this->_files[$orig]['destination'];
} else {
require_once 'Zend/File/Transfer/Exception.php';
throw new Zend_File_Transfer_Exception(sprintf('"%s" not found by file transfer adapter', $orig));
}
}
foreach ($files as $key => $content) {
if (isset($this->_files[$key]['destination'])) {
$destinations[$key] = $this->_files[$key]['destination'];
@ -1185,7 +1205,7 @@ abstract class Zend_File_Transfer_Adapter_Abstract
*
* @param string|array $files Files to get the mimetype from
* @throws Zend_File_Transfer_Exception When the file does not exist
* @return string|array Filesize
* @return string|array MimeType
*/
public function getMimeType($files = null)
{
@ -1201,19 +1221,27 @@ abstract class Zend_File_Transfer_Adapter_Abstract
throw new Zend_File_Transfer_Exception("File '{$value['name']}' does not exist");
}
if (class_exists('finfo', false) && ((!empty($value['options']['magicFile'])) or (defined('MAGIC')))) {
if (class_exists('finfo', false)) {
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
if (!empty($value['options']['magicFile'])) {
$mime = new finfo(FILEINFO_MIME, $value['options']['magicFile']);
$mime = new finfo($const, $value['options']['magicFile']);
} else {
$mime = new finfo(FILEINFO_MIME);
$mime = new finfo($const);
}
if ($mime !== false) {
$result[$key] = $mime->file($file);
}
$result[$key] = $mime->file($file);
unset($mime);
} elseif (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
$result[$key] = mime_content_type($file);
} else {
$result[$key] = $value['type'];
}
if (empty($result[$key])) {
if (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
$result[$key] = mime_content_type($file);
} else {
$result[$key] = $value['type'];
}
}
if (empty($result[$key])) {

View File

@ -14,11 +14,14 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @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: $
* @version $Id: Http.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/**
* @see Zend_File_Transfer_Adapter_Abstract
*/
require_once 'Zend/File/Transfer/Adapter/Abstract.php';
/**
@ -160,8 +163,16 @@ class Zend_File_Transfer_Adapter_Http extends Zend_File_Transfer_Adapter_Abstrac
$filename = $directory . $content['name'];
$rename = $this->getFilter('Rename');
if ($rename !== null) {
$filename = $rename->getNewName($content['tmp_name']);
$key = array_search(get_class($rename), $this->_files[$file]['filters']);
$tmp = $rename->getNewName($content['tmp_name']);
if ($tmp != $content['tmp_name']) {
$filename = $tmp;
}
if (dirname($filename) == '.') {
$filename = $directory . $filename;
}
$key = array_search(get_class($rename), $this->_files[$file]['filters']);
unset($this->_files[$file]['filters'][$key]);
}

View File

@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @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: $
* @version $Id: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/**
@ -29,7 +29,7 @@ require_once 'Zend/Exception.php';
*
* @category Zend
* @package Zend_File_Transfer
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_File_Transfer_Exception extends Zend_Exception