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:
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Abstract.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, See
|
||||
$var = strtolower(substr($var, 3));
|
||||
return isset($this->_has[$var]) ? $this->_has[$var] : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Mail_Storage_Exception
|
||||
*/
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Exception.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Exception.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Folder.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Folder.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Interface.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Interface.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Maildir.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Maildir.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Mbox.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Mbox.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Imap.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Imap.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
|
||||
if ($flags === null) {
|
||||
return count($this->_protocol->search(array('ALL')));
|
||||
}
|
||||
|
||||
|
||||
$params = array();
|
||||
foreach ((array)$flags as $flag) {
|
||||
if (isset(self::$_searchFlags[$flag])) {
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Maildir.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Maildir.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
|
||||
'R' => Zend_Mail_Storage::FLAG_ANSWERED,
|
||||
'S' => Zend_Mail_Storage::FLAG_SEEN,
|
||||
'T' => Zend_Mail_Storage::FLAG_DELETED);
|
||||
|
||||
|
||||
// TODO: getFlags($id) for fast access if headers are not needed (i.e. just setting flags)?
|
||||
|
||||
/**
|
||||
@ -86,7 +86,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
|
||||
return count($this->_files);
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$count = 0;
|
||||
if (!is_array($flags)) {
|
||||
foreach ($this->_files as $file) {
|
||||
if (isset($file['flaglookup'][$flags])) {
|
||||
@ -95,7 +95,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
$flags = array_flip($flags);
|
||||
foreach ($this->_files as $file) {
|
||||
foreach ($flags as $flag => $v) {
|
||||
@ -179,7 +179,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
|
||||
return new $this->_messageClass(array('file' => $this->_getFileData($id, 'filename'),
|
||||
'flags' => $this->_getFileData($id, 'flags')));
|
||||
}
|
||||
|
||||
|
||||
return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $this->getRawHeader($id),
|
||||
'flags' => $this->_getFileData($id, 'flags')));
|
||||
}
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Mbox.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Mbox.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
|
||||
if (is_array($params)) {
|
||||
$params = (object)$params;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($params->filename) /* || Zend_Loader::isReadable($params['filename']) */) {
|
||||
/**
|
||||
* @see Zend_Mail_Storage_Exception
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Pop3.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Pop3.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -244,7 +244,7 @@ class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract
|
||||
}
|
||||
$count = $this->countMessages();
|
||||
if ($count < 1) {
|
||||
return array();
|
||||
return array();
|
||||
}
|
||||
$range = range(1, $count);
|
||||
return array_combine($range, $range);
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Interface.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Interface.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Mail
|
||||
* @subpackage Storage
|
||||
* @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: Maildir.php 16219 2009-06-21 19:45:39Z thomas $
|
||||
* @version $Id: Maildir.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
* @var bool|int
|
||||
*/
|
||||
protected $_quota;
|
||||
|
||||
|
||||
/**
|
||||
* create a new maildir
|
||||
*
|
||||
@ -85,7 +85,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (array('cur', 'tmp', 'new') as $subdir) {
|
||||
if (!@mkdir($dir . DIRECTORY_SEPARATOR . $subdir)) {
|
||||
// ignore if dir exists (i.e. was already valid maildir or two processes try to create one)
|
||||
@ -99,7 +99,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create instance with parameters
|
||||
* Additional parameters are (see parent for more):
|
||||
@ -112,11 +112,11 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
if (is_array($params)) {
|
||||
$params = (object)$params;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($params->create) && isset($params->dirname) && !file_exists($params->dirname . DIRECTORY_SEPARATOR . 'cur')) {
|
||||
self::initMaildir($params->dirname);
|
||||
}
|
||||
|
||||
|
||||
parent::__construct($params);
|
||||
}
|
||||
|
||||
@ -546,7 +546,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
* @see Zend_Mail_Storage_Exception
|
||||
*/
|
||||
require_once 'Zend/Mail/Storage/Exception.php';
|
||||
throw new Zend_Mail_Storage_Exception('storage is over quota!');
|
||||
throw new Zend_Mail_Storage_Exception('storage is over quota!');
|
||||
}
|
||||
|
||||
if ($folder === null) {
|
||||
@ -619,9 +619,9 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
* @see Zend_Mail_Storage_Exception
|
||||
*/
|
||||
require_once 'Zend/Mail/Storage/Exception.php';
|
||||
throw new Zend_Mail_Storage_Exception('storage is over quota!');
|
||||
throw new Zend_Mail_Storage_Exception('storage is over quota!');
|
||||
}
|
||||
|
||||
|
||||
if (!($folder instanceof Zend_Mail_Storage_Folder)) {
|
||||
$folder = $this->getFolders($folder);
|
||||
}
|
||||
@ -677,7 +677,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
'flags' => $flags,
|
||||
'filename' => $new_file);
|
||||
}
|
||||
|
||||
|
||||
if ($this->_quota) {
|
||||
$this->_addQuotaEntry((int)$size, 1);
|
||||
}
|
||||
@ -695,7 +695,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
if (!($folder instanceof Zend_Mail_Storage_Folder)) {
|
||||
$folder = $this->getFolders($folder);
|
||||
}
|
||||
|
||||
|
||||
if ($folder->getGlobalName() == $this->_currentFolder
|
||||
|| ($this->_currentFolder == 'INBOX' && $folder->getGlobalName() == '/')) {
|
||||
/**
|
||||
@ -704,7 +704,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
require_once 'Zend/Mail/Storage/Exception.php';
|
||||
throw new Zend_Mail_Storage_Exception('target is current folder');
|
||||
}
|
||||
|
||||
|
||||
$filedata = $this->_getFileData($id);
|
||||
$old_file = $filedata['filename'];
|
||||
$flags = $filedata['flags'];
|
||||
@ -790,11 +790,11 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
public function removeMessage($id)
|
||||
{
|
||||
$filename = $this->_getFileData($id, 'filename');
|
||||
|
||||
|
||||
if ($this->_quota) {
|
||||
$size = filesize($filename);
|
||||
}
|
||||
|
||||
|
||||
if (!@unlink($filename)) {
|
||||
/**
|
||||
* @see Zend_Mail_Storage_Exception
|
||||
@ -809,7 +809,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
$this->_addQuotaEntry(0 - (int)$size, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* enable/disable quota and set a quota value if wanted or needed
|
||||
*
|
||||
@ -824,7 +824,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
public function setQuota($value) {
|
||||
$this->_quota = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get currently set quota
|
||||
*
|
||||
@ -855,10 +855,10 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
}
|
||||
return $quota;
|
||||
}
|
||||
|
||||
|
||||
return $this->_quota;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see http://www.inter7.com/courierimap/README.maildirquota.html "Calculating maildirsize"
|
||||
*/
|
||||
@ -876,7 +876,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
throw new Zend_Mail_Storage_Exception('no quota defintion found');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$folders = new RecursiveIteratorIterator($this->getFolders(), RecursiveIteratorIterator::SELF_FIRST);
|
||||
foreach ($folders as $folder) {
|
||||
$subdir = $folder->getGlobalName();
|
||||
@ -888,29 +888,29 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
if ($subdir == 'Trash') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
foreach (array('cur', 'new') as $subsubdir) {
|
||||
$dirname = $this->_rootdir . $subdir . DIRECTORY_SEPARATOR . $subsubdir . DIRECTORY_SEPARATOR;
|
||||
if (!file_exists($dirname)) {
|
||||
continue;
|
||||
}
|
||||
// NOTE: we are using mtime instead of "the latest timestamp". The latest would be atime
|
||||
// and as we are accessing the directory it would make the whole calculation useless.
|
||||
// and as we are accessing the directory it would make the whole calculation useless.
|
||||
$timestamps[$dirname] = filemtime($dirname);
|
||||
|
||||
$dh = opendir($dirname);
|
||||
// NOTE: Should have been checked in constructor. Not throwing an exception here, quotas will
|
||||
// NOTE: Should have been checked in constructor. Not throwing an exception here, quotas will
|
||||
// therefore not be fully enforeced, but next request will fail anyway, if problem persists.
|
||||
if (!$dh) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
while (($entry = readdir()) !== false) {
|
||||
if ($entry[0] == '.' || !is_file($dirname . $entry)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (strpos($entry, ',S=')) {
|
||||
strtok($entry, '=');
|
||||
$filesize = strtok(':');
|
||||
@ -930,7 +930,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tmp = $this->_createTmpFile();
|
||||
$fh = $tmp['handle'];
|
||||
$definition = array();
|
||||
@ -951,10 +951,10 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return array('size' => $total_size, 'count' => $messages, 'quota' => $quota);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see http://www.inter7.com/courierimap/README.maildirquota.html "Calculating the quota for a Maildir++"
|
||||
*/
|
||||
@ -1001,9 +1001,9 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
$messages += $count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$over_quota = false;
|
||||
$over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']);
|
||||
$over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']);
|
||||
$over_quota = $over_quota || (isset($quota['count']) && $messages > $quota['count']);
|
||||
// NOTE: $maildirsize equals false if it wasn't set (AKA we recalculated) or it's only
|
||||
// one line, because $maildirsize[0] gets unsetted.
|
||||
@ -1015,18 +1015,18 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
$messages = $result['count'];
|
||||
$quota = $result['quota'];
|
||||
$over_quota = false;
|
||||
$over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']);
|
||||
$over_quota = $over_quota || (isset($quota['size']) && $total_size > $quota['size']);
|
||||
$over_quota = $over_quota || (isset($quota['count']) && $messages > $quota['count']);
|
||||
}
|
||||
|
||||
|
||||
if ($fh) {
|
||||
// TODO is there a safe way to keep the handle open for writing?
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
|
||||
return array('size' => $total_size, 'count' => $messages, 'quota' => $quota, 'over_quota' => $over_quota);
|
||||
}
|
||||
|
||||
|
||||
protected function _addQuotaEntry($size, $count = 1) {
|
||||
if (!file_exists($this->_rootdir . 'maildirsize')) {
|
||||
// TODO: should get file handler from _calculateQuota
|
||||
@ -1035,7 +1035,7 @@ class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Mai
|
||||
$count = (int)$count;
|
||||
file_put_contents($this->_rootdir . 'maildirsize', "$size $count\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if storage is currently over quota
|
||||
*
|
||||
|
Reference in New Issue
Block a user