Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'upstream/1.4' into 1.4

  • Loading branch information...
commit 07b31612331b7be02ea7c9046a98b1d467a9a546 2 parents 627225f + 75d9b19
@rdavaillaud authored
Showing with 1,763 additions and 871 deletions.
  1. +17 −0 CHANGELOG
  2. +2 −2 lib/autoload/sfAutoloadAgain.class.php
  3. +1 −1  lib/autoload/sfCoreAutoload.class.php
  4. +2 −2 lib/controller/sfController.class.php
  5. +2 −2 lib/database/sfPDODatabase.class.php
  6. +5 −3 lib/debug/sfTimerManager.class.php
  7. +4 −3 lib/exception/sfException.class.php
  8. +23 −1 lib/form/sfForm.class.php
  9. +4 −4 lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php
  10. +14 −8 lib/request/sfWebRequest.class.php
  11. +2 −2 lib/storage/sfPDOSessionStorage.class.php
  12. +18 −6 lib/vendor/swiftmailer/classes/Swift.php
  13. +0 −3  lib/vendor/swiftmailer/classes/Swift/Attachment.php
  14. +1 −4 lib/vendor/swiftmailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php
  15. +0 −2  lib/vendor/swiftmailer/classes/Swift/ByteStream/ArrayByteStream.php
  16. +78 −21 lib/vendor/swiftmailer/classes/Swift/ByteStream/FileByteStream.php
  17. +1 −1  lib/vendor/swiftmailer/classes/Swift/CharacterReader.php
  18. +12 −17 lib/vendor/swiftmailer/classes/Swift/CharacterReader/GenericFixedWidthReader.php
  19. +12 −13 lib/vendor/swiftmailer/classes/Swift/CharacterReader/UsAsciiReader.php
  20. +44 −45 lib/vendor/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php
  21. +0 −1  lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory.php
  22. +36 −22 lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
  23. +0 −2  lib/vendor/swiftmailer/classes/Swift/CharacterStream/ArrayCharacterStream.php
  24. +0 −2  lib/vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php
  25. +0 −1  lib/vendor/swiftmailer/classes/Swift/DependencyContainer.php
  26. +0 −1  lib/vendor/swiftmailer/classes/Swift/DependencyException.php
  27. +0 −3  lib/vendor/swiftmailer/classes/Swift/EmbeddedFile.php
  28. +0 −1  lib/vendor/swiftmailer/classes/Swift/Encoder.php
  29. +0 −1  lib/vendor/swiftmailer/classes/Swift/Encoder/Base64Encoder.php
  30. +44 −11 lib/vendor/swiftmailer/classes/Swift/Encoder/QpEncoder.php
  31. +0 −2  lib/vendor/swiftmailer/classes/Swift/Encoder/Rfc2231Encoder.php
  32. +0 −1  lib/vendor/swiftmailer/classes/Swift/Encoding.php
  33. +0 −2  lib/vendor/swiftmailer/classes/Swift/Events/CommandEvent.php
  34. +0 −2  lib/vendor/swiftmailer/classes/Swift/Events/CommandListener.php
  35. +0 −2  lib/vendor/swiftmailer/classes/Swift/Events/EventDispatcher.php
  36. +0 −1  lib/vendor/swiftmailer/classes/Swift/Events/EventObject.php
  37. +0 −1  lib/vendor/swiftmailer/classes/Swift/Events/ResponseEvent.php
  38. +0 −2  lib/vendor/swiftmailer/classes/Swift/Events/ResponseListener.php
  39. +3 −10 lib/vendor/swiftmailer/classes/Swift/Events/SendEvent.php
  40. +0 −2  lib/vendor/swiftmailer/classes/Swift/Events/SendListener.php
  41. +0 −8 lib/vendor/swiftmailer/classes/Swift/Events/SimpleEventDispatcher.php
  42. +0 −1  lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeEvent.php
  43. +0 −2  lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeListener.php
  44. +0 −2  lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionEvent.php
  45. +0 −2  lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionListener.php
  46. +0 −2  lib/vendor/swiftmailer/classes/Swift/FailoverTransport.php
  47. +100 −6 lib/vendor/swiftmailer/classes/Swift/FileSpool.php
  48. +0 −1  lib/vendor/swiftmailer/classes/Swift/FileStream.php
  49. +0 −1  lib/vendor/swiftmailer/classes/Swift/Filterable.php
  50. +0 −2  lib/vendor/swiftmailer/classes/Swift/Image.php
  51. +0 −1  lib/vendor/swiftmailer/classes/Swift/IoException.php
  52. +0 −2  lib/vendor/swiftmailer/classes/Swift/KeyCache.php
  53. +0 −5 lib/vendor/swiftmailer/classes/Swift/KeyCache/ArrayKeyCache.php
  54. +35 −18 lib/vendor/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.php
  55. +112 −0 lib/vendor/swiftmailer/classes/Swift/KeyCache/DummyKeyCache.php
  56. +0 −2  lib/vendor/swiftmailer/classes/Swift/KeyCache/KeyCacheInputStream.php
  57. +0 −4 lib/vendor/swiftmailer/classes/Swift/KeyCache/NullKeyCache.php
  58. +0 −2  lib/vendor/swiftmailer/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
  59. +0 −2  lib/vendor/swiftmailer/classes/Swift/LoadBalancedTransport.php
  60. +0 −2  lib/vendor/swiftmailer/classes/Swift/MailTransport.php
  61. +20 −75 lib/vendor/swiftmailer/classes/Swift/Mailer.php
  62. +0 −1  lib/vendor/swiftmailer/classes/Swift/Mailer/ArrayRecipientIterator.php
  63. +84 −0 lib/vendor/swiftmailer/classes/Swift/MemorySpool.php
  64. +0 −3  lib/vendor/swiftmailer/classes/Swift/Message.php
  65. +7 −7 lib/vendor/swiftmailer/classes/Swift/Mime/Attachment.php
  66. +0 −3  lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder.php
  67. +0 −4 lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
  68. +0 −3  lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
  69. +24 −6 lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
  70. +3 −6 lib/vendor/swiftmailer/classes/Swift/Mime/EmbeddedFile.php
  71. +0 −1  lib/vendor/swiftmailer/classes/Swift/Mime/EncodingObserver.php
  72. +178 −0 lib/vendor/swiftmailer/classes/Swift/Mime/Grammar.php
  73. +0 −1  lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder.php
  74. +26 −1 lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
  75. +10 −39 lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
  76. +0 −1  lib/vendor/swiftmailer/classes/Swift/Mime/HeaderFactory.php
  77. +0 −1  lib/vendor/swiftmailer/classes/Swift/Mime/HeaderSet.php
  78. +51 −143 lib/vendor/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php
  79. +3 −2 lib/vendor/swiftmailer/classes/Swift/Mime/Headers/DateHeader.php
  80. +26 −21 lib/vendor/swiftmailer/classes/Swift/Mime/Headers/IdentificationHeader.php
  81. +18 −8 lib/vendor/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php
  82. +16 −22 lib/vendor/swiftmailer/classes/Swift/Mime/Headers/ParameterizedHeader.php
  83. +24 −10 lib/vendor/swiftmailer/classes/Swift/Mime/Headers/PathHeader.php
  84. +5 −6 lib/vendor/swiftmailer/classes/Swift/Mime/Headers/UnstructuredHeader.php
  85. +0 −1  lib/vendor/swiftmailer/classes/Swift/Mime/Message.php
  86. +0 −3  lib/vendor/swiftmailer/classes/Swift/Mime/MimeEntity.php
  87. +35 −7 lib/vendor/swiftmailer/classes/Swift/Mime/MimePart.php
  88. +0 −1  lib/vendor/swiftmailer/classes/Swift/Mime/ParameterizedHeader.php
  89. +13 −16 lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php
  90. +0 −2  lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php
  91. +21 −8 lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMessage.php
  92. +73 −14 lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php
  93. +0 −2  lib/vendor/swiftmailer/classes/Swift/MimePart.php
  94. +0 −3  lib/vendor/swiftmailer/classes/Swift/Plugins/AntiFloodPlugin.php
  95. +0 −7 lib/vendor/swiftmailer/classes/Swift/Plugins/BandwidthMonitorPlugin.php
  96. +59 −18 lib/vendor/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php
  97. +68 −0 lib/vendor/swiftmailer/classes/Swift/Plugins/ImpersonatePlugin.php
  98. +0 −10 lib/vendor/swiftmailer/classes/Swift/Plugins/LoggerPlugin.php
  99. +77 −0 lib/vendor/swiftmailer/classes/Swift/Plugins/MessageLogger.php
  100. +0 −1  lib/vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Exception.php
  101. +0 −2  lib/vendor/swiftmailer/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
  102. +0 −1  lib/vendor/swiftmailer/classes/Swift/Plugins/Reporter.php
  103. +0 −3  lib/vendor/swiftmailer/classes/Swift/Plugins/ReporterPlugin.php
  104. +0 −2  lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HitReporter.php
  105. +0 −2  lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HtmlReporter.php
  106. +0 −4 lib/vendor/swiftmailer/classes/Swift/Plugins/ThrottlerPlugin.php
  107. +16 −1 lib/vendor/swiftmailer/classes/Swift/Preferences.php
  108. +0 −1  lib/vendor/swiftmailer/classes/Swift/RfcComplianceException.php
  109. +0 −2  lib/vendor/swiftmailer/classes/Swift/SendmailTransport.php
  110. +0 −2  lib/vendor/swiftmailer/classes/Swift/SmtpTransport.php
  111. +2 −0  lib/vendor/swiftmailer/classes/Swift/Spool.php
  112. +0 −1  lib/vendor/swiftmailer/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
  113. +0 −1  lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilter.php
  114. +0 −2  lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
  115. +1 −3 lib/vendor/swiftmailer/classes/Swift/Transport.php
  116. +32 −16 lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php
  117. +0 −3  lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
  118. +0 −3  lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
  119. +0 −3  lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
  120. +0 −3  lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/AuthHandler.php
  121. +0 −1  lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Authenticator.php
  122. +0 −1  lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpHandler.php
  123. +71 −15 lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpTransport.php
  124. +1 −3 lib/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php
  125. +0 −2  lib/vendor/swiftmailer/classes/Swift/Transport/IoBuffer.php
  126. +2 −5 lib/vendor/swiftmailer/classes/Swift/Transport/LoadBalancedTransport.php
  127. +9 −6 lib/vendor/swiftmailer/classes/Swift/Transport/MailTransport.php
  128. +2 −5 lib/vendor/swiftmailer/classes/Swift/Transport/SendmailTransport.php
  129. +2 −3 lib/vendor/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php
  130. +1 −0  lib/vendor/swiftmailer/classes/Swift/Transport/SpoolTransport.php
  131. +67 −14 lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php
  132. +0 −1  lib/vendor/swiftmailer/classes/Swift/TransportException.php
  133. +38 −0 lib/vendor/swiftmailer/classes/Swift/Validate.php
  134. +9 −0 lib/vendor/swiftmailer/dependency_maps/message_deps.php
  135. +11 −3 lib/vendor/swiftmailer/dependency_maps/mime_deps.php
  136. +5 −3 lib/vendor/swiftmailer/preferences.php
  137. +10 −4 lib/vendor/swiftmailer/swift_init.php
  138. +8 −6 lib/vendor/swiftmailer/swift_required.php
  139. +7 −2 lib/vendor/swiftmailer/swift_required_pear.php
  140. +2 −2 lib/widget/sfWidget.class.php
  141. +2 −2 lib/widget/sfWidgetForm.class.php
  142. +44 −1 test/unit/form/sfFormTest.php
  143. +4 −3 test/unit/request/sfWebRequestTest.php
  144. +2 −1  test/unit/widget/sfWidgetFormTest.php
  145. +2 −1  test/unit/widget/sfWidgetTest.php
