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:
2019-07-17 22:31:04 +02:00
parent 38c146901c
commit 2f397f01f7
2677 changed files with 296182 additions and 45159 deletions

View File

@ -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 $
*/

View File

@ -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
*