diff --git a/lib/vendor/symfony/CHANGELOG b/lib/vendor/symfony/CHANGELOG index 95e5ddc46..9eea1b0c9 100644 --- a/lib/vendor/symfony/CHANGELOG +++ b/lib/vendor/symfony/CHANGELOG @@ -1,3 +1,71 @@ +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 +------------------------- + + * [33466] fixed a possible DB session fixation attack (patch from Dmitri Groutso) + * [33373] fixed test browser click function does not handle css selector without [ or ] (closes #9982, patch from mouette) + +03/08/12: Versions 1.4.17 +------------------------- + + * [33363] added some tests (closes #3237, patch from Stephen.Ostrow) + * [33362] fixed a notice on PHP 5.4 (closes #9985, patch from bshaffer) + * [33358] fixed Notice with PHP 5.4 (closes #10003) + * [33309] fixed error in Debug mode from sfDebug.class.php when myUser implements sfSecurityUser (closes #9996) + * [33299] reverted [33226] because of side effects (refs #8348) + * [33292] fixed test for PHP 5.3 (patch from pylebecq) + +12/13/11: Version 1.4.16 +------------------------ + + * [33251] fixed sfChoiceFormat when a string to translate contains a valid range (closes #9973) + * [33250] fixed saving i18n fields in subforms (closes #7626, patch from yoshy71) + * [33249] fixed last modified date calculation in sfMessageSource_Aggregate (closes #9981, patch from jamiel) + * [33226] fixed merging problem for the routing configuration (closes #8348) + * [33214] fixed ob_start() behavior on CLI (closes #9970) + * [33208] fixed ob_start usage (to avoid warning in PHP 5.4, closes #9970) + +10/27/11: Version 1.4.15 +------------------------ + + * [33151] fixed usage of mb_strlen in tasks (closes #9940) + * [33149] added missing admin.delete_object event (closes #9943) + * [33137] fixed multiple database support in Propel plugin (for the generator and sfPropelData, closes #8345) + * [33125] fixed the possibility to include files included in an exclude rule in the deploy task (closes #9912) + * [33122] fixed include|get_component when sfPartialView class is customized (closes #9932) + * [33121] fixed protocol relative URL in the asset helper (closes #9936) + * [33053] fixed typo (closes #9927, based on a patch from pmallet) + +09/16/11: Version 1.4.14 +------------------------ + + * [33025] fixed sfCacheSessionStorage does not always check whether HTTP_USER_AGENT is set (closes #9921, patch from boutell) + * [33022] fixed auto_link_text() when an email address is already linked (closes #9915, based on a patch from klemens_u) + * [33021] fixed sfCacheSessionStorage does not serialize properly, also uses wrong option name for httponly (closes #9919, based on a patch from boutell) + * [32939] fixed memory leak in sfRoute::generate() (closes #9886 - patch from acf0) + * [32892] fixed Doctrine form generation when a schema has abstract tables (closes #9885 - patch from chok) + * [32891] fixed sfFinder bug when mirroring file with twice the path inside it (closes #9892 - based on a patch from shordeaux) + * [32890] fixed bad value of property 'list-style' in css of WebDebug toolbar (closes #9891 - patch from tomi) + 08/05/11: Version 1.4.13 ------------------------ diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/add.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/add.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/cancel.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/cancel.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/default_icon.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/default_icon.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/delete.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/delete.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/edit.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/edit.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/error.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/error.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/filter.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/filter.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/first.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/first.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/last.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/last.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/list.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/list.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/next.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/next.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/ok.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/ok.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/previous.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/previous.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/reset.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/reset.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/save.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/save.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_admin/images/tick.png b/lib/vendor/symfony/data/web/sf/sf_admin/images/tick.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_web_debug/images/config.png b/lib/vendor/symfony/data/web/sf/sf_web_debug/images/config.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_web_debug/images/database.png b/lib/vendor/symfony/data/web/sf/sf_web_debug/images/database.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_web_debug/images/log.png b/lib/vendor/symfony/data/web/sf/sf_web_debug/images/log.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_web_debug/images/memory.png b/lib/vendor/symfony/data/web/sf/sf_web_debug/images/memory.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/data/web/sf/sf_web_debug/images/time.png b/lib/vendor/symfony/data/web/sf/sf_web_debug/images/time.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/autoload/sfAutoloadAgain.class.php b/lib/vendor/symfony/lib/autoload/sfAutoloadAgain.class.php index 065516b43..95dcaeaea 100644 --- a/lib/vendor/symfony/lib/autoload/sfAutoloadAgain.class.php +++ b/lib/vendor/symfony/lib/autoload/sfAutoloadAgain.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage autoload * @author Kris Wallsmith - * @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; } diff --git a/lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php b/lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php index ab105507d..7aa75b067 100644 --- a/lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php +++ b/lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php @@ -11,7 +11,7 @@ /** * The current symfony version. */ -define('SYMFONY_VERSION', '1.4.13'); +define('SYMFONY_VERSION', '1.4.20'); /** * sfCoreAutoload class. diff --git a/lib/vendor/symfony/lib/command/sfCommandApplication.class.php b/lib/vendor/symfony/lib/command/sfCommandApplication.class.php index 660c93b90..737da048e 100644 --- a/lib/vendor/symfony/lib/command/sfCommandApplication.class.php +++ b/lib/vendor/symfony/lib/command/sfCommandApplication.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage command * @author Fabien Potencier - * @version SVN: $Id: sfCommandApplication.class.php 23218 2009-10-20 20:59:02Z FabianLange $ + * @version SVN: $Id: sfCommandApplication.class.php 33151 2011-10-24 08:55:03Z fabien $ */ abstract class sfCommandApplication { @@ -519,7 +519,15 @@ public function getTaskToExecute($name) protected function strlen($string) { - return function_exists('mb_strlen') ? mb_strlen($string) : strlen($string); + if (!function_exists('mb_strlen')) { + return strlen($string); + } + + if (false === $encoding = mb_detect_encoding($string)) { + return strlen($string); + } + + return mb_strlen($string, $encoding); } /** diff --git a/lib/vendor/symfony/lib/config/sfApplicationConfiguration.class.php b/lib/vendor/symfony/lib/config/sfApplicationConfiguration.class.php index 7786dacfc..a65e4500a 100644 --- a/lib/vendor/symfony/lib/config/sfApplicationConfiguration.class.php +++ b/lib/vendor/symfony/lib/config/sfApplicationConfiguration.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage config * @author Fabien Potencier - * @version SVN: $Id: sfApplicationConfiguration.class.php 29526 2010-05-19 13:06:40Z fabien $ + * @version SVN: $Id: sfApplicationConfiguration.class.php 33214 2011-11-19 13:47:24Z fabien $ */ abstract class sfApplicationConfiguration extends ProjectConfiguration { @@ -150,9 +150,9 @@ public function initConfiguration() $this->initializePlugins(); // compress output - if (!self::$coreLoaded) + if (!self::$coreLoaded && sfConfig::get('sf_compressed')) { - ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : ''); + ob_start('ob_gzhandler'); } self::$coreLoaded = true; diff --git a/lib/vendor/symfony/lib/config/sfFactoryConfigHandler.class.php b/lib/vendor/symfony/lib/config/sfFactoryConfigHandler.class.php index b1615adf0..13072a489 100644 --- a/lib/vendor/symfony/lib/config/sfFactoryConfigHandler.class.php +++ b/lib/vendor/symfony/lib/config/sfFactoryConfigHandler.class.php @@ -17,7 +17,7 @@ * @subpackage config * @author Fabien Potencier * @author Sean Kerr - * @version SVN: $Id: sfFactoryConfigHandler.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + * @version SVN: $Id: sfFactoryConfigHandler.class.php 33299 2011-12-30 17:42:47Z fabien $ */ class sfFactoryConfigHandler extends sfYamlConfigHandler { diff --git a/lib/vendor/symfony/lib/controller/sfController.class.php b/lib/vendor/symfony/lib/controller/sfController.class.php index 75d5dcf33..1643cfc81 100644 --- a/lib/vendor/symfony/lib/controller/sfController.class.php +++ b/lib/vendor/symfony/lib/controller/sfController.class.php @@ -16,7 +16,7 @@ * @subpackage controller * @author Fabien Potencier * @author Sean Kerr - * @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; } /** diff --git a/lib/vendor/symfony/lib/database/sfPDODatabase.class.php b/lib/vendor/symfony/lib/database/sfPDODatabase.class.php index d4af36dce..20e2708aa 100644 --- a/lib/vendor/symfony/lib/database/sfPDODatabase.class.php +++ b/lib/vendor/symfony/lib/database/sfPDODatabase.class.php @@ -18,7 +18,7 @@ * @author Fabien Potencier * @author Sean Kerr * @author Dustin Whittle - * @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); } } diff --git a/lib/vendor/symfony/lib/debug/sfDebug.class.php b/lib/vendor/symfony/lib/debug/sfDebug.class.php index aaf2919b0..99315a729 100644 --- a/lib/vendor/symfony/lib/debug/sfDebug.class.php +++ b/lib/vendor/symfony/lib/debug/sfDebug.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage debug * @author Fabien Potencier - * @version SVN: $Id: sfDebug.class.php 31250 2010-10-26 14:18:26Z fabien $ + * @version SVN: $Id: sfDebug.class.php 33309 2012-01-20 13:06:21Z fabien $ */ class sfDebug { @@ -167,7 +167,7 @@ public static function userAsArray(sfUser $user = null) 'culture' => $user->getCulture(), ); - if ($user instanceof sfSecurityUser) + if ($user instanceof sfBasicSecurityUser) { $data = array_merge($data, array( 'authenticated' => $user->isAuthenticated(), diff --git a/lib/vendor/symfony/lib/debug/sfTimerManager.class.php b/lib/vendor/symfony/lib/debug/sfTimerManager.class.php index a165d7640..ecda0b6c9 100644 --- a/lib/vendor/symfony/lib/debug/sfTimerManager.class.php +++ b/lib/vendor/symfony/lib/debug/sfTimerManager.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage util * @author Fabien Potencier - * @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]; } diff --git a/lib/vendor/symfony/lib/debug/sfWebDebug.class.php b/lib/vendor/symfony/lib/debug/sfWebDebug.class.php index 03f8ec04e..55f6b9187 100644 --- a/lib/vendor/symfony/lib/debug/sfWebDebug.class.php +++ b/lib/vendor/symfony/lib/debug/sfWebDebug.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage debug * @author Fabien Potencier - * @version SVN: $Id: sfWebDebug.class.php 31254 2010-10-26 15:26:03Z fabien $ + * @version SVN: $Id: sfWebDebug.class.php 32890 2011-08-05 07:44:44Z fabien $ */ class sfWebDebug { @@ -780,7 +780,7 @@ public function getStylesheet() margin: 0; padding: 0; margin-left: 20px; - list-style: number; + list-style: decimal; } #sfWebDebugDatabaseLogs li diff --git a/lib/vendor/symfony/lib/exception/sfException.class.php b/lib/vendor/symfony/lib/exception/sfException.class.php index 727500925..14a32baea 100644 --- a/lib/vendor/symfony/lib/exception/sfException.class.php +++ b/lib/vendor/symfony/lib/exception/sfException.class.php @@ -18,7 +18,7 @@ * @subpackage exception * @author Fabien Potencier * @author Sean Kerr - * @version SVN: $Id: sfException.class.php 32641 2011-06-11 13:39:35Z fabien $ + * @version SVN: $Id: sfException.class.php 33539 2012-09-19 05:36:02Z fabien $ */ class sfException extends Exception { @@ -100,7 +100,9 @@ public function printStackTrace() } } - ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : ''); + if (sfConfig::get('sf_compressed')) { + ob_start('ob_gzhandler'); + } header('HTTP/1.0 500 Internal Server Error'); } @@ -193,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'; } diff --git a/lib/vendor/symfony/lib/form/addon/sfFormObject.class.php b/lib/vendor/symfony/lib/form/addon/sfFormObject.class.php index ae80719b1..c4a1aa985 100644 --- a/lib/vendor/symfony/lib/form/addon/sfFormObject.class.php +++ b/lib/vendor/symfony/lib/form/addon/sfFormObject.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage form * @author Kris Wallsmith - * @version SVN: $Id: sfFormObject.class.php 22917 2009-10-10 13:44:53Z Kris.Wallsmith $ + * @version SVN: $Id: sfFormObject.class.php 33250 2011-12-12 16:02:15Z fabien $ */ abstract class sfFormObject extends BaseForm { @@ -241,8 +241,8 @@ public function saveEmbeddedForms($con = null, $forms = null) { if ($form instanceof sfFormObject) { - $form->saveEmbeddedForms($con); $form->getObject()->save($con); + $form->saveEmbeddedForms($con); } else { diff --git a/lib/vendor/symfony/lib/form/sfForm.class.php b/lib/vendor/symfony/lib/form/sfForm.class.php index 8d750d4a3..2a470d5ee 100644 --- a/lib/vendor/symfony/lib/form/sfForm.class.php +++ b/lib/vendor/symfony/lib/form/sfForm.class.php @@ -23,7 +23,7 @@ * @package symfony * @subpackage form * @author Fabien Potencier - * @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 { diff --git a/lib/vendor/symfony/lib/helper/AssetHelper.php b/lib/vendor/symfony/lib/helper/AssetHelper.php index c6537fe62..2a5d1059c 100644 --- a/lib/vendor/symfony/lib/helper/AssetHelper.php +++ b/lib/vendor/symfony/lib/helper/AssetHelper.php @@ -16,7 +16,7 @@ * @subpackage helper * @author Fabien Potencier * @author David Heinemeier Hansson - * @version SVN: $Id: AssetHelper.php 24289 2009-11-23 19:45:06Z Kris.Wallsmith $ + * @version SVN: $Id: AssetHelper.php 33121 2011-10-07 12:29:09Z fabien $ */ /** @@ -374,7 +374,7 @@ function image_tag($source, $options = array()) function _compute_public_path($source, $dir, $ext, $absolute = false) { - if (strpos($source, '://')) + if (strpos($source, '://') || strpos($source, '//') === 0) { return $source; } diff --git a/lib/vendor/symfony/lib/helper/PartialHelper.php b/lib/vendor/symfony/lib/helper/PartialHelper.php index 9bfb4e11b..5a209c4fd 100644 --- a/lib/vendor/symfony/lib/helper/PartialHelper.php +++ b/lib/vendor/symfony/lib/helper/PartialHelper.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage helper * @author Fabien Potencier - * @version SVN: $Id: PartialHelper.php 27755 2010-02-08 20:51:02Z Kris.Wallsmith $ + * @version SVN: $Id: PartialHelper.php 33122 2011-10-07 12:42:49Z fabien $ */ /** @@ -136,6 +136,8 @@ function get_component($moduleName, $componentName, $vars = array()) $context = sfContext::getInstance(); $actionName = '_'.$componentName; + require($context->getConfigCache()->checkConfig('modules/'.$moduleName.'/config/module.yml')); + $class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class', 'sf').'PartialView'; $view = new $class($context, $moduleName, $actionName, ''); $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ? sfOutputEscaper::unescape($vars) : $vars); diff --git a/lib/vendor/symfony/lib/helper/TextHelper.php b/lib/vendor/symfony/lib/helper/TextHelper.php index e92184d9c..8c7d473a7 100644 --- a/lib/vendor/symfony/lib/helper/TextHelper.php +++ b/lib/vendor/symfony/lib/helper/TextHelper.php @@ -16,7 +16,7 @@ * @subpackage helper * @author Fabien Potencier * @author David Heinemeier Hansson - * @version SVN: $Id: TextHelper.php 31895 2011-01-24 18:37:43Z fabien $ + * @version SVN: $Id: TextHelper.php 33022 2011-09-15 05:27:12Z fabien $ */ /** @@ -283,5 +283,10 @@ function _auto_link_urls($text, $href_options = array(), $truncate = false, $tru */ function _auto_link_email_addresses($text) { - return preg_replace('/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/', '\\1', $text); + // Taken from http://snippets.dzone.com/posts/show/6156 + return preg_replace("#(^|[\n ])([a-z0-9&\-_\.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1\\2@\\3", $text); + + // Removed since it destroys already linked emails + // Example: bar gets bar gets bar + //return preg_replace('/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/', '\\1', $text); } diff --git a/lib/vendor/symfony/lib/i18n/sfChoiceFormat.class.php b/lib/vendor/symfony/lib/i18n/sfChoiceFormat.class.php index 238142608..5c17f42d7 100644 --- a/lib/vendor/symfony/lib/i18n/sfChoiceFormat.class.php +++ b/lib/vendor/symfony/lib/i18n/sfChoiceFormat.class.php @@ -13,7 +13,7 @@ * {@link http://prado.sourceforge.net/} * * @author Wei Zhuo - * @version $Id: sfChoiceFormat.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + * @version $Id: sfChoiceFormat.class.php 33251 2011-12-12 16:30:59Z fabien $ * @package symfony * @subpackage i18n */ @@ -65,7 +65,7 @@ class sfChoiceFormat /** * The pattern to parse the formatting string. */ - protected $parse = '/\s*\|?([\(\[\{]([-Inf\d:\s]+,?[\+Inf\d\s:\?\-=!><%\|&\(\)]*)+[\)\]\}])\s*/'; + protected $parse = '/(?:^\s*|\s*\|)([\(\[\{]([-Inf\d:\s]+,?[\+Inf\d\s:\?\-=!><%\|&\(\)]*)+[\)\]\}])\s*/'; /** * The value for positive infinity. diff --git a/lib/vendor/symfony/lib/i18n/sfCultureInfo.class.php b/lib/vendor/symfony/lib/i18n/sfCultureInfo.class.php index a9ded67f9..edd6ec9fc 100644 --- a/lib/vendor/symfony/lib/i18n/sfCultureInfo.class.php +++ b/lib/vendor/symfony/lib/i18n/sfCultureInfo.class.php @@ -13,7 +13,7 @@ * {@link http://prado.sourceforge.net/} * * @author Wei Zhuo - * @version $Id: sfCultureInfo.class.php 32741 2011-07-09 09:41:59Z fabien $ + * @version $Id: sfCultureInfo.class.php 33361 2012-03-08 13:48:42Z fabien $ * @package symfony * @subpackage i18n */ @@ -772,16 +772,23 @@ public function getCurrencies($currencies = null, $full = false) $allCurrencies = array_intersect_key($allCurrencies, array_flip($currencies)); } - if (!$full) + $tmp = array(); + foreach ($allCurrencies as $key => $value) { - foreach ($allCurrencies as $key => $value) - { - $allCurrencies[$key] = $value[1]; - } + $allCurrencies[$key] = $value[1]; + $tmp[$key] = $value[0]; } $this->sortArray($allCurrencies); + if ($full) + { + foreach ($allCurrencies as $key => $value) + { + $allCurrencies[$key] = array($tmp[$key], $value); + } + } + return $allCurrencies; } @@ -846,7 +853,7 @@ public function getTimeZones() /** * sorts the passed array according to the locale of this sfCultureInfo class * - * @param array the array to pe sorted wiht "asort" and this locale + * @param array the array to be sorted with "asort" and this locale */ public function sortArray(&$array) { diff --git a/lib/vendor/symfony/lib/i18n/sfMessageSource_Aggregate.class.php b/lib/vendor/symfony/lib/i18n/sfMessageSource_Aggregate.class.php index 67b43ac4e..ed99da27e 100644 --- a/lib/vendor/symfony/lib/i18n/sfMessageSource_Aggregate.class.php +++ b/lib/vendor/symfony/lib/i18n/sfMessageSource_Aggregate.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage i18n * @author Fabien Potencier - * @version SVN: $Id: sfMessageSource_Aggregate.class.php 13401 2008-11-27 11:18:39Z fabien $ + * @version SVN: $Id: sfMessageSource_Aggregate.class.php 33249 2011-12-12 15:50:45Z fabien $ */ class sfMessageSource_Aggregate extends sfMessageSource { @@ -51,7 +51,10 @@ protected function getLastModified($sources) $lastModified = time(); foreach ($sources as $source) { - $lastModified = min($lastModified, $source[0]->getLastModified($source[1])); + if (0 !== $sourceLastModified = $source[0]->getLastModified($source[1])) + { + $lastModified = min($lastModified, $sourceLastModified); + } } return $lastModified; diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/batchAction.php b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/batchAction.php index 323a7e017..e2c181298 100644 --- a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/batchAction.php +++ b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/batchAction.php @@ -54,6 +54,8 @@ protected function executeBatchDelete(sfWebRequest $request) foreach ($records as $record) { + $this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $record))); + $record->delete(); } diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php index 84c1d9365..a79ce70f7 100644 --- a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php +++ b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php @@ -6,7 +6,7 @@ * @package sfDoctrinePlugin * @subpackage database * @author Kris Wallsmith - * @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); diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/form/sfFormFilterDoctrine.class.php b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/form/sfFormFilterDoctrine.class.php index e644c307c..5838d0866 100644 --- a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/form/sfFormFilterDoctrine.class.php +++ b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/form/sfFormFilterDoctrine.class.php @@ -21,7 +21,7 @@ * @subpackage form * @author Fabien Potencier * @author Jonathan H. Wage - * @version SVN: $Id: sfFormFilterDoctrine.class.php 32740 2011-07-09 09:24:03Z fabien $ + * @version SVN: $Id: sfFormFilterDoctrine.class.php 33150 2011-10-24 07:57:16Z fabien $ */ abstract class sfFormFilterDoctrine extends sfFormFilter { diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php index fc7713b8d..898fc5a6c 100644 --- a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php +++ b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php @@ -18,7 +18,7 @@ * @subpackage generator * @author Fabien Potencier * @author Jonathan H. Wage - * @version SVN: $Id: sfDoctrineFormGenerator.class.php 29661 2010-05-28 16:56:42Z Kris.Wallsmith $ + * @version SVN: $Id: sfDoctrineFormGenerator.class.php 32892 2011-08-05 07:53:57Z fabien $ */ class sfDoctrineFormGenerator extends sfGenerator { @@ -167,10 +167,14 @@ public function getPluginModels() if ($reflection->isSubClassOf($parent)) { $this->pluginModels[$modelName] = $pluginName; - $generators = Doctrine_Core::getTable($modelName)->getGenerators(); - foreach ($generators as $generator) + + if ($reflection->isInstantiable()) { - $this->pluginModels[$generator->getOption('className')] = $pluginName; + $generators = Doctrine_Core::getTable($modelName)->getGenerators(); + foreach ($generators as $generator) + { + $this->pluginModels[$generator->getOption('className')] = $pluginName; + } } } } diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php index 8362fc0c4..250873231 100644 --- a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php +++ b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php @@ -18,7 +18,7 @@ * @subpackage doctrine * @author Fabien Potencier * @author Jonathan H. Wage - * @version SVN: $Id: sfDoctrineMigrateTask.class.php 23922 2009-11-14 14:58:38Z fabien $ + * @version SVN: $Id: sfDoctrineMigrateTask.class.php 33338 2012-02-15 16:02:28Z fabien $ */ class sfDoctrineMigrateTask extends sfDoctrineBaseTask { @@ -100,7 +100,23 @@ protected function execute($arguments = array(), $options = array()) $this->logSection('doctrine', sprintf('Migrating from version %s to %s%s', $from, $version, $options['dry-run'] ? ' (dry run)' : '')); try { - $migration->migrate($version, $options['dry-run']); + $migration_classes = $migration->getMigrationClasses(); + if($version < $from) + { + for($i = (int)$from - 1; $i >= (int)$version; $i--) + { + $this->logSection('doctrine', 'executing migration : '.$i .', class: '.$migration_classes[$i]); + $migration->migrate($i, $options['dry-run']); + } + } + else + { + for($i = (int)$from + 1; $i <= (int)$version; $i++) + { + $this->logSection('doctrine', 'executing migration : '.$i.', class: '.$migration_classes[$i]); + $migration->migrate($i, $options['dry-run']); + } + } } catch (Exception $e) { diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php index a06f136ac..728207ee0 100644 --- a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php +++ b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php @@ -32,8 +32,6 @@ */ abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract { - protected static $initializedTables = array(); - /** * _options * @@ -162,13 +160,12 @@ public function initialize(Doctrine_Table $table) $this->_options['tableName'] = str_replace('%TABLE%', $ownerTableName, $tableName); } - $currentTableHash = spl_object_hash($table); - if (!empty(self::$initializedTables[$currentTableHash])) { - return null; + // check that class doesn't exist (otherwise we cannot create it) + if ($this->_options['generateFiles'] === false && class_exists($this->_options['className'])) { + $this->_table = Doctrine_Core::getTable($this->_options['className']); + return false; } - self::$initializedTables[$currentTableHash] = true; - $this->buildTable(); $fk = $this->buildForeignKeys($this->_options['table']); @@ -180,9 +177,7 @@ public function initialize(Doctrine_Table $table) $this->setTableDefinition(); $this->setUp(); - if ($this->_options['generateFiles'] === true || !class_exists($this->_options['className'])) { - $this->generateClassFromTable($this->_table); - } + $this->generateClassFromTable($this->_table); $this->buildChildDefinitions(); diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Validator/Readonly.php b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Validator/Readonly.php old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/linked_schema.yml b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/linked_schema.yml old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/asc.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/asc.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/default.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/default.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/delete.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/delete.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/desc.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/desc.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/edit.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/edit.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/error.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/error.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/first.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/first.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/last.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/last.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/list.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/list.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/new.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/new.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/next.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/next.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/previous.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/previous.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/tick.png b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/web/images/tick.png old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/lib/request/sfWebRequest.class.php b/lib/vendor/symfony/lib/request/sfWebRequest.class.php index a9b255455..eddc31e11 100644 --- a/lib/vendor/symfony/lib/request/sfWebRequest.class.php +++ b/lib/vendor/symfony/lib/request/sfWebRequest.class.php @@ -18,7 +18,7 @@ * @subpackage request * @author Fabien Potencier * @author Sean Kerr - * @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; } /** diff --git a/lib/vendor/symfony/lib/routing/sfRoute.class.php b/lib/vendor/symfony/lib/routing/sfRoute.class.php index c86c6b8c5..75935428f 100644 --- a/lib/vendor/symfony/lib/routing/sfRoute.class.php +++ b/lib/vendor/symfony/lib/routing/sfRoute.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage routing * @author Fabien Potencier - * @version SVN: $Id: sfRoute.class.php 32652 2011-06-15 17:44:19Z fabien $ + * @version SVN: $Id: sfRoute.class.php 32939 2011-08-22 13:40:06Z fabien $ */ class sfRoute implements Serializable { @@ -232,7 +232,7 @@ public function generate($params, $context = array(), $absolute = false) { // replace variables $variables = $this->variables; - uasort($variables, create_function('$a, $b', 'return strlen($a) < strlen($b);')); + uasort($variables, array('sfRoute', 'generateCompareVarsByStrlen')); foreach ($variables as $variable => $value) { $url = str_replace($value, urlencode($tparams[$variable]), $url); @@ -259,6 +259,11 @@ public function generate($params, $context = array(), $absolute = false) return $url; } + static private function generateCompareVarsByStrlen($a, $b) + { + return strlen($a) < strlen($b); + } + /** * Generates a URL for the given parameters by using the route tokens. * diff --git a/lib/vendor/symfony/lib/storage/sfCacheSessionStorage.class.php b/lib/vendor/symfony/lib/storage/sfCacheSessionStorage.class.php index 2c702db55..00d602b12 100644 --- a/lib/vendor/symfony/lib/storage/sfCacheSessionStorage.class.php +++ b/lib/vendor/symfony/lib/storage/sfCacheSessionStorage.class.php @@ -40,12 +40,20 @@ class sfCacheSessionStorage extends sfStorage public function initialize($options = array()) { // initialize parent + + // bc with a slightly different name formerly used here, let's be + // compatible with the base class name for it from here on out + if (isset($options['session_cookie_http_only'])) + { + $options['session_cookie_httponly'] = $options['session_cookie_http_only']; + } + parent::initialize(array_merge(array('session_name' => 'sfproject', 'session_cookie_lifetime' => '+30 days', 'session_cookie_path' => '/', 'session_cookie_domain' => null, 'session_cookie_secure' => false, - 'session_cookie_http_only' => true, + 'session_cookie_httponly' => true, 'session_cookie_secret' => 'sf$ecret'), $options)); // create cache instance @@ -108,14 +116,28 @@ public function initialize($options = array()) $this->options['session_cookie_path'], $this->options['session_cookie_domain'], $this->options['session_cookie_secure'], - $this->options['session_cookie_http_only']); + $this->options['session_cookie_httponly']); $this->data = array(); } else { - // load data from cache - $this->data = $this->cache->get($this->id, array()); + // load data from cache. Watch out for the default case. We could + // serialize(array()) as the default to the call but that would be a performance hit + $raw = $this->cache->get($this->id, null); + if (is_null($raw)) + { + $this->data = array(); + } + elseif (is_array($raw)) + { + // probably an old cached value (BC) + $this->data = $raw; + } + else + { + $this->data = unserialize($raw); + } if(sfConfig::get('sf_logging_enabled')) { @@ -208,10 +230,12 @@ public function regenerate($destroy = false) } // generate session id - $this->id = md5(rand(0, 999999).$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT'].$this->options['session_cookie_secret']); + $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'ua'; + + $this->id = md5(rand(0, 999999).$_SERVER['REMOTE_ADDR'].$ua.$this->options['session_cookie_secret']); // save data to cache - $this->cache->set($this->id, $this->data); + $this->cache->set($this->id, serialize($this->data)); // update session id in signed cookie $this->response->setCookie($this->options['session_name'], @@ -220,7 +244,7 @@ public function regenerate($destroy = false) $this->options['session_cookie_path'], $this->options['session_cookie_domain'], $this->options['session_cookie_secure'], - $this->options['session_cookie_http_only']); + $this->options['session_cookie_httponly']); session_id($this->id); return true; } @@ -249,11 +273,10 @@ public function shutdown() // only update cache if session has changed if($this->dataChanged === true) { - $this->cache->set($this->id, $this->data); + $this->cache->set($this->id, serialize($this->data)); if(sfConfig::get('sf_logging_enabled')) { $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Storing session to cache'))); - // $this->dispatcher->notify(new sfEvent($this, 'application.log', array(var_export($this->data, true)))); } } } diff --git a/lib/vendor/symfony/lib/storage/sfPDOSessionStorage.class.php b/lib/vendor/symfony/lib/storage/sfPDOSessionStorage.class.php index ca8af01dd..a67d2e08e 100644 --- a/lib/vendor/symfony/lib/storage/sfPDOSessionStorage.class.php +++ b/lib/vendor/symfony/lib/storage/sfPDOSessionStorage.class.php @@ -19,7 +19,7 @@ * @author Mathew Toth * @author Fabien Potencier * @author Sean Kerr - * @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 { diff --git a/lib/vendor/symfony/lib/task/generator/skeleton/project/symfony b/lib/vendor/symfony/lib/task/generator/skeleton/project/symfony old mode 100755 new mode 100644 diff --git a/lib/vendor/symfony/lib/task/project/sfProjectDeployTask.class.php b/lib/vendor/symfony/lib/task/project/sfProjectDeployTask.class.php index 4799e6f01..174fc5438 100644 --- a/lib/vendor/symfony/lib/task/project/sfProjectDeployTask.class.php +++ b/lib/vendor/symfony/lib/task/project/sfProjectDeployTask.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage task * @author Fabien Potencier - * @version SVN: $Id: sfProjectDeployTask.class.php 23922 2009-11-14 14:58:38Z fabien $ + * @version SVN: $Id: sfProjectDeployTask.class.php 33125 2011-10-08 21:02:31Z fabien $ */ class sfProjectDeployTask extends sfBaseTask { @@ -142,14 +142,14 @@ protected function execute($arguments = array(), $options = array()) else { $parameters = $options['rsync-options']; - if (file_exists($options['rsync-dir'].'/rsync_exclude.txt')) + if (file_exists($options['rsync-dir'].'/rsync_include.txt')) { - $parameters .= sprintf(' --exclude-from=%s/rsync_exclude.txt', $options['rsync-dir']); + $parameters .= sprintf(' --include-from=%s/rsync_include.txt', $options['rsync-dir']); } - if (file_exists($options['rsync-dir'].'/rsync_include.txt')) + if (file_exists($options['rsync-dir'].'/rsync_exclude.txt')) { - $parameters .= sprintf(' --include-from=%s/rsync_include.txt', $options['rsync-dir']); + $parameters .= sprintf(' --exclude-from=%s/rsync_exclude.txt', $options['rsync-dir']); } if (file_exists($options['rsync-dir'].'/rsync.txt')) diff --git a/lib/vendor/symfony/lib/task/sfTask.class.php b/lib/vendor/symfony/lib/task/sfTask.class.php index 53b7345ae..9baba32c3 100644 --- a/lib/vendor/symfony/lib/task/sfTask.class.php +++ b/lib/vendor/symfony/lib/task/sfTask.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage task * @author Fabien Potencier - * @version SVN: $Id: sfTask.class.php 30773 2010-08-27 19:27:41Z Kris.Wallsmith $ + * @version SVN: $Id: sfTask.class.php 33151 2011-10-24 08:55:03Z fabien $ */ abstract class sfTask { @@ -651,6 +651,14 @@ abstract protected function execute($arguments = array(), $options = array()); protected function strlen($string) { - return function_exists('mb_strlen') ? mb_strlen($string) : strlen($string); + if (!function_exists('mb_strlen')) { + return strlen($string); + } + + if (false === $encoding = mb_detect_encoding($string)) { + return strlen($string); + } + + return mb_strlen($string, $encoding); } } diff --git a/lib/vendor/symfony/lib/user/sfBasicSecurityUser.class.php b/lib/vendor/symfony/lib/user/sfBasicSecurityUser.class.php index 7d394ccaa..d08faf99a 100644 --- a/lib/vendor/symfony/lib/user/sfBasicSecurityUser.class.php +++ b/lib/vendor/symfony/lib/user/sfBasicSecurityUser.class.php @@ -16,7 +16,7 @@ * @subpackage user * @author Fabien Potencier * @author Sean Kerr - * @version SVN: $Id: sfBasicSecurityUser.class.php 29528 2010-05-19 13:12:27Z fabien $ + * @version SVN: $Id: sfBasicSecurityUser.class.php 33466 2012-05-30 07:33:03Z fabien $ */ class sfBasicSecurityUser extends sfUser implements sfSecurityUser { diff --git a/lib/vendor/symfony/lib/util/sfBrowserBase.class.php b/lib/vendor/symfony/lib/util/sfBrowserBase.class.php index 338959515..40e7df0d9 100644 --- a/lib/vendor/symfony/lib/util/sfBrowserBase.class.php +++ b/lib/vendor/symfony/lib/util/sfBrowserBase.class.php @@ -16,7 +16,7 @@ * @package symfony * @subpackage util * @author Fabien Potencier - * @version SVN: $Id: sfBrowserBase.class.php 28702 2010-03-23 12:02:01Z fabien $ + * @version SVN: $Id: sfBrowserBase.class.php 33373 2012-03-08 15:45:46Z fabien $ */ abstract class sfBrowserBase { @@ -700,7 +700,10 @@ public function doClick($name, $arguments = array(), $options = array()) $query .= sprintf('|//input[((@type="submit" or @type="button") and @value="%s") or (@type="image" and @alt="%s")]', $name, $name); $query .= sprintf('|//button[.="%s" or @id="%s" or @name="%s"]', $name, $name, $name); - $list = $this->getResponseDomXpath()->query($query); + if (!$list = @$this->getResponseDomXpath()->query($query)) + { + throw new InvalidArgumentException(sprintf('The name "%s" is not valid', $name)); + } $position = isset($options['position']) ? $options['position'] - 1 : 0; diff --git a/lib/vendor/symfony/lib/util/sfFinder.class.php b/lib/vendor/symfony/lib/util/sfFinder.class.php index 8779cbac4..f95d97a4b 100644 --- a/lib/vendor/symfony/lib/util/sfFinder.class.php +++ b/lib/vendor/symfony/lib/util/sfFinder.class.php @@ -26,7 +26,7 @@ * @package symfony * @subpackage util * @author Fabien Potencier - * @version SVN: $Id: sfFinder.class.php 30528 2010-08-04 16:25:14Z fabien $ + * @version SVN: $Id: sfFinder.class.php 32891 2011-08-05 07:48:34Z fabien $ */ class sfFinder { @@ -382,7 +382,7 @@ public function in() if ($this->relative) { - $new_files = str_replace(rtrim($dir, '/').'/', '', $new_files); + $new_files = preg_replace('#^'.preg_quote(rtrim($dir, '/'), '#').'/#', '', $new_files); } $files = array_merge($files, $new_files); @@ -617,7 +617,7 @@ public static function isPathAbsolute($path) * @author Richard Clamp perl version * @copyright 2004-2005 Fabien Potencier * @copyright 2002 Richard Clamp - * @version SVN: $Id: sfFinder.class.php 30528 2010-08-04 16:25:14Z fabien $ + * @version SVN: $Id: sfFinder.class.php 32891 2011-08-05 07:48:34Z fabien $ */ class sfGlobToRegex { @@ -739,7 +739,7 @@ public static function glob_to_regex($glob) * @copyright 2004-2005 Fabien Potencier * @copyright 2002 Richard Clamp * @see http://physics.nist.gov/cuu/Units/binary.html - * @version SVN: $Id: sfFinder.class.php 30528 2010-08-04 16:25:14Z fabien $ + * @version SVN: $Id: sfFinder.class.php 32891 2011-08-05 07:48:34Z fabien $ */ class sfNumberCompare { diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift.php index 7d251d34c..eaba9850d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift.php +++ b/lib/vendor/symfony/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 @@ abstract class Swift 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')); } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Attachment.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Attachment.php index d3779bfe9..9362b8469 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Attachment.php +++ b/lib/vendor/symfony/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}. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php index 71bc3f1b8..96a4386bb 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php +++ b/lib/vendor/symfony/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 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream { /** Write sequence */ - private $_sequence = 0; + protected $_sequence = 0; /** StreamFilters */ private $_filters = array(); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/ArrayByteStream.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/ArrayByteStream.php index f91888946..c1cd01ae0 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/ArrayByteStream.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/FileByteStream.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/FileByteStream.php index 14773c2f5..45be3c2ba 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/ByteStream/FileByteStream.php +++ b/lib/vendor/symfony/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; + } } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader.php index 53d39ece9..c660a884e 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader.php +++ b/lib/vendor/symfony/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(); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/GenericFixedWidthReader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/GenericFixedWidthReader.php index 26b13ff42..8345ac590 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/GenericFixedWidthReader.php +++ b/lib/vendor/symfony/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; } - } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/UsAsciiReader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/UsAsciiReader.php index 3e0228a37..790394963 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/UsAsciiReader.php +++ b/lib/vendor/symfony/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; } /** diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php index 54ea9a462..deea4b341 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php +++ b/lib/vendor/symfony/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; } /** diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory.php index 9e01de17e..55ce880b1 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php index a6f9f9487..48b186dcf 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php +++ b/lib/vendor/symfony/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]; } } } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterStream/ArrayCharacterStream.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterStream/ArrayCharacterStream.php index 9612365a7..b74b08f0d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterStream/ArrayCharacterStream.php +++ b/lib/vendor/symfony/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'; /** diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php index f090aa7d3..57c3fb778 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php @@ -18,8 +18,6 @@ */ -//@require 'Swift/CharacterStream.php'; -//@require 'Swift/OutputByteStream.php'; /** diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/DependencyContainer.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/DependencyContainer.php index b6ba554e6..066811e87 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/DependencyContainer.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/DependencyException.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/DependencyException.php index bb1681ce1..7622aac80 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/DependencyException.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/EmbeddedFile.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/EmbeddedFile.php index 34d096c6c..122a62584 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/EmbeddedFile.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder.php index 32aa96a00..3db403f13 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/Base64Encoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/Base64Encoder.php index 09c71baf4..ba62c8d2f 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/Base64Encoder.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/QpEncoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/QpEncoder.php index 6914f6c4f..6efd728be 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/QpEncoder.php +++ b/lib/vendor/symfony/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 diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/Rfc2231Encoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/Rfc2231Encoder.php index febc6ba83..c4c572571 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoder/Rfc2231Encoder.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoding.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoding.php index 1849a8295..369b9a5db 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Encoding.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/CommandEvent.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/CommandEvent.php index 73eb5850f..11b808c01 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/CommandEvent.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/CommandListener.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/CommandListener.php index 2fd71172f..0964577aa 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/CommandListener.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/EventDispatcher.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/EventDispatcher.php index aaf12117e..a0e5e601d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/EventDispatcher.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/EventObject.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/EventObject.php index 5d494fe89..ba6aac0b7 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/EventObject.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/ResponseEvent.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/ResponseEvent.php index addf9e7a8..7ce0ad68d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/ResponseEvent.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/ResponseListener.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/ResponseListener.php index 092385b28..d2fc8e484 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/ResponseListener.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SendEvent.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SendEvent.php index 49a835135..85c039ca5 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SendEvent.php +++ b/lib/vendor/symfony/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. @@ -37,23 +36,17 @@ 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; } -} \ No newline at end of file +} diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SendListener.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SendListener.php index a8f0cc33d..1ce187c9c 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SendListener.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SimpleEventDispatcher.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SimpleEventDispatcher.php index 3e6c0beb3..1d9237cfd 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/SimpleEventDispatcher.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeEvent.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeEvent.php index f069a4c17..e57176a9b 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeEvent.php +++ b/lib/vendor/symfony/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). diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeListener.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeListener.php index ba729d010..9c028f0d2 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeListener.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionEvent.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionEvent.php index a1bf7d278..154432864 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionEvent.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionListener.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionListener.php index d6dce94f5..92266afbe 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionListener.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FailoverTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FailoverTransport.php index 6e6b7a8bd..5767119cf 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FailoverTransport.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FileSpool.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FileSpool.php index 28c679612..48b224715 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FileSpool.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FileSpool.php @@ -12,15 +12,23 @@ * Stores Messages on the filesystem. * @package Swift * @author Fabien Potencier + * @author Xavier De Cock */ class Swift_FileSpool extends Swift_ConfigurableSpool { /** The spool directory */ 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.']'); + } } } @@ -56,15 +67,73 @@ 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; + } } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FileStream.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FileStream.php index a7f894dcd..56bf36ee4 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/FileStream.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Filterable.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Filterable.php index c0479671c..4ca5f4022 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Filterable.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Image.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Image.php index c161d7a62..3baa79ea2 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Image.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/IoException.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/IoException.php index 88a5b0dd6..7c2a9bbfb 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/IoException.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache.php index b942663a5..e3e8f0c14 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/ArrayKeyCache.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/ArrayKeyCache.php index fe3b7c992..72d784226 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/ArrayKeyCache.php +++ b/lib/vendor/symfony/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. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.php index 599fd6c7c..7835079e8 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.php +++ b/lib/vendor/symfony/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); } while (!feof($fp) && false !== $bytes = fread($fp, 8192)) { @@ -207,8 +211,9 @@ public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) } if ($this->_quotes) { - set_magic_quotes_runtime(1); + ini_set('magic_quotes_runtime', 1); } + $this->_freeHandle($nsKey, $itemKey); } } @@ -232,11 +237,9 @@ public function clearKey($nsKey, $itemKey) { if ($this->hasKey($nsKey, $itemKey)) { - $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_END); - fclose($fp); + $this->_freeHandle($nsKey, $itemKey); unlink($this->_path . '/' . $nsKey . '/' . $itemKey); } - unset($this->_keys[$nsKey][$itemKey]); } /** @@ -251,7 +254,10 @@ public function clearAll($nsKey) { $this->clearKey($nsKey, $itemKey); } - rmdir($this->_path . '/' . $nsKey); + if (is_dir($this->_path . '/' . $nsKey)) + { + rmdir($this->_path . '/' . $nsKey); + } unset($this->_keys[$nsKey]); } } @@ -286,21 +292,32 @@ private function _prepareCache($nsKey) */ private function _getHandle($nsKey, $itemKey, $position) { - if (!isset($this->_keys[$nsKey]) || !array_key_exists($itemKey, $this->_keys[$nsKey])) + if (!isset($this->_keys[$nsKey][$itemKey])) { - $fp = fopen($this->_path . '/' . $nsKey . '/' . $itemKey, 'w+b'); + $openMode = $this->hasKey($nsKey, $itemKey) + ? 'r+b' + : 'w+b' + ; + $fp = fopen($this->_path . '/' . $nsKey . '/' . $itemKey, $openMode); $this->_keys[$nsKey][$itemKey] = $fp; } if (self::POSITION_START == $position) { fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_SET); } - else + elseif (self::POSITION_END == $position) { fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_END); } return $this->_keys[$nsKey][$itemKey]; } + + private function _freeHandle($nsKey, $itemKey) + { + $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_CURRENT); + fclose($fp); + $this->_keys[$nsKey][$itemKey] = null; + } /** * Destructor. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/DummyKeyCache.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/DummyKeyCache.php new file mode 100644 index 000000000..5721c66a0 --- /dev/null +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/DummyKeyCache.php @@ -0,0 +1,112 @@ +. + + */ + +/** + * A basic KeyCache backed by an array. + * @package Swift + * @subpackage KeyCache + * @author Xavier De Cock + */ +class Swift_KeyCache_DummyKeyCache implements Swift_KeyCache +{ + /** + * Set a string into the cache under $itemKey for the namespace $nsKey. + * @param string $nsKey + * @param string $itemKey + * @param string $string + * @param int $mode + * @see MODE_WRITE, MODE_APPEND + */ + public function setString($nsKey, $itemKey, $string, $mode) + {} + + /** + * Set a ByteStream into the cache under $itemKey for the namespace $nsKey. + * @param string $nsKey + * @param string $itemKey + * @param Swift_OutputByteStream $os + * @param int $mode + * @see MODE_WRITE, MODE_APPEND + */ + public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, + $mode) + {} + + /** + * Provides a ByteStream which when written to, writes data to $itemKey. + * NOTE: The stream will always write in append mode. + * @param string $nsKey + * @param string $itemKey + * @return Swift_InputByteStream + */ + public function getInputByteStream($nsKey, $itemKey, + Swift_InputByteStream $writeThrough = null) + { + return false; + } + + /** + * Get data back out of the cache as a string. + * @param string $nsKey + * @param string $itemKey + * @return string + */ + public function getString($nsKey, $itemKey) + { + return false; + } + + /** + * Get data back out of the cache as a ByteStream. + * @param string $nsKey + * @param string $itemKey + * @param Swift_InputByteStream $is to write the data to + */ + public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is) + { + return false; + } + + /** + * Check if the given $itemKey exists in the namespace $nsKey. + * @param string $nsKey + * @param string $itemKey + * @return boolean + */ + public function hasKey($nsKey, $itemKey) + { + return false; + } + + /** + * Clear data for $itemKey in the namespace $nsKey if it exists. + * @param string $nsKey + * @param string $itemKey + */ + public function clearKey($nsKey, $itemKey) + {} + + /** + * Clear all data in the namespace $nsKey if it exists. + * @param string $nsKey + */ + public function clearAll($nsKey) + {} +} diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/KeyCacheInputStream.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/KeyCacheInputStream.php index a1f4440c1..f4a3f4761 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/KeyCacheInputStream.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/KeyCacheInputStream.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/KeyCache.php'; -//@require 'Swift/InputByteStream.php'; /** * Writes data to a KeyCache using a stream. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/NullKeyCache.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/NullKeyCache.php index 2646522e7..d75ab48a3 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/NullKeyCache.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/NullKeyCache.php @@ -8,10 +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'; /** * A null KeyCache that does not cache at all. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php index 87cdced81..e9c90bf56 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/KeyCache.php'; -//@require 'Swift/KeyCacheInputStream.php'; /** * Writes data to a KeyCache using a stream. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/LoadBalancedTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/LoadBalancedTransport.php index 14ae2928b..de3045ad6 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/LoadBalancedTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/LoadBalancedTransport.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/LoadBalancedTransport.php'; -//@require 'Swift/DependencyContainer.php'; /** * Redudantly and rotationally uses several Transport implementations when sending. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MailTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MailTransport.php index afe29c6ff..dd8ccacc8 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MailTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MailTransport.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/MailTransport.php'; -//@require 'Swift/DependencyContainer.php'; /** * Sends Messages using the mail() function. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer.php index c92feb41b..a0561d3d2 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport.php'; -//@require 'Swift/Mime/Message.php'; -//@require 'Swift/Mailer/RecipientIterator.php'; -//@require 'Swift/Events/EventListener.php'; /** * Swift Mailer class. @@ -45,17 +41,27 @@ public static function newInstance(Swift_Transport $transport) { return new self($transport); } - + + /** + * Create a new class instance of one if the message services + * For example 'mimepart' would create a 'message.mimepart' instance + * + * @param string $service + * @return object + */ + public function createMessage($service = 'message') + { + return Swift_DependencyContainer::getInstance() + ->lookup('message.'.$service); + } + /** * Send the given Message like it would be sent in a mail client. * * All recipients (with the exception of Bcc) will be able to see the other * recipients this message was sent to. * - * If you need to send to each recipient without disclosing details about the - * other recipients see {@link batchSend()}. - * - * Recipient/sender data will be retreived from the Message object. + * Recipient/sender data will be retrieved from the Message object. * * The return value is the number of recipients who were accepted for * delivery. @@ -63,7 +69,6 @@ public static function newInstance(Swift_Transport $transport) * @param Swift_Mime_Message $message * @param array &$failedRecipients, optional * @return int - * @see batchSend() */ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { @@ -74,79 +79,19 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) $this->_transport->start(); } - return $this->_transport->send($message, $failedRecipients); - } - - /** - * Send the given Message to all recipients individually. - * - * This differs from {@link send()} in the way headers are presented to the - * recipient. The only recipient in the "To:" field will be the individual - * recipient it was sent to. - * - * If an iterator is provided, recipients will be read from the iterator - * one-by-one, otherwise recipient data will be retreived from the Message - * object. - * - * Sender information is always read from the Message object. - * - * The return value is the number of recipients who were accepted for - * delivery. - * - * @param Swift_Mime_Message $message - * @param array &$failedRecipients, optional - * @param Swift_Mailer_RecipientIterator $it, optional - * @return int - * @see send() - */ - public function batchSend(Swift_Mime_Message $message, - &$failedRecipients = null, - Swift_Mailer_RecipientIterator $it = null) - { - $failedRecipients = (array) $failedRecipients; - $sent = 0; - $to = $message->getTo(); - $cc = $message->getCc(); - $bcc = $message->getBcc(); - if (!empty($cc)) + try { - $message->setCc(array()); + $sent = $this->_transport->send($message, $failedRecipients); } - if (!empty($bcc)) + catch (Swift_RfcComplianceException $e) { - $message->setBcc(array()); - } - - //Use an iterator if set - if (isset($it)) - { - while ($it->hasNext()) + foreach ($message->getTo() as $address => $name) { - $message->setTo($it->nextRecipient()); - $sent += $this->send($message, $failedRecipients); + $failedRecipients[] = $address; } } - else - { - foreach ($to as $address => $name) - { - $message->setTo(array($address => $name)); - $sent += $this->send($message, $failedRecipients); - } - } - - $message->setTo($to); - - if (!empty($cc)) - { - $message->setCc($cc); - } - if (!empty($bcc)) - { - $message->setBcc($bcc); - } return $sent; } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer/ArrayRecipientIterator.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer/ArrayRecipientIterator.php index 65d60c187..c732ebb91 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer/ArrayRecipientIterator.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer/ArrayRecipientIterator.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mailer/RecipientIterator.php'; /** * Wraps a standard PHP array in an interator. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MemorySpool.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MemorySpool.php new file mode 100644 index 000000000..6a64c52f2 --- /dev/null +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MemorySpool.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Stores Messages in memory. + * @package Swift + * @author Fabien Potencier + */ +class Swift_MemorySpool implements Swift_Spool +{ + protected $messages = array(); + + /** + * Tests if this Transport mechanism has started. + * @return boolean + */ + public function isStarted() + { + return true; + } + + /** + * Starts this Transport mechanism. + */ + public function start() + { + } + + /** + * Stops this Transport mechanism. + */ + public function stop() + { + } + + /** + * Stores a message in the queue. + * + * @param Swift_Mime_Message $message The message to store + * + * @return boolean Whether the operation has succeeded + */ + public function queueMessage(Swift_Mime_Message $message) + { + $this->messages[] = $message; + return true; + } + + /** + * Sends messages using the given transport instance. + * + * @param Swift_Transport $transport A transport instance + * @param string[] &$failedRecipients An array of failures by-reference + * + * @return int The number of sent emails + */ + public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) + { + if (!$this->messages) + { + return 0; + } + + if (!$transport->isStarted()) + { + $transport->start(); + } + + $count = 0; + while ($message = array_pop($this->messages)) + { + $count += $transport->send($message, $failedRecipients); + } + + return $count; + } +} diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Message.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Message.php index e7d610e67..2f12ede3f 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Message.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Message.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/SimpleMessage.php'; -//@require 'Swift/MimePart.php'; -//@require 'Swift/DependencyContainer.php'; /** * The Message class for building emails. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Attachment.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Attachment.php index 25ef68b3a..e1c28f406 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Attachment.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Attachment.php @@ -8,11 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/SimpleMimeEntity.php'; -//@require 'Swift/Mime/ContentEncoder.php'; -//@require 'Swift/Mime/HeaderSet.php'; -//@require 'Swift/FileStream.php'; -//@require 'Swift/KeyCache.php'; /** * An attachment, in a multipart message. @@ -31,13 +26,14 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity * @param Swift_Mime_HeaderSet $headers * @param Swift_Mime_ContentEncoder $encoder * @param Swift_KeyCache $cache + * @param Swift_Mime_Grammar $grammar * @param array $mimeTypes optional */ public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, - $mimeTypes = array()) + Swift_Mime_Grammar $grammar, $mimeTypes = array()) { - parent::__construct($headers, $encoder, $cache); + parent::__construct($headers, $encoder, $cache, $grammar); $this->setDisposition('attachment'); $this->setContentType('application/octet-stream'); $this->_mimeTypes = $mimeTypes; @@ -66,6 +62,7 @@ public function getDisposition() /** * Set the Content-Disposition of this attachment. * @param string $disposition + * @return Swift_Mime_Attachment */ public function setDisposition($disposition) { @@ -90,6 +87,7 @@ public function getFilename() /** * Set the filename of this attachment. * @param string $filename + * @return Swift_Mime_Attachment */ public function setFilename($filename) { @@ -110,6 +108,7 @@ public function getSize() /** * Set the file size of this attachment. * @param int $size + * @return Swift_Mime_Attachment */ public function setSize($size) { @@ -121,6 +120,7 @@ public function setSize($size) * Set the file that this attachment is for. * @param Swift_FileStream $file * @param string $contentType optional + * @return Swift_Mime_Attachment */ public function setFile(Swift_FileStream $file, $contentType = null) { diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder.php index e1c99c590..6e02fec4d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Encoder.php'; -//@require 'Swift/InputByteStream.php'; -//@require 'Swift/OutputByteStream.php'; /** * Interface for all Transfer Encoding schemes. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php index e89938ef8..04e1155c5 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/ContentEncoder.php'; -//@require 'Swift/Encoder/Base64Encoder.php'; -//@require 'Swift/InputByteStream.php'; -//@require 'Swift/OutputByteStream.php'; /** * Handles Base 64 Transfer Encoding in Swift Mailer. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php index 4a725d856..7f5ad0826 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/ContentEncoder.php'; -//@require 'Swift/InputByteStream.php'; -//@require 'Swift/OutputByteStream.php'; /** * Handles binary/7/8-bit Transfer Encoding in Swift Mailer. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php index 3beeb635e..8d4937046 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php @@ -8,11 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/ContentEncoder.php'; -//@require 'Swift/Encoder/QpEncoder.php'; -//@require 'Swift/InputByteStrean.php'; -//@require 'Swift/OutputByteStream.php'; -//@require 'Swift/CharacterStream.php'; /** * Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer. @@ -24,17 +19,40 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_ContentEncoder { + protected $_dotEscape; + /** * Creates a new QpContentEncoder for the given CharacterStream. * @param Swift_CharacterStream $charStream to use for reading characters * @param Swift_StreamFilter $filter if canonicalization should occur + * @param boolean $dotEscape if dot stuffing workaround must be enabled */ public function __construct(Swift_CharacterStream $charStream, - Swift_StreamFilter $filter = null) + Swift_StreamFilter $filter = null, $dotEscape=false) { + $this->_dotEscape = $dotEscape; parent::__construct($charStream, $filter); } + public function __sleep() + { + return array('_charStream', '_filter', '_dotEscape'); + } + + protected function getSafeMapShareId() + { + return get_class($this).($this->_dotEscape ? '.dotEscape' : ''); + } + + protected function initSafeMap() + { + parent::initSafeMap(); + if ($this->_dotEscape) { + /* Encode . as =2e for buggy remote servers */ + unset($this->_safeMap[0x2e]); + } + } + /** * Encode stream $in to stream $out. * QP encoded strings have a maximum line length of 76 characters. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/EmbeddedFile.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/EmbeddedFile.php index 983b78dac..529de7f91 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/EmbeddedFile.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/EmbeddedFile.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Attachment.php'; -//@require 'Swift/Mime/ContentEncoder.php'; -//@require 'Swift/KeyCache.php'; -//@require /** * An embedded file, in a multipart message. @@ -27,13 +23,14 @@ class Swift_Mime_EmbeddedFile extends Swift_Mime_Attachment * @param Swift_Mime_HeaderSet $headers * @param Swift_Mime_ContentEncoder $encoder * @param Swift_KeyCache $cache + * @param Swift_Mime_Grammar $grammar * @param array $mimeTypes optional */ public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, - $mimeTypes = array()) + Swift_Mime_Grammar $grammar, $mimeTypes = array()) { - parent::__construct($headers, $encoder, $cache, $mimeTypes); + parent::__construct($headers, $encoder, $cache, $grammar, $mimeTypes); $this->setDisposition('inline'); $this->setId($this->getId()); } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/EncodingObserver.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/EncodingObserver.php index 50472db6c..021cabd0f 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/EncodingObserver.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/EncodingObserver.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/ContentEncoder.php'; /** * Observes changes for a Mime entity's ContentEncoder. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Grammar.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Grammar.php new file mode 100644 index 000000000..5e021fc59 --- /dev/null +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Grammar.php @@ -0,0 +1,178 @@ +init(); + } + + public function __wakeup() + { + $this->init(); + } + + protected function init() + { + if(count(self::$_specials) > 0) + { + return; + } + + self::$_specials = array( + '(', ')', '<', '>', '[', ']', + ':', ';', '@', ',', '.', '"' + ); + + /*** Refer to RFC 2822 for ABNF grammar ***/ + + //All basic building blocks + self::$_grammar['NO-WS-CTL'] = '[\x01-\x08\x0B\x0C\x0E-\x19\x7F]'; + self::$_grammar['WSP'] = '[ \t]'; + self::$_grammar['CRLF'] = '(?:\r\n)'; + self::$_grammar['FWS'] = '(?:(?:' . self::$_grammar['WSP'] . '*' . + self::$_grammar['CRLF'] . ')?' . self::$_grammar['WSP'] . ')'; + self::$_grammar['text'] = '[\x00-\x08\x0B\x0C\x0E-\x7F]'; + self::$_grammar['quoted-pair'] = '(?:\\\\' . self::$_grammar['text'] . ')'; + self::$_grammar['ctext'] = '(?:' . self::$_grammar['NO-WS-CTL'] . + '|[\x21-\x27\x2A-\x5B\x5D-\x7E])'; + //Uses recursive PCRE (?1) -- could be a weak point?? + self::$_grammar['ccontent'] = '(?:' . self::$_grammar['ctext'] . '|' . + self::$_grammar['quoted-pair'] . '|(?1))'; + self::$_grammar['comment'] = '(\((?:' . self::$_grammar['FWS'] . '|' . + self::$_grammar['ccontent']. ')*' . self::$_grammar['FWS'] . '?\))'; + self::$_grammar['CFWS'] = '(?:(?:' . self::$_grammar['FWS'] . '?' . + self::$_grammar['comment'] . ')*(?:(?:' . self::$_grammar['FWS'] . '?' . + self::$_grammar['comment'] . ')|' . self::$_grammar['FWS'] . '))'; + self::$_grammar['qtext'] = '(?:' . self::$_grammar['NO-WS-CTL'] . + '|[\x21\x23-\x5B\x5D-\x7E])'; + self::$_grammar['qcontent'] = '(?:' . self::$_grammar['qtext'] . '|' . + self::$_grammar['quoted-pair'] . ')'; + self::$_grammar['quoted-string'] = '(?:' . self::$_grammar['CFWS'] . '?"' . + '(' . self::$_grammar['FWS'] . '?' . self::$_grammar['qcontent'] . ')*' . + self::$_grammar['FWS'] . '?"' . self::$_grammar['CFWS'] . '?)'; + self::$_grammar['atext'] = '[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]'; + self::$_grammar['atom'] = '(?:' . self::$_grammar['CFWS'] . '?' . + self::$_grammar['atext'] . '+' . self::$_grammar['CFWS'] . '?)'; + self::$_grammar['dot-atom-text'] = '(?:' . self::$_grammar['atext'] . '+' . + '(\.' . self::$_grammar['atext'] . '+)*)'; + self::$_grammar['dot-atom'] = '(?:' . self::$_grammar['CFWS'] . '?' . + self::$_grammar['dot-atom-text'] . '+' . self::$_grammar['CFWS'] . '?)'; + self::$_grammar['word'] = '(?:' . self::$_grammar['atom'] . '|' . + self::$_grammar['quoted-string'] . ')'; + self::$_grammar['phrase'] = '(?:' . self::$_grammar['word'] . '+?)'; + self::$_grammar['no-fold-quote'] = '(?:"(?:' . self::$_grammar['qtext'] . + '|' . self::$_grammar['quoted-pair'] . ')*")'; + self::$_grammar['dtext'] = '(?:' . self::$_grammar['NO-WS-CTL'] . + '|[\x21-\x5A\x5E-\x7E])'; + self::$_grammar['no-fold-literal'] = '(?:\[(?:' . self::$_grammar['dtext'] . + '|' . self::$_grammar['quoted-pair'] . ')*\])'; + + //Message IDs + self::$_grammar['id-left'] = '(?:' . self::$_grammar['dot-atom-text'] . '|' . + self::$_grammar['no-fold-quote'] . ')'; + self::$_grammar['id-right'] = '(?:' . self::$_grammar['dot-atom-text'] . '|' . + self::$_grammar['no-fold-literal'] . ')'; + + //Addresses, mailboxes and paths + self::$_grammar['local-part'] = '(?:' . self::$_grammar['dot-atom'] . '|' . + self::$_grammar['quoted-string'] . ')'; + self::$_grammar['dcontent'] = '(?:' . self::$_grammar['dtext'] . '|' . + self::$_grammar['quoted-pair'] . ')'; + self::$_grammar['domain-literal'] = '(?:' . self::$_grammar['CFWS'] . '?\[(' . + self::$_grammar['FWS'] . '?' . self::$_grammar['dcontent'] . ')*?' . + self::$_grammar['FWS'] . '?\]' . self::$_grammar['CFWS'] . '?)'; + self::$_grammar['domain'] = '(?:' . self::$_grammar['dot-atom'] . '|' . + self::$_grammar['domain-literal'] . ')'; + self::$_grammar['addr-spec'] = '(?:' . self::$_grammar['local-part'] . '@' . + self::$_grammar['domain'] . ')'; + } + + /** + * Get the grammar defined for $name token. + * @param string $name execatly as written in the RFC + * @return string + */ + public function getDefinition($name) + { + if (array_key_exists($name, self::$_grammar)) + { + return self::$_grammar[$name]; + } + else + { + throw new Swift_RfcComplianceException( + "No such grammar '" . $name . "' defined." + ); + } + } + + /** + * Returns the tokens defined in RFC 2822 (and some related RFCs). + * @return array + */ + public function getGrammarDefinitions() + { + return self::$_grammar; + } + + /** + * Returns the current special characters used in the syntax which need to be escaped. + * @return array + */ + public function getSpecials() + { + return self::$_specials; + } + + /** + * Escape special characters in a string (convert to quoted-pairs). + * @param string $token + * @param string[] $include additonal chars to escape + * @param string[] $exclude chars from escaping + * @return string + */ + public function escapeSpecials($token, $include = array(), + $exclude = array()) + { + foreach ( + array_merge(array('\\'), array_diff(self::$_specials, $exclude), $include) as $char) + { + $token = str_replace($char, '\\' . $char, $token); + } + return $token; + } +} diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder.php index cc70c5f6c..023f36779 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Encoder.php'; /** * Interface for all Header Encoding schemes. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php index feaba981c..1395dae8d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php @@ -32,5 +32,30 @@ public function getName() { return 'B'; } - + + + /** + * Takes an unencoded string and produces a Base64 encoded string from it. + * If the charset is iso-2022-jp, it uses mb_encode_mimeheader instead of + * default encodeString, otherwise pass to the parent method. + * @param string $string to encode + * @param int $firstLineOffset + * @param int $maxLineLength, optional, 0 indicates the default of 76 bytes + * @param string $charset + * @return string + */ + public function encodeString($string, $firstLineOffset = 0, + $maxLineLength = 0, $charset = 'utf-8') + { + if (strtolower($charset) === 'iso-2022-jp') + { + $old = mb_internal_encoding(); + mb_internal_encoding('utf-8'); + $newstring = mb_encode_mimeheader($string, $charset, $this->getName(), "\r\n"); + mb_internal_encoding($old); + return $newstring; + } + return parent::encodeString($string, $firstLineOffset, $maxLineLength); + } + } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php index d727da027..9dbb71319 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php @@ -22,8 +22,6 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_HeaderEncoder { - private static $_headerSafeMap = array(); - /** * Creates a new QpHeaderEncoder for the given CharacterStream. * @param Swift_CharacterStream $charStream to use for reading characters @@ -31,15 +29,16 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder public function __construct(Swift_CharacterStream $charStream) { parent::__construct($charStream); - if (empty(self::$_headerSafeMap)) + } + + protected function initSafeMap() + { + foreach (array_merge( + range(0x61, 0x7A), range(0x41, 0x5A), + range(0x30, 0x39), array(0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F) + ) as $byte) { - foreach (array_merge( - range(0x61, 0x7A), range(0x41, 0x5A), - range(0x30, 0x39), array(0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F) - ) as $byte) - { - self::$_headerSafeMap[$byte] = chr($byte); - } + $this->_safeMap[$byte] = chr($byte); } } @@ -61,39 +60,11 @@ public function getName() * @return string */ public function encodeString($string, $firstLineOffset = 0, - $maxLineLength = 0) + $maxLineLength = 0, $charst = 'utf-8') { return str_replace(array(' ', '=20', "=\r\n"), array('_', '_', "\r\n"), parent::encodeString($string, $firstLineOffset, $maxLineLength) ); } - // -- Overridden points of extension - - /** - * Encode the given byte array into a verbatim QP form. - * @param int[] $bytes - * @return string - * @access protected - */ - protected function _encodeByteSequence(array $bytes, &$size) - { - $ret = ''; - $size=0; - foreach ($bytes as $b) - { - if (isset(self::$_headerSafeMap[$b])) - { - $ret .= self::$_headerSafeMap[$b]; - ++$size; - } - else - { - $ret .= self::$_qpMap[$b]; - $size+=3; - } - } - return $ret; - } - } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderFactory.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderFactory.php index 83bb35ad6..13083bb0a 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderFactory.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderFactory.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/CharsetObserver.php'; /** * Creates MIME headers. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderSet.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderSet.php index 81e7a979b..65895091d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderSet.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderSet.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/CharsetObserver.php'; /** * A collection of MIME headers. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php index c3049c25c..5a6fffeec 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Header.php'; -//@require 'Swift/Mime/HeaderEncoder.php'; -//@require 'Swift/RfcComplianceException.php'; - /** * An abstract base MIME Header. * @package Swift @@ -22,25 +18,18 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header { /** - * Special characters used in the syntax which need to be escaped. - * @var string[] - * @access private - */ - private $_specials = array(); - - /** - * Tokens defined in RFC 2822 (and some related RFCs). - * @var string[] + * The name of this Header. + * @var string * @access private */ - private $_grammar = array(); + private $_name; /** - * The name of this Header. - * @var string + * The Grammar used for this Header. + * @var Swift_Mime_Grammar * @access private */ - private $_name; + private $_grammar; /** * The Encoder used to encode this Header. @@ -76,6 +65,15 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header */ private $_cachedValue = null; + /** + * Creates a new Header. + * @param Swift_Mime_Grammar $grammar + */ + public function __construct(Swift_Mime_Grammar $grammar) + { + $this->setGrammar($grammar); + } + /** * Set the character set used in this Header. * @param string $charset @@ -139,6 +137,25 @@ public function getEncoder() return $this->_encoder; } + /** + * Set the grammar used for the header. + * @param Swift_Mime_Grammar $grammar + */ + public function setGrammar(Swift_Mime_Grammar $grammar) + { + $this->_grammar = $grammar; + $this->setCachedValue(null); + } + + /** + * Get the grammar used for this Header. + * @return Swift_Mime_Grammar + */ + public function getGrammar() + { + return $this->_grammar; + } + /** * Get the name of this header (e.g. charset). * @return string @@ -201,118 +218,6 @@ protected function setFieldName($name) $this->_name = $name; } - /** - * Initialize some RFC 2822 (and friends) ABNF grammar definitions. - * @access protected - */ - protected function initializeGrammar() - { - $this->_specials = array( - '(', ')', '<', '>', '[', ']', - ':', ';', '@', ',', '.', '"' - ); - - /*** Refer to RFC 2822 for ABNF grammar ***/ - - //All basic building blocks - $this->_grammar['NO-WS-CTL'] = '[\x01-\x08\x0B\x0C\x0E-\x19\x7F]'; - $this->_grammar['WSP'] = '[ \t]'; - $this->_grammar['CRLF'] = '(?:\r\n)'; - $this->_grammar['FWS'] = '(?:(?:' . $this->_grammar['WSP'] . '*' . - $this->_grammar['CRLF'] . ')?' . $this->_grammar['WSP'] . ')'; - $this->_grammar['text'] = '[\x00-\x08\x0B\x0C\x0E-\x7F]'; - $this->_grammar['quoted-pair'] = '(?:\\\\' . $this->_grammar['text'] . ')'; - $this->_grammar['ctext'] = '(?:' . $this->_grammar['NO-WS-CTL'] . - '|[\x21-\x27\x2A-\x5B\x5D-\x7E])'; - //Uses recursive PCRE (?1) -- could be a weak point?? - $this->_grammar['ccontent'] = '(?:' . $this->_grammar['ctext'] . '|' . - $this->_grammar['quoted-pair'] . '|(?1))'; - $this->_grammar['comment'] = '(\((?:' . $this->_grammar['FWS'] . '|' . - $this->_grammar['ccontent']. ')*' . $this->_grammar['FWS'] . '?\))'; - $this->_grammar['CFWS'] = '(?:(?:' . $this->_grammar['FWS'] . '?' . - $this->_grammar['comment'] . ')*(?:(?:' . $this->_grammar['FWS'] . '?' . - $this->_grammar['comment'] . ')|' . $this->_grammar['FWS'] . '))'; - $this->_grammar['qtext'] = '(?:' . $this->_grammar['NO-WS-CTL'] . - '|[\x21\x23-\x5B\x5D-\x7E])'; - $this->_grammar['qcontent'] = '(?:' . $this->_grammar['qtext'] . '|' . - $this->_grammar['quoted-pair'] . ')'; - $this->_grammar['quoted-string'] = '(?:' . $this->_grammar['CFWS'] . '?"' . - '(' . $this->_grammar['FWS'] . '?' . $this->_grammar['qcontent'] . ')*' . - $this->_grammar['FWS'] . '?"' . $this->_grammar['CFWS'] . '?)'; - $this->_grammar['atext'] = '[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]'; - $this->_grammar['atom'] = '(?:' . $this->_grammar['CFWS'] . '?' . - $this->_grammar['atext'] . '+' . $this->_grammar['CFWS'] . '?)'; - $this->_grammar['dot-atom-text'] = '(?:' . $this->_grammar['atext'] . '+' . - '(\.' . $this->_grammar['atext'] . '+)*)'; - $this->_grammar['dot-atom'] = '(?:' . $this->_grammar['CFWS'] . '?' . - $this->_grammar['dot-atom-text'] . '+' . $this->_grammar['CFWS'] . '?)'; - $this->_grammar['word'] = '(?:' . $this->_grammar['atom'] . '|' . - $this->_grammar['quoted-string'] . ')'; - $this->_grammar['phrase'] = '(?:' . $this->_grammar['word'] . '+?)'; - $this->_grammar['no-fold-quote'] = '(?:"(?:' . $this->_grammar['qtext'] . - '|' . $this->_grammar['quoted-pair'] . ')*")'; - $this->_grammar['dtext'] = '(?:' . $this->_grammar['NO-WS-CTL'] . - '|[\x21-\x5A\x5E-\x7E])'; - $this->_grammar['no-fold-literal'] = '(?:\[(?:' . $this->_grammar['dtext'] . - '|' . $this->_grammar['quoted-pair'] . ')*\])'; - - //Message IDs - $this->_grammar['id-left'] = '(?:' . $this->_grammar['dot-atom-text'] . '|' . - $this->_grammar['no-fold-quote'] . ')'; - $this->_grammar['id-right'] = '(?:' . $this->_grammar['dot-atom-text'] . '|' . - $this->_grammar['no-fold-literal'] . ')'; - - //Addresses, mailboxes and paths - $this->_grammar['local-part'] = '(?:' . $this->_grammar['dot-atom'] . '|' . - $this->_grammar['quoted-string'] . ')'; - $this->_grammar['dcontent'] = '(?:' . $this->_grammar['dtext'] . '|' . - $this->_grammar['quoted-pair'] . ')'; - $this->_grammar['domain-literal'] = '(?:' . $this->_grammar['CFWS'] . '?\[(' . - $this->_grammar['FWS'] . '?' . $this->_grammar['dcontent'] . ')*?' . - $this->_grammar['FWS'] . '?\]' . $this->_grammar['CFWS'] . '?)'; - $this->_grammar['domain'] = '(?:' . $this->_grammar['dot-atom'] . '|' . - $this->_grammar['domain-literal'] . ')'; - $this->_grammar['addr-spec'] = '(?:' . $this->_grammar['local-part'] . '@' . - $this->_grammar['domain'] . ')'; - } - - /** - * Get the grammar defined for $name token. - * @param string $name execatly as written in the RFC - * @return string - */ - protected function getGrammar($name) - { - if (array_key_exists($name, $this->_grammar)) - { - return $this->_grammar[$name]; - } - else - { - throw new Swift_RfcComplianceException( - "No such grammar '" . $name . "' defined." - ); - } - } - - /** - * Escape special characters in a string (convert to quoted-pairs). - * @param string $token - * @param string[] $include additonal chars to escape - * @param string[] $exclude chars from escaping - * @return string - */ - protected function escapeSpecials($token, $include = array(), - $exclude = array()) - { - foreach ( - array_merge(array('\\'), array_diff($this->_specials, $exclude), $include) as $char) - { - $token = str_replace($char, '\\' . $char, $token); - } - return $token; - } - /** * Produces a compliant, formatted RFC 2822 'phrase' based on the string given. * @param Swift_Mime_Header $header @@ -328,14 +233,14 @@ protected function createPhrase(Swift_Mime_Header $header, $string, $charset, //Treat token as exactly what was given $phraseStr = $string; //If it's not valid - if (!preg_match('/^' . $this->_grammar['phrase'] . '$/D', $phraseStr)) + if (!preg_match('/^' . $this->getGrammar()->getDefinition('phrase') . '$/D', $phraseStr)) { // .. but it is just ascii text, try escaping some characters // and make it a quoted-string - if (preg_match('/^' . $this->_grammar['text'] . '*$/D', $phraseStr)) + if (preg_match('/^' . $this->getGrammar()->getDefinition('text') . '*$/D', $phraseStr)) { - $phraseStr = $this->escapeSpecials( - $phraseStr, array('"'), $this->_specials + $phraseStr = $this->getGrammar()->escapeSpecials( + $phraseStr, array('"'), $this->getGrammar()->getSpecials() ); $phraseStr = '"' . $phraseStr . '"'; } @@ -472,15 +377,18 @@ protected function getTokenAsEncodedWord($token, $firstLineOffset = 0) $encodedTextLines = explode("\r\n", $this->_encoder->encodeString( - $token, $firstLineOffset, 75 - $encodingWrapperLength + $token, $firstLineOffset, 75 - $encodingWrapperLength, $this->_charset ) - ); - - foreach ($encodedTextLines as $lineNum => $line) + ); + + if (strtolower($this->_charset) !== 'iso-2022-jp') // special encoding for iso-2022-jp using mb_encode_mimeheader { - $encodedTextLines[$lineNum] = '=?' . $charsetDecl . - '?' . $this->_encoder->getName() . - '?' . $line . '?='; + foreach ($encodedTextLines as $lineNum => $line) + { + $encodedTextLines[$lineNum] = '=?' . $charsetDecl . + '?' . $this->_encoder->getName() . + '?' . $line . '?='; + } } return implode("\r\n ", $encodedTextLines); @@ -534,9 +442,9 @@ protected function clearCachedValueIf($condition) /** * Generate a list of all tokens in the final header. - * @param string $string input, optional - * @return string[] - * @access private + * @param string $string The string to tokenize + * @return array An array of tokens as strings + * @access protected */ protected function toTokens($string = null) { diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/DateHeader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/DateHeader.php index 598c0c5a9..bb345fdc8 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/DateHeader.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/DateHeader.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Headers/AbstractHeader.php'; /** @@ -36,10 +35,12 @@ class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader * ?> * * @param string $name of Header + * @param Swift_Mime_Grammar $grammar */ - public function __construct($name) + public function __construct($name, Swift_Mime_Grammar $grammar) { $this->setFieldName($name); + parent::__construct($grammar); } /** diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/IdentificationHeader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/IdentificationHeader.php index 55ff73730..030417589 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/IdentificationHeader.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/IdentificationHeader.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Headers/AbstractHeader.php'; -//@require 'Swift/RfcComplianceException.php'; /** * An ID MIME Header for something like Message-ID or Content-ID. @@ -32,11 +30,12 @@ class Swift_Mime_Headers_IdentificationHeader /** * Creates a new IdentificationHeader with the given $name and $id. * @param string $name + * @param Swift_Mime_Grammar $grammar */ - public function __construct($name) + public function __construct($name, Swift_Mime_Grammar $grammar) { $this->setFieldName($name); - $this->initializeGrammar(); + parent::__construct($grammar); } /** @@ -73,12 +72,12 @@ public function getFieldBodyModel() /** * Set the ID used in the value of this header. - * @param string $id + * @param string|array $id * @throws Swift_RfcComplianceException */ public function setId($id) { - return $this->setIds(array($id)); + $this->setIds(is_array($id) ? $id : array($id)); } /** @@ -103,22 +102,10 @@ public function setIds(array $ids) { $actualIds = array(); - foreach ($ids as $k => $id) + foreach ($ids as $id) { - if (preg_match( - '/^' . $this->getGrammar('id-left') . '@' . - $this->getGrammar('id-right') . '$/D', - $id - )) - { - $actualIds[] = $id; - } - else - { - throw new Swift_RfcComplianceException( - 'Invalid ID given <' . $id . '>' - ); - } + $this->_assertValidId($id); + $actualIds[] = $id; } $this->clearCachedValueIf($this->_ids != $actualIds); @@ -158,4 +145,22 @@ public function getFieldBody() return $this->getCachedValue(); } + /** + * Throws an Exception if the id passed does not comply with RFC 2822. + * @param string $id + * @throws Swift_RfcComplianceException + */ + private function _assertValidId($id) + { + if (!preg_match( + '/^' . $this->getGrammar()->getDefinition('id-left') . '@' . + $this->getGrammar()->getDefinition('id-right') . '$/D', + $id + )) + { + throw new Swift_RfcComplianceException( + 'Invalid ID given <' . $id . '>' + ); + } + } } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php index 77d3bba22..066456053 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Headers/AbstractHeader.php'; -//@require 'Swift/Mime/HeaderEncoder.php'; /** * A Mailbox Address MIME Header for something like From or Sender. @@ -31,12 +29,13 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader * Creates a new MailboxHeader with $name. * @param string $name of Header * @param Swift_Mime_HeaderEncoder $encoder + * @param Swift_Mime_Grammar $grammar */ - public function __construct($name, Swift_Mime_HeaderEncoder $encoder) + public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar) { $this->setFieldName($name); $this->setEncoder($encoder); - $this->initializeGrammar(); + parent::__construct($grammar); } /** @@ -168,7 +167,7 @@ public function getNameAddresses() */ public function setAddresses($addresses) { - return $this->setNameAddresses(array_values((array) $addresses)); + $this->setNameAddresses(array_values((array) $addresses)); } /** @@ -268,6 +267,17 @@ protected function createMailboxListString(array $mailboxes) { return implode(', ', $this->_createNameAddressStrings($mailboxes)); } + + /** + * Redefine the encoding requirements for mailboxes. Commas and semicolons are used to separate + * multiple addresses, and should therefore be encoded + * @param string $token + * @return boolean + */ + protected function tokenNeedsEncoding($token) + { + return preg_match('/[,;]/', $token) || parent::tokenNeedsEncoding($token); + } // -- Private methods @@ -298,12 +308,12 @@ private function _createNameAddressStrings(array $mailboxes) /** * Throws an Exception if the address passed does not comply with RFC 2822. * @param string $address - * @throws Exception If invalid. - * @access protected + * @throws Swift_RfcComplianceException If invalid. + * @access private */ private function _assertValidAddress($address) { - if (!preg_match('/^' . $this->getGrammar('addr-spec') . '$/D', + if (!preg_match('/^' . $this->getGrammar()->getDefinition('addr-spec') . '$/D', $address)) { throw new Swift_RfcComplianceException( diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/ParameterizedHeader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/ParameterizedHeader.php index 974b44e2b..0a31b2ddf 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/ParameterizedHeader.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/ParameterizedHeader.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Headers/UnstructuredHeader.php'; -//@require 'Swift/Mime/HeaderEncoder.php'; -//@require 'Swift/Mime/ParameterizedHeader.php'; -//@require 'Swift/Encoder.php'; /** * An abstract base MIME Header. @@ -24,6 +20,12 @@ class Swift_Mime_Headers_ParameterizedHeader implements Swift_Mime_ParameterizedHeader { + /** + * RFC 2231's definition of a token. + * @var string + */ + const TOKEN_REGEX = '(?:[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+)'; + /** * The Encoder used to encode the parameters. * @var Swift_Encoder @@ -38,27 +40,18 @@ class Swift_Mime_Headers_ParameterizedHeader */ private $_params = array(); - /** - * RFC 2231's definition of a token. - * @var string - * @access private - */ - private $_tokenRe; - /** * Creates a new ParameterizedHeader with $name. * @param string $name * @param Swift_Mime_HeaderEncoder $encoder * @param Swift_Encoder $paramEncoder, optional + * @param Swift_Mime_Grammar $grammar */ public function __construct($name, Swift_Mime_HeaderEncoder $encoder, - Swift_Encoder $paramEncoder = null) + Swift_Encoder $paramEncoder = null, Swift_Mime_Grammar $grammar) { - $this->setFieldName($name); - $this->setEncoder($encoder); + parent::__construct($name, $encoder, $grammar); $this->_paramEncoder = $paramEncoder; - $this->initializeGrammar(); - $this->_tokenRe = '(?:[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+)'; } /** @@ -150,7 +143,8 @@ public function getFieldBody() //TODO: Check caching here * Generate a list of all tokens in the final header. * This doesn't need to be overridden in theory, but it is for implementation * reasons to prevent potential breakage of attributes. - * @return string[] + * @param string $string The string to tokenize + * @return array An array of tokens as strings * @access protected */ protected function toTokens($string = null) @@ -192,11 +186,11 @@ private function _createParameter($name, $value) $firstLineOffset = 0; //If it's not already a valid parameter value... - if (!preg_match('/^' . $this->_tokenRe . '$/D', $value)) + if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) { //TODO: text, or something else?? //... and it's not ascii - if (!preg_match('/^' . $this->getGrammar('text') . '*$/D', $value)) + if (!preg_match('/^' . $this->getGrammar()->getDefinition('text') . '*$/D', $value)) { $encoded = true; //Allow space for the indices, charset and language @@ -213,7 +207,7 @@ private function _createParameter($name, $value) if (isset($this->_paramEncoder)) { $value = $this->_paramEncoder->encodeString( - $origValue, $firstLineOffset, $maxValueLength + $origValue, $firstLineOffset, $maxValueLength, $this->getCharset() ); } else //We have to go against RFC 2183/2231 in some areas for interoperability @@ -232,7 +226,7 @@ private function _createParameter($name, $value) foreach ($valueLines as $i => $line) { $paramLines[] = $name . '*' . $i . - $this->_getEndOfParameterValue($line, $encoded, $i == 0); + $this->_getEndOfParameterValue($line, true, $i == 0); } return implode(";\r\n ", $paramLines); } @@ -254,7 +248,7 @@ private function _createParameter($name, $value) */ private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false) { - if (!preg_match('/^' . $this->_tokenRe . '$/D', $value)) + if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) { $value = '"' . $value . '"'; } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/PathHeader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/PathHeader.php index 0a8a100a8..7f1252d92 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/PathHeader.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/PathHeader.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Headers/AbstractHeader.php'; -//@require 'Swift/RfcComplianceException.php'; /** * A Path Header in Swift Mailer, such a Return-Path. @@ -30,11 +28,12 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader /** * Creates a new PathHeader with the given $name. * @param string $name + * @param Swift_Mime_Grammar $grammar */ - public function __construct($name) + public function __construct($name, Swift_Mime_Grammar $grammar) { $this->setFieldName($name); - $this->initializeGrammar(); + parent::__construct($grammar); } /** @@ -80,16 +79,14 @@ public function setAddress($address) { $this->_address = null; } - elseif ('' == $address - || preg_match('/^' . $this->getGrammar('addr-spec') . '$/D', $address)) + elseif ('' == $address) { - $this->_address = $address; + $this->_address = ''; } else { - throw new Swift_RfcComplianceException( - 'Address set in PathHeader does not comply with addr-spec of RFC 2822.' - ); + $this->_assertValidAddress($address); + $this->_address = $address; } $this->setCachedValue(null); } @@ -123,4 +120,21 @@ public function getFieldBody() return $this->getCachedValue(); } + /** + * Throws an Exception if the address passed does not comply with RFC 2822. + * @param string $address + * @throws Swift_RfcComplianceException If invalid. + * @access private + */ + private function _assertValidAddress($address) + { + if (!preg_match('/^' . $this->getGrammar()->getDefinition('addr-spec') . '$/D', + $address)) + { + throw new Swift_RfcComplianceException( + 'Address set in PathHeader does not comply with addr-spec of RFC 2822.' + ); + } + } + } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/UnstructuredHeader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/UnstructuredHeader.php index fdcc21ed1..491d7eb4a 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/UnstructuredHeader.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/UnstructuredHeader.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Headers/AbstractHeader.php'; -//@require 'Swift/Mime/HeaderEncoder.php'; /** * A Simple MIME Header. @@ -32,12 +30,15 @@ class Swift_Mime_Headers_UnstructuredHeader * Creates a new SimpleHeader with $name. * @param string $name * @param Swift_Mime_HeaderEncoder $encoder + * @param Swift_Mime_Grammar $grammar */ - public function __construct($name, Swift_Mime_HeaderEncoder $encoder) + public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar) { $this->setFieldName($name); $this->setEncoder($encoder); + parent::__construct($grammar); } + /** * Get the type of Header that this instance represents. * @return int @@ -97,9 +98,7 @@ public function getFieldBody() if (!$this->getCachedValue()) { $this->setCachedValue( - str_replace('\\', '\\\\', $this->encodeWords( - $this, $this->_value, -1, $this->getCharset(), $this->getEncoder() - )) + $this->encodeWords($this, $this->_value) ); } return $this->getCachedValue(); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Message.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Message.php index 0496c0877..497f36eaa 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Message.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/Message.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/MimeEntity.php'; /** * A Message (RFC 2822) object. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/MimeEntity.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/MimeEntity.php index 2b08009d9..b46c296d6 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/MimeEntity.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/MimeEntity.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/InputByteStream.php'; -//@require 'Swift/Mime/EncodingObserver.php'; -//@require 'Swift/Mime/CharsetObserver.php'; /** * A MIME entity, such as an attachment. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/MimePart.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/MimePart.php index 78c6fe09f..d93d4b4dd 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/MimePart.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/MimePart.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/SimpleMimeEntity.php'; -//@require 'Swift/Mime/ContentEncoder.php'; -//@require 'Swift/Mime/HeaderSet.php'; -//@require 'Swift/KeyCache.php'; /** * A MIME part, in a multipart message. @@ -41,12 +37,13 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity * @param Swift_Mime_HeaderSet $headers * @param Swift_Mime_ContentEncoder $encoder * @param Swift_KeyCache $cache + * @param Swift_Mime_Grammar $grammar * @param string $charset */ public function __construct(Swift_Mime_HeaderSet $headers, - Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, $charset = null) + Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null) { - parent::__construct($headers, $encoder, $cache); + parent::__construct($headers, $encoder, $cache, $grammar); $this->setContentType('text/plain'); if (!is_null($charset)) { @@ -61,14 +58,18 @@ public function __construct(Swift_Mime_HeaderSet $headers, * @param mixed $body * @param string $contentType optional * @param string $charset optional + * @param Swift_Mime_MimePart */ public function setBody($body, $contentType = null, $charset = null) { - parent::setBody($body, $contentType); if (isset($charset)) { $this->setCharset($charset); } + $body = $this->_convertString($body); + + parent::setBody($body, $contentType); + return $this; } @@ -86,6 +87,7 @@ public function getCharset() * Set the character set of this entity. * * @param string $charset + * @param Swift_Mime_MimePart */ public function setCharset($charset) { @@ -113,6 +115,7 @@ public function getFormat() * Set the format of this entity (flowed or fixed). * * @param string $format + * @param Swift_Mime_MimePart */ public function setFormat($format) { @@ -137,6 +140,7 @@ public function getDelSp() * Turn delsp on or off for this entity. * * @param boolean $delsp + * @param Swift_Mime_MimePart */ public function setDelSp($delsp = true) { @@ -193,4 +197,28 @@ protected function _setNestingLevel($level) $this->_nestingLevel = $level; } + /** Encode charset when charset is not utf-8 */ + protected function _convertString($string) + { + $charset = strtolower($this->getCharset()); + if (!in_array($charset, array('utf-8', 'iso-8859-1', ""))) + { + // mb_convert_encoding must be the first one to check, since iconv cannot convert some words. + if (function_exists('mb_convert_encoding')) + { + $string = mb_convert_encoding($string, $charset, 'utf-8'); + } + else if (function_exists('iconv')) + { + $string = iconv($charset, 'utf-8//TRANSLIT//IGNORE', $string); + } + else + { + throw new Swift_SwiftException('No suitable convert encoding function (use UTF-8 as your harset or install the mbstring or iconv extension).'); + } + return $string; + } + return $string; + } + } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ParameterizedHeader.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ParameterizedHeader.php index da65ca98c..12e3586cc 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ParameterizedHeader.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/ParameterizedHeader.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Header.php'; /** * A MIME Header with parameters. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php index 6954ac5c0..35156d32a 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php @@ -8,15 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/HeaderFactory.php'; -//@require 'Swift/Mime/HeaderEncoder.php'; -//@require 'Swift/Encoder.php'; -//@require 'Swift/Mime/Headers/MailboxHeader.php'; -//@require 'Swift/Mime/Headers/DateHeader.php'; -//@require 'Swift/Mime/Headers/UnstructuredHeader.php'; -//@require 'Swift/Mime/Headers/ParameterizedHeader.php'; -//@require 'Swift/Mime/Headers/IdentificationHeader.php'; -//@require 'Swift/Mime/Headers/PathHeader.php'; /** * Creates MIME headers. @@ -33,6 +24,9 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory /** The Encoder used by parameters */ private $_paramEncoder; + /** The Grammar */ + private $_grammar; + /** The charset of created Headers */ private $_charset; @@ -40,13 +34,15 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory * Creates a new SimpleHeaderFactory using $encoder and $paramEncoder. * @param Swift_Mime_HeaderEncoder $encoder * @param Swift_Encoder $paramEncoder + * @param Swift_Mime_Grammar $grammar * @param string $charset */ public function __construct(Swift_Mime_HeaderEncoder $encoder, - Swift_Encoder $paramEncoder, $charset = null) + Swift_Encoder $paramEncoder, Swift_Mime_Grammar $grammar, $charset = null) { $this->_encoder = $encoder; $this->_paramEncoder = $paramEncoder; + $this->_grammar = $grammar; $this->_charset = $charset; } @@ -58,7 +54,7 @@ public function __construct(Swift_Mime_HeaderEncoder $encoder, */ public function createMailboxHeader($name, $addresses = null) { - $header = new Swift_Mime_Headers_MailboxHeader($name, $this->_encoder); + $header = new Swift_Mime_Headers_MailboxHeader($name, $this->_encoder, $this->_grammar); if (isset($addresses)) { $header->setFieldBodyModel($addresses); @@ -75,7 +71,7 @@ public function createMailboxHeader($name, $addresses = null) */ public function createDateHeader($name, $timestamp = null) { - $header = new Swift_Mime_Headers_DateHeader($name); + $header = new Swift_Mime_Headers_DateHeader($name, $this->_grammar); if (isset($timestamp)) { $header->setFieldBodyModel($timestamp); @@ -92,7 +88,7 @@ public function createDateHeader($name, $timestamp = null) */ public function createTextHeader($name, $value = null) { - $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->_encoder); + $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->_encoder, $this->_grammar); if (isset($value)) { $header->setFieldBodyModel($value); @@ -114,7 +110,8 @@ public function createParameterizedHeader($name, $value = null, $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->_encoder, (strtolower($name) == 'content-disposition') ? $this->_paramEncoder - : null + : null, + $this->_grammar ); if (isset($value)) { @@ -136,7 +133,7 @@ public function createParameterizedHeader($name, $value = null, */ public function createIdHeader($name, $ids = null) { - $header = new Swift_Mime_Headers_IdentificationHeader($name); + $header = new Swift_Mime_Headers_IdentificationHeader($name, $this->_grammar); if (isset($ids)) { $header->setFieldBodyModel($ids); @@ -153,7 +150,7 @@ public function createIdHeader($name, $ids = null) */ public function createPathHeader($name, $path = null) { - $header = new Swift_Mime_Headers_PathHeader($name); + $header = new Swift_Mime_Headers_PathHeader($name, $this->_grammar); if (isset($path)) { $header->setFieldBodyModel($path); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php index eeb0221bb..e3435ad8d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/HeaderSet.php'; -//@require 'Swift/Mime/HeaderFactory.php'; /** * A collection of MIME headers. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMessage.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMessage.php index bbe1e8fc5..c8fdb34fc 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMessage.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMessage.php @@ -8,11 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Message.php'; -//@require 'Swift/Mime/MimePart.php'; -//@require 'Swift/Mime/MimeEntity.php'; -//@require 'Swift/Mime/HeaderSet.php'; -//@require 'Swift/Mime/ContentEncoder.php'; /** * The default email message class. @@ -29,12 +24,13 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart * @param Swift_Mime_HeaderSet $headers * @param Swift_Mime_ContentEncoder $encoder * @param Swift_KeyCache $cache + * @param Swift_Mime_Grammar $grammar * @param string $charset */ public function __construct(Swift_Mime_HeaderSet $headers, - Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, $charset = null) + Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null) { - parent::__construct($headers, $encoder, $cache, $charset); + parent::__construct($headers, $encoder, $cache, $grammar, $charset); $this->getHeaders()->defineOrdering(array( 'Return-Path', 'Sender', @@ -71,6 +67,7 @@ public function getNestingLevel() /** * Set the subject of this message. * @param string $subject + * @return Swift_Mime_SimpleMessage */ public function setSubject($subject) { @@ -93,6 +90,7 @@ public function getSubject() /** * Set the date at which this message was created. * @param int $date + * @return Swift_Mime_SimpleMessage */ public function setDate($date) { @@ -115,6 +113,7 @@ public function getDate() /** * Set the return-path (the bounce address) of this message. * @param string $address + * @return Swift_Mime_SimpleMessage */ public function setReturnPath($address) { @@ -139,6 +138,7 @@ public function getReturnPath() * This does not override the From field, but it has a higher significance. * @param string $sender * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function setSender($address, $name = null) { @@ -188,6 +188,7 @@ public function addFrom($address, $name = null) * * @param string $addresses * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function setFrom($addresses, $name = null) { @@ -220,6 +221,7 @@ public function getFrom() * * @param string $address * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function addReplyTo($address, $name = null) { @@ -238,6 +240,7 @@ public function addReplyTo($address, $name = null) * * @param string $addresses * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function setReplyTo($addresses, $name = null) { @@ -270,6 +273,7 @@ public function getReplyTo() * * @param string $address * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function addTo($address, $name = null) { @@ -288,6 +292,7 @@ public function addTo($address, $name = null) * * @param array $addresses * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function setTo($addresses, $name = null) { @@ -320,6 +325,7 @@ public function getTo() * * @param string $address * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function addCc($address, $name = null) { @@ -336,6 +342,7 @@ public function addCc($address, $name = null) * * @param array $addresses * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function setCc($addresses, $name = null) { @@ -368,6 +375,7 @@ public function getCc() * * @param string $address * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function addBcc($address, $name = null) { @@ -384,6 +392,7 @@ public function addBcc($address, $name = null) * * @param array $addresses * @param string $name optional + * @return Swift_Mime_SimpleMessage */ public function setBcc($addresses, $name = null) { @@ -413,6 +422,7 @@ public function getBcc() * Set the priority of this message. * The value is an integer where 1 is the highest priority and 5 is the lowest. * @param int $priority + * @return Swift_Mime_SimpleMessage */ public function setPriority($priority) { @@ -458,6 +468,7 @@ public function getPriority() /** * Ask for a delivery receipt from the recipient to be sent to $addresses * @param array $addresses + * @return Swift_Mime_SimpleMessage */ public function setReadReceiptTo($addresses) { @@ -481,6 +492,7 @@ public function getReadReceiptTo() /** * Attach a {@link Swift_Mime_MimeEntity} such as an Attachment or MimePart. * @param Swift_Mime_MimeEntity $entity + * @return Swift_Mime_SimpleMessage */ public function attach(Swift_Mime_MimeEntity $entity) { @@ -491,6 +503,7 @@ public function attach(Swift_Mime_MimeEntity $entity) /** * Remove an already attached entity. * @param Swift_Mime_MimeEntity $entity + * @return Swift_Mime_SimpleMessage */ public function detach(Swift_Mime_MimeEntity $entity) { @@ -581,7 +594,7 @@ protected function _getIdField() private function _becomeMimePart() { $part = new parent($this->getHeaders()->newInstance(), $this->getEncoder(), - $this->_getCache(), $this->_userCharset + $this->_getCache(), $this->_getGrammar(), $this->_userCharset ); $part->setContentType($this->_userContentType); $part->setBody($this->getBody()); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php index a392145cb..6c5766d46 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/HeaderSet.php'; -//@require 'Swift/OutputByteStream.php'; -//@require 'Swift/Mime/ContentEncoder.php'; -//@require 'Swift/KeyCache.php'; /** * A MIME entity, in a multipart message. @@ -30,6 +26,9 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity /** The encoder that encodes the body into a streamable format */ private $_encoder; + + /** The grammar to use for id validation */ + private $_grammar; /** A mime bounary, if any is used */ private $_boundary; @@ -79,13 +78,16 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity * @param Swift_Mime_HeaderSet $headers * @param Swift_Mime_ContentEncoder $encoder * @param Swift_KeyCache $cache + * @param Swift_Mime_Grammar $grammar */ public function __construct(Swift_Mime_HeaderSet $headers, - Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache) + Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, + Swift_Mime_Grammar $grammar) { $this->_cacheKey = uniqid(); $this->_cache = $cache; $this->_headers = $headers; + $this->_grammar = $grammar; $this->setEncoder($encoder); $this->_headers->defineOrdering( array('Content-Type', 'Content-Transfer-Encoding') @@ -112,7 +114,8 @@ public function __construct(Swift_Mime_HeaderSet $headers, ) ) ); - $this->generateId(); + + $this->_id = $this->getRandomId(); } /** @@ -121,12 +124,8 @@ public function __construct(Swift_Mime_HeaderSet $headers, */ public function generateId() { - $idLeft = time() . '.' . uniqid(); - $idRight = !empty($_SERVER['SERVER_NAME']) - ? $_SERVER['SERVER_NAME'] - : 'swift.generated'; - $this->_id = $idLeft . '@' . $idRight; - return $this->getId(); + $this->setId($this->getRandomId()); + return $this->_id; } /** @@ -160,6 +159,7 @@ public function getContentType() /** * Set the Content-type of this entity. * @param string $type + * @return Swift_Mime_SimpleMimeEntity */ public function setContentType($type) { @@ -185,6 +185,7 @@ public function getId() /** * Set the CID of this entity. * @param string $id + * @return Swift_Mime_SimpleMimeEntity */ public function setId($id) { @@ -210,6 +211,7 @@ public function getDescription() * Set the description of this entity. * This method sets a value in the Content-ID header. * @param string $description + * @return Swift_Mime_SimpleMimeEntity */ public function setDescription($description) { @@ -233,6 +235,7 @@ public function getMaxLineLength() * Set the maximum line length of lines in this body. * Though not enforced by the library, lines should not exceed 1000 chars. * @param int $length + * @return Swift_Mime_SimpleMimeEntity */ public function setMaxLineLength($length) { @@ -253,6 +256,7 @@ public function getChildren() * Set all children of this entity. * @param array $children Swiift_Mime_Entity instances * @param int $compoundLevel For internal use only + * @return Swift_Mime_SimpleMimeEntity */ public function setChildren(array $children, $compoundLevel = null) { @@ -346,6 +350,7 @@ public function getBody() * {@link Swift_OutputByteStream}. * @param mixed $body * @param string $contentType optional + * @return Swift_Mime_SimpleMimeEntity */ public function setBody($body, $contentType = null) { @@ -374,6 +379,7 @@ public function getEncoder() /** * Set the encoder used for the body of this entity. * @param Swift_Mime_ContentEncoder $encoder + * @return Swift_Mime_SimpleMimeEntity */ public function setEncoder(Swift_Mime_ContentEncoder $encoder) { @@ -405,6 +411,7 @@ public function getBoundary() * Set the boundary used to separate children in this entity. * @param string $boundary * @throws Swift_RfcComplianceException + * @return Swift_Mime_SimpleMimeEntity */ public function setBoundary($boundary) { @@ -634,6 +641,15 @@ protected function _getCache() return $this->_cache; } + /** + * Get the grammar used for validation. + * @return Swift_Mime_Grammar + */ + protected function _getGrammar() + { + return $this->_grammar; + } + /** * Empty the KeyCache for this entity. */ @@ -642,6 +658,30 @@ protected function _clearCache() $this->_cache->clearKey($this->_cacheKey, 'body'); } + /** + * Returns a random Content-ID or Message-ID. + * @return string + */ + protected function getRandomId() + { + $idLeft = time() . '.' . uniqid(); + $idRight = !empty($_SERVER['SERVER_NAME']) + ? $_SERVER['SERVER_NAME'] + : 'swift.generated'; + $id = $idLeft . '@' . $idRight; + + try + { + $this->_assertValidId($id); + } + catch (Swift_RfcComplianceException $e) + { + $id = $idLeft . '@swift.generated'; + } + + return $id; + } + // -- Private methods private function _readStream(Swift_OutputByteStream $os) @@ -668,7 +708,7 @@ private function _assertValidBoundary($boundary) '/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', $boundary)) { - throw new Exception('Mime boundary set is not RFC 2046 compliant.'); + throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.'); } } @@ -723,7 +763,7 @@ private function _getNeededChildLevel($child, $compoundLevel) private function _createChild() { return new self($this->_headers->newInstance(), - $this->_encoder, $this->_cache); + $this->_encoder, $this->_cache, $this->_grammar); } private function _notifyEncoderChanged(Swift_Mime_ContentEncoder $encoder) @@ -790,4 +830,23 @@ public function __destruct() $this->_cache->clearAll($this->_cacheKey); } + /** + * Throws an Exception if the id passed does not comply with RFC 2822. + * @param string $id + * @throws Swift_RfcComplianceException + */ + private function _assertValidId($id) + { + if (!preg_match( + '/^' . $this->_grammar->getDefinition('id-left') . '@' . + $this->_grammar->getDefinition('id-right') . '$/D', + $id + )) + { + throw new Swift_RfcComplianceException( + 'Invalid ID given <' . $id . '>' + ); + } + } + } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MimePart.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MimePart.php index 60b6d5699..e22f15e6e 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MimePart.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/MimePart.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/MimePart.php'; -//@require 'Swift/DependencyContainer.php'; /** * A MIME part, in a multipart message. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/AntiFloodPlugin.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/AntiFloodPlugin.php index 46a7f4481..34e3d147f 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/AntiFloodPlugin.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/AntiFloodPlugin.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Events/SendListener.php'; -//@require 'Swift/Events/SendEvent.php'; -//@require 'Swift/Plugins/Sleeper.php'; /** * Reduces network flooding when sending large amounts of mail. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/BandwidthMonitorPlugin.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/BandwidthMonitorPlugin.php index 501cd809a..f56d3374a 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/BandwidthMonitorPlugin.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/BandwidthMonitorPlugin.php @@ -8,13 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Events/SendListener.php'; -//@require 'Swift/Events/SendEvent.php'; -//@require 'Swift/Events/CommandListener.php'; -//@require 'Swift/Events/CommandEvent.php'; -//@require 'Swift/Events/ResponseListener.php'; -//@require 'Swift/Events/ResponseEvent.php'; -//@require 'Swift/InputByteStream.php'; /** * Reduces network flooding when sending large amounts of mail. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php index da1a3079e..eb75d6e3c 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Events/SendListener.php'; -//@require 'Swift/Events/SendEvent.php'; -//@require 'Swift/Plugins/Decorator/Replacements.php'; /** * Allows customization of Messages on-the-fly. @@ -19,6 +16,7 @@ * @subpackage Plugins * * @author Chris Corbyn + * @author Fabien Potencier */ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_Plugins_Decorator_Replacements @@ -28,10 +26,10 @@ class Swift_Plugins_DecoratorPlugin private $_replacements; /** The body as it was before replacements */ - private $_orginalBody; + private $_originalBody; - /** The original subject of the message, before replacements */ - private $_originalSubject; + /** The original headers of the message, before replacements */ + private $_originalHeaders = array(); /** Bodies of children before they are replaced */ private $_originalChildBodies = array(); @@ -57,11 +55,23 @@ class Swift_Plugins_DecoratorPlugin * the object should return just the array of replacements for the address * given to {@link Swift_Plugins_Decorator_Replacements::getReplacementsFor()}. * - * @param mixed $replacements + * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements */ public function __construct($replacements) { - if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) + $this->setReplacements($replacements); + } + + /** + * Sets replacements. + * + * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements + * + * @see __construct() + */ + public function setReplacements($replacements) + { + if (!($replacements instanceof \Swift_Plugins_Decorator_Replacements)) { $this->_replacements = (array) $replacements; } @@ -95,15 +105,40 @@ public function beforeSendPerformed(Swift_Events_SendEvent $evt) $this->_originalBody = $body; $message->setBody($bodyReplaced); } - $subject = $message->getSubject(); - $subjectReplaced = str_replace( - $search, $replace, $subject - ); - if ($subject != $subjectReplaced) + + foreach ($message->getHeaders()->getAll() as $header) { - $this->_originalSubject = $subject; - $message->setSubject($subjectReplaced); + $body = $header->getFieldBodyModel(); + $count = 0; + if (is_array($body)) + { + $bodyReplaced = array(); + foreach ($body as $key => $value) + { + $count1 = 0; + $count2 = 0; + $key = is_string($key) ? str_replace($search, $replace, $key, $count1) : $key; + $value = is_string($value) ? str_replace($search, $replace, $value, $count2) : $value; + $bodyReplaced[$key] = $value; + + if (!$count && ($count1 || $count2)) + { + $count = 1; + } + } + } + else + { + $bodyReplaced = str_replace($search, $replace, $body, $count); + } + + if ($count) + { + $this->_originalHeaders[$header->getFieldName()] = $body; + $header->setFieldBodyModel($bodyReplaced); + } } + $children = (array) $message->getChildren(); foreach ($children as $child) { @@ -176,10 +211,16 @@ private function _restoreMessage(Swift_Mime_Message $message) $message->setBody($this->_originalBody); $this->_originalBody = null; } - if (isset($this->_originalSubject)) + if (!empty($this->_originalHeaders)) { - $message->setSubject($this->_originalSubject); - $this->_originalSubject = null; + foreach ($message->getHeaders()->getAll() as $header) + { + if (array_key_exists($header->getFieldName(), $this->_originalHeaders)) + { + $header->setFieldBodyModel($this->_originalHeaders[$header->getFieldName()]); + } + } + $this->_originalHeaders = array(); } if (!empty($this->_originalChildBodies)) { diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ImpersonatePlugin.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ImpersonatePlugin.php new file mode 100644 index 000000000..3b0a42514 --- /dev/null +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ImpersonatePlugin.php @@ -0,0 +1,68 @@ +_sender = $sender; + } + + /** + * Invoked immediately before the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) { + $message = $evt->getMessage(); + $headers = $message->getHeaders(); + + // save current recipients + $headers->addPathHeader('X-Swift-Return-Path', $message->getReturnPath()); + + // replace them with the one to send to + $message->setReturnPath($this->_sender); + } + + /** + * Invoked immediately after the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) { + $message = $evt->getMessage(); + + // restore original headers + $headers = $message->getHeaders(); + + if ($headers->has('X-Swift-Return-Path')) { + $message->setReturnPath($headers->get('X-Swift-Return-Path')->getAddress()); + $headers->removeAll('X-Swift-Return-Path'); + } + } +} diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/LoggerPlugin.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/LoggerPlugin.php index d595f2645..20e5490b3 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/LoggerPlugin.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/LoggerPlugin.php @@ -8,16 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Events/CommandListener.php'; -//@require 'Swift/Events/CommandEvent.php'; -//@require 'Swift/Events/ResponseListener.php'; -//@require 'Swift/Events/ResponseEvent.php'; -//@require 'Swift/Events/TransportChangeListener.php'; -//@require 'Swift/Events/TransportChangeEvent.php'; -//@require 'Swift/Events/TransportExceptionEvent.php'; -//@require 'Swift/Events/TransportExceptionListener.php'; -//@require 'Swift/Events/TransportException.php'; -//@require 'Swift/Plugins/Logger.php'; /** * Does real time logging of Transport level information. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/MessageLogger.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/MessageLogger.php new file mode 100644 index 000000000..b6a942235 --- /dev/null +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/MessageLogger.php @@ -0,0 +1,77 @@ +messages = array(); + } + + /** + * Get the message list + * + * @return array + */ + public function getMessages() + { + return $this->messages; + } + + /** + * Get the message count + * + * @return int count + */ + public function countMessages() + { + return count($this->messages); + } + + /** + * Empty the message list + * + */ + public function clear() + { + $this->messages = array(); + } + + /** + * Invoked immediately before the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(Swift_Events_SendEvent $evt) + { + $this->messages[] = clone $evt->getMessage(); + } + + /** + * Invoked immediately after the Message is sent. + * + * @param Swift_Events_SendEvent $evt + */ + public function sendPerformed(Swift_Events_SendEvent $evt) + { + } +} diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Exception.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Exception.php index e0205f44d..006d25745 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Exception.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Exception.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/IoException.php'; /** * Pop3Exception thrown when an error occurs connecting to a POP3 host. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/PopBeforeSmtpPlugin.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/PopBeforeSmtpPlugin.php index fd1cf467f..e21981ce3 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/PopBeforeSmtpPlugin.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/PopBeforeSmtpPlugin.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Events/TransportChangeListener.php'; -//@require 'Swift/Events/TransportChangeEvent.php'; /** * Makes sure a connection to a POP3 host has been established prior to connecting to SMTP. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporter.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporter.php index 00d5765d7..d87fdc3f9 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporter.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporter.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Message.php'; /** * The Reporter plugin sends pass/fail notification to a Reporter. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ReporterPlugin.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ReporterPlugin.php index 1beac5b9f..b5e0e9327 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ReporterPlugin.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ReporterPlugin.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Events/SendListener.php'; -//@require 'Swift/Events/SendEvent.php'; -//@require 'Swift/Plugins/Reporter.php'; /** * Does real time reporting of pass/fail for each recipient. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HitReporter.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HitReporter.php index 0022f5e65..af5d7e386 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HitReporter.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HitReporter.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Plugins/Reporter.php'; -//@require 'Swift/Mime/Message.php'; /** * A reporter which "collects" failures for the Reporter plugin. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HtmlReporter.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HtmlReporter.php index 73700780e..119c4b271 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HtmlReporter.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HtmlReporter.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Plugins/Reporter.php'; -//@require 'Swift/Mime/Message.php'; /** * A HTML output reporter for the Reporter plugin. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ThrottlerPlugin.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ThrottlerPlugin.php index 43bb1f48c..7e18c2873 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ThrottlerPlugin.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Plugins/ThrottlerPlugin.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Events/SendEvent.php'; -//@require 'Swift/Plugins/BandwidthMonitorPlugin.php'; -//@require 'Swift/Plugins/Sleeper.php'; -//@require 'Swift/Plugins/Timer.php'; /** * Throttles the rate at which emails are sent. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Preferences.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Preferences.php index 20a2e5f18..7539acb62 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Preferences.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Preferences.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/DependencyContainer.php'; /** * Changes some global preference settings in Swift Mailer. @@ -73,4 +72,20 @@ public function setCacheType($type) return $this; } + /** + * Add the + * @param boolean $dotEscape + * @return Swift_Preferences + */ + public function setQPDotEscape($dotEscape) + { + $dotEscape=!empty($dotEscape); + Swift_DependencyContainer::getInstance() + -> register('mime.qpcontentencoder') + -> asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder') + -> withDependencies(array('mime.charstream', 'mime.bytecanonicalizer')) + -> addConstructorValue($dotEscape); + return $this; + } + } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/RfcComplianceException.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/RfcComplianceException.php index 5bb394b58..6e3c78724 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/RfcComplianceException.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/RfcComplianceException.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/SwiftException.php'; /** * RFC Compliance Exception class. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/SendmailTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/SendmailTransport.php index 60a700076..59ea207db 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/SendmailTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/SendmailTransport.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/SendmailTransport.php'; -//@require 'Swift/DependencyContainer.php'; /** * SendmailTransport for sending mail through a sendmail/postfix (etc..) binary. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/SmtpTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/SmtpTransport.php index 65180d587..0e69b3769 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/SmtpTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/SmtpTransport.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/EsmtpTransport.php'; -//@require 'Swift/DependencyContainer.php'; /** * Sends Messages over SMTP with ESMTP support. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Spool.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Spool.php index 6d0670975..daeeefbc1 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Spool.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Spool.php @@ -35,6 +35,8 @@ public function isStarted(); /** * Queues a message. * @param Swift_Mime_Message $message The message to store + * + * @return boolean Whether the operation has succeeded */ public function queueMessage(Swift_Mime_Message $message); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php index 2df52be1b..56baeff34 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/StreamFilter.php'; /** * Processes bytes as they pass through a buffer and replaces sequences in it. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilter.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilter.php index 9ab6c3085..deebcd615 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilter.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilter.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/StreamFilter.php'; /** * Processes bytes as they pass through a buffer and replaces sequences in it. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilterFactory.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilterFactory.php index fcd4b830c..4b6448746 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilterFactory.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilterFactory.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/StreamFilters/StringReplacementFilter.php'; -//@require 'Swift/StreamFilterFactory.php'; /** * Creates filters for replacing needles in a string buffer. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport.php index 9b54752fb..9347d79b7 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Mime/Message.php'; -//@require 'Swift/Events/EventListener.php'; /** * Sends Messages via an abstract Transport subsystem. @@ -41,7 +39,7 @@ public function stop(); /** * Send the given Message. * - * Recipient/sender data will be retreived from the Message API. + * Recipient/sender data will be retrieved from the Message API. * The return value is the number of recipients who were accepted for delivery. * * @param Swift_Mime_Message $message diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php index 3329d34f7..de4e4400d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php @@ -8,13 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport.php'; -//@require 'Swift/Transport/IoBuffer.php'; -//@require 'Swift/Transport/CommandSentException.php'; -//@require 'Swift/TransportException.php'; -//@require 'Swift/Mime/Message.php'; -//@require 'Swift/Events/EventDispatcher.php'; -//@require 'Swift/Events/EventListener.php'; /** * Sends Messages over SMTP. @@ -39,6 +32,9 @@ abstract class Swift_Transport_AbstractSmtpTransport /** The event dispatching layer */ protected $_eventDispatcher; + /** Source Ip */ + protected $_sourceIp; + /** Return an array of params for the Buffer */ abstract protected function _getBufferParams(); @@ -63,6 +59,7 @@ public function __construct(Swift_Transport_IoBuffer $buf, * brackets (i.e. [127.0.0.1]). * * @param string $domain + * @return Swift_Transport_AbstractSmtpTransport */ public function setLocalDomain($domain) { @@ -80,6 +77,25 @@ public function getLocalDomain() return $this->_domain; } + + /** + * Sets the sourceIp + * @param string $source + */ + public function setSourceIp($source) + { + $this->_sourceIp=$source; + } + + /** + * Returns the ip used to connect to the destination + * @return string + */ + public function getSourceIp() + { + return $this->_sourceIp; + } + /** * Start the SMTP connection. */ @@ -129,7 +145,7 @@ public function isStarted() /** * Send the given Message. * - * Recipient/sender data will be retreived from the Message API. + * Recipient/sender data will be retrieved from the Message API. * The return value is the number of recipients who were accepted for delivery. * * @param Swift_Mime_Message $message @@ -141,13 +157,6 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) $sent = 0; $failedRecipients = (array) $failedRecipients; - if (!$reversePath = $this->_getReversePath($message)) - { - throw new Swift_TransportException( - 'Cannot send message without a sender address' - ); - } - if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) { $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); @@ -157,6 +166,13 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) } } + if (!$reversePath = $this->_getReversePath($message)) + { + throw new Swift_TransportException( + 'Cannot send message without a sender address' + ); + } + $to = (array) $message->getTo(); $cc = (array) $message->getCc(); $bcc = (array) $message->getBcc(); @@ -391,7 +407,7 @@ protected function _throwException(Swift_TransportException $e) /** Throws an Exception if a response code is incorrect */ protected function _assertResponseCode($response, $wanted) { - list($code, $separator, $text) = sscanf($response, '%3d%[ -]%s'); + list($code) = sscanf($response, '%3d'); $valid = (empty($wanted) || in_array($code, $wanted)); if ($evt = $this->_eventDispatcher->createResponseEvent($this, $response, diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php index 4c7e0f2ec..1595211b4 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/Esmtp/Authenticator.php'; -//@require 'Swift/Transport/SmtpAgent.php'; -//@require 'Swift/TransportException.php'; /** * Handles CRAM-MD5 authentication. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php index bd226174e..312b7e20d 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/Esmtp/Authenticator.php'; -//@require 'Swift/Transport/SmtpAgent.php'; -//@require 'Swift/TransportException.php'; /** * Handles LOGIN authentication. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php index ddd80942f..ca588eaaa 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/Esmtp/Authenticator.php'; -//@require 'Swift/Transport/SmtpAgent.php'; -//@require 'Swift/TransportException.php'; /** * Handles PLAIN authentication. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/AuthHandler.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/AuthHandler.php index a223169b7..1d98cd6aa 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/AuthHandler.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/AuthHandler.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/TransportException.php'; -//@require 'Swift/Transport/EsmtpHandler.php'; -//@require 'Swift/Transport/SmtpAgent.php'; /** * An ESMTP handler for AUTH support. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Authenticator.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Authenticator.php index bf166d324..4af223eea 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Authenticator.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Authenticator.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/SmtpAgent.php'; /** * An Authentication mechanism. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpHandler.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpHandler.php index e96f95f61..a09ae1966 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpHandler.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpHandler.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/EsmtpBufferWrapper.php'; /** * An ESMTP handler. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpTransport.php index fc10ba870..54f9ff5c1 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpTransport.php @@ -8,13 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/AbstractSmtpTransport.php'; -//@require 'Swift/Transport/EsmtpHandler.php'; -//@require 'Swift/Transport/IoBuffer.php'; -//@require 'Swift/Transport/SmtpAgent.php'; -//@require 'Swift/TransportException.php'; -//@require 'Swift/Mime/Message.php'; -//@require 'Swift/Events/EventDispatcher.php'; /** * Sends Messages over SMTP with ESMTP support. @@ -52,6 +45,7 @@ class Swift_Transport_EsmtpTransport 'port' => 25, 'timeout' => 30, 'blocking' => 1, + 'tls' => false, 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET ); @@ -71,6 +65,7 @@ public function __construct(Swift_Transport_IoBuffer $buf, /** * Set the host to connect to. * @param string $host + * @return Swift_Transport_EsmtpTransport */ public function setHost($host) { @@ -90,6 +85,7 @@ public function getHost() /** * Set the port to connect to. * @param int $port + * @return Swift_Transport_EsmtpTransport */ public function setPort($port) { @@ -109,10 +105,12 @@ public function getPort() /** * Set the connection timeout. * @param int $timeout seconds + * @return Swift_Transport_EsmtpTransport */ public function setTimeout($timeout) { $this->_params['timeout'] = (int) $timeout; + $this->_buffer->setParam('timeout', (int) $timeout); return $this; } @@ -128,10 +126,18 @@ public function getTimeout() /** * Set the encryption type (tls or ssl) * @param string $encryption + * @return Swift_Transport_EsmtpTransport */ public function setEncryption($enc) { - $this->_params['protocol'] = $enc; + if ('tls' == $enc) + { + $this->_params['protocol'] = 'tcp'; + $this->_params['tls'] = true; + } else { + $this->_params['protocol'] = $enc; + $this->_params['tls'] = false; + } return $this; } @@ -141,12 +147,33 @@ public function setEncryption($enc) */ public function getEncryption() { - return $this->_params['protocol']; + return $this->_params['tls'] ? 'tls' : $this->_params['protocol']; + } + + /** + * Sets the sourceIp + * @param string $source + * @return Swift_Transport_EsmtpTransport + */ + public function setSourceIp($source) + { + $this->_params['sourceIp']=$source; + return $this; + } + + /** + * Returns the ip used to connect to the destination + * @return string + */ + public function getSourceIp() + { + return $this->_params['sourceIp']; } /** * Set ESMTP extension handlers. * @param Swift_Transport_EsmtpHandler[] $handlers + * @return Swift_Transport_EsmtpTransport */ public function setExtensionHandlers(array $handlers) { @@ -239,16 +266,45 @@ protected function _doHeloCommand() $response = $this->executeCommand( sprintf("EHLO %s\r\n", $this->_domain), array(250) ); - $this->_capabilities = $this->_getCapabilities($response); - $this->_setHandlerParams(); - foreach ($this->_getActiveHandlers() as $handler) + } + catch (Swift_TransportException $e) + { + return parent::_doHeloCommand(); + } + + if ($this->_params['tls']) + { + try + { + $this->executeCommand("STARTTLS\r\n", array(220)); + + if (!$this->_buffer->startTLS()) + { + throw new Swift_TransportException('Unable to connect with TLS encryption'); + } + + try + { + $response = $this->executeCommand( + sprintf("EHLO %s\r\n", $this->_domain), array(250) + ); + } + catch (Swift_TransportException $e) + { + return parent::_doHeloCommand(); + } + } + catch (Swift_TransportException $e) { - $handler->afterEhlo($this); + $this->_throwException($e); } } - catch (Swift_TransportException $e) + + $this->_capabilities = $this->_getCapabilities($response); + $this->_setHandlerParams(); + foreach ($this->_getActiveHandlers() as $handler) { - parent::_doHeloCommand(); + $handler->afterEhlo($this); } } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php index e62491c20..ffb822c9b 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/LoadBalancedTransport.php'; -//@require 'Swift/Mime/Message.php'; /** * Contains a list of redundant Transports so when one fails, the next is used. @@ -38,7 +36,7 @@ public function __construct() /** * Send the given Message. - * Recipient/sender data will be retreived from the Message API. + * Recipient/sender data will be retrieved from the Message API. * The return value is the number of recipients who were accepted for delivery. * @param Swift_Mime_Message $message * @param string[] &$failedRecipients to collect failures by-reference diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/IoBuffer.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/IoBuffer.php index ac66ef03d..9a46cd91e 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/IoBuffer.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/IoBuffer.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/InputByteStream.php'; -//@require 'Swift/OutputByteStream.php'; /** * Buffers input and output to a resource. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/LoadBalancedTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/LoadBalancedTransport.php index 367981b1f..293431716 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/LoadBalancedTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/LoadBalancedTransport.php @@ -8,9 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport.php'; -//@require 'Swift/Mime/Message.php'; -//@require 'Swift/Events/EventListener.php'; /** * Redudantly and rotationally uses several Transports when sending. @@ -56,7 +53,7 @@ public function setTransports(array $transports) * * @return array Swift_Transport */ - public function getTransports(array $transports) + public function getTransports() { return array_merge($this->_transports, $this->_deadTransports); } @@ -93,7 +90,7 @@ public function stop() /** * Send the given Message. * - * Recipient/sender data will be retreived from the Message API. + * Recipient/sender data will be retrieved from the Message API. * The return value is the number of recipients who were accepted for delivery. * * @param Swift_Mime_Message $message diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/MailTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/MailTransport.php index eca59e169..62994f9dd 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/MailTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/MailTransport.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport.php'; -//@require 'Swift/Transport/MailInvoker.php'; -//@require 'Swift/Mime/Message.php'; -//@require 'Swift/Events/EventListener.php'; /** * Sends Messages using the mail() function. @@ -79,6 +75,7 @@ public function stop() * This string is formatted for sprintf() where %s is the sender address. * * @param string $params + * @return Swift_Transport_MailTransport */ public function setExtraParams($params) { @@ -101,7 +98,7 @@ public function getExtraParams() /** * Send the given Message. * - * Recipient/sender data will be retreived from the Message API. + * Recipient/sender data will be retrieved from the Message API. * The return value is the number of recipients who were accepted for delivery. * * @param Swift_Mime_Message $message @@ -130,8 +127,14 @@ public function send(Swift_Mime_Message $message, &$failedRecipients = null) $toHeader = $message->getHeaders()->get('To'); $subjectHeader = $message->getHeaders()->get('Subject'); + if (!$toHeader) + { + throw new Swift_TransportException( + 'Cannot send message without a recipient' + ); + } $to = $toHeader->getFieldBody(); - $subject = $subjectHeader->getFieldBody(); + $subject = $subjectHeader ? $subjectHeader->getFieldBody() : ''; $reversePath = $this->_getReversePath($message); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SendmailTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SendmailTransport.php index aae8bde4e..1ed74e02f 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SendmailTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SendmailTransport.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/Transport/EsmtpTransport.php'; -//@require 'Swift/Transport/IoBuffer.php'; -//@require 'Swift/Transport/Log.php'; -//@require 'Swift/Events/EventDispatcher.php'; /** * SendmailTransport for sending mail through a sendmail/postfix (etc..) binary. @@ -70,6 +66,7 @@ public function start() * The recommended mode is "-bs" since it is interactive and failure notifications * are hence possible. * @param string $command + * @return Swift_Transport_SendmailTransport */ public function setCommand($command) { @@ -88,7 +85,7 @@ public function getCommand() /** * Send the given Message. - * Recipient/sender data will be retreived from the Message API. + * Recipient/sender data will be retrieved from the Message API. * The return value is the number of recipients who were accepted for delivery. * NOTE: If using 'sendmail -t' you will not be aware of any failures until * they bounce (i.e. send() will always return 100% success). diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php index 271ba8483..cc278d034 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php @@ -18,7 +18,6 @@ */ -//@require 'Swift/Transport/MailInvoker.php'; /** * This is the implementation class for {@link Swift_Transport_MailInvoker}. @@ -47,11 +46,11 @@ public function mail($to, $subject, $body, $headers = null, $extraParams = null) { if (!ini_get('safe_mode')) { - return mail($to, $subject, $body, $headers, $extraParams); + return @mail($to, $subject, $body, $headers, $extraParams); } else { - return mail($to, $subject, $body, $headers); + return @mail($to, $subject, $body, $headers); } } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SpoolTransport.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SpoolTransport.php index 61a148497..d3fecf1c2 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SpoolTransport.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/SpoolTransport.php @@ -33,6 +33,7 @@ public function __construct(Swift_Events_EventDispatcher $eventDispatcher, Swift /** * Sets the spool object. * @param Swift_Spool $spool + * @return Swift_Transport_SpoolTransport */ public function setSpool(Swift_Spool $spool) { diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php index 01ae8a593..d9801fab1 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php @@ -8,10 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/ByteStream/AbstractFilterableInputStream.php'; -//@require 'Swift/ReplacementFilterFactory.php'; -//@require 'Swift/Transport/IoBuffer.php'; -//@require 'Swift/TransportException.php'; /** * A generic IoBuffer implementation supporting remote sockets and local processes. @@ -83,23 +79,29 @@ public function setParam($param, $value) { switch ($param) { - case 'protocol': - if (!array_key_exists('protocol', $this->_params) - || $value != $this->_params['protocol']) + case 'timeout': + if ($this->_stream) { - if ('tls' == $value) - { - stream_socket_enable_crypto( - $this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT - ); - } + stream_set_timeout($this->_stream, $value); } break; + + case 'blocking': + if ($this->_stream) + { + stream_set_blocking($this->_stream, 1); + } + } } $this->_params[$param] = $value; } + public function startTLS() + { + return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + } + /** * Perform any shutdown logic needed. */ @@ -165,6 +167,17 @@ public function readLine($sequence) if (isset($this->_out) && !feof($this->_out)) { $line = fgets($this->_out); + if (strlen($line)==0) + { + $metas = stream_get_meta_data($this->_out); + if ($metas['timed_out']) { + throw new Swift_IoException( + 'Connection to ' . + $this->_getReadConnectionDescription() . + ' Timed Out' + ); + } + } return $line; } } @@ -182,6 +195,18 @@ public function read($length) if (isset($this->_out) && !feof($this->_out)) { $ret = fread($this->_out, $length); + if (strlen($ret)==0) + { + $metas = stream_get_meta_data($this->_out); + if ($metas['timed_out']) + { + throw new Swift_IoException( + 'Connection to ' . + $this->_getReadConnectionDescription() . + ' Timed Out' + ); + } + } return $ret; } } @@ -230,7 +255,13 @@ private function _establishSocketConnection() { $timeout = $this->_params['timeout']; } - if (!$this->_stream = fsockopen($host, $this->_params['port'], $errno, $errstr, $timeout)) + $options = array(); + if (!empty($this->_params['sourceIp'])) + { + $options['socket']['bindto']=$this->_params['sourceIp'].':0'; + } + $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options)); + if (false === $this->_stream) { throw new Swift_TransportException( 'Connection could not be established with host ' . $this->_params['host'] . @@ -245,6 +276,7 @@ private function _establishSocketConnection() { stream_set_blocking($this->_stream, 0); } + stream_set_timeout($this->_stream, $timeout); $this->_in =& $this->_stream; $this->_out =& $this->_stream; } @@ -273,4 +305,25 @@ private function _establishProcessConnection() $this->_out =& $pipes[1]; } + + private function _getReadConnectionDescription() + { + switch ($this->_params['type']) + { + case self::TYPE_PROCESS: + return 'Process '.$this->_params['command']; + break; + + case self::TYPE_SOCKET: + default: + $host = $this->_params['host']; + if (!empty($this->_params['protocol'])) + { + $host = $this->_params['protocol'] . '://' . $host; + } + $host.=':'.$this->_params['port']; + return $host; + break; + } + } } diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/TransportException.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/TransportException.php index b7cd6589b..7df6e0b4f 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/TransportException.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/TransportException.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ -//@require 'Swift/IoException.php'; /** * TransportException thrown when an error occurs in the Transport subsystem. diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Validate.php b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Validate.php new file mode 100644 index 000000000..d21900e22 --- /dev/null +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Validate.php @@ -0,0 +1,38 @@ + + */ +class Swift_Validate +{ + /** + * Grammar Object + * @var Swift_Mime_Grammar + */ + private static $grammar = null; + + /** + * Checks if an email matches the current grammars + * @param string $email + */ + public static function email($email) + { + if (self::$grammar===null) + { + self::$grammar = Swift_DependencyContainer::getInstance() + ->lookup('mime.grammar'); + } + return preg_match( + '/^' . self::$grammar->getDefinition('addr-spec') . '$/D', + $email + ); + } +} \ No newline at end of file diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/dependency_maps/message_deps.php b/lib/vendor/symfony/lib/vendor/swiftmailer/dependency_maps/message_deps.php new file mode 100644 index 000000000..38ba4c091 --- /dev/null +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/dependency_maps/message_deps.php @@ -0,0 +1,9 @@ + register('message.message') + -> asNewInstanceOf('Swift_Message') + + -> register('message.mimepart') + -> asNewInstanceOf('Swift_MimePart'); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/dependency_maps/mime_deps.php b/lib/vendor/symfony/lib/vendor/swiftmailer/dependency_maps/mime_deps.php index e03927a3c..6d7b30d68 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/dependency_maps/mime_deps.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/dependency_maps/mime_deps.php @@ -1,18 +1,22 @@ register('properties.charset') -> asValue('utf-8') + -> register('mime.grammar') + -> asSharedInstanceOf('Swift_Mime_Grammar') + -> register('mime.message') -> asNewInstanceOf('Swift_Mime_SimpleMessage') -> withDependencies(array( 'mime.headerset', 'mime.qpcontentencoder', 'cache', + 'mime.grammar', 'properties.charset' )) @@ -22,6 +26,7 @@ 'mime.headerset', 'mime.qpcontentencoder', 'cache', + 'mime.grammar', 'properties.charset' )) @@ -30,7 +35,8 @@ -> withDependencies(array( 'mime.headerset', 'mime.base64contentencoder', - 'cache' + 'cache', + 'mime.grammar' )) -> addConstructorValue($swift_mime_types) @@ -39,7 +45,8 @@ -> withDependencies(array( 'mime.headerset', 'mime.base64contentencoder', - 'cache' + 'cache', + 'mime.grammar' )) -> addConstructorValue($swift_mime_types) @@ -48,6 +55,7 @@ -> withDependencies(array( 'mime.qpheaderencoder', 'mime.rfc2231encoder', + 'mime.grammar', 'properties.charset' )) diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/preferences.php b/lib/vendor/symfony/lib/vendor/swiftmailer/preferences.php index 0b9e4b1ff..c9b5a5c67 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/preferences.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/preferences.php @@ -9,12 +9,14 @@ // Sets the default charset so that setCharset() is not needed elsewhere Swift_Preferences::getInstance()->setCharset('utf-8'); -// Without these lines the default caching mechanism is "array" but this uses -// a lot of memory. -// If possible, use a disk cache to enable attaching large attachments etc +// Without these lines the default caching mechanism is "array" but this uses a lot of memory. +// If possible, use a disk cache to enable attaching large attachments etc. +// You can override the default temporary directory by setting the TMPDIR environment variable. if (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir())) { Swift_Preferences::getInstance() -> setTempDir(sys_get_temp_dir()) -> setCacheType('disk'); } + +Swift_Preferences::getInstance()->setQPDotEscape(false); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/swift_init.php b/lib/vendor/symfony/lib/vendor/swiftmailer/swift_init.php index fe624a9d2..77807676a 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/swift_init.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/swift_init.php @@ -12,10 +12,16 @@ * Dependency injection initialization for Swift Mailer. */ +if (defined('SWIFT_INIT_LOADED')) + return; + +define('SWIFT_INIT_LOADED', true); + //Load in dependency maps -require_once dirname(__FILE__) . '/dependency_maps/cache_deps.php'; -require_once dirname(__FILE__) . '/dependency_maps/mime_deps.php'; -require_once dirname(__FILE__) . '/dependency_maps/transport_deps.php'; +require dirname(__FILE__) . '/dependency_maps/cache_deps.php'; +require dirname(__FILE__) . '/dependency_maps/mime_deps.php'; +require dirname(__FILE__) . '/dependency_maps/message_deps.php'; +require dirname(__FILE__) . '/dependency_maps/transport_deps.php'; //Load in global library preferences -require_once dirname(__FILE__) . '/preferences.php'; +require dirname(__FILE__) . '/preferences.php'; diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/swift_required.php b/lib/vendor/symfony/lib/vendor/swiftmailer/swift_required.php index ad1a4ad5a..f810b59b8 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/swift_required.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/swift_required.php @@ -12,11 +12,13 @@ * Autoloader and dependency injection initialization for Swift Mailer. */ -//Load Swift utility class -require_once dirname(__FILE__) . '/classes/Swift.php'; +if (defined('SWIFT_REQUIRED_LOADED')) + return; + +define('SWIFT_REQUIRED_LOADED', true); -//Start the autoloader -Swift::registerAutoload(); +//Load Swift utility class +require dirname(__FILE__) . '/classes/Swift.php'; -//Load the init script to set up dependency injection -require_once dirname(__FILE__) . '/swift_init.php'; +//Start the autoloader and lazy-load the init script to set up dependency injection +Swift::registerAutoload(dirname(__FILE__) . '/swift_init.php'); diff --git a/lib/vendor/symfony/lib/vendor/swiftmailer/swift_required_pear.php b/lib/vendor/symfony/lib/vendor/swiftmailer/swift_required_pear.php index 20a615974..cf7261a8e 100644 --- a/lib/vendor/symfony/lib/vendor/swiftmailer/swift_required_pear.php +++ b/lib/vendor/symfony/lib/vendor/swiftmailer/swift_required_pear.php @@ -12,11 +12,16 @@ * Autoloader and dependency injection initialization for Swift Mailer. */ +if (defined('SWIFT_REQUIRED_LOADED')) + return; + +define('SWIFT_REQUIRED_LOADED', true); + //Load Swift utility class -require_once dirname(__FILE__) . '/Swift.php'; +require dirname(__FILE__) . '/Swift.php'; //Start the autoloader Swift::registerAutoload(); //Load the init script to set up dependency injection -require_once dirname(__FILE__) . '/swift_init.php'; +require dirname(__FILE__) . '/swift_init.php'; diff --git a/lib/vendor/symfony/lib/widget/sfWidget.class.php b/lib/vendor/symfony/lib/widget/sfWidget.class.php index 87f8abaf9..c4e4bbae0 100644 --- a/lib/vendor/symfony/lib/widget/sfWidget.class.php +++ b/lib/vendor/symfony/lib/widget/sfWidget.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage widget * @author Fabien Potencier - * @version SVN: $Id: sfWidget.class.php 22933 2009-10-11 22:42:56Z Kris.Wallsmith $ + * @version SVN: $Id: sfWidget.class.php 33596 2012-11-21 14:14:21Z fabien $ */ abstract class sfWidget { @@ -361,7 +361,7 @@ public function renderContentTag($tag, $content = null, $attributes = array()) */ static public function escapeOnce($value) { - return self::fixDoubleEscape(htmlspecialchars((string) $value, ENT_QUOTES, self::getCharset())); + return self::fixDoubleEscape(htmlspecialchars(!is_array($value) ? (string) $value : null, ENT_QUOTES, self::getCharset())); } /** diff --git a/lib/vendor/symfony/lib/widget/sfWidgetForm.class.php b/lib/vendor/symfony/lib/widget/sfWidgetForm.class.php index be2ce90c6..2121c6eaf 100644 --- a/lib/vendor/symfony/lib/widget/sfWidgetForm.class.php +++ b/lib/vendor/symfony/lib/widget/sfWidgetForm.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage widget * @author Fabien Potencier - * @version SVN: $Id: sfWidgetForm.class.php 24137 2009-11-18 13:12:40Z fabien $ + * @version SVN: $Id: sfWidgetForm.class.php 33596 2012-11-21 14:14:21Z fabien $ */ abstract class sfWidgetForm extends sfWidget { @@ -244,7 +244,7 @@ public function generateId($name, $value = null) // check to see if we have an array variable for a field name if (strstr($name, '[')) { - $name = str_replace(array('[]', '][', '[', ']'), array((null !== $value ? '_'.$value : ''), '_', '_', ''), $name); + $name = str_replace(array('[]', '][', '[', ']'), array(((null !== $value) && !is_array($value) ? '_'.$value : ''), '_', '_', ''), $name); } if (false !== strpos($this->getOption('id_format'), '%s')) diff --git a/lib/vendor/symfony/lib/widget/sfWidgetFormDateRange.class.php b/lib/vendor/symfony/lib/widget/sfWidgetFormDateRange.class.php index 6b25f2e93..daf14f0a9 100644 --- a/lib/vendor/symfony/lib/widget/sfWidgetFormDateRange.class.php +++ b/lib/vendor/symfony/lib/widget/sfWidgetFormDateRange.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage widget * @author Fabien Potencier - * @version SVN: $Id: sfWidgetFormDateRange.class.php 30762 2010-08-25 12:33:33Z fabien $ + * @version SVN: $Id: sfWidgetFormDateRange.class.php 33053 2011-09-20 15:31:20Z fabien $ */ class sfWidgetFormDateRange extends sfWidgetForm { @@ -55,7 +55,7 @@ protected function configure($options = array(), $attributes = array()) */ public function render($name, $value = null, $attributes = array(), $errors = array()) { - $values = array_merge(array('from' => '', 'to' => '', 'is_empty' => ''), is_array($value) ? $value : array()); + $value = array_merge(array('from' => '', 'to' => ''), is_array($value) ? $value : array()); return strtr($this->translate($this->getOption('template')), array( '%from_date%' => $this->getOption('from_date')->render($name.'[from]', $value['from']), diff --git a/lib/vendor/symfony/lib/widget/sfWidgetFormSelectCheckbox.class.php b/lib/vendor/symfony/lib/widget/sfWidgetFormSelectCheckbox.class.php index 98b22096b..973ce5265 100644 --- a/lib/vendor/symfony/lib/widget/sfWidgetFormSelectCheckbox.class.php +++ b/lib/vendor/symfony/lib/widget/sfWidgetFormSelectCheckbox.class.php @@ -14,7 +14,7 @@ * @package symfony * @subpackage widget * @author Fabien Potencier - * @version SVN: $Id: sfWidgetFormSelectCheckbox.class.php 30762 2010-08-25 12:33:33Z fabien $ + * @version SVN: $Id: sfWidgetFormSelectCheckbox.class.php 33362 2012-03-08 13:53:08Z fabien $ */ class sfWidgetFormSelectCheckbox extends sfWidgetFormChoiceBase { @@ -102,7 +102,7 @@ protected function formatChoices($name, $value, $choices, $attributes) 'id' => $id = $this->generateId($name, self::escapeOnce($key)), ); - if ((is_array($value) && in_array(strval($key), $value)) || strval($key) == strval($value)) + if ((is_array($value) && in_array(strval($key), $value)) || (is_string($value) && strval($key) == strval($value))) { $baseAttributes['checked'] = 'checked'; } diff --git a/lib/vendor/symfony/test/functional/fixtures/apps/frontend/config/view.yml b/lib/vendor/symfony/test/functional/fixtures/apps/frontend/config/view.yml index 64f550313..d690255fe 100644 --- a/lib/vendor/symfony/test/functional/fixtures/apps/frontend/config/view.yml +++ b/lib/vendor/symfony/test/functional/fixtures/apps/frontend/config/view.yml @@ -14,6 +14,9 @@ default: - ie6: condition: lte IE 6 + - + multiple_media: + media: 'print,handheld' javascripts: [ ] diff --git a/lib/vendor/symfony/test/functional/genericTest.php b/lib/vendor/symfony/test/functional/genericTest.php index 43ef9945b..f70672271 100644 --- a/lib/vendor/symfony/test/functional/genericTest.php +++ b/lib/vendor/symfony/test/functional/genericTest.php @@ -3,7 +3,7 @@ /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier - * + * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ @@ -23,6 +23,7 @@ checkElement('body', '/congratulations/i')-> checkElement('link[href="/sf/sf_default/css/screen.css"]')-> checkElement('link[href="/css/main.css"]')-> + checkElement('link[href="/css/multiple_media.css"][media="print,handheld"]')-> matches('#'.preg_quote('').'#')-> end() ; diff --git a/lib/vendor/symfony/test/unit/helper/TextHelperTest.php b/lib/vendor/symfony/test/unit/helper/TextHelperTest.php index eca779d09..42be2d10b 100644 --- a/lib/vendor/symfony/test/unit/helper/TextHelperTest.php +++ b/lib/vendor/symfony/test/unit/helper/TextHelperTest.php @@ -13,7 +13,7 @@ require_once(dirname(__FILE__).'/../../../lib/helper/TagHelper.php'); require_once(dirname(__FILE__).'/../../../lib/helper/TextHelper.php'); -$t = new lime_test(54); +$t = new lime_test(56); // truncate_text() $t->diag('truncate_text()'); @@ -134,4 +134,5 @@ $t->is(auto_link_text('

http://www.google.com/?q=symfony+link

', 'all', array(), true, 32, '***'), '

http://www.google.com/?q=symfony***

', 'auto_link_text() takes truncation parameters'); $t->is(auto_link_text('

http://twitter.com/#!/fabpot

'),'

http://twitter.com/#!/fabpot

',"auto_link_text() converts URLs with complex fragments to links"); $t->is(auto_link_text('

http://twitter.com/#!/fabpot is Fabien Potencier on Twitter

'),'

http://twitter.com/#!/fabpot is Fabien Potencier on Twitter

',"auto_link_text() converts URLs with complex fragments and trailing text to links"); - +$t->is(auto_link_text('hello '.$email_result, 'email_addresses'), 'hello '.$email_result, "auto_link_text() does not double-link emails"); +$t->is(auto_link_text('

Link '.$link_result.'

'), '

Link '.$link_result.'

', "auto_link_text() does not double-link emails"); diff --git a/lib/vendor/symfony/test/unit/i18n/sfChoiceFormatTest.php b/lib/vendor/symfony/test/unit/i18n/sfChoiceFormatTest.php index b182ada9b..173fa4492 100644 --- a/lib/vendor/symfony/test/unit/i18n/sfChoiceFormatTest.php +++ b/lib/vendor/symfony/test/unit/i18n/sfChoiceFormatTest.php @@ -10,7 +10,7 @@ require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); -$t = new lime_test(89); +$t = new lime_test(90); $n = new sfChoiceFormat(); @@ -97,6 +97,9 @@ $t->is($n->format($strings[4][0], 1), $strings[4][1][1][1], '->format() returns the string that match the number'); $t->is($n->format($strings[4][0], 12), $strings[4][1][1][2], '->format() returns the string that match the number'); +// test strings with some set notation +$t->is($n->format("[0]Some text|[1,Inf] Some text (10)", 12), 'Some text (10)', '->format() does not take into account ranges that are not prefixed with |'); + // test set notation // tests adapted from Prado unit test suite $t->diag('set notation'); diff --git a/lib/vendor/symfony/test/unit/request/sfRequestTest.php b/lib/vendor/symfony/test/unit/request/sfRequestTest.php old mode 100644 new mode 100755 diff --git a/lib/vendor/symfony/test/unit/request/sfWebRequestTest.php b/lib/vendor/symfony/test/unit/request/sfWebRequestTest.php index 6e3b4306e..707066df7 100644 --- a/lib/vendor/symfony/test/unit/request/sfWebRequestTest.php +++ b/lib/vendor/symfony/test/unit/request/sfWebRequestTest.php @@ -10,7 +10,7 @@ require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); -$t = new lime_test(72); +$t = new lime_test(73); class myRequest extends sfWebRequest { @@ -101,15 +101,16 @@ public function resetPathInfoArray() $request->acceptableContentTypes = null; $_SERVER['HTTP_ACCEPT'] = 'text/xml,application/xhtml+xml,application/xml,text/html;q=0.9,text/plain;q=0.8,*/*;q=0.5'; -$t->is($request->getAcceptableContentTypes(), array('text/xml', 'application/xml', 'application/xhtml+xml', 'text/html', 'text/plain', '*/*'), '->getAcceptableContentTypes() returns an array with all accepted content types'); +$t->is($request->getAcceptableContentTypes(), array('text/xml', 'application/xhtml+xml', 'application/xml', 'text/html', 'text/plain', '*/*'), '->getAcceptableContentTypes() returns an array with all accepted content types'); // ->splitHttpAcceptHeader() $t->diag('->splitHttpAcceptHeader()'); $t->is($request->splitHttpAcceptHeader(''), array(), '->splitHttpAcceptHeader() returns an empty array if the header is empty'); -$t->is($request->splitHttpAcceptHeader('a,b,c'), array('c', 'b', 'a'), '->splitHttpAcceptHeader() returns an array of values'); +$t->is($request->splitHttpAcceptHeader('a,b,c'), array('a', 'b', 'c'), '->splitHttpAcceptHeader() returns an array of values'); $t->is($request->splitHttpAcceptHeader('a,b;q=0.7,c;q=0.3'), array('a', 'b', 'c'), '->splitHttpAcceptHeader() strips the q value'); $t->is($request->splitHttpAcceptHeader('a;q=0.1,b,c;q=0.3'), array('b', 'c', 'a'), '->splitHttpAcceptHeader() sorts values by the q value'); +$t->is($request->splitHttpAcceptHeader('a;q=0.3,b,c;q=0.3'), array('b', 'a', 'c'), '->splitHttpAcceptHeader() sorts values by the q value including equal values'); $t->is($request->splitHttpAcceptHeader('a; q=0.1, b, c; q=0.3'), array('b', 'c', 'a'), '->splitHttpAcceptHeader() trims whitespaces'); $t->is($request->splitHttpAcceptHeader('a; q=0, b'), array('b'), '->splitHttpAcceptHeader() removes values when q = 0 (as per the RFC)'); diff --git a/lib/vendor/symfony/test/unit/util/sfBrowserTest.php b/lib/vendor/symfony/test/unit/util/sfBrowserTest.php index d4f457c76..d5ad70a8f 100644 --- a/lib/vendor/symfony/test/unit/util/sfBrowserTest.php +++ b/lib/vendor/symfony/test/unit/util/sfBrowserTest.php @@ -10,7 +10,7 @@ require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); -$t = new lime_test(73); +$t = new lime_test(74); // ->click() $t->diag('->click()'); @@ -133,6 +133,11 @@ public function getDefaultServerArray($name) + + EOF; @@ -311,6 +316,9 @@ public function getDefaultServerArray($name) $t->pass('->deselect() cannot deselect radiobuttons'); } +list($method, $uri, $parameters) = $b->click('li:contains("first") a'); +$t->is($uri, 'myfirstlink', 'click accept css selectors without "[" or "]"'); + // ->call() $t->diag('->call()'); $b->call('https://app-test/index.phpmain/index'); diff --git a/lib/vendor/symfony/test/unit/validator/sfValidatorFileTest.php b/lib/vendor/symfony/test/unit/validator/sfValidatorFileTest.php index bd3274a55..fb4ad4134 100644 --- a/lib/vendor/symfony/test/unit/validator/sfValidatorFileTest.php +++ b/lib/vendor/symfony/test/unit/validator/sfValidatorFileTest.php @@ -75,7 +75,7 @@ public function getMimeTypesFromCategory($category) else { $v = new testValidatorFile(); - $t->is($v->guessFromFileinfo($tmpDir.'/test.txt'), (version_compare(PHP_VERSION, '5.3', '<')) ? 'text/plain' : 'text/plain; charset=us-ascii', '->guessFromFileinfo() guesses the type of a given file'); + $t->is($v->guessFromFileinfo($tmpDir.'/test.txt'), 'text/plain', '->guessFromFileinfo() guesses the type of a given file'); $t->is($v->guessFromFileinfo($tmpDir.'/foo.txt'), null, '->guessFromFileinfo() returns null if the file type is not guessable'); } @@ -88,7 +88,7 @@ public function getMimeTypesFromCategory($category) else { $v = new testValidatorFile(); - $t->is($v->guessFromMimeContentType($tmpDir.'/test.txt'), (version_compare(PHP_VERSION, '5.3', '<')) ? 'text/plain' : 'text/plain; charset=us-ascii', '->guessFromMimeContentType() guesses the type of a given file'); + $t->is($v->guessFromMimeContentType($tmpDir.'/test.txt'), 'text/plain', '->guessFromMimeContentType() guesses the type of a given file'); $t->is($v->guessFromMimeContentType($tmpDir.'/foo.txt'), null, '->guessFromMimeContentType() returns null if the file type is not guessable'); } @@ -102,7 +102,7 @@ public function getMimeTypesFromCategory($category) // ->getMimeType() $t->diag('->getMimeType()'); $v = new testValidatorFile(); -$t->is($v->getMimeType($tmpDir.'/test.txt', 'image/png'), (version_compare(PHP_VERSION, '5.3', '<')) ? 'text/plain' : 'text/plain; charset=us-ascii', '->getMimeType() guesses the type of a given file'); +$t->is($v->getMimeType($tmpDir.'/test.txt', 'image/png'), 'text/plain', '->getMimeType() guesses the type of a given file'); $t->is($v->getMimeType($tmpDir.'/foo.txt', 'text/plain'), 'text/plain', '->getMimeType() returns the default type if the file type is not guessable'); $v->setOption('mime_type_guessers', array_merge(array(array($v, 'guessFromNothing')), $v->getOption('mime_type_guessers'))); @@ -126,7 +126,7 @@ public function getMimeTypesFromCategory($category) $t->ok($f instanceof sfValidatedFile, '->clean() returns a sfValidatedFile instance'); $t->is($f->getOriginalName(), '', '->clean() returns a sfValidatedFile with an empty original name if the name is not passed in the initial value'); $t->is($f->getSize(), strlen($content), '->clean() returns a sfValidatedFile with a computed file size if the size is not passed in the initial value'); -$t->is($f->getType(), (version_compare(PHP_VERSION, '5.3', '<')) ? 'text/plain' : 'text/plain; charset=us-ascii', '->clean() returns a sfValidatedFile with a guessed content type'); +$t->is($f->getType(), 'text/plain', '->clean() returns a sfValidatedFile with a guessed content type'); class myValidatedFile extends sfValidatedFile { diff --git a/lib/vendor/symfony/test/unit/widget/i18n/sfWidgetFormI18nChoiceCountryTest.php b/lib/vendor/symfony/test/unit/widget/i18n/sfWidgetFormI18nChoiceCountryTest.php index 7a4460871..c588c0b71 100644 --- a/lib/vendor/symfony/test/unit/widget/i18n/sfWidgetFormI18nChoiceCountryTest.php +++ b/lib/vendor/symfony/test/unit/widget/i18n/sfWidgetFormI18nChoiceCountryTest.php @@ -41,7 +41,7 @@ // Test for ICU Upgrade and Ticket #7988 // should be 0. Tests will break after ICU Update, which is fine. change count to 0 $t->is(count($css->matchAll('#country option[value="ZZ"]')), 1, '->render() does not contain dummy data'); -$t->is(count($css->matchAll('#country option[value="419"]')), 1, '->render() does not contain region data'); +$t->is(count($css->matchAll('#country option[value="419"]')), 0, '->render() does not contain region data'); // add_empty $t->diag('add_empty'); diff --git a/lib/vendor/symfony/test/unit/widget/sfWidgetFormTest.php b/lib/vendor/symfony/test/unit/widget/sfWidgetFormTest.php index 68998a88e..8ac66f22c 100644 --- a/lib/vendor/symfony/test/unit/widget/sfWidgetFormTest.php +++ b/lib/vendor/symfony/test/unit/widget/sfWidgetFormTest.php @@ -10,7 +10,7 @@ require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); -$t = new lime_test(34); +$t = new lime_test(35); class MyWidgetForm extends sfWidgetForm { @@ -104,6 +104,7 @@ public function generateId($name, $value = null) $w->setIdFormat('id_for_%s_works'); $t->is($w->generateId('foo'), 'id_for_foo_works', '->setIdFormat() sets the format of the widget id'); $t->is($w->generateId('foo[]'), 'id_for_foo_works', '->generateId() removes the [] from the name'); +$t->is($w->generateId('foo[]', array()), 'id_for_foo_works', '->generateId() accepts array value'); $t->is($w->generateId('foo[bar][]'), 'id_for_foo_bar_works', '->generateId() replaces [] with _'); $t->is($w->generateId('foo[bar][]', 'test'), 'id_for_foo_bar_test_works', '->generateId() takes the value into account if provided'); $t->is($w->generateId('_foo[bar][]', 'test'), 'id_for__foo_bar_test_works', '->generateId() leaves valid ids'); diff --git a/lib/vendor/symfony/test/unit/widget/sfWidgetTest.php b/lib/vendor/symfony/test/unit/widget/sfWidgetTest.php index 6c210a972..1b2adf15d 100644 --- a/lib/vendor/symfony/test/unit/widget/sfWidgetTest.php +++ b/lib/vendor/symfony/test/unit/widget/sfWidgetTest.php @@ -10,7 +10,7 @@ require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); -$t = new lime_test(32); +$t = new lime_test(33); class MyWidget extends sfWidget { @@ -133,6 +133,7 @@ protected function configure($options = array(), $attributes = array()) $t->is(sfWidget::escapeOnce('This a > text to "escape"'), 'This a > text to "escape"', '::escapeOnce() escapes an HTML strings'); $t->is(sfWidget::escapeOnce(sfWidget::escapeOnce('This a > text to "escape"')), 'This a > text to "escape"', '::escapeOnce() does not escape an already escaped string'); $t->is(sfWidget::escapeOnce('This a > text to "escape"'), 'This a > text to "escape"', '::escapeOnce() does not escape an already escaped string'); +$t->is(sfWidget::escapeOnce(array()), null, '::escapeOnce() accepts array as argument and returns null'); class MyClass {