View
17 CHANGELOG
@@ -1,6 +1,23 @@
CHANGELOG
=========
+11/25/12: Versions 1.4.20
+-------------------------
+
+ * [33598] fixed the possibility to fake a file upload
+ * [33545] fixed sfPDOSessionStorage for Oracle (closes #10022)
+ * [33544] fixed sfWebRequest::splitHttpAcceptHeader incorrect result order (closes #10069, patch by Keri Henare)
+ * [33539] fixed exception format when using the PHP 5.4 built-in server (closes #10067, based on a patch from jgskin)
+ * [33486] fixed sfPDODatabase::call() method (closes #10044)
+
+10/09/12: Versions 1.4.19
+-------------------------
+
+ * [33545] fixed sfPDOSessionStorage for Oracle (closes #10022)
+ * [33544] fixed sfWebRequest::splitHttpAcceptHeader incorrect result order (closes #10069, patch by Keri Henare)
+ * [33539] fixed exception format when using the PHP 5.4 built-in server (closes #10067, based on a patch from jgskin)
+ * [33486] fixed sfPDODatabase::call() method (closes #10044)
+
05/30/12: Versions 1.4.18
-------------------------
View
4 lib/autoload/sfAutoloadAgain.class.php
@@ -14,7 +14,7 @@
* @package symfony
* @subpackage autoload
* @author Kris Wallsmith <kris.wallsmith@symfony-project.com>
- * @version SVN: $Id: sfAutoloadAgain.class.php 22248 2009-09-22 17:15:16Z fabien $
+ * @version SVN: $Id: sfAutoloadAgain.class.php 33561 2012-10-18 11:42:28Z fabien $
*/
class sfAutoloadAgain
{
@@ -69,7 +69,7 @@ public function autoload($class)
{
foreach ($autoloads as $position => $autoload)
{
- if ($this === $autoload[0])
+ if (is_array($autoload) && $this === $autoload[0])
{
break;
}
View
2  lib/autoload/sfCoreAutoload.class.php
@@ -11,7 +11,7 @@
/**
* The current symfony version.
*/
-define('SYMFONY_VERSION', '1.4.18');
+define('SYMFONY_VERSION', '1.4.20');
/**
* sfCoreAutoload class.
View
4 lib/controller/sfController.class.php
@@ -16,7 +16,7 @@
* @subpackage controller
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
- * @version SVN: $Id: sfController.class.php 30912 2010-09-15 11:10:46Z fabien $
+ * @version SVN: $Id: sfController.class.php 33539 2012-09-19 05:36:02Z fabien $
*/
abstract class sfController
{
@@ -489,7 +489,7 @@ public function setRenderMode($mode)
*/
public function inCLI()
{
- return 0 == strncasecmp(PHP_SAPI, 'cli', 3);
+ return 'cli' == PHP_SAPI;
}
/**
View
4 lib/database/sfPDODatabase.class.php
@@ -18,7 +18,7 @@
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
* @author Dustin Whittle <dustin.whittle@symfony-project.com>
- * @version SVN: $Id: sfPDODatabase.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
+ * @version SVN: $Id: sfPDODatabase.class.php 33486 2012-07-09 08:57:29Z fabien $
*/
class sfPDODatabase extends sfDatabase
{
@@ -109,6 +109,6 @@ public function shutdown()
*/
public function __call($method, $arguments)
{
- return $this->getConnection()->$method($arguments);
+ return call_user_func_array(array($this->getConnection(), $method), $arguments);
}
}
View
8 lib/debug/sfTimerManager.class.php
@@ -14,7 +14,7 @@
* @package symfony
* @subpackage util
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
- * @version SVN: $Id: sfTimerManager.class.php 13339 2008-11-25 14:58:05Z fabien $
+ * @version SVN: $Id: sfTimerManager.class.php 33570 2012-10-25 09:44:55Z fabien $
*/
class sfTimerManager
{
@@ -29,14 +29,16 @@ class sfTimerManager
*
* @return sfTimer The timer instance
*/
- public static function getTimer($name)
+ public static function getTimer($name,$reset=true)
{
if (!isset(self::$timers[$name]))
{
self::$timers[$name] = new sfTimer($name);
}
- self::$timers[$name]->startTimer();
+ if($reset){
+ self::$timers[$name]->startTimer();
+ }
return self::$timers[$name];
}
View
7 lib/exception/sfException.class.php
@@ -18,7 +18,7 @@
* @subpackage exception
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
- * @version SVN: $Id: sfException.class.php 33214 2011-11-19 13:47:24Z fabien $
+ * @version SVN: $Id: sfException.class.php 33539 2012-09-19 05:36:02Z fabien $
*/
class sfException extends Exception
{
@@ -195,8 +195,9 @@ static protected function outputStackTrace(Exception $exception)
}
}
- // when using CLI, we force the format to be TXT
- if (0 == strncasecmp(PHP_SAPI, 'cli', 3))
+ // when using CLI, we force the format to be TXT. Compare exactly to
+ // the string 'cli' because the php 5.4 server is identified by 'cli-server'
+ if ('cli' == PHP_SAPI)
{
$format = 'txt';
}
View
24 lib/form/sfForm.class.php
@@ -23,7 +23,7 @@
* @package symfony
* @subpackage form
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
- * @version SVN: $Id: sfForm.class.php 29678 2010-05-30 14:38:42Z Kris.Wallsmith $
+ * @version SVN: $Id: sfForm.class.php 33598 2012-11-25 09:57:29Z fabien $
*/
class sfForm implements ArrayAccess, Iterator, Countable
{
@@ -222,6 +222,8 @@ public function bind(array $taintedValues = null, array $taintedFiles = null)
$this->taintedFiles = array();
}
+ $this->checkTaintedValues($this->taintedValues);
+
try
{
$this->doBind(self::deepArrayUnion($this->taintedValues, self::convertFileInformation($this->taintedFiles)));
@@ -1336,4 +1338,24 @@ static protected function deepArrayUnion($array1, $array2)
return $array1;
}
+
+ /**
+ * Checks that the $_POST values do not contain something that
+ * looks like a file upload (coming from $_FILE).
+ */
+ protected function checkTaintedValues($values)
+ {
+ foreach ($values as $name => $value)
+ {
+ if (!is_array($value)) {
+ continue;
+ }
+
+ if (isset($value['tmp_name'])) {
+ throw new InvalidArgumentException('Do not try to fake a file upload.');
+ }
+
+ $this->checkTaintedValues($value);
+ }
+ }
}
View
8 lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php
@@ -6,7 +6,7 @@
* @package sfDoctrinePlugin
* @subpackage database
* @author Kris Wallsmith <kris.wallsmith@symfony-project.com>
- * @version SVN: $Id: sfDoctrineConnectionProfiler.class.php 20157 2009-07-13 17:00:12Z Kris.Wallsmith $
+ * @version SVN: $Id: sfDoctrineConnectionProfiler.class.php 33570 2012-10-25 09:44:55Z fabien $
*/
class sfDoctrineConnectionProfiler extends Doctrine_Connection_Profiler
{
@@ -82,7 +82,7 @@ public function preQuery(Doctrine_Event $event)
*/
public function postQuery(Doctrine_Event $event)
{
- sfTimerManager::getTimer('Database (Doctrine)')->addTime();
+ sfTimerManager::getTimer('Database (Doctrine)',false)->addTime();
$args = func_get_args();
$this->__call(__FUNCTION__, $args);
@@ -118,7 +118,7 @@ public function preExec(Doctrine_Event $event)
*/
public function postExec(Doctrine_Event $event)
{
- sfTimerManager::getTimer('Database (Doctrine)')->addTime();
+ sfTimerManager::getTimer('Database (Doctrine)',false)->addTime();
$args = func_get_args();
$this->__call(__FUNCTION__, $args);
@@ -154,7 +154,7 @@ public function preStmtExecute(Doctrine_Event $event)
*/
public function postStmtExecute(Doctrine_Event $event)
{
- sfTimerManager::getTimer('Database (Doctrine)')->addTime();
+ sfTimerManager::getTimer('Database (Doctrine)',false)->addTime();
$args = func_get_args();
$this->__call(__FUNCTION__, $args);
View
22 lib/request/sfWebRequest.class.php
@@ -18,7 +18,7 @@
* @subpackage request
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
- * @version SVN: $Id: sfWebRequest.class.php 32729 2011-07-05 15:23:04Z www-data $
+ * @version SVN: $Id: sfWebRequest.class.php 33544 2012-10-05 10:42:42Z fabien $
*/
class sfWebRequest extends sfRequest
{
@@ -633,12 +633,13 @@ public function setRelativeUrlRoot($value)
public function splitHttpAcceptHeader($header)
{
$values = array();
+ $groups = array();
foreach (array_filter(explode(',', $header)) as $value)
{
// Cut off any q-value that might come after a semi-colon
if ($pos = strpos($value, ';'))
{
- $q = (float) trim(substr($value, strpos($value, '=') + 1));
+ $q = trim(substr($value, strpos($value, '=') + 1));
$value = substr($value, 0, $pos);
}
else
@@ -646,15 +647,20 @@ public function splitHttpAcceptHeader($header)
$q = 1;
}
- if (0 < $q)
- {
- $values[trim($value)] = $q;
- }
+ $groups[$q][] = $value;
}
- arsort($values);
+ krsort($groups);
+
+ foreach ($groups as $q => $items) {
+ if (0 < $q) {
+ foreach ($items as $value) {
+ $values[] = trim($value);
+ }
+ }
+ }
- return array_keys($values);
+ return $values;
}
/**
View
4 lib/storage/sfPDOSessionStorage.class.php
@@ -19,7 +19,7 @@
* @author Mathew Toth <developer@poetryleague.com>
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
- * @version SVN: $Id: sfPDOSessionStorage.class.php 13143 2008-11-18 22:22:01Z FabianLange $
+ * @version SVN: $Id: sfPDOSessionStorage.class.php 33545 2012-10-05 10:49:45Z fabien $
*/
class sfPDOSessionStorage extends sfDatabaseSessionStorage
{
@@ -115,7 +115,7 @@ public function sessionRead($id)
$sessionRows = $stmt->fetchAll(PDO::FETCH_NUM);
if (count($sessionRows) == 1)
{
- return $sessionRows[0][0];
+ return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0];
}
else
{
View
24 lib/vendor/swiftmailer/classes/Swift.php
@@ -18,8 +18,11 @@
abstract class Swift
{
+ static $initialized = false;
+ static $initPath;
+
/** Swift Mailer Version number generated during dist release process */
- const VERSION = '4.1.0-DEV';
+ const VERSION = '4.1.8';
/**
* Internal autoloader for spl_autoload_register().
@@ -29,28 +32,37 @@
public static function autoload($class)
{
//Don't interfere with other autoloaders
- if (0 !== strpos($class, 'Swift'))
+ if (0 !== strpos($class, 'Swift_'))
{
- return false;
+ return;
}
$path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';
if (!file_exists($path))
{
- return false;
+ return;
+ }
+
+ if (self::$initPath && !self::$initialized)
+ {
+ self::$initialized = true;
+ require self::$initPath;
}
- require_once $path;
+ require $path;
}
/**
* Configure autoloading using Swift Mailer.
*
* This is designed to play nicely with other autoloaders.
+ *
+ * @param string $initPath The init script to load when autoloading the first Swift class
*/
- public static function registerAutoload()
+ public static function registerAutoload($initPath = null)
{
+ self::$initPath = $initPath;
spl_autoload_register(array('Swift', 'autoload'));
}
View
3  lib/vendor/swiftmailer/classes/Swift/Attachment.php
@@ -8,9 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Mime/Attachment.php';
-//@require 'Swift/ByteStream/FileByteStream.php';
-//@require 'Swift/DependencyContainer.php';
/**
* Attachment class for attaching files to a {@link Swift_Mime_Message}.
View
5 lib/vendor/swiftmailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php
@@ -8,9 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/InputByteStream.php';
-//@require 'Swift/Filterable.php';
-//@require 'Swift/StreamFilter.php';
/**
* Provides the base functionality for an InputStream supporting filters.
@@ -23,7 +20,7 @@
{
/** Write sequence */
- private $_sequence = 0;
+ protected $_sequence = 0;
/** StreamFilters */
private $_filters = array();
View
2  lib/vendor/swiftmailer/classes/Swift/ByteStream/ArrayByteStream.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/InputByteStream.php';
-//@require 'Swift/OutputByteStream.php';
/**
* Allows reading and writing of bytes to and from an array.
View
99 lib/vendor/swiftmailer/classes/Swift/ByteStream/FileByteStream.php
@@ -8,10 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/ByteStream/AbstractFilterableInputStream.php';
-//@require 'Swift/InputByteStream.php';
-//@require 'Swift/FileStream.php';
-//@require 'Swift/IoException.php';
/**
* Allows reading and writing of bytes to and from a file.
@@ -41,6 +37,9 @@ class Swift_ByteStream_FileByteStream
/** If magic_quotes_runtime is on, this will be true */
private $_quotes = false;
+
+ /** If stream is seekable true/false, or null if not known */
+ private $_seekable = null;
/**
* Create a new FileByteStream for $path.
@@ -51,7 +50,11 @@ public function __construct($path, $writable = false)
{
$this->_path = $path;
$this->_mode = $writable ? 'w+b' : 'rb';
- $this->_quotes = get_magic_quotes_runtime();
+
+ if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1)
+ {
+ $this->_quotes = true;
+ }
}
/**
@@ -79,18 +82,19 @@ public function read($length)
{
if ($this->_quotes)
{
- set_magic_quotes_runtime(0);
+ ini_set('magic_quotes_runtime', 0);
}
$bytes = fread($fp, $length);
if ($this->_quotes)
{
- set_magic_quotes_runtime(1);
+ ini_set('magic_quotes_runtime', 1);
}
$this->_offset = ftell($fp);
return $bytes;
}
else
{
+ $this->_resetReadHandle();
return false;
}
}
@@ -104,7 +108,7 @@ public function setReadPointer($byteOffset)
{
if (isset($this->_reader))
{
- fseek($this->_reader, $byteOffset, SEEK_SET);
+ $this->_seekReadStreamToPosition($byteOffset);
}
$this->_offset = $byteOffset;
}
@@ -132,9 +136,13 @@ private function _getReadHandle()
{
throw new Swift_IoException(
'Unable to open file for reading [' . $this->_path . ']'
- );
+ );
+ }
+ if ($this->_offset <> 0)
+ {
+ $this->_getReadStreamSeekableStatus();
+ $this->_seekReadStreamToPosition($this->_offset);
}
- fseek($this->_reader, $this->_offset, SEEK_SET);
}
return $this->_reader;
}
@@ -148,22 +156,12 @@ private function _getWriteHandle()
{
throw new Swift_IoException(
'Unable to open file for writing [' . $this->_path . ']'
- );
+ );
}
}
return $this->_writer;
}
- /** Force a reload of the resource for writing */
- private function _resetWriteHandle()
- {
- if (isset($this->_writer))
- {
- fclose($this->_writer);
- $this->_writer = null;
- }
- }
-
/** Force a reload of the resource for reading */
private function _resetReadHandle()
{
@@ -174,4 +172,63 @@ private function _resetReadHandle()
}
}
+ /** Check if ReadOnly Stream is seekable */
+ private function _getReadStreamSeekableStatus()
+ {
+ $metas = stream_get_meta_data($this->_reader);
+ $this->_seekable = $metas['seekable'];
+ }
+
+ /** Streams in a readOnly stream ensuring copy if needed */
+ private function _seekReadStreamToPosition($offset)
+ {
+ if ($this->_seekable===null)
+ {
+ $this->_getReadStreamSeekableStatus();
+ }
+ if ($this->_seekable === false)
+ {
+ $currentPos = ftell($this->_reader);
+ if ($currentPos<$offset)
+ {
+ $toDiscard = $offset-$currentPos;
+ fread($this->_reader, $toDiscard);
+ return;
+ }
+ $this->_copyReadStream();
+ }
+ fseek($this->_reader, $offset, SEEK_SET);
+ }
+
+ /** Copy a readOnly Stream to ensure seekability */
+ private function _copyReadStream()
+ {
+ if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b'))
+ {
+ /* We have opened a php:// Stream Should work without problem */
+ }
+ elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile()))
+ {
+ /* We have opened a tmpfile */
+ }
+ else
+ {
+ throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available');
+ }
+ $currentPos = ftell($this->_reader);
+ fclose($this->_reader);
+ $source = fopen($this->_path, 'rb');
+ if (!$source)
+ {
+ throw new Swift_IoException('Unable to open file for copying [' . $this->_path . ']');
+ }
+ fseek($tmpFile, 0, SEEK_SET);
+ while (!feof($source))
+ {
+ fwrite($tmpFile, fread($source, 4096));
+ }
+ fseek($tmpFile, $currentPos, SEEK_SET);
+ fclose($source);
+ $this->_reader = $tmpFile;
+ }
}
View
2  lib/vendor/swiftmailer/classes/Swift/CharacterReader.php
@@ -34,7 +34,7 @@ public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredC
/**
* Returns mapType
- * @int mapType
+ * @return int mapType
*/
public function getMapType();
View
29 lib/vendor/swiftmailer/classes/Swift/CharacterReader/GenericFixedWidthReader.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/CharacterReader.php';
/**
* Provides fixed-width byte sizes for reading fixed-width character sets.
@@ -20,14 +19,13 @@
class Swift_CharacterReader_GenericFixedWidthReader
implements Swift_CharacterReader
{
-
/**
* The number of bytes in a single character.
* @var int
* @access private
*/
private $_width;
-
+
/**
* Creates a new GenericFixedWidthReader using $width bytes per character.
* @param int $width
@@ -48,22 +46,22 @@ public function __construct($width)
*/
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
- $strlen = strlen($string);
- // % and / are CPU intensive, so, maybe find a better way
- $ignored = $strlen%$this->_width;
- $ignoredChars = substr($string, - $ignored);
- $currentMap = $this->_width;
- return ($strlen - $ignored)/$this->_width;
-
+ $strlen = strlen($string);
+ // % and / are CPU intensive, so, maybe find a better way
+ $ignored = $strlen%$this->_width;
+ $ignoredChars = substr($string, - $ignored);
+ $currentMap = $this->_width;
+
+ return ($strlen - $ignored)/$this->_width;
}
/**
* Returns mapType
- * @int mapType
+ * @return int mapType
*/
public function getMapType()
{
- return self::MAP_TYPE_FIXED_LEN;
+ return self::MAP_TYPE_FIXED_LEN;
}
/**
@@ -78,10 +76,8 @@ public function getMapType()
public function validateByteSequence($bytes, $size)
{
$needed = $this->_width - $size;
- return ($needed > -1)
- ? $needed
- : -1
- ;
+
+ return ($needed > -1) ? $needed : -1;
}
/**
@@ -92,5 +88,4 @@ public function getInitialByteSize()
{
return $this->_width;
}
-
}
View
25 lib/vendor/swiftmailer/classes/Swift/CharacterReader/UsAsciiReader.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/CharacterReader.php';
/**
* Analyzes US-ASCII characters.
@@ -28,25 +27,25 @@ class Swift_CharacterReader_UsAsciiReader
*/
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
- $strlen=strlen($string);
- $ignoredChars='';
- for( $i = 0; $i < $strlen; ++$i)
- {
- if ($string[$i]>"\x07F")
- { // Invalid char
- $currentMap[$i+$startOffset]=$string[$i];
- }
- }
- return $strlen;
+ $strlen=strlen($string);
+ $ignoredChars='';
+ for( $i = 0; $i < $strlen; ++$i)
+ {
+ if ($string[$i]>"\x07F")
+ { // Invalid char
+ $currentMap[$i+$startOffset]=$string[$i];
+ }
+ }
+ return $strlen;
}
/**
* Returns mapType
- * @int mapType
+ * @return int mapType
*/
public function getMapType()
{
- return self::MAP_TYPE_INVALID;
+ return self::MAP_TYPE_INVALID;
}
/**
View
89 lib/vendor/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/CharacterReader.php';
/**
* Analyzes UTF-8 characters.
@@ -86,40 +85,40 @@ class Swift_CharacterReader_Utf8Reader
*/
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
- if (!isset($currentMap['i']) || !isset($currentMap['p']))
- {
- $currentMap['p'] = $currentMap['i'] = array();
- }
- $strlen=strlen($string);
- $charPos=count($currentMap['p']);
- $foundChars=0;
- $invalid=false;
- for ($i=0; $i<$strlen; ++$i)
- {
- $char=$string[$i];
- $size=self::$s_length_map[$char];
- if ($size==0)
- {
- /* char is invalid, we must wait for a resync */
- $invalid=true;
- continue;
- }
- else
- {
- if ($invalid==true)
- {
- /* We mark the chars as invalid and start a new char */
- $currentMap['p'][$charPos+$foundChars]=$startOffset+$i;
- $currentMap['i'][$charPos+$foundChars]=true;
- ++$foundChars;
- $invalid=false;
- }
- if (($i+$size) > $strlen){
- $ignoredChars=substr($string, $i);
- break;
- }
- for ($j=1; $j<$size; ++$j)
- {
+ if (!isset($currentMap['i']) || !isset($currentMap['p']))
+ {
+ $currentMap['p'] = $currentMap['i'] = array();
+ }
+ $strlen=strlen($string);
+ $charPos=count($currentMap['p']);
+ $foundChars=0;
+ $invalid=false;
+ for ($i=0; $i<$strlen; ++$i)
+ {
+ $char=$string[$i];
+ $size=self::$s_length_map[$char];
+ if ($size==0)
+ {
+ /* char is invalid, we must wait for a resync */
+ $invalid=true;
+ continue;
+ }
+ else
+ {
+ if ($invalid==true)
+ {
+ /* We mark the chars as invalid and start a new char */
+ $currentMap['p'][$charPos+$foundChars]=$startOffset+$i;
+ $currentMap['i'][$charPos+$foundChars]=true;
+ ++$foundChars;
+ $invalid=false;
+ }
+ if (($i+$size) > $strlen){
+ $ignoredChars=substr($string, $i);
+ break;
+ }
+ for ($j=1; $j<$size; ++$j)
+ {
$char=$string[$i+$j];
if ($char>"\x7F" && $char<"\xC0")
{
@@ -131,23 +130,23 @@ public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredC
$invalid=true;
continue 2;
}
- }
- /* Ok we got a complete char here */
- $lastChar=$currentMap['p'][$charPos+$foundChars]=$startOffset+$i+$size;
- $i+=$j-1;
- ++$foundChars;
- }
- }
- return $foundChars;
+ }
+ /* Ok we got a complete char here */
+ $currentMap['p'][$charPos+$foundChars]=$startOffset+$i+$size;
+ $i+=$j-1;
+ ++$foundChars;
+ }
+ }
+ return $foundChars;
}
/**
* Returns mapType
- * @int mapType
+ * @return int mapType
*/
public function getMapType()
{
- return self::MAP_TYPE_POSITIONS;
+ return self::MAP_TYPE_POSITIONS;
}
/**
View
1  lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/CharacterReader.php';
/**
* A factory for creating CharacterReaders.
View
58 lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/CharacterReaderFactory.php';
/**
* Standard factory for creating CharacterReaders.
@@ -25,20 +24,35 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory
* @var array
* @access private
*/
- private $_map = array();
+ private static $_map = array();
/**
* Factories which have already been loaded.
* @var Swift_CharacterReaderFactory[]
* @access private
*/
- private $_loaded = array();
+ private static $_loaded = array();
/**
* Creates a new CharacterReaderFactory.
*/
public function __construct()
{
+ $this->init();
+ }
+
+ public function __wakeup()
+ {
+ $this->init();
+ }
+
+ public function init()
+ {
+ if(count(self::$_map) > 0)
+ {
+ return;
+ }
+
$prefix = 'Swift_CharacterReader_';
$singleByte = array(
@@ -57,32 +71,32 @@ public function __construct()
);
//Utf-8
- $this->_map['utf-?8'] = array(
+ self::$_map['utf-?8'] = array(
'class' => $prefix . 'Utf8Reader',
'constructor' => array()
);
//7-8 bit charsets
- $this->_map['(us-)?ascii'] = $singleByte;
- $this->_map['(iso|iec)-?8859-?[0-9]+'] = $singleByte;
- $this->_map['windows-?125[0-9]'] = $singleByte;
- $this->_map['cp-?[0-9]+'] = $singleByte;
- $this->_map['ansi'] = $singleByte;
- $this->_map['macintosh'] = $singleByte;
- $this->_map['koi-?7'] = $singleByte;
- $this->_map['koi-?8-?.+'] = $singleByte;
- $this->_map['mik'] = $singleByte;
- $this->_map['(cork|t1)'] = $singleByte;
- $this->_map['v?iscii'] = $singleByte;
+ self::$_map['(us-)?ascii'] = $singleByte;
+ self::$_map['(iso|iec)-?8859-?[0-9]+'] = $singleByte;
+ self::$_map['windows-?125[0-9]'] = $singleByte;
+ self::$_map['cp-?[0-9]+'] = $singleByte;
+ self::$_map['ansi'] = $singleByte;
+ self::$_map['macintosh'] = $singleByte;
+ self::$_map['koi-?7'] = $singleByte;
+ self::$_map['koi-?8-?.+'] = $singleByte;
+ self::$_map['mik'] = $singleByte;
+ self::$_map['(cork|t1)'] = $singleByte;
+ self::$_map['v?iscii'] = $singleByte;
//16 bits
- $this->_map['(ucs-?2|utf-?16)'] = $doubleByte;
+ self::$_map['(ucs-?2|utf-?16)'] = $doubleByte;
//32 bits
- $this->_map['(ucs-?4|utf-?32)'] = $fourBytes;
+ self::$_map['(ucs-?4|utf-?32)'] = $fourBytes;
//Fallback
- $this->_map['.*'] = $singleByte;
+ self::$_map['.*'] = $singleByte;
}
/**
@@ -93,12 +107,12 @@ public function __construct()
public function getReaderFor($charset)
{
$charset = trim(strtolower($charset));
- foreach ($this->_map as $pattern => $spec)
+ foreach (self::$_map as $pattern => $spec)
{
$re = '/^' . $pattern . '$/D';
if (preg_match($re, $charset))
{
- if (!array_key_exists($pattern, $this->_loaded))
+ if (!array_key_exists($pattern, self::$_loaded))
{
$reflector = new ReflectionClass($spec['class']);
if ($reflector->getConstructor())
@@ -109,9 +123,9 @@ public function getReaderFor($charset)
{
$reader = $reflector->newInstance();
}
- $this->_loaded[$pattern] = $reader;
+ self::$_loaded[$pattern] = $reader;
}
- return $this->_loaded[$pattern];
+ return self::$_loaded[$pattern];
}
}
}
View
2  lib/vendor/swiftmailer/classes/Swift/CharacterStream/ArrayCharacterStream.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/CharacterStream.php';
-//@require 'Swift/OutputByteStream.php';
/**
View
2  lib/vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php
@@ -18,8 +18,6 @@
*/
-//@require 'Swift/CharacterStream.php';
-//@require 'Swift/OutputByteStream.php';
/**
View
1  lib/vendor/swiftmailer/classes/Swift/DependencyContainer.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/DependencyException.php';
/**
* Dependency Injection container.
View
1  lib/vendor/swiftmailer/classes/Swift/DependencyException.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/SwiftException.php';
/**
* DependencyException thrown when a requested dependeny is missing.
View
3  lib/vendor/swiftmailer/classes/Swift/EmbeddedFile.php
@@ -8,9 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Mime/Attachment.php';
-//@require 'Swift/DependencyContainer.php';
-//@require 'Swift/ByteStream/FileByteStream.php';
/**
* An embedded file, in a multipart message.
View
1  lib/vendor/swiftmailer/classes/Swift/Encoder.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Mime/CharsetObserver.php';
/**
* Interface for all Encoder schemes.
View
1  lib/vendor/swiftmailer/classes/Swift/Encoder/Base64Encoder.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Encoder.php';
/**
* Handles Base 64 Encoding in Swift Mailer.
View
55 lib/vendor/swiftmailer/classes/Swift/Encoder/QpEncoder.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Encoder.php';
-//@require 'Swift/CharacterStream.php';
/**
* Handles Quoted Printable (QP) Encoding in Swift Mailer.
@@ -95,12 +93,14 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
255 => '=FF'
);
+ protected static $_safeMapShare = array();
+
/**
* A map of non-encoded ascii characters.
* @var string[]
* @access protected
*/
- protected static $_safeMap = array();
+ protected $_safeMap = array();
/**
* Creates a new QpEncoder for the given CharacterStream.
@@ -111,17 +111,50 @@ public function __construct(Swift_CharacterStream $charStream,
Swift_StreamFilter $filter = null)
{
$this->_charStream = $charStream;
- if (empty(self::$_safeMap))
+ if(!isset(self::$_safeMapShare[$this->getSafeMapShareId()]))
{
- foreach (array_merge(
- array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte)
- {
- self::$_safeMap[$byte] = chr($byte);
- }
+ $this->initSafeMap();
+ self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap;
+ }
+ else
+ {
+ $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()];
}
$this->_filter = $filter;
}
+ public function __sleep()
+ {
+ return array('_charStream', '_filter');
+ }
+
+ public function __wakeup()
+ {
+ if(!isset(self::$_safeMapShare[$this->getSafeMapShareId()]))
+ {
+ $this->initSafeMap();
+ self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap;
+ }
+ else
+ {
+ $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()];
+ }
+ }
+
+ protected function getSafeMapShareId()
+ {
+ return get_class($this);
+ }
+
+ protected function initSafeMap()
+ {
+ foreach (array_merge(
+ array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte)
+ {
+ $this->_safeMap[$byte] = chr($byte);
+ }
+ }
+
/**
* Takes an unencoded string and produces a QP encoded string from it.
* QP encoded strings have a maximum line length of 76 characters.
@@ -215,9 +248,9 @@ protected function _encodeByteSequence(array $bytes, &$size)
$size=0;
foreach ($bytes as $b)
{
- if (isset(self::$_safeMap[$b]))
+ if (isset($this->_safeMap[$b]))
{
- $ret .= self::$_safeMap[$b];
+ $ret .= $this->_safeMap[$b];
++$size;
}
else
View
2  lib/vendor/swiftmailer/classes/Swift/Encoder/Rfc2231Encoder.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Encoder.php';
-//@require 'Swift/CharacterStream.php';
/**
* Handles RFC 2231 specified Encoding in Swift Mailer.
View
1  lib/vendor/swiftmailer/classes/Swift/Encoding.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/DependencyContainer.php';
/**
* Provides quick access to each encoding type.
View
2  lib/vendor/swiftmailer/classes/Swift/Events/CommandEvent.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventObject.php';
-//@require 'Swift/Transport.php';
/**
* Generated when a command is sent over an SMTP connection.
View
2  lib/vendor/swiftmailer/classes/Swift/Events/CommandListener.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventListener.php';
-//@require 'Swift/Events/CommandEvent.php';
/**
* Listens for Transports to send commands to the server.
View
2  lib/vendor/swiftmailer/classes/Swift/Events/EventDispatcher.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventListener.php';
-//@require 'Swift/Event.php';
/**
* Interface for the EventDispatcher which handles the event dispatching layer.
View
1  lib/vendor/swiftmailer/classes/Swift/Events/EventObject.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/Event.php';
/**
* A base Event which all Event classes inherit from.
View
1  lib/vendor/swiftmailer/classes/Swift/Events/ResponseEvent.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventObject.php';
/**
* Generated when a response is received on a SMTP connection.
View
2  lib/vendor/swiftmailer/classes/Swift/Events/ResponseListener.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventListener.php';
-//@require 'Swift/Events/ResponseEvent.php';
/**
* Listens for responses from a remote SMTP server.
View
13 lib/vendor/swiftmailer/classes/Swift/Events/SendEvent.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventObject.php';
/**
* Generated when a message is being sent.
@@ -38,22 +37,16 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
private $_message;
/**
- * The Transport used in sending.
- * @var Swift_Transport
- */
- private $_transport;
-
- /**
* Any recipients which failed after sending.
* @var string[]
*/
- private $failedRecipients = array();
+ private $_failedRecipients = array();
/**
* The overall result as a bitmask from the class constants.
* @var int
*/
- private $result;
+ private $_result;
/**
* Create a new SendEvent for $source and $message.
@@ -124,4 +117,4 @@ public function getResult()
return $this->_result;
}
-}
+}
View
2  lib/vendor/swiftmailer/classes/Swift/Events/SendListener.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventListener.php';
-//@require 'Swift/Events/SendEvent.php';
/**
* Listens for Messages being sent from within the Transport system.
View
8 lib/vendor/swiftmailer/classes/Swift/Events/SimpleEventDispatcher.php
@@ -8,14 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventDispatcher.php';
-//@require 'Swift/Events/EventListener.php';
-//@require 'Swift/Events/EventObject.php';
-//@require 'Swift/Events/CommandEvent.php';
-//@require 'Swift/Events/ResponseEvent.php';
-//@require 'Swift/Events/SendEvent.php';
-//@require 'Swift/Events/TransportChangeEvent.php';
-//@require 'Swift/Events/TransportExceptionEvent.php';
/**
* The EventDispatcher which handles the event dispatching layer.
View
1  lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeEvent.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventObject.php';
/**
* Generated when the state of a Transport is changed (i.e. stopped/started).
View
2  lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeListener.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventListener.php';
-//@require 'Swift/Events/TransportChangeEvent.php';
/**
* Listens for changes within the Transport system.
View
2  lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionEvent.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventObject.php';
-//@require 'Swift/TransportException.php';
/**
* Generated when a TransportException is thrown from the Transport system.
View
2  lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionListener.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Events/EventListener.php';
-//@require 'Swift/Events/TransportExceptionEvent.php';
/**
* Listens for Exceptions thrown from within the Transport system.
View
2  lib/vendor/swiftmailer/classes/Swift/FailoverTransport.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Transport/FailoverTransport.php';
-//@require 'Swift/DependencyContainer.php';
/**
* Contains a list of redundant Transports so when one fails, the next is used.
View
106 lib/vendor/swiftmailer/classes/Swift/FileSpool.php
@@ -12,6 +12,7 @@
* Stores Messages on the filesystem.
* @package Swift
* @author Fabien Potencier
+ * @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_FileSpool extends Swift_ConfigurableSpool
{
@@ -19,8 +20,15 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
private $_path;
/**
+ * File WriteRetry Limit
+ * @var int
+ */
+ private $_retryLimit=10;
+
+ /**
* Create a new FileSpool.
* @param string $path
+ * @throws Swift_IoException
*/
public function __construct($path)
{
@@ -28,7 +36,10 @@ public function __construct($path)
if (!file_exists($this->_path))
{
- mkdir($this->_path, 0777, true);
+ if (!mkdir($this->_path, 0777, true))
+ {
+ throw new Swift_IoException('Unable to create Path ['.$this->_path.']');
+ }
}
}
@@ -57,14 +68,72 @@ public function stop()
}
/**
+ * Allow to manage the enqueuing retry limit.
+ * Default, is ten and allows over 64^20 different fileNames
+ *
+ * @param integer $limit
+ */
+ public function setRetryLimit($limit)
+ {
+ $this->_retryLimit=$limit;
+ }
+
+ /**
* Queues a message.
* @param Swift_Mime_Message $message The message to store
+ * @return boolean
+ * @throws Swift_IoException
*/
public function queueMessage(Swift_Mime_Message $message)
{
$ser = serialize($message);
+ $fileName=$this->_path.'/'.$this->getRandomString(10);
+ for ($i = 0; $i < $this->_retryLimit; ++$i)
+ {
+ /* We try an exclusive creation of the file
+ * This is an atomic operation, it avoid locking mechanism
+ */
+ $fp = @fopen($fileName.'.message', 'x');
+ if (false !== $fp)
+ {
+ if (false === fwrite($fp, $ser))
+ {
+ return false;
+ }
+
+ return fclose($fp);
+ }
+ else
+ {
+ /* The file allready exists, we try a longer fileName
+ */
+ $fileName.=$this->getRandomString(1);
+ }
+ }
- file_put_contents($this->_path.'/'.md5($ser.uniqid()).'.message', $ser);
+ throw new Swift_IoException('Unable to create a file for enqueuing Message');
+ }
+
+ /**
+ * Execute a recovery if for anyreason a process is sending for too long
+ *
+ * @param int $timeout in second Defaults is for very slow smtp responses
+ */
+ public function recover($timeout=900)
+ {
+ foreach (new DirectoryIterator($this->_path) as $file)
+ {
+ $file = $file->getRealPath();
+
+ if (substr($file, -16)=='.message.sending')
+ {
+ $lockedtime=filectime($file);
+ if ((time()-$lockedtime)>$timeout)
+ {
+ rename($file, substr($file, 0, -8));
+ }
+ }
+ }
}
/**
@@ -89,16 +158,25 @@ public function flushQueue(Swift_Transport $transport, &$failedRecipients = null
{
$file = $file->getRealPath();
- if (!strpos($file, '.message'))
+ if (substr($file, -8) != '.message')
{
continue;
}
- $message = unserialize(file_get_contents($file));
+ /* We try a rename, it's an atomic operation, and avoid locking the file */
+ if (rename($file, $file.'.sending'))
+ {
+ $message = unserialize(file_get_contents($file.'.sending'));
- $count += $transport->send($message, $failedRecipients);
+ $count += $transport->send($message, $failedRecipients);
- unlink($file);
+ unlink($file.'.sending');
+ }
+ else
+ {
+ /* This message has just been catched by another process */
+ continue;
+ }
if ($this->getMessageLimit() && $count >= $this->getMessageLimit())
{
@@ -113,4 +191,20 @@ public function flushQueue(Swift_Transport $transport, &$failedRecipients = null
return $count;
}
+
+ /**
+ * Returns a random string needed to generate a fileName for the queue.
+ * @param int $count
+ */
+ protected function getRandomString($count) {
+ // This string MUST stay FS safe, avoid special chars
+ $base="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.";
+ $ret='';
+ $strlen=strlen($base);
+ for ($i=0; $i<$count; ++$i)
+ {
+ $ret.=$base[((int)rand(0,$strlen-1))];
+ }
+ return $ret;
+ }
}
View
1  lib/vendor/swiftmailer/classes/Swift/FileStream.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/OutputByteStream.php';
/**
* An OutputByteStream which specifically reads from a file.
View
1  lib/vendor/swiftmailer/classes/Swift/Filterable.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/StreamFilter.php';
/**
* Allows StreamFilters to operate on a stream.
View
2  lib/vendor/swiftmailer/classes/Swift/Image.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/Image.php';
-//@require 'Swift/ByteStream/FileByteStream.php';
/**
* An image, embedded in a multipart message.
View
1  lib/vendor/swiftmailer/classes/Swift/IoException.php
@@ -8,7 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/SwiftException.php';
/**
* I/O Exception class.
View
2  lib/vendor/swiftmailer/classes/Swift/KeyCache.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/InputByteStream.php';
-//@require 'Swift/OutputByteStream.php';
/**
* Provides a mechanism for storing data using two keys.
View
5 lib/vendor/swiftmailer/classes/Swift/KeyCache/ArrayKeyCache.php
@@ -8,11 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/KeyCache.php';
-//@require 'Swift/KeyCacheInputStream.php';
-//@require 'Swift/InputByteStream.php';
-//@require 'Swift/OutputByteStrean.php';
-//@require 'Swift/SwiftException.php';
/**
* A basic KeyCache backed by an array.
View
53 lib/vendor/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.php
@@ -8,12 +8,6 @@
* file that was distributed with this source code.
*/
-//@require 'Swift/KeyCache.php';
-//@require 'Swift/KeyCacheInputStream.php';
-//@require 'Swift/InputByteStream.php';
-//@require 'Swift/OutputByteStrean.php';
-//@require 'Swift/SwiftException.php';
-//@require 'Swift/IoException.php';
/**
* A KeyCache which streams to and from disk.
@@ -29,6 +23,9 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
/** Signal to place pointer at end of file */
const POSITION_END = 1;
+
+ /** Signal to leave pointer in whatever position it currently is */
+ const POSITION_CURRENT = 2;
/**
* An InputStream for cloning.
@@ -68,7 +65,11 @@ public function __construct(Swift_KeyCache_KeyCacheInputStream $stream, $path)
{
$this->_stream = $stream;
$this->_path = $path;
- $this->_quotes = get_magic_quotes_runtime();
+
+ if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1)
+ {
+ $this->_quotes = true;
+ }
}
/**
@@ -99,6 +100,7 @@ public function setString($nsKey, $itemKey, $string, $mode)
break;
}
fwrite($fp, $string);
+ $this->_freeHandle($nsKey, $itemKey);
}
/**
@@ -133,6 +135,7 @@ public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $o
{
fwrite($fp, $bytes);
}
+ $this->_freeHandle($nsKey, $itemKey);
}
/**
@@ -171,7 +174,7 @@ public function getString($nsKey, $itemKey)
$fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);
if ($this->_quotes)
{
- set_magic_quotes_runtime(0);
+ ini_set('magic_quotes_runtime', 0);
}
$str = '';
while (!feof($fp) && false !== $bytes = fread($fp, 8192))
@@ -180,8 +183,9 @@ public function getString($nsKey, $itemKey)
}
if ($this->_quotes)
{
- set_magic_quotes_runtime(1);
+ ini_set('magic_quotes_runtime', 1);
}
+ $this->_freeHandle($nsKey, $itemKey);
return $str;
}
}
@@ -199,7 +203,7 @@ public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is)
$fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);
if ($this->_quotes)
{
- set_magic_quotes_runtime(0);
+ ini_set('magic_quotes_runtime', 0);
}