# HG changeset patch # User Raphael Velt # Date 1363945624 -3600 # Node ID ba5f4046635bc74c4f7d6f64f67871696bbe176c # Parent 8d50c48361b83044afa32666ae47da1862ef4c4e# Parent 5b7391b75db24b6910d17663029ec59297ec6648 Merge with b70f633a6f16bcc42923f796b2c7a31b6afd9694 diff -r 8d50c48361b8 -r ba5f4046635b web/common.php --- a/web/common.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/common.php Fri Mar 22 10:47:04 2013 +0100 @@ -40,7 +40,7 @@ $configuration = array( - 'siteUrl' => 'http://twitter.com/oauth', + 'siteUrl' => 'https://api.twitter.com/oauth', 'consumerKey' => '***REMOVED***', 'consumerSecret' => '***REMOVED***' ); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl.php --- a/web/lib/Zend/Acl.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Acl.php 23358 2010-11-18 16:19:31Z ralph $ + * @version $Id: Acl.php 24771 2012-05-07 01:13:06Z adamlundrigan $ */ @@ -53,7 +53,7 @@ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Acl @@ -140,7 +140,7 @@ * will have the least priority, and the last parent added will have the * highest priority. * - * @param Zend_Acl_Role_Interface $role + * @param Zend_Acl_Role_Interface|string $role * @param Zend_Acl_Role_Interface|string|array $parents * @uses Zend_Acl_Role_Registry::add() * @return Zend_Acl Provides a fluent interface @@ -655,7 +655,7 @@ } unset($rTarget); } - + // normalize privileges to array if (null === $privileges) { $privileges = array(); @@ -726,7 +726,7 @@ } continue; } - + if (isset($rules['allPrivileges']['type']) && $type === $rules['allPrivileges']['type']) { @@ -750,7 +750,7 @@ * since null (all resources) was passed to this setRule() call, we need * clean up all the rules for the global allResources, as well as the indivually * set resources (per privilege as well) - */ + */ foreach (array_merge(array(null), $allResources) as $resource) { $rules =& $this->_getRules($resource, $role, true); if (null === $rules) { @@ -769,7 +769,7 @@ } continue; } - + if (isset($rules['allPrivileges']['type']) && $type === $rules['allPrivileges']['type']) { unset($rules['allPrivileges']); } @@ -1218,6 +1218,11 @@ } /** + * Returns an array of registered roles. + * + * Note that this method does not return instances of registered roles, + * but only the role identifiers. + * * @return array of registered roles */ public function getRoles() @@ -1232,6 +1237,6 @@ { return array_keys($this->_resources); } - + } - + diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl/Assert/Interface.php --- a/web/lib/Zend/Acl/Assert/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl/Assert/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -41,7 +41,7 @@ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Acl_Assert_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl/Exception.php --- a/web/lib/Zend/Acl/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Acl_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl/Resource.php --- a/web/lib/Zend/Acl/Resource.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl/Resource.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Resource.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Acl_Resource implements Zend_Acl_Resource_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl/Resource/Interface.php --- a/web/lib/Zend/Acl/Resource/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl/Resource/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,16 +14,16 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Acl_Resource_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl/Role.php --- a/web/lib/Zend/Acl/Role.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl/Role.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Role.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Role.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Acl_Role implements Zend_Acl_Role_Interface @@ -44,7 +44,7 @@ /** * Sets the Role identifier * - * @param string $id + * @param string $roleId * @return void */ public function __construct($roleId) diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl/Role/Interface.php --- a/web/lib/Zend/Acl/Role/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl/Role/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,16 +14,16 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Acl_Role_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl/Role/Registry.php --- a/web/lib/Zend/Acl/Role/Registry.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl/Role/Registry.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Registry.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Registry.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Acl_Role_Registry diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Acl/Role/Registry/Exception.php --- a/web/lib/Zend/Acl/Role/Registry/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Acl/Role/Registry/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Acl - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Acl_Role_Registry_Exception extends Zend_Acl_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Adobe/Auth.php --- a/web/lib/Zend/Amf/Adobe/Auth.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Adobe/Auth.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Auth.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Auth.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Amf_Auth_Abstract */ @@ -33,7 +33,7 @@ * * @package Zend_Amf * @subpackage Adobe - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Adobe_Auth extends Zend_Amf_Auth_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Adobe/DbInspector.php --- a/web/lib/Zend/Amf/Adobe/DbInspector.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Adobe/DbInspector.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: DbInspector.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: DbInspector.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -24,7 +24,7 @@ * * @package Zend_Amf * @subpackage Adobe - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Adobe_DbInspector diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Adobe/Introspector.php --- a/web/lib/Zend/Amf/Adobe/Introspector.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Adobe/Introspector.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Introspector.php 23316 2010-11-10 16:37:40Z matthew $ + * @version $Id: Introspector.php 25024 2012-07-30 15:08:15Z rob $ */ /** @see Zend_Amf_Parse_TypeLoader */ @@ -33,7 +33,7 @@ * * @package Zend_Amf * @subpackage Adobe - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Adobe_Introspector diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Auth/Abstract.php --- a/web/lib/Zend/Amf/Auth/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Auth/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Auth_Adapter_Interface */ @@ -27,7 +27,7 @@ * * @package Zend_Amf * @subpackage Auth - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Amf_Auth_Abstract implements Zend_Auth_Adapter_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Constants.php --- a/web/lib/Zend/Amf/Constants.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Constants.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Constants.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Constants.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -24,7 +24,7 @@ * deserialization to detect the AMF marker and encoding types. * * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ final class Zend_Amf_Constants diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Exception.php --- a/web/lib/Zend/Amf/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ /** * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Amf0/Deserializer.php --- a/web/lib/Zend/Amf/Parse/Amf0/Deserializer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Amf0/Deserializer.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse_Amf0 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Deserializer.php 21209 2010-02-27 10:37:15Z yoshida@zend.co.jp $ + * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Amf_Constants */ @@ -33,7 +33,7 @@ * @todo Class could be implemented as Factory Class with each data type it's own class * @package Zend_Amf * @subpackage Parse_Amf0 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_Amf0_Deserializer extends Zend_Amf_Parse_Deserializer diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Amf0/Serializer.php --- a/web/lib/Zend/Amf/Parse/Amf0/Serializer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Amf0/Serializer.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse_Amf0 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Serializer.php 21968 2010-04-22 03:53:34Z matthew $ + * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $ */ /** Zend_Amf_Constants */ @@ -32,7 +32,7 @@ * @uses Zend_Amf_Parse_Serializer * @package Zend_Amf * @subpackage Parse_Amf0 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer @@ -63,8 +63,8 @@ */ public function writeTypeMarker(&$data, $markerType = null, $dataByVal = false) { - // Workaround for PHP5 with E_STRICT enabled complaining about "Only - // variables should be passed by reference" + // Workaround for PHP5 with E_STRICT enabled complaining about "Only + // variables should be passed by reference" if ((null === $data) && ($dataByVal !== false)) { $data = &$dataByVal; } @@ -127,7 +127,7 @@ case (is_bool($data)): $markerType = Zend_Amf_Constants::AMF0_BOOLEAN; break; - case (is_string($data) && (strlen($data) > 65536)): + case (is_string($data) && (($this->_mbStringFunctionsOverloaded ? mb_strlen($data, '8bit') : strlen($data)) > 65536)): $markerType = Zend_Amf_Constants::AMF0_LONGSTRING; break; case (is_string($data)): @@ -187,23 +187,23 @@ * Check if the given object is in the reference table, write the reference if it exists, * otherwise add the object to the reference table * - * @param mixed $object object reference to check for reference - * @param $markerType AMF type of the object to write - * @param mixed $objectByVal object to check for reference + * @param mixed $object object reference to check for reference + * @param string $markerType AMF type of the object to write + * @param mixed $objectByVal object to check for reference * @return Boolean true, if the reference was written, false otherwise */ - protected function writeObjectReference(&$object, $markerType, $objectByVal = false) + protected function writeObjectReference(&$object, $markerType, $objectByVal = false) { - // Workaround for PHP5 with E_STRICT enabled complaining about "Only + // Workaround for PHP5 with E_STRICT enabled complaining about "Only // variables should be passed by reference" if ((null === $object) && ($objectByVal !== false)) { $object = &$objectByVal; } - if ($markerType == Zend_Amf_Constants::AMF0_OBJECT - || $markerType == Zend_Amf_Constants::AMF0_MIXEDARRAY - || $markerType == Zend_Amf_Constants::AMF0_ARRAY - || $markerType == Zend_Amf_Constants::AMF0_TYPEDOBJECT + if ($markerType == Zend_Amf_Constants::AMF0_OBJECT + || $markerType == Zend_Amf_Constants::AMF0_MIXEDARRAY + || $markerType == Zend_Amf_Constants::AMF0_ARRAY + || $markerType == Zend_Amf_Constants::AMF0_TYPEDOBJECT ) { $ref = array_search($object, $this->_referenceObjects, true); //handle object reference diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Amf3/Deserializer.php --- a/web/lib/Zend/Amf/Parse/Amf3/Deserializer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Amf3/Deserializer.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse_Amf3 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Deserializer.php 21968 2010-04-22 03:53:34Z matthew $ + * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Amf_Parse_Deserializer */ @@ -34,7 +34,7 @@ * @todo Class could be implemented as Factory Class with each data type it's own class. * @package Zend_Amf * @subpackage Parse_Amf3 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer @@ -225,7 +225,7 @@ $timestamp = floor($this->_stream->readDouble() / 1000); require_once 'Zend/Date.php'; - $dateTime = new Zend_Date((int) $timestamp); + $dateTime = new Zend_Date($timestamp); $this->_referenceObjects[] = $dateTime; return $dateTime; } @@ -385,6 +385,7 @@ } // Add properties back to the return object. + if (!is_array($properties)) $properties = array(); foreach($properties as $key=>$value) { if($key) { $returnObject->$key = $value; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Amf3/Serializer.php --- a/web/lib/Zend/Amf/Parse/Amf3/Serializer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Amf3/Serializer.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse_Amf3 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Serializer.php 22101 2010-05-04 20:07:13Z matthew $ + * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $ */ /** Zend_Amf_Constants */ @@ -35,7 +35,7 @@ * * @package Zend_Amf * @subpackage Parse_Amf3 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer @@ -45,7 +45,7 @@ * @var string */ protected $_strEmpty = ''; - + /** * An array of reference objects per amf body * @var array @@ -78,7 +78,7 @@ */ public function writeTypeMarker(&$data, $markerType = null, $dataByVal = false) { - // Workaround for PHP5 with E_STRICT enabled complaining about "Only + // Workaround for PHP5 with E_STRICT enabled complaining about "Only // variables should be passed by reference" if ((null === $data) && ($dataByVal !== false)) { $data = &$dataByVal; @@ -215,7 +215,7 @@ * @return Zend_Amf_Parse_Amf3_Serializer */ protected function writeBinaryString(&$string){ - $ref = strlen($string) << 1 | 0x01; + $ref = ($this->_mbStringFunctionsOverloaded ? mb_strlen($string, '8bit') : strlen($string)) << 1 | 0x01; $this->writeInteger($ref); $this->_stream->writeBytes($string); @@ -230,15 +230,17 @@ */ public function writeString(&$string) { - $len = strlen($string); + $len = $this->_mbStringFunctionsOverloaded ? mb_strlen($string, '8bit') : strlen($string); if(!$len){ $this->writeInteger(0x01); return $this; } - $ref = array_search($string, $this->_referenceStrings, true); - if($ref === false){ - $this->_referenceStrings[] = $string; + $ref = array_key_exists($string, $this->_referenceStrings) + ? $this->_referenceStrings[$string] + : false; + if ($ref === false){ + $this->_referenceStrings[$string] = count($this->_referenceStrings); $this->writeBinaryString($string); } else { $ref <<= 1; @@ -380,13 +382,16 @@ */ protected function writeObjectReference(&$object, $objectByVal = false) { - // Workaround for PHP5 with E_STRICT enabled complaining about "Only + // Workaround for PHP5 with E_STRICT enabled complaining about "Only // variables should be passed by reference" if ((null === $object) && ($objectByVal !== false)) { $object = &$objectByVal; } - $ref = array_search($object, $this->_referenceObjects,true); + $hash = spl_object_hash($object); + $ref = array_key_exists($hash, $this->_referenceObjects) + ? $this->_referenceObjects[$hash] + : false; // quickly handle object references if ($ref !== false){ @@ -394,7 +399,7 @@ $this->writeInteger($ref); return true; } - $this->_referenceObjects[] = $object; + $this->_referenceObjects[$hash] = count($this->_referenceObjects); return false; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Deserializer.php --- a/web/lib/Zend/Amf/Parse/Deserializer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Deserializer.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Deserializer.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -30,7 +30,7 @@ * @see http://opensource.adobe.com/svn/opensource/blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/ * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Amf_Parse_Deserializer diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/InputStream.php --- a/web/lib/Zend/Amf/Parse/InputStream.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/InputStream.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: InputStream.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: InputStream.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Amf_Util_BinaryStream */ @@ -31,7 +31,7 @@ * * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_InputStream extends Zend_Amf_Util_BinaryStream diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/OutputStream.php --- a/web/lib/Zend/Amf/Parse/OutputStream.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/OutputStream.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: OutputStream.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: OutputStream.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Amf_Util_BinaryStream */ @@ -32,7 +32,7 @@ * @uses Zend_Amf_Util_BinaryStream * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_OutputStream extends Zend_Amf_Util_BinaryStream diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Resource/MysqlResult.php --- a/web/lib/Zend/Amf/Parse/Resource/MysqlResult.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Resource/MysqlResult.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: MysqlResult.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: MysqlResult.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_Resource_MysqlResult diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Resource/MysqliResult.php --- a/web/lib/Zend/Amf/Parse/Resource/MysqliResult.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Resource/MysqliResult.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: MysqliResult.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: MysqliResult.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_Resource_MysqliResult diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Resource/Stream.php --- a/web/lib/Zend/Amf/Parse/Resource/Stream.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Resource/Stream.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Stream.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Stream.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -25,7 +25,7 @@ * * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Parse_Resource_Stream diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/Serializer.php --- a/web/lib/Zend/Amf/Parse/Serializer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/Serializer.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Serializer.php 21968 2010-04-22 03:53:34Z matthew $ + * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $ */ /** @@ -25,7 +25,7 @@ * * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Amf_Parse_Serializer @@ -38,6 +38,13 @@ protected $_stream; /** + * str* functions overloaded using mbstring.func_overload + * + * @var bool + */ + protected $mbStringFunctionsOverloaded; + + /** * Constructor * * @param Zend_Amf_Parse_OutputStream $stream @@ -46,6 +53,7 @@ public function __construct(Zend_Amf_Parse_OutputStream $stream) { $this->_stream = $stream; + $this->_mbStringFunctionsOverloaded = function_exists('mb_strlen') && (ini_get('mbstring.func_overload') !== '') && ((int)ini_get('mbstring.func_overload') & 2); } /** diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Parse/TypeLoader.php --- a/web/lib/Zend/Amf/Parse/TypeLoader.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Parse/TypeLoader.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: TypeLoader.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: TypeLoader.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -47,7 +47,7 @@ * @todo PHP 5.3 can drastically change this class w/ namespace and the new call_user_func w/ namespace * @package Zend_Amf * @subpackage Parse - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ final class Zend_Amf_Parse_TypeLoader diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Request.php --- a/web/lib/Zend/Amf/Request.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Request.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Request.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Request.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Amf_Parse_InputStream */ @@ -40,7 +40,7 @@ * * @todo Currently not checking if the object needs to be Type Mapped to a server object. * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Request diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Request/Http.php --- a/web/lib/Zend/Amf/Request/Http.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Request/Http.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Request - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Amf_Request */ @@ -32,7 +32,7 @@ * * @package Zend_Amf * @subpackage Request - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Request_Http extends Zend_Amf_Request diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Response.php --- a/web/lib/Zend/Amf/Response.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Response.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Response.php 21968 2010-04-22 03:53:34Z matthew $ + * @version $Id: Response.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Amf_Constants */ @@ -32,7 +32,7 @@ * Handles converting the PHP object ready for response back into AMF * * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Response @@ -95,7 +95,7 @@ $stream->writeByte($header->mustRead); $stream->writeLong(Zend_Amf_Constants::UNKNOWN_CONTENT_LENGTH); if (is_object($header->data)) { - // Workaround for PHP5 with E_STRICT enabled complaining about + // Workaround for PHP5 with E_STRICT enabled complaining about // "Only variables should be passed by reference" $placeholder = null; $serializer->writeTypeMarker($placeholder, null, $header->data); @@ -115,7 +115,7 @@ $bodyData = $body->getData(); $markerType = ($this->_objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) ? null : Zend_Amf_Constants::AMF0_AMF3; if (is_object($bodyData)) { - // Workaround for PHP5 with E_STRICT enabled complaining about + // Workaround for PHP5 with E_STRICT enabled complaining about // "Only variables should be passed by reference" $placeholder = null; $serializer->writeTypeMarker($placeholder, $markerType, $bodyData); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Response/Http.php --- a/web/lib/Zend/Amf/Response/Http.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Response/Http.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Response - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Http.php 22096 2010-05-04 15:37:23Z wadearnold $ + * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Amf_Response */ @@ -28,7 +28,7 @@ * * @package Zend_Amf * @subpackage Response - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Response_Http extends Zend_Amf_Response @@ -41,11 +41,33 @@ public function getResponse() { if (!headers_sent()) { - header('Cache-Control: no-cache, must-revalidate'); + if ($this->isIeOverSsl()) { + header('Cache-Control: cache, must-revalidate'); + header('Pragma: public'); + } else { + header('Cache-Control: no-cache, must-revalidate'); + header('Pragma: no-cache'); + } header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); - header('Pragma: no-cache'); header('Content-Type: application/x-amf'); } return parent::getResponse(); } + + protected function isIeOverSsl() + { + $ssl = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false; + if (!$ssl || ($ssl == 'off')) { + // IIS reports "off", whereas other browsers simply don't populate + return false; + } + + $ua = $_SERVER['HTTP_USER_AGENT']; + if (!preg_match('/; MSIE \d+\.\d+;/', $ua)) { + // Not MicroSoft Internet Explorer + return false; + } + + return true; + } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Server.php --- a/web/lib/Zend/Amf/Server.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Server.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Amf - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Server.php 23256 2010-10-26 12:51:54Z alexander $ + * @version $Id: Server.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Server_Interface */ @@ -52,7 +52,7 @@ * @todo Make the reflection methods cache and autoload. * @package Zend_Amf * @subpackage Server - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Server implements Zend_Server_Interface @@ -142,12 +142,18 @@ /** * Set authentication adapter * + * If the authentication adapter implements a "getAcl()" method, populate + * the ACL of this instance with it (if none exists already). + * * @param Zend_Amf_Auth_Abstract $auth * @return Zend_Amf_Server */ public function setAuth(Zend_Amf_Auth_Abstract $auth) { $this->_auth = $auth; + if ((null === $this->getAcl()) && method_exists($auth, 'getAcl')) { + $this->setAcl($auth->getAcl()); + } return $this; } /** @@ -317,6 +323,7 @@ throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist: '.$e->getMessage(), 0, $e); } // Add the new loaded class to the server. + require_once 'Zend/Amf/Server/Exception.php'; $this->setClass($className, $source); } @@ -334,6 +341,8 @@ $params = array_merge($params, $argv); } + $params = $this->_castParameters($info, $params); + if ($info instanceof Zend_Server_Reflection_Function) { $func = $info->getName(); $this->_checkAcl(null, $func); @@ -494,66 +503,60 @@ // set response encoding $response->setObjectEncoding($objectEncoding); - $responseBody = $request->getAmfBodies(); - - $handleAuth = false; - if ($this->_auth) { - $headers = $request->getAmfHeaders(); - if (isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]) && - isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid)) { - $handleAuth = true; + // Authenticate, if we have credential headers + $error = false; + $headers = $request->getAmfHeaders(); + if (isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]) + && isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid) + && isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password) + ) { + try { + if ($this->_handleAuth( + $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid, + $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password + )) { + // use RequestPersistentHeader to clear credentials + $response->addAmfHeader( + new Zend_Amf_Value_MessageHeader( + Zend_Amf_Constants::PERSISTENT_HEADER, + false, + new Zend_Amf_Value_MessageHeader( + Zend_Amf_Constants::CREDENTIALS_HEADER, + false, null + ) + ) + ); + } + } catch (Exception $e) { + // Error during authentication; report it + $error = $this->_errorMessage( + $objectEncoding, + '', + $e->getMessage(), + $e->getTraceAsString(), + $e->getCode(), + $e->getLine() + ); + $responseType = Zend_AMF_Constants::STATUS_METHOD; } } // Iterate through each of the service calls in the AMF request - foreach($responseBody as $body) + foreach($request->getAmfBodies() as $body) { + if ($error) { + // Error during authentication; just report it and be done + $responseURI = $body->getResponseURI() . $responseType; + $newBody = new Zend_Amf_Value_MessageBody($responseURI, null, $error); + $response->addAmfBody($newBody); + continue; + } try { - if ($handleAuth) { - if ($this->_handleAuth( - $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid, - $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password)) { - // use RequestPersistentHeader to clear credentials - $response->addAmfHeader( - new Zend_Amf_Value_MessageHeader( - Zend_Amf_Constants::PERSISTENT_HEADER, - false, - new Zend_Amf_Value_MessageHeader( - Zend_Amf_Constants::CREDENTIALS_HEADER, - false, null))); - $handleAuth = false; - } - } - - if ($objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) { - // AMF0 Object Encoding - $targetURI = $body->getTargetURI(); - $message = ''; - - // Split the target string into its values. - $source = substr($targetURI, 0, strrpos($targetURI, '.')); - - if ($source) { - // Break off method name from namespace into source - $method = substr(strrchr($targetURI, '.'), 1); - $return = $this->_dispatch($method, $body->getData(), $source); - } else { - // Just have a method name. - $return = $this->_dispatch($targetURI, $body->getData()); - } - } else { - // AMF3 read message type - $message = $body->getData(); - if ($message instanceof Zend_Amf_Value_Messaging_CommandMessage) { - // async call with command message - $return = $this->_loadCommandMessage($message); - } elseif ($message instanceof Zend_Amf_Value_Messaging_RemotingMessage) { - require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php'; - $return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message); - $return->body = $this->_dispatch($message->operation, $message->body, $message->source); - } else { - // Amf3 message sent with netConnection + switch ($objectEncoding) { + case Zend_Amf_Constants::AMF0_OBJECT_ENCODING: + // AMF0 Object Encoding $targetURI = $body->getTargetURI(); + $message = ''; // Split the target string into its values. $source = substr($targetURI, 0, strrpos($targetURI, '.')); @@ -566,7 +569,35 @@ // Just have a method name. $return = $this->_dispatch($targetURI, $body->getData()); } - } + break; + case Zend_Amf_Constants::AMF3_OBJECT_ENCODING: + default: + // AMF3 read message type + $message = $body->getData(); + if ($message instanceof Zend_Amf_Value_Messaging_CommandMessage) { + // async call with command message + $return = $this->_loadCommandMessage($message); + } elseif ($message instanceof Zend_Amf_Value_Messaging_RemotingMessage) { + require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php'; + $return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message); + $return->body = $this->_dispatch($message->operation, $message->body, $message->source); + } else { + // Amf3 message sent with netConnection + $targetURI = $body->getTargetURI(); + + // Split the target string into its values. + $source = substr($targetURI, 0, strrpos($targetURI, '.')); + + if ($source) { + // Break off method name from namespace into source + $method = substr(strrchr($targetURI, '.'), 1); + $return = $this->_dispatch($method, $body->getData(), $source); + } else { + // Just have a method name. + $return = $this->_dispatch($targetURI, $body->getData()); + } + } + break; } $responseType = Zend_AMF_Constants::RESULT_METHOD; } catch (Exception $e) { @@ -933,4 +964,85 @@ { return array_keys($this->_table); } + + /** + * Cast parameters + * + * Takes the provided parameters from the request, and attempts to cast them + * to objects, if the prototype defines any as explicit object types + * + * @param Reflection $reflectionMethod + * @param array $params + * @return array + */ + protected function _castParameters($reflectionMethod, array $params) + { + $prototypes = $reflectionMethod->getPrototypes(); + $nonObjectTypes = array( + 'null', + 'mixed', + 'void', + 'unknown', + 'bool', + 'boolean', + 'number', + 'int', + 'integer', + 'double', + 'float', + 'string', + 'array', + 'object', + 'stdclass', + ); + $types = array(); + foreach ($prototypes as $prototype) { + foreach ($prototype->getParameters() as $parameter) { + $type = $parameter->getType(); + if (in_array(strtolower($type), $nonObjectTypes)) { + continue; + } + $position = $parameter->getPosition(); + $types[$position] = $type; + } + } + + if (empty($types)) { + return $params; + } + + foreach ($params as $position => $value) { + if (!isset($types[$position])) { + // No specific type to cast to? done + continue; + } + + $type = $types[$position]; + + if (!class_exists($type)) { + // Not a class, apparently. done + continue; + } + + if ($value instanceof $type) { + // Already of the right type? done + continue; + } + + if (!is_array($value) && !is_object($value)) { + // Can't cast scalars to objects easily; done + continue; + } + + // Create instance, and loop through value to set + $object = new $type; + foreach ($value as $property => $defined) { + $object->{$property} = $defined; + } + + $params[$position] = $object; + } + + return $params; + } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Server/Exception.php --- a/web/lib/Zend/Amf/Server/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Server/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Server - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Amf_Exception */ @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Amf * @subpackage Server - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Server_Exception extends Zend_Amf_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Util/BinaryStream.php --- a/web/lib/Zend/Amf/Util/BinaryStream.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Util/BinaryStream.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Util - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: BinaryStream.php 22101 2010-05-04 20:07:13Z matthew $ + * @version $Id: BinaryStream.php 25241 2013-01-22 11:07:36Z frosch $ */ /** @@ -25,7 +25,7 @@ * * @package Zend_Amf * @subpackage Util - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Util_BinaryStream @@ -51,6 +51,11 @@ protected $_needle; /** + * @var bool str* functions overloaded using mbstring.func_overload? + */ + protected $_mbStringFunctionsOverloaded; + + /** * Constructor * * Create a reference to a byte stream that is going to be parsed or created @@ -69,7 +74,8 @@ $this->_stream = $stream; $this->_needle = 0; - $this->_streamLength = strlen($stream); + $this->_mbStringFunctionsOverloaded = function_exists('mb_strlen') && (ini_get('mbstring.func_overload') !== '') && ((int)ini_get('mbstring.func_overload') & 2); + $this->_streamLength = $this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream); $this->_bigEndian = (pack('l', 1) === "\x00\x00\x00\x01"); } @@ -97,7 +103,7 @@ require_once 'Zend/Amf/Exception.php'; throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length); } - $bytes = substr($this->_stream, $this->_needle, $length); + $bytes = $this->_mbStringFunctionsOverloaded ? mb_substr($this->_stream, $this->_needle, $length, '8bit') : substr($this->_stream, $this->_needle, $length); $this->_needle+= $length; return $bytes; } @@ -120,12 +126,18 @@ * Reads a signed byte * * @return int Value is in the range of -128 to 127. + * @throws Zend_Amf_Exception */ public function readByte() { if (($this->_needle + 1) > $this->_streamLength) { require_once 'Zend/Amf/Exception.php'; - throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length); + throw new Zend_Amf_Exception( + 'Buffer underrun at needle position: ' + . $this->_needle + . ' while requesting length: ' + . $this->_streamLength + ); } return ord($this->_stream{$this->_needle++}); @@ -184,7 +196,7 @@ */ public function writeUtf($stream) { - $this->writeInt(strlen($stream)); + $this->writeInt($this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream)); $this->_stream.= $stream; return $this; } @@ -209,7 +221,7 @@ */ public function writeLongUtf($stream) { - $this->writeLong(strlen($stream)); + $this->writeLong($this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream)); $this->_stream.= $stream; } @@ -255,7 +267,7 @@ */ public function readDouble() { - $bytes = substr($this->_stream, $this->_needle, 8); + $bytes = $this->_mbStringFunctionsOverloaded ? mb_substr($this->_stream, $this->_needle, 8, '8bit') : substr($this->_stream, $this->_needle, 8); $this->_needle+= 8; if (!$this->_bigEndian) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/ByteArray.php --- a/web/lib/Zend/Amf/Value/ByteArray.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/ByteArray.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ByteArray.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ByteArray.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -25,7 +25,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_ByteArray diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/MessageBody.php --- a/web/lib/Zend/Amf/Value/MessageBody.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/MessageBody.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: MessageBody.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: MessageBody.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_MessageBody diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/MessageHeader.php --- a/web/lib/Zend/Amf/Value/MessageHeader.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/MessageHeader.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: MessageHeader.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: MessageHeader.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_MessageHeader diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/Messaging/AbstractMessage.php --- a/web/lib/Zend/Amf/Value/Messaging/AbstractMessage.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/Messaging/AbstractMessage.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AbstractMessage.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: AbstractMessage.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_Messaging_AbstractMessage diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/Messaging/AcknowledgeMessage.php --- a/web/lib/Zend/Amf/Value/Messaging/AcknowledgeMessage.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/Messaging/AcknowledgeMessage.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AcknowledgeMessage.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: AcknowledgeMessage.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Amf_Value_Messaging_AsyncMessage */ @@ -32,7 +32,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_Messaging_AcknowledgeMessage extends Zend_Amf_Value_Messaging_AsyncMessage diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/Messaging/ArrayCollection.php --- a/web/lib/Zend/Amf/Value/Messaging/ArrayCollection.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/Messaging/ArrayCollection.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ArrayCollection.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ArrayCollection.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -27,9 +27,9 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Amf_Value_Messaging_ArrayCollection +class Zend_Amf_Value_Messaging_ArrayCollection extends ArrayObject { } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/Messaging/AsyncMessage.php --- a/web/lib/Zend/Amf/Value/Messaging/AsyncMessage.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/Messaging/AsyncMessage.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AsyncMessage.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: AsyncMessage.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -30,7 +30,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_Messaging_AsyncMessage extends Zend_Amf_Value_Messaging_AbstractMessage diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/Messaging/CommandMessage.php --- a/web/lib/Zend/Amf/Value/Messaging/CommandMessage.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/Messaging/CommandMessage.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: CommandMessage.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: CommandMessage.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -36,7 +36,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_Messaging_CommandMessage extends Zend_Amf_Value_Messaging_AsyncMessage diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/Messaging/ErrorMessage.php --- a/web/lib/Zend/Amf/Value/Messaging/ErrorMessage.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/Messaging/ErrorMessage.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ErrorMessage.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ErrorMessage.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Amf_Value_Messaging_AcknowledgeMessage */ @@ -30,7 +30,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_Messaging_ErrorMessage extends Zend_Amf_Value_Messaging_AcknowledgeMessage diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/Messaging/RemotingMessage.php --- a/web/lib/Zend/Amf/Value/Messaging/RemotingMessage.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/Messaging/RemotingMessage.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: RemotingMessage.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: RemotingMessage.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Amf_Value_Messaging_AbstractMessage */ @@ -31,7 +31,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_Messaging_RemotingMessage extends Zend_Amf_Value_Messaging_AbstractMessage diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Amf/Value/TraitsInfo.php --- a/web/lib/Zend/Amf/Value/TraitsInfo.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Amf/Value/TraitsInfo.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: TraitsInfo.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: TraitsInfo.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -25,7 +25,7 @@ * * @package Zend_Amf * @subpackage Value - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Amf_Value_TraitsInfo diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application.php --- a/web/lib/Zend/Application.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,15 +14,15 @@ * * @category Zend * @package Zend_Application - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Application.php 23163 2010-10-19 16:30:26Z matthew $ + * @version $Id: Application.php 25024 2012-07-30 15:08:15Z rob $ */ /** * @category Zend * @package Zend_Application - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application @@ -376,9 +376,12 @@ protected function _loadConfig($file) { $environment = $this->getEnvironment(); - $suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION)); + $suffix = pathinfo($file, PATHINFO_EXTENSION); + $suffix = ($suffix === 'dist') + ? pathinfo(basename($file, ".$suffix"), PATHINFO_EXTENSION) + : $suffix; - switch ($suffix) { + switch (strtolower($suffix)) { case 'ini': $config = new Zend_Config_Ini($file, $environment); break; @@ -392,6 +395,7 @@ break; case 'yaml': + case 'yml': $config = new Zend_Config_Yaml($file, $environment); break; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Bootstrap/Bootstrap.php --- a/web/lib/Zend/Application/Bootstrap/Bootstrap.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Bootstrap/Bootstrap.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Bootstrap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Bootstrap.php 20885 2010-02-03 19:33:59Z matthew $ + * @version $Id: Bootstrap.php 25073 2012-11-06 19:31:53Z rob $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Application * @subpackage Bootstrap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Bootstrap_Bootstrap @@ -120,7 +120,7 @@ public function getResourceLoader() { if ((null === $this->_resourceLoader) - && (false !== ($namespace = $this->getAppNamespace())) + && (false != ($namespace = $this->getAppNamespace())) ) { $r = new ReflectionClass($this); $path = $r->getFileName(); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Bootstrap/BootstrapAbstract.php --- a/web/lib/Zend/Application/Bootstrap/BootstrapAbstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Bootstrap/BootstrapAbstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Bootstrap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: BootstrapAbstract.php 23278 2010-10-30 12:50:21Z ramon $ + * @version $Id: BootstrapAbstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Application * @subpackage Bootstrap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Application_Bootstrap_BootstrapAbstract @@ -352,7 +352,9 @@ continue; } - if (class_exists($plugin)) { //@SEE ZF-7550 + if (class_exists($plugin) + && is_subclass_of($plugin, 'Zend_Application_Resource_Resource') + ) { //@SEE ZF-7550 $spec = (array) $spec; $spec['bootstrap'] = $this; $instance = new $plugin($spec); @@ -414,7 +416,8 @@ { if ($this->_pluginLoader === null) { $options = array( - 'Zend_Application_Resource' => 'Zend/Application/Resource' + 'Zend_Application_Resource' => 'Zend/Application/Resource', + 'ZendX_Application_Resource' => 'ZendX/Application/Resource' ); $this->_pluginLoader = new Zend_Loader_PluginLoader($options); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Bootstrap/Bootstrapper.php --- a/web/lib/Zend/Application/Bootstrap/Bootstrapper.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Bootstrap/Bootstrapper.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Bootstrap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Bootstrapper.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Bootstrapper.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * @category Zend * @package Zend_Application * @subpackage Bootstrap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Application_Bootstrap_Bootstrapper diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Bootstrap/Exception.php --- a/web/lib/Zend/Application/Bootstrap/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Bootstrap/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Application - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -30,7 +30,7 @@ * @category Zend * @package Zend_Application * @uses Zend_Application_Exception - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Bootstrap_Exception extends Zend_Application_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Bootstrap/ResourceBootstrapper.php --- a/web/lib/Zend/Application/Bootstrap/ResourceBootstrapper.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Bootstrap/ResourceBootstrapper.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Bootstrap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ResourceBootstrapper.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ResourceBootstrapper.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * @category Zend * @package Zend_Application * @subpackage Bootstrap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Application_Bootstrap_ResourceBootstrapper diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Exception.php --- a/web/lib/Zend/Application/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Application - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 25024 2012-07-30 15:08:15Z rob $ */ /** @@ -30,7 +30,7 @@ * @uses Zend_Exception * @category Zend * @package Zend_Application - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Module/Autoloader.php --- a/web/lib/Zend/Application/Module/Autoloader.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Module/Autoloader.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Application * @subpackage Module - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Autoloader.php 20250 2010-01-12 22:15:20Z dasprid $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Autoloader.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,7 +30,7 @@ * @category Zend * @package Zend_Application * @subpackage Module - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Module_Autoloader extends Zend_Loader_Autoloader_Resource diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Module/Bootstrap.php --- a/web/lib/Zend/Application/Module/Bootstrap.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Module/Bootstrap.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Application * @subpackage Module - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Bootstrap.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Bootstrap.php 25024 2012-07-30 15:08:15Z rob $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Module - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Application_Module_Bootstrap @@ -97,9 +97,9 @@ /** * Get default application namespace * - * Proxies to {@link getModuleName()}, and returns the current module + * Proxies to {@link getModuleName()}, and returns the current module * name - * + * * @return string */ public function getAppNamespace() diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Cachemanager.php --- a/web/lib/Zend/Application/Resource/Cachemanager.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Cachemanager.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Cachemanager.php 20785 2010-01-31 09:43:03Z mikaelkael $ + * @version $Id: Cachemanager.php 24593 2012-01-05 20:35:02Z matthew $ */ require_once 'Zend/Application/Resource/ResourceAbstract.php'; @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Cachemanager extends Zend_Application_Resource_ResourceAbstract @@ -57,7 +57,7 @@ { if (null === $this->_manager) { $this->_manager = new Zend_Cache_Manager; - + $options = $this->getOptions(); foreach ($options as $key => $value) { if ($this->_manager->hasCacheTemplate($key)) { @@ -67,7 +67,7 @@ } } } - + return $this->_manager; } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Db.php --- a/web/lib/Zend/Application/Resource/Db.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Db.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Db.php 22544 2010-07-10 15:01:37Z freak $ + * @version $Id: Db.php 25123 2012-11-14 18:27:44Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbstract @@ -45,7 +45,7 @@ protected $_adapter = null; /** - * @var Zend_Db_Adapter_Interface + * @var Zend_Db_Adapter_Abstract */ protected $_db; @@ -66,7 +66,7 @@ /** * Set the adapter * - * @param $adapter string + * @param string $adapter * @return Zend_Application_Resource_Db */ public function setAdapter($adapter) @@ -88,7 +88,7 @@ /** * Set the adapter params * - * @param $adapter string + * @param string $adapter * @return Zend_Application_Resource_Db */ public function setParams(array $params) @@ -132,7 +132,7 @@ /** * Retrieve initialized DB connection * - * @return null|Zend_Db_Adapter_Interface + * @return null|Zend_Db_Adapter_Abstract */ public function getDbAdapter() { @@ -140,6 +140,12 @@ && (null !== ($adapter = $this->getAdapter())) ) { $this->_db = Zend_Db::factory($adapter, $this->getParams()); + + if ($this->_db instanceof Zend_Db_Adapter_Abstract + && $this->isDefaultTableAdapter() + ) { + Zend_Db_Table::setDefaultAdapter($this->_db); + } } return $this->_db; } @@ -152,16 +158,13 @@ public function init() { if (null !== ($db = $this->getDbAdapter())) { - if ($this->isDefaultTableAdapter()) { - Zend_Db_Table::setDefaultAdapter($db); - } return $db; } } /** * Set the default metadata cache - * + * * @param string|Zend_Cache_Core $cache * @return Zend_Application_Resource_Db */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Dojo.php --- a/web/lib/Zend/Application/Resource/Dojo.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Dojo.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Dojo.php 21318 2010-03-04 13:20:01Z freak $ + * @version $Id: Dojo.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Dojo diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Exception.php --- a/web/lib/Zend/Application/Resource/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 22609 2010-07-17 08:47:59Z torio $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Exception extends Zend_Application_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Frontcontroller.php --- a/web/lib/Zend/Application/Resource/Frontcontroller.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Frontcontroller.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Frontcontroller.php 23378 2010-11-18 21:48:27Z bittarman $ + * @version $Id: Frontcontroller.php 24798 2012-05-12 19:17:41Z adamlundrigan $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resource_ResourceAbstract @@ -101,9 +101,9 @@ case 'plugins': foreach ((array) $value as $pluginClass) { - $stackIndex = null; - if(is_array($pluginClass)) { - $pluginClass = array_change_key_case($pluginClass, CASE_LOWER); + $stackIndex = null; + if(is_array($pluginClass)) { + $pluginClass = array_change_key_case($pluginClass, CASE_LOWER); if(isset($pluginClass['class'])) { if(isset($pluginClass['stackindex'])) { @@ -135,6 +135,22 @@ } break; + case 'dispatcher': + if(!isset($value['class'])) { + require_once 'Zend/Application/Exception.php'; + throw new Zend_Application_Exception('You must specify both '); + } + if (!isset($value['params'])) { + $value['params'] = array(); + } + + $dispatchClass = $value['class']; + if(!class_exists($dispatchClass)) { + require_once 'Zend/Application/Exception.php'; + throw new Zend_Application_Exception('Dispatcher class not found!'); + } + $front->setDispatcher(new $dispatchClass((array)$value['params'])); + break; default: $front->setParam($key, $value); break; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Layout.php --- a/web/lib/Zend/Application/Resource/Layout.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Layout.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Layout.php 20814 2010-02-01 20:13:08Z freak $ + * @version $Id: Layout.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Layout diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Locale.php --- a/web/lib/Zend/Application/Resource/Locale.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Locale.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Locale.php 20814 2010-02-01 20:13:08Z freak $ + * @version $Id: Locale.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Locale @@ -56,7 +56,6 @@ return $this->getLocale(); } - /** * Retrieve locale object * @@ -66,7 +65,8 @@ { if (null === $this->_locale) { $options = $this->getOptions(); - if(!isset($options['default'])) { + + if (!isset($options['default'])) { $this->_locale = new Zend_Locale(); } elseif(!isset($options['force']) || (bool) $options['force'] == false) @@ -86,4 +86,32 @@ return $this->_locale; } + + /** + * Set the cache + * + * @param string|Zend_Cache_Core $cache + * @return Zend_Application_Resource_Locale + */ + public function setCache($cache) + { + if (is_string($cache)) { + $bootstrap = $this->getBootstrap(); + if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper + && $bootstrap->hasPluginResource('CacheManager') + ) { + $cacheManager = $bootstrap->bootstrap('CacheManager') + ->getResource('CacheManager'); + if (null !== $cacheManager && $cacheManager->hasCache($cache)) { + $cache = $cacheManager->getCache($cache); + } + } + } + + if ($cache instanceof Zend_Cache_Core) { + Zend_Locale::setCache($cache); + } + + return $this; + } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Log.php --- a/web/lib/Zend/Application/Resource/Log.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Log.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Log.php 20814 2010-02-01 20:13:08Z freak $ + * @version $Id: Log.php 24607 2012-01-16 16:45:49Z xerkus $ */ /** @@ -27,13 +27,13 @@ /** - * Resource for initializing the locale + * Resource for initializing logger * * @uses Zend_Application_Resource_ResourceAbstract * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Log @@ -56,8 +56,8 @@ /** * Attach logger - * - * @param Zend_Log $log + * + * @param Zend_Log $log * @return Zend_Application_Resource_Log */ public function setLog(Zend_Log $log) @@ -66,6 +66,11 @@ return $this; } + /** + * Retrieve logger object + * + * @return Zend_Log + */ public function getLog() { if (null === $this->_log) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Mail.php --- a/web/lib/Zend/Application/Resource/Mail.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Mail.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Mail.php 21015 2010-02-11 01:56:02Z freak $ + * @version $Id: Mail.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceAbstract @@ -46,7 +46,7 @@ public function init() { return $this->getMail(); } - + /** * * @return Zend_Mail_Transport_Abstract|null @@ -56,7 +56,7 @@ if (null === $this->_transport) { $options = $this->getOptions(); foreach($options as $key => $option) { - $options[strtolower($key)] = $option; + $options[strtolower($key)] = $option; } $this->setOptions($options); @@ -73,14 +73,14 @@ Zend_Mail::setDefaultTransport($this->_transport); } } - + $this->_setDefaults('from'); $this->_setDefaults('replyTo'); } return $this->_transport; } - + protected function _setDefaults($type) { $key = strtolower('default' . $type); $options = $this->getOptions(); @@ -99,13 +99,13 @@ } } } - + protected function _setupTransport($options) { - if(!isset($options['type'])) { - $options['type'] = 'sendmail'; - } - + if(!isset($options['type'])) { + $options['type'] = 'sendmail'; + } + $transportName = $options['type']; if(!Zend_Loader_Autoloader::autoload($transportName)) { @@ -122,9 +122,10 @@ } } } - + unset($options['type']); - + unset($options['register']); //@see ZF-11022 + switch($transportName) { case 'Zend_Mail_Transport_Smtp': if(!isset($options['host'])) { @@ -132,7 +133,7 @@ 'A host is necessary for smtp transport,' .' but none was given'); } - + $transport = new $transportName($options['host'], $options); break; case 'Zend_Mail_Transport_Sendmail': diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Modules.php --- a/web/lib/Zend/Application/Resource/Modules.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Modules.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Modules.php 20814 2010-02-01 20:13:08Z freak $ + * @version $Id: Modules.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Modules extends Zend_Application_Resource_ResourceAbstract @@ -62,6 +62,7 @@ */ public function init() { + $bootstraps = array(); $bootstrap = $this->getBootstrap(); $bootstrap->bootstrap('FrontController'); $front = $bootstrap->getResource('FrontController'); @@ -103,12 +104,28 @@ continue; } + $bootstraps[$module] = $bootstrapClass; + } + + return $this->_bootstraps = $this->bootstrapBootstraps($bootstraps); + } + + /* + * Bootstraps the bootstraps found. Allows for easy extension. + * @param array $bootstraps Array containing the bootstraps to instantiate + */ + protected function bootstrapBootstraps($bootstraps) + { + $bootstrap = $this->getBootstrap(); + $out = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); + + foreach($bootstraps as $module => $bootstrapClass) { $moduleBootstrap = new $bootstrapClass($bootstrap); $moduleBootstrap->bootstrap(); - $this->_bootstraps[$module] = $moduleBootstrap; + $out[$module] = $moduleBootstrap; } - return $this->_bootstraps; + return $out; } /** diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Multidb.php --- a/web/lib/Zend/Application/Resource/Multidb.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Multidb.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Multidb.php 22546 2010-07-10 15:18:12Z freak $ + * @version $Id: Multidb.php 24593 2012-01-05 20:35:02Z matthew $ */ require_once 'Zend/Application/Resource/ResourceAbstract.php'; @@ -51,7 +51,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Multidb extends Zend_Application_Resource_ResourceAbstract @@ -85,7 +85,7 @@ } foreach ($options as $id => $params) { - $adapter = $params['adapter']; + $adapter = $params['adapter']; $default = (int) ( isset($params['isDefaultTableAdapter']) && $params['isDefaultTableAdapter'] || isset($params['default']) && $params['default'] @@ -178,7 +178,7 @@ /** * Set the default metadata cache - * + * * @param string|Zend_Cache_Core $cache * @return Zend_Application_Resource_Multidb */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Navigation.php --- a/web/lib/Zend/Application/Resource/Navigation.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Navigation.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Navigation.php 22882 2010-08-22 14:00:16Z freak $ + * @version $Id: Navigation.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @author Dolf Schimmel * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -56,12 +56,13 @@ { if (!$this->_container) { $options = $this->getOptions(); - $pages = isset($options['pages']) ? $options['pages'] : array(); - $this->_container = new Zend_Navigation($pages); - + if(isset($options['defaultPageType'])) { Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']); } + + $pages = isset($options['pages']) ? $options['pages'] : array(); + $this->_container = new Zend_Navigation($pages); } $this->store(); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Resource.php --- a/web/lib/Zend/Application/Resource/Resource.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Resource.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Resource.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Application_Resource_Resource diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/ResourceAbstract.php --- a/web/lib/Zend/Application/Resource/ResourceAbstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/ResourceAbstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ResourceAbstract.php 23384 2010-11-19 00:00:29Z ramon $ + * @version $Id: ResourceAbstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Application_Resource_ResourceAbstract implements Zend_Application_Resource_Resource diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Router.php --- a/web/lib/Zend/Application/Resource/Router.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Router.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Router.php 20814 2010-02-01 20:13:08Z freak $ + * @version $Id: Router.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Router diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Session.php --- a/web/lib/Zend/Application/Resource/Session.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Session.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Session.php 20814 2010-02-01 20:13:08Z freak $ + * @version $Id: Session.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Session extends Zend_Application_Resource_ResourceAbstract @@ -50,7 +50,7 @@ * * @param array|string|Zend_Session_SaveHandler_Interface $saveHandler * @return Zend_Application_Resource_Session - * @throws Zend_Application_Resource_Exception When $saveHandler is no valid save handler + * @throws Zend_Application_Resource_Exception When $saveHandler is not a valid save handler */ public function setSaveHandler($saveHandler) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Translate.php --- a/web/lib/Zend/Application/Resource/Translate.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Translate.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Translate.php 22968 2010-09-18 19:50:02Z intiilapa $ + * @version $Id: Translate.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_Translate extends Zend_Application_Resource_ResourceAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/Useragent.php --- a/web/lib/Zend/Application/Resource/Useragent.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/Useragent.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,72 +1,72 @@ -getUserAgent(); - - // Optionally seed the UserAgent view helper - $bootstrap = $this->getBootstrap(); - if ($bootstrap->hasResource('view') || $bootstrap->hasPluginResource('view')) { - $bootstrap->bootstrap('view'); - $view = $bootstrap->getResource('view'); - if (null !== $view) { - $view->userAgent($userAgent); - } - } - - return $userAgent; - } - - /** - * Get UserAgent instance - * - * @return Zend_Http_UserAgent - */ - public function getUserAgent() - { - if (null === $this->_userAgent) { - $options = $this->getOptions(); - $this->_userAgent = new Zend_Http_UserAgent($options); - } - - return $this->_userAgent; - } -} +getUserAgent(); + + // Optionally seed the UserAgent view helper + $bootstrap = $this->getBootstrap(); + if ($bootstrap->hasResource('view') || $bootstrap->hasPluginResource('view')) { + $bootstrap->bootstrap('view'); + $view = $bootstrap->getResource('view'); + if (null !== $view) { + $view->userAgent($userAgent); + } + } + + return $userAgent; + } + + /** + * Get UserAgent instance + * + * @return Zend_Http_UserAgent + */ + public function getUserAgent() + { + if (null === $this->_userAgent) { + $options = $this->getOptions(); + $this->_userAgent = new Zend_Http_UserAgent($options); + } + + return $this->_userAgent; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Application/Resource/View.php --- a/web/lib/Zend/Application/Resource/View.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Application/Resource/View.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: View.php 22965 2010-09-18 17:45:51Z intiilapa $ + * @version $Id: View.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Application * @subpackage Resource - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceAbstract @@ -52,9 +52,8 @@ { $view = $this->getView(); - $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); + $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer->setView($view); - Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); return $view; } @@ -78,6 +77,9 @@ if (isset($options['contentType'])) { $this->_view->headMeta()->appendHttpEquiv('Content-Type', $options['contentType']); } + if (isset($options['assign']) && is_array($options['assign'])) { + $this->_view->assign($options['assign']); + } } return $this->_view; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth.php --- a/web/lib/Zend/Auth.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,16 +14,16 @@ * * @category Zend * @package Zend_Auth - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Auth.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Auth.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Auth - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/DbTable.php --- a/web/lib/Zend/Auth/Adapter/DbTable.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/DbTable.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: DbTable.php 22613 2010-07-17 13:43:22Z dragonbe $ + * @version $Id: DbTable.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -41,7 +41,7 @@ * @category Zend * @package Zend_Auth * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface @@ -114,12 +114,12 @@ * @var array */ protected $_resultRow = null; - + /** - * $_ambiguityIdentity - Flag to indicate same Identity can be used with + * $_ambiguityIdentity - Flag to indicate same Identity can be used with * different credentials. Default is FALSE and need to be set to true to * allow ambiguity usage. - * + * * @var boolean */ protected $_ambiguityIdentity = false; @@ -159,7 +159,7 @@ /** * _setDbAdapter() - set the database adapter to be used for quering * - * @param Zend_Db_Adapter_Abstract + * @param Zend_Db_Adapter_Abstract * @throws Zend_Auth_Adapter_Exception * @return Zend_Auth_Adapter_DbTable */ @@ -178,7 +178,7 @@ throw new Zend_Auth_Adapter_Exception('No database adapter present'); } } - + return $this; } @@ -265,12 +265,12 @@ $this->_credential = $credential; return $this; } - + /** * setAmbiguityIdentity() - sets a flag for usage of identical identities * with unique credentials. It accepts integers (0, 1) or boolean (true, * false) parameters. Default is false. - * + * * @param int|bool $flag * @return Zend_Auth_Adapter_DbTable */ @@ -284,9 +284,9 @@ return $this; } /** - * getAmbiguityIdentity() - returns TRUE for usage of multiple identical + * getAmbiguityIdentity() - returns TRUE for usage of multiple identical * identies with different credentials, FALSE if not used. - * + * * @return bool */ public function getAmbiguityIdentity() @@ -367,7 +367,7 @@ $this->_authenticateSetup(); $dbSelect = $this->_authenticateCreateSelect(); $resultIdentities = $this->_authenticateQuerySelect($dbSelect); - + if ( ($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof Zend_Auth_Result) { return $authResult; } @@ -382,7 +382,7 @@ } $resultIdentities = $validIdentities; } - + $authResult = $this->_authenticateValidateResult(array_shift($resultIdentities)); return $authResult; } @@ -477,7 +477,7 @@ $origDbFetchMode = $this->_zendDb->getFetchMode(); $this->_zendDb->setFetchMode(Zend_DB::FETCH_ASSOC); } - $resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString()); + $resultIdentities = $this->_zendDb->fetchAll($dbSelect); if (isset($origDbFetchMode)) { $this->_zendDb->setFetchMode($origDbFetchMode); unset($origDbFetchMode); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/Digest.php --- a/web/lib/Zend/Auth/Adapter/Digest.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/Digest.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Digest.php 23088 2010-10-11 19:53:24Z padraic $ + * @version $Id: Digest.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Auth * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface @@ -227,7 +227,7 @@ $result['messages'][] = "Username '$this->_username' and realm '$this->_realm' combination not found"; return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']); } - + /** * Securely compare two strings for equality while avoided C level memcmp() * optimisations capable of leaking timing information useful to an attacker diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/Exception.php --- a/web/lib/Zend/Auth/Adapter/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Auth * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Adapter_Exception extends Zend_Auth_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/Http.php --- a/web/lib/Zend/Auth/Adapter/Http.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/Http.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter_Http - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Http.php 23088 2010-10-11 19:53:24Z padraic $ + * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -35,7 +35,7 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter_Http - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @todo Support auth-int * @todo Track nonces, nonce-count, opaque for replay protection and stale support @@ -844,7 +844,7 @@ return $data; } - + /** * Securely compare two strings for equality while avoided C level memcmp() * optimisations capable of leaking timing information useful to an attacker diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/Http/Resolver/Exception.php --- a/web/lib/Zend/Auth/Adapter/Http/Resolver/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/Http/Resolver/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter_Http - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter_Http - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Adapter_Http_Resolver_Exception extends Zend_Auth_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/Http/Resolver/File.php --- a/web/lib/Zend/Auth/Adapter/Http/Resolver/File.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/Http/Resolver/File.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter_Http - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter_Http - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Resolver_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/Http/Resolver/Interface.php --- a/web/lib/Zend/Auth/Adapter/Http/Resolver/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/Http/Resolver/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter_Http - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -30,7 +30,7 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter_Http - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Auth_Adapter_Http_Resolver_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/InfoCard.php --- a/web/lib/Zend/Auth/Adapter/InfoCard.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/InfoCard.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: InfoCard.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: InfoCard.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -42,7 +42,7 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Adapter_InfoCard implements Zend_Auth_Adapter_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/Interface.php --- a/web/lib/Zend/Auth/Adapter/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Auth_Adapter_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/Ldap.php --- a/web/lib/Zend/Auth/Adapter/Ldap.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/Ldap.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ldap.php 21319 2010-03-04 16:02:16Z sgehrig $ + * @version $Id: Ldap.php 24618 2012-02-03 08:32:06Z sgehrig $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface @@ -335,8 +335,8 @@ $messages[1] = ''; $messages[] = "$canonicalName authentication successful"; if ($requireRebind === true) { - // rebinding with authenticated user - $ldap->bind($dn, $password); + // rebinding with authenticated user + $ldap->bind($dn, $password); } return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $canonicalName, $messages); } else { @@ -371,7 +371,11 @@ } else { $line = $zle->getLine(); $messages[] = $zle->getFile() . "($line): " . $zle->getMessage(); - $messages[] = str_replace($password, '*****', $zle->getTraceAsString()); + $messages[] = preg_replace( + '/\b'.preg_quote(substr($password, 0, 15), '/').'\b/', + '*****', + $zle->getTraceAsString() + ); $messages[0] = 'An unexpected failure occurred'; } $messages[1] = $zle->getMessage(); @@ -488,7 +492,9 @@ $returnObject = new stdClass(); - $omitAttribs = array_map('strtolower', $omitAttribs); + $returnAttribs = array_map('strtolower', $returnAttribs); + $omitAttribs = array_map('strtolower', $omitAttribs); + $returnAttribs = array_diff($returnAttribs, $omitAttribs); $entry = $this->getLdap()->getEntry($this->_authenticatedDn, $returnAttribs, true); foreach ($entry as $attr => $value) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Adapter/OpenId.php --- a/web/lib/Zend/Auth/Adapter/OpenId.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Adapter/OpenId.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: OpenId.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: OpenId.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -40,7 +40,7 @@ * @category Zend * @package Zend_Auth * @subpackage Zend_Auth_Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Adapter_OpenId implements Zend_Auth_Adapter_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Exception.php --- a/web/lib/Zend/Auth/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Auth - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Auth - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Result.php --- a/web/lib/Zend/Auth/Result.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Result.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,16 +14,16 @@ * * @category Zend * @package Zend_Auth - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Result.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Result.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Auth - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Result diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Storage/Exception.php --- a/web/lib/Zend/Auth/Storage/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Storage/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Storage - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Auth * @subpackage Storage - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Storage_Exception extends Zend_Auth_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Storage/Interface.php --- a/web/lib/Zend/Auth/Storage/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Storage/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,16 +15,16 @@ * @category Zend * @package Zend_Auth * @subpackage Storage - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Auth * @subpackage Storage - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Auth_Storage_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Storage/NonPersistent.php --- a/web/lib/Zend/Auth/Storage/NonPersistent.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Storage/NonPersistent.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Storage - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: NonPersistent.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: NonPersistent.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -37,7 +37,7 @@ * @category Zend * @package Zend_Auth * @subpackage Storage - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Storage_NonPersistent implements Zend_Auth_Storage_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Auth/Storage/Session.php --- a/web/lib/Zend/Auth/Storage/Session.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Auth/Storage/Session.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Auth * @subpackage Storage - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Session.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Session.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -37,7 +37,7 @@ * @category Zend * @package Zend_Auth * @subpackage Storage - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Auth_Storage_Session implements Zend_Auth_Storage_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode.php --- a/web/lib/Zend/Barcode.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Barcode.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Barcode.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -24,7 +24,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode @@ -55,10 +55,10 @@ * @throws Zend_Barcode_Exception */ public static function factory( - $barcode, - $renderer = 'image', - $barcodeConfig = array(), - $rendererConfig = array(), + $barcode, + $renderer = 'image', + $barcodeConfig = array(), + $rendererConfig = array(), $automaticRenderError = true ) { /* @@ -313,9 +313,9 @@ * @param array | Zend_Config $rendererConfig */ public static function render( - $barcode, - $renderer, - $barcodeConfig = array(), + $barcode, + $renderer, + $barcodeConfig = array(), $rendererConfig = array() ) { self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->render(); @@ -331,9 +331,9 @@ * @return mixed */ public static function draw( - $barcode, - $renderer, - $barcodeConfig = array(), + $barcode, + $renderer, + $barcodeConfig = array(), $rendererConfig = array() ) { return self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->draw(); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Exception.php --- a/web/lib/Zend/Barcode/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 22999 2010-09-23 19:43:14Z mikaelkael $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * Zend_Exception @@ -28,7 +28,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Code128.php --- a/web/lib/Zend/Barcode/Object/Code128.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Code128.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Code25.php 20096 2010-01-06 02:05:09Z bkarwin $ */ @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract @@ -48,9 +48,9 @@ protected $_withChecksum = true; /** - * @var array - */ - protected $_convertedText = array(); + * @var array + */ + protected $_convertedText = array(); protected $_codingMap = array( 0 => "11011001100", 1 => "11001101100", 2 => "11001100110", @@ -192,7 +192,7 @@ $characterLength = 11 * $this->_barThinWidth * $this->_factor; $convertedChars = count($this->_convertToBarcodeChars($this->getText())); if ($this->_withChecksum) { - $convertedChars++; + $convertedChars++; } $encodedData = $convertedChars * $characterLength; // ...except the STOP character (13) @@ -220,7 +220,7 @@ $convertedChars = $this->_convertToBarcodeChars($this->getText()); if ($this->_withChecksum) { - $convertedChars[] = $this->getChecksum($this->getText()); + $convertedChars[] = $this->getChecksum($this->getText()); } // STOP CHARACTER @@ -229,7 +229,7 @@ foreach ($convertedChars as $barcodeChar) { $barcodePattern = $this->_codingMap[$barcodeChar]; foreach (str_split($barcodePattern) as $c) { - $barcodeTable[] = array($c, 1, 0, 1); + $barcodeTable[] = array($c, $this->_barThinWidth, 0, 1); } } return $barcodeTable; @@ -238,24 +238,24 @@ /** * Checks if the next $length chars of $string starting at $pos are numeric. * Returns false if the end of the string is reached. - * @param $string String to search - * @param $pos Starting position - * @param $length Length to search + * @param string $string String to search + * @param int $pos Starting position + * @param int $length Length to search * @return bool */ protected static function _isDigit($string, $pos, $length = 2) { - if ($pos + $length > strlen($string)) { - return false; - } + if ($pos + $length > strlen($string)) { + return false; + } - for ($i = $pos; $i < $pos + $length; $i++) { - if (!is_numeric($string[$i])) { - return false; - } - } - return true; - } + for ($i = $pos; $i < $pos + $length; $i++) { + if (!is_numeric($string[$i])) { + return false; + } + } + return true; + } /** * Convert string to barcode string @@ -263,14 +263,14 @@ */ protected function _convertToBarcodeChars($string) { - $string = (string) $string; - if (!strlen($string)) { - return array(); - } + $string = (string) $string; + if (!strlen($string)) { + return array(); + } - if (isset($this->_convertedText[md5($string)])) { - return $this->_convertedText[md5($string)]; - } + if (isset($this->_convertedText[md5($string)])) { + return $this->_convertedText[md5($string)]; + } $currentCharset = null; $sum = 0; @@ -363,17 +363,17 @@ */ public function getChecksum($text) { - $tableOfChars = $this->_convertToBarcodeChars($text); + $tableOfChars = $this->_convertToBarcodeChars($text); - $sum = $tableOfChars[0]; - unset($tableOfChars[0]); + $sum = $tableOfChars[0]; + unset($tableOfChars[0]); - $k = 1; - foreach ($tableOfChars as $char) { - $sum += ($k++) * $char; - } + $k = 1; + foreach ($tableOfChars as $char) { + $sum += ($k++) * $char; + } - $checksum = $sum % 103; + $checksum = $sum % 103; return $checksum; } @@ -385,7 +385,7 @@ */ protected function _validateText($value, $options = array()) { - // @TODO: add code128 validator - return true; + // @TODO: add code128 validator + return true; } -} \ No newline at end of file +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Code25.php --- a/web/lib/Zend/Barcode/Object/Code25.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Code25.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Code25.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Code25.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Code25 extends Zend_Barcode_Object_ObjectAbstract @@ -97,7 +97,7 @@ $barcodeTable[] = array(1 , $this->_barThickWidth , 0 , 1); $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(0 , 1); + $barcodeTable[] = array(0 , $this->_barThinWidth); $text = str_split($this->getText()); foreach ($text as $char) { @@ -106,7 +106,7 @@ /* visible, width, top, length */ $width = $c ? $this->_barThickWidth : $this->_barThinWidth; $barcodeTable[] = array(1 , $width , 0 , 1); - $barcodeTable[] = array(0 , 1); + $barcodeTable[] = array(0 , $this->_barThinWidth); } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Code25interleaved.php --- a/web/lib/Zend/Barcode/Object/Code25interleaved.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Code25interleaved.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Code25interleaved.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Code25interleaved.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Barcode_Object_Code25 */ @@ -31,7 +31,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Code25interleaved extends Zend_Barcode_Object_Code25 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Code39.php --- a/web/lib/Zend/Barcode/Object/Code39.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Code39.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Code39.php 23398 2010-11-19 17:17:05Z mikaelkael $ + * @version $Id: Code39.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Code39 extends Zend_Barcode_Object_ObjectAbstract @@ -163,7 +163,7 @@ $barcodeTable[] = array((int) $visible, $width, 0, 1); $visible = ! $visible; } - $barcodeTable[] = array(0 , 1); + $barcodeTable[] = array(0 , $this->_barThinWidth); } return $barcodeTable; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Ean13.php --- a/web/lib/Zend/Barcode/Object/Ean13.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Ean13.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ean13.php 22999 2010-09-23 19:43:14Z mikaelkael $ + * @version $Id: Ean13.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Ean13 extends Zend_Barcode_Object_ObjectAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Ean2.php --- a/web/lib/Zend/Barcode/Object/Ean2.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Ean2.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ean2.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Ean2.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Ean2 extends Zend_Barcode_Object_Ean5 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Ean5.php --- a/web/lib/Zend/Barcode/Object/Ean5.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Ean5.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ean5.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Ean5.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Ean5 extends Zend_Barcode_Object_Ean13 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Ean8.php --- a/web/lib/Zend/Barcode/Object/Ean8.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Ean8.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ean8.php 21667 2010-03-28 17:45:14Z mikaelkael $ + * @version $Id: Ean8.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Ean8 extends Zend_Barcode_Object_Ean13 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Error.php --- a/web/lib/Zend/Barcode/Object/Error.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Error.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Error.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Error.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Barcode_Object_ObjectAbstract */ @@ -28,7 +28,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Error extends Zend_Barcode_Object_ObjectAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Exception.php --- a/web/lib/Zend/Barcode/Object/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Barcode_Exception */ @@ -27,7 +27,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Exception extends Zend_Barcode_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Identcode.php --- a/web/lib/Zend/Barcode/Object/Identcode.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Identcode.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Identcode.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Identcode.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Identcode extends Zend_Barcode_Object_Code25interleaved diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Itf14.php --- a/web/lib/Zend/Barcode/Object/Itf14.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Itf14.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Itf14.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Itf14.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Barcode_Object_Code25interleaved */ @@ -31,7 +31,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Itf14 extends Zend_Barcode_Object_Code25interleaved diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Leitcode.php --- a/web/lib/Zend/Barcode/Object/Leitcode.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Leitcode.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Leitcode.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Leitcode.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Leitcode extends Zend_Barcode_Object_Identcode diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/ObjectAbstract.php --- a/web/lib/Zend/Barcode/Object/ObjectAbstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/ObjectAbstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ObjectAbstract.php 23400 2010-11-19 17:18:31Z mikaelkael $ + * @version $Id: ObjectAbstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -25,7 +25,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Barcode_Object_ObjectAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Planet.php --- a/web/lib/Zend/Barcode/Object/Planet.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Planet.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Planet.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Planet.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Planet extends Zend_Barcode_Object_Postnet diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Postnet.php --- a/web/lib/Zend/Barcode/Object/Postnet.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Postnet.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Postnet.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Postnet.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Postnet extends Zend_Barcode_Object_ObjectAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Royalmail.php --- a/web/lib/Zend/Barcode/Object/Royalmail.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Royalmail.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Royalmail.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Royalmail.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Royalmail extends Zend_Barcode_Object_ObjectAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Upca.php --- a/web/lib/Zend/Barcode/Object/Upca.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Upca.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Upca.php 21667 2010-03-28 17:45:14Z mikaelkael $ + * @version $Id: Upca.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Upca extends Zend_Barcode_Object_Ean13 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Object/Upce.php --- a/web/lib/Zend/Barcode/Object/Upce.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Object/Upce.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Object - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Upce.php 21667 2010-03-28 17:45:14Z mikaelkael $ + * @version $Id: Upce.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -35,7 +35,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Object_Upce extends Zend_Barcode_Object_Ean13 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Renderer/Exception.php --- a/web/lib/Zend/Barcode/Renderer/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Renderer/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Barcode_Exception */ @@ -27,7 +27,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Renderer_Exception extends Zend_Barcode_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Renderer/Image.php --- a/web/lib/Zend/Barcode/Renderer/Image.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Renderer/Image.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Renderer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Image.php 22999 2010-09-23 19:43:14Z mikaelkael $ + * @version $Id: Image.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Barcode_Renderer_RendererAbstract*/ @@ -28,7 +28,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Renderer_Image extends Zend_Barcode_Renderer_RendererAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Renderer/Pdf.php --- a/web/lib/Zend/Barcode/Renderer/Pdf.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Renderer/Pdf.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Renderer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Pdf.php 22418 2010-06-11 16:27:22Z mikaelkael $ + * @version $Id: Pdf.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Barcode_Renderer_RendererAbstract */ @@ -37,7 +37,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Renderer_Pdf extends Zend_Barcode_Renderer_RendererAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Renderer/RendererAbstract.php --- a/web/lib/Zend/Barcode/Renderer/RendererAbstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Renderer/RendererAbstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Barcode * @subpackage Renderer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: RendererAbstract.php 22999 2010-09-23 19:43:14Z mikaelkael $ + * @version $Id: RendererAbstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -25,7 +25,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Barcode_Renderer_RendererAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Barcode/Renderer/Svg.php --- a/web/lib/Zend/Barcode/Renderer/Svg.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Barcode/Renderer/Svg.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Barcode * @subpackage Renderer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Image.php 20366 2010-01-18 03:56:52Z ralph $ */ @@ -28,7 +28,7 @@ * * @category Zend * @package Zend_Barcode - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Barcode_Renderer_Svg extends Zend_Barcode_Renderer_RendererAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache.php --- a/web/lib/Zend/Cache.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,15 +14,15 @@ * * @category Zend * @package Zend_Cache - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Cache.php 23154 2010-10-18 17:41:06Z mabe $ + * @version $Id: Cache.php 24656 2012-02-26 06:02:53Z adamlundrigan $ */ /** * @package Zend_Cache - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Cache @@ -41,14 +41,14 @@ * @var array */ public static $standardBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform', - 'Xcache', 'TwoLevels', 'ZendServer_Disk', 'ZendServer_ShMem'); + 'Xcache', 'TwoLevels', 'WinCache', 'ZendServer_Disk', 'ZendServer_ShMem'); /** * Standard backends which implement the ExtendedInterface * * @var array */ - public static $standardExtendedBackends = array('File', 'Apc', 'TwoLevels', 'Memcached', 'Libmemcached', 'Sqlite'); + public static $standardExtendedBackends = array('File', 'Apc', 'TwoLevels', 'Memcached', 'Libmemcached', 'Sqlite', 'WinCache'); /** * Only for backward compatibility (may be removed in next major release) @@ -64,7 +64,7 @@ * @var array * @deprecated */ - public static $availableBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform', 'Xcache', 'TwoLevels'); + public static $availableBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform', 'Xcache', 'WinCache', 'TwoLevels'); /** * Consts for clean() method @@ -133,7 +133,7 @@ require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php'; } else { // we use a custom backend - if (!preg_match('~^[\w]+$~D', $backend)) { + if (!preg_match('~^[\w\\\\]+$~D', $backend)) { Zend_Cache::throwException("Invalid backend name [$backend]"); } if (!$customBackendNaming) { @@ -175,7 +175,7 @@ require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php'; } else { // we use a custom frontend - if (!preg_match('~^[\w]+$~D', $frontend)) { + if (!preg_match('~^[\w\\\\]+$~D', $frontend)) { Zend_Cache::throwException("Invalid frontend name [$frontend]"); } if (!$customFrontendNaming) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend.php --- a/web/lib/Zend/Cache/Backend.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,16 +15,16 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Backend.php 20880 2010-02-03 18:18:32Z matthew $ + * @version $Id: Backend.php 24989 2012-06-21 07:24:13Z mabe $ */ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend @@ -112,6 +112,28 @@ } /** + * Returns an option + * + * @param string $name Optional, the options name to return + * @throws Zend_Cache_Exceptions + * @return mixed + */ + public function getOption($name) + { + $name = strtolower($name); + + if (array_key_exists($name, $this->_options)) { + return $this->_options[$name]; + } + + if (array_key_exists($name, $this->_directives)) { + return $this->_directives[$name]; + } + + Zend_Cache::throwException("Incorrect option name : {$name}"); + } + + /** * Get the life time * * if $specificLifetime is not false, the given specific life time is used @@ -154,7 +176,7 @@ $tmpdir = array(); foreach (array($_ENV, $_SERVER) as $tab) { foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) { - if (isset($tab[$key])) { + if (isset($tab[$key]) && is_string($tab[$key])) { if (($key == 'windir') or ($key == 'SystemRoot')) { $dir = realpath($tab[$key] . '\\temp'); } else { @@ -200,7 +222,7 @@ /** * Verify if the given temporary directory is readable and writable * - * @param $dir temporary directory + * @param string $dir temporary directory * @return boolean true if the directory is ok */ protected function _isGoodTmpDir($dir) @@ -237,7 +259,9 @@ // Create a default logger to the standard output stream require_once 'Zend/Log.php'; require_once 'Zend/Log/Writer/Stream.php'; + require_once 'Zend/Log/Filter/Priority.php'; $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output')); + $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<=')); $this->_directives['logger'] = $logger; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/Apc.php --- a/web/lib/Zend/Cache/Backend/Apc.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/Apc.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Apc.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Apc.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -35,7 +35,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/BlackHole.php --- a/web/lib/Zend/Cache/Backend/BlackHole.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/BlackHole.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: BlackHole.php 20785 2010-01-31 09:43:03Z mikaelkael $ + * @version $Id: BlackHole.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,11 +33,11 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Cache_Backend_BlackHole - extends Zend_Cache_Backend +class Zend_Cache_Backend_BlackHole + extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface { /** diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/ExtendedInterface.php --- a/web/lib/Zend/Cache/Backend/ExtendedInterface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/ExtendedInterface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ExtendedInterface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ExtendedInterface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/File.php --- a/web/lib/Zend/Cache/Backend/File.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/File.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: File.php 21636 2010-03-24 17:10:23Z mabe $ + * @version $Id: File.php 24844 2012-05-31 19:01:36Z rob $ */ /** @@ -34,7 +34,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface @@ -71,7 +71,11 @@ * for you. Maybe, 1 or 2 is a good start. * * =====> (int) hashed_directory_umask : - * - Umask for hashed directory structure + * - deprecated + * - Permissions for hashed directory structure + * + * =====> (int) hashed_directory_perm : + * - Permissions for hashed directory structure * * =====> (string) file_name_prefix : * - prefix for cache files @@ -79,7 +83,11 @@ * (like /tmp) can cause disasters when cleaning the cache * * =====> (int) cache_file_umask : - * - Umask for cache files + * - deprecated + * - Permissions for cache files + * + * =====> (int) cache_file_perm : + * - Permissions for cache files * * =====> (int) metatadatas_array_max_size : * - max size for the metadatas array (don't change this value unless you @@ -93,9 +101,9 @@ 'read_control' => true, 'read_control_type' => 'crc32', 'hashed_directory_level' => 0, - 'hashed_directory_umask' => 0700, + 'hashed_directory_perm' => 0700, 'file_name_prefix' => 'zend_cache', - 'cache_file_umask' => 0600, + 'cache_file_perm' => 0600, 'metadatas_array_max_size' => 100 ); @@ -130,13 +138,29 @@ if ($this->_options['metadatas_array_max_size'] < 10) { Zend_Cache::throwException('Invalid metadatas_array_max_size, must be > 10'); } - if (isset($options['hashed_directory_umask']) && is_string($options['hashed_directory_umask'])) { + + if (isset($options['hashed_directory_umask'])) { + // See #ZF-12047 + trigger_error("'hashed_directory_umask' is deprecated -> please use 'hashed_directory_perm' instead", E_USER_NOTICE); + if (!isset($options['hashed_directory_perm'])) { + $options['hashed_directory_perm'] = $options['hashed_directory_umask']; + } + } + if (isset($options['hashed_directory_perm']) && is_string($options['hashed_directory_perm'])) { // See #ZF-4422 - $this->_options['hashed_directory_umask'] = octdec($this->_options['hashed_directory_umask']); + $this->_options['hashed_directory_perm'] = octdec($this->_options['hashed_directory_perm']); } - if (isset($options['cache_file_umask']) && is_string($options['cache_file_umask'])) { + + if (isset($options['cache_file_umask'])) { + // See #ZF-12047 + trigger_error("'cache_file_umask' is deprecated -> please use 'cache_file_perm' instead", E_USER_NOTICE); + if (!isset($options['cache_file_perm'])) { + $options['cache_file_perm'] = $options['cache_file_umask']; + } + } + if (isset($options['cache_file_perm']) && is_string($options['cache_file_perm'])) { // See #ZF-4422 - $this->_options['cache_file_umask'] = octdec($this->_options['cache_file_umask']); + $this->_options['cache_file_perm'] = octdec($this->_options['cache_file_perm']); } } @@ -151,10 +175,10 @@ public function setCacheDir($value, $trailingSeparator = true) { if (!is_dir($value)) { - Zend_Cache::throwException('cache_dir must be a directory'); + Zend_Cache::throwException(sprintf('cache_dir "%s" must be a directory', $value)); } if (!is_writable($value)) { - Zend_Cache::throwException('cache_dir is not writable'); + Zend_Cache::throwException(sprintf('cache_dir "%s" is not writable', $value)); } if ($trailingSeparator) { // add a trailing DIRECTORY_SEPARATOR if necessary @@ -268,14 +292,15 @@ * Clean some cache records * * Available modes are : - * 'all' (default) => remove all cache entries ($tags is not used) - * 'old' => remove too old cache entries ($tags is not used) - * 'matchingTag' => remove cache entries matching all given tags - * ($tags can be an array of strings or a single string) - * 'notMatchingTag' => remove cache entries not matching one of the given tags - * ($tags can be an array of strings or a single string) - * 'matchingAnyTag' => remove cache entries matching any given tags - * ($tags can be an array of strings or a single string) + * + * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) + * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) + * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags + * ($tags can be an array of strings or a single string) + * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} + * ($tags can be an array of strings or a single string) + * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags + * ($tags can be an array of strings or a single string) * * @param string $mode clean mode * @param tags array $tags array of tags @@ -722,8 +747,8 @@ if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) { // Recursive call $result = $this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags) && $result; - if ($mode=='all') { - // if mode=='all', we try to drop the structure too + if ($mode == Zend_Cache::CLEANING_MODE_ALL) { + // we try to drop the structure too @rmdir($file); } } @@ -918,8 +943,8 @@ $partsArray = $this->_path($id, true); foreach ($partsArray as $part) { if (!is_dir($part)) { - @mkdir($part, $this->_options['hashed_directory_umask']); - @chmod($part, $this->_options['hashed_directory_umask']); // see #ZF-320 (this line is required in some configurations) + @mkdir($part, $this->_options['hashed_directory_perm']); + @chmod($part, $this->_options['hashed_directory_perm']); // see #ZF-320 (this line is required in some configurations) } } return true; @@ -987,7 +1012,7 @@ } @fclose($f); } - @chmod($file, $this->_options['cache_file_umask']); + @chmod($file, $this->_options['cache_file_perm']); return $result; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/Interface.php --- a/web/lib/Zend/Cache/Backend/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,16 +15,16 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Cache_Backend_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/Libmemcached.php --- a/web/lib/Zend/Cache/Backend/Libmemcached.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/Libmemcached.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Libmemcached.php 23220 2010-10-22 10:24:14Z mabe $ + * @version $Id: Libmemcached.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -35,7 +35,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_Libmemcached extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/Memcached.php --- a/web/lib/Zend/Cache/Backend/Memcached.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/Memcached.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Memcached.php 22207 2010-05-20 16:47:16Z mabe $ + * @version $Id: Memcached.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -35,7 +35,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/Sqlite.php --- a/web/lib/Zend/Cache/Backend/Sqlite.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/Sqlite.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Sqlite.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Sqlite.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -34,7 +34,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface @@ -530,7 +530,6 @@ $rand = rand(1, $this->_options['automatic_vacuum_factor']); if ($rand == 1) { $this->_query('VACUUM'); - @sqlite_close($this->_getConnection()); } } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/Static.php --- a/web/lib/Zend/Cache/Backend/Static.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/Static.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Static.php 22950 2010-09-16 19:33:00Z mabe $ + * @version $Id: Static.php 24989 2012-06-21 07:24:13Z mabe $ */ /** @@ -33,7 +33,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_Static @@ -99,17 +99,13 @@ */ public function getOption($name) { + $name = strtolower($name); + if ($name == 'tag_cache') { return $this->getInnerCache(); - } else { - if (in_array($name, $this->_options)) { - return $this->_options[$name]; - } - if ($name == 'lifetime') { - return parent::getLifetime(); - } - return null; } + + return parent::getOption($name); } /** @@ -123,7 +119,7 @@ */ public function load($id, $doNotTestCacheValidity = false) { - if (empty($id)) { + if (($id = (string)$id) === '') { $id = $this->_detectId(); } else { $id = $this->_decodeId($id); @@ -136,7 +132,7 @@ } $fileName = basename($id); - if (empty($fileName)) { + if ($fileName === '') { $fileName = $this->_options['index_filename']; } $pathName = $this->_options['public_dir'] . dirname($id); @@ -163,7 +159,7 @@ } $fileName = basename($id); - if (empty($fileName)) { + if ($fileName === '') { $fileName = $this->_options['index_filename']; } if ($this->_tagged === null && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) { @@ -211,14 +207,14 @@ } clearstatcache(); - if ($id === null || strlen($id) == 0) { + if (($id = (string)$id) === '') { $id = $this->_detectId(); } else { $id = $this->_decodeId($id); } $fileName = basename($id); - if (empty($fileName)) { + if ($fileName === '') { $fileName = $this->_options['index_filename']; } @@ -308,7 +304,7 @@ } else { $extension = $this->_options['file_extension']; } - if (empty($fileName)) { + if ($fileName === '') { $fileName = $this->_options['index_filename']; } $pathName = $this->_options['public_dir'] . dirname($id); @@ -333,7 +329,7 @@ Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path'); } $fileName = basename($id); - if (empty($fileName)) { + if ($fileName === '') { $fileName = $this->_options['index_filename']; } $pathName = $this->_options['public_dir'] . dirname($id); @@ -343,14 +339,16 @@ if (!is_writable($directory)) { return false; } - foreach (new DirectoryIterator($directory) as $file) { - if (true === $file->isFile()) { - if (false === unlink($file->getPathName())) { - return false; + if (is_dir($directory)) { + foreach (new DirectoryIterator($directory) as $file) { + if (true === $file->isFile()) { + if (false === unlink($file->getPathName())) { + return false; + } } } } - rmdir(dirname($path)); + rmdir($directory); } if (file_exists($file)) { if (!is_writable($file)) { @@ -538,7 +536,7 @@ * Detect an octal string and return its octal value for file permission ops * otherwise return the non-string (assumed octal or decimal int already) * - * @param $val The potential octal in need of conversion + * @param string $val The potential octal in need of conversion * @return int */ protected function _octdec($val) @@ -551,9 +549,12 @@ /** * Decode a request URI from the provided ID + * + * @param string $id + * @return string */ protected function _decodeId($id) { - return pack('H*', $id);; + return pack('H*', $id); } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/Test.php --- a/web/lib/Zend/Cache/Backend/Test.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/Test.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Test.php 23051 2010-10-07 17:01:21Z mabe $ + * @version $Id: Test.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -34,7 +34,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface @@ -164,7 +164,7 @@ public function save($data, $id, $tags = array(), $specificLifetime = false) { $this->_addLog('save', array($data, $id, $tags)); - if ($id=='false') { + if (substr($id,-5)=='false') { return false; } return true; @@ -182,7 +182,7 @@ public function remove($id) { $this->_addLog('remove', array($id)); - if ($id=='false') { + if (substr($id,-5)=='false') { return false; } return true; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/TwoLevels.php --- a/web/lib/Zend/Cache/Backend/TwoLevels.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/TwoLevels.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: TwoLevels.php 22736 2010-07-30 16:25:54Z andyfowler $ + * @version $Id: TwoLevels.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -35,7 +35,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -383,7 +383,6 @@ return $this->_slowBackend->getIdsMatchingAnyTags($tags); } - /** * Return the filling percentage of the backend storage * @@ -481,18 +480,19 @@ */ private function _getFastLifetime($lifetime, $priority, $maxLifetime = null) { - if ($lifetime === null) { - // if lifetime is null, we have an infinite lifetime + if ($lifetime <= 0) { + // if no lifetime, we have an infinite lifetime // we need to use arbitrary lifetimes $fastLifetime = (int) (2592000 / (11 - $priority)); } else { - $fastLifetime = (int) ($lifetime / (11 - $priority)); + // prevent computed infinite lifetime (0) by ceil + $fastLifetime = (int) ceil($lifetime / (11 - $priority)); } - if (($maxLifetime !== null) && ($maxLifetime >= 0)) { - if ($fastLifetime > $maxLifetime) { - return $maxLifetime; - } + + if ($maxLifetime >= 0 && $fastLifetime > $maxLifetime) { + return $maxLifetime; } + return $fastLifetime; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/WinCache.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cache/Backend/WinCache.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,349 @@ + infinite lifetime) + * @return boolean true if no problem + */ + public function save($data, $id, $tags = array(), $specificLifetime = false) + { + $lifetime = $this->getLifetime($specificLifetime); + $result = wincache_ucache_set($id, array($data, time(), $lifetime), $lifetime); + if (count($tags) > 0) { + $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND); + } + return $result; + } + + /** + * Remove a cache record + * + * @param string $id cache id + * @return boolean true if no problem + */ + public function remove($id) + { + return wincache_ucache_delete($id); + } + + /** + * Clean some cache records + * + * Available modes are : + * 'all' (default) => remove all cache entries ($tags is not used) + * 'old' => unsupported + * 'matchingTag' => unsupported + * 'notMatchingTag' => unsupported + * 'matchingAnyTag' => unsupported + * + * @param string $mode clean mode + * @param array $tags array of tags + * @throws Zend_Cache_Exception + * @return boolean true if no problem + */ + public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array()) + { + switch ($mode) { + case Zend_Cache::CLEANING_MODE_ALL: + return wincache_ucache_clear(); + break; + case Zend_Cache::CLEANING_MODE_OLD: + $this->_log("Zend_Cache_Backend_WinCache::clean() : CLEANING_MODE_OLD is unsupported by the WinCache backend"); + break; + case Zend_Cache::CLEANING_MODE_MATCHING_TAG: + case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG: + case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG: + $this->_log(self::TAGS_UNSUPPORTED_BY_CLEAN_OF_WINCACHE_BACKEND); + break; + default: + Zend_Cache::throwException('Invalid mode for clean() method'); + break; + } + } + + /** + * Return true if the automatic cleaning is available for the backend + * + * DEPRECATED : use getCapabilities() instead + * + * @deprecated + * @return boolean + */ + public function isAutomaticCleaningAvailable() + { + return false; + } + + /** + * Return the filling percentage of the backend storage + * + * @throws Zend_Cache_Exception + * @return int integer between 0 and 100 + */ + public function getFillingPercentage() + { + $mem = wincache_ucache_meminfo(); + $memSize = $mem['memory_total']; + $memUsed = $memSize - $mem['memory_free']; + if ($memSize == 0) { + Zend_Cache::throwException('can\'t get WinCache memory size'); + } + if ($memUsed > $memSize) { + return 100; + } + return ((int) (100. * ($memUsed / $memSize))); + } + + /** + * Return an array of stored tags + * + * @return array array of stored tags (string) + */ + public function getTags() + { + $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND); + return array(); + } + + /** + * Return an array of stored cache ids which match given tags + * + * In case of multiple tags, a logical AND is made between tags + * + * @param array $tags array of tags + * @return array array of matching cache ids (string) + */ + public function getIdsMatchingTags($tags = array()) + { + $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND); + return array(); + } + + /** + * Return an array of stored cache ids which don't match given tags + * + * In case of multiple tags, a logical OR is made between tags + * + * @param array $tags array of tags + * @return array array of not matching cache ids (string) + */ + public function getIdsNotMatchingTags($tags = array()) + { + $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND); + return array(); + } + + /** + * Return an array of stored cache ids which match any given tags + * + * In case of multiple tags, a logical AND is made between tags + * + * @param array $tags array of tags + * @return array array of any matching cache ids (string) + */ + public function getIdsMatchingAnyTags($tags = array()) + { + $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND); + return array(); + } + + /** + * Return an array of stored cache ids + * + * @return array array of stored cache ids (string) + */ + public function getIds() + { + $res = array(); + $array = wincache_ucache_info(); + $records = $array['ucache_entries']; + foreach ($records as $record) { + $res[] = $record['key_name']; + } + return $res; + } + + /** + * Return an array of metadatas for the given cache id + * + * The array must include these keys : + * - expire : the expire timestamp + * - tags : a string array of tags + * - mtime : timestamp of last modification time + * + * @param string $id cache id + * @return array array of metadatas (false if the cache id is not found) + */ + public function getMetadatas($id) + { + $tmp = wincache_ucache_get($id); + if (is_array($tmp)) { + $data = $tmp[0]; + $mtime = $tmp[1]; + if (!isset($tmp[2])) { + return false; + } + $lifetime = $tmp[2]; + return array( + 'expire' => $mtime + $lifetime, + 'tags' => array(), + 'mtime' => $mtime + ); + } + return false; + } + + /** + * Give (if possible) an extra lifetime to the given cache id + * + * @param string $id cache id + * @param int $extraLifetime + * @return boolean true if ok + */ + public function touch($id, $extraLifetime) + { + $tmp = wincache_ucache_get($id); + if (is_array($tmp)) { + $data = $tmp[0]; + $mtime = $tmp[1]; + if (!isset($tmp[2])) { + return false; + } + $lifetime = $tmp[2]; + $newLifetime = $lifetime - (time() - $mtime) + $extraLifetime; + if ($newLifetime <=0) { + return false; + } + return wincache_ucache_set($id, array($data, time(), $newLifetime), $newLifetime); + } + return false; + } + + /** + * Return an associative array of capabilities (booleans) of the backend + * + * The array must include these keys : + * - automatic_cleaning (is automating cleaning necessary) + * - tags (are tags supported) + * - expired_read (is it possible to read expired cache records + * (for doNotTestCacheValidity option for example)) + * - priority does the backend deal with priority when saving + * - infinite_lifetime (is infinite lifetime can work with this backend) + * - get_list (is it possible to get the list of cache ids and the complete list of tags) + * + * @return array associative of with capabilities + */ + public function getCapabilities() + { + return array( + 'automatic_cleaning' => false, + 'tags' => false, + 'expired_read' => false, + 'priority' => false, + 'infinite_lifetime' => false, + 'get_list' => true + ); + } + +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/Xcache.php --- a/web/lib/Zend/Cache/Backend/Xcache.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/Xcache.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Xcache.php 23345 2010-11-15 16:31:14Z mabe $ + * @version $Id: Xcache.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -35,7 +35,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_Xcache extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/ZendPlatform.php --- a/web/lib/Zend/Cache/Backend/ZendPlatform.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/ZendPlatform.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ZendPlatform.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ZendPlatform.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -36,7 +36,7 @@ * * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_ZendPlatform extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/ZendServer.php --- a/web/lib/Zend/Cache/Backend/ZendServer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/ZendServer.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ZendServer.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ZendServer.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Cache_Backend_ZendServer extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/ZendServer/Disk.php --- a/web/lib/Zend/Cache/Backend/ZendServer/Disk.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/ZendServer/Disk.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Disk.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Disk.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Backend/ZendServer/ShMem.php --- a/web/lib/Zend/Cache/Backend/ZendServer/ShMem.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Backend/ZendServer/ShMem.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ShMem.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ShMem.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Backend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Backend_ZendServer_ShMem extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Core.php --- a/web/lib/Zend/Cache/Core.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Core.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,15 +14,15 @@ * * @category Zend * @package Zend_Cache - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Core.php 22651 2010-07-21 04:19:44Z ramon $ + * @version $Id: Core.php 24989 2012-06-21 07:24:13Z mabe $ */ /** * @package Zend_Cache - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Core @@ -211,7 +211,7 @@ public function setOption($name, $value) { if (!is_string($name)) { - Zend_Cache::throwException("Incorrect option name : $name"); + Zend_Cache::throwException("Incorrect option name!"); } $name = strtolower($name); if (array_key_exists($name, $this->_options)) { @@ -235,17 +235,18 @@ */ public function getOption($name) { - if (is_string($name)) { - $name = strtolower($name); - if (array_key_exists($name, $this->_options)) { - // This is a Core option - return $this->_options[$name]; - } - if (array_key_exists($name, $this->_specificOptions)) { - // This a specic option of this frontend - return $this->_specificOptions[$name]; - } + $name = strtolower($name); + + if (array_key_exists($name, $this->_options)) { + // This is a Core option + return $this->_options[$name]; } + + if (array_key_exists($name, $this->_specificOptions)) { + // This a specic option of this frontend + return $this->_specificOptions[$name]; + } + Zend_Cache::throwException("Incorrect option name : $name"); } @@ -300,6 +301,8 @@ $id = $this->_id($id); // cache id may need prefix $this->_lastId = $id; self::_validateIdOrTag($id); + + $this->_log("Zend_Cache_Core: load item '{$id}'", 7); $data = $this->_backend->load($id, $doNotTestCacheValidity); if ($data===false) { // no cache available @@ -326,6 +329,8 @@ $id = $this->_id($id); // cache id may need prefix self::_validateIdOrTag($id); $this->_lastId = $id; + + $this->_log("Zend_Cache_Core: test item '{$id}'", 7); return $this->_backend->test($id); } @@ -360,27 +365,22 @@ Zend_Cache::throwException("Datas must be string or set automatic_serialization = true"); } } + // automatic cleaning if ($this->_options['automatic_cleaning_factor'] > 0) { $rand = rand(1, $this->_options['automatic_cleaning_factor']); if ($rand==1) { - if ($this->_extendedBackend) { - // New way - if ($this->_backendCapabilities['automatic_cleaning']) { - $this->clean(Zend_Cache::CLEANING_MODE_OLD); - } else { - $this->_log('Zend_Cache_Core::save() / automatic cleaning is not available/necessary with this backend'); - } + // new way || deprecated way + if ($this->_extendedBackend || method_exists($this->_backend, 'isAutomaticCleaningAvailable')) { + $this->_log("Zend_Cache_Core::save(): automatic cleaning running", 7); + $this->clean(Zend_Cache::CLEANING_MODE_OLD); } else { - // Deprecated way (will be removed in next major version) - if (method_exists($this->_backend, 'isAutomaticCleaningAvailable') && ($this->_backend->isAutomaticCleaningAvailable())) { - $this->clean(Zend_Cache::CLEANING_MODE_OLD); - } else { - $this->_log('Zend_Cache_Core::save() / automatic cleaning is not available/necessary with this backend'); - } + $this->_log("Zend_Cache_Core::save(): automatic cleaning is not available/necessary with current backend", 4); } } } + + $this->_log("Zend_Cache_Core: save item '{$id}'", 7); if ($this->_options['ignore_user_abort']) { $abort = ignore_user_abort(true); } @@ -392,22 +392,23 @@ if ($this->_options['ignore_user_abort']) { ignore_user_abort($abort); } + if (!$result) { // maybe the cache is corrupted, so we remove it ! - if ($this->_options['logging']) { - $this->_log("Zend_Cache_Core::save() : impossible to save cache (id=$id)"); - } - $this->remove($id); + $this->_log("Zend_Cache_Core::save(): failed to save item '{$id}' -> removing it", 4); + $this->_backend->remove($id); return false; } + if ($this->_options['write_control']) { $data2 = $this->_backend->load($id, true); if ($data!=$data2) { - $this->_log('Zend_Cache_Core::save() / write_control : written and read data do not match'); + $this->_log("Zend_Cache_Core::save(): write control of item '{$id}' failed -> removing it", 4); $this->_backend->remove($id); return false; } } + return true; } @@ -424,6 +425,8 @@ } $id = $this->_id($id); // cache id may need prefix self::_validateIdOrTag($id); + + $this->_log("Zend_Cache_Core: remove item '{$id}'", 7); return $this->_backend->remove($id); } @@ -458,6 +461,7 @@ Zend_Cache::throwException('Invalid cleaning mode'); } self::_validateTagsArray($tags); + return $this->_backend->clean($mode, $tags); } @@ -649,6 +653,8 @@ Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); } $id = $this->_id($id); // cache id may need prefix + + $this->_log("Zend_Cache_Core: touch item '{$id}'", 7); return $this->_backend->touch($id, $extraLifetime); } @@ -713,9 +719,11 @@ } // Create a default logger to the standard output stream + require_once 'Zend/Log.php'; require_once 'Zend/Log/Writer/Stream.php'; - require_once 'Zend/Log.php'; + require_once 'Zend/Log/Filter/Priority.php'; $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output')); + $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<=')); $this->_options['logger'] = $logger; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Exception.php --- a/web/lib/Zend/Cache/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Cache - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ /** * @package Zend_Cache - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Exception extends Zend_Exception {} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Frontend/Capture.php --- a/web/lib/Zend/Cache/Frontend/Capture.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Frontend/Capture.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Capture.php 22662 2010-07-24 17:37:36Z mabe $ + * @version $Id: Capture.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -30,7 +30,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Frontend_Capture extends Zend_Cache_Core @@ -46,7 +46,7 @@ * @var array */ protected $_tags = array(); - + protected $_extension = null; /** diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Frontend/Class.php --- a/web/lib/Zend/Cache/Frontend/Class.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Frontend/Class.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Class.php 23051 2010-10-07 17:01:21Z mabe $ + * @version $Id: Class.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Frontend_Class extends Zend_Cache_Core @@ -200,13 +200,19 @@ */ public function __call($name, $parameters) { + $callback = array($this->_cachedEntity, $name); + + if (!is_callable($callback, false)) { + Zend_Cache::throwException('Invalid callback'); + } + $cacheBool1 = $this->_specificOptions['cache_by_default']; $cacheBool2 = in_array($name, $this->_specificOptions['cached_methods']); $cacheBool3 = in_array($name, $this->_specificOptions['non_cached_methods']); $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3)); if (!$cache) { // We do not have not cache - return call_user_func_array(array($this->_cachedEntity, $name), $parameters); + return call_user_func_array($callback, $parameters); } $id = $this->_makeId($name, $parameters); @@ -220,7 +226,7 @@ ob_implicit_flush(false); try { - $return = call_user_func_array(array($this->_cachedEntity, $name), $parameters); + $return = call_user_func_array($callback, $parameters); $output = ob_get_clean(); $data = array($output, $return); $this->save($data, $id, $this->_tags, $this->_specificLifetime, $this->_priority); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Frontend/File.php --- a/web/lib/Zend/Cache/Frontend/File.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Frontend/File.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: File.php 23330 2010-11-14 20:08:09Z mabe $ + * @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -30,7 +30,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Frontend_File extends Zend_Cache_Core @@ -110,7 +110,11 @@ clearstatcache(); $i = 0; foreach ($masterFiles as $masterFile) { - $mtime = @filemtime($masterFile); + if (file_exists($masterFile)) { + $mtime = filemtime($masterFile); + } else { + $mtime = false; + } if (!$this->_specificOptions['ignore_missing_master_files'] && !$mtime) { Zend_Cache::throwException('Unable to read master_file : ' . $masterFile); @@ -119,7 +123,7 @@ $this->_masterFile_mtimes[$i] = $mtime; $this->_specificOptions['master_files'][$i] = $masterFile; if ($i === 0) { // to keep a compatibility - $this->_specificOptions['master_files'] = $masterFile; + $this->_specificOptions['master_file'] = $masterFile; } $i++; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Frontend/Function.php --- a/web/lib/Zend/Cache/Frontend/Function.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Frontend/Function.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Function.php 22648 2010-07-20 14:43:27Z mabe $ + * @version $Id: Function.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -30,7 +30,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Frontend_Function extends Zend_Cache_Core @@ -104,8 +104,7 @@ ob_start(); ob_implicit_flush(false); $return = call_user_func_array($callback, $parameters); - $output = ob_get_contents(); - ob_end_clean(); + $output = ob_get_clean(); $data = array($output, $return); $this->save($data, $id, $tags, $specificLifetime, $priority); } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Frontend/Output.php --- a/web/lib/Zend/Cache/Frontend/Output.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Frontend/Output.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Output.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Output.php 24800 2012-05-13 11:59:32Z mabe $ */ @@ -30,7 +30,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Frontend_Output extends Zend_Cache_Core @@ -55,7 +55,7 @@ * * @param string $id Cache id * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested - * @param boolean $echoData If set to true, datas are sent to the browser if the cache is hit (simpy returned else) + * @param boolean $echoData If set to true, datas are sent to the browser if the cache is hit (simply returned else) * @return mixed True if the cache is hit (false else) with $echoData=true (default) ; string else (datas) */ public function start($id, $doNotTestCacheValidity = false, $echoData = true) @@ -88,8 +88,7 @@ public function end($tags = array(), $specificLifetime = false, $forcedDatas = null, $echoData = true, $priority = 8) { if ($forcedDatas === null) { - $data = ob_get_contents(); - ob_end_clean(); + $data = ob_get_clean(); } else { $data =& $forcedDatas; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Frontend/Page.php --- a/web/lib/Zend/Cache/Frontend/Page.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Frontend/Page.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Page.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Page.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -30,7 +30,7 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Frontend_Page extends Zend_Cache_Core @@ -243,9 +243,11 @@ { $this->_cancel = false; $lastMatchingRegexp = null; - foreach ($this->_specificOptions['regexps'] as $regexp => $conf) { - if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) { - $lastMatchingRegexp = $regexp; + if (isset($_SERVER['REQUEST_URI'])) { + foreach ($this->_specificOptions['regexps'] as $regexp => $conf) { + if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) { + $lastMatchingRegexp = $regexp; + } } } $this->_activeOptions = $this->_specificOptions['default_options']; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cache/Manager.php --- a/web/lib/Zend/Cache/Manager.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cache/Manager.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Cache - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Manager.php 22727 2010-07-30 12:36:00Z mabe $ + * @version $Id: Manager.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @see Zend_Cache_Exception */ @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Cache - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Manager diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Captcha/Adapter.php --- a/web/lib/Zend/Captcha/Adapter.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Captcha/Adapter.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,9 +30,9 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Adapter.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Adapter.php 24593 2012-01-05 20:35:02Z matthew $ */ interface Zend_Captcha_Adapter extends Zend_Validate_Interface { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Captcha/Base.php --- a/web/lib/Zend/Captcha/Base.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Captcha/Base.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -33,9 +33,9 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Base.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Base.php 24593 2012-01-05 20:35:02Z matthew $ */ abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_Captcha_Adapter { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Captcha/Dumb.php --- a/web/lib/Zend/Captcha/Dumb.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Captcha/Dumb.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,13 +30,36 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Dumb.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Dumb.php 24747 2012-05-05 00:21:56Z adamlundrigan $ */ class Zend_Captcha_Dumb extends Zend_Captcha_Word { /** + * CAPTCHA label + * @type string + */ + protected $_label = 'Please type this word backwards'; + + /** + * Set the label for the CAPTCHA + * @param string $label + */ + public function setLabel($label) + { + $this->_label = $label; + } + + /** + * Retrieve the label for the CAPTCHA + * @return string + */ + public function getLabel() + { + return $this->_label; + } + /** * Render the captcha * * @param Zend_View_Interface $view @@ -45,7 +68,7 @@ */ public function render(Zend_View_Interface $view = null, $element = null) { - return 'Please type this word backwards: ' + return $this->getLabel() . ': ' . strrev($this->getWord()) . ''; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Captcha/Exception.php --- a/web/lib/Zend/Captcha/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Captcha/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,8 +14,8 @@ * * @category Zend * @package Zend_Captcha - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -29,7 +29,7 @@ * * @category Zend * @package Zend_Captcha - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Captcha_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Captcha/Figlet.php --- a/web/lib/Zend/Captcha/Figlet.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Captcha/Figlet.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -33,9 +33,9 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Figlet.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Figlet.php 24593 2012-01-05 20:35:02Z matthew $ */ class Zend_Captcha_Figlet extends Zend_Captcha_Word { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Captcha/Image.php --- a/web/lib/Zend/Captcha/Image.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Captcha/Image.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Image.php 22589 2010-07-16 20:51:51Z mikaelkael $ + * @version $Id: Image.php 24821 2012-05-29 14:54:50Z adamlundrigan $ */ /** @see Zend_Captcha_Word */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Captcha_Image extends Zend_Captcha_Word @@ -580,7 +580,7 @@ $suffixLength = strlen($this->_suffix); foreach (new DirectoryIterator($imgdir) as $file) { if (!$file->isDot() && !$file->isDir()) { - if ($file->getMTime() < $expire) { + if (file_exists($file->getPathname()) && $file->getMTime() < $expire) { // only deletes files ending with $this->_suffix if (substr($file->getFilename(), -($suffixLength)) == $this->_suffix) { unlink($file->getPathname()); @@ -599,7 +599,11 @@ */ public function render(Zend_View_Interface $view = null, $element = null) { + $endTag = ' />'; + if (($view instanceof Zend_View_Abstract) && !$view->doctype()->isXhtml()) { + $endTag = '>'; + } return '' . $this->getImgAlt()
-             . ''; + . '" src="' . $this->getImgUrl() . $this->getId() . $this->getSuffix() . '"' . $endTag; } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Captcha/ReCaptcha.php --- a/web/lib/Zend/Captcha/ReCaptcha.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Captcha/ReCaptcha.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -35,9 +35,9 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ReCaptcha.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ReCaptcha.php 24593 2012-01-05 20:35:02Z matthew $ */ class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base { @@ -261,6 +261,20 @@ */ public function render(Zend_View_Interface $view = null, $element = null) { - return $this->getService()->getHTML(); + $name = null; + if ($element instanceof Zend_Form_Element) { + $name = $element->getBelongsTo(); + } + return $this->getService()->getHTML($name); + } + + /** + * Get captcha decorator + * + * @return string + */ + public function getDecorator() + { + return "Captcha_ReCaptcha"; } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Captcha/Word.php --- a/web/lib/Zend/Captcha/Word.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Captcha/Word.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,9 +30,9 @@ * @category Zend * @package Zend_Captcha * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Word.php 21793 2010-04-08 00:51:31Z stas $ + * @version $Id: Word.php 24593 2012-01-05 20:35:02Z matthew $ */ abstract class Zend_Captcha_Word extends Zend_Captcha_Base { @@ -93,10 +93,10 @@ * @var integer */ protected $_timeout = 300; - + /** * Should generate() keep session or create a new one? - * + * * @var boolean */ protected $_keepSession = false; @@ -131,7 +131,7 @@ * * @return string */ - public function getSessionClass() + public function getSessionClass() { return $this->_sessionClass; } @@ -217,21 +217,21 @@ return $this->_timeout; } - /** - * Sets if session should be preserved on generate() - * - * @param $keepSession Should session be kept on generate()? - * @return Zend_Captcha_Word - */ - public function setKeepSession($keepSession) - { - $this->_keepSession = $keepSession; - return $this; - } + /** + * Sets if session should be preserved on generate() + * + * @param bool $keepSession Should session be kept on generate()? + * @return Zend_Captcha_Word + */ + public function setKeepSession($keepSession) + { + $this->_keepSession = $keepSession; + return $this; + } /** * Numbers should be included in the pattern? - * + * * @return bool */ public function getUseNumbers() @@ -239,10 +239,10 @@ return $this->_useNumbers; } - /** - * Set if numbers should be included in the pattern - * - * @param $_useNumbers numbers should be included in the pattern? + /** + * Set if numbers should be included in the pattern + * + * @param bool $_useNumbers numbers should be included in the pattern? * @return Zend_Captcha_Word */ public function setUseNumbers($_useNumbers) @@ -250,8 +250,8 @@ $this->_useNumbers = $_useNumbers; return $this; } - - /** + + /** * Get session object * * @return Zend_Session_Namespace @@ -348,7 +348,7 @@ public function generate() { if(!$this->_keepSession) { - $this->_session = null; + $this->_session = null; } $id = $this->_generateRandomId(); $this->_setId($id); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/AbstractFactory.php --- a/web/lib/Zend/Cloud/AbstractFactory.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/AbstractFactory.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Cloud - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -23,29 +23,29 @@ * * @category Zend * @package Zend_Cloud - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cloud_AbstractFactory { /** * Constructor - * + * * @return void */ private function __construct() { // private ctor - should not be used } - + /** * Get an individual adapter instance - * - * @param string $adapterOption - * @param array|Zend_Config $options + * + * @param string $adapterOption + * @param array|Zend_Config $options * @return null|Zend_Cloud_DocumentService_Adapter|Zend_Cloud_QueueService_Adapter|Zend_Cloud_StorageService_Adapter */ - protected static function _getAdapter($adapterOption, $options) + protected static function _getAdapter($adapterOption, $options) { if ($options instanceof Zend_Config) { $options = $options->toArray(); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/Adapter.php --- a/web/lib/Zend/Cloud/DocumentService/Adapter.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Adapter.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Cloud_DocumentService_Adapter @@ -67,9 +67,9 @@ /** * List all documents in a collection - * - * @param string $collectionName - * @param null|array $options + * + * @param string $collectionName + * @param null|array $options * @return Zend_Cloud_DocumentService_DocumentSet */ public function listDocuments($collectionName, array $options = null); @@ -87,7 +87,7 @@ /** * Replace document * The new document replaces the existing document with the same ID. - * + * * @param string $collectionName Collection name * @param Zend_Cloud_DocumentService_Document $document * @param array $options @@ -96,8 +96,8 @@ /** * Update document - * The fields of the existing documents will be updated. - * Fields not specified in the set will be left as-is. + * The fields of the existing documents will be updated. + * Fields not specified in the set will be left as-is. * * @param string $collectionName * @param mixed|Zend_Cloud_DocumentService_Document $documentID Document ID, adapter-dependent, or document containing updates @@ -106,7 +106,7 @@ * @return boolean */ public function updateDocument($collectionName, $documentID, $fieldset = null, $options = null); - + /** * Delete document * @@ -119,16 +119,16 @@ /** * Fetch single document by ID - * + * * Will return false if the document does not exist - * + * * @param string $collectionName Collection name * @param mixed $documentID Document ID, adapter-dependent * @param array $options * @return Zend_Cloud_DocumentService_Document */ public function fetchDocument($collectionName, $documentID, $options = null); - + /** * Query for documents stored in the document service. If a string is passed in * $query, the query string will be passed directly to the service. @@ -139,15 +139,15 @@ * @return array Array of field sets */ public function query($collectionName, $query, $options = null); - + /** * Create query statement - * + * * @param string $fields * @return Zend_Cloud_DocumentService_Query */ public function select($fields = null); - + /** * Get the concrete service client */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/Adapter/AbstractAdapter.php --- a/web/lib/Zend/Cloud/DocumentService/Adapter/AbstractAdapter.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Adapter/AbstractAdapter.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -33,10 +33,10 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter +abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter implements Zend_Cloud_DocumentService_Adapter { const DOCUMENT_CLASS = 'document_class'; @@ -57,15 +57,15 @@ /** * Class to utilize for new query objects - * + * * @var string */ protected $_queryClass = 'Zend_Cloud_DocumentService_Query'; /** * Set the class for document objects - * - * @param string $class + * + * @param string $class * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter */ public function setDocumentClass($class) @@ -76,7 +76,7 @@ /** * Get the class for document objects - * + * * @return string */ public function getDocumentClass() @@ -86,8 +86,8 @@ /** * Set the class for document set objects - * - * @param string $class + * + * @param string $class * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter */ public function setDocumentSetClass($class) @@ -98,7 +98,7 @@ /** * Get the class for document set objects - * + * * @return string */ public function getDocumentSetClass() @@ -108,8 +108,8 @@ /** * Set the query class for query objects - * - * @param string $class + * + * @param string $class * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter */ public function setQueryClass($class) @@ -120,7 +120,7 @@ /** * Get the class for query objects - * + * * @return string */ public function getQueryClass() diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/Adapter/SimpleDb.php --- a/web/lib/Zend/Cloud/DocumentService/Adapter/SimpleDb.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Adapter/SimpleDb.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,468 +1,468 @@ -toArray(); - } - - if (!is_array($options)) { - throw new Zend_Cloud_DocumentService_Exception('Invalid options provided to constructor'); - } - - $this->_simpleDb = new Zend_Service_Amazon_SimpleDb( - $options[self::AWS_ACCESS_KEY], $options[self::AWS_SECRET_KEY] - ); - - if (isset($options[self::HTTP_ADAPTER])) { - $this->_sqs->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]); - } - - if (isset($options[self::DOCUMENT_CLASS])) { - $this->setDocumentClass($options[self::DOCUMENT_CLASS]); - } - - if (isset($options[self::DOCUMENTSET_CLASS])) { - $this->setDocumentSetClass($options[self::DOCUMENTSET_CLASS]); - } - - if (isset($options[self::QUERY_CLASS])) { - $this->setQueryClass($options[self::QUERY_CLASS]); - } - } - - /** - * Create collection. - * - * @param string $name - * @param array $options - * @return void - */ - public function createCollection($name, $options = null) - { - try { - $this->_simpleDb->createDomain($name); - } catch(Zend_Service_Amazon_Exception $e) { - throw new Zend_Cloud_DocumentService_Exception('Error on domain creation: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Delete collection. - * - * @param string $name - * @param array $options - * @return void - */ - public function deleteCollection($name, $options = null) - { - try { - $this->_simpleDb->deleteDomain($name); - } catch(Zend_Service_Amazon_Exception $e) { - throw new Zend_Cloud_DocumentService_Exception('Error on collection deletion: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * List collections. - * - * @param array $options - * @return array - */ - public function listCollections($options = null) - { - try { - // TODO package this in Pages - $domains = $this->_simpleDb->listDomains()->getData(); - } catch(Zend_Service_Amazon_Exception $e) { - throw new Zend_Cloud_DocumentService_Exception('Error on collection deletion: '.$e->getMessage(), $e->getCode(), $e); - } - - return $domains; - } - - /** - * List documents - * - * Returns a key/value array of document names to document objects. - * - * @param string $collectionName Name of collection for which to list documents - * @param array|null $options - * @return Zend_Cloud_DocumentService_DocumentSet - */ - public function listDocuments($collectionName, array $options = null) - { - $query = $this->select('*')->from($collectionName); - $items = $this->query($collectionName, $query, $options); - return $items; - } - - /** - * Insert document - * - * @param string $collectionName Collection into which to insert document - * @param array|Zend_Cloud_DocumentService_Document $document - * @param array $options - * @return void - */ - public function insertDocument($collectionName, $document, $options = null) - { - if (is_array($document)) { - $document = $this->_getDocumentFromArray($document); - } - - if (!$document instanceof Zend_Cloud_DocumentService_Document) { - throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied'); - } - - try { - $this->_simpleDb->putAttributes( - $collectionName, - $document->getID(), - $this->_makeAttributes($document->getID(), $document->getFields()) - ); - } catch(Zend_Service_Amazon_Exception $e) { - throw new Zend_Cloud_DocumentService_Exception('Error on document insertion: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Replace an existing document with a new version - * - * @param string $collectionName - * @param array|Zend_Cloud_DocumentService_Document $document - * @param array $options - * @return void - */ - public function replaceDocument($collectionName, $document, $options = null) - { - if (is_array($document)) { - $document = $this->_getDocumentFromArray($document); - } - - if (!$document instanceof Zend_Cloud_DocumentService_Document) { - throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied'); - } - - // Delete document first, then insert. PutAttributes always keeps any - // fields not referenced in the payload, but present in the document - $documentId = $document->getId(); - $fields = $document->getFields(); - $docClass = get_class($document); - $this->deleteDocument($collectionName, $document, $options); - - $document = new $docClass($fields, $documentId); - $this->insertDocument($collectionName, $document); - } - - /** - * Update document. The new document replaces the existing document. - * - * Option 'merge' specifies to add all attributes (if true) or - * specific attributes ("attr" => true) instead of replacing them. - * By default, attributes are replaced. - * - * @param string $collectionName - * @param mixed|Zend_Cloud_DocumentService_Document $documentId Document ID, adapter-dependent - * @param array|Zend_Cloud_DocumentService_Document $fieldset Set of fields to update - * @param array $options - * @return boolean - */ - public function updateDocument($collectionName, $documentId, $fieldset = null, $options = null) - { - if (null === $fieldset && $documentId instanceof Zend_Cloud_DocumentService_Document) { - $fieldset = $documentId->getFields(); - if (empty($documentId)) { - $documentId = $documentId->getId(); - } - } elseif ($fieldset instanceof Zend_Cloud_DocumentService_Document) { - if (empty($documentId)) { - $documentId = $fieldset->getId(); - } - $fieldset = $fieldset->getFields(); - } - - $replace = array(); - if (empty($options[self::MERGE_OPTION])) { - // no merge option - we replace all - foreach ($fieldset as $key => $value) { - $replace[$key] = true; - } - } elseif (is_array($options[self::MERGE_OPTION])) { - foreach ($fieldset as $key => $value) { - if (empty($options[self::MERGE_OPTION][$key])) { - // if there's merge key, we add it, otherwise we replace it - $replace[$key] = true; - } - } - } // otherwise $replace is empty - all is merged - - try { - $this->_simpleDb->putAttributes( - $collectionName, - $documentId, - $this->_makeAttributes($documentId, $fieldset), - $replace - ); - } catch(Zend_Service_Amazon_Exception $e) { - throw new Zend_Cloud_DocumentService_Exception('Error on document update: '.$e->getMessage(), $e->getCode(), $e); - } - return true; - } - - /** - * Delete document. - * - * @param string $collectionName Collection from which to delete document - * @param mixed $document Document ID or Document object. - * @param array $options - * @return boolean - */ - public function deleteDocument($collectionName, $document, $options = null) - { - if ($document instanceof Zend_Cloud_DocumentService_Document) { - $document = $document->getId(); - } - try { - $this->_simpleDb->deleteAttributes($collectionName, $document); - } catch(Zend_Service_Amazon_Exception $e) { - throw new Zend_Cloud_DocumentService_Exception('Error on document deletion: '.$e->getMessage(), $e->getCode(), $e); - } - return true; - } - - /** - * Fetch single document by ID - * - * @param string $collectionName Collection name - * @param mixed $documentId Document ID, adapter-dependent - * @param array $options - * @return Zend_Cloud_DocumentService_Document - */ - public function fetchDocument($collectionName, $documentId, $options = null) - { - try { - $attributes = $this->_simpleDb->getAttributes($collectionName, $documentId); - if ($attributes == false || count($attributes) == 0) { - return false; - } - return $this->_resolveAttributes($attributes, true); - } catch(Zend_Service_Amazon_Exception $e) { - throw new Zend_Cloud_DocumentService_Exception('Error on fetching document: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Query for documents stored in the document service. If a string is passed in - * $query, the query string will be passed directly to the service. - * - * @param string $collectionName Collection name - * @param string $query - * @param array $options - * @return array Zend_Cloud_DocumentService_DocumentSet - */ - public function query($collectionName, $query, $options = null) - { - $returnDocs = isset($options[self::RETURN_DOCUMENTS]) - ? (bool) $options[self::RETURN_DOCUMENTS] - : true; - - try { - if ($query instanceof Zend_Cloud_DocumentService_Adapter_SimpleDb_Query) { - $query = $query->assemble($collectionName); - } - $result = $this->_simpleDb->select($query); - } catch(Zend_Service_Amazon_Exception $e) { - throw new Zend_Cloud_DocumentService_Exception('Error on document query: '.$e->getMessage(), $e->getCode(), $e); - } - - return $this->_getDocumentSetFromResultSet($result, $returnDocs); - } - - /** - * Create query statement - * - * @param string $fields - * @return Zend_Cloud_DocumentService_Adapter_SimpleDb_Query - */ - public function select($fields = null) - { - $queryClass = $this->getQueryClass(); - if (!class_exists($queryClass)) { - require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($queryClass); - } - - $query = new $queryClass($this); - $defaultClass = self::DEFAULT_QUERY_CLASS; - if (!$query instanceof $defaultClass) { - throw new Zend_Cloud_DocumentService_Exception('Query class must extend ' . self::DEFAULT_QUERY_CLASS); - } - - $query->select($fields); - return $query; - } - - /** - * Get the concrete service client - * - * @return Zend_Service_Amazon_SimpleDb - */ - public function getClient() - { - return $this->_simpleDb; - } - - /** - * Convert array of key-value pairs to array of Amazon attributes - * - * @param string $name - * @param array $attributes - * @return array - */ - protected function _makeAttributes($name, $attributes) - { - $result = array(); - foreach ($attributes as $key => $attr) { - $result[] = new Zend_Service_Amazon_SimpleDb_Attribute($name, $key, $attr); - } - return $result; - } - - /** - * Convert array of Amazon attributes to array of key-value pairs - * - * @param array $attributes - * @return array - */ - protected function _resolveAttributes($attributes, $returnDocument = false) - { - $result = array(); - foreach ($attributes as $attr) { - $value = $attr->getValues(); - if (count($value) == 0) { - $value = null; - } elseif (count($value) == 1) { - $value = $value[0]; - } - $result[$attr->getName()] = $value; - } - - // Return as document object? - if ($returnDocument) { - $documentClass = $this->getDocumentClass(); - return new $documentClass($result, $attr->getItemName()); - } - - return $result; - } - - /** - * Create suitable document from array of fields - * - * @param array $document - * @return Zend_Cloud_DocumentService_Document - */ - protected function _getDocumentFromArray($document) - { - if (!isset($document[Zend_Cloud_DocumentService_Document::KEY_FIELD])) { - if (isset($document[self::ITEM_NAME])) { - $key = $document[self::ITEM_NAME]; - unset($document[self::ITEM_NAME]); - } else { - throw new Zend_Cloud_DocumentService_Exception('Fields array should contain the key field '.Zend_Cloud_DocumentService_Document::KEY_FIELD); - } - } else { - $key = $document[Zend_Cloud_DocumentService_Document::KEY_FIELD]; - unset($document[Zend_Cloud_DocumentService_Document::KEY_FIELD]); - } - - $documentClass = $this->getDocumentClass(); - return new $documentClass($document, $key); - } - - /** - * Create a DocumentSet from a SimpleDb resultset - * - * @param Zend_Service_Amazon_SimpleDb_Page $resultSet - * @param bool $returnDocs - * @return Zend_Cloud_DocumentService_DocumentSet - */ - protected function _getDocumentSetFromResultSet(Zend_Service_Amazon_SimpleDb_Page $resultSet, $returnDocs = true) - { - $docs = array(); - foreach ($resultSet->getData() as $item) { - $docs[] = $this->_resolveAttributes($item, $returnDocs); - } - - $setClass = $this->getDocumentSetClass(); - return new $setClass($docs); - } -} +toArray(); + } + + if (!is_array($options)) { + throw new Zend_Cloud_DocumentService_Exception('Invalid options provided to constructor'); + } + + $this->_simpleDb = new Zend_Service_Amazon_SimpleDb( + $options[self::AWS_ACCESS_KEY], $options[self::AWS_SECRET_KEY] + ); + + if (isset($options[self::HTTP_ADAPTER])) { + $this->_simpleDb->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]); + } + + if (isset($options[self::DOCUMENT_CLASS])) { + $this->setDocumentClass($options[self::DOCUMENT_CLASS]); + } + + if (isset($options[self::DOCUMENTSET_CLASS])) { + $this->setDocumentSetClass($options[self::DOCUMENTSET_CLASS]); + } + + if (isset($options[self::QUERY_CLASS])) { + $this->setQueryClass($options[self::QUERY_CLASS]); + } + } + + /** + * Create collection. + * + * @param string $name + * @param array $options + * @return void + */ + public function createCollection($name, $options = null) + { + try { + $this->_simpleDb->createDomain($name); + } catch(Zend_Service_Amazon_Exception $e) { + throw new Zend_Cloud_DocumentService_Exception('Error on domain creation: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Delete collection. + * + * @param string $name + * @param array $options + * @return void + */ + public function deleteCollection($name, $options = null) + { + try { + $this->_simpleDb->deleteDomain($name); + } catch(Zend_Service_Amazon_Exception $e) { + throw new Zend_Cloud_DocumentService_Exception('Error on collection deletion: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * List collections. + * + * @param array $options + * @return array + */ + public function listCollections($options = null) + { + try { + // TODO package this in Pages + $domains = $this->_simpleDb->listDomains()->getData(); + } catch(Zend_Service_Amazon_Exception $e) { + throw new Zend_Cloud_DocumentService_Exception('Error on collection deletion: '.$e->getMessage(), $e->getCode(), $e); + } + + return $domains; + } + + /** + * List documents + * + * Returns a key/value array of document names to document objects. + * + * @param string $collectionName Name of collection for which to list documents + * @param array|null $options + * @return Zend_Cloud_DocumentService_DocumentSet + */ + public function listDocuments($collectionName, array $options = null) + { + $query = $this->select('*')->from($collectionName); + $items = $this->query($collectionName, $query, $options); + return $items; + } + + /** + * Insert document + * + * @param string $collectionName Collection into which to insert document + * @param array|Zend_Cloud_DocumentService_Document $document + * @param array $options + * @return void + */ + public function insertDocument($collectionName, $document, $options = null) + { + if (is_array($document)) { + $document = $this->_getDocumentFromArray($document); + } + + if (!$document instanceof Zend_Cloud_DocumentService_Document) { + throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied'); + } + + try { + $this->_simpleDb->putAttributes( + $collectionName, + $document->getID(), + $this->_makeAttributes($document->getID(), $document->getFields()) + ); + } catch(Zend_Service_Amazon_Exception $e) { + throw new Zend_Cloud_DocumentService_Exception('Error on document insertion: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Replace an existing document with a new version + * + * @param string $collectionName + * @param array|Zend_Cloud_DocumentService_Document $document + * @param array $options + * @return void + */ + public function replaceDocument($collectionName, $document, $options = null) + { + if (is_array($document)) { + $document = $this->_getDocumentFromArray($document); + } + + if (!$document instanceof Zend_Cloud_DocumentService_Document) { + throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied'); + } + + // Delete document first, then insert. PutAttributes always keeps any + // fields not referenced in the payload, but present in the document + $documentId = $document->getId(); + $fields = $document->getFields(); + $docClass = get_class($document); + $this->deleteDocument($collectionName, $document, $options); + + $document = new $docClass($fields, $documentId); + $this->insertDocument($collectionName, $document); + } + + /** + * Update document. The new document replaces the existing document. + * + * Option 'merge' specifies to add all attributes (if true) or + * specific attributes ("attr" => true) instead of replacing them. + * By default, attributes are replaced. + * + * @param string $collectionName + * @param mixed|Zend_Cloud_DocumentService_Document $documentId Document ID, adapter-dependent + * @param array|Zend_Cloud_DocumentService_Document $fieldset Set of fields to update + * @param array $options + * @return boolean + */ + public function updateDocument($collectionName, $documentId, $fieldset = null, $options = null) + { + if (null === $fieldset && $documentId instanceof Zend_Cloud_DocumentService_Document) { + $fieldset = $documentId->getFields(); + if (empty($documentId)) { + $documentId = $documentId->getId(); + } + } elseif ($fieldset instanceof Zend_Cloud_DocumentService_Document) { + if (empty($documentId)) { + $documentId = $fieldset->getId(); + } + $fieldset = $fieldset->getFields(); + } + + $replace = array(); + if (empty($options[self::MERGE_OPTION])) { + // no merge option - we replace all + foreach ($fieldset as $key => $value) { + $replace[$key] = true; + } + } elseif (is_array($options[self::MERGE_OPTION])) { + foreach ($fieldset as $key => $value) { + if (empty($options[self::MERGE_OPTION][$key])) { + // if there's merge key, we add it, otherwise we replace it + $replace[$key] = true; + } + } + } // otherwise $replace is empty - all is merged + + try { + $this->_simpleDb->putAttributes( + $collectionName, + $documentId, + $this->_makeAttributes($documentId, $fieldset), + $replace + ); + } catch(Zend_Service_Amazon_Exception $e) { + throw new Zend_Cloud_DocumentService_Exception('Error on document update: '.$e->getMessage(), $e->getCode(), $e); + } + return true; + } + + /** + * Delete document. + * + * @param string $collectionName Collection from which to delete document + * @param mixed $document Document ID or Document object. + * @param array $options + * @return boolean + */ + public function deleteDocument($collectionName, $document, $options = null) + { + if ($document instanceof Zend_Cloud_DocumentService_Document) { + $document = $document->getId(); + } + try { + $this->_simpleDb->deleteAttributes($collectionName, $document); + } catch(Zend_Service_Amazon_Exception $e) { + throw new Zend_Cloud_DocumentService_Exception('Error on document deletion: '.$e->getMessage(), $e->getCode(), $e); + } + return true; + } + + /** + * Fetch single document by ID + * + * @param string $collectionName Collection name + * @param mixed $documentId Document ID, adapter-dependent + * @param array $options + * @return Zend_Cloud_DocumentService_Document + */ + public function fetchDocument($collectionName, $documentId, $options = null) + { + try { + $attributes = $this->_simpleDb->getAttributes($collectionName, $documentId); + if ($attributes == false || count($attributes) == 0) { + return false; + } + return $this->_resolveAttributes($attributes, true); + } catch(Zend_Service_Amazon_Exception $e) { + throw new Zend_Cloud_DocumentService_Exception('Error on fetching document: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Query for documents stored in the document service. If a string is passed in + * $query, the query string will be passed directly to the service. + * + * @param string $collectionName Collection name + * @param string $query + * @param array $options + * @return array Zend_Cloud_DocumentService_DocumentSet + */ + public function query($collectionName, $query, $options = null) + { + $returnDocs = isset($options[self::RETURN_DOCUMENTS]) + ? (bool) $options[self::RETURN_DOCUMENTS] + : true; + + try { + if ($query instanceof Zend_Cloud_DocumentService_Adapter_SimpleDb_Query) { + $query = $query->assemble($collectionName); + } + $result = $this->_simpleDb->select($query); + } catch(Zend_Service_Amazon_Exception $e) { + throw new Zend_Cloud_DocumentService_Exception('Error on document query: '.$e->getMessage(), $e->getCode(), $e); + } + + return $this->_getDocumentSetFromResultSet($result, $returnDocs); + } + + /** + * Create query statement + * + * @param string $fields + * @return Zend_Cloud_DocumentService_Adapter_SimpleDb_Query + */ + public function select($fields = null) + { + $queryClass = $this->getQueryClass(); + if (!class_exists($queryClass)) { + require_once 'Zend/Loader.php'; + Zend_Loader::loadClass($queryClass); + } + + $query = new $queryClass($this); + $defaultClass = self::DEFAULT_QUERY_CLASS; + if (!$query instanceof $defaultClass) { + throw new Zend_Cloud_DocumentService_Exception('Query class must extend ' . self::DEFAULT_QUERY_CLASS); + } + + $query->select($fields); + return $query; + } + + /** + * Get the concrete service client + * + * @return Zend_Service_Amazon_SimpleDb + */ + public function getClient() + { + return $this->_simpleDb; + } + + /** + * Convert array of key-value pairs to array of Amazon attributes + * + * @param string $name + * @param array $attributes + * @return array + */ + protected function _makeAttributes($name, $attributes) + { + $result = array(); + foreach ($attributes as $key => $attr) { + $result[] = new Zend_Service_Amazon_SimpleDb_Attribute($name, $key, $attr); + } + return $result; + } + + /** + * Convert array of Amazon attributes to array of key-value pairs + * + * @param array $attributes + * @return array + */ + protected function _resolveAttributes($attributes, $returnDocument = false) + { + $result = array(); + foreach ($attributes as $attr) { + $value = $attr->getValues(); + if (count($value) == 0) { + $value = null; + } elseif (count($value) == 1) { + $value = $value[0]; + } + $result[$attr->getName()] = $value; + } + + // Return as document object? + if ($returnDocument) { + $documentClass = $this->getDocumentClass(); + return new $documentClass($result, $attr->getItemName()); + } + + return $result; + } + + /** + * Create suitable document from array of fields + * + * @param array $document + * @return Zend_Cloud_DocumentService_Document + */ + protected function _getDocumentFromArray($document) + { + if (!isset($document[Zend_Cloud_DocumentService_Document::KEY_FIELD])) { + if (isset($document[self::ITEM_NAME])) { + $key = $document[self::ITEM_NAME]; + unset($document[self::ITEM_NAME]); + } else { + throw new Zend_Cloud_DocumentService_Exception('Fields array should contain the key field '.Zend_Cloud_DocumentService_Document::KEY_FIELD); + } + } else { + $key = $document[Zend_Cloud_DocumentService_Document::KEY_FIELD]; + unset($document[Zend_Cloud_DocumentService_Document::KEY_FIELD]); + } + + $documentClass = $this->getDocumentClass(); + return new $documentClass($document, $key); + } + + /** + * Create a DocumentSet from a SimpleDb resultset + * + * @param Zend_Service_Amazon_SimpleDb_Page $resultSet + * @param bool $returnDocs + * @return Zend_Cloud_DocumentService_DocumentSet + */ + protected function _getDocumentSetFromResultSet(Zend_Service_Amazon_SimpleDb_Page $resultSet, $returnDocs = true) + { + $docs = array(); + foreach ($resultSet->getData() as $item) { + $docs[] = $this->_resolveAttributes($item, $returnDocs); + } + + $setClass = $this->getDocumentSetClass(); + return new $setClass($docs); + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/Adapter/SimpleDb/Query.php --- a/web/lib/Zend/Cloud/DocumentService/Adapter/SimpleDb/Query.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Adapter/SimpleDb/Query.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -23,13 +23,13 @@ require_once 'Zend/Cloud/DocumentService/Query.php'; /** - * Class implementing Query adapter for working with SimpleDb queries in a + * Class implementing Query adapter for working with SimpleDb queries in a * structured way * * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cloud_DocumentService_Adapter_SimpleDb_Query @@ -42,8 +42,8 @@ /** * Constructor - * - * @param Zend_Cloud_DocumentService_Adapter_SimpleDb $adapter + * + * @param Zend_Cloud_DocumentService_Adapter_SimpleDb $adapter * @param null|string $collectionName * @return void */ @@ -57,7 +57,7 @@ /** * Get adapter - * + * * @return Zend_Cloud_DocumentService_Adapter_SimpleDb */ public function getAdapter() @@ -67,7 +67,7 @@ /** * Assemble the query into a format the adapter can utilize - * + * * @var string $collectionName Name of collection from which to select * @return string */ @@ -150,10 +150,10 @@ /** * Parse a where statement into service-specific language - * + * * @todo Ensure this fulfills the entire SimpleDB query specification for WHERE - * @param string $where - * @param array $args + * @param string $where + * @param array $args * @return string */ protected function _parseWhere($where, $args) diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php --- a/web/lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -29,10 +29,10 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Cloud_DocumentService_Adapter_WindowsAzure +class Zend_Cloud_DocumentService_Adapter_WindowsAzure extends Zend_Cloud_DocumentService_Adapter_AbstractAdapter { /* @@ -50,20 +50,20 @@ const ROW_KEY = 'RowKey'; const VERIFY_ETAG = "verify_etag"; const TIMESTAMP_KEY = "Timestamp"; - + const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_TABLE; const DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'; /** * Azure service instance. - * + * * @var Zend_Service_WindowsAzure_Storage_Table */ protected $_storageClient; /** * Class to utilize for new query objects - * + * * @var string */ protected $_queryClass = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'; @@ -76,11 +76,11 @@ /** * Constructor - * - * @param array $options + * + * @param array $options * @return void */ - public function __construct($options = array()) + public function __construct($options = array()) { if ($options instanceof Zend_Config) { $options = $options->toArray(); @@ -142,8 +142,8 @@ /** * Set the default partition key - * - * @param string $key + * + * @param string $key * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure */ public function setDefaultPartitionKey($key) @@ -155,7 +155,7 @@ /** * Retrieve default partition key - * + * * @return null|string */ public function getDefaultPartitionKey() @@ -170,7 +170,7 @@ * @param array $options * @return boolean */ - public function createCollection($name, $options = null) + public function createCollection($name, $options = null) { if (!preg_match('/^[A-Za-z][A-Za-z0-9]{2,}$/', $name)) { throw new Zend_Cloud_DocumentService_Exception('Invalid collection name; Windows Azure collection names must consist of alphanumeric characters only, and be at least 3 characters long'); @@ -192,7 +192,7 @@ * @param array $options * @return boolean */ - public function deleteCollection($name, $options = null) + public function deleteCollection($name, $options = null) { try { $this->_storageClient->deleteTable($name); @@ -210,7 +210,7 @@ * @param array $options * @return array */ - public function listCollections($options = null) + public function listCollections($options = null) { try { $tables = $this->_storageClient->listTables(); @@ -228,7 +228,7 @@ /** * Create suitable document from array of fields - * + * * @param array $document * @param null|string $collectionName Collection to which this document belongs * @return Zend_Cloud_DocumentService_Document @@ -257,12 +257,12 @@ $documentClass = $this->getDocumentClass(); return new $documentClass($document, $key); } - + /** * List all documents in a collection - * - * @param string $collectionName - * @param null|array $options + * + * @param string $collectionName + * @param null|array $options * @return Zend_Cloud_DocumentService_DocumentSet */ public function listDocuments($collectionName, array $options = null) @@ -282,19 +282,19 @@ { if (is_array($document)) { $document = $this->_getDocumentFromArray($document, $collectionName); - } - + } + if (!$document instanceof Zend_Cloud_DocumentService_Document) { throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied'); } - + $key = $this->_validateDocumentId($document->getId(), $collectionName); $document->setId($key); - + $this->_validateCompositeKey($key); $this->_validateFields($document); try { - + $entity = new Zend_Service_WindowsAzure_Storage_DynamicTableEntity($key[0], $key[1]); $entity->setAzureValues($document->getFields(), true); $this->_storageClient->insertEntity($collectionName, $entity); @@ -304,8 +304,8 @@ } /** - * Replace document. - * + * Replace document. + * * The new document replaces the existing document. * * @param Zend_Cloud_DocumentService_Document $document @@ -316,12 +316,12 @@ { if (is_array($document)) { $document = $this->_getDocumentFromArray($document, $collectionName); - } - + } + if (!$document instanceof Zend_Cloud_DocumentService_Document) { throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied'); } - + $key = $this->_validateDocumentId($document->getId(), $collectionName); $this->_validateFields($document); try { @@ -330,7 +330,7 @@ if (isset($options[self::VERIFY_ETAG])) { $entity->setEtag($options[self::VERIFY_ETAG]); } - + $this->_storageClient->updateEntity($collectionName, $entity, isset($options[self::VERIFY_ETAG])); } catch(Zend_Service_WindowsAzure_Exception $e) { throw new Zend_Cloud_DocumentService_Exception('Error on document replace: '.$e->getMessage(), $e->getCode(), $e); @@ -338,8 +338,8 @@ } /** - * Update document. - * + * Update document. + * * The new document is merged the existing document. * * @param string $collectionName @@ -375,13 +375,13 @@ if (isset($options[self::VERIFY_ETAG])) { $entity->setEtag($options[self::VERIFY_ETAG]); } - + $this->_storageClient->mergeEntity($collectionName, $entity, isset($options[self::VERIFY_ETAG])); } catch(Zend_Service_WindowsAzure_Exception $e) { throw new Zend_Cloud_DocumentService_Exception('Error on document update: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Delete document. * @@ -412,7 +412,7 @@ /** * Fetch single document by ID - * + * * @param string $collectionName Collection name * @param mixed $documentId Document ID, adapter-dependent * @param array $options @@ -432,7 +432,7 @@ throw new Zend_Cloud_DocumentService_Exception('Error on document fetch: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Query for documents stored in the document service. If a string is passed in * $query, the query string will be passed directly to the service. @@ -466,7 +466,7 @@ $setClass = $this->getDocumentSetClass(); return new $setClass($resultSet); } - + /** * Create query statement * @@ -487,9 +487,9 @@ } $query->select($fields); - return $query; + return $query; } - + /** * Get the concrete service client * @@ -499,11 +499,11 @@ { return $this->_storageClient; } - + /** * Resolve table values to attributes - * - * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity + * + * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity * @return array */ protected function _resolveAttributes(Zend_Service_WindowsAzure_Storage_TableEntity $entity) @@ -514,12 +514,12 @@ } return $result; } - + /** * Validate a partition or row key - * - * @param string $key + * + * @param string $key * @return void * @throws Zend_Cloud_DocumentService_Exception */ @@ -532,8 +532,8 @@ /** * Validate a composite key - * - * @param array $key + * + * @param array $key * @return throws Zend_Cloud_DocumentService_Exception */ protected function _validateCompositeKey(array $key) @@ -549,15 +549,15 @@ /** * Validate a document identifier * - * If the identifier is an array containing a valid partition and row key, + * If the identifier is an array containing a valid partition and row key, * returns it. If the identifier is a string: - * - if a default partition key is present, it creates an identifier using + * - if a default partition key is present, it creates an identifier using * that and the provided document ID * - if a collection name is provided, it will use that for the partition key * - otherwise, it's invalid - * - * @param array|string $documentId - * @param null|string $collectionName + * + * @param array|string $documentId + * @param null|string $collectionName * @return array * @throws Zend_Cloud_DocumentService_Exception */ @@ -585,7 +585,7 @@ /** * Validate a document's fields for well-formedness * - * Since Azure uses Atom, and fieldnames are included as part of XML + * Since Azure uses Atom, and fieldnames are included as part of XML * element tag names, the field names must be valid XML names. * * @param Zend_Cloud_DocumentService_Document|array $document @@ -608,10 +608,10 @@ /** * Validate an individual field name for well-formedness * - * Since Azure uses Atom, and fieldnames are included as part of XML + * Since Azure uses Atom, and fieldnames are included as part of XML * element tag names, the field names must be valid XML names. * - * While we could potentially normalize names, this could also lead to + * While we could potentially normalize names, this could also lead to * conflict with other field names -- which we should avoid. As such, * invalid field names will raise an exception. * diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure/Query.php --- a/web/lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure/Query.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure/Query.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,171 +1,171 @@ -_azureSelect = $select; - } - - /** - * SELECT clause (fields to be selected) - * - * Does nothing for Azure. - * - * @param string $select - * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query - */ - public function select($select) - { - return $this; - } - - /** - * FROM clause (table name) - * - * @param string $from - * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query - */ - public function from($from) - { - $this->_azureSelect->from($from); - return $this; - } - - /** - * WHERE clause (conditions to be used) - * - * @param string $where - * @param mixed $value Value or array of values to be inserted instead of ? - * @param string $op Operation to use to join where clauses (AND/OR) - * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query - */ - public function where($where, $value = null, $op = 'and') - { - if (!empty($value) && !is_array($value)) { - // fix buglet in Azure - numeric values are quoted unless passed as an array - $value = array($value); - } - $this->_azureSelect->where($where, $value, $op); - return $this; - } - - /** - * WHERE clause for item ID - * - * This one should be used when fetching specific rows since some adapters - * have special syntax for primary keys - * - * @param array $value Row ID for the document (PartitionKey, RowKey) - * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query - */ - public function whereId($value) - { - if (!is_array($value)) { - require_once 'Zend/Cloud/DocumentService/Exception.php'; - throw new Zend_Cloud_DocumentService_Exception('Invalid document key'); - } - $this->_azureSelect->wherePartitionKey($value[0])->whereRowKey($value[1]); - return $this; - } - - /** - * LIMIT clause (how many rows to return) - * - * @param int $limit - * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query - */ - public function limit($limit) - { - $this->_azureSelect->top($limit); - return $this; - } - - /** - * ORDER BY clause (sorting) - * - * @todo Azure service doesn't seem to support this yet; emulate? - * @param string $sort Column to sort by - * @param string $direction Direction - asc/desc - * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query - * @throws Zend_Cloud_OperationNotAvailableException - */ - public function order($sort, $direction = 'asc') - { - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException('No support for sorting for Azure yet'); - } - - /** - * Get Azure select query - * - * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery - */ - public function getAzureSelect() - { - return $this->_azureSelect; - } - - /** - * Assemble query - * - * Simply return the WindowsAzure table entity query object - * - * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery - */ - public function assemble() - { - return $this->getAzureSelect(); - } -} +_azureSelect = $select; + } + + /** + * SELECT clause (fields to be selected) + * + * Does nothing for Azure. + * + * @param string $select + * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query + */ + public function select($select) + { + return $this; + } + + /** + * FROM clause (table name) + * + * @param string $from + * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query + */ + public function from($from) + { + $this->_azureSelect->from($from); + return $this; + } + + /** + * WHERE clause (conditions to be used) + * + * @param string $where + * @param mixed $value Value or array of values to be inserted instead of ? + * @param string $op Operation to use to join where clauses (AND/OR) + * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query + */ + public function where($where, $value = null, $op = 'and') + { + if (!empty($value) && !is_array($value)) { + // fix buglet in Azure - numeric values are quoted unless passed as an array + $value = array($value); + } + $this->_azureSelect->where($where, $value, $op); + return $this; + } + + /** + * WHERE clause for item ID + * + * This one should be used when fetching specific rows since some adapters + * have special syntax for primary keys + * + * @param array $value Row ID for the document (PartitionKey, RowKey) + * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query + */ + public function whereId($value) + { + if (!is_array($value)) { + require_once 'Zend/Cloud/DocumentService/Exception.php'; + throw new Zend_Cloud_DocumentService_Exception('Invalid document key'); + } + $this->_azureSelect->wherePartitionKey($value[0])->whereRowKey($value[1]); + return $this; + } + + /** + * LIMIT clause (how many rows to return) + * + * @param int $limit + * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query + */ + public function limit($limit) + { + $this->_azureSelect->top($limit); + return $this; + } + + /** + * ORDER BY clause (sorting) + * + * @todo Azure service doesn't seem to support this yet; emulate? + * @param string $sort Column to sort by + * @param string $direction Direction - asc/desc + * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query + * @throws Zend_Cloud_OperationNotAvailableException + */ + public function order($sort, $direction = 'asc') + { + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException('No support for sorting for Azure yet'); + } + + /** + * Get Azure select query + * + * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery + */ + public function getAzureSelect() + { + return $this->_azureSelect; + } + + /** + * Assemble query + * + * Simply return the WindowsAzure table entity query object + * + * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery + */ + public function assemble() + { + return $this->getAzureSelect(); + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/Document.php --- a/web/lib/Zend/Cloud/DocumentService/Document.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Document.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,248 +1,248 @@ -_fields = $fields; - $this->setId($id); - } - - /** - * Set document identifier - * - * @param mixed $id - * @return Zend_Cloud_DocumentService_Document - */ - public function setId($id) - { - $this->_id = $id; - return $this; - } - - /** - * Get ID name. - * - * @return string - */ - public function getId() - { - return $this->_id; - } - - /** - * Get fields as array. - * - * @return array - */ - public function getFields() - { - return $this->_fields; - } - - /** - * Get field by name. - * - * @param string $name - * @return mixed - */ - public function getField($name) - { - if (isset($this->_fields[$name])) { - return $this->_fields[$name]; - } - return null; - } - - /** - * Set field by name. - * - * @param string $name - * @param mixed $value - * @return Zend_Cloud_DocumentService_Document - */ - public function setField($name, $value) - { - $this->_fields[$name] = $value; - return $this; - } - - /** - * Overloading: get value - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - return $this->getField($name); - } - - /** - * Overloading: set field - * - * @param string $name - * @param mixed $value - * @return void - */ - public function __set($name, $value) - { - $this->setField($name, $value); - } - - /** - * ArrayAccess: does field exist? - * - * @param string $name - * @return bool - */ - public function offsetExists($name) - { - return isset($this->_fields[$name]); - } - - /** - * ArrayAccess: get field by name - * - * @param string $name - * @return mixed - */ - public function offsetGet($name) - { - return $this->getField($name); - } - - /** - * ArrayAccess: set field to value - * - * @param string $name - * @param mixed $value - * @return void - */ - public function offsetSet($name, $value) - { - $this->setField($name, $value); - } - - /** - * ArrayAccess: remove field from document - * - * @param string $name - * @return void - */ - public function offsetUnset($name) - { - if ($this->offsetExists($name)) { - unset($this->_fields[$name]); - } - } - - /** - * Overloading: retrieve and set fields by name - * - * @param string $name - * @param mixed $args - * @return mixed - */ - public function __call($name, $args) - { - $prefix = substr($name, 0, 3); - if ($prefix == 'get') { - // Get value - $option = substr($name, 3); - return $this->getField($option); - } elseif ($prefix == 'set') { - // set value - $option = substr($name, 3); - return $this->setField($option, $args[0]); - } - - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException("Unknown operation $name"); - } - - /** - * Countable: return count of fields in document - * - * @return int - */ - public function count() - { - return count($this->_fields); - } - - /** - * IteratorAggregate: return iterator for iterating over fields - * - * @return Iterator - */ - public function getIterator() - { - return new ArrayIterator($this->_fields); - } -} +_fields = $fields; + $this->setId($id); + } + + /** + * Set document identifier + * + * @param mixed $id + * @return Zend_Cloud_DocumentService_Document + */ + public function setId($id) + { + $this->_id = $id; + return $this; + } + + /** + * Get ID name. + * + * @return string + */ + public function getId() + { + return $this->_id; + } + + /** + * Get fields as array. + * + * @return array + */ + public function getFields() + { + return $this->_fields; + } + + /** + * Get field by name. + * + * @param string $name + * @return mixed + */ + public function getField($name) + { + if (isset($this->_fields[$name])) { + return $this->_fields[$name]; + } + return null; + } + + /** + * Set field by name. + * + * @param string $name + * @param mixed $value + * @return Zend_Cloud_DocumentService_Document + */ + public function setField($name, $value) + { + $this->_fields[$name] = $value; + return $this; + } + + /** + * Overloading: get value + * + * @param string $name + * @return mixed + */ + public function __get($name) + { + return $this->getField($name); + } + + /** + * Overloading: set field + * + * @param string $name + * @param mixed $value + * @return void + */ + public function __set($name, $value) + { + $this->setField($name, $value); + } + + /** + * ArrayAccess: does field exist? + * + * @param string $name + * @return bool + */ + public function offsetExists($name) + { + return isset($this->_fields[$name]); + } + + /** + * ArrayAccess: get field by name + * + * @param string $name + * @return mixed + */ + public function offsetGet($name) + { + return $this->getField($name); + } + + /** + * ArrayAccess: set field to value + * + * @param string $name + * @param mixed $value + * @return void + */ + public function offsetSet($name, $value) + { + $this->setField($name, $value); + } + + /** + * ArrayAccess: remove field from document + * + * @param string $name + * @return void + */ + public function offsetUnset($name) + { + if ($this->offsetExists($name)) { + unset($this->_fields[$name]); + } + } + + /** + * Overloading: retrieve and set fields by name + * + * @param string $name + * @param mixed $args + * @return mixed + */ + public function __call($name, $args) + { + $prefix = substr($name, 0, 3); + if ($prefix == 'get') { + // Get value + $option = substr($name, 3); + return $this->getField($option); + } elseif ($prefix == 'set') { + // set value + $option = substr($name, 3); + return $this->setField($option, $args[0]); + } + + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException("Unknown operation $name"); + } + + /** + * Countable: return count of fields in document + * + * @return int + */ + public function count() + { + return count($this->_fields); + } + + /** + * IteratorAggregate: return iterator for iterating over fields + * + * @return Iterator + */ + public function getIterator() + { + return new ArrayIterator($this->_fields); + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/DocumentSet.php --- a/web/lib/Zend/Cloud/DocumentService/DocumentSet.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/DocumentSet.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -23,7 +23,7 @@ * @category Zend * @package Zend_Cloud * @subpackage DocumentService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cloud_DocumentService_DocumentSet implements Countable, IteratorAggregate @@ -48,7 +48,7 @@ /** * Countable: number of documents in set - * + * * @return int */ public function count() @@ -58,7 +58,7 @@ /** * IteratorAggregate: retrieve iterator - * + * * @return Traversable */ public function getIterator() diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/Exception.php --- a/web/lib/Zend/Cloud/DocumentService/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,38 +1,38 @@ -foo('bar') - * but concrete adapters should be able to recognise it - * - * The call will be iterpreted as clause 'foo' with argument 'bar' - * - * @param string $name Clause/method name - * @param mixed $args - * @return Zend_Cloud_DocumentService_Query - */ - public function __call($name, $args) - { - $this->_clauses[] = array(strtolower($name), $args); - return $this; - } - - /** - * SELECT clause (fields to be selected) - * - * @param null|string|array $select - * @return Zend_Cloud_DocumentService_Query - */ - public function select($select) - { - if (empty($select)) { - return $this; - } - if (!is_string($select) && !is_array($select)) { - require_once 'Zend/Cloud/DocumentService/Exception.php'; - throw new Zend_Cloud_DocumentService_Exception("SELECT argument must be a string or an array of strings"); - } - $this->_clauses[] = array(self::QUERY_SELECT, $select); - return $this; - } - - /** - * FROM clause - * - * @param string $name Field names - * @return Zend_Cloud_DocumentService_Query - */ - public function from($name) - { - if(!is_string($name)) { - require_once 'Zend/Cloud/DocumentService/Exception.php'; - throw new Zend_Cloud_DocumentService_Exception("FROM argument must be a string"); - } - $this->_clauses[] = array(self::QUERY_FROM, $name); - return $this; - } - - /** - * WHERE query - * - * @param string $cond Condition - * @param array $args Arguments to substitute instead of ?'s in condition - * @param string $op relation to other clauses - and/or - * @return Zend_Cloud_DocumentService_Query - */ - public function where($cond, $value = null, $op = 'and') - { - if (!is_string($cond)) { - require_once 'Zend/Cloud/DocumentService/Exception.php'; - throw new Zend_Cloud_DocumentService_Exception("WHERE argument must be a string"); - } - $this->_clauses[] = array(self::QUERY_WHERE, array($cond, $value, $op)); - return $this; - } - - /** - * Select record or fields by ID - * - * @param string|int $value Identifier to select by - * @return Zend_Cloud_DocumentService_Query - */ - public function whereId($value) - { - if (!is_scalar($value)) { - require_once 'Zend/Cloud/DocumentService/Exception.php'; - throw new Zend_Cloud_DocumentService_Exception("WHEREID argument must be a scalar"); - } - $this->_clauses[] = array(self::QUERY_WHEREID, $value); - return $this; - } - - /** - * LIMIT clause (how many items to return) - * - * @param int $limit - * @return Zend_Cloud_DocumentService_Query - */ - public function limit($limit) - { - if ($limit != (int) $limit) { - require_once 'Zend/Cloud/DocumentService/Exception.php'; - throw new Zend_Cloud_DocumentService_Exception("LIMIT argument must be an integer"); - } - $this->_clauses[] = array(self::QUERY_LIMIT, $limit); - return $this; - } - - /** - * ORDER clause; field or fields to sort by, and direction to sort - * - * @param string|int|array $sort - * @param string $direction - * @return Zend_Cloud_DocumentService_Query - */ - public function order($sort, $direction = 'asc') - { - $this->_clauses[] = array(self::QUERY_ORDER, array($sort, $direction)); - return $this; - } - - /** - * "Assemble" the query - * - * Simply returns the clauses present. - * - * @return array - */ - public function assemble() - { - return $this->getClauses(); - } - - /** - * Return query clauses as an array - * - * @return array Clauses in the query - */ - public function getClauses() - { - return $this->_clauses; - } -} +foo('bar') + * but concrete adapters should be able to recognise it + * + * The call will be iterpreted as clause 'foo' with argument 'bar' + * + * @param string $name Clause/method name + * @param mixed $args + * @return Zend_Cloud_DocumentService_Query + */ + public function __call($name, $args) + { + $this->_clauses[] = array(strtolower($name), $args); + return $this; + } + + /** + * SELECT clause (fields to be selected) + * + * @param null|string|array $select + * @return Zend_Cloud_DocumentService_Query + */ + public function select($select) + { + if (empty($select)) { + return $this; + } + if (!is_string($select) && !is_array($select)) { + require_once 'Zend/Cloud/DocumentService/Exception.php'; + throw new Zend_Cloud_DocumentService_Exception("SELECT argument must be a string or an array of strings"); + } + $this->_clauses[] = array(self::QUERY_SELECT, $select); + return $this; + } + + /** + * FROM clause + * + * @param string $name Field names + * @return Zend_Cloud_DocumentService_Query + */ + public function from($name) + { + if(!is_string($name)) { + require_once 'Zend/Cloud/DocumentService/Exception.php'; + throw new Zend_Cloud_DocumentService_Exception("FROM argument must be a string"); + } + $this->_clauses[] = array(self::QUERY_FROM, $name); + return $this; + } + + /** + * WHERE query + * + * @param string $cond Condition + * @param array $args Arguments to substitute instead of ?'s in condition + * @param string $op relation to other clauses - and/or + * @return Zend_Cloud_DocumentService_Query + */ + public function where($cond, $value = null, $op = 'and') + { + if (!is_string($cond)) { + require_once 'Zend/Cloud/DocumentService/Exception.php'; + throw new Zend_Cloud_DocumentService_Exception("WHERE argument must be a string"); + } + $this->_clauses[] = array(self::QUERY_WHERE, array($cond, $value, $op)); + return $this; + } + + /** + * Select record or fields by ID + * + * @param string|int $value Identifier to select by + * @return Zend_Cloud_DocumentService_Query + */ + public function whereId($value) + { + if (!is_scalar($value)) { + require_once 'Zend/Cloud/DocumentService/Exception.php'; + throw new Zend_Cloud_DocumentService_Exception("WHEREID argument must be a scalar"); + } + $this->_clauses[] = array(self::QUERY_WHEREID, $value); + return $this; + } + + /** + * LIMIT clause (how many items to return) + * + * @param int $limit + * @return Zend_Cloud_DocumentService_Query + */ + public function limit($limit) + { + if ($limit != (int) $limit) { + require_once 'Zend/Cloud/DocumentService/Exception.php'; + throw new Zend_Cloud_DocumentService_Exception("LIMIT argument must be an integer"); + } + $this->_clauses[] = array(self::QUERY_LIMIT, $limit); + return $this; + } + + /** + * ORDER clause; field or fields to sort by, and direction to sort + * + * @param string|int|array $sort + * @param string $direction + * @return Zend_Cloud_DocumentService_Query + */ + public function order($sort, $direction = 'asc') + { + $this->_clauses[] = array(self::QUERY_ORDER, array($sort, $direction)); + return $this; + } + + /** + * "Assemble" the query + * + * Simply returns the clauses present. + * + * @return array + */ + public function assemble() + { + return $this->getClauses(); + } + + /** + * Return query clauses as an array + * + * @return array Clauses in the query + */ + public function getClauses() + { + return $this->_clauses; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/DocumentService/QueryAdapter.php --- a/web/lib/Zend/Cloud/DocumentService/QueryAdapter.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/QueryAdapter.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,102 +1,102 @@ -_clientException = $clientException; - parent::__construct($message, $code, $clientException); - } - - public function getClientException() { - return $this->_getPrevious(); - } -} - +_clientException = $clientException; + parent::__construct($message, $code, $clientException); + } + + public function getClientException() { + return $this->_getPrevious(); + } +} + diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/Infrastructure/Adapter.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cloud/Infrastructure/Adapter.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,167 @@ +adapterResult; + } + + /** + * Wait for status $status with a timeout of $timeout seconds + * + * @param string $id + * @param string $status + * @param integer $timeout + * @return boolean + */ + public function waitStatusInstance($id, $status, $timeout = self::TIMEOUT_STATUS_CHANGE) + { + if (empty($id) || empty($status)) { + return false; + } + + $num = 0; + while (($num<$timeout) && ($this->statusInstance($id) != $status)) { + sleep(self::TIME_STEP_STATUS_CHANGE); + $num += self::TIME_STEP_STATUS_CHANGE; + } + return ($num < $timeout); + } + + /** + * Run arbitrary shell script on an instance + * + * @param string $id + * @param array $param + * @param string|array $cmd + * @return string|array + */ + public function deployInstance($id, $params, $cmd) + { + if (!function_exists("ssh2_connect")) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Deployment requires the PHP "SSH" extension (ext/ssh2)'); + } + + if (empty($id)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You must specify the instance where to deploy'); + } + + if (empty($cmd)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You must specify the shell commands to run on the instance'); + } + + if (empty($params) + || empty($params[Zend_Cloud_Infrastructure_Instance::SSH_USERNAME]) + || (empty($params[Zend_Cloud_Infrastructure_Instance::SSH_PASSWORD]) + && empty($params[Zend_Cloud_Infrastructure_Instance::SSH_KEY])) + ) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You must specify the params for the SSH connection'); + } + + $host = $this->publicDnsInstance($id); + if (empty($host)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception(sprintf( + 'The instance identified by "%s" does not exist', + $id + )); + } + + $conn = ssh2_connect($host); + if (!ssh2_auth_password($conn, $params[Zend_Cloud_Infrastructure_Instance::SSH_USERNAME], + $params[Zend_Cloud_Infrastructure_Instance::SSH_PASSWORD])) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('SSH authentication failed'); + } + + if (is_array($cmd)) { + $result = array(); + foreach ($cmd as $command) { + $stream = ssh2_exec($conn, $command); + $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR); + + stream_set_blocking($errorStream, true); + stream_set_blocking($stream, true); + + $output = stream_get_contents($stream); + $error = stream_get_contents($errorStream); + + if (empty($error)) { + $result[$command] = $output; + } else { + $result[$command] = $error; + } + } + } else { + $stream = ssh2_exec($conn, $cmd); + $result = stream_set_blocking($stream, true); + $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR); + + stream_set_blocking($errorStream, true); + stream_set_blocking($stream, true); + + $output = stream_get_contents($stream); + $error = stream_get_contents($errorStream); + + if (empty($error)) { + $result = $output; + } else { + $result = $error; + } + } + return $result; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/Infrastructure/Adapter/Ec2.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cloud/Infrastructure/Adapter/Ec2.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,496 @@ + Zend_Cloud_Infrastructure_Instance::STATUS_RUNNING, + 'terminated' => Zend_Cloud_Infrastructure_Instance::STATUS_TERMINATED, + 'pending' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'shutting-down' => Zend_Cloud_Infrastructure_Instance::STATUS_SHUTTING_DOWN, + 'stopping' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'stopped' => Zend_Cloud_Infrastructure_Instance::STATUS_STOPPED, + 'rebooting' => Zend_Cloud_Infrastructure_Instance::STATUS_REBOOTING, + ); + + /** + * Map monitor metrics between Infrastructure and EC2 + * + * @var array + */ + protected $mapMetrics= array ( + Zend_Cloud_Infrastructure_Instance::MONITOR_CPU => 'CPUUtilization', + Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_READ => 'DiskReadBytes', + Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_WRITE => 'DiskWriteBytes', + Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_IN => 'NetworkIn', + Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_OUT => 'NetworkOut', + ); + + /** + * Constructor + * + * @param array|Zend_Config $options + * @return void + */ + public function __construct($options = array()) + { + if (is_object($options)) { + if (method_exists($options, 'toArray')) { + $options= $options->toArray(); + } elseif ($options instanceof Traversable) { + $options = iterator_to_array($options); + } + } + + if (empty($options) || !is_array($options)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Invalid options provided'); + } + + if (!isset($options[self::AWS_ACCESS_KEY]) + || !isset($options[self::AWS_SECRET_KEY]) + ) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('AWS keys not specified!'); + } + + $this->accessKey = $options[self::AWS_ACCESS_KEY]; + $this->accessSecret = $options[self::AWS_SECRET_KEY]; + $this->region = ''; + + if (isset($options[self::AWS_REGION])) { + $this->region= $options[self::AWS_REGION]; + } + + try { + $this->ec2 = new Zend_Service_Amazon_Ec2_Instance($options[self::AWS_ACCESS_KEY], $options[self::AWS_SECRET_KEY], $this->region); + } catch (Exception $e) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Error on create: ' . $e->getMessage(), $e->getCode(), $e); + } + + if (isset($options[self::HTTP_ADAPTER])) { + $this->ec2->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]); + } + } + + /** + * Convert the attributes of EC2 into attributes of Infrastructure + * + * @param array $attr + * @return array|boolean + */ + private function convertAttributes($attr) + { + $result = array(); + if (!empty($attr) && is_array($attr)) { + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ID] = $attr['instanceId']; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STATUS] = $this->mapStatus[$attr['instanceState']['name']]; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_IMAGEID] = $attr['imageId']; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ZONE] = $attr['availabilityZone']; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_LAUNCHTIME] = $attr['launchTime']; + + switch ($attr['instanceType']) { + case Zend_Service_Amazon_Ec2_Instance::MICRO: + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '1 virtual core'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '613MB'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '0GB'; + break; + case Zend_Service_Amazon_Ec2_Instance::SMALL: + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '1 virtual core'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '1.7GB'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '160GB'; + break; + case Zend_Service_Amazon_Ec2_Instance::LARGE: + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '2 virtual core'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '7.5GB'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '850GB'; + break; + case Zend_Service_Amazon_Ec2_Instance::XLARGE: + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '4 virtual core'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '15GB'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '1690GB'; + break; + case Zend_Service_Amazon_Ec2_Instance::HCPU_MEDIUM: + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '2 virtual core'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '1.7GB'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '350GB'; + break; + case Zend_Service_Amazon_Ec2_Instance::HCPU_XLARGE: + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '8 virtual core'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '7GB'; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '1690GB'; + break; + } + } + return $result; + } + + /** + * Return a list of the available instancies + * + * @return Zend_Cloud_Infrastructure_InstanceList + */ + public function listInstances() + { + $this->adapterResult = $this->ec2->describe(); + + $result = array(); + foreach ($this->adapterResult['instances'] as $instance) { + $result[]= $this->convertAttributes($instance); + } + return new Zend_Cloud_Infrastructure_InstanceList($this, $result); + } + + /** + * Return the status of an instance + * + * @param string + * @return string|boolean + */ + public function statusInstance($id) + { + $this->adapterResult = $this->ec2->describe($id); + if (empty($this->adapterResult['instances'])) { + return false; + } + $result = $this->adapterResult['instances'][0]; + return $this->mapStatus[$result['instanceState']['name']]; + } + + /** + * Return the public DNS name of the instance + * + * @param string $id + * @return string|boolean + */ + public function publicDnsInstance($id) + { + $this->adapterResult = $this->ec2->describe($id); + if (empty($this->adapterResult['instances'])) { + return false; + } + $result = $this->adapterResult['instances'][0]; + return $result['dnsName']; + } + + /** + * Reboot an instance + * + * @param string $id + * @return boolean + */ + public function rebootInstance($id) + { + $this->adapterResult= $this->ec2->reboot($id); + return $this->adapterResult; + } + + /** + * Create a new instance + * + * @param string $name + * @param array $options + * @return Instance|boolean + */ + public function createInstance($name, $options) + { + // @todo instance's name management? + $this->adapterResult = $this->ec2->run($options); + if (empty($this->adapterResult['instances'])) { + return false; + } + $this->error= false; + return new Zend_Cloud_Infrastructure_Instance($this, $this->convertAttributes($this->adapterResult['instances'][0])); + } + + /** + * Stop an instance + * + * @param string $id + * @return boolean + */ + public function stopInstance($id) + { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The stopInstance method is not implemented in the adapter'); + } + + /** + * Start an instance + * + * @param string $id + * @return boolean + */ + public function startInstance($id) + { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The startInstance method is not implemented in the adapter'); + } + + /** + * Destroy an instance + * + * @param string $id + * @return boolean + */ + public function destroyInstance($id) + { + $this->adapterResult = $this->ec2->terminate($id); + return (!empty($this->adapterResult)); + } + + /** + * Return a list of all the available instance images + * + * @return ImageList + */ + public function imagesInstance() + { + if (!isset($this->ec2Image)) { + $this->ec2Image = new Zend_Service_Amazon_Ec2_Image($this->accessKey, $this->accessSecret, $this->region); + } + + $this->adapterResult = $this->ec2Image->describe(); + + $images = array(); + + foreach ($this->adapterResult as $result) { + switch (strtolower($result['platform'])) { + case 'windows' : + $platform = Zend_Cloud_Infrastructure_Image::IMAGE_WINDOWS; + break; + default: + $platform = Zend_Cloud_Infrastructure_Image::IMAGE_LINUX; + break; + } + + $images[]= array ( + Zend_Cloud_Infrastructure_Image::IMAGE_ID => $result['imageId'], + Zend_Cloud_Infrastructure_Image::IMAGE_NAME => '', + Zend_Cloud_Infrastructure_Image::IMAGE_DESCRIPTION => $result['imageLocation'], + Zend_Cloud_Infrastructure_Image::IMAGE_OWNERID => $result['imageOwnerId'], + Zend_Cloud_Infrastructure_Image::IMAGE_ARCHITECTURE => $result['architecture'], + Zend_Cloud_Infrastructure_Image::IMAGE_PLATFORM => $platform, + ); + } + return new Zend_Cloud_Infrastructure_ImageList($images,$this->ec2Image); + } + + /** + * Return all the available zones + * + * @return array + */ + public function zonesInstance() + { + if (!isset($this->ec2Zone)) { + $this->ec2Zone = new Zend_Service_Amazon_Ec2_AvailabilityZones($this->accessKey,$this->accessSecret,$this->region); + } + $this->adapterResult = $this->ec2Zone->describe(); + + $zones = array(); + foreach ($this->adapterResult as $zone) { + if (strtolower($zone['zoneState']) === 'available') { + $zones[] = array ( + Zend_Cloud_Infrastructure_Instance::INSTANCE_ZONE => $zone['zoneName'], + ); + } + } + return $zones; + } + + /** + * Return the system information about the $metric of an instance + * + * @param string $id + * @param string $metric + * @param null|array $options + * @return array + */ + public function monitorInstance($id, $metric, $options = null) + { + if (empty($id) || empty($metric)) { + return false; + } + + if (!in_array($metric,$this->validMetrics)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception(sprintf( + 'The metric "%s" is not valid', + $metric + )); + } + + if (!empty($options) && !is_array($options)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The options must be an array'); + } + + if (!empty($options) + && (empty($options[Zend_Cloud_Infrastructure_Instance::MONITOR_START_TIME]) + || empty($options[Zend_Cloud_Infrastructure_Instance::MONITOR_END_TIME])) + ) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception(sprintf( + 'The options array must contain: "%s" and "%s"', + $options[Zend_Cloud_Infrastructure_Instance::MONITOR_START_TIME], + $options[Zend_Cloud_Infrastructure_Instance::MONITOR_END_TIME] + )); + } + + if (!isset($this->ec2Monitor)) { + $this->ec2Monitor = new Zend_Service_Amazon_Ec2_CloudWatch($this->accessKey, $this->accessSecret, $this->region); + } + + $param = array( + 'MeasureName' => $this->mapMetrics[$metric], + 'Statistics' => array('Average'), + 'Dimensions' => array('InstanceId' => $id), + ); + + if (!empty($options)) { + $param['StartTime'] = $options[Zend_Cloud_Infrastructure_Instance::MONITOR_START_TIME]; + $param['EndTime'] = $options[Zend_Cloud_Infrastructure_Instance::MONITOR_END_TIME]; + } + + $this->adapterResult = $this->ec2Monitor->getMetricStatistics($param); + + $monitor = array(); + $num = 0; + $average = 0; + + if (!empty($this->adapterResult['datapoints'])) { + foreach ($this->adapterResult['datapoints'] as $result) { + $monitor['series'][] = array ( + 'timestamp' => $result['Timestamp'], + 'value' => $result['Average'], + ); + $average += $result['Average']; + $num++; + } + } + + if ($num > 0) { + $monitor['average'] = $average / $num; + } + + return $monitor; + } + + /** + * Get the adapter + * + * @return Zend_Service_Amazon_Ec2_Instance + */ + public function getAdapter() + { + return $this->ec2; + } + + /** + * Get last HTTP request + * + * @return string + */ + public function getLastHttpRequest() + { + return $this->ec2->getHttpClient()->getLastRequest(); + } + + /** + * Get the last HTTP response + * + * @return Zend_Http_Response + */ + public function getLastHttpResponse() + { + return $this->ec2->getHttpClient()->getLastResponse(); + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/Infrastructure/Adapter/Rackspace.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cloud/Infrastructure/Adapter/Rackspace.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,483 @@ + Zend_Cloud_Infrastructure_Instance::STATUS_RUNNING, + 'SUSPENDED' => Zend_Cloud_Infrastructure_Instance::STATUS_STOPPED, + 'BUILD' => Zend_Cloud_Infrastructure_Instance::STATUS_REBUILD, + 'REBUILD' => Zend_Cloud_Infrastructure_Instance::STATUS_REBUILD, + 'QUEUE_RESIZE' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'PREP_RESIZE' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'RESIZE' => Zend_Cloud_Infrastructure_Instance::STATUS_REBUILD, + 'VERIFY_RESIZE' => Zend_Cloud_Infrastructure_Instance::STATUS_REBUILD, + 'PASSWORD' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'RESCUE' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'REBOOT' => Zend_Cloud_Infrastructure_Instance::STATUS_REBOOTING, + 'HARD_REBOOT' => Zend_Cloud_Infrastructure_Instance::STATUS_REBOOTING, + 'SHARE_IP' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'SHARE_IP_NO_CONFIG' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'DELETE_IP' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING, + 'UNKNOWN' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING + ); + /** + * Constructor + * + * @param array|Zend_Config $options + * @return void + */ + public function __construct($options = array()) + { + if (is_object($options)) { + if (method_exists($options, 'toArray')) { + $options= $options->toArray(); + } elseif ($options instanceof Traversable) { + $options = iterator_to_array($options); + } + } + + if (empty($options) || !is_array($options)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Invalid options provided'); + } + + if (!isset($options[self::RACKSPACE_USER])) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Rackspace access user not specified!'); + } + + if (!isset($options[self::RACKSPACE_KEY])) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Rackspace access key not specified!'); + } + + $this->accessUser = $options[self::RACKSPACE_USER]; + $this->accessKey = $options[self::RACKSPACE_KEY]; + + if (isset($options[self::RACKSPACE_REGION])) { + switch ($options[self::RACKSPACE_REGION]) { + case self::RACKSPACE_ZONE_UK: + $this->region= Zend_Service_Rackspace_Servers::UK_AUTH_URL; + break; + case self::RACKSPACE_ZONE_USA: + $this->region = Zend_Service_Rackspace_Servers::US_AUTH_URL; + break; + default: + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The region is not valid'); + } + } else { + $this->region = Zend_Service_Rackspace_Servers::US_AUTH_URL; + } + + try { + $this->rackspace = new Zend_Service_Rackspace_Servers($this->accessUser,$this->accessKey, $this->region); + } catch (Exception $e) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Error on create: ' . $e->getMessage(), $e->getCode(), $e); + } + + if (isset($options[self::HTTP_ADAPTER])) { + $this->rackspace->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]); + } + + } + /** + * Convert the attributes of Rackspace server into attributes of Infrastructure + * + * @param array $attr + * @return array|boolean + */ + protected function convertAttributes($attr) + { + $result = array(); + if (!empty($attr) && is_array($attr)) { + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ID] = $attr['id']; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_NAME] = $attr['name']; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STATUS] = $this->mapStatus[$attr['status']]; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_IMAGEID] = $attr['imageId']; + if ($this->region==Zend_Service_Rackspace_Servers::US_AUTH_URL) { + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ZONE] = self::RACKSPACE_ZONE_USA; + } else { + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ZONE] = self::RACKSPACE_ZONE_UK; + } + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = $this->flavors[$attr['flavorId']]['ram']; + $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = $this->flavors[$attr['flavorId']]['disk']; + } + return $result; + } + /** + * Return a list of the available instancies + * + * @return InstanceList|boolean + */ + public function listInstances() + { + $this->adapterResult = $this->rackspace->listServers(true); + if ($this->adapterResult===false) { + return false; + } + $array= $this->adapterResult->toArray(); + $result = array(); + foreach ($array as $instance) { + $result[]= $this->convertAttributes($instance); + } + return new Zend_Cloud_Infrastructure_InstanceList($this, $result); + } + /** + * Return the status of an instance + * + * @param string + * @return string|boolean + */ + public function statusInstance($id) + { + $this->adapterResult = $this->rackspace->getServer($id); + if ($this->adapterResult===false) { + return false; + } + $array= $this->adapterResult->toArray(); + return $this->mapStatus[$array['status']]; + } + /** + * Return the public DNS name/Ip address of the instance + * + * @param string $id + * @return string|boolean + */ + public function publicDnsInstance($id) + { + $this->adapterResult = $this->rackspace->getServerPublicIp($id); + if (empty($this->adapterResult)) { + return false; + } + return $this->adapterResult[0]; + } + /** + * Reboot an instance + * + * @param string $id + * @return boolean + */ + public function rebootInstance($id) + { + return $this->rackspace->rebootServer($id,true); + } + /** + * Create a new instance + * + * @param string $name + * @param array $options + * @return Instance|boolean + */ + public function createInstance($name, $options) + { + if (empty($name)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You must specify the name of the instance'); + } + if (empty($options) || !is_array($options)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The options must be an array'); + } + // @todo create an generic abstract definition for an instance? + $metadata= array(); + if (isset($options['metadata'])) { + $metadata= $options['metadata']; + unset($options['metadata']); + } + $files= array(); + if (isset($options['files'])) { + $files= $options['files']; + unset($options['files']); + } + $options['name']= $name; + $this->adapterResult = $this->rackspace->createServer($options,$metadata,$files); + if ($this->adapterResult===false) { + return false; + } + return new Zend_Cloud_Infrastructure_Instance($this, $this->convertAttributes($this->adapterResult->toArray())); + } + /** + * Stop an instance + * + * @param string $id + * @return boolean + */ + public function stopInstance($id) + { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The stopInstance method is not implemented in the adapter'); + } + + /** + * Start an instance + * + * @param string $id + * @return boolean + */ + public function startInstance($id) + { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The startInstance method is not implemented in the adapter'); + } + + /** + * Destroy an instance + * + * @param string $id + * @return boolean + */ + public function destroyInstance($id) + { + $this->adapterResult= $this->rackspace->deleteServer($id); + return $this->adapterResult; + } + /** + * Return a list of all the available instance images + * + * @return ImageList|boolean + */ + public function imagesInstance() + { + $this->adapterResult = $this->rackspace->listImages(true); + if ($this->adapterResult===false) { + return false; + } + + $images= $this->adapterResult->toArray(); + $result= array(); + + foreach ($images as $image) { + if (strtolower($image['status'])==='active') { + if (strpos($image['name'],'Windows')!==false) { + $platform = Zend_Cloud_Infrastructure_Image::IMAGE_WINDOWS; + } else { + $platform = Zend_Cloud_Infrastructure_Image::IMAGE_LINUX; + } + if (strpos($image['name'],'x64')!==false) { + $arch = Zend_Cloud_Infrastructure_Image::ARCH_64BIT; + } else { + $arch = Zend_Cloud_Infrastructure_Image::ARCH_32BIT; + } + $result[]= array ( + Zend_Cloud_Infrastructure_Image::IMAGE_ID => $image['id'], + Zend_Cloud_Infrastructure_Image::IMAGE_NAME => $image['name'], + Zend_Cloud_Infrastructure_Image::IMAGE_DESCRIPTION => $image['name'], + Zend_Cloud_Infrastructure_Image::IMAGE_ARCHITECTURE => $arch, + Zend_Cloud_Infrastructure_Image::IMAGE_PLATFORM => $platform, + ); + } + } + return new Zend_Cloud_Infrastructure_ImageList($result,$this->adapterResult); + } + /** + * Return all the available zones + * + * @return array + */ + public function zonesInstance() + { + return array(self::RACKSPACE_ZONE_USA,self::RACKSPACE_ZONE_UK); + } + /** + * Return the system information about the $metric of an instance + * NOTE: it works only for Linux servers + * + * @param string $id + * @param string $metric + * @param null|array $options + * @return array|boolean + */ + public function monitorInstance($id, $metric, $options = null) + { + if (!function_exists("ssh2_connect")) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Monitor requires the PHP "SSH" extension (ext/ssh2)'); + } + if (empty($id)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You must specify the id of the instance to monitor'); + } + if (empty($metric)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You must specify the metric to monitor'); + } + if (!in_array($metric,$this->validMetrics)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception(sprintf('The metric "%s" is not valid', $metric)); + } + if (!empty($options) && !is_array($options)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The options must be an array'); + } + + switch ($metric) { + case Zend_Cloud_Infrastructure_Instance::MONITOR_CPU: + $cmd= 'top -b -n '.self::MONITOR_CPU_SAMPLES.' | grep \'Cpu\''; + break; + case Zend_Cloud_Infrastructure_Instance::MONITOR_RAM: + $cmd= 'top -b -n 1 | grep \'Mem\''; + break; + case Zend_Cloud_Infrastructure_Instance::MONITOR_DISK: + $cmd= 'df --total | grep total'; + break; + } + if (empty($cmd)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('The metric specified is not supported by the adapter'); + } + + $params= array( + Zend_Cloud_Infrastructure_Instance::SSH_USERNAME => $options['username'], + Zend_Cloud_Infrastructure_Instance::SSH_PASSWORD => $options['password'] + ); + $exec_time= time(); + $result= $this->deployInstance($id,$params,$cmd); + + if (empty($result)) { + return false; + } + + $monitor = array(); + $num = 0; + $average = 0; + + $outputs= explode("\n",$result); + foreach ($outputs as $output) { + if (!empty($output)) { + switch ($metric) { + case Zend_Cloud_Infrastructure_Instance::MONITOR_CPU: + if (preg_match('/(\d+\.\d)%us/', $output,$match)) { + $usage = (float) $match[1]; + } + break; + case Zend_Cloud_Infrastructure_Instance::MONITOR_RAM: + if (preg_match('/(\d+)k total/', $output,$match)) { + $total = (integer) $match[1]; + } + if (preg_match('/(\d+)k used/', $output,$match)) { + $used = (integer) $match[1]; + } + if ($total>0) { + $usage= (float) $used/$total; + } + break; + case Zend_Cloud_Infrastructure_Instance::MONITOR_DISK: + if (preg_match('/(\d+)%/', $output,$match)) { + $usage = (float) $match[1]; + } + break; + } + + $monitor['series'][] = array ( + 'timestamp' => $exec_time, + 'value' => number_format($usage,2).'%' + ); + + $average += $usage; + $exec_time+= 60; // seconds + $num++; + } + } + + if ($num>0) { + $monitor['average'] = number_format($average/$num,2).'%'; + } + return $monitor; + } + /** + * Get the adapter + * + * @return Zend_Service_Rackspace_Servers + */ + public function getAdapter() + { + return $this->rackspace; + } + /** + * Get last HTTP request + * + * @return string + */ + public function getLastHttpRequest() + { + return $this->rackspace->getHttpClient()->getLastRequest(); + } + /** + * Get the last HTTP response + * + * @return Zend_Http_Response + */ + public function getLastHttpResponse() + { + return $this->rackspace->getHttpClient()->getLastResponse(); + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/Infrastructure/Exception.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cloud/Infrastructure/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,25 @@ +toArray(); + } elseif ($data instanceof Traversable) { + $data = iterator_to_array($data); + } + } + + if (empty($data) || !is_array($data)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You must pass an array of parameters'); + } + + foreach ($this->attributeRequired as $key) { + if (empty($data[$key])) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception(sprintf( + 'The param "%s" is a required parameter for class %s', + $key, + __CLASS__ + )); + } + } + + $this->attributes = $data; + $this->adapter = $adapter; + } + + /** + * Get Attribute with a specific key + * + * @param array $data + * @return misc|boolean + */ + public function getAttribute($key) + { + if (!empty($this->attributes[$key])) { + return $this->attributes[$key]; + } + return false; + } + + /** + * Get all the attributes + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Get the image ID + * + * @return string + */ + public function getId() + { + return $this->attributes[self::IMAGE_ID]; + } + + /** + * Get the Owner ID + * + * @return string + */ + public function getOwnerId() + { + return $this->attributes[self::IMAGE_OWNERID]; + } + + /** + * Get the name + * + * @return string + */ + public function getName() + { + return $this->attributes[self::IMAGE_NAME]; + } + + /** + * Get the description + * + * @return string + */ + public function getDescription() + { + return $this->attributes[self::IMAGE_DESCRIPTION]; + } + + /** + * Get the platform + * + * @return string + */ + public function getPlatform() + { + return $this->attributes[self::IMAGE_PLATFORM]; + } + + /** + * Get the architecture + * + * @return string + */ + public function getArchitecture() + { + return $this->attributes[self::IMAGE_ARCHITECTURE]; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/Infrastructure/ImageList.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cloud/Infrastructure/ImageList.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,218 @@ +adapter = $adapter; + $this->constructFromArray($images); + } + + /** + * Transforms the Array to array of Instances + * + * @param array $list + * @return void + */ + protected function constructFromArray(array $list) + { + foreach ($list as $image) { + $this->addImage(new Zend_Cloud_Infrastructure_Image($image, $this->adapter)); + } + } + + /** + * Add an image + * + * @param Image + * @return ImageList + */ + protected function addImage(Zend_Cloud_Infrastructure_Image $image) + { + $this->images[] = $image; + return $this; + } + + /** + * Return number of images + * + * Implement Countable::count() + * + * @return int + */ + public function count() + { + return count($this->images); + } + + /** + * Return the current element + * + * Implement Iterator::current() + * + * @return Image + */ + public function current() + { + return $this->images[$this->iteratorKey]; + } + + /** + * Return the key of the current element + * + * Implement Iterator::key() + * + * @return int + */ + public function key() + { + return $this->iteratorKey; + } + + /** + * Move forward to next element + * + * Implement Iterator::next() + * + * @return void + */ + public function next() + { + $this->iteratorKey++; + } + + /** + * Rewind the Iterator to the first element + * + * Implement Iterator::rewind() + * + * @return void + */ + public function rewind() + { + $this->iteratorKey = 0; + } + + /** + * Check if there is a current element after calls to rewind() or next() + * + * Implement Iterator::valid() + * + * @return bool + */ + public function valid() + { + $numItems = $this->count(); + if ($numItems > 0 && $this->iteratorKey < $numItems) { + return true; + } + return false; + } + + /** + * Whether the offset exists + * + * Implement ArrayAccess::offsetExists() + * + * @param int $offset + * @return bool + */ + public function offsetExists($offset) + { + return ($offset < $this->count()); + } + + /** + * Return value at given offset + * + * Implement ArrayAccess::offsetGet() + * + * @param int $offset + * @throws Zend_Cloud_Infrastructure_Exception + * @return Image + */ + public function offsetGet($offset) + { + if (!$this->offsetExists($offset)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Illegal index'); + } + return $this->images[$offset]; + } + + /** + * Throws exception because all values are read-only + * + * Implement ArrayAccess::offsetSet() + * + * @param int $offset + * @param string $value + * @throws Zend_Cloud_Infrastructure_Exception + */ + public function offsetSet($offset, $value) + { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You are trying to set read-only property'); + } + + /** + * Throws exception because all values are read-only + * + * Implement ArrayAccess::offsetUnset() + * + * @param int $offset + * @throws Zend_Cloud_Infrastructure_Exception + */ + public function offsetUnset($offset) + { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You are trying to unset read-only property'); + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/Infrastructure/Instance.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cloud/Infrastructure/Instance.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,320 @@ +toArray(); + } elseif ($data instanceof Traversable) { + $data = iterator_to_array($data); + } + } + + if (empty($data) || !is_array($data)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception("You must pass an array of parameters"); + } + + foreach ($this->attributeRequired as $key) { + if (empty($data[$key])) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception(sprintf( + 'The param "%s" is a required param for %s', + $key, + __CLASS__ + )); + } + } + + $this->adapter = $adapter; + $this->attributes = $data; + } + + /** + * Get Attribute with a specific key + * + * @param array $data + * @return misc|false + */ + public function getAttribute($key) + { + if (!empty($this->attributes[$key])) { + return $this->attributes[$key]; + } + return false; + } + + /** + * Get all the attributes + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Get the instance's id + * + * @return string + */ + public function getId() + { + return $this->attributes[self::INSTANCE_ID]; + } + + /** + * Get the instance's image id + * + * @return string + */ + public function getImageId() + { + return $this->attributes[self::INSTANCE_IMAGEID]; + } + + /** + * Get the instance's name + * + * @return string + */ + public function getName() + { + return $this->attributes[self::INSTANCE_NAME]; + } + + /** + * Get the status of the instance + * + * @return string|boolean + */ + public function getStatus() + { + return $this->adapter->statusInstance($this->attributes[self::INSTANCE_ID]); + } + + /** + * Wait for status $status with a timeout of $timeout seconds + * + * @param string $status + * @param integer $timeout + * @return boolean + */ + public function waitStatus($status, $timeout = Adapter::TIMEOUT_STATUS_CHANGE) + { + return $this->adapter->waitStatusInstance($this->attributes[self::INSTANCE_ID], $status, $timeout); + } + + /** + * Get the public DNS of the instance + * + * @return string + */ + public function getPublicDns() + { + if (!isset($this->attributes[self::INSTANCE_PUBLICDNS])) { + $this->attributes[self::INSTANCE_PUBLICDNS] = $this->adapter->publicDnsInstance($this->attributes[self::INSTANCE_ID]); + } + return $this->attributes[self::INSTANCE_PUBLICDNS]; + } + + /** + * Get the instance's CPU + * + * @return string + */ + public function getCpu() + { + return $this->attributes[self::INSTANCE_CPU]; + } + + /** + * Get the instance's RAM size + * + * @return string + */ + public function getRamSize() + { + return $this->attributes[self::INSTANCE_RAM]; + } + + /** + * Get the instance's storage size + * + * @return string + */ + public function getStorageSize() + { + return $this->attributes[self::INSTANCE_STORAGE]; + } + + /** + * Get the instance's zone + * + * @return string + */ + public function getZone() + { + return $this->attributes[self::INSTANCE_ZONE]; + } + + /** + * Get the instance's launch time + * + * @return string + */ + public function getLaunchTime() + { + return $this->attributes[self::INSTANCE_LAUNCHTIME]; + } + + /** + * Reboot the instance + * + * @return boolean + */ + public function reboot() + { + return $this->adapter->rebootInstance($this->attributes[self::INSTANCE_ID]); + } + + /** + * Stop the instance + * + * @return boolean + */ + public function stop() + { + return $this->adapter->stopInstance($this->attributes[self::INSTANCE_ID]); + } + + /** + * Start the instance + * + * @return boolean + */ + public function start() + { + return $this->adapter->startInstance($this->attributes[self::INSTANCE_ID]); + } + + /** + * Destroy the instance + * + * @return boolean + */ + public function destroy() + { + return $this->adapter->destroyInstance($this->attributes[self::INSTANCE_ID]); + } + + /** + * Return the system informations about the $metric of an instance + * + * @param string $metric + * @param null|array $options + * @return array|boolean + */ + public function monitor($metric, $options = null) + { + return $this->adapter->monitorInstance($this->attributes[self::INSTANCE_ID], $metric, $options); + } + + /** + * Run arbitrary shell script on the instance + * + * @param array $param + * @param string|array $cmd + * @return string|array + */ + public function deploy($params, $cmd) + { + return $this->adapter->deployInstance($this->attributes[self::INSTANCE_ID], $params, $cmd); + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/Infrastructure/InstanceList.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cloud/Infrastructure/InstanceList.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,219 @@ +adapter = $adapter; + $this->constructFromArray($instances); + } + + /** + * Transforms the Array to array of Instances + * + * @param array $list + * @return void + */ + protected function constructFromArray(array $list) + { + foreach ($list as $instance) { + $this->addInstance(new Zend_Cloud_Infrastructure_Instance($this->adapter,$instance)); + } + } + + /** + * Add an instance + * + * @param Instance + * @return InstanceList + */ + protected function addInstance(Zend_Cloud_Infrastructure_Instance $instance) + { + $this->instances[] = $instance; + return $this; + } + + /** + * Return number of instances + * + * Implement Countable::count() + * + * @return int + */ + public function count() + { + return count($this->instances); + } + + /** + * Return the current element + * + * Implement Iterator::current() + * + * @return Instance + */ + public function current() + { + return $this->instances[$this->iteratorKey]; + } + + /** + * Return the key of the current element + * + * Implement Iterator::key() + * + * @return int + */ + public function key() + { + return $this->iteratorKey; + } + + /** + * Move forward to next element + * + * Implement Iterator::next() + * + * @return void + */ + public function next() + { + $this->iteratorKey++; + } + + /** + * Rewind the Iterator to the first element + * + * Implement Iterator::rewind() + * + * @return void + */ + public function rewind() + { + $this->iteratorKey = 0; + } + + /** + * Check if there is a current element after calls to rewind() or next() + * + * Implement Iterator::valid() + * + * @return bool + */ + public function valid() + { + $numItems = $this->count(); + if ($numItems > 0 && $this->iteratorKey < $numItems) { + return true; + } + return false; + } + + /** + * Whether the offset exists + * + * Implement ArrayAccess::offsetExists() + * + * @param int $offset + * @return bool + */ + public function offsetExists($offset) + { + return ($offset < $this->count()); + } + + /** + * Return value at given offset + * + * Implement ArrayAccess::offsetGet() + * + * @param int $offset + * @return Instance + * @throws Zend_Cloud_Infrastructure_Exception + */ + public function offsetGet($offset) + { + if (!$this->offsetExists($offset)) { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('Illegal index'); + } + return $this->instances[$offset]; + } + + /** + * Throws exception because all values are read-only + * + * Implement ArrayAccess::offsetSet() + * + * @param int $offset + * @param string $value + * @throws Zend_Cloud_Infrastructure_Exception + */ + public function offsetSet($offset, $value) + { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You are trying to set read-only property'); + } + + /** + * Throws exception because all values are read-only + * + * Implement ArrayAccess::offsetUnset() + * + * @param int $offset + * @throws Zend_Cloud_Infrastructure_Exception + */ + public function offsetUnset($offset) + { + require_once 'Zend/Cloud/Infrastructure/Exception.php'; + throw new Zend_Cloud_Infrastructure_Exception('You are trying to unset read-only property'); + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/OperationNotAvailableException.php --- a/web/lib/Zend/Cloud/OperationNotAvailableException.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/OperationNotAvailableException.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,34 +1,34 @@ -toArray(); @@ -85,7 +85,7 @@ if(isset($options[self::HTTP_ADAPTER])) { $this->_sqs->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]); - } + } } /** @@ -97,7 +97,7 @@ * @param array $options * @return string Queue ID (typically URL) */ - public function createQueue($name, $options = null) + public function createQueue($name, $options = null) { try { return $this->_sqs->create($name, $options[self::CREATE_TIMEOUT]); @@ -113,7 +113,7 @@ * @param array $options * @return boolean true if successful, false otherwise */ - public function deleteQueue($queueId, $options = null) + public function deleteQueue($queueId, $options = null) { try { return $this->_sqs->delete($queueId); @@ -128,7 +128,7 @@ * @param array $options * @return array Queue IDs */ - public function listQueues($options = null) + public function listQueues($options = null) { try { return $this->_sqs->getQueues(); @@ -144,7 +144,7 @@ * @param array $options * @return array */ - public function fetchQueueMetadata($queueId, $options = null) + public function fetchQueueMetadata($queueId, $options = null) { try { // TODO: ZF-9050 Fix the SQS client library in trunk to return all attribute values @@ -169,7 +169,7 @@ * @param array $options * @return void */ - public function storeQueueMetadata($queueId, $metadata, $options = null) + public function storeQueueMetadata($queueId, $metadata, $options = null) { // TODO Add support for SetQueueAttributes to client library require_once 'Zend/Cloud/OperationNotAvailableException.php'; @@ -184,7 +184,7 @@ * @param array $options * @return string Message ID */ - public function sendMessage($queueId, $message, $options = null) + public function sendMessage($queueId, $message, $options = null) { try { return $this->_sqs->send($queueId, $message); @@ -202,7 +202,7 @@ * @param array $options * @return array */ - public function receiveMessages($queueId, $max = 1, $options = null) + public function receiveMessages($queueId, $max = 1, $options = null) { try { return $this->_makeMessages($this->_sqs->receive($queueId, $max, $options[self::VISIBILITY_TIMEOUT])); @@ -210,11 +210,11 @@ throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Create Zend_Cloud_QueueService_Message array for * Sqs messages. - * + * * @param array $messages * @return Zend_Cloud_QueueService_Message[] */ @@ -237,7 +237,7 @@ * @param array $options * @return void */ - public function deleteMessage($queueId, $message, $options = null) + public function deleteMessage($queueId, $message, $options = null) { try { if($message instanceof Zend_Cloud_QueueService_Message) { @@ -249,7 +249,7 @@ throw new Zend_Cloud_QueueService_Exception('Error on deleting a message: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Peek at the messages from the specified queue without removing them. * @@ -269,7 +269,7 @@ /** * Get SQS implementation - * @return Zend_Service_Amazon_Sqs + * @return Zend_Service_Amazon_Sqs */ public function getClient() { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/QueueService/Adapter/WindowsAzure.php --- a/web/lib/Zend/Cloud/QueueService/Adapter/WindowsAzure.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/QueueService/Adapter/WindowsAzure.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage QueueService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -27,10 +27,10 @@ * @category Zend * @package Zend_Cloud * @subpackage QueueService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Cloud_QueueService_Adapter_WindowsAzure +class Zend_Cloud_QueueService_Adapter_WindowsAzure extends Zend_Cloud_QueueService_Adapter_AbstractAdapter { /** @@ -49,20 +49,20 @@ /** message options */ const MESSAGE_TTL = 'ttl'; - + const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_QUEUE; /** * Storage client - * + * * @var Zend_Service_WindowsAzure_Storage_Queue */ protected $_storageClient = null; - + /** * Constructor - * - * @param array|Zend_Config $options + * + * @param array|Zend_Config $options * @return void */ public function __construct($options = array()) @@ -112,9 +112,9 @@ } catch(Zend_Service_WindowsAzure_Exception $e) { throw new Zend_Cloud_QueueService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e); } - + } - + /** * Create a queue. Returns the ID of the created queue (typically the URL). * It may take some time to create the queue. Check your vendor's @@ -133,7 +133,7 @@ throw new Zend_Cloud_QueueService_Exception('Error on queue creation: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Delete a queue. All messages in the queue will also be deleted. * @@ -152,7 +152,7 @@ throw new Zend_Cloud_QueueService_Exception('Error on queue deletion: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * List all queues. * @@ -177,7 +177,7 @@ throw new Zend_Cloud_QueueService_Exception('Error on listing queues: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Get a key/value array of metadata for the given queue. * @@ -196,12 +196,12 @@ throw new Zend_Cloud_QueueService_Exception('Error on fetching queue metadata: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Store a key/value array of metadata for the specified queue. - * WARNING: This operation overwrites any metadata that is located at + * WARNING: This operation overwrites any metadata that is located at * $destinationPath. Some adapters may not support this method. - * + * * @param string $queueId * @param array $metadata * @param array $options @@ -218,10 +218,10 @@ throw new Zend_Cloud_QueueService_Exception('Error on setting queue metadata: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Send a message to the specified queue. - * + * * @param string $queueId * @param string $message * @param array $options @@ -240,11 +240,11 @@ throw new Zend_Cloud_QueueService_Exception('Error on sending message: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Recieve at most $max messages from the specified queue and return the * message IDs for messages recieved. - * + * * @param string $queueId * @param int $max * @param array $options @@ -266,11 +266,11 @@ throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Create Zend_Cloud_QueueService_Message array for * Azure messages. - * + * * @param array $messages * @return Zend_Cloud_QueueService_Message[] */ @@ -287,9 +287,9 @@ /** * Delete the specified message from the specified queue. - * + * * @param string $queueId - * @param Zend_Cloud_QueueService_Message $message Message ID or message + * @param Zend_Cloud_QueueService_Message $message Message ID or message * @param array $options * @return void */ @@ -331,10 +331,10 @@ throw new Zend_Cloud_QueueService_Exception('Error on peeking messages: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Get Azure implementation - * @return Zend_Service_Azure_Storage_Queue + * @return Zend_Service_Azure_Storage_Queue */ public function getClient() { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/QueueService/Adapter/ZendQueue.php --- a/web/lib/Zend/Cloud/QueueService/Adapter/ZendQueue.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/QueueService/Adapter/ZendQueue.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage QueueService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -27,33 +27,33 @@ * @category Zend * @package Zend_Cloud * @subpackage QueueService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Cloud_QueueService_Adapter_ZendQueue +class Zend_Cloud_QueueService_Adapter_ZendQueue extends Zend_Cloud_QueueService_Adapter_AbstractAdapter { /** * Options array keys for the Zend_Queue adapter. */ const ADAPTER = 'adapter'; - + /** * Storage client - * + * * @var Zend_Queue */ protected $_queue = null; - + /** * @var array All queues */ protected $_queues = array(); - + /** * Constructor - * - * @param array|Zend_Config $options + * + * @param array|Zend_Config $options * @return void */ public function __construct ($options = array()) @@ -87,7 +87,7 @@ throw new Zend_Cloud_QueueService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Create a queue. Returns the ID of the created queue (typically the URL). * It may take some time to create the queue. Check your vendor's @@ -106,7 +106,7 @@ throw new Zend_Cloud_QueueService_Exception('Error on queue creation: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Delete a queue. All messages in the queue will also be deleted. * @@ -128,7 +128,7 @@ throw new Zend_Cloud_QueueService_Exception('Error on queue deletion: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * List all queues. * @@ -143,7 +143,7 @@ throw new Zend_Cloud_QueueService_Exception('Error on listing queues: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Get a key/value array of metadata for the given queue. * @@ -162,12 +162,12 @@ throw new Zend_Cloud_QueueService_Exception('Error on fetching queue metadata: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Store a key/value array of metadata for the specified queue. - * WARNING: This operation overwrites any metadata that is located at + * WARNING: This operation overwrites any metadata that is located at * $destinationPath. Some adapters may not support this method. - * + * * @param string $queueId * @param array $metadata * @param array $options @@ -184,10 +184,10 @@ throw new Zend_Cloud_QueueService_Exception('Error on setting queue metadata: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Send a message to the specified queue. - * + * * @param string $queueId * @param string $message * @param array $options @@ -204,11 +204,11 @@ throw new Zend_Cloud_QueueService_Exception('Error on sending message: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Recieve at most $max messages from the specified queue and return the * message IDs for messages recieved. - * + * * @param string $queueId * @param int $max * @param array $options @@ -230,11 +230,11 @@ throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Create Zend_Cloud_QueueService_Message array for * Azure messages. - * + * * @param array $messages * @return Zend_Cloud_QueueService_Message[] */ @@ -248,12 +248,12 @@ } return new $setClass($result); } - + /** * Delete the specified message from the specified queue. - * + * * @param string $queueId - * @param Zend_Cloud_QueueService_Message $message Message ID or message + * @param Zend_Cloud_QueueService_Message $message Message ID or message * @param array $options * @return void */ @@ -269,13 +269,13 @@ if (!($message instanceof Zend_Queue_Message)) { throw new Zend_Cloud_QueueService_Exception('Cannot delete the message: Zend_Queue_Message object required'); } - + return $this->_queues[$queueId]->deleteMessage($message); } catch (Zend_Queue_Exception $e) { throw new Zend_Cloud_QueueService_Exception('Error on deleting a message: '.$e->getMessage(), $e->getCode(), $e); } } - + /** * Peek at the messages from the specified queue without removing them. * @@ -289,10 +289,10 @@ require_once 'Zend/Cloud/OperationNotAvailableException.php'; throw new Zend_Cloud_OperationNotAvailableException('ZendQueue doesn\'t currently support message peeking'); } - + /** * Get Azure implementation - * @return Zend_Queue + * @return Zend_Queue */ public function getClient() { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/QueueService/Exception.php --- a/web/lib/Zend/Cloud/QueueService/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/QueueService/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,37 +1,37 @@ -_body = $body; - $this->_clientMessage = $message; - } - - /** - * Get the message body - * @return string - */ - public function getBody() - { - return $this->_body; - } - - /** - * Get the original adapter-specific message - */ - public function getMessage() - { - return $this->_clientMessage; - } -} +_body = $body; + $this->_clientMessage = $message; + } + + /** + * Get the message body + * @return string + */ + public function getBody() + { + return $this->_body; + } + + /** + * Get the original adapter-specific message + */ + public function getMessage() + { + return $this->_clientMessage; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/QueueService/MessageSet.php --- a/web/lib/Zend/Cloud/QueueService/MessageSet.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/QueueService/MessageSet.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage QueueService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -23,7 +23,7 @@ * @category Zend * @package Zend_Cloud * @subpackage QueueService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate @@ -36,8 +36,8 @@ /** * Constructor - * - * @param array $messages + * + * @param array $messages * @return void */ public function __construct(array $messages) @@ -48,7 +48,7 @@ /** * Countable: number of messages in collection - * + * * @return int */ public function count() @@ -58,7 +58,7 @@ /** * IteratorAggregate: return iterable object - * + * * @return Traversable */ public function getIterator() diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/StorageService/Adapter.php --- a/web/lib/Zend/Cloud/StorageService/Adapter.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/StorageService/Adapter.php Fri Mar 22 10:47:04 2013 +0100 @@ -13,7 +13,7 @@ * @category Zend * @package Zend_Cloud * @subpackage StorageService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -23,7 +23,7 @@ * @category Zend * @package Zend_Cloud * @subpackage StorageService - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Cloud_StorageService_Adapter @@ -39,10 +39,10 @@ * @return mixed */ public function fetchItem($path, $options = null); - + /** * Store an item in the storage service. - * WARNING: This operation overwrites any item that is located at + * WARNING: This operation overwrites any item that is located at * $destinationPath. * @param string $destinationPath * @param mixed $data @@ -52,7 +52,7 @@ public function storeItem($destinationPath, $data, $options = null); - + /** * Delete an item in the storage service. * @@ -61,10 +61,10 @@ * @return void */ public function deleteItem($path, $options = null); - + /** * Copy an item in the storage service to a given path. - * + * * The $destinationPath must be a directory. * * @param string $sourcePath @@ -73,10 +73,10 @@ * @return void */ public function copyItem($sourcePath, $destinationPath, $options = null); - + /** * Move an item in the storage service to a given path. - * + * * The $destinationPath must be a directory. * * @param string $sourcePath @@ -85,7 +85,7 @@ * @return void */ public function moveItem($sourcePath, $destinationPath, $options = null); - + /** * Rename an item in the storage service to a given name. * @@ -96,10 +96,10 @@ * @return void */ public function renameItem($path, $name, $options = null); - + /** * List items in the given directory in the storage service - * + * * The $path must be a directory * * @@ -108,7 +108,7 @@ * @return array A list of item names */ public function listItems($path, $options = null); - + /** * Get a key/value array of metadata for the given path. * @@ -117,10 +117,10 @@ * @return array */ public function fetchMetadata($path, $options = null); - + /** * Store a key/value array of metadata at the given path. - * WARNING: This operation overwrites any metadata that is located at + * WARNING: This operation overwrites any metadata that is located at * $destinationPath. * * @param string $destinationPath @@ -128,7 +128,7 @@ * @return void */ public function storeMetadata($destinationPath, $metadata, $options = null); - + /** * Delete a key/value array of metadata at the given path. * diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/StorageService/Adapter/FileSystem.php --- a/web/lib/Zend/Cloud/StorageService/Adapter/FileSystem.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/StorageService/Adapter/FileSystem.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,267 +1,267 @@ -toArray(); - } - - if (!is_array($options)) { - throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); - } - - if (isset($options[self::LOCAL_DIRECTORY])) { - $this->_directory = $options[self::LOCAL_DIRECTORY]; - } else { - $this->_directory = realpath(sys_get_temp_dir()); - } - } - - /** - * Get an item from the storage service. - * - * TODO: Support streaming - * - * @param string $path - * @param array $options - * @return false|string - */ - public function fetchItem($path, $options = array()) - { - $filepath = $this->_getFullPath($path); - $path = realpath($filepath); - - if (!$path) { - return false; - } - - return file_get_contents($path); - } - - /** - * Store an item in the storage service. - * - * WARNING: This operation overwrites any item that is located at - * $destinationPath. - * - * @TODO Support streams - * - * @param string $destinationPath - * @param mixed $data - * @param array $options - * @return void - */ - public function storeItem($destinationPath, $data, $options = array()) - { - $path = $this->_getFullPath($destinationPath); - file_put_contents($path, $data); - chmod($path, 0777); - } - - /** - * Delete an item in the storage service. - * - * @param string $path - * @param array $options - * @return void - */ - public function deleteItem($path, $options = array()) - { - if (!isset($path)) { - return; - } - - $filepath = $this->_getFullPath($path); - if (file_exists($filepath)) { - unlink($filepath); - } - } - - /** - * Copy an item in the storage service to a given path. - * - * WARNING: This operation is *very* expensive for services that do not - * support copying an item natively. - * - * @TODO Support streams for those services that don't support natively - * - * @param string $sourcePath - * @param string $destination path - * @param array $options - * @return void - */ - public function copyItem($sourcePath, $destinationPath, $options = array()) - { - copy($this->_getFullPath($sourcePath), $this->_getFullPath($destinationPath)); - } - - /** - * Move an item in the storage service to a given path. - * - * WARNING: This operation is *very* expensive for services that do not - * support moving an item natively. - * - * @TODO Support streams for those services that don't support natively - * - * @param string $sourcePath - * @param string $destination path - * @param array $options - * @return void - */ - public function moveItem($sourcePath, $destinationPath, $options = array()) - { - rename($this->_getFullPath($sourcePath), $this->_getFullPath($destinationPath)); - } - - /** - * Rename an item in the storage service to a given name. - * - * - * @param string $path - * @param string $name - * @param array $options - * @return void - */ - public function renameItem($path, $name, $options = null) - { - rename( - $this->_getFullPath($path), - dirname($this->_getFullPath($path)) . DIRECTORY_SEPARATOR . $name - ); - } - - /** - * List items in the given directory in the storage service - * - * The $path must be a directory - * - * - * @param string $path Must be a directory - * @param array $options - * @return array A list of item names - */ - public function listItems($path, $options = null) - { - $listing = scandir($this->_getFullPath($path)); - - // Remove the hidden navigation directories - $listing = array_diff($listing, array('.', '..')); - - return $listing; - } - - /** - * Get a key/value array of metadata for the given path. - * - * @param string $path - * @param array $options - * @return array - */ - public function fetchMetadata($path, $options = array()) - { - $fullPath = $this->_getFullPath($path); - $metadata = null; - if (file_exists($fullPath)) { - $metadata = stat(realpath($fullPath)); - } - - return isset($metadata) ? $metadata : false; - } - - /** - * Store a key/value array of metadata at the given path. - * WARNING: This operation overwrites any metadata that is located at - * $destinationPath. - * - * @param string $destinationPath - * @param array $options - * @return void - */ - public function storeMetadata($destinationPath, $metadata, $options = array()) - { - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException('Storing metadata not implemented'); - } - - /** - * Delete a key/value array of metadata at the given path. - * - * @param string $path - * @param array $options - * @return void - */ - public function deleteMetadata($path) - { - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException('Deleting metadata not implemented'); - } - - /** - * Return the full path for the file. - * - * @param string $path - * @return string - */ - private function _getFullPath($path) - { - return $this->_directory . DIRECTORY_SEPARATOR . $path; - } - - /** - * Get the concrete client. - * @return strings - */ - public function getClient() - { - return $this->_directory; - } -} +toArray(); + } + + if (!is_array($options)) { + throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); + } + + if (isset($options[self::LOCAL_DIRECTORY])) { + $this->_directory = $options[self::LOCAL_DIRECTORY]; + } else { + $this->_directory = realpath(sys_get_temp_dir()); + } + } + + /** + * Get an item from the storage service. + * + * TODO: Support streaming + * + * @param string $path + * @param array $options + * @return false|string + */ + public function fetchItem($path, $options = array()) + { + $filepath = $this->_getFullPath($path); + $path = realpath($filepath); + + if (!$path || !file_exists($path)) { + return false; + } + + return file_get_contents($path); + } + + /** + * Store an item in the storage service. + * + * WARNING: This operation overwrites any item that is located at + * $destinationPath. + * + * @TODO Support streams + * + * @param string $destinationPath + * @param mixed $data + * @param array $options + * @return void + */ + public function storeItem($destinationPath, $data, $options = array()) + { + $path = $this->_getFullPath($destinationPath); + file_put_contents($path, $data); + chmod($path, 0777); + } + + /** + * Delete an item in the storage service. + * + * @param string $path + * @param array $options + * @return void + */ + public function deleteItem($path, $options = array()) + { + if (!isset($path)) { + return; + } + + $filepath = $this->_getFullPath($path); + if (file_exists($filepath)) { + unlink($filepath); + } + } + + /** + * Copy an item in the storage service to a given path. + * + * WARNING: This operation is *very* expensive for services that do not + * support copying an item natively. + * + * @TODO Support streams for those services that don't support natively + * + * @param string $sourcePath + * @param string $destination path + * @param array $options + * @return void + */ + public function copyItem($sourcePath, $destinationPath, $options = array()) + { + copy($this->_getFullPath($sourcePath), $this->_getFullPath($destinationPath)); + } + + /** + * Move an item in the storage service to a given path. + * + * WARNING: This operation is *very* expensive for services that do not + * support moving an item natively. + * + * @TODO Support streams for those services that don't support natively + * + * @param string $sourcePath + * @param string $destination path + * @param array $options + * @return void + */ + public function moveItem($sourcePath, $destinationPath, $options = array()) + { + rename($this->_getFullPath($sourcePath), $this->_getFullPath($destinationPath)); + } + + /** + * Rename an item in the storage service to a given name. + * + * + * @param string $path + * @param string $name + * @param array $options + * @return void + */ + public function renameItem($path, $name, $options = null) + { + rename( + $this->_getFullPath($path), + dirname($this->_getFullPath($path)) . DIRECTORY_SEPARATOR . $name + ); + } + + /** + * List items in the given directory in the storage service + * + * The $path must be a directory + * + * + * @param string $path Must be a directory + * @param array $options + * @return array A list of item names + */ + public function listItems($path, $options = null) + { + $listing = scandir($this->_getFullPath($path)); + + // Remove the hidden navigation directories + $listing = array_diff($listing, array('.', '..')); + + return $listing; + } + + /** + * Get a key/value array of metadata for the given path. + * + * @param string $path + * @param array $options + * @return array + */ + public function fetchMetadata($path, $options = array()) + { + $fullPath = $this->_getFullPath($path); + $metadata = null; + if (file_exists($fullPath)) { + $metadata = stat(realpath($fullPath)); + } + + return isset($metadata) ? $metadata : false; + } + + /** + * Store a key/value array of metadata at the given path. + * WARNING: This operation overwrites any metadata that is located at + * $destinationPath. + * + * @param string $destinationPath + * @param array $options + * @return void + */ + public function storeMetadata($destinationPath, $metadata, $options = array()) + { + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException('Storing metadata not implemented'); + } + + /** + * Delete a key/value array of metadata at the given path. + * + * @param string $path + * @param array $options + * @return void + */ + public function deleteMetadata($path) + { + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException('Deleting metadata not implemented'); + } + + /** + * Return the full path for the file. + * + * @param string $path + * @return string + */ + private function _getFullPath($path) + { + return $this->_directory . DIRECTORY_SEPARATOR . $path; + } + + /** + * Get the concrete client. + * @return strings + */ + public function getClient() + { + return $this->_directory; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php --- a/web/lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,399 +1,399 @@ -toArray(); - } - - if (!is_array($options)) { - throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); - } - - $auth = array( - 'username' => $options[self::USERNAME], - 'password' => $options[self::PASSWORD], - 'appKey' => $options[self::APP_KEY], - ); - $nirvanix_options = array(); - if (isset($options[self::HTTP_ADAPTER])) { - $httpc = new Zend_Http_Client(); - $httpc->setAdapter($options[self::HTTP_ADAPTER]); - $nirvanix_options['httpClient'] = $httpc; - } - try { - $this->_nirvanix = new Zend_Service_Nirvanix($auth, $nirvanix_options); - $this->_remoteDirectory = $options[self::REMOTE_DIRECTORY]; - $this->_imfNs = $this->_nirvanix->getService('IMFS'); - $this->_metadataNs = $this->_nirvanix->getService('Metadata'); - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Get an item from the storage service. - * - * @param string $path - * @param array $options - * @return mixed - */ - public function fetchItem($path, $options = null) - { - $path = $this->_getFullPath($path); - try { - $item = $this->_imfNs->getContents($path); - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); - } - return $item; - } - - /** - * Store an item in the storage service. - * WARNING: This operation overwrites any item that is located at - * $destinationPath. - * @param string $destinationPath - * @param mixed $data - * @param array $options - * @return void - */ - public function storeItem($destinationPath, $data, $options = null) - { - try { - $path = $this->_getFullPath($destinationPath); - $this->_imfNs->putContents($path, $data); - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e); - } - return true; - } - - /** - * Delete an item in the storage service. - * - * @param string $path - * @param array $options - * @return void - */ - public function deleteItem($path, $options = null) - { - try { - $path = $this->_getFullPath($path); - $this->_imfNs->unlink($path); - } catch(Zend_Service_Nirvanix_Exception $e) { -// if (trim(strtoupper($e->getMessage())) != 'INVALID PATH') { -// // TODO Differentiate among errors in the Nirvanix adapter - throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Copy an item in the storage service to a given path. - * WARNING: This operation is *very* expensive for services that do not - * support copying an item natively. - * - * @param string $sourcePath - * @param string $destination path - * @param array $options - * @return void - */ - public function copyItem($sourcePath, $destinationPath, $options = null) - { - try { - $sourcePath = $this->_getFullPath($sourcePath); - $destinationPath = $this->_getFullPath($destinationPath); - $this->_imfNs->CopyFiles(array('srcFilePath' => $sourcePath, - 'destFolderPath' => $destinationPath)); - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Move an item in the storage service to a given path. - * WARNING: This operation is *very* expensive for services that do not - * support moving an item natively. - * - * @param string $sourcePath - * @param string $destination path - * @param array $options - * @return void - */ - public function moveItem($sourcePath, $destinationPath, $options = null) - { - try { - $sourcePath = $this->_getFullPath($sourcePath); - $destinationPath = $this->_getFullPath($destinationPath); - $this->_imfNs->RenameFile(array('filePath' => $sourcePath, - 'newFileName' => $destinationPath)); - // $this->_imfNs->MoveFiles(array('srcFilePath' => $sourcePath, - // 'destFolderPath' => $destinationPath)); - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Rename an item in the storage service to a given name. - * - * - * @param string $path - * @param string $name - * @param array $options - * @return void - */ - public function renameItem($path, $name, $options = null) - { - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException('Renaming not implemented'); - } - - /** - * Get a key/value array of metadata for the given path. - * - * @param string $path - * @param array $options - * @return array An associative array of key/value pairs specifying the metadata for this object. - * If no metadata exists, an empty array is returned. - */ - public function fetchMetadata($path, $options = null) - { - $path = $this->_getFullPath($path); - try { - $metadataNode = $this->_metadataNs->getMetadata(array('path' => $path)); - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on fetching metadata: '.$e->getMessage(), $e->getCode(), $e); - } - - $metadata = array(); - $length = count($metadataNode->Metadata); - - // Need to special case this as Nirvanix returns an array if there is - // more than one, but doesn't return an array if there is only one. - if ($length == 1) - { - $metadata[(string)$metadataNode->Metadata->Type->value] = (string)$metadataNode->Metadata->Value; - } - else if ($length > 1) - { - for ($i=0; $i<$length; $i++) - { - $metadata[(string)$metadataNode->Metadata[$i]->Type] = (string)$metadataNode->Metadata[$i]->Value; - } - } - return $metadata; - } - - /** - * Store a key/value array of metadata at the given path. - * WARNING: This operation overwrites any metadata that is located at - * $destinationPath. - * - * @param array $metadata - An associative array specifying the key/value pairs for the metadata. - * @param $destinationPath - * @param array $options - * @return void - */ - public function storeMetadata($destinationPath, $metadata, $options = null) - { - $destinationPath = $this->_getFullPath($destinationPath); - if ($metadata != null) { - try { - foreach ($metadata AS $key=>$value) { - $metadataString = $key . ":" . $value; - $this->_metadataNs->SetMetadata(array( - 'path' => $destinationPath, - 'metadata' => $metadataString, - )); - } - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on storing metadata: '.$e->getMessage(), $e->getCode(), $e); - } - } - } - - /** - * Delete a key/value array of metadata at the given path. - * - * @param string $path - * @param array $metadata - An associative array specifying the key/value pairs for the metadata - * to be deleted. If null, all metadata associated with the object will - * be deleted. - * @param array $options - * @return void - */ - public function deleteMetadata($path, $metadata = null, $options = null) - { - $path = $this->_getFullPath($path); - try { - if ($metadata == null) { - $this->_metadataNs->DeleteAllMetadata(array('path' => $path)); - } else { - foreach ($metadata AS $key=>$value) { - $this->_metadataNs->DeleteMetadata(array( - 'path' => $path, - 'metadata' => $key, - )); - } - } - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on deleting metadata: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /* - * Recursively traverse all the folders and build an array that contains - * the path names for each folder. - * - * @param $path - The folder path to get the list of folders from. - * @param &$resultArray - reference to the array that contains the path names - * for each folder. - */ - private function getAllFolders($path, &$resultArray) - { - $response = $this->_imfNs->ListFolder(array( - 'folderPath' => $path, - 'pageNumber' => 1, - 'pageSize' => $this->maxPageSize, - )); - $numFolders = $response->ListFolder->TotalFolderCount; - if ($numFolders == 0) { - return; - } else { - //Need to special case this as Nirvanix returns an array if there is - //more than one, but doesn't return an array if there is only one. - if ($numFolders == 1) { - $folderPath = $response->ListFolder->Folder->Path; - array_push($resultArray, $folderPath); - $this->getAllFolders('/' . $folderPath, $resultArray); - } else { - foreach ($response->ListFolder->Folder as $arrayElem) { - $folderPath = $arrayElem->Path; - array_push($resultArray, $folderPath); - $this->getAllFolders('/' . $folderPath, $resultArray); - } - } - } - } - - /** - * Return an array of the items contained in the given path. The items - * returned are the files or objects that in the specified path. - * - * @param string $path - * @param array $options - * @return array - */ - public function listItems($path, $options = null) - { - $path = $this->_getFullPath($path); - $resultArray = array(); - - if (!isset($path)) { - return false; - } else { - try { - $response = $this->_imfNs->ListFolder(array( - 'folderPath' => $path, - 'pageNumber' => 1, - 'pageSize' => $this->maxPageSize, - )); - } catch (Zend_Service_Nirvanix_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e); - } - - $numFiles = $response->ListFolder->TotalFileCount; - - //Add the file names to the array - if ($numFiles != 0) { - //Need to special case this as Nirvanix returns an array if there is - //more than one, but doesn't return an array if there is only one. - if ($numFiles == 1) { - $resultArray[] = (string)$response->ListFolder->File->Name; - } - else { - foreach ($response->ListFolder->File as $arrayElem) { - $resultArray[] = (string) $arrayElem->Name; - } - } - } - } - - return $resultArray; - } - - /** - * Get full path to an object - * - * @param string $path - * @return string - */ - private function _getFullPath($path) - { - return $this->_remoteDirectory . $path; - } - - /** - * Get the concrete client. - * @return Zend_Service_Nirvanix - */ - public function getClient() - { - return $this->_nirvanix; - } -} +toArray(); + } + + if (!is_array($options)) { + throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); + } + + $auth = array( + 'username' => $options[self::USERNAME], + 'password' => $options[self::PASSWORD], + 'appKey' => $options[self::APP_KEY], + ); + $nirvanix_options = array(); + if (isset($options[self::HTTP_ADAPTER])) { + $httpc = new Zend_Http_Client(); + $httpc->setAdapter($options[self::HTTP_ADAPTER]); + $nirvanix_options['httpClient'] = $httpc; + } + try { + $this->_nirvanix = new Zend_Service_Nirvanix($auth, $nirvanix_options); + $this->_remoteDirectory = $options[self::REMOTE_DIRECTORY]; + $this->_imfNs = $this->_nirvanix->getService('IMFS'); + $this->_metadataNs = $this->_nirvanix->getService('Metadata'); + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Get an item from the storage service. + * + * @param string $path + * @param array $options + * @return mixed + */ + public function fetchItem($path, $options = null) + { + $path = $this->_getFullPath($path); + try { + $item = $this->_imfNs->getContents($path); + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); + } + return $item; + } + + /** + * Store an item in the storage service. + * WARNING: This operation overwrites any item that is located at + * $destinationPath. + * @param string $destinationPath + * @param mixed $data + * @param array $options + * @return void + */ + public function storeItem($destinationPath, $data, $options = null) + { + try { + $path = $this->_getFullPath($destinationPath); + $this->_imfNs->putContents($path, $data); + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e); + } + return true; + } + + /** + * Delete an item in the storage service. + * + * @param string $path + * @param array $options + * @return void + */ + public function deleteItem($path, $options = null) + { + try { + $path = $this->_getFullPath($path); + $this->_imfNs->unlink($path); + } catch(Zend_Service_Nirvanix_Exception $e) { +// if (trim(strtoupper($e->getMessage())) != 'INVALID PATH') { +// // TODO Differentiate among errors in the Nirvanix adapter + throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Copy an item in the storage service to a given path. + * WARNING: This operation is *very* expensive for services that do not + * support copying an item natively. + * + * @param string $sourcePath + * @param string $destination path + * @param array $options + * @return void + */ + public function copyItem($sourcePath, $destinationPath, $options = null) + { + try { + $sourcePath = $this->_getFullPath($sourcePath); + $destinationPath = $this->_getFullPath($destinationPath); + $this->_imfNs->CopyFiles(array('srcFilePath' => $sourcePath, + 'destFolderPath' => $destinationPath)); + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Move an item in the storage service to a given path. + * WARNING: This operation is *very* expensive for services that do not + * support moving an item natively. + * + * @param string $sourcePath + * @param string $destination path + * @param array $options + * @return void + */ + public function moveItem($sourcePath, $destinationPath, $options = null) + { + try { + $sourcePath = $this->_getFullPath($sourcePath); + $destinationPath = $this->_getFullPath($destinationPath); + $this->_imfNs->RenameFile(array('filePath' => $sourcePath, + 'newFileName' => $destinationPath)); + // $this->_imfNs->MoveFiles(array('srcFilePath' => $sourcePath, + // 'destFolderPath' => $destinationPath)); + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Rename an item in the storage service to a given name. + * + * + * @param string $path + * @param string $name + * @param array $options + * @return void + */ + public function renameItem($path, $name, $options = null) + { + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException('Renaming not implemented'); + } + + /** + * Get a key/value array of metadata for the given path. + * + * @param string $path + * @param array $options + * @return array An associative array of key/value pairs specifying the metadata for this object. + * If no metadata exists, an empty array is returned. + */ + public function fetchMetadata($path, $options = null) + { + $path = $this->_getFullPath($path); + try { + $metadataNode = $this->_metadataNs->getMetadata(array('path' => $path)); + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on fetching metadata: '.$e->getMessage(), $e->getCode(), $e); + } + + $metadata = array(); + $length = count($metadataNode->Metadata); + + // Need to special case this as Nirvanix returns an array if there is + // more than one, but doesn't return an array if there is only one. + if ($length == 1) + { + $metadata[(string)$metadataNode->Metadata->Type->value] = (string)$metadataNode->Metadata->Value; + } + else if ($length > 1) + { + for ($i=0; $i<$length; $i++) + { + $metadata[(string)$metadataNode->Metadata[$i]->Type] = (string)$metadataNode->Metadata[$i]->Value; + } + } + return $metadata; + } + + /** + * Store a key/value array of metadata at the given path. + * WARNING: This operation overwrites any metadata that is located at + * $destinationPath. + * + * @param string $destinationPath + * @param array $metadata associative array specifying the key/value pairs for the metadata. + * @param array $options + * @return void + */ + public function storeMetadata($destinationPath, $metadata, $options = null) + { + $destinationPath = $this->_getFullPath($destinationPath); + if ($metadata != null) { + try { + foreach ($metadata AS $key=>$value) { + $metadataString = $key . ":" . $value; + $this->_metadataNs->SetMetadata(array( + 'path' => $destinationPath, + 'metadata' => $metadataString, + )); + } + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on storing metadata: '.$e->getMessage(), $e->getCode(), $e); + } + } + } + + /** + * Delete a key/value array of metadata at the given path. + * + * @param string $path + * @param array $metadata - An associative array specifying the key/value pairs for the metadata + * to be deleted. If null, all metadata associated with the object will + * be deleted. + * @param array $options + * @return void + */ + public function deleteMetadata($path, $metadata = null, $options = null) + { + $path = $this->_getFullPath($path); + try { + if ($metadata == null) { + $this->_metadataNs->DeleteAllMetadata(array('path' => $path)); + } else { + foreach ($metadata AS $key=>$value) { + $this->_metadataNs->DeleteMetadata(array( + 'path' => $path, + 'metadata' => $key, + )); + } + } + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on deleting metadata: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /* + * Recursively traverse all the folders and build an array that contains + * the path names for each folder. + * + * @param string $path folder path to get the list of folders from. + * @param array& $resultArray reference to the array that contains the path names + * for each folder. + */ + private function getAllFolders($path, &$resultArray) + { + $response = $this->_imfNs->ListFolder(array( + 'folderPath' => $path, + 'pageNumber' => 1, + 'pageSize' => $this->maxPageSize, + )); + $numFolders = $response->ListFolder->TotalFolderCount; + if ($numFolders == 0) { + return; + } else { + //Need to special case this as Nirvanix returns an array if there is + //more than one, but doesn't return an array if there is only one. + if ($numFolders == 1) { + $folderPath = $response->ListFolder->Folder->Path; + array_push($resultArray, $folderPath); + $this->getAllFolders('/' . $folderPath, $resultArray); + } else { + foreach ($response->ListFolder->Folder as $arrayElem) { + $folderPath = $arrayElem->Path; + array_push($resultArray, $folderPath); + $this->getAllFolders('/' . $folderPath, $resultArray); + } + } + } + } + + /** + * Return an array of the items contained in the given path. The items + * returned are the files or objects that in the specified path. + * + * @param string $path + * @param array $options + * @return array + */ + public function listItems($path, $options = null) + { + $path = $this->_getFullPath($path); + $resultArray = array(); + + if (!isset($path)) { + return false; + } else { + try { + $response = $this->_imfNs->ListFolder(array( + 'folderPath' => $path, + 'pageNumber' => 1, + 'pageSize' => $this->maxPageSize, + )); + } catch (Zend_Service_Nirvanix_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e); + } + + $numFiles = $response->ListFolder->TotalFileCount; + + //Add the file names to the array + if ($numFiles != 0) { + //Need to special case this as Nirvanix returns an array if there is + //more than one, but doesn't return an array if there is only one. + if ($numFiles == 1) { + $resultArray[] = (string)$response->ListFolder->File->Name; + } + else { + foreach ($response->ListFolder->File as $arrayElem) { + $resultArray[] = (string) $arrayElem->Name; + } + } + } + } + + return $resultArray; + } + + /** + * Get full path to an object + * + * @param string $path + * @return string + */ + private function _getFullPath($path) + { + return $this->_remoteDirectory . $path; + } + + /** + * Get the concrete client. + * @return Zend_Service_Nirvanix + */ + public function getClient() + { + return $this->_nirvanix; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/StorageService/Adapter/Rackspace.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Cloud/StorageService/Adapter/Rackspace.php Fri Mar 22 10:47:04 2013 +0100 @@ -0,0 +1,332 @@ +toArray(); + } + + if (!is_array($options) || empty($options)) { + throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); + } + + try { + $this->_rackspace = new Zend_Service_Rackspace_Files($options[self::USER], $options[self::API_KEY]); + } catch (Zend_Service_Rackspace_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e); + } + + if (isset($options[self::HTTP_ADAPTER])) { + $this->_rackspace->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]); + } + if (!empty($options[self::REMOTE_CONTAINER])) { + $this->_container = $options[self::REMOTE_CONTAINER]; + } + } + + /** + * Get an item from the storage service. + * + * @param string $path + * @param array $options + * @return mixed + */ + public function fetchItem($path, $options = null) + { + $item = $this->_rackspace->getObject($this->_container,$path, $options); + if (!$this->_rackspace->isSuccessful() && ($this->_rackspace->getErrorCode()!='404')) { + throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$this->_rackspace->getErrorMsg()); + } + if (!empty($item)) { + return $item->getContent(); + } else { + return false; + } + } + + /** + * Store an item in the storage service. + * + * @param string $destinationPath + * @param mixed $data + * @param array $options + * @return void + */ + public function storeItem($destinationPath, $data, $options = null) + { + $this->_rackspace->storeObject($this->_container,$destinationPath,$data,$options); + if (!$this->_rackspace->isSuccessful()) { + throw new Zend_Cloud_StorageService_Exception('Error on store: '.$this->_rackspace->getErrorMsg()); + } + } + + /** + * Delete an item in the storage service. + * + * @param string $path + * @param array $options + * @return void + */ + public function deleteItem($path, $options = null) + { + $this->_rackspace->deleteObject($this->_container,$path); + if (!$this->_rackspace->isSuccessful()) { + throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$this->_rackspace->getErrorMsg()); + } + } + + /** + * Copy an item in the storage service to a given path. + * + * @param string $sourcePath + * @param string $destination path + * @param array $options + * @return void + */ + public function copyItem($sourcePath, $destinationPath, $options = null) + { + $this->_rackspace->copyObject($this->_container,$sourcePath,$this->_container,$destinationPath,$options); + if (!$this->_rackspace->isSuccessful()) { + throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$this->_rackspace->getErrorMsg()); + } + } + + /** + * Move an item in the storage service to a given path. + * WARNING: This operation is *very* expensive for services that do not + * support moving an item natively. + * + * @param string $sourcePath + * @param string $destination path + * @param array $options + * @return void + */ + public function moveItem($sourcePath, $destinationPath, $options = null) + { + try { + $this->copyItem($sourcePath, $destinationPath, $options); + } catch (Zend_Service_Rackspace_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage()); + } + try { + $this->deleteItem($sourcePath); + } catch (Zend_Service_Rackspace_Exception $e) { + $this->deleteItem($destinationPath); + throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage()); + } + } + + /** + * Rename an item in the storage service to a given name. + * + * @param string $path + * @param string $name + * @param array $options + * @return void + */ + public function renameItem($path, $name, $options = null) + { + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException('Renaming not implemented'); + } + + /** + * Get a key/value array of metadata for the given path. + * + * @param string $path + * @param array $options + * @return array An associative array of key/value pairs specifying the metadata for this object. + * If no metadata exists, an empty array is returned. + */ + public function fetchMetadata($path, $options = null) + { + $result = $this->_rackspace->getMetadataObject($this->_container,$path); + if (!$this->_rackspace->isSuccessful()) { + throw new Zend_Cloud_StorageService_Exception('Error on fetch metadata: '.$this->_rackspace->getErrorMsg()); + } + $metadata = array(); + if (isset($result['metadata'])) { + $metadata = $result['metadata']; + } + // delete the self::DELETE_METADATA_KEY - this is a trick to remove all + // the metadata information of an object (see deleteMetadata). + // Rackspace doesn't have an API to remove the metadata of an object + unset($metadata[self::DELETE_METADATA_KEY]); + return $metadata; + } + + /** + * Store a key/value array of metadata at the given path. + * WARNING: This operation overwrites any metadata that is located at + * $destinationPath. + * + * @param string $destinationPath + * @param array $metadata associative array specifying the key/value pairs for the metadata. + * @param array $options + * @return void + */ + public function storeMetadata($destinationPath, $metadata, $options = null) + { + $this->_rackspace->setMetadataObject($this->_container, $destinationPath, $metadata); + if (!$this->_rackspace->isSuccessful()) { + throw new Zend_Cloud_StorageService_Exception('Error on store metadata: '.$this->_rackspace->getErrorMsg()); + } + } + + /** + * Delete a key/value array of metadata at the given path. + * + * @param string $path + * @param array $metadata - An associative array specifying the key/value pairs for the metadata + * to be deleted. If null, all metadata associated with the object will + * be deleted. + * @param array $options + * @return void + */ + public function deleteMetadata($path, $metadata = null, $options = null) + { + if (empty($metadata)) { + $newMetadata = array(self::DELETE_METADATA_KEY => true); + try { + $this->storeMetadata($path, $newMetadata); + } catch (Zend_Service_Rackspace_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage()); + } + } else { + try { + $oldMetadata = $this->fetchMetadata($path); + } catch (Zend_Service_Rackspace_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage()); + } + $newMetadata = array_diff_assoc($oldMetadata, $metadata); + try { + $this->storeMetadata($path, $newMetadata); + } catch (Zend_Service_Rackspace_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage()); + } + } + } + + /* + * Recursively traverse all the folders and build an array that contains + * the path names for each folder. + * + * @param string $path folder path to get the list of folders from. + * @param array& $resultArray reference to the array that contains the path names + * for each folder. + * @return void + */ + private function getAllFolders($path, &$resultArray) + { + if (!empty($path)) { + $options = array ( + 'prefix' => $path + ); + } + $files = $this->_rackspace->getObjects($this->_container,$options); + if (!$this->_rackspace->isSuccessful()) { + throw new Zend_Cloud_StorageService_Exception('Error on get all folders: '.$this->_rackspace->getErrorMsg()); + } + $resultArray = array(); + foreach ($files as $file) { + $resultArray[dirname($file->getName())] = true; + } + $resultArray = array_keys($resultArray); + } + + /** + * Return an array of the items contained in the given path. The items + * returned are the files or objects that in the specified path. + * + * @param string $path + * @param array $options + * @return array + */ + public function listItems($path, $options = null) + { + if (!empty($path)) { + $options = array ( + 'prefix' => $path + ); + } + + $files = $this->_rackspace->getObjects($this->_container,$options); + if (!$this->_rackspace->isSuccessful()) { + throw new Zend_Cloud_StorageService_Exception('Error on list items: '.$this->_rackspace->getErrorMsg()); + } + $resultArray = array(); + if (!empty($files)) { + foreach ($files as $file) { + $resultArray[] = $file->getName(); + } + } + return $resultArray; + } + + /** + * Get the concrete client. + * + * @return Zend_Service_Rackspace_File + */ + public function getClient() + { + return $this->_rackspace; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/StorageService/Adapter/S3.php --- a/web/lib/Zend/Cloud/StorageService/Adapter/S3.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/StorageService/Adapter/S3.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,327 +1,332 @@ -toArray(); - } - - if (!is_array($options)) { - throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); - } - - if (!isset($options[self::AWS_ACCESS_KEY]) || !isset($options[self::AWS_SECRET_KEY])) { - throw new Zend_Cloud_StorageService_Exception('AWS keys not specified!'); - } - - try { - $this->_s3 = new Zend_Service_Amazon_S3($options[self::AWS_ACCESS_KEY], - $options[self::AWS_SECRET_KEY]); - } catch (Zend_Service_Amazon_S3_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e); - } - - if (isset($options[self::HTTP_ADAPTER])) { - $this->_s3->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]); - } - - if (isset($options[self::BUCKET_NAME])) { - $this->_defaultBucketName = $options[self::BUCKET_NAME]; - } - - if (isset($options[self::BUCKET_AS_DOMAIN])) { - $this->_defaultBucketAsDomain = $options[self::BUCKET_AS_DOMAIN]; - } - } - - /** - * Get an item from the storage service. - * - * @TODO Support streams - * - * @param string $path - * @param array $options - * @return string - */ - public function fetchItem($path, $options = array()) - { - $fullPath = $this->_getFullPath($path, $options); - try { - if (!empty($options[self::FETCH_STREAM])) { - return $this->_s3->getObjectStream($fullPath, $options[self::FETCH_STREAM]); - } else { - return $this->_s3->getObject($fullPath); - } - } catch (Zend_Service_Amazon_S3_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Store an item in the storage service. - * - * WARNING: This operation overwrites any item that is located at - * $destinationPath. - * - * @TODO Support streams - * - * @param string $destinationPath - * @param string|resource $data - * @param array $options - * @return void - */ - public function storeItem($destinationPath, $data, $options = array()) - { - try { - $fullPath = $this->_getFullPath($destinationPath, $options); - return $this->_s3->putObject( - $fullPath, - $data, - empty($options[self::METADATA]) ? null : $options[self::METADATA] - ); - } catch (Zend_Service_Amazon_S3_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Delete an item in the storage service. - * - * @param string $path - * @param array $options - * @return void - */ - public function deleteItem($path, $options = array()) - { - try { - $this->_s3->removeObject($this->_getFullPath($path, $options)); - } catch (Zend_Service_Amazon_S3_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Copy an item in the storage service to a given path. - * - * WARNING: This operation is *very* expensive for services that do not - * support copying an item natively. - * - * @TODO Support streams for those services that don't support natively - * - * @param string $sourcePath - * @param string $destination path - * @param array $options - * @return void - */ - public function copyItem($sourcePath, $destinationPath, $options = array()) - { - try { - // TODO We *really* need to add support for object copying in the S3 adapter - $item = $this->fetch($_getFullPath(sourcePath), $options); - $this->storeItem($item, $destinationPath, $options); - } catch (Zend_Service_Amazon_S3_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Move an item in the storage service to a given path. - * - * @TODO Support streams for those services that don't support natively - * - * @param string $sourcePath - * @param string $destination path - * @param array $options - * @return void - */ - public function moveItem($sourcePath, $destinationPath, $options = array()) - { - try { - $fullSourcePath = $this->_getFullPath($sourcePath, $options); - $fullDestPath = $this->_getFullPath($destinationPath, $options); - return $this->_s3->moveObject( - $fullSourcePath, - $fullDestPath, - empty($options[self::METADATA]) ? null : $options[self::METADATA] - ); - } catch (Zend_Service_Amazon_S3_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Rename an item in the storage service to a given name. - * - * - * @param string $path - * @param string $name - * @param array $options - * @return void - */ - public function renameItem($path, $name, $options = null) - { - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException('Rename not implemented'); - } - - /** - * List items in the given directory in the storage service - * - * The $path must be a directory - * - * - * @param string $path Must be a directory - * @param array $options - * @return array A list of item names - */ - public function listItems($path, $options = null) - { - try { - // TODO Support 'prefix' parameter for Zend_Service_Amazon_S3::getObjectsByBucket() - return $this->_s3->getObjectsByBucket($this->_defaultBucketName); - } catch (Zend_Service_Amazon_S3_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Get a key/value array of metadata for the given path. - * - * @param string $path - * @param array $options - * @return array - */ - public function fetchMetadata($path, $options = array()) - { - try { - return $this->_s3->getInfo($this->_getFullPath($path, $options)); - } catch (Zend_Service_Amazon_S3_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Store a key/value array of metadata at the given path. - * WARNING: This operation overwrites any metadata that is located at - * $destinationPath. - * - * @param string $destinationPath - * @param array $options - * @return void - */ - public function storeMetadata($destinationPath, $metadata, $options = array()) - { - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException('Storing separate metadata is not supported, use storeItem() with \'metadata\' option key'); - } - - /** - * Delete a key/value array of metadata at the given path. - * - * @param string $path - * @param array $options - * @return void - */ - public function deleteMetadata($path) - { - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException('Deleting metadata not supported'); - } - - /** - * Get full path, including bucket, for an object - * - * @param string $path - * @param array $options - * @return void - */ - protected function _getFullPath($path, $options) - { - if (isset($options[self::BUCKET_NAME])) { - $bucket = $options[self::BUCKET_NAME]; - } else if (isset($this->_defaultBucketName)) { - $bucket = $this->_defaultBucketName; - } else { - require_once 'Zend/Cloud/StorageService/Exception.php'; - throw new Zend_Cloud_StorageService_Exception('Bucket name must be specified for S3 adapter.'); - } - - if (isset($options[self::BUCKET_AS_DOMAIN])) { - // TODO: support bucket domain names - require_once 'Zend/Cloud/StorageService/Exception.php'; - throw new Zend_Cloud_StorageService_Exception('The S3 adapter does not currently support buckets in domain names.'); - } - - return trim($bucket) . '/' . trim($path); - } - - /** - * Get the concrete client. - * @return Zend_Service_Amazon_S3 - */ - public function getClient() - { - return $this->_s3; - } -} +toArray(); + } + + if (!is_array($options)) { + throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); + } + + if (!isset($options[self::AWS_ACCESS_KEY]) || !isset($options[self::AWS_SECRET_KEY])) { + throw new Zend_Cloud_StorageService_Exception('AWS keys not specified!'); + } + + try { + $this->_s3 = new Zend_Service_Amazon_S3($options[self::AWS_ACCESS_KEY], + $options[self::AWS_SECRET_KEY]); + } catch (Zend_Service_Amazon_S3_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e); + } + + if (isset($options[self::HTTP_ADAPTER])) { + $this->_s3->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]); + } + + if (isset($options[self::BUCKET_NAME])) { + $this->_defaultBucketName = $options[self::BUCKET_NAME]; + } + + if (isset($options[self::BUCKET_AS_DOMAIN])) { + $this->_defaultBucketAsDomain = $options[self::BUCKET_AS_DOMAIN]; + } + } + + /** + * Get an item from the storage service. + * + * @TODO Support streams + * + * @param string $path + * @param array $options + * @return string + */ + public function fetchItem($path, $options = array()) + { + $fullPath = $this->_getFullPath($path, $options); + try { + if (!empty($options[self::FETCH_STREAM])) { + return $this->_s3->getObjectStream($fullPath, $options[self::FETCH_STREAM]); + } else { + return $this->_s3->getObject($fullPath); + } + } catch (Zend_Service_Amazon_S3_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Store an item in the storage service. + * + * WARNING: This operation overwrites any item that is located at + * $destinationPath. + * + * @TODO Support streams + * + * @param string $destinationPath + * @param string|resource $data + * @param array $options + * @return void + */ + public function storeItem($destinationPath, $data, $options = array()) + { + try { + $fullPath = $this->_getFullPath($destinationPath, $options); + return $this->_s3->putObject( + $fullPath, + $data, + empty($options[self::METADATA]) ? null : $options[self::METADATA] + ); + } catch (Zend_Service_Amazon_S3_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Delete an item in the storage service. + * + * @param string $path + * @param array $options + * @return void + */ + public function deleteItem($path, $options = array()) + { + try { + $this->_s3->removeObject($this->_getFullPath($path, $options)); + } catch (Zend_Service_Amazon_S3_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Copy an item in the storage service to a given path. + * + * WARNING: This operation is *very* expensive for services that do not + * support copying an item natively. + * + * @TODO Support streams for those services that don't support natively + * + * @param string $sourcePath + * @param string $destination path + * @param array $options + * @return void + */ + public function copyItem($sourcePath, $destinationPath, $options = array()) + { + try { + $fullSourcePath = $this->_getFullPath($sourcePath, $options); + $fullDestPath = $this->_getFullPath($destinationPath, $options); + return $this->_s3->copyObject( + $fullSourcePath, + $fullDestPath, + empty($options[self::METADATA]) ? null : $options[self::METADATA] + ); + + } catch (Zend_Service_Amazon_S3_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Move an item in the storage service to a given path. + * + * @TODO Support streams for those services that don't support natively + * + * @param string $sourcePath + * @param string $destination path + * @param array $options + * @return void + */ + public function moveItem($sourcePath, $destinationPath, $options = array()) + { + try { + $fullSourcePath = $this->_getFullPath($sourcePath, $options); + $fullDestPath = $this->_getFullPath($destinationPath, $options); + return $this->_s3->moveObject( + $fullSourcePath, + $fullDestPath, + empty($options[self::METADATA]) ? null : $options[self::METADATA] + ); + } catch (Zend_Service_Amazon_S3_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Rename an item in the storage service to a given name. + * + * + * @param string $path + * @param string $name + * @param array $options + * @return void + */ + public function renameItem($path, $name, $options = null) + { + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException('Rename not implemented'); + } + + /** + * List items in the given directory in the storage service + * + * The $path must be a directory + * + * + * @param string $path Must be a directory + * @param array $options + * @return array A list of item names + */ + public function listItems($path, $options = null) + { + try { + // TODO Support 'prefix' parameter for Zend_Service_Amazon_S3::getObjectsByBucket() + return $this->_s3->getObjectsByBucket($this->_defaultBucketName); + } catch (Zend_Service_Amazon_S3_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Get a key/value array of metadata for the given path. + * + * @param string $path + * @param array $options + * @return array + */ + public function fetchMetadata($path, $options = array()) + { + try { + return $this->_s3->getInfo($this->_getFullPath($path, $options)); + } catch (Zend_Service_Amazon_S3_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Store a key/value array of metadata at the given path. + * WARNING: This operation overwrites any metadata that is located at + * $destinationPath. + * + * @param string $destinationPath + * @param array $options + * @return void + */ + public function storeMetadata($destinationPath, $metadata, $options = array()) + { + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException('Storing separate metadata is not supported, use storeItem() with \'metadata\' option key'); + } + + /** + * Delete a key/value array of metadata at the given path. + * + * @param string $path + * @param array $options + * @return void + */ + public function deleteMetadata($path) + { + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException('Deleting metadata not supported'); + } + + /** + * Get full path, including bucket, for an object + * + * @param string $path + * @param array $options + * @return void + */ + protected function _getFullPath($path, $options) + { + if (isset($options[self::BUCKET_NAME])) { + $bucket = $options[self::BUCKET_NAME]; + } else if (isset($this->_defaultBucketName)) { + $bucket = $this->_defaultBucketName; + } else { + require_once 'Zend/Cloud/StorageService/Exception.php'; + throw new Zend_Cloud_StorageService_Exception('Bucket name must be specified for S3 adapter.'); + } + + if (isset($options[self::BUCKET_AS_DOMAIN])) { + // TODO: support bucket domain names + require_once 'Zend/Cloud/StorageService/Exception.php'; + throw new Zend_Cloud_StorageService_Exception('The S3 adapter does not currently support buckets in domain names.'); + } + + return trim($bucket) . '/' . trim($path); + } + + /** + * Get the concrete client. + * @return Zend_Service_Amazon_S3 + */ + public function getClient() + { + return $this->_s3; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/StorageService/Adapter/WindowsAzure.php --- a/web/lib/Zend/Cloud/StorageService/Adapter/WindowsAzure.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/StorageService/Adapter/WindowsAzure.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,443 +1,443 @@ -toArray(); - } - - if (!is_array($options)) { - throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); - } - - // Build Zend_Service_WindowsAzure_Storage_Blob instance - if (!isset($options[self::HOST])) { - $host = self::DEFAULT_HOST; - } else { - $host = $options[self::HOST]; - } - - if (!isset($options[self::ACCOUNT_NAME])) { - throw new Zend_Cloud_StorageService_Exception('No Windows Azure account name provided.'); - } - if (!isset($options[self::ACCOUNT_KEY])) { - throw new Zend_Cloud_StorageService_Exception('No Windows Azure account key provided.'); - } - - $this->_storageClient = new Zend_Service_WindowsAzure_Storage_Blob($host, - $options[self::ACCOUNT_NAME], $options[self::ACCOUNT_KEY]); - - // Parse other options - if (!empty($options[self::PROXY_HOST])) { - $proxyHost = $options[self::PROXY_HOST]; - $proxyPort = isset($options[self::PROXY_PORT]) ? $options[self::PROXY_PORT] : 8080; - $proxyCredentials = isset($options[self::PROXY_CREDENTIALS]) ? $options[self::PROXY_CREDENTIALS] : ''; - - $this->_storageClient->setProxy(true, $proxyHost, $proxyPort, $proxyCredentials); - } - - if (isset($options[self::HTTP_ADAPTER])) { - $this->_storageClient->setHttpClientChannel($options[self::HTTP_ADAPTER]); - } - - // Set container - $this->_container = $options[self::CONTAINER]; - - // Make sure the container exists - if (!$this->_storageClient->containerExists($this->_container)) { - $this->_storageClient->createContainer($this->_container); - } - } - - /** - * Get an item from the storage service. - * - * @param string $path - * @param array $options - * @return mixed - */ - public function fetchItem($path, $options = null) - { - // Options - $returnType = self::RETURN_STRING; - $returnPath = tempnam('', 'azr'); - $openMode = 'r'; - - // Parse options - if (is_array($options)) { - if (isset($options[self::RETURN_TYPE])) { - $returnType = $options[self::RETURN_TYPE]; - } - - if (isset($options[self::RETURN_PATHNAME])) { - $returnPath = $options[self::RETURN_PATHNAME]; - } - - if (isset($options[self::RETURN_OPENMODE])) { - $openMode = $options[self::RETURN_OPENMODE]; - } - } - - // Fetch the blob - try { - $this->_storageClient->getBlob( - $this->_container, - $path, - $returnPath - ); - } catch (Zend_Service_WindowsAzure_Exception $e) { - if (strpos($e->getMessage(), "does not exist") !== false) { - return false; - } - throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); - } - - // Return value - if ($returnType == self::RETURN_PATH) { - return $returnPath; - } - if ($returnType == self::RETURN_STRING) { - return file_get_contents($returnPath); - } - if ($returnType == self::RETURN_STREAM) { - return fopen($returnPath, $openMode); - } - } - - /** - * Store an item in the storage service. - * WARNING: This operation overwrites any item that is located at - * $destinationPath. - * @param string $destinationPath - * @param mixed $data - * @param array $options - * @return boolean - */ - public function storeItem($destinationPath, $data, $options = null) - { - // Create a temporary file that will be uploaded - $temporaryFilePath = ''; - $removeTemporaryFilePath = false; - - if (is_resource($data)) { - $temporaryFilePath = tempnam('', 'azr'); - $fpDestination = fopen($temporaryFilePath, 'w'); - - $fpSource = $data; - rewind($fpSource); - while (!feof($fpSource)) { - fwrite($fpDestination, fread($fpSource, 8192)); - } - - fclose($fpDestination); - - $removeTemporaryFilePath = true; - } elseif (file_exists($data)) { - $temporaryFilePath = $data; - $removeTemporaryFilePath = false; - } else { - $temporaryFilePath = tempnam('', 'azr'); - file_put_contents($temporaryFilePath, $data); - $removeTemporaryFilePath = true; - } - - try { - // Upload data - $this->_storageClient->putBlob( - $this->_container, - $destinationPath, - $temporaryFilePath - ); - } catch(Zend_Service_WindowsAzure_Exception $e) { - @unlink($temporaryFilePath); - throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e); - } - if ($removeTemporaryFilePath) { - @unlink($temporaryFilePath); - } - } - - /** - * Delete an item in the storage service. - * - * @param string $path - * @param array $options - * @return void - */ - public function deleteItem($path, $options = null) - { - try { - $this->_storageClient->deleteBlob( - $this->_container, - $path - ); - } catch (Zend_Service_WindowsAzure_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Copy an item in the storage service to a given path. - * - * @param string $sourcePath - * @param string $destinationPath - * @param array $options - * @return void - */ - public function copyItem($sourcePath, $destinationPath, $options = null) - { - try { - $this->_storageClient->copyBlob( - $this->_container, - $sourcePath, - $this->_container, - $destinationPath - ); - } catch (Zend_Service_WindowsAzure_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Move an item in the storage service to a given path. - * - * @param string $sourcePath - * @param string $destinationPath - * @param array $options - * @return void - */ - public function moveItem($sourcePath, $destinationPath, $options = null) - { - try { - $this->_storageClient->copyBlob( - $this->_container, - $sourcePath, - $this->_container, - $destinationPath - ); - - $this->_storageClient->deleteBlob( - $this->_container, - $sourcePath - ); - } catch (Zend_Service_WindowsAzure_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e); - } - - } - - /** - * Rename an item in the storage service to a given name. - * - * - * @param string $path - * @param string $name - * @param array $options - * @return void - */ - public function renameItem($path, $name, $options = null) - { - return $this->moveItem($path, $name, $options); - } - - /** - * List items in the given directory in the storage service - * - * The $path must be a directory - * - * - * @param string $path Must be a directory - * @param array $options - * @return array A list of item names - */ - public function listItems($path, $options = null) - { - // Options - $returnType = self::RETURN_NAMES; // 1: return list of paths, 2: return raw output from underlying provider - - // Parse options - if (is_array($options)&& isset($options[self::RETURN_TYPE])) { - $returnType = $options[self::RETURN_TYPE]; - } - - try { - // Fetch list - $blobList = $this->_storageClient->listBlobs( - $this->_container, - $path - ); - } catch (Zend_Service_WindowsAzure_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e); - } - - // Return - if ($returnType == self::RETURN_LIST) { - return $blobList; - } - - $returnValue = array(); - foreach ($blobList as $blob) { - $returnValue[] = $blob->Name; - } - - return $returnValue; - } - - /** - * Get a key/value array of metadata for the given path. - * - * @param string $path - * @param array $options - * @return array - */ - public function fetchMetadata($path, $options = null) - { - try { - return $this->_storageClient->getBlobMetaData( - $this->_container, - $path - ); - } catch (Zend_Service_WindowsAzure_Exception $e) { - if (strpos($e->getMessage(), "could not be accessed") !== false) { - return false; - } - throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Store a key/value array of metadata at the given path. - * WARNING: This operation overwrites any metadata that is located at - * $destinationPath. - * - * @param string $destinationPath - * @param array $options - * @return void - */ - public function storeMetadata($destinationPath, $metadata, $options = null) - { - try { - $this->_storageClient->setBlobMetadata($this->_container, $destinationPath, $metadata); - } catch (Zend_Service_WindowsAzure_Exception $e) { - if (strpos($e->getMessage(), "could not be accessed") === false) { - throw new Zend_Cloud_StorageService_Exception('Error on store metadata: '.$e->getMessage(), $e->getCode(), $e); - } - } - } - - /** - * Delete a key/value array of metadata at the given path. - * - * @param string $path - * @param array $options - * @return void - */ - public function deleteMetadata($path, $options = null) - { - try { - $this->_storageClient->setBlobMetadata($this->_container, $destinationPath, array()); - } catch (Zend_Service_WindowsAzure_Exception $e) { - if (strpos($e->getMessage(), "could not be accessed") === false) { - throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage(), $e->getCode(), $e); - } - } - } - - /** - * Delete container - * - * @return void - */ - public function deleteContainer() - { - try { - $this->_storageClient->deleteContainer($this->_container); - } catch (Zend_Service_WindowsAzure_Exception $e) { - throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Get the concrete adapter. - * @return Zend_Service_Azure_Storage_Blob - */ - public function getClient() - { - return $this->_storageClient; - } -} +toArray(); + } + + if (!is_array($options)) { + throw new Zend_Cloud_StorageService_Exception('Invalid options provided'); + } + + // Build Zend_Service_WindowsAzure_Storage_Blob instance + if (!isset($options[self::HOST])) { + $host = self::DEFAULT_HOST; + } else { + $host = $options[self::HOST]; + } + + if (!isset($options[self::ACCOUNT_NAME])) { + throw new Zend_Cloud_StorageService_Exception('No Windows Azure account name provided.'); + } + if (!isset($options[self::ACCOUNT_KEY])) { + throw new Zend_Cloud_StorageService_Exception('No Windows Azure account key provided.'); + } + + $this->_storageClient = new Zend_Service_WindowsAzure_Storage_Blob($host, + $options[self::ACCOUNT_NAME], $options[self::ACCOUNT_KEY]); + + // Parse other options + if (!empty($options[self::PROXY_HOST])) { + $proxyHost = $options[self::PROXY_HOST]; + $proxyPort = isset($options[self::PROXY_PORT]) ? $options[self::PROXY_PORT] : 8080; + $proxyCredentials = isset($options[self::PROXY_CREDENTIALS]) ? $options[self::PROXY_CREDENTIALS] : ''; + + $this->_storageClient->setProxy(true, $proxyHost, $proxyPort, $proxyCredentials); + } + + if (isset($options[self::HTTP_ADAPTER])) { + $this->_storageClient->setHttpClientChannel($options[self::HTTP_ADAPTER]); + } + + // Set container + $this->_container = $options[self::CONTAINER]; + + // Make sure the container exists + if (!$this->_storageClient->containerExists($this->_container)) { + $this->_storageClient->createContainer($this->_container); + } + } + + /** + * Get an item from the storage service. + * + * @param string $path + * @param array $options + * @return mixed + */ + public function fetchItem($path, $options = null) + { + // Options + $returnType = self::RETURN_STRING; + $returnPath = tempnam('', 'azr'); + $openMode = 'r'; + + // Parse options + if (is_array($options)) { + if (isset($options[self::RETURN_TYPE])) { + $returnType = $options[self::RETURN_TYPE]; + } + + if (isset($options[self::RETURN_PATHNAME])) { + $returnPath = $options[self::RETURN_PATHNAME]; + } + + if (isset($options[self::RETURN_OPENMODE])) { + $openMode = $options[self::RETURN_OPENMODE]; + } + } + + // Fetch the blob + try { + $this->_storageClient->getBlob( + $this->_container, + $path, + $returnPath + ); + } catch (Zend_Service_WindowsAzure_Exception $e) { + if (strpos($e->getMessage(), "does not exist") !== false) { + return false; + } + throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); + } + + // Return value + if ($returnType == self::RETURN_PATH) { + return $returnPath; + } + if ($returnType == self::RETURN_STRING) { + return file_get_contents($returnPath); + } + if ($returnType == self::RETURN_STREAM) { + return fopen($returnPath, $openMode); + } + } + + /** + * Store an item in the storage service. + * WARNING: This operation overwrites any item that is located at + * $destinationPath. + * @param string $destinationPath + * @param mixed $data + * @param array $options + * @return boolean + */ + public function storeItem($destinationPath, $data, $options = null) + { + // Create a temporary file that will be uploaded + $temporaryFilePath = ''; + $removeTemporaryFilePath = false; + + if (is_resource($data)) { + $temporaryFilePath = tempnam('', 'azr'); + $fpDestination = fopen($temporaryFilePath, 'w'); + + $fpSource = $data; + rewind($fpSource); + while (!feof($fpSource)) { + fwrite($fpDestination, fread($fpSource, 8192)); + } + + fclose($fpDestination); + + $removeTemporaryFilePath = true; + } elseif (file_exists($data)) { + $temporaryFilePath = $data; + $removeTemporaryFilePath = false; + } else { + $temporaryFilePath = tempnam('', 'azr'); + file_put_contents($temporaryFilePath, $data); + $removeTemporaryFilePath = true; + } + + try { + // Upload data + $this->_storageClient->putBlob( + $this->_container, + $destinationPath, + $temporaryFilePath + ); + } catch(Zend_Service_WindowsAzure_Exception $e) { + @unlink($temporaryFilePath); + throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e); + } + if ($removeTemporaryFilePath) { + @unlink($temporaryFilePath); + } + } + + /** + * Delete an item in the storage service. + * + * @param string $path + * @param array $options + * @return void + */ + public function deleteItem($path, $options = null) + { + try { + $this->_storageClient->deleteBlob( + $this->_container, + $path + ); + } catch (Zend_Service_WindowsAzure_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Copy an item in the storage service to a given path. + * + * @param string $sourcePath + * @param string $destinationPath + * @param array $options + * @return void + */ + public function copyItem($sourcePath, $destinationPath, $options = null) + { + try { + $this->_storageClient->copyBlob( + $this->_container, + $sourcePath, + $this->_container, + $destinationPath + ); + } catch (Zend_Service_WindowsAzure_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Move an item in the storage service to a given path. + * + * @param string $sourcePath + * @param string $destinationPath + * @param array $options + * @return void + */ + public function moveItem($sourcePath, $destinationPath, $options = null) + { + try { + $this->_storageClient->copyBlob( + $this->_container, + $sourcePath, + $this->_container, + $destinationPath + ); + + $this->_storageClient->deleteBlob( + $this->_container, + $sourcePath + ); + } catch (Zend_Service_WindowsAzure_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e); + } + + } + + /** + * Rename an item in the storage service to a given name. + * + * + * @param string $path + * @param string $name + * @param array $options + * @return void + */ + public function renameItem($path, $name, $options = null) + { + return $this->moveItem($path, $name, $options); + } + + /** + * List items in the given directory in the storage service + * + * The $path must be a directory + * + * + * @param string $path Must be a directory + * @param array $options + * @return array A list of item names + */ + public function listItems($path, $options = null) + { + // Options + $returnType = self::RETURN_NAMES; // 1: return list of paths, 2: return raw output from underlying provider + + // Parse options + if (is_array($options)&& isset($options[self::RETURN_TYPE])) { + $returnType = $options[self::RETURN_TYPE]; + } + + try { + // Fetch list + $blobList = $this->_storageClient->listBlobs( + $this->_container, + $path + ); + } catch (Zend_Service_WindowsAzure_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e); + } + + // Return + if ($returnType == self::RETURN_LIST) { + return $blobList; + } + + $returnValue = array(); + foreach ($blobList as $blob) { + $returnValue[] = $blob->Name; + } + + return $returnValue; + } + + /** + * Get a key/value array of metadata for the given path. + * + * @param string $path + * @param array $options + * @return array + */ + public function fetchMetadata($path, $options = null) + { + try { + return $this->_storageClient->getBlobMetaData( + $this->_container, + $path + ); + } catch (Zend_Service_WindowsAzure_Exception $e) { + if (strpos($e->getMessage(), "could not be accessed") !== false) { + return false; + } + throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Store a key/value array of metadata at the given path. + * WARNING: This operation overwrites any metadata that is located at + * $destinationPath. + * + * @param string $destinationPath + * @param array $options + * @return void + */ + public function storeMetadata($destinationPath, $metadata, $options = null) + { + try { + $this->_storageClient->setBlobMetadata($this->_container, $destinationPath, $metadata); + } catch (Zend_Service_WindowsAzure_Exception $e) { + if (strpos($e->getMessage(), "could not be accessed") === false) { + throw new Zend_Cloud_StorageService_Exception('Error on store metadata: '.$e->getMessage(), $e->getCode(), $e); + } + } + } + + /** + * Delete a key/value array of metadata at the given path. + * + * @param string $path + * @param array $options + * @return void + */ + public function deleteMetadata($path, $options = null) + { + try { + $this->_storageClient->setBlobMetadata($this->_container, $destinationPath, array()); + } catch (Zend_Service_WindowsAzure_Exception $e) { + if (strpos($e->getMessage(), "could not be accessed") === false) { + throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage(), $e->getCode(), $e); + } + } + } + + /** + * Delete container + * + * @return void + */ + public function deleteContainer() + { + try { + $this->_storageClient->deleteContainer($this->_container); + } catch (Zend_Service_WindowsAzure_Exception $e) { + throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Get the concrete adapter. + * @return Zend_Service_Azure_Storage_Blob + */ + public function getClient() + { + return $this->_storageClient; + } +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Cloud/StorageService/Exception.php --- a/web/lib/Zend/Cloud/StorageService/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Cloud/StorageService/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -1,38 +1,38 @@ -setConstant($const); + } + + return $this; + } + + /** * setProperty() * * @param array|Zend_CodeGenerator_Php_Property $property @@ -296,6 +316,9 @@ throw new Zend_CodeGenerator_Php_Exception('setProperty() expects either an array of property options or an instance of Zend_CodeGenerator_Php_Property'); } + if ($property->isConst()) { + return $this->setConstant($property); + } if (isset($this->_properties[$propertyName])) { require_once 'Zend/CodeGenerator/Php/Exception.php'; throw new Zend_CodeGenerator_Php_Exception('A property by name ' . $propertyName . ' already exists in this class.'); @@ -306,6 +329,37 @@ } /** + * setConstant() + * + * @param array|Zend_CodeGenerator_Php_Property $const + * @return Zend_CodeGenerator_Php_Class + */ + public function setConstant($const) + { + if (is_array($const)) { + $const = new Zend_CodeGenerator_Php_Property($const); + $constName = $const->getName(); + } elseif ($const instanceof Zend_CodeGenerator_Php_Property) { + $constName = $const->getName(); + } else { + require_once 'Zend/CodeGenerator/Php/Exception.php'; + throw new Zend_CodeGenerator_Php_Exception('setConstant() expects either an array of property options or an instance of Zend_CodeGenerator_Php_Property'); + } + + if (!$const->isConst()) { + require_once 'Zend/CodeGenerator/Php/Exception.php'; + throw new Zend_CodeGenerator_Php_Exception('setProperty() expects argument to define a constant'); + } + if (isset($this->_constants[$constName])) { + require_once 'Zend/CodeGenerator/Php/Exception.php'; + throw new Zend_CodeGenerator_Php_Exception('A constant by name ' . $constName . ' already exists in this class.'); + } + + $this->_constants[$constName] = $const; + return $this; + } + + /** * getProperties() * * @return array @@ -316,6 +370,16 @@ } /** + * getConstants() + * + * @return array + */ + public function getConstants() + { + return $this->_constants; + } + + /** * getProperty() * * @param string $propertyName @@ -332,6 +396,22 @@ } /** + * getConstant() + * + * @param string $constName + * @return Zend_CodeGenerator_Php_Property + */ + public function getConstant($constName) + { + foreach ($this->_constants as $const) { + if ($const->getName() == $constName) { + return $const; + } + } + return false; + } + + /** * hasProperty() * * @param string $propertyName @@ -343,6 +423,17 @@ } /** + * hasConstant() + * + * @param string $constName + * @return bool + */ + public function hasConstant($constName) + { + return isset($this->_constants[$constName]); + } + + /** * setMethods() * * @param array $methods @@ -437,6 +528,12 @@ } } + foreach ($this->_constants as $constant) { + if ($constant->isSourceDirty()) { + return true; + } + } + foreach ($this->_methods as $method) { if ($method->isSourceDirty()) { return true; @@ -481,6 +578,13 @@ $output .= self::LINE_FEED . '{' . self::LINE_FEED . self::LINE_FEED; + $constants = $this->getConstants(); + if (!empty($constants)) { + foreach ($constants as $const) { + $output .= $const->generate() . self::LINE_FEED . self::LINE_FEED; + } + } + $properties = $this->getProperties(); if (!empty($properties)) { foreach ($properties as $property) { @@ -507,6 +611,7 @@ protected function _init() { $this->_properties = new Zend_CodeGenerator_Php_Member_Container(Zend_CodeGenerator_Php_Member_Container::TYPE_PROPERTY); + $this->_constants = new Zend_CodeGenerator_Php_Member_Container(Zend_CodeGenerator_Php_Member_Container::TYPE_PROPERTY); $this->_methods = new Zend_CodeGenerator_Php_Member_Container(Zend_CodeGenerator_Php_Member_Container::TYPE_METHOD); } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Docblock.php --- a/web/lib/Zend/CodeGenerator/Php/Docblock.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Docblock.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Docblock.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Docblock.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract @@ -211,7 +211,11 @@ $content = wordwrap($content, 80, self::LINE_FEED); $lines = explode(self::LINE_FEED, $content); foreach ($lines as $line) { - $output .= $indent . ' * ' . $line . self::LINE_FEED; + $output .= $indent . ' *'; + if ($line) { + $output .= " $line"; + } + $output .= self::LINE_FEED; } $output .= $indent . ' */' . self::LINE_FEED; return $output; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Docblock/Tag.php --- a/web/lib/Zend/CodeGenerator/Php/Docblock/Tag.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Docblock/Tag.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,30 +15,20 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Tag.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Tag.php 24593 2012-01-05 20:35:02Z matthew $ */ /** - * @see Zend_CodeGenerator_Abstract + * @see Zend_CodeGenerator_Php_Abstract */ require_once 'Zend/CodeGenerator/Php/Abstract.php'; /** - * @see Zend_CodeGenerator_Php_Docblock_Tag_Param - */ -require_once 'Zend/CodeGenerator/Php/Docblock/Tag/Param.php'; - -/** - * @see Zend_CodeGenerator_Php_Docblock_Tag_Return - */ -require_once 'Zend/CodeGenerator/Php/Docblock/Tag/Return.php'; - -/** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstract @@ -178,7 +168,11 @@ */ public function generate() { - return '@' . $this->_name . ' ' . $this->_description; + $tag = '@' . $this->_name; + if ($this->_description) { + $tag .= ' ' . $this->_description; + } + return $tag; } -} \ No newline at end of file +} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Docblock/Tag/License.php --- a/web/lib/Zend/CodeGenerator/Php/Docblock/Tag/License.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Docblock/Tag/License.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: License.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: License.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Docblock_Tag_License extends Zend_CodeGenerator_Php_Docblock_Tag diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Docblock/Tag/Param.php --- a/web/lib/Zend/CodeGenerator/Php/Docblock/Tag/Param.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Docblock/Tag/Param.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Param.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Param.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_Docblock_Tag @@ -53,7 +53,7 @@ * fromReflection() * * @param Zend_Reflection_Docblock_Tag $reflectionTagParam - * @return Zend_CodeGenerator_Php_Docblock_Tag_Param + * @return Zend_CodeGenerator_Php_Docblock_Tag */ public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTagParam) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Docblock/Tag/Return.php --- a/web/lib/Zend/CodeGenerator/Php/Docblock/Tag/Return.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Docblock/Tag/Return.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Return.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Return.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Docblock_Tag_Return extends Zend_CodeGenerator_Php_Docblock_Tag diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Exception.php --- a/web/lib/Zend/CodeGenerator/Php/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Exception extends Zend_CodeGenerator_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/File.php --- a/web/lib/Zend/CodeGenerator/Php/File.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/File.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract @@ -97,7 +97,7 @@ } /** - * fromReflectedFilePath() - use this if you intend on generating code generation objects based on the same file. + * fromReflectedFileName() - use this if you intend on generating code generation objects based on the same file. * This will keep previous changes to the file in tact during the same PHP process * * @param string $filePath @@ -110,7 +110,7 @@ $realpath = realpath($filePath); if ($realpath === false) { - if ( ($realpath = Zend_Reflection_file::findRealpathInIncludePath($filePath)) === false) { + if ( ($realpath = Zend_Reflection_File::findRealpathInIncludePath($filePath)) === false) { require_once 'Zend/CodeGenerator/Php/Exception.php'; throw new Zend_CodeGenerator_Php_Exception('No file for ' . $realpath . ' was found.'); } @@ -394,7 +394,7 @@ // if there are markers, put the body into the output $body = $this->getBody(); - if (preg_match('#/\* Zend_CodeGenerator_Php_File-(.*?)Marker:#', $body)) { + if (preg_match('#/\* Zend_CodeGenerator_Php_File-(.*?)Marker#', $body)) { $output .= $body; $body = ''; } @@ -428,6 +428,9 @@ $classes = $this->getClasses(); if (!empty($classes)) { foreach ($classes as $class) { + if($this->getDocblock() == $class->getDocblock()) { + $class->setDocblock(null); + } $regex = str_replace('?', $class->getName(), self::$_markerClass); $regex = preg_quote($regex, '#'); if (preg_match('#'.$regex.'#', $output)) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Member/Abstract.php --- a/web/lib/Zend/CodeGenerator/Php/Member/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Member/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator_Php_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Member/Container.php --- a/web/lib/Zend/CodeGenerator/Php/Member/Container.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Member/Container.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,15 +15,15 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Container.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Container.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Member_Container extends ArrayObject diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Method.php --- a/web/lib/Zend/CodeGenerator/Php/Method.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Method.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Method.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Method.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -38,7 +38,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstract @@ -220,10 +220,12 @@ $output .= ')' . self::LINE_FEED . $indent . '{' . self::LINE_FEED; - if ($this->_body) { + if ($this->_body && $this->isSourceDirty()) { $output .= ' ' . str_replace(self::LINE_FEED, self::LINE_FEED . $indent . $indent, trim($this->_body)) . self::LINE_FEED; + } elseif ($this->_body) { + $output .= $this->_body . self::LINE_FEED; } $output .= $indent . '}' . self::LINE_FEED; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Parameter.php --- a/web/lib/Zend/CodeGenerator/Php/Parameter.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Parameter.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Parameter.php 21889 2010-04-16 18:40:50Z juokaz $ + * @version $Id: Parameter.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Parameter/DefaultValue.php --- a/web/lib/Zend/CodeGenerator/Php/Parameter/DefaultValue.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Parameter/DefaultValue.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage Php - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: DefaultValue.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: DefaultValue.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage Php - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Parameter_DefaultValue diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Property.php --- a/web/lib/Zend/CodeGenerator/Php/Property.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Property.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Property.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Property.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/CodeGenerator/Php/Property/DefaultValue.php --- a/web/lib/Zend/CodeGenerator/Php/Property/DefaultValue.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/CodeGenerator/Php/Property/DefaultValue.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_CodeGenerator * @subpackage PHP - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: DefaultValue.php 21979 2010-04-24 11:07:11Z jan $ + * @version $Id: DefaultValue.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_CodeGenerator - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Php_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config.php --- a/web/lib/Zend/Config.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,16 +14,16 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Config.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Config.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config implements Countable, Iterator diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Exception.php --- a/web/lib/Zend/Config/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config_Exception extends Zend_Exception {} diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Ini.php --- a/web/lib/Zend/Config/Ini.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Ini.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ini.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Ini.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config_Ini extends Zend_Config @@ -83,16 +83,17 @@ * * The $options parameter may be provided as either a boolean or an array. * If provided as a boolean, this sets the $allowModifications option of - * Zend_Config. If provided as an array, there are two configuration + * Zend_Config. If provided as an array, there are three configuration * directives that may be set. For example: * * $options = array( * 'allowModifications' => false, - * 'nestSeparator' => '->' + * 'nestSeparator' => ':', + * 'skipExtends' => false, * ); * * @param string $filename - * @param string|null $section + * @param mixed $section * @param boolean|array $options * @throws Zend_Config_Exception * @return void @@ -157,11 +158,11 @@ $this->_loadedSection = $section; } - + /** * Load the INI file from disk using parse_ini_file(). Use a private error * handler to convert any loading errors into a Zend_Config_Exception - * + * * @param string $filename * @throws Zend_Config_Exception * @return array @@ -171,7 +172,7 @@ set_error_handler(array($this, '_loadFileErrorHandler')); $iniArray = parse_ini_file($filename, true); // Warnings and errors are suppressed restore_error_handler(); - + // Check if there was a error while loading file if ($this->_loadFileErrorStr !== null) { /** @@ -180,7 +181,7 @@ require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception($this->_loadFileErrorStr); } - + return $iniArray; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Json.php --- a/web/lib/Zend/Config/Json.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Json.php Fri Mar 22 10:47:04 2013 +0100 @@ -16,7 +16,7 @@ * @package Zend_Config * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Json.php 23294 2010-11-05 00:27:34Z ramon $ + * @version $Id: Json.php 24810 2012-05-17 21:20:12Z rob $ */ /** @@ -220,7 +220,9 @@ { foreach ($this->_getConstants() as $constant) { if (strstr($value, $constant)) { - $value = str_replace($constant, constant($constant), $value); + // handle backslashes that may represent windows path names for instance + $replacement = str_replace('\\', '\\\\', constant($constant)); + $value = str_replace($constant, $replacement, $value); } } return $value; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Writer.php --- a/web/lib/Zend/Config/Writer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Writer.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,15 +14,15 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Writer.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Writer.php 25024 2012-07-30 15:08:15Z rob $ */ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Config_Writer diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Writer/Array.php --- a/web/lib/Zend/Config/Writer/Array.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Writer/Array.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Array.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Array.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config_Writer_Array extends Zend_Config_Writer_FileAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Writer/FileAbstract.php --- a/web/lib/Zend/Config/Writer/FileAbstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Writer/FileAbstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Config * @package Writer - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -26,9 +26,9 @@ * * @category Zend * @package Zend_package - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: FileAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: FileAbstract.php 24593 2012-01-05 20:35:02Z matthew $ */ class Zend_Config_Writer_FileAbstract extends Zend_Config_Writer { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Writer/Ini.php --- a/web/lib/Zend/Config/Writer/Ini.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Writer/Ini.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ini.php 21983 2010-04-25 08:09:09Z jan $ + * @version $Id: Ini.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config_Writer_Ini extends Zend_Config_Writer_FileAbstract @@ -161,11 +161,11 @@ throw new Zend_Config_Exception('Value can not contain double quotes "'); } } - + /** * Root elements that are not assigned to any section needs to be * on the top of config. - * + * * @see http://framework.zend.com/issues/browse/ZF-6289 * @param Zend_Config * @return Zend_Config @@ -174,7 +174,7 @@ { $configArray = $config->toArray(); $sections = array(); - + // remove sections from config array foreach ($configArray as $key => $value) { if (is_array($value)) { @@ -182,12 +182,12 @@ unset($configArray[$key]); } } - + // readd sections to the end foreach ($sections as $key => $value) { $configArray[$key] = $value; } - + return new Zend_Config($configArray); } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Writer/Json.php --- a/web/lib/Zend/Config/Writer/Json.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Writer/Json.php Fri Mar 22 10:47:04 2013 +0100 @@ -16,7 +16,7 @@ * @package Zend_Config * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Json.php 23294 2010-11-05 00:27:34Z ramon $ + * @version $Id: Json.php 23293 2010-11-04 23:40:23Z ramon $ */ /** diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Writer/Xml.php --- a/web/lib/Zend/Config/Writer/Xml.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Writer/Xml.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Xml.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Xml.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config_Writer_Xml extends Zend_Config_Writer_FileAbstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Writer/Yaml.php --- a/web/lib/Zend/Config/Writer/Yaml.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Writer/Yaml.php Fri Mar 22 10:47:04 2013 +0100 @@ -16,7 +16,7 @@ * @package Zend_Config * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Yaml.php 23294 2010-11-05 00:27:34Z ramon $ + * @version $Id: Yaml.php 23650 2011-01-21 21:32:57Z mikaelkael $ */ /** @@ -57,7 +57,7 @@ /** * Set callback for decoding YAML * - * @param $yamlEncoder the decoder to set + * @param callable $yamlEncoder the decoder to set * @return Zend_Config_Yaml */ public function setYamlEncoder($yamlEncoder) diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Xml.php --- a/web/lib/Zend/Config/Xml.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Xml.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Xml.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Xml.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config_Xml extends Zend_Config @@ -58,10 +58,20 @@ * * Note that the keys in $section will override any keys of the same * name in the sections that have been included via "extends". + * + * The $options parameter may be provided as either a boolean or an array. + * If provided as a boolean, this sets the $allowModifications option of + * Zend_Config. If provided as an array, there are two configuration + * directives that may be set. For example: * - * @param string $xml XML file or string to process - * @param mixed $section Section to process - * @param boolean $options Whether modifications are allowed at runtime + * $options = array( + * 'allowModifications' => false, + * 'skipExtends' => false + * ); + * + * @param string $xml XML file or string to process + * @param mixed $section Section to process + * @param array|boolean $options * @throws Zend_Config_Exception When xml is not set or cannot be loaded * @throws Zend_Config_Exception When section $sectionName cannot be found in $xml */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Config/Yaml.php --- a/web/lib/Zend/Config/Yaml.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Config/Yaml.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Yaml.php 23294 2010-11-05 00:27:34Z ramon $ + * @version $Id: Yaml.php 25169 2012-12-22 12:23:11Z rob $ */ /** @@ -29,7 +29,7 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Config_Yaml extends Zend_Config @@ -93,7 +93,7 @@ /** * Set callback for decoding YAML * - * @param $yamlDecoder the decoder to set + * @param callable $yamlDecoder the decoder to set * @return Zend_Config_Yaml */ public function setYamlDecoder($yamlDecoder) @@ -124,9 +124,9 @@ * - skip_extends: whether or not to skip processing of parent configuration * - yaml_decoder: a callback to use to decode the Yaml source * - * @param string $yaml YAML file to process - * @param mixed $section Section to process - * @param boolean $options Whether modifiacations are allowed at runtime + * @param string $yaml YAML file to process + * @param mixed $section Section to process + * @param array|boolean $options */ public function __construct($yaml, $section = null, $options = false) { @@ -201,7 +201,10 @@ foreach ($section as $sectionName) { if (!isset($config[$sectionName])) { require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section)); + throw new Zend_Config_Exception(sprintf( + 'Section "%s" cannot be found', + implode(' ', (array)$section) + )); } $dataArray = array_merge($this->_processExtends($config, $sectionName), $dataArray); @@ -210,7 +213,10 @@ } else { if (!isset($config[$section])) { require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section)); + throw new Zend_Config_Exception(sprintf( + 'Section "%s" cannot be found', + implode(' ', (array)$section) + )); } $dataArray = $this->_processExtends($config, $section); @@ -284,14 +290,13 @@ $config = array(); $inIndent = false; while (list($n, $line) = each($lines)) { - $lineno = $n+1; + $lineno = $n + 1; + + $line = rtrim(preg_replace("/#.*$/", "", $line)); if (strlen($line) == 0) { continue; } - if ($line[0] == '#') { - // comment - continue; - } + $indent = strspn($line, " "); // line without the spaces @@ -311,20 +316,12 @@ $inIndent = true; } - if (preg_match("/(\w+):\s*(.*)/", $line, $m)) { + if (preg_match("/(?!-)([\w\-]+):\s*(.*)/", $line, $m)) { // key: value - if ($m[2]) { + if (strlen($m[2])) { // simple key: value - $value = $m[2]; - // Check for booleans and constants - if (preg_match('/^(t(rue)?|on|y(es)?)$/i', $value)) { - $value = true; - } elseif (preg_match('/^(f(alse)?|off|n(o)?)$/i', $value)) { - $value = false; - } elseif (!self::$_ignoreConstants) { - // test for constants - $value = self::_replaceConstants($value); - } + $value = preg_replace("/#.*$/", "", $m[2]); + $value = self::_parseValue($value); } else { // key: and then values on new lines $value = self::_decodeYaml($currentIndent + 1, $lines); @@ -337,7 +334,9 @@ // item in the list: // - FOO if (strlen($line) > 2) { - $config[] = substr($line, 2); + $value = substr($line, 2); + + $config[] = self::_parseValue($value); } else { $config[] = self::_decodeYaml($currentIndent + 1, $lines); } @@ -353,6 +352,40 @@ } /** + * Parse values + * + * @param string $value + * @return string + */ + protected static function _parseValue($value) + { + $value = trim($value); + + // remove quotes from string. + if ('"' == $value['0']) { + if ('"' == $value[count($value) -1]) { + $value = substr($value, 1, -1); + } + } elseif ('\'' == $value['0'] && '\'' == $value[count($value) -1]) { + $value = strtr($value, array("''" => "'", "'" => '')); + } + + // Check for booleans and constants + if (preg_match('/^(t(rue)?|on|y(es)?)$/i', $value)) { + $value = true; + } elseif (preg_match('/^(f(alse)?|off|n(o)?)$/i', $value)) { + $value = false; + } elseif (strcasecmp($value, 'null') === 0) { + $value = null; + } elseif (!self::$_ignoreConstants) { + // test for constants + $value = self::_replaceConstants($value); + } + + return $value; + } + + /** * Replace any constants referenced in a string with their values * * @param string $value diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Console/Getopt.php --- a/web/lib/Zend/Console/Getopt.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Console/Getopt.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * * @category Zend * @package Zend_Console_Getopt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Getopt.php 22191 2010-05-17 21:50:14Z jan $ + * @version $Id: Getopt.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -80,7 +80,7 @@ * * @category Zend * @package Zend_Console_Getopt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version Release: @package_version@ * @since Class available since Release 0.6.0 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Console/Getopt/Exception.php --- a/web/lib/Zend/Console/Getopt/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Console/Getopt/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Console_Getopt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ /** * @category Zend * @package Zend_Console_Getopt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Console_Getopt_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action.php --- a/web/lib/Zend/Controller/Action.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Action.php 22792 2010-08-05 18:30:27Z matthew $ + * @version $Id: Action.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -37,7 +37,7 @@ /** * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interface @@ -505,14 +505,18 @@ $this->_classMethods = get_class_methods($this); } - // preDispatch() didn't change the action, so we can continue - if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) { - if ($this->getInvokeArg('useCaseSensitiveActions')) { - trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"'); + // If pre-dispatch hooks introduced a redirect then stop dispatch + // @see ZF-7496 + if (!($this->getResponse()->isRedirect())) { + // preDispatch() didn't change the action, so we can continue + if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) { + if ($this->getInvokeArg('useCaseSensitiveActions')) { + trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"'); + } + $this->$action(); + } else { + $this->__call($action, array()); } - $this->$action(); - } else { - $this->__call($action, array()); } $this->postDispatch(); } @@ -579,8 +583,24 @@ */ protected function _getParam($paramName, $default = null) { + return $this->getParam($paramName, $default); + } + + /** + * Gets a parameter from the {@link $_request Request object}. If the + * parameter does not exist, NULL will be returned. + * + * If the parameter does not exist and $default is set, then + * $default will be returned instead of NULL. + * + * @param string $paramName + * @param mixed $default + * @return mixed + */ + public function getParam($paramName, $default = null) + { $value = $this->getRequest()->getParam($paramName); - if ((null === $value || '' === $value) && (null !== $default)) { + if ((null === $value || '' === $value) && (null !== $default)) { $value = $default; } @@ -593,9 +613,23 @@ * @param string $paramName * @param mixed $value * @return Zend_Controller_Action + * @deprecated Deprecated as of Zend Framework 1.7. Use + * setParam() instead. */ protected function _setParam($paramName, $value) { + return $this->setParam($paramName, $value); + } + + /** + * Set a parameter in the {@link $_request Request object}. + * + * @param string $paramName + * @param mixed $value + * @return Zend_Controller_Action + */ + public function setParam($paramName, $value) + { $this->getRequest()->setParam($paramName, $value); return $this; @@ -607,9 +641,23 @@ * * @param string $paramName * @return boolean + * @deprecated Deprecated as of Zend Framework 1.7. Use + * hasParam() instead. */ protected function _hasParam($paramName) { + return $this->hasParam($paramName); + } + + /** + * Determine whether a given parameter exists in the + * {@link $_request Request object}. + * + * @param string $paramName + * @return boolean + */ + public function hasParam($paramName) + { return null !== $this->getRequest()->getParam($paramName); } @@ -618,9 +666,22 @@ * as an associative array. * * @return array + * @deprecated Deprecated as of Zend Framework 1.7. Use + * getAllParams() instead. */ protected function _getAllParams() { + return $this->getAllParams(); + } + + /** + * Return all parameters in the {@link $_request Request object} + * as an associative array. + * + * @return array + */ + public function getAllParams() + { return $this->getRequest()->getParams(); } @@ -650,9 +711,42 @@ * @param string $module * @param array $params * @return void + * @deprecated Deprecated as of Zend Framework 1.7. Use + * forward() instead. */ final protected function _forward($action, $controller = null, $module = null, array $params = null) { + $this->forward($action, $controller, $module, $params); + } + + /** + * Forward to another controller/action. + * + * It is important to supply the unformatted names, i.e. "article" + * rather than "ArticleController". The dispatcher will do the + * appropriate formatting when the request is received. + * + * If only an action name is provided, forwards to that action in this + * controller. + * + * If an action and controller are specified, forwards to that action and + * controller in this module. + * + * Specifying an action, controller, and module is the most specific way to + * forward. + * + * A fourth argument, $params, will be used to set the request parameters. + * If either the controller or module are unnecessary for forwarding, + * simply pass null values for them before specifying the parameters. + * + * @param string $action + * @param string $controller + * @param string $module + * @param array $params + * @return void + */ + final public function forward($action, $controller = null, $module = null, array $params = null) + { $request = $this->getRequest(); if (null !== $params) { @@ -680,9 +774,25 @@ * @param string $url * @param array $options Options to be used when redirecting * @return void + * @deprecated Deprecated as of Zend Framework 1.7. Use + * redirect() instead. */ protected function _redirect($url, array $options = array()) { + $this->redirect($url, $options); + } + + /** + * Redirect to another URL + * + * Proxies to {@link Zend_Controller_Action_Helper_Redirector::gotoUrl()}. + * + * @param string $url + * @param array $options Options to be used when redirecting + * @return void + */ + public function redirect($url, array $options = array()) + { $this->_helper->redirector->gotoUrl($url, $options); } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Exception.php --- a/web/lib/Zend/Controller/Action/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Exception extends Zend_Controller_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/Abstract.php --- a/web/lib/Zend/Controller/Action/Helper/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20261 2010-01-13 18:55:25Z matthew $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Action_Helper_Abstract @@ -142,13 +142,15 @@ */ public function getName() { - $full_class_name = get_class($this); - - if (strpos($full_class_name, '_') !== false) { - $helper_name = strrchr($full_class_name, '_'); - return ltrim($helper_name, '_'); + $fullClassName = get_class($this); + if (strpos($fullClassName, '_') !== false) { + $helperName = strrchr($fullClassName, '_'); + return ltrim($helperName, '_'); + } elseif (strpos($fullClassName, '\\') !== false) { + $helperName = strrchr($fullClassName, '\\'); + return ltrim($helperName, '\\'); } else { - return $full_class_name; + return $fullClassName; } } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/ActionStack.php --- a/web/lib/Zend/Controller/Action/Helper/ActionStack.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/ActionStack.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ActionStack.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ActionStack.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_ActionStack extends Zend_Controller_Action_Helper_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/AjaxContext.php --- a/web/lib/Zend/Controller/Action/Helper/AjaxContext.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/AjaxContext.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AjaxContext.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: AjaxContext.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_AjaxContext extends Zend_Controller_Action_Helper_ContextSwitch @@ -68,7 +68,10 @@ { $this->_currentContext = null; - if (!$this->getRequest()->isXmlHttpRequest()) { + $request = $this->getRequest(); + if (!method_exists($request, 'isXmlHttpRequest') || + !$this->getRequest()->isXmlHttpRequest()) + { return; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/AutoComplete/Abstract.php --- a/web/lib/Zend/Controller/Action/Helper/AutoComplete/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/AutoComplete/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Action_Helper_AutoComplete_Abstract extends Zend_Controller_Action_Helper_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/AutoCompleteDojo.php --- a/web/lib/Zend/Controller/Action/Helper/AutoCompleteDojo.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/AutoCompleteDojo.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AutoCompleteDojo.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: AutoCompleteDojo.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_AutoCompleteDojo extends Zend_Controller_Action_Helper_AutoComplete_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php --- a/web/lib/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AutoCompleteScriptaculous.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: AutoCompleteScriptaculous.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_AutoCompleteScriptaculous extends Zend_Controller_Action_Helper_AutoComplete_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/Cache.php --- a/web/lib/Zend/Controller/Action/Helper/Cache.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/Cache.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Cache.php 22662 2010-07-24 17:37:36Z mabe $ + * @version $Id: Cache.php 24853 2012-05-31 23:19:27Z adamlundrigan $ */ /** @@ -37,7 +37,7 @@ /** * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_Cache @@ -64,7 +64,7 @@ * @var array */ protected $_tags = array(); - + /** * Indexed map of Extensions by Controller and Action * @@ -130,16 +130,26 @@ public function removePage($relativeUrl, $recursive = false) { $cache = $this->getCache(Zend_Cache_Manager::PAGECACHE); + $encodedCacheId = $this->_encodeCacheId($relativeUrl); + if ($recursive) { $backend = $cache->getBackend(); if (($backend instanceof Zend_Cache_Backend) && method_exists($backend, 'removeRecursively') ) { - return $backend->removeRecursively($relativeUrl); + $result = $backend->removeRecursively($encodedCacheId); + if (is_null($result) ) { + $result = $backend->removeRecursively($relativeUrl); + } + return $result; } } - return $cache->remove($relativeUrl); + $result = $cache->remove($encodedCacheId); + if (is_null($result) ) { + $result = $cache->remove($relativeUrl); + } + return $result; } /** @@ -189,7 +199,7 @@ ->start($this->_encodeCacheId($reqUri), $tags, $extension); } } - + /** * Encode a Cache ID as hexadecimal. This is a workaround because Backend ID validation * is trapped in the Frontend classes. Will try to get this reversed for ZF 2.0 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/ContextSwitch.php --- a/web/lib/Zend/Controller/Action/Helper/ContextSwitch.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/ContextSwitch.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ContextSwitch.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ContextSwitch.php 24864 2012-06-02 00:51:50Z adamlundrigan $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action_Helper_Abstract @@ -1304,7 +1304,6 @@ if (null === $controller) { return array(); } - $action = (string) $action; $contextKey = $this->_contextKey; if (!isset($controller->$contextKey)) { @@ -1312,6 +1311,7 @@ } if (null !== $action) { + $action = (string) $action; if (isset($controller->{$contextKey}[$action])) { return $controller->{$contextKey}[$action]; } else { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/FlashMessenger.php --- a/web/lib/Zend/Controller/Action/Helper/FlashMessenger.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/FlashMessenger.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -36,9 +36,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: FlashMessenger.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: FlashMessenger.php 24813 2012-05-22 16:49:24Z adamlundrigan $ */ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Action_Helper_Abstract implements IteratorAggregate, Countable { @@ -112,6 +112,16 @@ $this->_namespace = $namespace; return $this; } + + /** + * getNamespace() - return the current namepsace + * + * @return string + */ + public function getNamespace() + { + return $this->_namespace; + } /** * resetNamespace() - reset the namespace to the default @@ -130,17 +140,22 @@ * @param string $message * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface */ - public function addMessage($message) + public function addMessage($message, $namespace = null) { + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + if (self::$_messageAdded === false) { self::$_session->setExpirationHops(1, null, true); } if (!is_array(self::$_session->{$this->_namespace})) { - self::$_session->{$this->_namespace} = array(); + self::$_session->{$namespace} = array(); } - self::$_session->{$this->_namespace}[] = $message; + self::$_session->{$namespace}[] = $message; + self::$_messageAdded = true; return $this; } @@ -150,9 +165,13 @@ * * @return boolean */ - public function hasMessages() + public function hasMessages($namespace = null) { - return isset(self::$_messages[$this->_namespace]); + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + + return isset(self::$_messages[$namespace]); } /** @@ -160,10 +179,14 @@ * * @return array */ - public function getMessages() + public function getMessages($namespace = null) { - if ($this->hasMessages()) { - return self::$_messages[$this->_namespace]; + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + + if ($this->hasMessages($namespace)) { + return self::$_messages[$namespace]; } return array(); @@ -174,10 +197,14 @@ * * @return boolean True if messages were cleared, false if none existed */ - public function clearMessages() + public function clearMessages($namespace = null) { - if ($this->hasMessages()) { - unset(self::$_messages[$this->_namespace]); + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + + if ($this->hasMessages($namespace)) { + unset(self::$_messages[$namespace]); return true; } @@ -190,9 +217,13 @@ * * @return boolean */ - public function hasCurrentMessages() + public function hasCurrentMessages($namespace = null) { - return isset(self::$_session->{$this->_namespace}); + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + + return isset(self::$_session->{$namespace}); } /** @@ -201,10 +232,14 @@ * * @return array */ - public function getCurrentMessages() + public function getCurrentMessages($namespace = null) { - if ($this->hasCurrentMessages()) { - return self::$_session->{$this->_namespace}; + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + + if ($this->hasCurrentMessages($namespace)) { + return self::$_session->{$namespace}; } return array(); @@ -215,10 +250,14 @@ * * @return boolean */ - public function clearCurrentMessages() + public function clearCurrentMessages($namespace = null) { + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + if ($this->hasCurrentMessages()) { - unset(self::$_session->{$this->_namespace}); + unset(self::$_session->{$namespace}); return true; } @@ -230,10 +269,14 @@ * * @return ArrayObject */ - public function getIterator() + public function getIterator($namespace = null) { - if ($this->hasMessages()) { - return new ArrayObject($this->getMessages()); + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + + if ($this->hasMessages($namespace)) { + return new ArrayObject($this->getMessages($namespace)); } return new ArrayObject(); @@ -244,10 +287,14 @@ * * @return int */ - public function count() + public function count($namespace = null) { - if ($this->hasMessages()) { - return count($this->getMessages()); + if (!is_string($namespace) || $namespace == '') { + $namespace = $this->getNamespace(); + } + + if ($this->hasMessages($namespace)) { + return count($this->getMessages($namespace)); } return 0; @@ -259,8 +306,8 @@ * @param string $message * @return void */ - public function direct($message) + public function direct($message, $namespace=NULL) { - return $this->addMessage($message); + return $this->addMessage($message, $namespace); } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/Json.php --- a/web/lib/Zend/Controller/Action/Helper/Json.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/Json.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Json.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Json.php 24829 2012-05-30 12:31:39Z adamlundrigan $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_Abstract @@ -53,23 +53,24 @@ * @param mixed $data * @param boolean $keepLayouts * @param boolean|array $keepLayouts + * @param boolean $encodeData Provided data is already JSON * NOTE: if boolean, establish $keepLayouts to true|false * if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false * if $keepLayouts and parmas for Zend_Json::encode are required - * then, the array can contains a 'keepLayout'=>true|false + * then, the array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false * that will not be passed to Zend_Json::encode method but will be passed * to Zend_View_Helper_Json * @throws Zend_Controller_Action_Helper_Json * @return string */ - public function encodeJson($data, $keepLayouts = false) + public function encodeJson($data, $keepLayouts = false, $encodeData = true) { /** * @see Zend_View_Helper_Json */ require_once 'Zend/View/Helper/Json.php'; $jsonHelper = new Zend_View_Helper_Json(); - $data = $jsonHelper->json($data, $keepLayouts); + $data = $jsonHelper->json($data, $keepLayouts, $encodeData); if (!$keepLayouts) { /** @@ -87,17 +88,18 @@ * * @param mixed $data * @param boolean|array $keepLayouts + * @param $encodeData Encode $data as JSON? * NOTE: if boolean, establish $keepLayouts to true|false * if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false * if $keepLayouts and parmas for Zend_Json::encode are required - * then, the array can contains a 'keepLayout'=>true|false + * then, the array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false * that will not be passed to Zend_Json::encode method but will be passed * to Zend_View_Helper_Json * @return string|void */ - public function sendJson($data, $keepLayouts = false) + public function sendJson($data, $keepLayouts = false, $encodeData = true) { - $data = $this->encodeJson($data, $keepLayouts); + $data = $this->encodeJson($data, $keepLayouts, $encodeData); $response = $this->getResponse(); $response->setBody($data); @@ -118,13 +120,14 @@ * @param mixed $data * @param boolean $sendNow * @param boolean $keepLayouts + * @param boolean $encodeData Encode $data as JSON? * @return string|void */ - public function direct($data, $sendNow = true, $keepLayouts = false) + public function direct($data, $sendNow = true, $keepLayouts = false, $encodeData = true) { if ($sendNow) { - return $this->sendJson($data, $keepLayouts); + return $this->sendJson($data, $keepLayouts, $encodeData); } - return $this->encodeJson($data, $keepLayouts); + return $this->encodeJson($data, $keepLayouts, $encodeData); } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/Redirector.php --- a/web/lib/Zend/Controller/Action/Helper/Redirector.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/Redirector.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Redirector.php 23248 2010-10-26 12:45:52Z matthew $ + * @version $Id: Redirector.php 24843 2012-05-31 18:43:18Z rob $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_Helper_Abstract @@ -100,7 +100,7 @@ } /** - * Retrieve HTTP status code for {@link _redirect()} behaviour + * Set HTTP status code for {@link _redirect()} behaviour * * @param int $code * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface @@ -123,7 +123,7 @@ } /** - * Retrieve exit flag for {@link _redirect()} behaviour + * Set exit flag for {@link _redirect()} behaviour * * @param boolean $flag * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface @@ -146,7 +146,7 @@ } /** - * Retrieve 'prepend base' flag for {@link _redirect()} behaviour + * Set 'prepend base' flag for {@link _redirect()} behaviour * * @param boolean $flag * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface @@ -294,9 +294,9 @@ } } - $params['module'] = $module; - $params['controller'] = $controller; - $params['action'] = $action; + $params[$request->getModuleKey()] = $module; + $params[$request->getControllerKey()] = $controller; + $params[$request->getActionKey()] = $action; $router = $this->getFrontController()->getRouter(); $url = $router->assemble($params, 'default', true); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/Url.php --- a/web/lib/Zend/Controller/Action/Helper/Url.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/Url.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Url.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Url.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_Url extends Zend_Controller_Action_Helper_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Helper/ViewRenderer.php --- a/web/lib/Zend/Controller/Action/Helper/ViewRenderer.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Helper/ViewRenderer.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ViewRenderer.php 20261 2010-01-13 18:55:25Z matthew $ + * @version $Id: ViewRenderer.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -68,7 +68,7 @@ * @uses Zend_Controller_Action_Helper_Abstract * @package Zend_Controller * @subpackage Zend_Controller_Action_Helper - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Action_Helper_Abstract @@ -626,6 +626,9 @@ } elseif (null !== $action) { $vars['action'] = $action; } + + $replacePattern = array('/[^a-z0-9]+$/i', '/^[^a-z0-9]+/i'); + $vars['action'] = preg_replace($replacePattern, '', $vars['action']); $inflector = $this->getInflector(); if ($this->getNoController() || $this->getNeverController()) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/HelperBroker.php --- a/web/lib/Zend/Controller/Action/HelperBroker.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/HelperBroker.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: HelperBroker.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: HelperBroker.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_HelperBroker diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/HelperBroker/PriorityStack.php --- a/web/lib/Zend/Controller/Action/HelperBroker/PriorityStack.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/HelperBroker/PriorityStack.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,16 +15,16 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: PriorityStack.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: PriorityStack.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggregate, ArrayAccess, Countable diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Action/Interface.php --- a/web/lib/Zend/Controller/Action/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Action/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,16 +15,16 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Action - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Controller_Action_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Dispatcher/Abstract.php --- a/web/lib/Zend/Controller/Dispatcher/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Dispatcher/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Dispatcher - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Controller_Dispatcher_Interface */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Controller * @subpackage Dispatcher - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Dispatcher_Abstract implements Zend_Controller_Dispatcher_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Dispatcher/Exception.php --- a/web/lib/Zend/Controller/Dispatcher/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Dispatcher/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Dispatcher - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Controller * @subpackage Dispatcher - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Dispatcher_Exception extends Zend_Controller_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Dispatcher/Interface.php --- a/web/lib/Zend/Controller/Dispatcher/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Dispatcher/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Dispatcher - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ /** * @package Zend_Controller * @subpackage Dispatcher - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Controller_Dispatcher_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Dispatcher/Standard.php --- a/web/lib/Zend/Controller/Dispatcher/Standard.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Dispatcher/Standard.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Dispatcher - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Standard.php 22038 2010-04-28 18:54:22Z matthew $ + * @version $Id: Standard.php 24861 2012-06-01 23:40:13Z adamlundrigan $ */ /** Zend_Loader */ @@ -30,7 +30,7 @@ * @category Zend * @package Zend_Controller * @subpackage Dispatcher - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abstract @@ -257,6 +257,19 @@ } /** + * If we're in a module or prefixDefaultModule is on, we must add the module name + * prefix to the contents of $className, as getControllerClass does not do that automatically. + * We must keep a separate variable because modules are not strictly PSR-0: We need the no-module-prefix + * class name to do the class->file mapping, but the full class name to insantiate the controller + */ + $moduleClassName = $className; + if (($this->_defaultModule != $this->_curModule) + || $this->getParam('prefixDefaultModule')) + { + $moduleClassName = $this->formatClassName($this->_curModule, $className); + } + + /** * Load the controller class file */ $className = $this->loadClass($className); @@ -265,12 +278,12 @@ * Instantiate controller with request, response, and invocation * arguments; throw exception if it's not an action controller */ - $controller = new $className($request, $this->getResponse(), $this->getParams()); + $controller = new $moduleClassName($request, $this->getResponse(), $this->getParams()); if (!($controller instanceof Zend_Controller_Action_Interface) && !($controller instanceof Zend_Controller_Action)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; throw new Zend_Controller_Dispatcher_Exception( - 'Controller "' . $className . '" is not an instance of Zend_Controller_Action_Interface' + 'Controller "' . $moduleClassName . '" is not an instance of Zend_Controller_Action_Interface' ); } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Exception.php --- a/web/lib/Zend/Controller/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Front.php --- a/web/lib/Zend/Controller/Front.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Front.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Front.php 20246 2010-01-12 21:36:08Z dasprid $ + * @version $Id: Front.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -32,7 +32,7 @@ /** * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Front diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Plugin/Abstract.php --- a/web/lib/Zend/Controller/Plugin/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Plugin/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,16 +15,16 @@ * @category Zend * @package Zend_Controller * @subpackage Plugins - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Controller * @subpackage Plugins - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Plugin_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Plugin/ActionStack.php --- a/web/lib/Zend/Controller/Plugin/ActionStack.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Plugin/ActionStack.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Controller * @subpackage Plugins - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -32,9 +32,9 @@ * @category Zend * @package Zend_Controller * @subpackage Plugins - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ActionStack.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: ActionStack.php 24593 2012-01-05 20:35:02Z matthew $ */ class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Plugin/Broker.php --- a/web/lib/Zend/Controller/Plugin/Broker.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Plugin/Broker.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Plugins - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Broker.php 20255 2010-01-13 13:23:36Z matthew $ + * @version $Id: Broker.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Controller_Plugin_Abstract */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Controller * @subpackage Plugins - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract @@ -237,7 +237,7 @@ $plugin->routeStartup($request); } catch (Exception $e) { if (Zend_Controller_Front::getInstance()->throwExceptions()) { - throw $e; + throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e); } else { $this->getResponse()->setException($e); } @@ -260,7 +260,7 @@ $plugin->routeShutdown($request); } catch (Exception $e) { if (Zend_Controller_Front::getInstance()->throwExceptions()) { - throw $e; + throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e); } else { $this->getResponse()->setException($e); } @@ -287,7 +287,7 @@ $plugin->dispatchLoopStartup($request); } catch (Exception $e) { if (Zend_Controller_Front::getInstance()->throwExceptions()) { - throw $e; + throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e); } else { $this->getResponse()->setException($e); } @@ -309,9 +309,11 @@ $plugin->preDispatch($request); } catch (Exception $e) { if (Zend_Controller_Front::getInstance()->throwExceptions()) { - throw $e; + throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e); } else { $this->getResponse()->setException($e); + // skip rendering of normal dispatch give the error handler a try + $this->getRequest()->setDispatched(false); } } } @@ -331,7 +333,7 @@ $plugin->postDispatch($request); } catch (Exception $e) { if (Zend_Controller_Front::getInstance()->throwExceptions()) { - throw $e; + throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e); } else { $this->getResponse()->setException($e); } @@ -353,7 +355,7 @@ $plugin->dispatchLoopShutdown(); } catch (Exception $e) { if (Zend_Controller_Front::getInstance()->throwExceptions()) { - throw $e; + throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e); } else { $this->getResponse()->setException($e); } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Plugin/ErrorHandler.php --- a/web/lib/Zend/Controller/Plugin/ErrorHandler.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Plugin/ErrorHandler.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Controller * @subpackage Plugins - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,9 +30,9 @@ * @category Zend * @package Zend_Controller * @subpackage Plugins - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ErrorHandler.php 20246 2010-01-12 21:36:08Z dasprid $ + * @version $Id: ErrorHandler.php 24593 2012-01-05 20:35:02Z matthew $ */ class Zend_Controller_Plugin_ErrorHandler extends Zend_Controller_Plugin_Abstract { @@ -193,8 +193,8 @@ /** * Route shutdown hook -- Ccheck for router exceptions - * - * @param Zend_Controller_Request_Abstract $request + * + * @param Zend_Controller_Request_Abstract $request */ public function routeShutdown(Zend_Controller_Request_Abstract $request) { @@ -202,6 +202,17 @@ } /** + * Pre dispatch hook -- check for exceptions and dispatch error handler if + * necessary + * + * @param Zend_Controller_Request_Abstract $request + */ + public function preDispatch(Zend_Controller_Request_Abstract $request) + { + $this->_handleError($request); + } + + /** * Post dispatch hook -- check for exceptions and dispatch error handler if * necessary * diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Plugin/PutHandler.php --- a/web/lib/Zend/Controller/Plugin/PutHandler.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Plugin/PutHandler.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Zend_Controller_Plugin - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: PutHandler.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: PutHandler.php 25024 2012-07-30 15:08:15Z rob $ */ /** @@ -35,7 +35,7 @@ * * @package Zend_Controller * @subpackage Zend_Controller_Plugin - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Plugin_PutHandler extends Zend_Controller_Plugin_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Request/Abstract.php --- a/web/lib/Zend/Controller/Request/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Request/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,15 +14,15 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Request_Abstract @@ -312,7 +312,7 @@ { $this->_params = $this->_params + (array) $array; - foreach ($this->_params as $key => $value) { + foreach ($array as $key => $value) { if (null === $value) { unset($this->_params[$key]); } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Request/Apache404.php --- a/web/lib/Zend/Controller/Request/Apache404.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Request/Apache404.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Apache404.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Apache404.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Controller_Request_Http */ @@ -50,8 +50,8 @@ $requestUri = $_SERVER['HTTP_X_REWRITE_URL']; } elseif (isset($_SERVER['REDIRECT_URL'])) { // Check if using mod_rewrite $requestUri = $_SERVER['REDIRECT_URL']; - if (isset($_SERVER['REDIRECT_QUERYSTRING'])) { - $parseUriGetVars = $_SERVER['REDIRECT_QUERYSTRING']; + if (isset($_SERVER['REDIRECT_QUERY_STRING'])) { + $parseUriGetVars = $_SERVER['REDIRECT_QUERY_STRING']; } } elseif (isset($_SERVER['REQUEST_URI'])) { $requestUri = $_SERVER['REQUEST_URI']; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Request/Exception.php --- a/web/lib/Zend/Controller/Request/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Request/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Request - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Controller * @subpackage Request - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Request_Exception extends Zend_Controller_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Request/Http.php --- a/web/lib/Zend/Controller/Request/Http.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Request/Http.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Http.php 23414 2010-11-20 10:56:11Z bittarman $ + * @version $Id: Http.php 24842 2012-05-31 18:31:28Z rob $ */ /** @see Zend_Controller_Request_Abstract */ @@ -390,7 +390,11 @@ public function setRequestUri($requestUri = null) { if ($requestUri === null) { - if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch + if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { + // IIS with Microsoft Rewrite Module + $requestUri = $_SERVER['HTTP_X_ORIGINAL_URL']; + } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { + // IIS with ISAPI_Rewrite $requestUri = $_SERVER['HTTP_X_REWRITE_URL']; } elseif ( // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem) @@ -545,13 +549,13 @@ * * @return string */ - public function getBaseUrl() + public function getBaseUrl($raw = false) { if (null === $this->_baseUrl) { $this->setBaseUrl(); } - return urldecode($this->_baseUrl); + return (($raw == false) ? urldecode($this->_baseUrl) : $this->_baseUrl); } /** @@ -612,31 +616,33 @@ public function setPathInfo($pathInfo = null) { if ($pathInfo === null) { - $baseUrl = $this->getBaseUrl(); - + $baseUrl = $this->getBaseUrl(); // this actually calls setBaseUrl() & setRequestUri() + $baseUrlRaw = $this->getBaseUrl(false); + $baseUrlEncoded = urlencode($baseUrlRaw); + if (null === ($requestUri = $this->getRequestUri())) { return $this; } - + // Remove the query string from REQUEST_URI if ($pos = strpos($requestUri, '?')) { $requestUri = substr($requestUri, 0, $pos); } - $requestUri = urldecode($requestUri); - - if (null !== $baseUrl - && ((!empty($baseUrl) && 0 === strpos($requestUri, $baseUrl)) - || empty($baseUrl)) - && false === ($pathInfo = substr($requestUri, strlen($baseUrl))) - ){ - // If substr() returns false then PATH_INFO is set to an empty string - $pathInfo = ''; - } elseif (null === $baseUrl - || (!empty($baseUrl) && false === strpos($requestUri, $baseUrl)) - ) { - $pathInfo = $requestUri; + if (!empty($baseUrl) || !empty($baseUrlRaw)) { + if (strpos($requestUri, $baseUrl) === 0) { + $pathInfo = substr($requestUri, strlen($baseUrl)); + } elseif (strpos($requestUri, $baseUrlRaw) === 0) { + $pathInfo = substr($requestUri, strlen($baseUrlRaw)); + } elseif (strpos($requestUri, $baseUrlEncoded) === 0) { + $pathInfo = substr($requestUri, strlen($baseUrlEncoded)); + } else { + $pathInfo = $requestUri; + } + } else { + $pathInfo = $requestUri; } + } $this->_pathInfo = (string) $pathInfo; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Request/HttpTestCase.php --- a/web/lib/Zend/Controller/Request/HttpTestCase.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Request/HttpTestCase.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: HttpTestCase.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: HttpTestCase.php 24593 2012-01-05 20:35:02Z matthew $ */ /** diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Request/Simple.php --- a/web/lib/Zend/Controller/Request/Simple.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Request/Simple.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Request - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Simple.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Controller_Request_Abstract */ @@ -27,7 +27,7 @@ * @category Zend * @package Zend_Controller * @subpackage Request - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Request_Simple extends Zend_Controller_Request_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Response/Abstract.php --- a/web/lib/Zend/Controller/Response/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Response/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 21301 2010-03-02 23:01:19Z yoshida@zend.co.jp $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * * @package Zend_Controller * @subpackage Response - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Response_Abstract @@ -257,7 +257,9 @@ } $key = array_search($headerRaw, $this->_headersRaw); - unset($this->_headersRaw[$key]); + if ($key !== false) { + unset($this->_headersRaw[$key]); + } return $this; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Response/Cli.php --- a/web/lib/Zend/Controller/Response/Cli.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Response/Cli.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Cli.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Cli.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -32,7 +32,7 @@ * @uses Zend_Controller_Response_Abstract * @package Zend_Controller * @subpackage Response - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Response_Cli extends Zend_Controller_Response_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Response/Exception.php --- a/web/lib/Zend/Controller/Response/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Response/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Request - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -28,7 +28,7 @@ /** * @package Zend_Controller * @subpackage Response - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Response_Exception extends Zend_Controller_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Response/Http.php --- a/web/lib/Zend/Controller/Response/Http.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Response/Http.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $ */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Response/HttpTestCase.php --- a/web/lib/Zend/Controller/Response/HttpTestCase.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Response/HttpTestCase.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Controller - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: HttpTestCase.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: HttpTestCase.php 24593 2012-01-05 20:35:02Z matthew $ */ /** diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Abstract.php --- a/web/lib/Zend/Controller/Router/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,12 +31,17 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Router_Abstract implements Zend_Controller_Router_Interface { /** + * URI delimiter + */ + const URI_DELIMITER = '/'; + + /** * Front controller instance * @var Zend_Controller_Front */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Exception.php --- a/web/lib/Zend/Controller/Router/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -28,7 +28,7 @@ /** * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Router_Exception extends Zend_Controller_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Interface.php --- a/web/lib/Zend/Controller/Router/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,15 +15,15 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Controller_Router_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Rewrite.php --- a/web/lib/Zend/Controller/Router/Rewrite.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Rewrite.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Rewrite.php 23362 2010-11-18 17:22:41Z bittarman $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Rewrite.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -31,7 +31,7 @@ * * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @see http://manuals.rubyonrails.com/read/chapter/65 */ @@ -381,7 +381,7 @@ // Find the matching route $routeMatched = false; - + foreach (array_reverse($this->_routes, true) as $name => $route) { // TODO: Should be an interface method. Hack for 1.0 BC if (method_exists($route, 'isAbstract') && $route->isAbstract()) { @@ -450,6 +450,11 @@ */ public function assemble($userParams, $name = null, $reset = false, $encode = true) { + if (!is_array($userParams)) { + require_once 'Zend/Controller/Router/Exception.php'; + throw new Zend_Controller_Router_Exception('userParams must be an array'); + } + if ($name == null) { try { $name = $this->getCurrentRouteName(); @@ -458,14 +463,14 @@ } } - // Use UNION (+) in order to preserve numeric keys + // Use UNION (+) in order to preserve numeric keys $params = $userParams + $this->_globalParams; $route = $this->getRoute($name); $url = $route->assemble($params, $reset, $encode); if (!preg_match('|^[a-z]+://|', $url)) { - $url = rtrim($this->getFrontController()->getBaseUrl(), '/') . '/' . $url; + $url = rtrim($this->getFrontController()->getBaseUrl(), self::URI_DELIMITER) . self::URI_DELIMITER . $url; } return $url; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Route.php --- a/web/lib/Zend/Controller/Router/Route.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Route.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Route.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Route.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -28,7 +28,7 @@ * * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @see http://manuals.rubyonrails.com/read/chapter/65 */ @@ -77,7 +77,7 @@ protected $_translatable = array(); protected $_urlVariable = ':'; - protected $_urlDelimiter = '/'; + protected $_urlDelimiter = self::URI_DELIMITER; protected $_regexDelimiter = '#'; protected $_defaultRegex = null; @@ -294,6 +294,9 @@ foreach ($this->_variables as $var) { if (!array_key_exists($var, $return)) { return false; + } elseif ($return[$var] == '' || $return[$var] === null) { + // Empty variable? Replace with the default value. + $return[$var] = $this->_defaults[$var]; } } @@ -344,7 +347,7 @@ $value = $this->_values[$name]; } elseif (!$reset && !$useDefault && isset($this->_wildcardData[$name])) { $value = $this->_wildcardData[$name]; - } elseif (isset($this->_defaults[$name])) { + } elseif (array_key_exists($name, $this->_defaults)) { $value = $this->_defaults[$name]; } else { require_once 'Zend/Controller/Router/Exception.php'; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Route/Abstract.php --- a/web/lib/Zend/Controller/Router/Route/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Route/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -32,12 +32,17 @@ * * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_Router_Route_Interface { /** + * URI delimiter + */ + const URI_DELIMITER = '/'; + + /** * Wether this route is abstract or not * * @var boolean diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Route/Chain.php --- a/web/lib/Zend/Controller/Router/Route/Chain.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Route/Chain.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Chain.php 23187 2010-10-20 18:42:37Z matthew $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Chain.php 25249 2013-02-06 09:54:24Z frosch $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -28,7 +28,7 @@ * * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Abstract @@ -39,7 +39,8 @@ /** * Instantiates route based on passed Zend_Config structure * - * @param Zend_Config $config Configuration object + * @param Zend_Config $config Configuration object + * @return Zend_Controller_Router_Route_Chain */ public static function getInstance(Zend_Config $config) { @@ -54,7 +55,7 @@ * @param string $separator * @return Zend_Controller_Router_Route_Chain */ - public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = '/') + public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = self::URI_DELIMITER) { $this->_routes[] = $route; $this->_separators[] = $separator; @@ -68,18 +69,21 @@ * Assigns and returns an array of defaults on a successful match. * * @param Zend_Controller_Request_Http $request Request to get the path info from + * @param null $partial * @return array|false An array of assigned values or a false on a mismatch */ public function match($request, $partial = null) { - $path = trim($request->getPathInfo(), '/'); - $subPath = $path; - $values = array(); + $path = trim($request->getPathInfo(), self::URI_DELIMITER); + $subPath = $path; + $values = array(); + $numRoutes = count($this->_routes); + $matchedPath = null; foreach ($this->_routes as $key => $route) { - if ($key > 0 - && $matchedPath !== null - && $subPath !== '' + if ($key > 0 + && $matchedPath !== null + && $subPath !== '' && $subPath !== false ) { $separator = substr($subPath, 0, strlen($this->_separators[$key])); @@ -99,7 +103,7 @@ $match = $request; } - $res = $route->match($match, true); + $res = $route->match($match, true, ($key == $numRoutes - 1)); if ($res === false) { return false; } @@ -126,7 +130,9 @@ /** * Assembles a URL path defined by this route * - * @param array $data An array of variable and value pairs used as parameters + * @param array $data An array of variable and value pairs used as parameters + * @param bool $reset + * @param bool $encode * @return string Route path with user submitted parameters */ public function assemble($data = array(), $reset = false, $encode = false) @@ -169,5 +175,42 @@ } } } + + /** + * Return a single parameter of route's defaults + * + * @param string $name Array key of the parameter + * @return string Previously set default + */ + public function getDefault($name) + { + $default = null; + foreach ($this->_routes as $route) { + if (method_exists($route, 'getDefault')) { + $current = $route->getDefault($name); + if (null !== $current) { + $default = $current; + } + } + } -} + return $default; + } + + /** + * Return an array of defaults + * + * @return array Route defaults + */ + public function getDefaults() + { + $defaults = array(); + foreach ($this->_routes as $route) { + if (method_exists($route, 'getDefaults')) { + $defaults = array_merge($defaults, $route->getDefaults()); + } + } + + return $defaults; + } +} \ No newline at end of file diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Route/Hostname.php --- a/web/lib/Zend/Controller/Router/Route/Hostname.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Route/Hostname.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Hostname.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Hostname.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -28,7 +28,7 @@ * * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @see http://manuals.rubyonrails.com/read/chapter/65 */ @@ -302,7 +302,6 @@ } } - $hostname = implode('.', $host); $url = $scheme . '://' . $url; return $url; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Route/Interface.php --- a/web/lib/Zend/Controller/Router/Route/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Route/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -26,7 +26,7 @@ /** * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Controller_Router_Route_Interface { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Route/Module.php --- a/web/lib/Zend/Controller/Router/Route/Module.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Route/Module.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Module.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Module.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,18 +30,13 @@ * * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @see http://manuals.rubyonrails.com/read/chapter/65 */ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_Abstract { /** - * URI delimiter - */ - const URI_DELIMITER = '/'; - - /** * Default values for the route (ie. module, controller, action, params) * @var array */ @@ -237,29 +232,29 @@ if (is_array($value)) { foreach ($value as $arrayValue) { $arrayValue = ($encode) ? urlencode($arrayValue) : $arrayValue; - $url .= '/' . $key; - $url .= '/' . $arrayValue; + $url .= self::URI_DELIMITER . $key; + $url .= self::URI_DELIMITER . $arrayValue; } } else { if ($encode) $value = urlencode($value); - $url .= '/' . $key; - $url .= '/' . $value; + $url .= self::URI_DELIMITER . $key; + $url .= self::URI_DELIMITER . $value; } } if (!empty($url) || $action !== $this->_defaults[$this->_actionKey]) { if ($encode) $action = urlencode($action); - $url = '/' . $action . $url; + $url = self::URI_DELIMITER . $action . $url; } if (!empty($url) || $controller !== $this->_defaults[$this->_controllerKey]) { if ($encode) $controller = urlencode($controller); - $url = '/' . $controller . $url; + $url = self::URI_DELIMITER . $controller . $url; } if (isset($module)) { if ($encode) $module = urlencode($module); - $url = '/' . $module . $url; + $url = self::URI_DELIMITER . $module . $url; } return ltrim($url, self::URI_DELIMITER); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Route/Regex.php --- a/web/lib/Zend/Controller/Router/Route/Regex.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Route/Regex.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Regex.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Regex.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -28,7 +28,7 @@ * * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Abstract @@ -74,7 +74,7 @@ public function match($path, $partial = false) { if (!$partial) { - $path = trim(urldecode($path), '/'); + $path = trim(urldecode($path), self::URI_DELIMITER); $regex = '#^' . $this->_regex . '$#i'; } else { $regex = '#^' . $this->_regex . '#i'; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Controller/Router/Route/Static.php --- a/web/lib/Zend/Controller/Router/Route/Static.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Controller/Router/Route/Static.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,8 +15,8 @@ * @category Zend * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: Static.php 23210 2010-10-21 16:10:55Z matthew $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: Static.php 24593 2012-01-05 20:35:02Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,7 +30,7 @@ * * @package Zend_Controller * @subpackage Router - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_Abstract @@ -62,7 +62,7 @@ */ public function __construct($route, $defaults = array()) { - $this->_route = trim($route, '/'); + $this->_route = trim($route, self::URI_DELIMITER); $this->_defaults = (array) $defaults; } @@ -83,7 +83,7 @@ return $this->_defaults; } } else { - if (trim($path, '/') == $this->_route) { + if (trim($path, self::URI_DELIMITER) == $this->_route) { return $this->_defaults; } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt.php --- a/web/lib/Zend/Crypt.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,15 +14,15 @@ * * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Crypt.php 23089 2010-10-12 17:05:31Z padraic $ + * @version $Id: Crypt.php 25024 2012-07-30 15:08:15Z rob $ */ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/DiffieHellman.php --- a/web/lib/Zend/Crypt/DiffieHellman.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/DiffieHellman.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage DiffieHellman - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: DiffieHellman.php 22662 2010-07-24 17:37:36Z mabe $ + * @version $Id: DiffieHellman.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -27,7 +27,7 @@ * * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_DiffieHellman diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/DiffieHellman/Exception.php --- a/web/lib/Zend/Crypt/DiffieHellman/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/DiffieHellman/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage DiffieHellman - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_DiffieHellman_Exception extends Zend_Crypt_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Exception.php --- a/web/lib/Zend/Crypt/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Hmac.php --- a/web/lib/Zend/Crypt/Hmac.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Hmac.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Hmac - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Hmac.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Hmac.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * @todo Check if mhash() is a required alternative (will be PECL-only soon) * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Hmac extends Zend_Crypt diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Hmac/Exception.php --- a/web/lib/Zend/Crypt/Hmac/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Hmac/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Hmac - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Hmac_Exception extends Zend_Crypt_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Math.php --- a/web/lib/Zend/Crypt/Math.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Math.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Math - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Math.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Math.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Math/BigInteger.php --- a/web/lib/Zend/Crypt/Math/BigInteger.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Math/BigInteger.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Math - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: BigInteger.php 23439 2010-11-23 21:10:14Z alexander $ + * @version $Id: BigInteger.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -38,7 +38,7 @@ * * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Math_BigInteger diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Math/BigInteger/Bcmath.php --- a/web/lib/Zend/Crypt/Math/BigInteger/Bcmath.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Math/BigInteger/Bcmath.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Math - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Bcmath.php 22653 2010-07-22 18:41:39Z mabe $ + * @version $Id: Bcmath.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Math/BigInteger/Exception.php --- a/web/lib/Zend/Crypt/Math/BigInteger/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Math/BigInteger/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Math - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Math_BigInteger_Exception extends Zend_Crypt_Math_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Math/BigInteger/Gmp.php --- a/web/lib/Zend/Crypt/Math/BigInteger/Gmp.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Math/BigInteger/Gmp.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Math - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Gmp.php 23439 2010-11-23 21:10:14Z alexander $ + * @version $Id: Gmp.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -33,7 +33,7 @@ * * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Math/BigInteger/Interface.php --- a/web/lib/Zend/Crypt/Math/BigInteger/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Math/BigInteger/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Math - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ * * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Crypt_Math_BigInteger_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Math/Exception.php --- a/web/lib/Zend/Crypt/Math/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Math/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Math - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Math_Exception extends Zend_Crypt_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Rsa.php --- a/web/lib/Zend/Crypt/Rsa.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Rsa.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Rsa - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Rsa.php 23439 2010-11-23 21:10:14Z alexander $ + * @version $Id: Rsa.php 24808 2012-05-17 19:56:09Z rob $ */ /** @@ -33,7 +33,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Rsa @@ -71,7 +71,7 @@ { if (!extension_loaded('openssl')) { require_once 'Zend/Crypt/Rsa/Exception.php'; - throw new Zend_Crypt_Rsa_Exception('Zend_Crypt_Rsa requires openssl extention to be loaded.'); + throw new Zend_Crypt_Rsa_Exception('Zend_Crypt_Rsa requires openssl extension to be loaded.'); } // Set _hashAlgorithm property when we are sure, that openssl extension is loaded @@ -201,6 +201,13 @@ return $decrypted; } + /** + * @param array $configargs + * + * @throws Zend_Crypt_Rsa_Exception + * + * @return ArrayObject + */ public function generateKeys(array $configargs = null) { $config = null; @@ -215,6 +222,10 @@ $privateKey = null; $publicKey = null; $resource = openssl_pkey_new($config); + if (!$resource) { + require_once 'Zend/Crypt/Rsa/Exception.php'; + throw new Zend_Crypt_Rsa_Exception('Failed to generate a new private key'); + } // above fails on PHP 5.3 openssl_pkey_export($resource, $private, $passPhrase); $privateKey = new Zend_Crypt_Rsa_Key_Private($private, $passPhrase); @@ -312,6 +323,9 @@ protected function _parseConfigArgs(array $config = null) { $configs = array(); + if (isset($config['private_key_bits'])) { + $configs['private_key_bits'] = $config['private_key_bits']; + } if (isset($config['privateKeyBits'])) { $configs['private_key_bits'] = $config['privateKeyBits']; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Rsa/Exception.php --- a/web/lib/Zend/Crypt/Rsa/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Rsa/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Crypt * @subpackage Math - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ */ @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Rsa_Exception extends Zend_Crypt_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Rsa/Key.php --- a/web/lib/Zend/Crypt/Rsa/Key.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Rsa/Key.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,15 +15,15 @@ * @category Zend * @package Zend_Crypt * @subpackage Rsa - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Key.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Key.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Rsa_Key implements Countable diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Rsa/Key/Private.php --- a/web/lib/Zend/Crypt/Rsa/Key/Private.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Rsa/Key/Private.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Rsa - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Private.php 22662 2010-07-24 17:37:36Z mabe $ + * @version $Id: Private.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Rsa_Key_Private extends Zend_Crypt_Rsa_Key diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Crypt/Rsa/Key/Public.php --- a/web/lib/Zend/Crypt/Rsa/Key/Public.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Crypt/Rsa/Key/Public.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Crypt * @subpackage Rsa - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Public.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Public.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @category Zend * @package Zend_Crypt - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Crypt_Rsa_Key_Public extends Zend_Crypt_Rsa_Key diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Currency.php --- a/web/lib/Zend/Currency.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Currency.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Currency - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Currency.php 22708 2010-07-28 07:25:16Z thomas $ + * @version $Id: Currency.php 24855 2012-06-01 00:12:25Z adamlundrigan $ */ /** @@ -31,7 +31,7 @@ * * @category Zend * @package Zend_Currency - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Currency @@ -91,6 +91,11 @@ */ public function __construct($options = null, $locale = null) { + $calloptions = $options; + if (is_array($options) && isset($options['display'])) { + $this->_options['display'] = $options['display']; + } + if (is_array($options)) { $this->setLocale($locale); $this->setFormat($options); @@ -120,10 +125,13 @@ } // Get the format - if (!empty($this->_options['symbol'])) { - $this->_options['display'] = self::USE_SYMBOL; - } else if (!empty($this->_options['currency'])) { - $this->_options['display'] = self::USE_SHORTNAME; + if ((is_array($calloptions) && !isset($calloptions['display'])) + || (!is_array($calloptions) && $this->_options['display'] == self::NO_SYMBOL)) { + if (!empty($this->_options['symbol'])) { + $this->_options['display'] = self::USE_SYMBOL; + } else if (!empty($this->_options['currency'])) { + $this->_options['display'] = self::USE_SHORTNAME; + } } } @@ -794,7 +802,7 @@ if (!class_exists($service)) { $file = str_replace('_', DIRECTORY_SEPARATOR, $service) . '.php'; if (Zend_Loader::isReadable($file)) { - Zend_Loader::loadClass($class); + Zend_Loader::loadClass($service); } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Currency/CurrencyInterface.php --- a/web/lib/Zend/Currency/CurrencyInterface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Currency/CurrencyInterface.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Currency - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: CurrencyInterface.php 20785 2010-01-31 09:43:03Z mikaelkael $ + * @version $Id: CurrencyInterface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -24,7 +24,7 @@ * * @category Zend * @package Zend_Currency - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Currency_CurrencyInterface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Currency/Exception.php --- a/web/lib/Zend/Currency/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Currency/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Currency - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * * @category Zend * @package Zend_Currency - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Currency_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Date.php --- a/web/lib/Zend/Date.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Date.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Date - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Date.php 22713 2010-07-29 11:41:56Z thomas $ + * @version $Id: Date.php 24880 2012-06-12 20:35:18Z matthew $ */ /** @@ -30,7 +30,7 @@ /** * @category Zend * @package Zend_Date - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Date extends Zend_Date_DateObject @@ -1201,7 +1201,7 @@ } preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match); - if (!empty($match) and ($match[count($match) - 1] <= 12) and ($match[count($match) - 1] >= -12)) { + if (!empty($match) and ($match[count($match) - 1] <= 14) and ($match[count($match) - 1] >= -12)) { $zone = "Etc/GMT"; $zone .= ($match[count($match) - 1] < 0) ? "+" : "-"; $zone .= (int) abs($match[count($match) - 1]); @@ -2107,7 +2107,10 @@ break; case self::RFC_2822: - $result = preg_match('/^\w{3},\s(\d{1,2})\s(\w{3})\s(\d{4})\s(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]{1}\d{4})$/', $date, $match); + $result = preg_match('/^\w{3},\s(\d{1,2})\s(\w{3})\s(\d{4})\s' + . '(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]' + . '{1}\d{4}|\w{1,20})$/', $date, $match); + if (!$result) { require_once 'Zend/Date/Exception.php'; throw new Zend_Date_Exception("no RFC 2822 format ($date)", 0, null, $date); @@ -2641,10 +2644,8 @@ $parsed['day'] = 0; } - if (isset($parsed['year'])) { - $parsed['year'] -= 1970; - } else { - $parsed['year'] = 0; + if (!isset($parsed['year'])) { + $parsed['year'] = 1970; } } @@ -2654,7 +2655,7 @@ isset($parsed['second']) ? $parsed['second'] : 0, isset($parsed['month']) ? (1 + $parsed['month']) : 1, isset($parsed['day']) ? (1 + $parsed['day']) : 1, - isset($parsed['year']) ? (1970 + $parsed['year']) : 1970, + $parsed['year'], false), $this->getUnixTimestamp(), false); } catch (Zend_Locale_Exception $e) { if (!is_numeric($date)) { @@ -3238,7 +3239,7 @@ /** * Check if location is supported * - * @param $location array - locations array + * @param array $location locations array * @return $horizon float */ private function _checkLocation($location) @@ -3281,7 +3282,7 @@ * Returns the time of sunrise for this date and a given location as new date object * For a list of cities and correct locations use the class Zend_Date_Cities * - * @param $location array - location of sunrise + * @param array $location location of sunrise * ['horizon'] -> civil, nautic, astronomical, effective (default) * ['longitude'] -> longitude of location * ['latitude'] -> latitude of location @@ -3301,7 +3302,7 @@ * Returns the time of sunset for this date and a given location as new date object * For a list of cities and correct locations use the class Zend_Date_Cities * - * @param $location array - location of sunset + * @param array $location location of sunset * ['horizon'] -> civil, nautic, astronomical, effective (default) * ['longitude'] -> longitude of location * ['latitude'] -> latitude of location @@ -3321,7 +3322,7 @@ * Returns an array with the sunset and sunrise dates for all horizon types * For a list of cities and correct locations use the class Zend_Date_Cities * - * @param $location array - location of suninfo + * @param array $location location of suninfo * ['horizon'] -> civil, nautic, astronomical, effective (default) * ['longitude'] -> longitude of location * ['latitude'] -> latitude of location @@ -3786,7 +3787,7 @@ * Returns the day as new date object * Example: 20.May.1986 -> 20.Jan.1970 00:00:00 * - * @param $locale string|Zend_Locale OPTIONAL Locale for parsing input + * @param Zend_Locale $locale OPTIONAL Locale for parsing input * @return Zend_Date */ public function getDay($locale = null) @@ -3798,9 +3799,9 @@ /** * Returns the calculated day * - * @param $calc string Type of calculation to make - * @param $day string|integer|Zend_Date Day to calculate, when null the actual day is calculated - * @param $locale string|Zend_Locale Locale for parsing input + * @param string $calc Type of calculation to make + * @param Zend_Date $day Day to calculate, when null the actual day is calculated + * @param Zend_Locale $locale Locale for parsing input * @return Zend_Date|integer */ private function _day($calc, $day, $locale) @@ -3929,7 +3930,7 @@ * Weekday is always from 1-7 * Example: 09-Jan-2007 -> 2 = Tuesday -> 02-Jan-1970 (when 02.01.1970 is also Tuesday) * - * @param $locale string|Zend_Locale OPTIONAL Locale for parsing input + * @param Zend_Locale $locale OPTIONAL Locale for parsing input * @return Zend_Date */ public function getWeekday($locale = null) @@ -3947,9 +3948,9 @@ /** * Returns the calculated weekday * - * @param $calc string Type of calculation to make - * @param $weekday string|integer|array|Zend_Date Weekday to calculate, when null the actual weekday is calculated - * @param $locale string|Zend_Locale Locale for parsing input + * @param string $calc Type of calculation to make + * @param Zend_Date $weekday Weekday to calculate, when null the actual weekday is calculated + * @param Zend_Locale $locale Locale for parsing input * @return Zend_Date|integer * @throws Zend_Date_Exception */ @@ -4166,7 +4167,7 @@ * Returns the hour as new date object * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 10:00:00 * - * @param $locale string|Zend_Locale OPTIONAL Locale for parsing input + * @param Zend_Locale $locale OPTIONAL Locale for parsing input * @return Zend_Date */ public function getHour($locale = null) @@ -4617,7 +4618,7 @@ * Returns the week as new date object using monday as begining of the week * Example: 12.Jan.2007 -> 08.Jan.1970 00:00:00 * - * @param $locale string|Zend_Locale OPTIONAL Locale for parsing input + * @param Zend_Locale $locale OPTIONAL Locale for parsing input * @return Zend_Date */ public function getWeek($locale = null) diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Date/Cities.php --- a/web/lib/Zend/Date/Cities.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Date/Cities.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Date - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Cities.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Cities.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ * @category Zend * @package Zend_Date * @subpackage Zend_Date_Cities - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Date_Cities diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Date/DateObject.php --- a/web/lib/Zend/Date/DateObject.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Date/DateObject.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,8 +14,8 @@ * * @category Zend * @package Zend_Date - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - * @version $Id: DateObject.php 22712 2010-07-29 08:24:28Z thomas $ + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id: DateObject.php 24880 2012-06-12 20:35:18Z matthew $ * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -23,7 +23,7 @@ * @category Zend * @package Zend_Date * @subpackage Zend_Date_DateObject - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Date_DateObject { @@ -312,6 +312,13 @@ } if (abs($timestamp) <= 0x7FFFFFFF) { + // See ZF-11992 + // "o" will sometimes resolve to the previous year (see + // http://php.net/date ; it's part of the ISO 8601 + // standard). However, this is not desired, so replacing + // all occurrences of "o" not preceded by a backslash + // with "Y" + $format = preg_replace('/(? (boolean) Whether to use a persistent connection or not, defaults to false * protocol => (string) The network protocol, defaults to TCPIP * caseFolding => (int) style of case-alteration used for identifiers + * socket => (string) The socket or named pipe that should be used * * @param array|Zend_Config $config An array or instance of Zend_Config having configuration data * @throws Zend_Db_Adapter_Exception @@ -531,6 +532,7 @@ * @param mixed $table The table to insert data into. * @param array $bind Column-value pairs. * @return int The number of affected rows. + * @throws Zend_Db_Adapter_Exception */ public function insert($table, array $bind) { @@ -583,6 +585,7 @@ * @param array $bind Column-value pairs. * @param mixed $where UPDATE WHERE clause(s). * @return int The number of affected rows. + * @throws Zend_Db_Adapter_Exception */ public function update($table, array $bind, $where = '') { @@ -743,7 +746,7 @@ * @param string|Zend_Db_Select $sql An SQL SELECT statement. * @param mixed $bind Data to bind into SELECT placeholders. * @param mixed $fetchMode Override current fetch mode. - * @return array + * @return mixed Array, object, or scalar depending on fetch mode. */ public function fetchRow($sql, $bind = array(), $fetchMode = null) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Db2.php --- a/web/lib/Zend/Db/Adapter/Db2.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Db2.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Db2.php 23199 2010-10-21 14:27:06Z ralph $ + * @version $Id: Db2.php 24593 2012-01-05 20:35:02Z matthew $ * */ @@ -39,7 +39,7 @@ /** * @package Zend_Db - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -161,7 +161,7 @@ $this->_config['driver_options']['i5_naming'] = DB2_I5_NAMING_OFF; } } - + if ($this->_config['host'] !== 'localhost' && !$this->_isI5) { // if the host isn't localhost, use extended connection params $dbname = 'DRIVER={IBM DB2 ODBC DRIVER}' . diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Db2/Exception.php --- a/web/lib/Zend/Db/Adapter/Db2/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Db2/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -30,7 +30,7 @@ * * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Db2_Exception extends Zend_Db_Adapter_Exception @@ -38,7 +38,7 @@ protected $code = '00000'; protected $message = 'unknown exception'; - function __construct($message = 'unknown exception', $code = '00000', Exception $e = null) + function __construct($message = 'unknown exception', $code = '00000', Exception $e = null) { parent::__construct($message, $code, $e); } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Exception.php --- a/web/lib/Zend/Db/Adapter/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Exception extends Zend_Db_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Mysqli.php --- a/web/lib/Zend/Db/Adapter/Mysqli.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Mysqli.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Mysqli.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Mysqli.php 25229 2013-01-18 08:17:21Z frosch $ */ @@ -46,7 +46,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract @@ -297,6 +297,12 @@ $port = null; } + if (isset($this->_config['socket'])) { + $socket = $this->_config['socket']; + } else { + $socket = null; + } + $this->_connection = mysqli_init(); if(!empty($this->_config['driver_options'])) { @@ -320,7 +326,8 @@ $this->_config['username'], $this->_config['password'], $this->_config['dbname'], - $port + $port, + $socket ); if ($_isConnected === false || mysqli_connect_errno()) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Mysqli/Exception.php --- a/web/lib/Zend/Db/Adapter/Mysqli/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Mysqli/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * */ @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Mysqli_Exception extends Zend_Db_Adapter_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Oracle.php --- a/web/lib/Zend/Db/Adapter/Oracle.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Oracle.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Oracle.php 21108 2010-02-19 22:36:08Z mikaelkael $ + * @version $Id: Oracle.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract @@ -147,8 +147,9 @@ public function isConnected() { return ((bool) (is_resource($this->_connection) - && get_resource_type($this->_connection) == 'oci8 connection')); - } + && (get_resource_type($this->_connection) == 'oci8 connection' + || get_resource_type($this->_connection) == 'oci8 persistent connection'))); + } /** * Force the connection to close. diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Oracle/Exception.php --- a/web/lib/Zend/Db/Adapter/Oracle/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Oracle/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Oracle_Exception extends Zend_Db_Adapter_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Abstract.php --- a/web/lib/Zend/Db/Adapter/Pdo/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -39,7 +39,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Ibm.php --- a/web/lib/Zend/Db/Adapter/Pdo/Ibm.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Ibm.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ibm.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Ibm.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -38,7 +38,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Pdo_Ibm extends Zend_Db_Adapter_Pdo_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Ibm/Db2.php --- a/web/lib/Zend/Db/Adapter/Pdo/Ibm/Db2.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Ibm/Db2.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Db2.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Db2.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Pdo_Ibm_Db2 diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Ibm/Ids.php --- a/web/lib/Zend/Db/Adapter/Pdo/Ibm/Ids.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Ibm/Ids.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ids.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Ids.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -32,7 +32,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Pdo_Ibm_Ids diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Mssql.php --- a/web/lib/Zend/Db/Adapter/Pdo/Mssql.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Mssql.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Mssql.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Mssql.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Mysql.php --- a/web/lib/Zend/Db/Adapter/Pdo/Mysql.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Mysql.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Mysql.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Mysql.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Abstract @@ -77,6 +77,19 @@ ); /** + * Override _dsn() and ensure that charset is incorporated in mysql + * @see Zend_Db_Adapter_Pdo_Abstract::_dsn() + */ + protected function _dsn() + { + $dsn = parent::_dsn(); + if (isset($this->_config['charset'])) { + $dsn .= ';charset=' . $this->_config['charset']; + } + return $dsn; + } + + /** * Creates a PDO object and connects to the database. * * @return void diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Oci.php --- a/web/lib/Zend/Db/Adapter/Pdo/Oci.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Oci.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Oci.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Oci.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Pdo_Oci extends Zend_Db_Adapter_Pdo_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Pgsql.php --- a/web/lib/Zend/Db/Adapter/Pdo/Pgsql.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Pgsql.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Pgsql.php 22788 2010-08-03 18:29:55Z ramon $ + * @version $Id: Pgsql.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Pdo/Sqlite.php --- a/web/lib/Zend/Db/Adapter/Pdo/Sqlite.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Pdo/Sqlite.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Sqlite.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Sqlite.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Sqlsrv.php --- a/web/lib/Zend/Db/Adapter/Sqlsrv.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Sqlsrv.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Sqlsrv.php 21885 2010-04-16 15:13:40Z juokaz $ + * @version $Id: Sqlsrv.php 25077 2012-11-06 20:06:24Z rob $ */ /** @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract @@ -437,10 +437,10 @@ $sql = "exec sp_columns @table_name = " . $this->quoteIdentifier($tableName, true); $stmt = $this->query($sql); $result = $stmt->fetchAll(Zend_Db::FETCH_NUM); - - // ZF-7698 - $stmt->closeCursor(); + // ZF-7698 + $stmt->closeCursor(); + if (count($result) == 0) { return array(); } @@ -622,17 +622,22 @@ } else { $over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby); } - + // Remove ORDER BY clause from $sql $sql = preg_replace('/\s+ORDER BY(.*)/', '', $sql); - + // Add ORDER BY clause as an argument for ROW_NUMBER() $sql = "SELECT ROW_NUMBER() OVER ($over) AS \"ZEND_DB_ROWNUM\", * FROM ($sql) AS inner_tbl"; - + $start = $offset + 1; - $end = $offset + $count; - $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end"; + if ($count == PHP_INT_MAX) { + $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" >= $start"; + } + else { + $end = $offset + $count; + $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end"; + } } return $sql; diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Adapter/Sqlsrv/Exception.php --- a/web/lib/Zend/Db/Adapter/Sqlsrv/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Adapter/Sqlsrv/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20625 2010-01-25 21:03:53Z ralph $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Db * @subpackage Adapter - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Adapter_Sqlsrv_Exception extends Zend_Db_Adapter_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Exception.php --- a/web/lib/Zend/Db/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Db - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Db - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Exception extends Zend_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Expr.php --- a/web/lib/Zend/Db/Expr.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Expr.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Expr - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Expr.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Expr.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -43,7 +43,7 @@ * @category Zend * @package Zend_Db * @subpackage Expr - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Expr diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Profiler.php --- a/web/lib/Zend/Db/Profiler.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Profiler.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Profiler - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Profiler.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Profiler.php 25127 2012-11-16 15:17:42Z rob $ */ @@ -25,7 +25,7 @@ * @category Zend * @package Zend_Db * @subpackage Profiler - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Profiler @@ -225,7 +225,9 @@ } /** - * @param integer $queryId + * Clone a profiler query + * + * @param Zend_Db_Profiler_Query $query * @return integer or null */ public function queryClone(Zend_Db_Profiler_Query $query) @@ -287,12 +289,12 @@ } /** - * Ends a query. Pass it the handle that was returned by queryStart(). + * Ends a query. Pass it the handle that was returned by queryStart(). * This will mark the query as ended and save the time. * * @param integer $queryId * @throws Zend_Db_Profiler_Exception - * @return void + * @return string Inform that a query is stored or ignored. */ public function queryEnd($queryId) { diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Profiler/Exception.php --- a/web/lib/Zend/Db/Profiler/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Profiler/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Profiler - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Db * @subpackage Profiler - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Profiler_Exception extends Zend_Db_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Profiler/Firebug.php --- a/web/lib/Zend/Db/Profiler/Firebug.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Profiler/Firebug.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Profiler - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Firebug.php 24593 2012-01-05 20:35:02Z matthew $ */ /** Zend_Db_Profiler */ @@ -35,7 +35,7 @@ * @category Zend * @package Zend_Db * @subpackage Profiler - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Profiler_Firebug extends Zend_Db_Profiler diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Profiler/Query.php --- a/web/lib/Zend/Db/Profiler/Query.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Profiler/Query.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Profiler - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Query.php 23382 2010-11-18 22:50:50Z bittarman $ + * @version $Id: Query.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -25,7 +25,7 @@ * @category Zend * @package Zend_Db * @subpackage Profiler - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Profiler_Query diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Select.php --- a/web/lib/Zend/Db/Select.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Select.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Select - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Select.php 23254 2010-10-26 12:49:23Z matthew $ + * @version $Id: Select.php 24833 2012-05-30 13:29:41Z adamlundrigan $ */ @@ -38,7 +38,7 @@ * @category Zend * @package Zend_Db * @subpackage Select - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Select @@ -207,8 +207,8 @@ * The first parameter $name can be a simple string, in which case the * correlation name is generated automatically. If you want to specify * the correlation name, the first parameter must be an associative - * array in which the key is the physical table name, and the value is - * the correlation name. For example, array('table' => 'alias'). + * array in which the key is the correlation name, and the value is + * the physical table name. For example, array('alias' => 'table'). * The correlation name is prepended to all columns fetched for this * table. * @@ -219,8 +219,8 @@ * no correlation name is generated or prepended to the columns named * in the second parameter. * - * @param array|string|Zend_Db_Expr $name The table name or an associative array relating table name to - * correlation name. + * @param array|string|Zend_Db_Expr $name The table name or an associative array + * relating correlation name to table name. * @param array|string|Zend_Db_Expr $cols The columns to select from this table. * @param string $schema The schema name to specify, if any. * @return Zend_Db_Select This Zend_Db_Select object. @@ -880,9 +880,13 @@ $join = $this->_adapter->quoteIdentifier(key($this->_parts[self::FROM]), true); $from = $this->_adapter->quoteIdentifier($this->_uniqueCorrelation($name), true); - $cond1 = $from . '.' . $cond; - $cond2 = $join . '.' . $cond; - $cond = $cond1 . ' = ' . $cond2; + $joinCond = array(); + foreach ((array)$cond as $fieldName) { + $cond1 = $from . '.' . $fieldName; + $cond2 = $join . '.' . $fieldName; + $joinCond[] = $cond1 . ' = ' . $cond2; + } + $cond = implode(' '.self::SQL_AND.' ', $joinCond); return $this->_join($type, $name, $cond, $cols, $schema); } @@ -896,7 +900,8 @@ private function _uniqueCorrelation($name) { if (is_array($name)) { - $c = end($name); + $k = key($name); + $c = is_string($k) ? $k : end($name); } else { // Extract just the last name of a qualified table name $dot = strrpos($name,'.'); diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Select/Exception.php --- a/web/lib/Zend/Db/Select/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Select/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Select - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Db * @subpackage Select - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement.php --- a/web/lib/Zend/Db/Statement.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Statement.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Statement.php 24790 2012-05-10 12:28:51Z mcleod@spaceweb.nl $ */ /** @@ -36,7 +36,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface @@ -176,37 +176,40 @@ */ protected function _stripQuoted($sql) { - // get the character for delimited id quotes, - // this is usually " but in MySQL is ` - $d = $this->_adapter->quoteIdentifier('a'); - $d = $d[0]; - - // get the value used as an escaped delimited id quote, - // e.g. \" or "" or \` - $de = $this->_adapter->quoteIdentifier($d); - $de = substr($de, 1, 2); - $de = str_replace('\\', '\\\\', $de); // get the character for value quoting // this should be ' $q = $this->_adapter->quote('a'); - $q = $q[0]; - + $q = $q[0]; // get the value used as an escaped quote, // e.g. \' or '' $qe = $this->_adapter->quote($q); $qe = substr($qe, 1, 2); - $qe = str_replace('\\', '\\\\', $qe); - + $qe = preg_quote($qe); + $escapeChar = substr($qe,0,1); + // remove 'foo\'bar' + if (!empty($q)) { + $escapeChar = preg_quote($escapeChar); + // this segfaults only after 65,000 characters instead of 9,000 + $sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql); + } + // get a version of the SQL statement with all quoted // values and delimited identifiers stripped out // remove "foo\"bar" - $sql = preg_replace("/$q($qe|\\\\{2}|[^$q])*$q/", '', $sql); - // remove 'foo\'bar' - if (!empty($q)) { - $sql = preg_replace("/$q($qe|[^$q])*$q/", '', $sql); - } + $sql = preg_replace("/\"(\\\\\"|[^\"])*\"/Us", '', $sql); + // get the character for delimited id quotes, + // this is usually " but in MySQL is ` + $d = $this->_adapter->quoteIdentifier('a'); + $d = $d[0]; + // get the value used as an escaped delimited id quote, + // e.g. \" or "" or \` + $de = $this->_adapter->quoteIdentifier($d); + $de = substr($de, 1, 2); + $de = preg_quote($de); + // Note: $de and $d where never used..., now they are: + $sql = preg_replace("/$d($de|\\\\{2}|[^$d])*$d/Us", '', $sql); return $sql; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Db2.php --- a/web/lib/Zend/Db/Statement/Db2.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Db2.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Db2.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Db2.php 24625 2012-02-22 21:53:40Z adamlundrigan $ */ /** @@ -30,7 +30,7 @@ * * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Db2 extends Zend_Db_Statement @@ -96,7 +96,7 @@ $datatype = DB2_CHAR; } - if (!db2_bind_param($this->_stmt, $position, "variable", $type, $datatype)) { + if (!db2_bind_param($this->_stmt, $parameter, "variable", $type, $datatype)) { /** * @see Zend_Db_Statement_Db2_Exception */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Db2/Exception.php --- a/web/lib/Zend/Db/Statement/Db2/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Db2/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Exception.php --- a/web/lib/Zend/Db/Statement/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20513 2010-01-22 07:55:48Z ralph $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Exception extends Zend_Db_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Interface.php --- a/web/lib/Zend/Db/Statement/Interface.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Interface.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ interface Zend_Db_Statement_Interface diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Mysqli.php --- a/web/lib/Zend/Db/Statement/Mysqli.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Mysqli.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Mysqli.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Mysqli.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Mysqli extends Zend_Db_Statement diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Mysqli/Exception.php --- a/web/lib/Zend/Db/Statement/Mysqli/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Mysqli/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Oracle.php --- a/web/lib/Zend/Db/Statement/Oracle.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Oracle.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Oracle.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Oracle.php 24863 2012-06-02 00:22:47Z adamlundrigan $ */ /** @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Oracle extends Zend_Db_Statement @@ -87,7 +87,7 @@ protected function _prepare($sql) { $connection = $this->_adapter->getConnection(); - $this->_stmt = oci_parse($connection, $sql); + $this->_stmt = @oci_parse($connection, $sql); if (!$this->_stmt) { /** * @see Zend_Db_Statement_Oracle_Exception @@ -240,7 +240,7 @@ } $error = false; foreach (array_keys($params) as $name) { - if (!@oci_bind_by_name($this->_stmt, $name, $params[$name], -1)) { + if (!$this->bindParam($name, $params[$name], null, -1)) { $error = true; break; } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Oracle/Exception.php --- a/web/lib/Zend/Db/Statement/Oracle/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Oracle/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Pdo.php --- a/web/lib/Zend/Db/Statement/Pdo.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Pdo.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Pdo.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Pdo.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggregate diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Pdo/Ibm.php --- a/web/lib/Zend/Db/Statement/Pdo/Ibm.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Pdo/Ibm.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ibm.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Ibm.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Pdo_Ibm extends Zend_Db_Statement_Pdo diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Pdo/Oci.php --- a/web/lib/Zend/Db/Statement/Pdo/Oci.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Pdo/Oci.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Oci.php 21104 2010-02-19 21:26:36Z mikaelkael $ + * @version $Id: Oci.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Pdo_Oci extends Zend_Db_Statement_Pdo diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Sqlsrv.php --- a/web/lib/Zend/Db/Statement/Sqlsrv.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Sqlsrv.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Sqlsrv.php 21887 2010-04-16 18:28:10Z juokaz $ + * @version $Id: Sqlsrv.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement @@ -376,11 +376,11 @@ require_once 'Zend/Db/Statement/Sqlsrv/Exception.php'; throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors()); } - - // reset column keys - $this->_keys = null; + + // reset column keys + $this->_keys = null; - return true; + return true; } /** @@ -411,8 +411,8 @@ return $num_rows; } - - /** + + /** * Returns an array containing all of the result set rows. * * @param int $style OPTIONAL Fetch mode. diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Statement/Sqlsrv/Exception.php --- a/web/lib/Zend/Db/Statement/Sqlsrv/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Statement/Sqlsrv/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -28,7 +28,7 @@ /** * @package Zend_Db * @subpackage Statement - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Statement_Sqlsrv_Exception extends Zend_Db_Statement_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table.php --- a/web/lib/Zend/Db/Table.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Table.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Table.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -36,7 +36,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Table extends Zend_Db_Table_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Abstract.php --- a/web/lib/Zend/Db/Table/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 21078 2010-02-18 18:07:16Z tech13 $ + * @version $Id: Abstract.php 24958 2012-06-15 13:44:04Z adamlundrigan $ */ /** @@ -41,7 +41,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Db_Table_Abstract @@ -70,6 +70,7 @@ const ON_UPDATE = 'onUpdate'; const CASCADE = 'cascade'; + const CASCADE_RECURSE = 'cascadeRecurse'; const RESTRICT = 'restrict'; const SET_NULL = 'setNull'; @@ -744,6 +745,7 @@ * Initialize database adapter. * * @return void + * @throws Zend_Db_Table_Exception */ protected function _setupDatabaseAdapter() { @@ -807,12 +809,23 @@ //get db configuration $dbConfig = $this->_db->getConfig(); + $port = isset($dbConfig['options']['port']) + ? ':'.$dbConfig['options']['port'] + : (isset($dbConfig['port']) + ? ':'.$dbConfig['port'] + : null); + + $host = isset($dbConfig['options']['host']) + ? ':'.$dbConfig['options']['host'] + : (isset($dbConfig['host']) + ? ':'.$dbConfig['host'] + : null); + // Define the cache identifier where the metadata are saved $cacheId = md5( // port:host/dbname:schema.table (based on availabilty) - (isset($dbConfig['options']['port']) ? ':'.$dbConfig['options']['port'] : null) - . (isset($dbConfig['options']['host']) ? ':'.$dbConfig['options']['host'] : null) - . '/'.$dbConfig['dbname'].':'.$this->_schema.'.'.$this->_name - ); + $port . $host . '/'. $dbConfig['dbname'] . ':' + . $this->_schema. '.' . $this->_name + ); } // If $this has no metadata cache or metadata cache misses @@ -873,7 +886,7 @@ // then throw an exception. if (empty($this->_primary)) { require_once 'Zend/Db/Table/Exception.php'; - throw new Zend_Db_Table_Exception('A table must have a primary key, but none was found'); + throw new Zend_Db_Table_Exception("A table must have a primary key, but none was found for table '{$this->_name}'"); } } else if (!is_array($this->_primary)) { $this->_primary = array(1 => $this->_primary); @@ -961,8 +974,9 @@ * You can elect to return only a part of this information by supplying its key name, * otherwise all information is returned as an array. * - * @param $key The specific info part to return OPTIONAL + * @param string $key The specific info part to return OPTIONAL * @return mixed + * @throws Zend_Db_Table_Exception */ public function info($key = null) { @@ -1035,14 +1049,24 @@ */ if (is_string($this->_sequence) && !isset($data[$pkIdentity])) { $data[$pkIdentity] = $this->_db->nextSequenceId($this->_sequence); + $pkSuppliedBySequence = true; } /** * If the primary key can be generated automatically, and no value was * specified in the user-supplied data, then omit it from the tuple. + * + * Note: this checks for sensible values in the supplied primary key + * position of the data. The following values are considered empty: + * null, false, true, '', array() */ - if (array_key_exists($pkIdentity, $data) && $data[$pkIdentity] === null) { - unset($data[$pkIdentity]); + if (!isset($pkSuppliedBySequence) && array_key_exists($pkIdentity, $data)) { + if ($data[$pkIdentity] === null // null + || $data[$pkIdentity] === '' // empty string + || is_bool($data[$pkIdentity]) // boolean + || (is_array($data[$pkIdentity]) && empty($data[$pkIdentity]))) { // empty array + unset($data[$pkIdentity]); + } } /** @@ -1157,6 +1181,22 @@ */ public function delete($where) { + $depTables = $this->getDependentTables(); + if (!empty($depTables)) { + $resultSet = $this->fetchAll($where); + if (count($resultSet) > 0 ) { + foreach ($resultSet as $row) { + /** + * Execute cascading deletes against dependent tables + */ + foreach ($depTables as $tableClass) { + $t = self::getTableFromString($tableClass, $this); + $t->_cascadeDelete($tableClass, $row->getPrimaryKey()); + } + } + } + } + $tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name; return $this->_db->delete($tableSpec, $where); } @@ -1170,27 +1210,56 @@ */ public function _cascadeDelete($parentTableClassname, array $primaryKey) { + // setup metadata $this->_setupMetadata(); + + // get this class name + $thisClass = get_class($this); + if ($thisClass === 'Zend_Db_Table') { + $thisClass = $this->_definitionConfigName; + } + $rowsAffected = 0; + foreach ($this->_getReferenceMapNormalized() as $map) { if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) { - switch ($map[self::ON_DELETE]) { - case self::CASCADE: - $where = array(); - for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) { - $col = $this->_db->foldCase($map[self::COLUMNS][$i]); - $refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]); - $type = $this->_metadata[$col]['DATA_TYPE']; - $where[] = $this->_db->quoteInto( - $this->_db->quoteIdentifier($col, true) . ' = ?', - $primaryKey[$refCol], $type); + + $where = array(); + + // CASCADE or CASCADE_RECURSE + if (in_array($map[self::ON_DELETE], array(self::CASCADE, self::CASCADE_RECURSE))) { + for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) { + $col = $this->_db->foldCase($map[self::COLUMNS][$i]); + $refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]); + $type = $this->_metadata[$col]['DATA_TYPE']; + $where[] = $this->_db->quoteInto( + $this->_db->quoteIdentifier($col, true) . ' = ?', + $primaryKey[$refCol], $type); + } + } + + // CASCADE_RECURSE + if ($map[self::ON_DELETE] == self::CASCADE_RECURSE) { + + /** + * Execute cascading deletes against dependent tables + */ + $depTables = $this->getDependentTables(); + if (!empty($depTables)) { + foreach ($depTables as $tableClass) { + $t = self::getTableFromString($tableClass, $this); + foreach ($this->fetchAll($where) as $depRow) { + $rowsAffected += $t->_cascadeDelete($thisClass, $depRow->getPrimaryKey()); + } } - $rowsAffected += $this->delete($where); - break; - default: - // no action - break; + } } + + // CASCADE or CASCADE_RECURSE + if (in_array($map[self::ON_DELETE], array(self::CASCADE, self::CASCADE_RECURSE))) { + $rowsAffected += $this->delete($where); + } + } } return $rowsAffected; @@ -1342,10 +1411,11 @@ * * @param string|array|Zend_Db_Table_Select $where OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object. * @param string|array $order OPTIONAL An SQL ORDER clause. + * @param int $offset OPTIONAL An SQL OFFSET value. * @return Zend_Db_Table_Row_Abstract|null The row results per the * Zend_Db_Adapter fetch mode, or null if no row found. */ - public function fetchRow($where = null, $order = null) + public function fetchRow($where = null, $order = null, $offset = null) { if (!($where instanceof Zend_Db_Table_Select)) { $select = $this->select(); @@ -1358,10 +1428,10 @@ $this->_order($select, $order); } - $select->limit(1); + $select->limit(1, ((is_numeric($offset)) ? (int) $offset : null)); } else { - $select = $where->limit(1); + $select = $where->limit(1, $where->getPart(Zend_Db_Select::LIMIT_OFFSET)); } $rows = $this->_fetch($select); @@ -1507,4 +1577,38 @@ return $data; } + public static function getTableFromString($tableName, Zend_Db_Table_Abstract $referenceTable = null) + { + if ($referenceTable instanceof Zend_Db_Table_Abstract) { + $tableDefinition = $referenceTable->getDefinition(); + + if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) { + return new Zend_Db_Table($tableName, $tableDefinition); + } + } + + // assume the tableName is the class name + if (!class_exists($tableName)) { + try { + require_once 'Zend/Loader.php'; + Zend_Loader::loadClass($tableName); + } catch (Zend_Exception $e) { + require_once 'Zend/Db/Table/Row/Exception.php'; + throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); + } + } + + $options = array(); + + if ($referenceTable instanceof Zend_Db_Table_Abstract) { + $options['db'] = $referenceTable->getAdapter(); + } + + if (isset($tableDefinition) && $tableDefinition !== null) { + $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition; + } + + return new $tableName($options); + } + } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Definition.php --- a/web/lib/Zend/Db/Table/Definition.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Definition.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Definition.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Definition.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -26,7 +26,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Table_Definition diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Exception.php --- a/web/lib/Zend/Db/Table/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Table_Exception extends Zend_Db_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Row.php --- a/web/lib/Zend/Db/Table/Row.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Row.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Row.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Row.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -34,7 +34,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Table_Row extends Zend_Db_Table_Row_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Row/Abstract.php --- a/web/lib/Zend/Db/Table/Row/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Row/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 22229 2010-05-21 20:55:01Z ralph $ + * @version $Id: Abstract.php 24831 2012-05-30 12:52:25Z rob $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggregate @@ -646,7 +646,7 @@ { return new ArrayIterator((array) $this->_data); } - + /** * Returns the column/value data as an array. * @@ -725,6 +725,17 @@ } /** + * Retrieves an associative array of primary keys. + * + * @param bool $useDirty + * @return array + */ + public function getPrimaryKey($useDirty = true) + { + return $this->_getPrimaryKey($useDirty); + } + + /** * Constructs where statement for retrieving row(s). * * @param bool $useDirty @@ -1167,37 +1178,7 @@ */ protected function _getTableFromString($tableName) { - - if ($this->_table instanceof Zend_Db_Table_Abstract) { - $tableDefinition = $this->_table->getDefinition(); - - if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) { - return new Zend_Db_Table($tableName, $tableDefinition); - } - } - - // assume the tableName is the class name - if (!class_exists($tableName)) { - try { - require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($tableName); - } catch (Zend_Exception $e) { - require_once 'Zend/Db/Table/Row/Exception.php'; - throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); - } - } - - $options = array(); - - if (($table = $this->_getTable())) { - $options['db'] = $table->getAdapter(); - } - - if (isset($tableDefinition) && $tableDefinition !== null) { - $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition; - } - - return new $tableName($options); + return Zend_Db_Table_Abstract::getTableFromString($tableName, $this->_table); } } diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Row/Exception.php --- a/web/lib/Zend/Db/Table/Row/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Row/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Table_Row_Exception extends Zend_Db_Table_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Rowset.php --- a/web/lib/Zend/Db/Table/Rowset.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Rowset.php Fri Mar 22 10:47:04 2013 +0100 @@ -16,9 +16,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Rowset.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Rowset.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -35,7 +35,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Table_Rowset extends Zend_Db_Table_Rowset_Abstract diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Rowset/Abstract.php --- a/web/lib/Zend/Db/Table/Rowset/Abstract.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Rowset/Abstract.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,16 +15,16 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 23380 2010-11-18 22:22:28Z ralph $ + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Countable, ArrayAccess @@ -384,11 +384,11 @@ require_once 'Zend/Db/Table/Rowset/Exception.php'; throw new Zend_Db_Table_Rowset_Exception('No row could be found at position ' . (int) $position, 0, $e); } - + if ($seek == true) { $this->seek($position); } - + return $row; } @@ -408,14 +408,14 @@ } return $this->_data; } - + protected function _loadAndReturnRow($position) { if (!isset($this->_data[$position])) { require_once 'Zend/Db/Table/Rowset/Exception.php'; throw new Zend_Db_Table_Rowset_Exception("Data for provided position does not exist"); } - + // do we already have a row object for this position? if (empty($this->_rows[$position])) { $this->_rows[$position] = new $this->_rowClass( diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Rowset/Exception.php --- a/web/lib/Zend/Db/Table/Rowset/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Rowset/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Table_Rowset_Exception extends Zend_Db_Table_Exception diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Select.php --- a/web/lib/Zend/Db/Table/Select.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Select.php Fri Mar 22 10:47:04 2013 +0100 @@ -16,9 +16,9 @@ * @category Zend * @package Zend_Db * @subpackage Select - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Select.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Select.php 24593 2012-01-05 20:35:02Z matthew $ */ @@ -40,7 +40,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Db_Table_Select extends Zend_Db_Select diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Db/Table/Select/Exception.php --- a/web/lib/Zend/Db/Table/Select/Exception.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Db/Table/Select/Exception.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Db * @subpackage Select - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Db * @subpackage Table - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Debug.php --- a/web/lib/Zend/Debug.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Debug.php Fri Mar 22 10:47:04 2013 +0100 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Debug - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Debug.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Debug.php 25095 2012-11-07 20:11:07Z rob $ */ /** @@ -24,7 +24,7 @@ * * @category Zend * @package Zend_Debug - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -90,7 +90,12 @@ . PHP_EOL; } else { if(!extension_loaded('xdebug')) { - $output = htmlspecialchars($output, ENT_QUOTES); + $flags = ENT_QUOTES; + // PHP 5.4.0+ + if (defined('ENT_SUBSTITUTE')) { + $flags = ENT_QUOTES | ENT_SUBSTITUTE; + } + $output = htmlspecialchars($output, $flags); } $output = '
'
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo.php
--- a/web/lib/Zend/Dojo.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Dojo
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -22,9 +22,9 @@
  * Enable Dojo components
  *
  * @package    Zend_Dojo
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Dojo.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Dojo.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/BuildLayer.php
--- a/web/lib/Zend/Dojo/BuildLayer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/BuildLayer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,16 +14,16 @@
  *
  * @category   Zend
  * @package    Zend_Dojo
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: BuildLayer.php 22280 2010-05-24 20:39:45Z matthew $
+ * @version    $Id: BuildLayer.php 25024 2012-07-30 15:08:15Z rob $
  */
 
 /**
  * Dojo module layer and custom build profile generation support
  *
  * @package    Zend_Dojo
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Dojo_BuildLayer
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Data.php
--- a/web/lib/Zend/Dojo/Data.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Data.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,9 +14,9 @@
  *
  * @category   Zend
  * @package    Zend_Dojo
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Data.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Data.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /**
@@ -26,7 +26,7 @@
  * @uses       Iterator
  * @uses       Countable
  * @package    Zend_Dojo
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Dojo_Data implements ArrayAccess,Iterator,Countable
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Exception.php
--- a/web/lib/Zend/Dojo/Exception.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Exception.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,9 +14,9 @@
  *
  * @category   Zend
  * @package    Zend_Dojo
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Exception */
@@ -27,7 +27,7 @@
  *
  * @uses       Zend_Exception
  * @package    Zend_Dojo
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Dojo_Exception extends Zend_Exception
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form.php
--- a/web/lib/Zend/Dojo/Form.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Form
  * @package    Zend_Dojo
  * @subpackage Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Form.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Form.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form extends Zend_Form
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/AccordionContainer.php
--- a/web/lib/Zend/Dojo/Form/Decorator/AccordionContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/AccordionContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,9 +29,9 @@
  * @uses       Zend_Dojo_Form_Decorator_DijitContainer
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: AccordionContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: AccordionContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_AccordionContainer extends Zend_Dojo_Form_Decorator_DijitContainer
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/AccordionPane.php
--- a/web/lib/Zend/Dojo/Form/Decorator/AccordionPane.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/AccordionPane.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,9 +29,9 @@
  * @uses       Zend_Dojo_Form_Decorator_DijitContainer
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: AccordionPane.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: AccordionPane.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_AccordionPane extends Zend_Dojo_Form_Decorator_DijitContainer
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/BorderContainer.php
--- a/web/lib/Zend/Dojo/Form/Decorator/BorderContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/BorderContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,9 +29,9 @@
  * @uses       Zend_Dojo_Form_Decorator_DijitContainer
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: BorderContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: BorderContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_BorderContainer extends Zend_Dojo_Form_Decorator_DijitContainer
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/ContentPane.php
--- a/web/lib/Zend/Dojo/Form/Decorator/ContentPane.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/ContentPane.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,9 +29,9 @@
  * @uses       Zend_Dojo_Form_Decorator_DijitContainer
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: ContentPane.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: ContentPane.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_ContentPane extends Zend_Dojo_Form_Decorator_DijitContainer
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/DijitContainer.php
--- a/web/lib/Zend/Dojo/Form/Decorator/DijitContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/DijitContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -35,9 +35,9 @@
  * @uses       Zend_Form_Decorator_Abstract
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: DijitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: DijitContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 abstract class Zend_Dojo_Form_Decorator_DijitContainer extends Zend_Form_Decorator_Abstract
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/DijitElement.php
--- a/web/lib/Zend/Dojo/Form/Decorator/DijitElement.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/DijitElement.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -36,9 +36,9 @@
  *
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: DijitElement.php 20621 2010-01-25 20:25:23Z matthew $
+ * @version    $Id: DijitElement.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_DijitElement extends Zend_Form_Decorator_ViewHelper
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/DijitForm.php
--- a/web/lib/Zend/Dojo/Form/Decorator/DijitForm.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/DijitForm.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -31,9 +31,9 @@
  *
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: DijitForm.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: DijitForm.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_DijitForm extends Zend_Dojo_Form_Decorator_DijitContainer
 {
@@ -56,6 +56,11 @@
         $dijitParams = $this->getDijitParams();
         $attribs     = array_merge($this->getAttribs(), $this->getOptions());
 
+        // Enforce id attribute of form for dojo events
+        if (!isset($attribs['name']) || !$attribs['name']) {
+            $element->setName(get_class($element) . '_' . uniqid());
+        }
+
         return $view->form($element->getName(), $attribs, $content);
     }
 }
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/SplitContainer.php
--- a/web/lib/Zend/Dojo/Form/Decorator/SplitContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/SplitContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,9 +29,9 @@
  * @uses       Zend_Dojo_Form_Decorator_DijitContainer
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: SplitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: SplitContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_SplitContainer extends Zend_Dojo_Form_Decorator_DijitContainer
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/StackContainer.php
--- a/web/lib/Zend/Dojo/Form/Decorator/StackContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/StackContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,9 +29,9 @@
  * @uses       Zend_Dojo_Form_Decorator_DijitContainer
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: StackContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: StackContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_StackContainer extends Zend_Dojo_Form_Decorator_DijitContainer
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Decorator/TabContainer.php
--- a/web/lib/Zend/Dojo/Form/Decorator/TabContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Decorator/TabContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -14,7 +14,7 @@
  *
  * @category   Zend
  * @package    Zend_Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,9 +29,9 @@
  * @uses       Zend_Dojo_Form_Decorator_DijitContainer
  * @package    Zend_Dojo
  * @subpackage Form_Decorator
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: TabContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: TabContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Decorator_TabContainer extends Zend_Dojo_Form_Decorator_DijitContainer
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/DisplayGroup.php
--- a/web/lib/Zend/Dojo/Form/DisplayGroup.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/DisplayGroup.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Form_DisplayGroup
  * @package    Zend_Dojo
  * @subpackage Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: DisplayGroup.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: DisplayGroup.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_DisplayGroup extends Zend_Form_DisplayGroup
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/Button.php
--- a/web/lib/Zend/Dojo/Form/Element/Button.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/Button.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Button.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Button.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_Button extends Zend_Dojo_Form_Element_Dijit
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/CheckBox.php
--- a/web/lib/Zend/Dojo/Form/Element/CheckBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/CheckBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -30,9 +30,9 @@
  * @uses       Zend_Dojo_Form_Element_Dijit
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: CheckBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: CheckBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_CheckBox extends Zend_Dojo_Form_Element_Dijit
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/ComboBox.php
--- a/web/lib/Zend/Dojo/Form/Element/ComboBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/ComboBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_DijitMulti
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: ComboBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: ComboBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_ComboBox extends Zend_Dojo_Form_Element_DijitMulti
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/CurrencyTextBox.php
--- a/web/lib/Zend/Dojo/Form/Element/CurrencyTextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/CurrencyTextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_NumberTextBox
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: CurrencyTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: CurrencyTextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_CurrencyTextBox extends Zend_Dojo_Form_Element_NumberTextBox
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/DateTextBox.php
--- a/web/lib/Zend/Dojo/Form/Element/DateTextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/DateTextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_ValidationTextBox
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: DateTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: DateTextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_DateTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/Dijit.php
--- a/web/lib/Zend/Dojo/Form/Element/Dijit.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/Dijit.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Dijit.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Dijit.php 24593 2012-01-05 20:35:02Z matthew $
  */
 abstract class Zend_Dojo_Form_Element_Dijit extends Zend_Form_Element
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/DijitMulti.php
--- a/web/lib/Zend/Dojo/Form/Element/DijitMulti.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/DijitMulti.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -30,9 +30,9 @@
  * @uses       Zend_Dojo_Form_Element_Dijit
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: DijitMulti.php 22322 2010-05-30 11:12:57Z thomas $
+ * @version    $Id: DijitMulti.php 24593 2012-01-05 20:35:02Z matthew $
  */
 abstract class Zend_Dojo_Form_Element_DijitMulti extends Zend_Dojo_Form_Element_Dijit
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/Editor.php
--- a/web/lib/Zend/Dojo/Form/Element/Editor.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/Editor.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Editor.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Editor.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_Form_Element_Dijit */
@@ -30,7 +30,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Dojo_Form_Element_Editor extends Zend_Dojo_Form_Element_Dijit
@@ -247,7 +247,7 @@
     {
         $plugin = (string) $plugin;
         $plugins = $this->getPlugins();
-        if (in_array($plugin, $plugins)) {
+        if (in_array($plugin, $plugins) && $plugin !== '|') {
             return $this;
         }
 
@@ -446,11 +446,11 @@
      */
     public function setMinHeight($minHeight)
     {
-        if (!preg_match('/^\d+(em)?$/i', $minHeight)) {
+        if (!preg_match('/^\d+(em|px|%)?$/i', $minHeight)) {
             require_once 'Zend/Form/Element/Exception.php';
             throw new Zend_Form_Element_Exception('Invalid minHeight provided; must be integer or CSS measurement');
         }
-        if ('em' != substr($minHeight, -2)) {
+        if (!preg_match('/(em|px|%)$/', $minHeight)) {
             $minHeight .= 'em';
         }
         return $this->setDijitParam('minHeight', $minHeight);
@@ -596,4 +596,102 @@
         }
         return $this->getDijitParam('updateInterval');
     }
+
+    /**
+     * Add a single editor extra plugin.
+     *
+     * @param  string $plugin
+     * @return Zend_Dojo_Form_Element_Editor
+     */
+    public function addExtraPlugin($plugin)
+    {
+        $plugin = (string) $plugin;
+        $extraPlugins = $this->getExtraPlugins();
+        if (in_array($plugin, $extraPlugins)) {
+            return $this;
+        }
+    
+        $extraPlugins[] = (string) $plugin;
+        $this->setDijitParam('extraPlugins', $extraPlugins);
+        return $this;
+    }
+    
+    /**
+     * Add multiple extra plugins.
+     *
+     * @param  array $extraPlugins
+     * @return Zend_Dojo_Form_Element_Editor
+     */
+    public function addExtraPlugins(array $plugins)
+    {
+        foreach ($plugins as $plugin) {
+            $this->addExtraPlugin($plugin);
+        }
+        return $this;
+    }
+    
+    /**
+     * Overwrite many extra plugins at once.
+     *
+     * @param  array $plugins
+     * @return Zend_Dojo_Form_Element_Editor
+     */
+    public function setExtraPlugins(array $plugins)
+    {
+        $this->clearExtraPlugins();
+        $this->addExtraPlugins($plugins);
+        return $this;
+    }
+    
+    /**
+     * Get all extra plugins.
+     *
+     * @return array
+     */
+    public function getExtraPlugins()
+    {
+        if (!$this->hasDijitParam('extraPlugins')) {
+            return array();
+        }
+        return $this->getDijitParam('extraPlugins');
+    }
+    
+    /**
+     * Is a given extra plugin registered?
+     *
+     * @param  string $plugin
+     * @return bool
+     */
+    public function hasExtraPlugin($plugin)
+    {
+        $extraPlugins = $this->getExtraPlugins();
+        return in_array((string) $plugin, $extraPlugins);
+    }
+    
+    /**
+     * Remove a given extra plugin.
+     *
+     * @param  string $plugin
+     * @return Zend_Dojo_Form_Element_Editor
+     */
+    public function removeExtraPlugin($plugin)
+    {
+        $extraPlugins = $this->getExtraPlugins();
+        if (false === ($index = array_search($plugin, $extraPlugins))) {
+            return $this;
+        }
+        unset($extraPlugins[$index]);
+        $this->setDijitParam('extraPlugins', $extraPlugins);
+        return $this;
+    }
+    
+    /**
+     * Clear all extra plugins.
+     *
+     * @return Zend_Dojo_Form_Element_Editor
+     */
+    public function clearExtraPlugins()
+    {
+        return $this->removeDijitParam('extraPlugins');
+    }
 }
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/FilteringSelect.php
--- a/web/lib/Zend/Dojo/Form/Element/FilteringSelect.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/FilteringSelect.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_ComboBox
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: FilteringSelect.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: FilteringSelect.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_FilteringSelect extends Zend_Dojo_Form_Element_ComboBox
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/HorizontalSlider.php
--- a/web/lib/Zend/Dojo/Form/Element/HorizontalSlider.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/HorizontalSlider.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_Slider
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: HorizontalSlider.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: HorizontalSlider.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_HorizontalSlider extends Zend_Dojo_Form_Element_Slider
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/NumberSpinner.php
--- a/web/lib/Zend/Dojo/Form/Element/NumberSpinner.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/NumberSpinner.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_ValidationTextBox
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: NumberSpinner.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: NumberSpinner.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_NumberSpinner extends Zend_Dojo_Form_Element_ValidationTextBox
 {
@@ -92,7 +92,7 @@
      */
     public function setLargeDelta($delta)
     {
-        $this->setDijitParam('largeDelta', (int) $delta);
+        $this->setDijitParam('largeDelta', (float) $delta);
         return $this;
     }
 
@@ -114,7 +114,7 @@
      */
     public function setSmallDelta($delta)
     {
-        $this->setDijitParam('smallDelta', (int) $delta);
+        $this->setDijitParam('smallDelta', (float) $delta);
         return $this;
     }
 
@@ -187,7 +187,7 @@
         if ($this->hasDijitParam('constraints')) {
             $constraints = $this->getDijitParam('constraints');
         }
-        $constraints['min'] = (int) $value;
+        $constraints['min'] = (float) $value;
         $this->setDijitParam('constraints', $constraints);
         return $this;
     }
@@ -221,7 +221,7 @@
         if ($this->hasDijitParam('constraints')) {
             $constraints = $this->getDijitParam('constraints');
         }
-        $constraints['max'] = (int) $value;
+        $constraints['max'] = (float) $value;
         $this->setDijitParam('constraints', $constraints);
         return $this;
     }
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/NumberTextBox.php
--- a/web/lib/Zend/Dojo/Form/Element/NumberTextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/NumberTextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_ValidationTextBox
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: NumberTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: NumberTextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_NumberTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/PasswordTextBox.php
--- a/web/lib/Zend/Dojo/Form/Element/PasswordTextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/PasswordTextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_ValidationTextBox
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: PasswordTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: PasswordTextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_PasswordTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/RadioButton.php
--- a/web/lib/Zend/Dojo/Form/Element/RadioButton.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/RadioButton.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_DijitMulti
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: RadioButton.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: RadioButton.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_RadioButton extends Zend_Dojo_Form_Element_DijitMulti
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/SimpleTextarea.php
--- a/web/lib/Zend/Dojo/Form/Element/SimpleTextarea.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/SimpleTextarea.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,9 +29,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: SimpleTextarea.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: SimpleTextarea.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_SimpleTextarea extends Zend_Dojo_Form_Element_Dijit
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/Slider.php
--- a/web/lib/Zend/Dojo/Form/Element/Slider.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/Slider.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_Dijit
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Slider.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Slider.php 24593 2012-01-05 20:35:02Z matthew $
  */
 abstract class Zend_Dojo_Form_Element_Slider extends Zend_Dojo_Form_Element_Dijit
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/SubmitButton.php
--- a/web/lib/Zend/Dojo/Form/Element/SubmitButton.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/SubmitButton.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: SubmitButton.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: SubmitButton.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_SubmitButton extends Zend_Dojo_Form_Element_Button
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/TextBox.php
--- a/web/lib/Zend/Dojo/Form/Element/TextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/TextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: TextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: TextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_TextBox extends Zend_Dojo_Form_Element_Dijit
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/Textarea.php
--- a/web/lib/Zend/Dojo/Form/Element/Textarea.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/Textarea.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Textarea.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Textarea.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_Textarea extends Zend_Dojo_Form_Element_Dijit
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/TimeTextBox.php
--- a/web/lib/Zend/Dojo/Form/Element/TimeTextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/TimeTextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_DateTextBox
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: TimeTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: TimeTextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_TimeTextBox extends Zend_Dojo_Form_Element_DateTextBox
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/ValidationTextBox.php
--- a/web/lib/Zend/Dojo/Form/Element/ValidationTextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/ValidationTextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_TextBox
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: ValidationTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: ValidationTextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_ValidationTextBox extends Zend_Dojo_Form_Element_TextBox
 {
@@ -132,6 +132,8 @@
      */
     public function setConstraints(array $constraints)
     {
+        $tmp = $this->getConstraints();
+        $constraints = array_merge($tmp, $constraints);
         array_walk_recursive($constraints, array($this, '_castBoolToString'));
         $this->setDijitParam('constraints', $constraints);
         return $this;
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/Element/VerticalSlider.php
--- a/web/lib/Zend/Dojo/Form/Element/VerticalSlider.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/Element/VerticalSlider.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Dojo_Form_Element_Slider
  * @package    Zend_Dojo
  * @subpackage Form_Element
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: VerticalSlider.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: VerticalSlider.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_Element_VerticalSlider extends Zend_Dojo_Form_Element_Slider
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/Form/SubForm.php
--- a/web/lib/Zend/Dojo/Form/SubForm.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/Form/SubForm.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -28,9 +28,9 @@
  * @uses       Zend_Form_SubForm
  * @package    Zend_Dojo
  * @subpackage Form
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: SubForm.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: SubForm.php 24593 2012-01-05 20:35:02Z matthew $
  */
 class Zend_Dojo_Form_SubForm extends Zend_Form_SubForm
 {
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Exception.php
--- a/web/lib/Zend/Dojo/View/Exception.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Exception.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /**
@@ -29,7 +29,7 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Dojo_View_Exception extends Zend_Dojo_Exception
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/AccordionContainer.php
--- a/web/lib/Zend/Dojo/View/Helper/AccordionContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/AccordionContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: AccordionContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: AccordionContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_DijitContainer
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_AccordionContainer extends Zend_Dojo_View_Helper_DijitContainer
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/AccordionPane.php
--- a/web/lib/Zend/Dojo/View/Helper/AccordionPane.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/AccordionPane.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: AccordionPane.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: AccordionPane.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_DijitContainer
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_AccordionPane extends Zend_Dojo_View_Helper_DijitContainer
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/BorderContainer.php
--- a/web/lib/Zend/Dojo/View/Helper/BorderContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/BorderContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: BorderContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: BorderContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_DijitContainer
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_BorderContainer extends Zend_Dojo_View_Helper_DijitContainer
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/Button.php
--- a/web/lib/Zend/Dojo/View/Helper/Button.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/Button.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Button.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Button.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_Dijit
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_Button extends Zend_Dojo_View_Helper_Dijit
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/CheckBox.php
--- a/web/lib/Zend/Dojo/View/Helper/CheckBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/CheckBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: CheckBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: CheckBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_Dijit
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_CheckBox extends Zend_Dojo_View_Helper_Dijit
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/ComboBox.php
--- a/web/lib/Zend/Dojo/View/Helper/ComboBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/ComboBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: ComboBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: ComboBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_Dijit
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
@@ -100,6 +100,10 @@
             return $html;
         }
 
+        // required for correct type casting in declerative mode 
+        if (isset($params['autocomplete'])) {
+            $params['autocomplete'] = ($params['autocomplete']) ? 'true' : 'false';
+        }
         // do as normal select
         $attribs = $this->_prepareDijit($attribs, $params, 'element');
         return $this->view->formSelect($id, $value, $attribs, $options);
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/ContentPane.php
--- a/web/lib/Zend/Dojo/View/Helper/ContentPane.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/ContentPane.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: ContentPane.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: ContentPane.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_DijitContainer
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_ContentPane extends Zend_Dojo_View_Helper_DijitContainer
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/CurrencyTextBox.php
--- a/web/lib/Zend/Dojo/View/Helper/CurrencyTextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/CurrencyTextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: CurrencyTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: CurrencyTextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_Dijit
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_CurrencyTextBox extends Zend_Dojo_View_Helper_Dijit
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/CustomDijit.php
--- a/web/lib/Zend/Dojo/View/Helper/CustomDijit.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/CustomDijit.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: CustomDijit.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: CustomDijit.php 25024 2012-07-30 15:08:15Z rob $
  */
 
 /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_DijitContainer
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_CustomDijit extends Zend_Dojo_View_Helper_DijitContainer
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/DateTextBox.php
--- a/web/lib/Zend/Dojo/View/Helper/DateTextBox.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/DateTextBox.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: DateTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: DateTextBox.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_Dijit
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 class Zend_Dojo_View_Helper_DateTextBox extends Zend_Dojo_View_Helper_Dijit
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/Dijit.php
--- a/web/lib/Zend/Dojo/View/Helper/Dijit.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/Dijit.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Dijit.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: Dijit.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_View_Helper_HtmlElement */
@@ -29,7 +29,7 @@
  * @uses       Zend_View_Helper_Abstract
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 abstract class Zend_Dojo_View_Helper_Dijit extends Zend_View_Helper_HtmlElement
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/DijitContainer.php
--- a/web/lib/Zend/Dojo/View/Helper/DijitContainer.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/DijitContainer.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: DijitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version    $Id: DijitContainer.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
  * @uses       Zend_Dojo_View_Helper_Dijit
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
   */
 abstract class Zend_Dojo_View_Helper_DijitContainer extends Zend_Dojo_View_Helper_Dijit
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/Dojo.php
--- a/web/lib/Zend/Dojo/View/Helper/Dojo.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/Dojo.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,8 +15,8 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
- * @version    $Id: Dojo.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version    $Id: Dojo.php 24593 2012-01-05 20:35:02Z matthew $
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -31,7 +31,7 @@
  *
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Dojo_View_Helper_Dojo
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/Dojo/Container.php
--- a/web/lib/Zend/Dojo/View/Helper/Dojo/Container.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/Dojo/Container.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,8 +15,8 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
- * @version    $Id: Container.php 23368 2010-11-18 19:56:30Z bittarman $
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @version    $Id: Container.php 24593 2012-01-05 20:35:02Z matthew $
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 
@@ -29,7 +29,7 @@
  *
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Dojo_View_Helper_Dojo_Container
@@ -882,7 +882,7 @@
      */
     public function addJavascript($js)
     {
-        $js = preg_replace('/^\s*(.*?)\s*$/s', '$1', $js);
+        $js = trim($js);
         if (!in_array(substr($js, -1), array(';', '}'))) {
             $js .= ';';
         }
@@ -1136,7 +1136,7 @@
         }
 
         $onLoadActions = array();
-        // Get Zend specific onLoad actions; these will always be first to 
+        // Get Zend specific onLoad actions; these will always be first to
         // ensure that dijits are created in the correct order
         foreach ($this->_getZendLoadActions() as $callback) {
             $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
@@ -1177,12 +1177,12 @@
     /**
      * Add an onLoad action related to ZF dijit creation
      *
-     * This method is public, but prefixed with an underscore to indicate that 
+     * This method is public, but prefixed with an underscore to indicate that
      * it should not normally be called by userland code. It is pertinent to
-     * ensuring that the correct order of operations occurs during dijit 
+     * ensuring that the correct order of operations occurs during dijit
      * creation.
-     * 
-     * @param  string $callback 
+     *
+     * @param  string $callback
      * @return Zend_Dojo_View_Helper_Dojo_Container
      */
     public function _addZendLoad($callback)
@@ -1195,7 +1195,7 @@
 
     /**
      * Retrieve all ZF dijit callbacks
-     * 
+     *
      * @return array
      */
     public function _getZendLoadActions()
diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Dojo/View/Helper/Editor.php
--- a/web/lib/Zend/Dojo/View/Helper/Editor.php	Fri Mar 22 10:44:46 2013 +0100
+++ b/web/lib/Zend/Dojo/View/Helper/Editor.php	Fri Mar 22 10:47:04 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Editor.php 20116 2010-01-07 14:18:34Z matthew $
+ * @version    $Id: Editor.php 24593 2012-01-05 20:35:02Z matthew $
  */
 
 /** Zend_Dojo_View_Helper_Dijit */
@@ -32,7 +32,7 @@
  * @uses       Zend_Dojo_View_Helper_Textarea
  * @package    Zend_Dojo
  * @subpackage View
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
@@ -57,14 +57,21 @@
         'fontSize' => 'FontChoice',
         'formatBlock' => 'FontChoice',
         'foreColor' => 'TextColor',
-        'hiliteColor' => 'TextColor'
+        'hiliteColor' => 'TextColor',
+        'enterKeyHandling' => 'EnterKeyHandling',
+        'fullScreen' => 'FullScreen',
+        'newPage' => 'NewPage',
+        'print' => 'Print',
+        'tabIndent' => 'TabIndent',
+        'toggleDir' => 'ToggleDir',
+        'viewSource' => 'ViewSource'
     );
 
     /**
      * JSON-encoded parameters
      * @var array
      */
-    protected $_jsonParams = array('captureEvents', 'events', 'plugins');
+    protected $_jsonParams = array('captureEvents', 'events', 'plugins', 'extraPlugins');
 
     /**
      * dijit.Editor
@@ -83,8 +90,8 @@
             }
         }
 
-        // Previous versions allowed specifying "degrade" to allow using a 
-        // textarea instead of a div -- but this is insecure. Removing the 
+        // Previous versions allowed specifying "degrade" to allow using a
+        // textarea instead of a div -- but this is insecure. Removing the
         // parameter if set to prevent its injection in the dijit.
         if (isset($params['degrade'])) {
             unset($params['degrade']);
@@ -114,17 +121,18 @@
 
         $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
 
-        $html  = '_htmlAttribs($hiddenAttribs) . $this->getClosingBracket();
-        $html .= '_htmlAttribs($attribs) . '>'
+        $html  = '_htmlAttribs($attribs) . '>'
                . $value
                . "\n";
 
-        // Embed a textarea in a