Commit 8f834617d6552af02a17ecc5cc32318d01621825

Authored by Tiago
1 parent c8f8a2aa
Exists in master

Atualizacao do Zend Framework

Showing 3014 changed files with 73075 additions and 15901 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 3014 files displayed.

README.md 100644 → 100755
default/forms/member.xml 100644 → 100755
default/views/scripts/profiles/member.phtml 100644 → 100755
default/views/scripts/users/permission.phtml 100644 → 100755
lib/Snep/AuthPlugin.php 100644 → 100755
lib/Zend/Acl.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Acl.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Acl.php 24771 2012-05-07 01:13:06Z adamlundrigan $
20 20 */
21 21  
22 22  
... ... @@ -53,7 +53,7 @@ require_once 'Zend/Acl/Resource.php';
53 53 /**
54 54 * @category Zend
55 55 * @package Zend_Acl
56   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  56 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
57 57 * @license http://framework.zend.com/license/new-bsd New BSD License
58 58 */
59 59 class Zend_Acl
... ... @@ -140,7 +140,7 @@ class Zend_Acl
140 140 * will have the least priority, and the last parent added will have the
141 141 * highest priority.
142 142 *
143   - * @param Zend_Acl_Role_Interface $role
  143 + * @param Zend_Acl_Role_Interface|string $role
144 144 * @param Zend_Acl_Role_Interface|string|array $parents
145 145 * @uses Zend_Acl_Role_Registry::add()
146 146 * @return Zend_Acl Provides a fluent interface
... ... @@ -309,6 +309,7 @@ class Zend_Acl
309 309 }
310 310 $resourceParent = $this->get($resourceParentId);
311 311 } catch (Zend_Acl_Exception $e) {
  312 + require_once 'Zend/Acl/Exception.php';
312 313 throw new Zend_Acl_Exception("Parent Resource id '$resourceParentId' does not exist", 0, $e);
313 314 }
314 315 $this->_resources[$resourceParentId]['children'][$resourceId] = $resource;
... ... @@ -407,6 +408,7 @@ class Zend_Acl
407 408 $resourceId = $this->get($resource)->getResourceId();
408 409 $inheritId = $this->get($inherit)->getResourceId();
409 410 } catch (Zend_Acl_Exception $e) {
  411 + require_once 'Zend/Acl/Exception.php';
410 412 throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e);
411 413 }
412 414  
... ... @@ -445,6 +447,7 @@ class Zend_Acl
445 447 try {
446 448 $resourceId = $this->get($resource)->getResourceId();
447 449 } catch (Zend_Acl_Exception $e) {
  450 + require_once 'Zend/Acl/Exception.php';
448 451 throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e);
449 452 }
450 453  
... ... @@ -629,21 +632,29 @@ class Zend_Acl
629 632 unset($rolesTemp);
630 633  
631 634 // ensure that all specified Resources exist; normalize input to array of Resource objects or null
632   - if (!is_array($resources)) {
633   - $resources = array($resources);
634   - } else if (0 === count($resources)) {
635   - $resources = array(null);
636   - }
637   - $resourcesTemp = $resources;
638   - $resources = array();
639   - foreach ($resourcesTemp as $resource) {
640   - if (null !== $resource) {
641   - $resources[] = $this->get($resource);
642   - } else {
643   - $resources[] = null;
  635 + if ($resources !== null) {
  636 + if (!is_array($resources)) {
  637 + $resources = array($resources);
  638 + } else if (0 === count($resources)) {
  639 + $resources = array(null);
644 640 }
  641 + $resourcesTemp = $resources;
  642 + $resources = array();
  643 + foreach ($resourcesTemp as $resource) {
  644 + if (null !== $resource) {
  645 + $resources[] = $this->get($resource);
  646 + } else {
  647 + $resources[] = null;
  648 + }
  649 + }
  650 + unset($resourcesTemp, $resource);
  651 + } else {
  652 + $allResources = array(); // this might be used later if resource iteration is required
  653 + foreach ($this->_resources as $rTarget) {
  654 + $allResources[] = $rTarget['instance'];
  655 + }
  656 + unset($rTarget);
645 657 }
646   - unset($resourcesTemp);
647 658  
648 659 // normalize privileges to array
649 660 if (null === $privileges) {
... ... @@ -656,15 +667,32 @@ class Zend_Acl
656 667  
657 668 // add to the rules
658 669 case self::OP_ADD:
659   - foreach ($resources as $resource) {
  670 + if ($resources !== null) {
  671 + // this block will iterate the provided resources
  672 + foreach ($resources as $resource) {
  673 + foreach ($roles as $role) {
  674 + $rules =& $this->_getRules($resource, $role, true);
  675 + if (0 === count($privileges)) {
  676 + $rules['allPrivileges']['type'] = $type;
  677 + $rules['allPrivileges']['assert'] = $assert;
  678 + if (!isset($rules['byPrivilegeId'])) {
  679 + $rules['byPrivilegeId'] = array();
  680 + }
  681 + } else {
  682 + foreach ($privileges as $privilege) {
  683 + $rules['byPrivilegeId'][$privilege]['type'] = $type;
  684 + $rules['byPrivilegeId'][$privilege]['assert'] = $assert;
  685 + }
  686 + }
  687 + }
  688 + }
  689 + } else {
  690 + // this block will apply to all resources in a global rule
660 691 foreach ($roles as $role) {
661   - $rules =& $this->_getRules($resource, $role, true);
  692 + $rules =& $this->_getRules(null, $role, true);
662 693 if (0 === count($privileges)) {
663 694 $rules['allPrivileges']['type'] = $type;
664 695 $rules['allPrivileges']['assert'] = $assert;
665   - if (!isset($rules['byPrivilegeId'])) {
666   - $rules['byPrivilegeId'] = array();
667   - }
668 696 } else {
669 697 foreach ($privileges as $privilege) {
670 698 $rules['byPrivilegeId'][$privilege]['type'] = $type;
... ... @@ -677,37 +705,81 @@ class Zend_Acl
677 705  
678 706 // remove from the rules
679 707 case self::OP_REMOVE:
680   - foreach ($resources as $resource) {
681   - foreach ($roles as $role) {
682   - $rules =& $this->_getRules($resource, $role);
683   - if (null === $rules) {
684   - continue;
685   - }
686   - if (0 === count($privileges)) {
687   - if (null === $resource && null === $role) {
688   - if ($type === $rules['allPrivileges']['type']) {
689   - $rules = array(
690   - 'allPrivileges' => array(
691   - 'type' => self::TYPE_DENY,
692   - 'assert' => null
693   - ),
694   - 'byPrivilegeId' => array()
695   - );
696   - }
  708 + if ($resources !== null) {
  709 + // this block will iterate the provided resources
  710 + foreach ($resources as $resource) {
  711 + foreach ($roles as $role) {
  712 + $rules =& $this->_getRules($resource, $role);
  713 + if (null === $rules) {
697 714 continue;
698 715 }
  716 + if (0 === count($privileges)) {
  717 + if (null === $resource && null === $role) {
  718 + if ($type === $rules['allPrivileges']['type']) {
  719 + $rules = array(
  720 + 'allPrivileges' => array(
  721 + 'type' => self::TYPE_DENY,
  722 + 'assert' => null
  723 + ),
  724 + 'byPrivilegeId' => array()
  725 + );
  726 + }
  727 + continue;
  728 + }
699 729  
700   - if (isset($rules['allPrivileges']['type']) &&
701   - $type === $rules['allPrivileges']['type'])
702   - {
703   - unset($rules['allPrivileges']);
704   - }
705   - } else {
706   - foreach ($privileges as $privilege) {
707   - if (isset($rules['byPrivilegeId'][$privilege]) &&
708   - $type === $rules['byPrivilegeId'][$privilege]['type'])
  730 + if (isset($rules['allPrivileges']['type']) &&
  731 + $type === $rules['allPrivileges']['type'])
709 732 {
710   - unset($rules['byPrivilegeId'][$privilege]);
  733 + unset($rules['allPrivileges']);
  734 + }
  735 + } else {
  736 + foreach ($privileges as $privilege) {
  737 + if (isset($rules['byPrivilegeId'][$privilege]) &&
  738 + $type === $rules['byPrivilegeId'][$privilege]['type'])
  739 + {
  740 + unset($rules['byPrivilegeId'][$privilege]);
  741 + }
  742 + }
  743 + }
  744 + }
  745 + }
  746 + } else {
  747 + // this block will apply to all resources in a global rule
  748 + foreach ($roles as $role) {
  749 + /**
  750 + * since null (all resources) was passed to this setRule() call, we need
  751 + * clean up all the rules for the global allResources, as well as the indivually
  752 + * set resources (per privilege as well)
  753 + */
  754 + foreach (array_merge(array(null), $allResources) as $resource) {
  755 + $rules =& $this->_getRules($resource, $role, true);
  756 + if (null === $rules) {
  757 + continue;
  758 + }
  759 + if (0 === count($privileges)) {
  760 + if (null === $role) {
  761 + if ($type === $rules['allPrivileges']['type']) {
  762 + $rules = array(
  763 + 'allPrivileges' => array(
  764 + 'type' => self::TYPE_DENY,
  765 + 'assert' => null
  766 + ),
  767 + 'byPrivilegeId' => array()
  768 + );
  769 + }
  770 + continue;
  771 + }
  772 +
  773 + if (isset($rules['allPrivileges']['type']) && $type === $rules['allPrivileges']['type']) {
  774 + unset($rules['allPrivileges']);
  775 + }
  776 + } else {
  777 + foreach ($privileges as $privilege) {
  778 + if (isset($rules['byPrivilegeId'][$privilege]) &&
  779 + $type === $rules['byPrivilegeId'][$privilege]['type'])
  780 + {
  781 + unset($rules['byPrivilegeId'][$privilege]);
  782 + }
711 783 }
712 784 }
713 785 }
... ... @@ -1126,6 +1198,7 @@ class Zend_Acl
1126 1198 return $nullRef;
1127 1199 }
1128 1200 $visitor['byRoleId'][$roleId]['byPrivilegeId'] = array();
  1201 + $visitor['byRoleId'][$roleId]['allPrivileges'] = array('type' => null, 'assert' => null);
1129 1202 }
1130 1203 return $visitor['byRoleId'][$roleId];
1131 1204 }
... ... @@ -1145,6 +1218,11 @@ class Zend_Acl
1145 1218 }
1146 1219  
1147 1220 /**
  1221 + * Returns an array of registered roles.
  1222 + *
  1223 + * Note that this method does not return instances of registered roles,
  1224 + * but only the role identifiers.
  1225 + *
1148 1226 * @return array of registered roles
1149 1227 */
1150 1228 public function getRoles()
... ... @@ -1159,6 +1237,6 @@ class Zend_Acl
1159 1237 {
1160 1238 return array_keys($this->_resources);
1161 1239 }
1162   -
  1240 +
1163 1241 }
1164   -
  1242 +
... ...
lib/Zend/Acl/Assert/Interface.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
... ... @@ -41,7 +41,7 @@ require_once 'Zend/Acl/Resource/Interface.php';
41 41 /**
42 42 * @category Zend
43 43 * @package Zend_Acl
44   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  44 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
45 45 * @license http://framework.zend.com/license/new-bsd New BSD License
46 46 */
47 47 interface Zend_Acl_Assert_Interface
... ...
lib/Zend/Acl/Exception.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
... ... @@ -29,7 +29,7 @@ require_once 'Zend/Exception.php';
29 29 /**
30 30 * @category Zend
31 31 * @package Zend_Acl
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Acl_Exception extends Zend_Exception
... ...
lib/Zend/Acl/Resource.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Resource.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
... ... @@ -29,7 +29,7 @@ require_once 'Zend/Acl/Resource/Interface.php';
29 29 /**
30 30 * @category Zend
31 31 * @package Zend_Acl
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Acl_Resource implements Zend_Acl_Resource_Interface
... ...
lib/Zend/Acl/Resource/Interface.php 100755 → 100644
... ... @@ -14,16 +14,16 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
23 23 /**
24 24 * @category Zend
25 25 * @package Zend_Acl
26   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  26 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27 27 * @license http://framework.zend.com/license/new-bsd New BSD License
28 28 */
29 29 interface Zend_Acl_Resource_Interface
... ...
lib/Zend/Acl/Role.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Role.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Role.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
... ... @@ -29,7 +29,7 @@ require_once 'Zend/Acl/Role/Interface.php';
29 29 /**
30 30 * @category Zend
31 31 * @package Zend_Acl
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Acl_Role implements Zend_Acl_Role_Interface
... ... @@ -44,7 +44,7 @@ class Zend_Acl_Role implements Zend_Acl_Role_Interface
44 44 /**
45 45 * Sets the Role identifier
46 46 *
47   - * @param string $id
  47 + * @param string $roleId
48 48 * @return void
49 49 */
50 50 public function __construct($roleId)
... ...
lib/Zend/Acl/Role/Interface.php 100755 → 100644
... ... @@ -14,16 +14,16 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
23 23 /**
24 24 * @category Zend
25 25 * @package Zend_Acl
26   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  26 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27 27 * @license http://framework.zend.com/license/new-bsd New BSD License
28 28 */
29 29 interface Zend_Acl_Role_Interface
... ...
lib/Zend/Acl/Role/Registry.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Registry.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Registry.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
... ... @@ -29,7 +29,7 @@ require_once 'Zend/Acl/Role/Interface.php';
29 29 /**
30 30 * @category Zend
31 31 * @package Zend_Acl
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Acl_Role_Registry
... ...
lib/Zend/Acl/Role/Registry/Exception.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Acl
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
... ... @@ -29,7 +29,7 @@ require_once 'Zend/Acl/Exception.php';
29 29 /**
30 30 * @category Zend
31 31 * @package Zend_Acl
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Acl_Role_Registry_Exception extends Zend_Acl_Exception
... ...
lib/Zend/Amf/Adobe/Auth.php
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Auth.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Auth.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /** @see Zend_Amf_Auth_Abstract */
... ... @@ -33,7 +33,7 @@ require_once 'Zend/Auth/Result.php';
33 33 *
34 34 * @package Zend_Amf
35 35 * @subpackage Adobe
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Amf_Adobe_Auth extends Zend_Amf_Auth_Abstract
... ...
lib/Zend/Amf/Adobe/DbInspector.php
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: DbInspector.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: DbInspector.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /**
... ... @@ -24,7 +24,7 @@
24 24 *
25 25 * @package Zend_Amf
26 26 * @subpackage Adobe
27   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  27 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28 28 * @license http://framework.zend.com/license/new-bsd New BSD License
29 29 */
30 30 class Zend_Amf_Adobe_DbInspector
... ...
lib/Zend/Amf/Adobe/Introspector.php
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Introspector.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Introspector.php 25024 2012-07-30 15:08:15Z rob $
20 20 */
21 21  
22 22 /** @see Zend_Amf_Parse_TypeLoader */
... ... @@ -33,7 +33,7 @@ require_once 'Zend/Server/Reflection.php';
33 33 *
34 34 * @package Zend_Amf
35 35 * @subpackage Adobe
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Amf_Adobe_Introspector
... ... @@ -283,7 +283,12 @@ class Zend_Amf_Adobe_Introspector
283 283 return 'Unknown';
284 284 }
285 285  
286   - if (in_array($typename, array('int', 'integer', 'bool', 'boolean', 'float', 'string', 'object', 'Unknown', 'stdClass', 'array'))) {
  286 + // Arrays
  287 + if ('array' == $typename) {
  288 + return 'Unknown[]';
  289 + }
  290 +
  291 + if (in_array($typename, array('int', 'integer', 'bool', 'boolean', 'float', 'string', 'object', 'Unknown', 'stdClass'))) {
287 292 return $typename;
288 293 }
289 294  
... ...
lib/Zend/Amf/Auth/Abstract.php
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /** @see Zend_Auth_Adapter_Interface */
... ... @@ -27,7 +27,7 @@ require_once 'Zend/Auth/Adapter/Interface.php';
27 27 *
28 28 * @package Zend_Amf
29 29 * @subpackage Auth
30   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  30 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31 31 * @license http://framework.zend.com/license/new-bsd New BSD License
32 32 */
33 33 abstract class Zend_Amf_Auth_Abstract implements Zend_Auth_Adapter_Interface
... ...
lib/Zend/Amf/Constants.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Constants.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Constants.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /**
... ... @@ -24,7 +24,7 @@
24 24 * deserialization to detect the AMF marker and encoding types.
25 25 *
26 26 * @package Zend_Amf
27   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  27 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28 28 * @license http://framework.zend.com/license/new-bsd New BSD License
29 29 */
30 30 final class Zend_Amf_Constants
... ...
lib/Zend/Amf/Exception.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /**
... ... @@ -26,7 +26,7 @@ require_once 'Zend/Exception.php';
26 26  
27 27 /**
28 28 * @package Zend_Amf
29   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30 30 * @license http://framework.zend.com/license/new-bsd New BSD License
31 31 */
32 32 class Zend_Amf_Exception extends Zend_Exception
... ...
lib/Zend/Amf/Parse/Amf0/Deserializer.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse_Amf0
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Deserializer.php 21210 2010-02-27 10:37:39Z yoshida@zend.co.jp $
  20 + * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** Zend_Amf_Constants */
... ... @@ -33,7 +33,7 @@ require_once 'Zend/Amf/Parse/Deserializer.php';
33 33 * @todo Class could be implemented as Factory Class with each data type it's own class
34 34 * @package Zend_Amf
35 35 * @subpackage Parse_Amf0
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Amf_Parse_Amf0_Deserializer extends Zend_Amf_Parse_Deserializer
... ...
lib/Zend/Amf/Parse/Amf0/Serializer.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse_Amf0
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Serializer.php 21969 2010-04-22 03:54:59Z matthew $
  20 + * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $
21 21 */
22 22  
23 23 /** Zend_Amf_Constants */
... ... @@ -32,7 +32,7 @@ require_once 'Zend/Amf/Parse/Serializer.php';
32 32 * @uses Zend_Amf_Parse_Serializer
33 33 * @package Zend_Amf
34 34 * @subpackage Parse_Amf0
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
... ... @@ -63,8 +63,8 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
63 63 */
64 64 public function writeTypeMarker(&$data, $markerType = null, $dataByVal = false)
65 65 {
66   - // Workaround for PHP5 with E_STRICT enabled complaining about "Only
67   - // variables should be passed by reference"
  66 + // Workaround for PHP5 with E_STRICT enabled complaining about "Only
  67 + // variables should be passed by reference"
68 68 if ((null === $data) && ($dataByVal !== false)) {
69 69 $data = &$dataByVal;
70 70 }
... ... @@ -127,7 +127,7 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
127 127 case (is_bool($data)):
128 128 $markerType = Zend_Amf_Constants::AMF0_BOOLEAN;
129 129 break;
130   - case (is_string($data) && (strlen($data) > 65536)):
  130 + case (is_string($data) && (($this->_mbStringFunctionsOverloaded ? mb_strlen($data, '8bit') : strlen($data)) > 65536)):
131 131 $markerType = Zend_Amf_Constants::AMF0_LONGSTRING;
132 132 break;
133 133 case (is_string($data)):
... ... @@ -187,23 +187,23 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
187 187 * Check if the given object is in the reference table, write the reference if it exists,
188 188 * otherwise add the object to the reference table
189 189 *
190   - * @param mixed $object object reference to check for reference
191   - * @param $markerType AMF type of the object to write
192   - * @param mixed $objectByVal object to check for reference
  190 + * @param mixed $object object reference to check for reference
  191 + * @param string $markerType AMF type of the object to write
  192 + * @param mixed $objectByVal object to check for reference
193 193 * @return Boolean true, if the reference was written, false otherwise
194 194 */
195   - protected function writeObjectReference(&$object, $markerType, $objectByVal = false)
  195 + protected function writeObjectReference(&$object, $markerType, $objectByVal = false)
196 196 {
197   - // Workaround for PHP5 with E_STRICT enabled complaining about "Only
  197 + // Workaround for PHP5 with E_STRICT enabled complaining about "Only
198 198 // variables should be passed by reference"
199 199 if ((null === $object) && ($objectByVal !== false)) {
200 200 $object = &$objectByVal;
201 201 }
202 202  
203   - if ($markerType == Zend_Amf_Constants::AMF0_OBJECT
204   - || $markerType == Zend_Amf_Constants::AMF0_MIXEDARRAY
205   - || $markerType == Zend_Amf_Constants::AMF0_ARRAY
206   - || $markerType == Zend_Amf_Constants::AMF0_TYPEDOBJECT
  203 + if ($markerType == Zend_Amf_Constants::AMF0_OBJECT
  204 + || $markerType == Zend_Amf_Constants::AMF0_MIXEDARRAY
  205 + || $markerType == Zend_Amf_Constants::AMF0_ARRAY
  206 + || $markerType == Zend_Amf_Constants::AMF0_TYPEDOBJECT
207 207 ) {
208 208 $ref = array_search($object, $this->_referenceObjects, true);
209 209 //handle object reference
... ...
lib/Zend/Amf/Parse/Amf3/Deserializer.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse_Amf3
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Deserializer.php 21969 2010-04-22 03:54:59Z matthew $
  20 + * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** Zend_Amf_Parse_Deserializer */
... ... @@ -34,7 +34,7 @@ require_once 'Zend/Amf/Parse/TypeLoader.php';
34 34 * @todo Class could be implemented as Factory Class with each data type it's own class.
35 35 * @package Zend_Amf
36 36 * @subpackage Parse_Amf3
37   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  37 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38 38 * @license http://framework.zend.com/license/new-bsd New BSD License
39 39 */
40 40 class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
... ... @@ -225,7 +225,7 @@ class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
225 225 $timestamp = floor($this->_stream->readDouble() / 1000);
226 226  
227 227 require_once 'Zend/Date.php';
228   - $dateTime = new Zend_Date((int) $timestamp);
  228 + $dateTime = new Zend_Date($timestamp);
229 229 $this->_referenceObjects[] = $dateTime;
230 230 return $dateTime;
231 231 }
... ... @@ -385,6 +385,7 @@ class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
385 385 }
386 386  
387 387 // Add properties back to the return object.
  388 + if (!is_array($properties)) $properties = array();
388 389 foreach($properties as $key=>$value) {
389 390 if($key) {
390 391 $returnObject->$key = $value;
... ...
lib/Zend/Amf/Parse/Amf3/Serializer.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse_Amf3
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Serializer.php 21969 2010-04-22 03:54:59Z matthew $
  20 + * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $
21 21 */
22 22  
23 23 /** Zend_Amf_Constants */
... ... @@ -35,7 +35,7 @@ require_once 'Zend/Amf/Parse/TypeLoader.php';
35 35 *
36 36 * @package Zend_Amf
37 37 * @subpackage Parse_Amf3
38   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  38 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39 39 * @license http://framework.zend.com/license/new-bsd New BSD License
40 40 */
41 41 class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
... ... @@ -45,7 +45,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
45 45 * @var string
46 46 */
47 47 protected $_strEmpty = '';
48   -
  48 +
49 49 /**
50 50 * An array of reference objects per amf body
51 51 * @var array
... ... @@ -78,7 +78,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
78 78 */
79 79 public function writeTypeMarker(&$data, $markerType = null, $dataByVal = false)
80 80 {
81   - // Workaround for PHP5 with E_STRICT enabled complaining about "Only
  81 + // Workaround for PHP5 with E_STRICT enabled complaining about "Only
82 82 // variables should be passed by reference"
83 83 if ((null === $data) && ($dataByVal !== false)) {
84 84 $data = &$dataByVal;
... ... @@ -215,7 +215,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
215 215 * @return Zend_Amf_Parse_Amf3_Serializer
216 216 */
217 217 protected function writeBinaryString(&$string){
218   - $ref = strlen($string) << 1 | 0x01;
  218 + $ref = ($this->_mbStringFunctionsOverloaded ? mb_strlen($string, '8bit') : strlen($string)) << 1 | 0x01;
219 219 $this->writeInteger($ref);
220 220 $this->_stream->writeBytes($string);
221 221  
... ... @@ -230,15 +230,17 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
230 230 */
231 231 public function writeString(&$string)
232 232 {
233   - $len = strlen($string);
  233 + $len = $this->_mbStringFunctionsOverloaded ? mb_strlen($string, '8bit') : strlen($string);
234 234 if(!$len){
235 235 $this->writeInteger(0x01);
236 236 return $this;
237 237 }
238 238  
239   - $ref = array_search($string, $this->_referenceStrings, true);
240   - if($ref === false){
241   - $this->_referenceStrings[] = $string;
  239 + $ref = array_key_exists($string, $this->_referenceStrings)
  240 + ? $this->_referenceStrings[$string]
  241 + : false;
  242 + if ($ref === false){
  243 + $this->_referenceStrings[$string] = count($this->_referenceStrings);
242 244 $this->writeBinaryString($string);
243 245 } else {
244 246 $ref <<= 1;
... ... @@ -380,13 +382,16 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
380 382 */
381 383 protected function writeObjectReference(&$object, $objectByVal = false)
382 384 {
383   - // Workaround for PHP5 with E_STRICT enabled complaining about "Only
  385 + // Workaround for PHP5 with E_STRICT enabled complaining about "Only
384 386 // variables should be passed by reference"
385 387 if ((null === $object) && ($objectByVal !== false)) {
386 388 $object = &$objectByVal;
387 389 }
388 390  
389   - $ref = array_search($object, $this->_referenceObjects,true);
  391 + $hash = spl_object_hash($object);
  392 + $ref = array_key_exists($hash, $this->_referenceObjects)
  393 + ? $this->_referenceObjects[$hash]
  394 + : false;
390 395  
391 396 // quickly handle object references
392 397 if ($ref !== false){
... ... @@ -394,7 +399,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
394 399 $this->writeInteger($ref);
395 400 return true;
396 401 }
397   - $this->_referenceObjects[] = $object;
  402 + $this->_referenceObjects[$hash] = count($this->_referenceObjects);
398 403 return false;
399 404 }
400 405  
... ...
lib/Zend/Amf/Parse/Deserializer.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Deserializer.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -30,7 +30,7 @@
30 30 * @see http://opensource.adobe.com/svn/opensource/blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/
31 31 * @package Zend_Amf
32 32 * @subpackage Parse
33   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34 34 * @license http://framework.zend.com/license/new-bsd New BSD License
35 35 */
36 36 abstract class Zend_Amf_Parse_Deserializer
... ...
lib/Zend/Amf/Parse/InputStream.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: InputStream.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: InputStream.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** Zend_Amf_Util_BinaryStream */
... ... @@ -31,7 +31,7 @@ require_once &#39;Zend/Amf/Util/BinaryStream.php&#39;;
31 31 *
32 32 * @package Zend_Amf
33 33 * @subpackage Parse
34   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  34 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35 35 * @license http://framework.zend.com/license/new-bsd New BSD License
36 36 */
37 37 class Zend_Amf_Parse_InputStream extends Zend_Amf_Util_BinaryStream
... ...
lib/Zend/Amf/Parse/OutputStream.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: OutputStream.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: OutputStream.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** Zend_Amf_Util_BinaryStream */
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Amf/Util/BinaryStream.php&#39;;
32 32 * @uses Zend_Amf_Util_BinaryStream
33 33 * @package Zend_Amf
34 34 * @subpackage Parse
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Amf_Parse_OutputStream extends Zend_Amf_Util_BinaryStream
... ...
lib/Zend/Amf/Parse/Resource/MysqlResult.php
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: MysqlResult.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: MysqlResult.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -26,7 +26,7 @@
26 26 *
27 27 * @package Zend_Amf
28 28 * @subpackage Parse
29   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30 30 * @license http://framework.zend.com/license/new-bsd New BSD License
31 31 */
32 32 class Zend_Amf_Parse_Resource_MysqlResult
... ...
lib/Zend/Amf/Parse/Resource/MysqliResult.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: MysqliResult.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: MysqliResult.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -26,7 +26,7 @@
26 26 *
27 27 * @package Zend_Amf
28 28 * @subpackage Parse
29   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30 30 * @license http://framework.zend.com/license/new-bsd New BSD License
31 31 */
32 32 class Zend_Amf_Parse_Resource_MysqliResult
... ...
lib/Zend/Amf/Parse/Resource/Stream.php
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Stream.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Stream.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -25,7 +25,7 @@
25 25 *
26 26 * @package Zend_Amf
27 27 * @subpackage Parse
28   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  28 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29 29 * @license http://framework.zend.com/license/new-bsd New BSD License
30 30 */
31 31 class Zend_Amf_Parse_Resource_Stream
... ...
lib/Zend/Amf/Parse/Serializer.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Serializer.php 21969 2010-04-22 03:54:59Z matthew $
  20 + * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $
21 21 */
22 22  
23 23 /**
... ... @@ -25,7 +25,7 @@
25 25 *
26 26 * @package Zend_Amf
27 27 * @subpackage Parse
28   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  28 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29 29 * @license http://framework.zend.com/license/new-bsd New BSD License
30 30 */
31 31 abstract class Zend_Amf_Parse_Serializer
... ... @@ -38,6 +38,13 @@ abstract class Zend_Amf_Parse_Serializer
38 38 protected $_stream;
39 39  
40 40 /**
  41 + * str* functions overloaded using mbstring.func_overload
  42 + *
  43 + * @var bool
  44 + */
  45 + protected $mbStringFunctionsOverloaded;
  46 +
  47 + /**
41 48 * Constructor
42 49 *
43 50 * @param Zend_Amf_Parse_OutputStream $stream
... ... @@ -46,6 +53,7 @@ abstract class Zend_Amf_Parse_Serializer
46 53 public function __construct(Zend_Amf_Parse_OutputStream $stream)
47 54 {
48 55 $this->_stream = $stream;
  56 + $this->_mbStringFunctionsOverloaded = function_exists('mb_strlen') && (ini_get('mbstring.func_overload') !== '') && ((int)ini_get('mbstring.func_overload') & 2);
49 57 }
50 58  
51 59 /**
... ...
lib/Zend/Amf/Parse/TypeLoader.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Parse
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: TypeLoader.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: TypeLoader.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -47,7 +47,7 @@ require_once &#39;Zend/Amf/Value/Messaging/RemotingMessage.php&#39;;
47 47 * @todo PHP 5.3 can drastically change this class w/ namespace and the new call_user_func w/ namespace
48 48 * @package Zend_Amf
49 49 * @subpackage Parse
50   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  50 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
51 51 * @license http://framework.zend.com/license/new-bsd New BSD License
52 52 */
53 53 final class Zend_Amf_Parse_TypeLoader
... ...
lib/Zend/Amf/Request.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Request.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Request.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /** @see Zend_Amf_Parse_InputStream */
... ... @@ -40,7 +40,7 @@ require_once &#39;Zend/Amf/Value/MessageBody.php&#39;;
40 40 *
41 41 * @todo Currently not checking if the object needs to be Type Mapped to a server object.
42 42 * @package Zend_Amf
43   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  43 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
44 44 * @license http://framework.zend.com/license/new-bsd New BSD License
45 45 */
46 46 class Zend_Amf_Request
... ...
lib/Zend/Amf/Request/Http.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Request
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** @see Zend_Amf_Request */
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Amf/Request.php&#39;;
32 32 *
33 33 * @package Zend_Amf
34 34 * @subpackage Request
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Amf_Request_Http extends Zend_Amf_Request
... ...
lib/Zend/Amf/Response.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Response.php 21969 2010-04-22 03:54:59Z matthew $
  19 + * @version $Id: Response.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /** @see Zend_Amf_Constants */
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Amf/Parse/Amf0/Serializer.php&#39;;
32 32 * Handles converting the PHP object ready for response back into AMF
33 33 *
34 34 * @package Zend_Amf
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Amf_Response
... ... @@ -95,7 +95,7 @@ class Zend_Amf_Response
95 95 $stream->writeByte($header->mustRead);
96 96 $stream->writeLong(Zend_Amf_Constants::UNKNOWN_CONTENT_LENGTH);
97 97 if (is_object($header->data)) {
98   - // Workaround for PHP5 with E_STRICT enabled complaining about
  98 + // Workaround for PHP5 with E_STRICT enabled complaining about
99 99 // "Only variables should be passed by reference"
100 100 $placeholder = null;
101 101 $serializer->writeTypeMarker($placeholder, null, $header->data);
... ... @@ -115,7 +115,7 @@ class Zend_Amf_Response
115 115 $bodyData = $body->getData();
116 116 $markerType = ($this->_objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) ? null : Zend_Amf_Constants::AMF0_AMF3;
117 117 if (is_object($bodyData)) {
118   - // Workaround for PHP5 with E_STRICT enabled complaining about
  118 + // Workaround for PHP5 with E_STRICT enabled complaining about
119 119 // "Only variables should be passed by reference"
120 120 $placeholder = null;
121 121 $serializer->writeTypeMarker($placeholder, $markerType, $bodyData);
... ...
lib/Zend/Amf/Response/Http.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Response
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** Zend_Amf_Response */
... ... @@ -28,7 +28,7 @@ require_once &#39;Zend/Amf/Response.php&#39;;
28 28 *
29 29 * @package Zend_Amf
30 30 * @subpackage Response
31   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32 32 * @license http://framework.zend.com/license/new-bsd New BSD License
33 33 */
34 34 class Zend_Amf_Response_Http extends Zend_Amf_Response
... ... @@ -41,10 +41,33 @@ class Zend_Amf_Response_Http extends Zend_Amf_Response
41 41 public function getResponse()
42 42 {
43 43 if (!headers_sent()) {
44   - header('Cache-Control: cache, must-revalidate');
45   - header('Pragma: public');
  44 + if ($this->isIeOverSsl()) {
  45 + header('Cache-Control: cache, must-revalidate');
  46 + header('Pragma: public');
  47 + } else {
  48 + header('Cache-Control: no-cache, must-revalidate');
  49 + header('Pragma: no-cache');
  50 + }
  51 + header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
46 52 header('Content-Type: application/x-amf');
47 53 }
48 54 return parent::getResponse();
49 55 }
  56 +
  57 + protected function isIeOverSsl()
  58 + {
  59 + $ssl = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false;
  60 + if (!$ssl || ($ssl == 'off')) {
  61 + // IIS reports "off", whereas other browsers simply don't populate
  62 + return false;
  63 + }
  64 +
  65 + $ua = $_SERVER['HTTP_USER_AGENT'];
  66 + if (!preg_match('/; MSIE \d+\.\d+;/', $ua)) {
  67 + // Not MicroSoft Internet Explorer
  68 + return false;
  69 + }
  70 +
  71 + return true;
  72 + }
50 73 }
... ...
lib/Zend/Amf/Server.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Amf
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Server.php 21210 2010-02-27 10:37:39Z yoshida@zend.co.jp $
  19 + * @version $Id: Server.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /** @see Zend_Server_Interface */
... ... @@ -52,7 +52,7 @@ require_once &#39;Zend/Auth.php&#39;;
52 52 * @todo Make the reflection methods cache and autoload.
53 53 * @package Zend_Amf
54 54 * @subpackage Server
55   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  55 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
56 56 * @license http://framework.zend.com/license/new-bsd New BSD License
57 57 */
58 58 class Zend_Amf_Server implements Zend_Server_Interface
... ... @@ -108,7 +108,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
108 108 protected $_session = false;
109 109  
110 110 /**
111   - * Namespace allows all AMF calls to not clobber other php session variables
  111 + * Namespace allows all AMF calls to not clobber other PHP session variables
112 112 * @var Zend_Session_NameSpace default session namespace zend_amf
113 113 */
114 114 protected $_sesionNamespace = 'zend_amf';
... ... @@ -142,12 +142,18 @@ class Zend_Amf_Server implements Zend_Server_Interface
142 142 /**
143 143 * Set authentication adapter
144 144 *
  145 + * If the authentication adapter implements a "getAcl()" method, populate
  146 + * the ACL of this instance with it (if none exists already).
  147 + *
145 148 * @param Zend_Amf_Auth_Abstract $auth
146 149 * @return Zend_Amf_Server
147 150 */
148 151 public function setAuth(Zend_Amf_Auth_Abstract $auth)
149 152 {
150 153 $this->_auth = $auth;
  154 + if ((null === $this->getAcl()) && method_exists($auth, 'getAcl')) {
  155 + $this->setAcl($auth->getAcl());
  156 + }
151 157 return $this;
152 158 }
153 159 /**
... ... @@ -300,12 +306,12 @@ class Zend_Amf_Server implements Zend_Server_Interface
300 306 $source = $mapped;
301 307 }
302 308 }
303   - $qualifiedName = empty($source) ? $method : $source.".".$method;
  309 + $qualifiedName = empty($source) ? $method : $source . '.' . $method;
304 310  
305 311 if (!isset($this->_table[$qualifiedName])) {
306 312 // if source is null a method that was not defined was called.
307 313 if ($source) {
308   - $className = str_replace(".", "_", $source);
  314 + $className = str_replace('.', '_', $source);
309 315 if(class_exists($className, false) && !isset($this->_classAllowed[$className])) {
310 316 require_once 'Zend/Amf/Server/Exception.php';
311 317 throw new Zend_Amf_Server_Exception('Can not call "' . $className . '" - use setClass()');
... ... @@ -317,8 +323,12 @@ class Zend_Amf_Server implements Zend_Server_Interface
317 323 throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist: '.$e->getMessage(), 0, $e);
318 324 }
319 325 // Add the new loaded class to the server.
  326 + require_once 'Zend/Amf/Server/Exception.php';
320 327 $this->setClass($className, $source);
321   - } else {
  328 + }
  329 +
  330 + if (!isset($this->_table[$qualifiedName])) {
  331 + // Source is null or doesn't contain specified method
322 332 require_once 'Zend/Amf/Server/Exception.php';
323 333 throw new Zend_Amf_Server_Exception('Method "' . $method . '" does not exist');
324 334 }
... ... @@ -331,6 +341,8 @@ class Zend_Amf_Server implements Zend_Server_Interface
331 341 $params = array_merge($params, $argv);
332 342 }
333 343  
  344 + $params = $this->_castParameters($info, $params);
  345 +
334 346 if ($info instanceof Zend_Server_Reflection_Function) {
335 347 $func = $info->getName();
336 348 $this->_checkAcl(null, $func);
... ... @@ -491,66 +503,60 @@ class Zend_Amf_Server implements Zend_Server_Interface
491 503 // set response encoding
492 504 $response->setObjectEncoding($objectEncoding);
493 505  
494   - $responseBody = $request->getAmfBodies();
495   -
496   - $handleAuth = false;
497   - if ($this->_auth) {
498   - $headers = $request->getAmfHeaders();
499   - if (isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]) &&
500   - isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid)) {
501   - $handleAuth = true;
  506 + // Authenticate, if we have credential headers
  507 + $error = false;
  508 + $headers = $request->getAmfHeaders();
  509 + if (isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER])
  510 + && isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid)
  511 + && isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password)
  512 + ) {
  513 + try {
  514 + if ($this->_handleAuth(
  515 + $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid,
  516 + $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password
  517 + )) {
  518 + // use RequestPersistentHeader to clear credentials
  519 + $response->addAmfHeader(
  520 + new Zend_Amf_Value_MessageHeader(
  521 + Zend_Amf_Constants::PERSISTENT_HEADER,
  522 + false,
  523 + new Zend_Amf_Value_MessageHeader(
  524 + Zend_Amf_Constants::CREDENTIALS_HEADER,
  525 + false, null
  526 + )
  527 + )
  528 + );
  529 + }
  530 + } catch (Exception $e) {
  531 + // Error during authentication; report it
  532 + $error = $this->_errorMessage(
  533 + $objectEncoding,
  534 + '',
  535 + $e->getMessage(),
  536 + $e->getTraceAsString(),
  537 + $e->getCode(),
  538 + $e->getLine()
  539 + );
  540 + $responseType = Zend_AMF_Constants::STATUS_METHOD;
502 541 }
503 542 }
504 543  
505 544 // Iterate through each of the service calls in the AMF request
506   - foreach($responseBody as $body)
  545 + foreach($request->getAmfBodies() as $body)
507 546 {
  547 + if ($error) {
  548 + // Error during authentication; just report it and be done
  549 + $responseURI = $body->getResponseURI() . $responseType;
  550 + $newBody = new Zend_Amf_Value_MessageBody($responseURI, null, $error);
  551 + $response->addAmfBody($newBody);
  552 + continue;
  553 + }
508 554 try {
509   - if ($handleAuth) {
510   - if ($this->_handleAuth(
511   - $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid,
512   - $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password)) {
513   - // use RequestPersistentHeader to clear credentials
514   - $response->addAmfHeader(
515   - new Zend_Amf_Value_MessageHeader(
516   - Zend_Amf_Constants::PERSISTENT_HEADER,
517   - false,
518   - new Zend_Amf_Value_MessageHeader(
519   - Zend_Amf_Constants::CREDENTIALS_HEADER,
520   - false, null)));
521   - $handleAuth = false;
522   - }
523   - }
524   -
525   - if ($objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) {
526   - // AMF0 Object Encoding
527   - $targetURI = $body->getTargetURI();
528   - $message = '';
529   -
530   - // Split the target string into its values.
531   - $source = substr($targetURI, 0, strrpos($targetURI, '.'));
532   -
533   - if ($source) {
534   - // Break off method name from namespace into source
535   - $method = substr(strrchr($targetURI, '.'), 1);
536   - $return = $this->_dispatch($method, $body->getData(), $source);
537   - } else {
538   - // Just have a method name.
539   - $return = $this->_dispatch($targetURI, $body->getData());
540   - }
541   - } else {
542   - // AMF3 read message type
543   - $message = $body->getData();
544   - if ($message instanceof Zend_Amf_Value_Messaging_CommandMessage) {
545   - // async call with command message
546   - $return = $this->_loadCommandMessage($message);
547   - } elseif ($message instanceof Zend_Amf_Value_Messaging_RemotingMessage) {
548   - require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
549   - $return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message);
550   - $return->body = $this->_dispatch($message->operation, $message->body, $message->source);
551   - } else {
552   - // Amf3 message sent with netConnection
  555 + switch ($objectEncoding) {
  556 + case Zend_Amf_Constants::AMF0_OBJECT_ENCODING:
  557 + // AMF0 Object Encoding
553 558 $targetURI = $body->getTargetURI();
  559 + $message = '';
554 560  
555 561 // Split the target string into its values.
556 562 $source = substr($targetURI, 0, strrpos($targetURI, '.'));
... ... @@ -563,7 +569,35 @@ class Zend_Amf_Server implements Zend_Server_Interface
563 569 // Just have a method name.
564 570 $return = $this->_dispatch($targetURI, $body->getData());
565 571 }
566   - }
  572 + break;
  573 + case Zend_Amf_Constants::AMF3_OBJECT_ENCODING:
  574 + default:
  575 + // AMF3 read message type
  576 + $message = $body->getData();
  577 + if ($message instanceof Zend_Amf_Value_Messaging_CommandMessage) {
  578 + // async call with command message
  579 + $return = $this->_loadCommandMessage($message);
  580 + } elseif ($message instanceof Zend_Amf_Value_Messaging_RemotingMessage) {
  581 + require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
  582 + $return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message);
  583 + $return->body = $this->_dispatch($message->operation, $message->body, $message->source);
  584 + } else {
  585 + // Amf3 message sent with netConnection
  586 + $targetURI = $body->getTargetURI();
  587 +
  588 + // Split the target string into its values.
  589 + $source = substr($targetURI, 0, strrpos($targetURI, '.'));
  590 +
  591 + if ($source) {
  592 + // Break off method name from namespace into source
  593 + $method = substr(strrchr($targetURI, '.'), 1);
  594 + $return = $this->_dispatch($method, $body->getData(), $source);
  595 + } else {
  596 + // Just have a method name.
  597 + $return = $this->_dispatch($targetURI, $body->getData());
  598 + }
  599 + }
  600 + break;
567 601 }
568 602 $responseType = Zend_AMF_Constants::RESULT_METHOD;
569 603 } catch (Exception $e) {
... ... @@ -607,7 +641,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
607 641 public function handle($request = null)
608 642 {
609 643 // Check if request was passed otherwise get it from the server
610   - if (is_null($request) || !$request instanceof Zend_Amf_Request) {
  644 + if ($request === null || !$request instanceof Zend_Amf_Request) {
611 645 $request = $this->getRequest();
612 646 } else {
613 647 $this->setRequest($request);
... ... @@ -930,4 +964,85 @@ class Zend_Amf_Server implements Zend_Server_Interface
930 964 {
931 965 return array_keys($this->_table);
932 966 }
  967 +
  968 + /**
  969 + * Cast parameters
  970 + *
  971 + * Takes the provided parameters from the request, and attempts to cast them
  972 + * to objects, if the prototype defines any as explicit object types
  973 + *
  974 + * @param Reflection $reflectionMethod
  975 + * @param array $params
  976 + * @return array
  977 + */
  978 + protected function _castParameters($reflectionMethod, array $params)
  979 + {
  980 + $prototypes = $reflectionMethod->getPrototypes();
  981 + $nonObjectTypes = array(
  982 + 'null',
  983 + 'mixed',
  984 + 'void',
  985 + 'unknown',
  986 + 'bool',
  987 + 'boolean',
  988 + 'number',
  989 + 'int',
  990 + 'integer',
  991 + 'double',
  992 + 'float',
  993 + 'string',
  994 + 'array',
  995 + 'object',
  996 + 'stdclass',
  997 + );
  998 + $types = array();
  999 + foreach ($prototypes as $prototype) {
  1000 + foreach ($prototype->getParameters() as $parameter) {
  1001 + $type = $parameter->getType();
  1002 + if (in_array(strtolower($type), $nonObjectTypes)) {
  1003 + continue;
  1004 + }
  1005 + $position = $parameter->getPosition();
  1006 + $types[$position] = $type;
  1007 + }
  1008 + }
  1009 +
  1010 + if (empty($types)) {
  1011 + return $params;
  1012 + }
  1013 +
  1014 + foreach ($params as $position => $value) {
  1015 + if (!isset($types[$position])) {
  1016 + // No specific type to cast to? done
  1017 + continue;
  1018 + }
  1019 +
  1020 + $type = $types[$position];
  1021 +
  1022 + if (!class_exists($type)) {
  1023 + // Not a class, apparently. done
  1024 + continue;
  1025 + }
  1026 +
  1027 + if ($value instanceof $type) {
  1028 + // Already of the right type? done
  1029 + continue;
  1030 + }
  1031 +
  1032 + if (!is_array($value) && !is_object($value)) {
  1033 + // Can't cast scalars to objects easily; done
  1034 + continue;
  1035 + }
  1036 +
  1037 + // Create instance, and loop through value to set
  1038 + $object = new $type;
  1039 + foreach ($value as $property => $defined) {
  1040 + $object->{$property} = $defined;
  1041 + }
  1042 +
  1043 + $params[$position] = $object;
  1044 + }
  1045 +
  1046 + return $params;
  1047 + }
933 1048 }
... ...
lib/Zend/Amf/Server/Exception.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Server
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** Zend_Amf_Exception */
... ... @@ -29,7 +29,7 @@ require_once &#39;Zend/Amf/Exception.php&#39;;
29 29 * @category Zend
30 30 * @package Zend_Amf
31 31 * @subpackage Server
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Amf_Server_Exception extends Zend_Amf_Exception
... ...
lib/Zend/Amf/Util/BinaryStream.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Util
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: BinaryStream.php 21210 2010-02-27 10:37:39Z yoshida@zend.co.jp $
  20 + * @version $Id: BinaryStream.php 25241 2013-01-22 11:07:36Z frosch $
21 21 */
22 22  
23 23 /**
... ... @@ -25,7 +25,7 @@
25 25 *
26 26 * @package Zend_Amf
27 27 * @subpackage Util
28   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  28 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29 29 * @license http://framework.zend.com/license/new-bsd New BSD License
30 30 */
31 31 class Zend_Amf_Util_BinaryStream
... ... @@ -51,6 +51,11 @@ class Zend_Amf_Util_BinaryStream
51 51 protected $_needle;
52 52  
53 53 /**
  54 + * @var bool str* functions overloaded using mbstring.func_overload?
  55 + */
  56 + protected $_mbStringFunctionsOverloaded;
  57 +
  58 + /**
54 59 * Constructor
55 60 *
56 61 * Create a reference to a byte stream that is going to be parsed or created
... ... @@ -69,7 +74,8 @@ class Zend_Amf_Util_BinaryStream
69 74  
70 75 $this->_stream = $stream;
71 76 $this->_needle = 0;
72   - $this->_streamLength = strlen($stream);
  77 + $this->_mbStringFunctionsOverloaded = function_exists('mb_strlen') && (ini_get('mbstring.func_overload') !== '') && ((int)ini_get('mbstring.func_overload') & 2);
  78 + $this->_streamLength = $this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream);
73 79 $this->_bigEndian = (pack('l', 1) === "\x00\x00\x00\x01");
74 80 }
75 81  
... ... @@ -97,7 +103,7 @@ class Zend_Amf_Util_BinaryStream
97 103 require_once 'Zend/Amf/Exception.php';
98 104 throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length);
99 105 }
100   - $bytes = substr($this->_stream, $this->_needle, $length);
  106 + $bytes = $this->_mbStringFunctionsOverloaded ? mb_substr($this->_stream, $this->_needle, $length, '8bit') : substr($this->_stream, $this->_needle, $length);
101 107 $this->_needle+= $length;
102 108 return $bytes;
103 109 }
... ... @@ -120,12 +126,18 @@ class Zend_Amf_Util_BinaryStream
120 126 * Reads a signed byte
121 127 *
122 128 * @return int Value is in the range of -128 to 127.
  129 + * @throws Zend_Amf_Exception
123 130 */
124 131 public function readByte()
125 132 {
126 133 if (($this->_needle + 1) > $this->_streamLength) {
127 134 require_once 'Zend/Amf/Exception.php';
128   - throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length);
  135 + throw new Zend_Amf_Exception(
  136 + 'Buffer underrun at needle position: '
  137 + . $this->_needle
  138 + . ' while requesting length: '
  139 + . $this->_streamLength
  140 + );
129 141 }
130 142  
131 143 return ord($this->_stream{$this->_needle++});
... ... @@ -184,7 +196,7 @@ class Zend_Amf_Util_BinaryStream
184 196 */
185 197 public function writeUtf($stream)
186 198 {
187   - $this->writeInt(strlen($stream));
  199 + $this->writeInt($this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream));
188 200 $this->_stream.= $stream;
189 201 return $this;
190 202 }
... ... @@ -209,7 +221,7 @@ class Zend_Amf_Util_BinaryStream
209 221 */
210 222 public function writeLongUtf($stream)
211 223 {
212   - $this->writeLong(strlen($stream));
  224 + $this->writeLong($this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream));
213 225 $this->_stream.= $stream;
214 226 }
215 227  
... ... @@ -255,7 +267,7 @@ class Zend_Amf_Util_BinaryStream
255 267 */
256 268 public function readDouble()
257 269 {
258   - $bytes = substr($this->_stream, $this->_needle, 8);
  270 + $bytes = $this->_mbStringFunctionsOverloaded ? mb_substr($this->_stream, $this->_needle, 8, '8bit') : substr($this->_stream, $this->_needle, 8);
259 271 $this->_needle+= 8;
260 272  
261 273 if (!$this->_bigEndian) {
... ...
lib/Zend/Amf/Value/ByteArray.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: ByteArray.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: ByteArray.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -25,7 +25,7 @@
25 25 *
26 26 * @package Zend_Amf
27 27 * @subpackage Value
28   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  28 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29 29 * @license http://framework.zend.com/license/new-bsd New BSD License
30 30 */
31 31 class Zend_Amf_Value_ByteArray
... ...
lib/Zend/Amf/Value/MessageBody.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: MessageBody.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: MessageBody.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@
33 33 *
34 34 * @package Zend_Amf
35 35 * @subpackage Value
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Amf_Value_MessageBody
... ...
lib/Zend/Amf/Value/MessageHeader.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: MessageHeader.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: MessageHeader.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -28,7 +28,7 @@
28 28 *
29 29 * @package Zend_Amf
30 30 * @subpackage Value
31   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32 32 * @license http://framework.zend.com/license/new-bsd New BSD License
33 33 */
34 34 class Zend_Amf_Value_MessageHeader
... ...
lib/Zend/Amf/Value/Messaging/AbstractMessage.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: AbstractMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: AbstractMessage.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -26,7 +26,7 @@
26 26 *
27 27 * @package Zend_Amf
28 28 * @subpackage Value
29   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30 30 * @license http://framework.zend.com/license/new-bsd New BSD License
31 31 */
32 32 class Zend_Amf_Value_Messaging_AbstractMessage
... ...
lib/Zend/Amf/Value/Messaging/AcknowledgeMessage.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: AcknowledgeMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: AcknowledgeMessage.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** Zend_Amf_Value_Messaging_AsyncMessage */
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Amf/Value/Messaging/AsyncMessage.php&#39;;
32 32 *
33 33 * @package Zend_Amf
34 34 * @subpackage Value
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Amf_Value_Messaging_AcknowledgeMessage extends Zend_Amf_Value_Messaging_AsyncMessage
... ...
lib/Zend/Amf/Value/Messaging/ArrayCollection.php
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: ArrayCollection.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: ArrayCollection.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -27,9 +27,9 @@
27 27 *
28 28 * @package Zend_Amf
29 29 * @subpackage Value
30   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  30 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31 31 * @license http://framework.zend.com/license/new-bsd New BSD License
32 32 */
33   -class Zend_Amf_Value_Messaging_ArrayCollection
  33 +class Zend_Amf_Value_Messaging_ArrayCollection extends ArrayObject
34 34 {
35 35 }
... ...
lib/Zend/Amf/Value/Messaging/AsyncMessage.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: AsyncMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: AsyncMessage.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -30,7 +30,7 @@ require_once &#39;Zend/Amf/Value/Messaging/AbstractMessage.php&#39;;
30 30 *
31 31 * @package Zend_Amf
32 32 * @subpackage Value
33   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34 34 * @license http://framework.zend.com/license/new-bsd New BSD License
35 35 */
36 36 class Zend_Amf_Value_Messaging_AsyncMessage extends Zend_Amf_Value_Messaging_AbstractMessage
... ...
lib/Zend/Amf/Value/Messaging/CommandMessage.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: CommandMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: CommandMessage.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -36,7 +36,7 @@ require_once &#39;Zend/Amf/Value/Messaging/AsyncMessage.php&#39;;
36 36 *
37 37 * @package Zend_Amf
38 38 * @subpackage Value
39   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  39 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
40 40 * @license http://framework.zend.com/license/new-bsd New BSD License
41 41 */
42 42 class Zend_Amf_Value_Messaging_CommandMessage extends Zend_Amf_Value_Messaging_AsyncMessage
... ...
lib/Zend/Amf/Value/Messaging/ErrorMessage.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: ErrorMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: ErrorMessage.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** @see Zend_Amf_Value_Messaging_AcknowledgeMessage */
... ... @@ -30,7 +30,7 @@ require_once &#39;Zend/Amf/Value/Messaging/AcknowledgeMessage.php&#39;;
30 30 *
31 31 * @package Zend_Amf
32 32 * @subpackage Value
33   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34 34 * @license http://framework.zend.com/license/new-bsd New BSD License
35 35 */
36 36 class Zend_Amf_Value_Messaging_ErrorMessage extends Zend_Amf_Value_Messaging_AcknowledgeMessage
... ...
lib/Zend/Amf/Value/Messaging/RemotingMessage.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: RemotingMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: RemotingMessage.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /** Zend_Amf_Value_Messaging_AbstractMessage */
... ... @@ -31,7 +31,7 @@ require_once &#39;Zend/Amf/Value/Messaging/AbstractMessage.php&#39;;
31 31 *
32 32 * @package Zend_Amf
33 33 * @subpackage Value
34   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  34 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35 35 * @license http://framework.zend.com/license/new-bsd New BSD License
36 36 */
37 37 class Zend_Amf_Value_Messaging_RemotingMessage extends Zend_Amf_Value_Messaging_AbstractMessage
... ...
lib/Zend/Amf/Value/TraitsInfo.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Amf
17 17 * @subpackage Value
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: TraitsInfo.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: TraitsInfo.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -25,7 +25,7 @@
25 25 *
26 26 * @package Zend_Amf
27 27 * @subpackage Value
28   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  28 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29 29 * @license http://framework.zend.com/license/new-bsd New BSD License
30 30 */
31 31 class Zend_Amf_Value_TraitsInfo
... ...
lib/Zend/Application.php 100755 → 100644
... ... @@ -14,15 +14,15 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Application
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Application.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Application.php 25024 2012-07-30 15:08:15Z rob $
20 20 */
21 21  
22 22 /**
23 23 * @category Zend
24 24 * @package Zend_Application
25   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  25 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26 26 * @license http://framework.zend.com/license/new-bsd New BSD License
27 27 */
28 28 class Zend_Application
... ... @@ -376,9 +376,12 @@ class Zend_Application
376 376 protected function _loadConfig($file)
377 377 {
378 378 $environment = $this->getEnvironment();
379   - $suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
  379 + $suffix = pathinfo($file, PATHINFO_EXTENSION);
  380 + $suffix = ($suffix === 'dist')
  381 + ? pathinfo(basename($file, ".$suffix"), PATHINFO_EXTENSION)
  382 + : $suffix;
380 383  
381   - switch ($suffix) {
  384 + switch (strtolower($suffix)) {
382 385 case 'ini':
383 386 $config = new Zend_Config_Ini($file, $environment);
384 387 break;
... ... @@ -387,6 +390,15 @@ class Zend_Application
387 390 $config = new Zend_Config_Xml($file, $environment);
388 391 break;
389 392  
  393 + case 'json':
  394 + $config = new Zend_Config_Json($file, $environment);
  395 + break;
  396 +
  397 + case 'yaml':
  398 + case 'yml':
  399 + $config = new Zend_Config_Yaml($file, $environment);
  400 + break;
  401 +
390 402 case 'php':
391 403 case 'inc':
392 404 $config = include $file;
... ...
lib/Zend/Application/Bootstrap/Bootstrap.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Bootstrap
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Bootstrap.php 20886 2010-02-03 19:36:06Z matthew $
  20 + * @version $Id: Bootstrap.php 25073 2012-11-06 19:31:53Z rob $
21 21 */
22 22  
23 23 /**
... ... @@ -29,7 +29,7 @@
29 29 * @category Zend
30 30 * @package Zend_Application
31 31 * @subpackage Bootstrap
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Application_Bootstrap_Bootstrap
... ... @@ -120,7 +120,7 @@ class Zend_Application_Bootstrap_Bootstrap
120 120 public function getResourceLoader()
121 121 {
122 122 if ((null === $this->_resourceLoader)
123   - && (false !== ($namespace = $this->getAppNamespace()))
  123 + && (false != ($namespace = $this->getAppNamespace()))
124 124 ) {
125 125 $r = new ReflectionClass($this);
126 126 $path = $r->getFileName();
... ...
lib/Zend/Application/Bootstrap/BootstrapAbstract.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Bootstrap
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: BootstrapAbstract.php 22125 2010-05-05 22:23:05Z hobodave $
  20 + * @version $Id: BootstrapAbstract.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -28,7 +28,7 @@
28 28 * @category Zend
29 29 * @package Zend_Application
30 30 * @subpackage Bootstrap
31   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32 32 * @license http://framework.zend.com/license/new-bsd New BSD License
33 33 */
34 34 abstract class Zend_Application_Bootstrap_BootstrapAbstract
... ... @@ -95,7 +95,7 @@ abstract class Zend_Application_Bootstrap_BootstrapAbstract
95 95 *
96 96 * @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application
97 97 * @return void
98   - * @throws Zend_Application_Bootstrap_Exception When invalid applicaiton is provided
  98 + * @throws Zend_Application_Bootstrap_Exception When invalid application is provided
99 99 */
100 100 public function __construct($application)
101 101 {
... ... @@ -163,7 +163,7 @@ abstract class Zend_Application_Bootstrap_BootstrapAbstract
163 163 */
164 164 public function hasOption($key)
165 165 {
166   - return in_array($key, $this->_optionKeys);
  166 + return in_array(strtolower($key), $this->_optionKeys);
167 167 }
168 168  
169 169 /**
... ... @@ -352,7 +352,9 @@ abstract class Zend_Application_Bootstrap_BootstrapAbstract
352 352 continue;
353 353 }
354 354  
355   - if (class_exists($plugin)) { //@SEE ZF-7550
  355 + if (class_exists($plugin)
  356 + && is_subclass_of($plugin, 'Zend_Application_Resource_Resource')
  357 + ) { //@SEE ZF-7550
356 358 $spec = (array) $spec;
357 359 $spec['bootstrap'] = $this;
358 360 $instance = new $plugin($spec);
... ... @@ -414,7 +416,8 @@ abstract class Zend_Application_Bootstrap_BootstrapAbstract
414 416 {
415 417 if ($this->_pluginLoader === null) {
416 418 $options = array(
417   - 'Zend_Application_Resource' => 'Zend/Application/Resource'
  419 + 'Zend_Application_Resource' => 'Zend/Application/Resource',
  420 + 'ZendX_Application_Resource' => 'ZendX/Application/Resource'
418 421 );
419 422  
420 423 $this->_pluginLoader = new Zend_Loader_PluginLoader($options);
... ...
lib/Zend/Application/Bootstrap/Bootstrapper.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Bootstrap
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Bootstrapper.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Bootstrapper.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -26,7 +26,7 @@
26 26 * @category Zend
27 27 * @package Zend_Application
28 28 * @subpackage Bootstrap
29   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30 30 * @license http://framework.zend.com/license/new-bsd New BSD License
31 31 */
32 32 interface Zend_Application_Bootstrap_Bootstrapper
... ...
lib/Zend/Application/Bootstrap/Exception.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Application
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /**
... ... @@ -30,7 +30,7 @@ require_once &#39;Zend/Application/Exception.php&#39;;
30 30 * @category Zend
31 31 * @package Zend_Application
32 32 * @uses Zend_Application_Exception
33   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34 34 * @license http://framework.zend.com/license/new-bsd New BSD License
35 35 */
36 36 class Zend_Application_Bootstrap_Exception extends Zend_Application_Exception
... ...
lib/Zend/Application/Bootstrap/ResourceBootstrapper.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Bootstrap
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: ResourceBootstrapper.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: ResourceBootstrapper.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -26,7 +26,7 @@
26 26 * @category Zend
27 27 * @package Zend_Application
28 28 * @subpackage Bootstrap
29   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30 30 * @license http://framework.zend.com/license/new-bsd New BSD License
31 31 */
32 32 interface Zend_Application_Bootstrap_ResourceBootstrapper
... ...
lib/Zend/Application/Exception.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Application
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Exception.php 25024 2012-07-30 15:08:15Z rob $
20 20 */
21 21  
22 22 /**
... ... @@ -30,7 +30,7 @@ require_once &#39;Zend/Exception.php&#39;;
30 30 * @uses Zend_Exception
31 31 * @category Zend
32 32 * @package Zend_Application
33   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34 34 * @license http://framework.zend.com/license/new-bsd New BSD License
35 35 */
36 36 class Zend_Application_Exception extends Zend_Exception
... ...
lib/Zend/Application/Module/Autoloader.php 100755 → 100644
... ... @@ -15,8 +15,8 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Module
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19   - * @version $Id: Autoloader.php 20250 2010-01-12 22:15:20Z dasprid $
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19 + * @version $Id: Autoloader.php 24593 2012-01-05 20:35:02Z matthew $
20 20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 21 */
22 22  
... ... @@ -30,7 +30,7 @@ require_once &#39;Zend/Loader/Autoloader/Resource.php&#39;;
30 30 * @category Zend
31 31 * @package Zend_Application
32 32 * @subpackage Module
33   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34 34 * @license http://framework.zend.com/license/new-bsd New BSD License
35 35 */
36 36 class Zend_Application_Module_Autoloader extends Zend_Loader_Autoloader_Resource
... ...
lib/Zend/Application/Module/Bootstrap.php 100755 → 100644
... ... @@ -15,8 +15,8 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Module
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19   - * @version $Id: Bootstrap.php 20096 2010-01-06 02:05:09Z bkarwin $
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19 + * @version $Id: Bootstrap.php 25024 2012-07-30 15:08:15Z rob $
20 20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 21 */
22 22  
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Bootstrap/Bootstrap.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Module
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 abstract class Zend_Application_Module_Bootstrap
... ... @@ -97,9 +97,9 @@ abstract class Zend_Application_Module_Bootstrap
97 97 /**
98 98 * Get default application namespace
99 99 *
100   - * Proxies to {@link getModuleName()}, and returns the current module
  100 + * Proxies to {@link getModuleName()}, and returns the current module
101 101 * name
102   - *
  102 + *
103 103 * @return string
104 104 */
105 105 public function getAppNamespace()
... ...
lib/Zend/Application/Resource/Cachemanager.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id$
  20 + * @version $Id: Cachemanager.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 require_once 'Zend/Application/Resource/ResourceAbstract.php';
... ... @@ -28,7 +28,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
28 28 * @category Zend
29 29 * @package Zend_Application
30 30 * @subpackage Resource
31   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32 32 * @license http://framework.zend.com/license/new-bsd New BSD License
33 33 */
34 34 class Zend_Application_Resource_Cachemanager extends Zend_Application_Resource_ResourceAbstract
... ... @@ -57,7 +57,7 @@ class Zend_Application_Resource_Cachemanager extends Zend_Application_Resource_R
57 57 {
58 58 if (null === $this->_manager) {
59 59 $this->_manager = new Zend_Cache_Manager;
60   -
  60 +
61 61 $options = $this->getOptions();
62 62 foreach ($options as $key => $value) {
63 63 if ($this->_manager->hasCacheTemplate($key)) {
... ... @@ -67,7 +67,7 @@ class Zend_Application_Resource_Cachemanager extends Zend_Application_Resource_R
67 67 }
68 68 }
69 69 }
70   -
  70 +
71 71 return $this->_manager;
72 72 }
73 73 }
... ...
lib/Zend/Application/Resource/Db.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Db.php 20816 2010-02-01 21:13:54Z freak $
  20 + * @version $Id: Db.php 25123 2012-11-14 18:27:44Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
32 32 * @category Zend
33 33 * @package Zend_Application
34 34 * @subpackage Resource
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbstract
... ... @@ -45,7 +45,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
45 45 protected $_adapter = null;
46 46  
47 47 /**
48   - * @var Zend_Db_Adapter_Interface
  48 + * @var Zend_Db_Adapter_Abstract
49 49 */
50 50 protected $_db;
51 51  
... ... @@ -66,7 +66,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
66 66 /**
67 67 * Set the adapter
68 68 *
69   - * @param $adapter string
  69 + * @param string $adapter
70 70 * @return Zend_Application_Resource_Db
71 71 */
72 72 public function setAdapter($adapter)
... ... @@ -88,7 +88,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
88 88 /**
89 89 * Set the adapter params
90 90 *
91   - * @param $adapter string
  91 + * @param string $adapter
92 92 * @return Zend_Application_Resource_Db
93 93 */
94 94 public function setParams(array $params)
... ... @@ -132,7 +132,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
132 132 /**
133 133 * Retrieve initialized DB connection
134 134 *
135   - * @return null|Zend_Db_Adapter_Interface
  135 + * @return null|Zend_Db_Adapter_Abstract
136 136 */
137 137 public function getDbAdapter()
138 138 {
... ... @@ -140,6 +140,12 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
140 140 && (null !== ($adapter = $this->getAdapter()))
141 141 ) {
142 142 $this->_db = Zend_Db::factory($adapter, $this->getParams());
  143 +
  144 + if ($this->_db instanceof Zend_Db_Adapter_Abstract
  145 + && $this->isDefaultTableAdapter()
  146 + ) {
  147 + Zend_Db_Table::setDefaultAdapter($this->_db);
  148 + }
143 149 }
144 150 return $this->_db;
145 151 }
... ... @@ -152,10 +158,39 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
152 158 public function init()
153 159 {
154 160 if (null !== ($db = $this->getDbAdapter())) {
155   - if ($this->isDefaultTableAdapter()) {
156   - Zend_Db_Table::setDefaultAdapter($db);
157   - }
158 161 return $db;
159 162 }
160 163 }
  164 +
  165 + /**
  166 + * Set the default metadata cache
  167 + *
  168 + * @param string|Zend_Cache_Core $cache
  169 + * @return Zend_Application_Resource_Db
  170 + */
  171 + public function setDefaultMetadataCache($cache)
  172 + {
  173 + $metadataCache = null;
  174 +
  175 + if (is_string($cache)) {
  176 + $bootstrap = $this->getBootstrap();
  177 + if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper
  178 + && $bootstrap->hasPluginResource('CacheManager')
  179 + ) {
  180 + $cacheManager = $bootstrap->bootstrap('CacheManager')
  181 + ->getResource('CacheManager');
  182 + if (null !== $cacheManager && $cacheManager->hasCache($cache)) {
  183 + $metadataCache = $cacheManager->getCache($cache);
  184 + }
  185 + }
  186 + } else if ($cache instanceof Zend_Cache_Core) {
  187 + $metadataCache = $cache;
  188 + }
  189 +
  190 + if ($metadataCache instanceof Zend_Cache_Core) {
  191 + Zend_Db_Table::setDefaultMetadataCache($metadataCache);
  192 + }
  193 +
  194 + return $this;
  195 + }
161 196 }
... ...
lib/Zend/Application/Resource/Dojo.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Layout.php 17687 2009-08-20 12:55:34Z thomas $
  20 + * @version $Id: Dojo.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Application_Resource_Dojo
... ...
lib/Zend/Application/Resource/Exception.php 100755 → 100644
... ... @@ -15,19 +15,24 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
  24 + * @see Zend_Application_Exception
  25 + */
  26 +require_once 'Zend/Application/Exception.php';
  27 +
  28 +/**
24 29 * Exception class for Zend_Application
25 30 *
26 31 * @uses Zend_Application_Exception
27 32 * @category Zend
28 33 * @package Zend_Application
29 34 * @subpackage Resource
30   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31 36 * @license http://framework.zend.com/license/new-bsd New BSD License
32 37 */
33 38 class Zend_Application_Resource_Exception extends Zend_Application_Exception
... ...
lib/Zend/Application/Resource/Frontcontroller.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Frontcontroller.php 20886 2010-02-03 19:36:06Z matthew $
  20 + * @version $Id: Frontcontroller.php 24798 2012-05-12 19:17:41Z adamlundrigan $
21 21 */
22 22  
23 23 /**
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
32 32 * @category Zend
33 33 * @package Zend_Application
34 34 * @subpackage Resource
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resource_ResourceAbstract
... ... @@ -68,7 +68,13 @@ class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resourc
68 68 break;
69 69  
70 70 case 'moduledirectory':
71   - $front->addModuleDirectory($value);
  71 + if (is_string($value)) {
  72 + $front->addModuleDirectory($value);
  73 + } elseif (is_array($value)) {
  74 + foreach($value as $moduleDir) {
  75 + $front->addModuleDirectory($moduleDir);
  76 + }
  77 + }
72 78 break;
73 79  
74 80 case 'defaultcontrollername':
... ... @@ -95,9 +101,9 @@ class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resourc
95 101  
96 102 case 'plugins':
97 103 foreach ((array) $value as $pluginClass) {
98   - $stackIndex = null;
99   - if(is_array($pluginClass)) {
100   - $pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
  104 + $stackIndex = null;
  105 + if(is_array($pluginClass)) {
  106 + $pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
101 107 if(isset($pluginClass['class']))
102 108 {
103 109 if(isset($pluginClass['stackindex'])) {
... ... @@ -129,6 +135,22 @@ class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resourc
129 135 }
130 136 break;
131 137  
  138 + case 'dispatcher':
  139 + if(!isset($value['class'])) {
  140 + require_once 'Zend/Application/Exception.php';
  141 + throw new Zend_Application_Exception('You must specify both ');
  142 + }
  143 + if (!isset($value['params'])) {
  144 + $value['params'] = array();
  145 + }
  146 +
  147 + $dispatchClass = $value['class'];
  148 + if(!class_exists($dispatchClass)) {
  149 + require_once 'Zend/Application/Exception.php';
  150 + throw new Zend_Application_Exception('Dispatcher class not found!');
  151 + }
  152 + $front->setDispatcher(new $dispatchClass((array)$value['params']));
  153 + break;
132 154 default:
133 155 $front->setParam($key, $value);
134 156 break;
... ...
lib/Zend/Application/Resource/Layout.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Layout.php 20816 2010-02-01 21:13:54Z freak $
  20 + * @version $Id: Layout.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Application_Resource_Layout
... ...
lib/Zend/Application/Resource/Locale.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Locale.php 20816 2010-02-01 21:13:54Z freak $
  20 + * @version $Id: Locale.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Application_Resource_Locale
... ... @@ -56,7 +56,6 @@ class Zend_Application_Resource_Locale
56 56 return $this->getLocale();
57 57 }
58 58  
59   -
60 59 /**
61 60 * Retrieve locale object
62 61 *
... ... @@ -66,7 +65,8 @@ class Zend_Application_Resource_Locale
66 65 {
67 66 if (null === $this->_locale) {
68 67 $options = $this->getOptions();
69   - if(!isset($options['default'])) {
  68 +
  69 + if (!isset($options['default'])) {
70 70 $this->_locale = new Zend_Locale();
71 71 } elseif(!isset($options['force']) ||
72 72 (bool) $options['force'] == false)
... ... @@ -86,4 +86,32 @@ class Zend_Application_Resource_Locale
86 86  
87 87 return $this->_locale;
88 88 }
  89 +
  90 + /**
  91 + * Set the cache
  92 + *
  93 + * @param string|Zend_Cache_Core $cache
  94 + * @return Zend_Application_Resource_Locale
  95 + */
  96 + public function setCache($cache)
  97 + {
  98 + if (is_string($cache)) {
  99 + $bootstrap = $this->getBootstrap();
  100 + if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper
  101 + && $bootstrap->hasPluginResource('CacheManager')
  102 + ) {
  103 + $cacheManager = $bootstrap->bootstrap('CacheManager')
  104 + ->getResource('CacheManager');
  105 + if (null !== $cacheManager && $cacheManager->hasCache($cache)) {
  106 + $cache = $cacheManager->getCache($cache);
  107 + }
  108 + }
  109 + }
  110 +
  111 + if ($cache instanceof Zend_Cache_Core) {
  112 + Zend_Locale::setCache($cache);
  113 + }
  114 +
  115 + return $this;
  116 + }
89 117 }
... ...
lib/Zend/Application/Resource/Log.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id$
  20 + * @version $Id: Log.php 24607 2012-01-16 16:45:49Z xerkus $
21 21 */
22 22  
23 23 /**
... ... @@ -27,13 +27,13 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
27 27  
28 28  
29 29 /**
30   - * Resource for initializing the locale
  30 + * Resource for initializing logger
31 31 *
32 32 * @uses Zend_Application_Resource_ResourceAbstract
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Application_Resource_Log
... ... @@ -56,8 +56,8 @@ class Zend_Application_Resource_Log
56 56  
57 57 /**
58 58 * Attach logger
59   - *
60   - * @param Zend_Log $log
  59 + *
  60 + * @param Zend_Log $log
61 61 * @return Zend_Application_Resource_Log
62 62 */
63 63 public function setLog(Zend_Log $log)
... ... @@ -66,6 +66,11 @@ class Zend_Application_Resource_Log
66 66 return $this;
67 67 }
68 68  
  69 + /**
  70 + * Retrieve logger object
  71 + *
  72 + * @return Zend_Log
  73 + */
69 74 public function getLog()
70 75 {
71 76 if (null === $this->_log) {
... ...
lib/Zend/Application/Resource/Mail.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Db.php 17687 2009-08-20 12:55:34Z thomas $
  20 + * @version $Id: Mail.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
32 32 * @category Zend
33 33 * @package Zend_Application
34 34 * @subpackage Resource
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceAbstract
... ... @@ -46,7 +46,7 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
46 46 public function init() {
47 47 return $this->getMail();
48 48 }
49   -
  49 +
50 50 /**
51 51 *
52 52 * @return Zend_Mail_Transport_Abstract|null
... ... @@ -56,7 +56,7 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
56 56 if (null === $this->_transport) {
57 57 $options = $this->getOptions();
58 58 foreach($options as $key => $option) {
59   - $options[strtolower($key)] = $option;
  59 + $options[strtolower($key)] = $option;
60 60 }
61 61 $this->setOptions($options);
62 62  
... ... @@ -73,14 +73,14 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
73 73 Zend_Mail::setDefaultTransport($this->_transport);
74 74 }
75 75 }
76   -
  76 +
77 77 $this->_setDefaults('from');
78 78 $this->_setDefaults('replyTo');
79 79 }
80 80  
81 81 return $this->_transport;
82 82 }
83   -
  83 +
84 84 protected function _setDefaults($type) {
85 85 $key = strtolower('default' . $type);
86 86 $options = $this->getOptions();
... ... @@ -99,13 +99,13 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
99 99 }
100 100 }
101 101 }
102   -
  102 +
103 103 protected function _setupTransport($options)
104 104 {
105   - if(!isset($options['type'])) {
106   - $options['type'] = 'sendmail';
107   - }
108   -
  105 + if(!isset($options['type'])) {
  106 + $options['type'] = 'sendmail';
  107 + }
  108 +
109 109 $transportName = $options['type'];
110 110 if(!Zend_Loader_Autoloader::autoload($transportName))
111 111 {
... ... @@ -122,9 +122,10 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
122 122 }
123 123 }
124 124 }
125   -
  125 +
126 126 unset($options['type']);
127   -
  127 + unset($options['register']); //@see ZF-11022
  128 +
128 129 switch($transportName) {
129 130 case 'Zend_Mail_Transport_Smtp':
130 131 if(!isset($options['host'])) {
... ... @@ -132,7 +133,7 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
132 133 'A host is necessary for smtp transport,'
133 134 .' but none was given');
134 135 }
135   -
  136 +
136 137 $transport = new $transportName($options['host'], $options);
137 138 break;
138 139 case 'Zend_Mail_Transport_Sendmail':
... ...
lib/Zend/Application/Resource/Modules.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Modules.php 20816 2010-02-01 21:13:54Z freak $
  20 + * @version $Id: Modules.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
32 32 * @category Zend
33 33 * @package Zend_Application
34 34 * @subpackage Resource
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 class Zend_Application_Resource_Modules extends Zend_Application_Resource_ResourceAbstract
... ... @@ -62,6 +62,7 @@ class Zend_Application_Resource_Modules extends Zend_Application_Resource_Resour
62 62 */
63 63 public function init()
64 64 {
  65 + $bootstraps = array();
65 66 $bootstrap = $this->getBootstrap();
66 67 $bootstrap->bootstrap('FrontController');
67 68 $front = $bootstrap->getResource('FrontController');
... ... @@ -103,12 +104,28 @@ class Zend_Application_Resource_Modules extends Zend_Application_Resource_Resour
103 104 continue;
104 105 }
105 106  
  107 + $bootstraps[$module] = $bootstrapClass;
  108 + }
  109 +
  110 + return $this->_bootstraps = $this->bootstrapBootstraps($bootstraps);
  111 + }
  112 +
  113 + /*
  114 + * Bootstraps the bootstraps found. Allows for easy extension.
  115 + * @param array $bootstraps Array containing the bootstraps to instantiate
  116 + */
  117 + protected function bootstrapBootstraps($bootstraps)
  118 + {
  119 + $bootstrap = $this->getBootstrap();
  120 + $out = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
  121 +
  122 + foreach($bootstraps as $module => $bootstrapClass) {
106 123 $moduleBootstrap = new $bootstrapClass($bootstrap);
107 124 $moduleBootstrap->bootstrap();
108   - $this->_bootstraps[$module] = $moduleBootstrap;
  125 + $out[$module] = $moduleBootstrap;
109 126 }
110 127  
111   - return $this->_bootstraps;
  128 + return $out;
112 129 }
113 130  
114 131 /**
... ...
lib/Zend/Application/Resource/Multidb.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id$
  20 + * @version $Id: Multidb.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 require_once 'Zend/Application/Resource/ResourceAbstract.php';
... ... @@ -32,6 +32,8 @@ require_once &#39;Zend/Db/Table.php&#39;;
32 32 *
33 33 * Example configuration:
34 34 * <pre>
  35 + * resources.multidb.defaultMetadataCache = "database"
  36 + *
35 37 * resources.multidb.db1.adapter = "pdo_mysql"
36 38 * resources.multidb.db1.host = "localhost"
37 39 * resources.multidb.db1.username = "webuser"
... ... @@ -49,7 +51,7 @@ require_once &#39;Zend/Db/Table.php&#39;;
49 51 * @category Zend
50 52 * @package Zend_Application
51 53 * @subpackage Resource
52   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  54 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
53 55 * @license http://framework.zend.com/license/new-bsd New BSD License
54 56 */
55 57 class Zend_Application_Resource_Multidb extends Zend_Application_Resource_ResourceAbstract
... ... @@ -77,8 +79,13 @@ class Zend_Application_Resource_Multidb extends Zend_Application_Resource_Resour
77 79 {
78 80 $options = $this->getOptions();
79 81  
  82 + if (isset($options['defaultMetadataCache'])) {
  83 + $this->_setDefaultMetadataCache($options['defaultMetadataCache']);
  84 + unset($options['defaultMetadataCache']);
  85 + }
  86 +
80 87 foreach ($options as $id => $params) {
81   - $adapter = $params['adapter'];
  88 + $adapter = $params['adapter'];
82 89 $default = (int) (
83 90 isset($params['isDefaultTableAdapter']) && $params['isDefaultTableAdapter']
84 91 || isset($params['default']) && $params['default']
... ... @@ -168,4 +175,36 @@ class Zend_Application_Resource_Multidb extends Zend_Application_Resource_Resour
168 175 Zend_Db_Table::setDefaultAdapter($adapter);
169 176 $this->_defaultDb = $adapter;
170 177 }
  178 +
  179 + /**
  180 + * Set the default metadata cache
  181 + *
  182 + * @param string|Zend_Cache_Core $cache
  183 + * @return Zend_Application_Resource_Multidb
  184 + */
  185 + protected function _setDefaultMetadataCache($cache)
  186 + {
  187 + $metadataCache = null;
  188 +
  189 + if (is_string($cache)) {
  190 + $bootstrap = $this->getBootstrap();
  191 + if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper &&
  192 + $bootstrap->hasPluginResource('CacheManager')
  193 + ) {
  194 + $cacheManager = $bootstrap->bootstrap('CacheManager')
  195 + ->getResource('CacheManager');
  196 + if (null !== $cacheManager && $cacheManager->hasCache($cache)) {
  197 + $metadataCache = $cacheManager->getCache($cache);
  198 + }
  199 + }
  200 + } else if ($cache instanceof Zend_Cache_Core) {
  201 + $metadataCache = $cache;
  202 + }
  203 +
  204 + if ($metadataCache instanceof Zend_Cache_Core) {
  205 + Zend_Db_Table::setDefaultMetadataCache($metadataCache);
  206 + }
  207 +
  208 + return $this;
  209 + }
171 210 }
... ...
lib/Zend/Application/Resource/Navigation.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Navigation.php 20816 2010-02-01 21:13:54Z freak $
  20 + * @version $Id: Navigation.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @author Dolf Schimmel
38 38 * @license http://framework.zend.com/license/new-bsd New BSD License
39 39 */
... ... @@ -56,6 +56,11 @@ class Zend_Application_Resource_Navigation
56 56 {
57 57 if (!$this->_container) {
58 58 $options = $this->getOptions();
  59 +
  60 + if(isset($options['defaultPageType'])) {
  61 + Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']);
  62 + }
  63 +
59 64 $pages = isset($options['pages']) ? $options['pages'] : array();
60 65 $this->_container = new Zend_Navigation($pages);
61 66 }
... ...
lib/Zend/Application/Resource/Resource.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Resource.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -26,7 +26,7 @@
26 26 * @category Zend
27 27 * @package Zend_Application
28 28 * @subpackage Resource
29   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30 30 * @license http://framework.zend.com/license/new-bsd New BSD License
31 31 */
32 32 interface Zend_Application_Resource_Resource
... ...
lib/Zend/Application/Resource/ResourceAbstract.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: ResourceAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: ResourceAbstract.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -32,7 +32,7 @@ require_once &#39;Zend/Application/Resource/Resource.php&#39;;
32 32 * @category Zend
33 33 * @package Zend_Application
34 34 * @subpackage Resource
35   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  35 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 36 * @license http://framework.zend.com/license/new-bsd New BSD License
37 37 */
38 38 abstract class Zend_Application_Resource_ResourceAbstract implements Zend_Application_Resource_Resource
... ... @@ -83,6 +83,11 @@ abstract class Zend_Application_Resource_ResourceAbstract implements Zend_Applic
83 83 */
84 84 public function setOptions(array $options)
85 85 {
  86 + if (array_key_exists('bootstrap', $options)) {
  87 + $this->setBootstrap($options['bootstrap']);
  88 + unset($options['bootstrap']);
  89 + }
  90 +
86 91 foreach ($options as $key => $value) {
87 92 if (in_array(strtolower($key), $this->_skipOptions)) {
88 93 continue;
... ... @@ -92,9 +97,6 @@ abstract class Zend_Application_Resource_ResourceAbstract implements Zend_Applic
92 97 if (method_exists($this, $method)) {
93 98 $this->$method($value);
94 99 }
95   - if ('bootstrap' === $key) {
96   - unset($options[$key]);
97   - }
98 100 }
99 101  
100 102 $this->_options = $this->mergeOptions($this->_options, $options);
... ...
lib/Zend/Application/Resource/Router.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Router.php 20816 2010-02-01 21:13:54Z freak $
  20 + * @version $Id: Router.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Application_Resource_Router
... ...
lib/Zend/Application/Resource/Session.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Session.php 20816 2010-02-01 21:13:54Z freak $
  20 + * @version $Id: Session.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Application_Resource_Session extends Zend_Application_Resource_ResourceAbstract
... ... @@ -50,7 +50,7 @@ class Zend_Application_Resource_Session extends Zend_Application_Resource_Resour
50 50 *
51 51 * @param array|string|Zend_Session_SaveHandler_Interface $saveHandler
52 52 * @return Zend_Application_Resource_Session
53   - * @throws Zend_Application_Resource_Exception When $saveHandler is no valid save handler
  53 + * @throws Zend_Application_Resource_Exception When $saveHandler is not a valid save handler
54 54 */
55 55 public function setSaveHandler($saveHandler)
56 56 {
... ...
lib/Zend/Application/Resource/Translate.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Translate.php 21770 2010-04-05 20:16:08Z thomas $
  20 + * @version $Id: Translate.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Application_Resource_Translate extends Zend_Application_Resource_ResourceAbstract
... ... @@ -67,9 +67,14 @@ class Zend_Application_Resource_Translate extends Zend_Application_Resource_Reso
67 67 if (null === $this->_translate) {
68 68 $options = $this->getOptions();
69 69  
70   - if (!isset($options['data'])) {
  70 + if (!isset($options['content']) && !isset($options['data'])) {
71 71 require_once 'Zend/Application/Resource/Exception.php';
72 72 throw new Zend_Application_Resource_Exception('No translation source data provided.');
  73 + } else if (array_key_exists('content', $options) && array_key_exists('data', $options)) {
  74 + require_once 'Zend/Application/Resource/Exception.php';
  75 + throw new Zend_Application_Resource_Exception(
  76 + 'Conflict on translation source data: choose only one key between content and data.'
  77 + );
73 78 }
74 79  
75 80 if (empty($options['adapter'])) {
... ... @@ -87,6 +92,21 @@ class Zend_Application_Resource_Translate extends Zend_Application_Resource_Reso
87 92 }
88 93 }
89 94  
  95 + if (!empty($options['cache']) && is_string($options['cache'])) {
  96 + $bootstrap = $this->getBootstrap();
  97 + if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper &&
  98 + $bootstrap->hasPluginResource('CacheManager')
  99 + ) {
  100 + $cacheManager = $bootstrap->bootstrap('CacheManager')
  101 + ->getResource('CacheManager');
  102 + if (null !== $cacheManager &&
  103 + $cacheManager->hasCache($options['cache'])
  104 + ) {
  105 + $options['cache'] = $cacheManager->getCache($options['cache']);
  106 + }
  107 + }
  108 + }
  109 +
90 110 $key = (isset($options['registry_key']) && !is_numeric($options['registry_key']))
91 111 ? $options['registry_key']
92 112 : self::DEFAULT_REGISTRY_KEY;
... ...
lib/Zend/Application/Resource/Useragent.php 0 → 100644
... ... @@ -0,0 +1,72 @@
  1 +<?php
  2 +/**
  3 + * Zend Framework
  4 + *
  5 + * LICENSE
  6 + *
  7 + * This source file is subject to the new BSD license that is bundled
  8 + * with this package in the file LICENSE.txt.
  9 + * It is also available through the world-wide-web at this URL:
  10 + * http://framework.zend.com/license/new-bsd
  11 + * If you did not receive a copy of the license and are unable to
  12 + * obtain it through the world-wide-web, please send an email
  13 + * to license@zend.com so we can send you a copy immediately.
  14 + *
  15 + * @category Zend
  16 + * @package Zend_Application
  17 + * @subpackage Resource
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19 + * @license http://framework.zend.com/license/new-bsd New BSD License
  20 + */
  21 +
  22 +/**
  23 + * @category Zend
  24 + * @package Zend_Application
  25 + * @subpackage Resource
  26 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  27 + * @license http://framework.zend.com/license/new-bsd New BSD License
  28 + */
  29 +class Zend_Application_Resource_UserAgent extends Zend_Application_Resource_ResourceAbstract
  30 +{
  31 + /**
  32 + * @var Zend_Http_UserAgent
  33 + */
  34 + protected $_userAgent;
  35 +
  36 + /**
  37 + * Intialize resource
  38 + *
  39 + * @return Zend_Http_UserAgent
  40 + */
  41 + public function init()
  42 + {
  43 + $userAgent = $this->getUserAgent();
  44 +
  45 + // Optionally seed the UserAgent view helper
  46 + $bootstrap = $this->getBootstrap();
  47 + if ($bootstrap->hasResource('view') || $bootstrap->hasPluginResource('view')) {
  48 + $bootstrap->bootstrap('view');
  49 + $view = $bootstrap->getResource('view');
  50 + if (null !== $view) {
  51 + $view->userAgent($userAgent);
  52 + }
  53 + }
  54 +
  55 + return $userAgent;
  56 + }
  57 +
  58 + /**
  59 + * Get UserAgent instance
  60 + *
  61 + * @return Zend_Http_UserAgent
  62 + */
  63 + public function getUserAgent()
  64 + {
  65 + if (null === $this->_userAgent) {
  66 + $options = $this->getOptions();
  67 + $this->_userAgent = new Zend_Http_UserAgent($options);
  68 + }
  69 +
  70 + return $this->_userAgent;
  71 + }
  72 +}
... ...
lib/Zend/Application/Resource/View.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Application
17 17 * @subpackage Resource
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: View.php 20816 2010-02-01 21:13:54Z freak $
  20 + * @version $Id: View.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Application/Resource/ResourceAbstract.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Application
35 35 * @subpackage Resource
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceAbstract
... ... @@ -52,9 +52,8 @@ class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceA
52 52 {
53 53 $view = $this->getView();
54 54  
55   - $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
  55 + $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
56 56 $viewRenderer->setView($view);
57   - Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
58 57 return $view;
59 58 }
60 59  
... ... @@ -69,8 +68,17 @@ class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceA
69 68 $options = $this->getOptions();
70 69 $this->_view = new Zend_View($options);
71 70  
72   - if(isset($options['doctype'])) {
  71 + if (isset($options['doctype'])) {
73 72 $this->_view->doctype()->setDoctype(strtoupper($options['doctype']));
  73 + if (isset($options['charset']) && $this->_view->doctype()->isHtml5()) {
  74 + $this->_view->headMeta()->setCharset($options['charset']);
  75 + }
  76 + }
  77 + if (isset($options['contentType'])) {
  78 + $this->_view->headMeta()->appendHttpEquiv('Content-Type', $options['contentType']);
  79 + }
  80 + if (isset($options['assign']) && is_array($options['assign'])) {
  81 + $this->_view->assign($options['assign']);
74 82 }
75 83 }
76 84 return $this->_view;
... ...
lib/Zend/Auth.php 100755 → 100644
... ... @@ -14,16 +14,16 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Auth
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Auth.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Auth.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
23 23 /**
24 24 * @category Zend
25 25 * @package Zend_Auth
26   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  26 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27 27 * @license http://framework.zend.com/license/new-bsd New BSD License
28 28 */
29 29 class Zend_Auth
... ...
lib/Zend/Auth/Adapter/DbTable.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Adapter
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: DbTable.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: DbTable.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -41,7 +41,7 @@ require_once &#39;Zend/Auth/Result.php&#39;;
41 41 * @category Zend
42 42 * @package Zend_Auth
43 43 * @subpackage Adapter
44   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  44 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
45 45 * @license http://framework.zend.com/license/new-bsd New BSD License
46 46 */
47 47 class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
... ... @@ -116,19 +116,28 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
116 116 protected $_resultRow = null;
117 117  
118 118 /**
  119 + * $_ambiguityIdentity - Flag to indicate same Identity can be used with
  120 + * different credentials. Default is FALSE and need to be set to true to
  121 + * allow ambiguity usage.
  122 + *
  123 + * @var boolean
  124 + */
  125 + protected $_ambiguityIdentity = false;
  126 +
  127 + /**
119 128 * __construct() - Sets configuration options
120 129 *
121   - * @param Zend_Db_Adapter_Abstract $zendDb
  130 + * @param Zend_Db_Adapter_Abstract $zendDb If null, default database adapter assumed
122 131 * @param string $tableName
123 132 * @param string $identityColumn
124 133 * @param string $credentialColumn
125 134 * @param string $credentialTreatment
126 135 * @return void
127 136 */
128   - public function __construct(Zend_Db_Adapter_Abstract $zendDb, $tableName = null, $identityColumn = null,
  137 + public function __construct(Zend_Db_Adapter_Abstract $zendDb = null, $tableName = null, $identityColumn = null,
129 138 $credentialColumn = null, $credentialTreatment = null)
130 139 {
131   - $this->_zendDb = $zendDb;
  140 + $this->_setDbAdapter($zendDb);
132 141  
133 142 if (null !== $tableName) {
134 143 $this->setTableName($tableName);
... ... @@ -148,6 +157,32 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
148 157 }
149 158  
150 159 /**
  160 + * _setDbAdapter() - set the database adapter to be used for quering
  161 + *
  162 + * @param Zend_Db_Adapter_Abstract
  163 + * @throws Zend_Auth_Adapter_Exception
  164 + * @return Zend_Auth_Adapter_DbTable
  165 + */
  166 + protected function _setDbAdapter(Zend_Db_Adapter_Abstract $zendDb = null)
  167 + {
  168 + $this->_zendDb = $zendDb;
  169 +
  170 + /**
  171 + * If no adapter is specified, fetch default database adapter.
  172 + */
  173 + if(null === $this->_zendDb) {
  174 + require_once 'Zend/Db/Table/Abstract.php';
  175 + $this->_zendDb = Zend_Db_Table_Abstract::getDefaultAdapter();
  176 + if (null === $this->_zendDb) {
  177 + require_once 'Zend/Auth/Adapter/Exception.php';
  178 + throw new Zend_Auth_Adapter_Exception('No database adapter present');
  179 + }
  180 + }
  181 +
  182 + return $this;
  183 + }
  184 +
  185 + /**
151 186 * setTableName() - set the table name to be used in the select query
152 187 *
153 188 * @param string $tableName
... ... @@ -232,6 +267,34 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
232 267 }
233 268  
234 269 /**
  270 + * setAmbiguityIdentity() - sets a flag for usage of identical identities
  271 + * with unique credentials. It accepts integers (0, 1) or boolean (true,
  272 + * false) parameters. Default is false.
  273 + *
  274 + * @param int|bool $flag
  275 + * @return Zend_Auth_Adapter_DbTable
  276 + */
  277 + public function setAmbiguityIdentity($flag)
  278 + {
  279 + if (is_integer($flag)) {
  280 + $this->_ambiguityIdentity = (1 === $flag ? true : false);
  281 + } elseif (is_bool($flag)) {
  282 + $this->_ambiguityIdentity = $flag;
  283 + }
  284 + return $this;
  285 + }
  286 + /**
  287 + * getAmbiguityIdentity() - returns TRUE for usage of multiple identical
  288 + * identies with different credentials, FALSE if not used.
  289 + *
  290 + * @return bool
  291 + */
  292 + public function getAmbiguityIdentity()
  293 + {
  294 + return $this->_ambiguityIdentity;
  295 + }
  296 +
  297 + /**
235 298 * getDbSelect() - Return the preauthentication Db Select object for userland select query modification
236 299 *
237 300 * @return Zend_Db_Select
... ... @@ -305,10 +368,21 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
305 368 $dbSelect = $this->_authenticateCreateSelect();
306 369 $resultIdentities = $this->_authenticateQuerySelect($dbSelect);
307 370  
308   - if ( ($authResult = $this->_authenticateValidateResultset($resultIdentities)) instanceof Zend_Auth_Result) {
  371 + if ( ($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof Zend_Auth_Result) {
309 372 return $authResult;
310 373 }
311 374  
  375 + if (true === $this->getAmbiguityIdentity()) {
  376 + $validIdentities = array ();
  377 + $zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match');
  378 + foreach ($resultIdentities as $identity) {
  379 + if (1 === (int) $identity[$zendAuthCredentialMatchColumn]) {
  380 + $validIdentities[] = $identity;
  381 + }
  382 + }
  383 + $resultIdentities = $validIdentities;
  384 + }
  385 +
312 386 $authResult = $this->_authenticateValidateResult(array_shift($resultIdentities));
313 387 return $authResult;
314 388 }
... ... @@ -403,7 +477,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
403 477 $origDbFetchMode = $this->_zendDb->getFetchMode();
404 478 $this->_zendDb->setFetchMode(Zend_DB::FETCH_ASSOC);
405 479 }
406   - $resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString());
  480 + $resultIdentities = $this->_zendDb->fetchAll($dbSelect);
407 481 if (isset($origDbFetchMode)) {
408 482 $this->_zendDb->setFetchMode($origDbFetchMode);
409 483 unset($origDbFetchMode);
... ... @@ -434,7 +508,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
434 508 $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
435 509 $this->_authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.';
436 510 return $this->_authenticateCreateAuthResult();
437   - } elseif (count($resultIdentities) > 1) {
  511 + } elseif (count($resultIdentities) > 1 && false === $this->getAmbiguityIdentity()) {
438 512 $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS;
439 513 $this->_authenticateResultInfo['messages'][] = 'More than one record matches the supplied identity.';
440 514 return $this->_authenticateCreateAuthResult();
... ...
lib/Zend/Auth/Adapter/Digest.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Adapter
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Digest.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Digest.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -31,7 +31,7 @@ require_once &#39;Zend/Auth/Adapter/Interface.php&#39;;
31 31 * @category Zend
32 32 * @package Zend_Auth
33 33 * @subpackage Adapter
34   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  34 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35 35 * @license http://framework.zend.com/license/new-bsd New BSD License
36 36 */
37 37 class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
... ... @@ -213,7 +213,7 @@ class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
213 213  
214 214 while ($line = trim(fgets($fileHandle))) {
215 215 if (substr($line, 0, $idLength) === $id) {
216   - if (substr($line, -32) === md5("$this->_username:$this->_realm:$this->_password")) {
  216 + if ($this->_secureStringCompare(substr($line, -32), md5("$this->_username:$this->_realm:$this->_password"))) {
217 217 $result['code'] = Zend_Auth_Result::SUCCESS;
218 218 } else {
219 219 $result['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
... ... @@ -227,4 +227,26 @@ class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
227 227 $result['messages'][] = "Username '$this->_username' and realm '$this->_realm' combination not found";
228 228 return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
229 229 }
  230 +
  231 + /**
  232 + * Securely compare two strings for equality while avoided C level memcmp()
  233 + * optimisations capable of leaking timing information useful to an attacker
  234 + * attempting to iteratively guess the unknown string (e.g. password) being
  235 + * compared against.
  236 + *
  237 + * @param string $a
  238 + * @param string $b
  239 + * @return bool
  240 + */
  241 + protected function _secureStringCompare($a, $b)
  242 + {
  243 + if (strlen($a) !== strlen($b)) {
  244 + return false;
  245 + }
  246 + $result = 0;
  247 + for ($i = 0; $i < strlen($a); $i++) {
  248 + $result |= ord($a[$i]) ^ ord($b[$i]);
  249 + }
  250 + return $result == 0;
  251 + }
230 252 }
... ...
lib/Zend/Auth/Adapter/Exception.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Adapter
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -31,7 +31,7 @@ require_once &#39;Zend/Auth/Exception.php&#39;;
31 31 * @category Zend
32 32 * @package Zend_Auth
33 33 * @subpackage Adapter
34   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  34 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35 35 * @license http://framework.zend.com/license/new-bsd New BSD License
36 36 */
37 37 class Zend_Auth_Adapter_Exception extends Zend_Auth_Exception
... ...
lib/Zend/Auth/Adapter/Http.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Zend_Auth_Adapter_Http
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -35,7 +35,7 @@ require_once &#39;Zend/Auth/Adapter/Interface.php&#39;;
35 35 * @category Zend
36 36 * @package Zend_Auth
37 37 * @subpackage Zend_Auth_Adapter_Http
38   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  38 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39 39 * @license http://framework.zend.com/license/new-bsd New BSD License
40 40 * @todo Support auth-int
41 41 * @todo Track nonces, nonce-count, opaque for replay protection and stale support
... ... @@ -538,7 +538,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
538 538 }
539 539  
540 540 $password = $this->_basicResolver->resolve($creds[0], $this->_realm);
541   - if ($password && $password == $creds[1]) {
  541 + if ($password && $this->_secureStringCompare($password, $creds[1])) {
542 542 $identity = array('username'=>$creds[0], 'realm'=>$this->_realm);
543 543 return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
544 544 } else {
... ... @@ -640,7 +640,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
640 640  
641 641 // If our digest matches the client's let them in, otherwise return
642 642 // a 401 code and exit to prevent access to the protected resource.
643   - if ($digest == $data['response']) {
  643 + if ($this->_secureStringCompare($digest, $data['response'])) {
644 644 $identity = array('username'=>$data['username'], 'realm'=>$data['realm']);
645 645 return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
646 646 } else {
... ... @@ -844,4 +844,26 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
844 844  
845 845 return $data;
846 846 }
  847 +
  848 + /**
  849 + * Securely compare two strings for equality while avoided C level memcmp()
  850 + * optimisations capable of leaking timing information useful to an attacker
  851 + * attempting to iteratively guess the unknown string (e.g. password) being
  852 + * compared against.
  853 + *
  854 + * @param string $a
  855 + * @param string $b
  856 + * @return bool
  857 + */
  858 + protected function _secureStringCompare($a, $b)
  859 + {
  860 + if (strlen($a) !== strlen($b)) {
  861 + return false;
  862 + }
  863 + $result = 0;
  864 + for ($i = 0; $i < strlen($a); $i++) {
  865 + $result |= ord($a[$i]) ^ ord($b[$i]);
  866 + }
  867 + return $result == 0;
  868 + }
847 869 }
... ...
lib/Zend/Auth/Adapter/Http/Resolver/Exception.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Zend_Auth_Adapter_Http
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Auth/Exception.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Auth
35 35 * @subpackage Zend_Auth_Adapter_Http
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Auth_Adapter_Http_Resolver_Exception extends Zend_Auth_Exception
... ...
lib/Zend/Auth/Adapter/Http/Resolver/File.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Zend_Auth_Adapter_Http
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -33,7 +33,7 @@ require_once &#39;Zend/Auth/Adapter/Http/Resolver/Interface.php&#39;;
33 33 * @category Zend
34 34 * @package Zend_Auth
35 35 * @subpackage Zend_Auth_Adapter_Http
36   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 38 */
39 39 class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Resolver_Interface
... ...
lib/Zend/Auth/Adapter/Http/Resolver/Interface.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Zend_Auth_Adapter_Http
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -30,7 +30,7 @@
30 30 * @category Zend
31 31 * @package Zend_Auth
32 32 * @subpackage Zend_Auth_Adapter_Http
33   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  33 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34 34 * @license http://framework.zend.com/license/new-bsd New BSD License
35 35 */
36 36 interface Zend_Auth_Adapter_Http_Resolver_Interface
... ...
lib/Zend/Auth/Adapter/InfoCard.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Zend_Auth_Adapter
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: InfoCard.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: InfoCard.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -42,7 +42,7 @@ require_once &#39;Zend/InfoCard.php&#39;;
42 42 * @category Zend
43 43 * @package Zend_Auth
44 44 * @subpackage Zend_Auth_Adapter
45   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  45 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
46 46 * @license http://framework.zend.com/license/new-bsd New BSD License
47 47 */
48 48 class Zend_Auth_Adapter_InfoCard implements Zend_Auth_Adapter_Interface
... ...
lib/Zend/Auth/Adapter/Interface.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Zend_Auth_Adapter
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -31,7 +31,7 @@ require_once &#39;Zend/Auth/Result.php&#39;;
31 31 * @category Zend
32 32 * @package Zend_Auth
33 33 * @subpackage Zend_Auth_Adapter
34   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  34 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35 35 * @license http://framework.zend.com/license/new-bsd New BSD License
36 36 */
37 37 interface Zend_Auth_Adapter_Interface
... ...
lib/Zend/Auth/Adapter/Ldap.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Zend_Auth_Adapter
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Ldap.php 21320 2010-03-04 16:05:09Z sgehrig $
  20 + * @version $Id: Ldap.php 24618 2012-02-03 08:32:06Z sgehrig $
21 21 */
22 22  
23 23 /**
... ... @@ -29,7 +29,7 @@ require_once &#39;Zend/Auth/Adapter/Interface.php&#39;;
29 29 * @category Zend
30 30 * @package Zend_Auth
31 31 * @subpackage Zend_Auth_Adapter
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
... ... @@ -335,8 +335,8 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
335 335 $messages[1] = '';
336 336 $messages[] = "$canonicalName authentication successful";
337 337 if ($requireRebind === true) {
338   - // rebinding with authenticated user
339   - $ldap->bind($dn, $password);
  338 + // rebinding with authenticated user
  339 + $ldap->bind($dn, $password);
340 340 }
341 341 return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $canonicalName, $messages);
342 342 } else {
... ... @@ -371,7 +371,11 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
371 371 } else {
372 372 $line = $zle->getLine();
373 373 $messages[] = $zle->getFile() . "($line): " . $zle->getMessage();
374   - $messages[] = str_replace($password, '*****', $zle->getTraceAsString());
  374 + $messages[] = preg_replace(
  375 + '/\b'.preg_quote(substr($password, 0, 15), '/').'\b/',
  376 + '*****',
  377 + $zle->getTraceAsString()
  378 + );
375 379 $messages[0] = 'An unexpected failure occurred';
376 380 }
377 381 $messages[1] = $zle->getMessage();
... ... @@ -488,7 +492,9 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
488 492  
489 493 $returnObject = new stdClass();
490 494  
491   - $omitAttribs = array_map('strtolower', $omitAttribs);
  495 + $returnAttribs = array_map('strtolower', $returnAttribs);
  496 + $omitAttribs = array_map('strtolower', $omitAttribs);
  497 + $returnAttribs = array_diff($returnAttribs, $omitAttribs);
492 498  
493 499 $entry = $this->getLdap()->getEntry($this->_authenticatedDn, $returnAttribs, true);
494 500 foreach ($entry as $attr => $value) {
... ...
lib/Zend/Auth/Adapter/OpenId.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Zend_Auth_Adapter
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: OpenId.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: OpenId.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -40,7 +40,7 @@ require_once &#39;Zend/OpenId/Consumer.php&#39;;
40 40 * @category Zend
41 41 * @package Zend_Auth
42 42 * @subpackage Zend_Auth_Adapter
43   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  43 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
44 44 * @license http://framework.zend.com/license/new-bsd New BSD License
45 45 */
46 46 class Zend_Auth_Adapter_OpenId implements Zend_Auth_Adapter_Interface
... ...
lib/Zend/Auth/Exception.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Auth
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
... ... @@ -29,7 +29,7 @@ require_once &#39;Zend/Exception.php&#39;;
29 29 /**
30 30 * @category Zend
31 31 * @package Zend_Auth
32   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33 33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 34 */
35 35 class Zend_Auth_Exception extends Zend_Exception
... ...
lib/Zend/Auth/Result.php 100755 → 100644
... ... @@ -14,16 +14,16 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Auth
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Result.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Result.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22  
23 23 /**
24 24 * @category Zend
25 25 * @package Zend_Auth
26   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  26 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27 27 * @license http://framework.zend.com/license/new-bsd New BSD License
28 28 */
29 29 class Zend_Auth_Result
... ...
lib/Zend/Auth/Storage/Exception.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Storage
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -31,7 +31,7 @@ require_once &#39;Zend/Auth/Exception.php&#39;;
31 31 * @category Zend
32 32 * @package Zend_Auth
33 33 * @subpackage Storage
34   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  34 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35 35 * @license http://framework.zend.com/license/new-bsd New BSD License
36 36 */
37 37 class Zend_Auth_Storage_Exception extends Zend_Auth_Exception
... ...
lib/Zend/Auth/Storage/Interface.php 100755 → 100644
... ... @@ -15,16 +15,16 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Storage
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
24 24 * @category Zend
25 25 * @package Zend_Auth
26 26 * @subpackage Storage
27   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  27 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28 28 * @license http://framework.zend.com/license/new-bsd New BSD License
29 29 */
30 30 interface Zend_Auth_Storage_Interface
... ...
lib/Zend/Auth/Storage/NonPersistent.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Storage
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: NonPersistent.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: NonPersistent.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -37,7 +37,7 @@ require_once &#39;Zend/Auth/Storage/Interface.php&#39;;
37 37 * @category Zend
38 38 * @package Zend_Auth
39 39 * @subpackage Storage
40   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  40 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41 41 * @license http://framework.zend.com/license/new-bsd New BSD License
42 42 */
43 43 class Zend_Auth_Storage_NonPersistent implements Zend_Auth_Storage_Interface
... ...
lib/Zend/Auth/Storage/Session.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Auth
17 17 * @subpackage Storage
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Session.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Session.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23  
... ... @@ -37,7 +37,7 @@ require_once &#39;Zend/Session.php&#39;;
37 37 * @category Zend
38 38 * @package Zend_Auth
39 39 * @subpackage Storage
40   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  40 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41 41 * @license http://framework.zend.com/license/new-bsd New BSD License
42 42 */
43 43 class Zend_Auth_Storage_Session implements Zend_Auth_Storage_Interface
... ...
lib/Zend/Barcode.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Barcode
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Barcode.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Barcode.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21  
22 22 /**
... ... @@ -24,7 +24,7 @@
24 24 *
25 25 * @category Zend
26 26 * @package Zend_Barcode
27   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  27 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28 28 * @license http://framework.zend.com/license/new-bsd New BSD License
29 29 */
30 30 class Zend_Barcode
... ... @@ -55,10 +55,10 @@ class Zend_Barcode
55 55 * @throws Zend_Barcode_Exception
56 56 */
57 57 public static function factory(
58   - $barcode,
59   - $renderer = 'image',
60   - $barcodeConfig = array(),
61   - $rendererConfig = array(),
  58 + $barcode,
  59 + $renderer = 'image',
  60 + $barcodeConfig = array(),
  61 + $rendererConfig = array(),
62 62 $automaticRenderError = true
63 63 ) {
64 64 /*
... ... @@ -313,9 +313,9 @@ class Zend_Barcode
313 313 * @param array | Zend_Config $rendererConfig
314 314 */
315 315 public static function render(
316   - $barcode,
317   - $renderer,
318   - $barcodeConfig = array(),
  316 + $barcode,
  317 + $renderer,
  318 + $barcodeConfig = array(),
319 319 $rendererConfig = array()
320 320 ) {
321 321 self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->render();
... ... @@ -331,9 +331,9 @@ class Zend_Barcode
331 331 * @return mixed
332 332 */
333 333 public static function draw(
334   - $barcode,
335   - $renderer,
336   - $barcodeConfig = array(),
  334 + $barcode,
  335 + $renderer,
  336 + $barcodeConfig = array(),
337 337 $rendererConfig = array()
338 338 ) {
339 339 return self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->draw();
... ...
lib/Zend/Barcode/Exception.php 100755 → 100644
... ... @@ -14,9 +14,9 @@
14 14 *
15 15 * @category Zend
16 16 * @package Zend_Barcode
17   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  17 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18 18 * @license http://framework.zend.com/license/new-bsd New BSD License
19   - * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
  19 + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20 20 */
21 21 /**
22 22 * Zend_Exception
... ... @@ -28,7 +28,7 @@ require_once &#39;Zend/Exception.php&#39;;
28 28 *
29 29 * @category Zend
30 30 * @package Zend_Barcode
31   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  31 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32 32 * @license http://framework.zend.com/license/new-bsd New BSD License
33 33 */
34 34 class Zend_Barcode_Exception extends Zend_Exception
... ... @@ -41,8 +41,8 @@ class Zend_Barcode_Exception extends Zend_Exception
41 41  
42 42 /**
43 43 * Set renderable flag
44   - *
45   - * @param bool $flag
  44 + *
  45 + * @param bool $flag
46 46 * @return Zend_Barcode_Exception
47 47 */
48 48 public function setIsRenderable($flag)
... ... @@ -53,7 +53,7 @@ class Zend_Barcode_Exception extends Zend_Exception
53 53  
54 54 /**
55 55 * Retrieve renderable flag
56   - *
  56 + *
57 57 * @return bool
58 58 */
59 59 public function isRenderable()
... ...
lib/Zend/Barcode/Object/Code128.php 0 → 100644
... ... @@ -0,0 +1,391 @@
  1 +<?php
  2 +/**
  3 + * Zend Framework
  4 + *
  5 + * LICENSE
  6 + *
  7 + * This source file is subject to the new BSD license that is bundled
  8 + * with this package in the file LICENSE.txt.
  9 + * It is also available through the world-wide-web at this URL:
  10 + * http://framework.zend.com/license/new-bsd
  11 + * If you did not receive a copy of the license and are unable to
  12 + * obtain it through the world-wide-web, please send an email
  13 + * to license@zend.com so we can send you a copy immediately.
  14 + *
  15 + * @category Zend
  16 + * @package Zend_Barcode
  17 + * @subpackage Object
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19 + * @license http://framework.zend.com/license/new-bsd New BSD License
  20 + * @version $Id: Code25.php 20096 2010-01-06 02:05:09Z bkarwin $
  21 + */
  22 +
  23 +/**
  24 + * @see Zend_Barcode_Object_ObjectAbstract
  25 + */
  26 +require_once 'Zend/Barcode/Object/ObjectAbstract.php';
  27 +
  28 +/**
  29 + * @see Zend_Validate_Barcode
  30 + */
  31 +require_once 'Zend/Validate/Barcode.php';
  32 +
  33 +/**
  34 + * Class for generate Code128 barcode
  35 + *
  36 + * @category Zend
  37 + * @package Zend_Barcode
  38 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  39 + * @license http://framework.zend.com/license/new-bsd New BSD License
  40 + */
  41 +class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
  42 +{
  43 + /**
  44 + * Drawing of checksum
  45 + * (even if it's sometime optional, most of time it's required)
  46 + * @var boolean
  47 + */
  48 + protected $_withChecksum = true;
  49 +
  50 + /**
  51 + * @var array
  52 + */
  53 + protected $_convertedText = array();
  54 +
  55 + protected $_codingMap = array(
  56 + 0 => "11011001100", 1 => "11001101100", 2 => "11001100110",
  57 + 3 => "10010011000", 4 => "10010001100", 5 => "10001001100",
  58 + 6 => "10011001000", 7 => "10011000100", 8 => "10001100100",
  59 + 9 => "11001001000", 10 => "11001000100", 11 => "11000100100",
  60 + 12 => "10110011100", 13 => "10011011100", 14 => "10011001110",
  61 + 15 => "10111001100", 16 => "10011101100", 17 => "10011100110",
  62 + 18 => "11001110010", 19 => "11001011100", 20 => "11001001110",
  63 + 21 => "11011100100", 22 => "11001110100", 23 => "11101101110",
  64 + 24 => "11101001100", 25 => "11100101100", 26 => "11100100110",
  65 + 27 => "11101100100", 28 => "11100110100", 29 => "11100110010",
  66 + 30 => "11011011000", 31 => "11011000110", 32 => "11000110110",
  67 + 33 => "10100011000", 34 => "10001011000", 35 => "10001000110",
  68 + 36 => "10110001000", 37 => "10001101000", 38 => "10001100010",
  69 + 39 => "11010001000", 40 => "11000101000", 41 => "11000100010",
  70 + 42 => "10110111000", 43 => "10110001110", 44 => "10001101110",
  71 + 45 => "10111011000", 46 => "10111000110", 47 => "10001110110",
  72 + 48 => "11101110110", 49 => "11010001110", 50 => "11000101110",
  73 + 51 => "11011101000", 52 => "11011100010", 53 => "11011101110",
  74 + 54 => "11101011000", 55 => "11101000110", 56 => "11100010110",
  75 + 57 => "11101101000", 58 => "11101100010", 59 => "11100011010",
  76 + 60 => "11101111010", 61 => "11001000010", 62 => "11110001010",
  77 + 63 => "10100110000", 64 => "10100001100", 65 => "10010110000",
  78 + 66 => "10010000110", 67 => "10000101100", 68 => "10000100110",
  79 + 69 => "10110010000", 70 => "10110000100", 71 => "10011010000",
  80 + 72 => "10011000010", 73 => "10000110100", 74 => "10000110010",
  81 + 75 => "11000010010", 76 => "11001010000", 77 => "11110111010",
  82 + 78 => "11000010100", 79 => "10001111010", 80 => "10100111100",
  83 + 81 => "10010111100", 82 => "10010011110", 83 => "10111100100",
  84 + 84 => "10011110100", 85 => "10011110010", 86 => "11110100100",
  85 + 87 => "11110010100", 88 => "11110010010", 89 => "11011011110",
  86 + 90 => "11011110110", 91 => "11110110110", 92 => "10101111000",
  87 + 93 => "10100011110", 94 => "10001011110", 95 => "10111101000",
  88 + 96 => "10111100010", 97 => "11110101000", 98 => "11110100010",
  89 + 99 => "10111011110", 100 => "10111101110", 101 => "11101011110",
  90 + 102 => "11110101110",
  91 + 103 => "11010000100", 104 => "11010010000", 105 => "11010011100",
  92 + 106 => "1100011101011");
  93 +
  94 + /**
  95 + * Character sets ABC
  96 + * @var array
  97 + */
  98 + protected $_charSets = array(
  99 + 'A' => array(
  100 + ' ', '!', '"', '#', '$', '%', '&', "'",
  101 + '(', ')', '*', '+', ',', '-', '.', '/',
  102 + '0', '1', '2', '3', '4', '5', '6', '7',
  103 + '8', '9', ':', ';', '<', '=', '>', '?',
  104 + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
  105 + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
  106 + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
  107 + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
  108 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  109 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
  110 + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
  111 + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
  112 + 'FNC3', 'FNC2', 'SHIFT', 'Code C', 'Code B', 'FNC4', 'FNC1',
  113 + 'START A', 'START B', 'START C', 'STOP'),
  114 + 'B' => array(
  115 + ' ', '!', '"', '#', '$', '%', '&', "'",
  116 + '(', ')', '*', '+', ',', '-', '.', '/',
  117 + '0', '1', '2', '3', '4', '5', '6', '7',
  118 + '8', '9', ':', ';', '<', '=', '>', '?',
  119 + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
  120 + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
  121 + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
  122 + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
  123 + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
  124 + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
  125 + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
  126 + 'x', 'y', 'z', '{', '|', '}', '~', 0x7F,
  127 + 'FNC3', 'FNC2', 'SHIFT', 'Code C', 'FNC4', 'Code A', 'FNC1',
  128 + 'START A', 'START B', 'START C', 'STOP',),
  129 + 'C' => array(
  130 + '00', '01', '02', '03', '04', '05', '06', '07', '08', '09',
  131 + '10', '11', '12', '13', '14', '15', '16', '17', '18', '19',
  132 + '20', '21', '22', '23', '24', '25', '26', '27', '28', '29',
  133 + '30', '31', '32', '33', '34', '35', '36', '37', '38', '39',
  134 + '40', '41', '42', '43', '44', '45', '46', '47', '48', '49',
  135 + '50', '51', '52', '53', '54', '55', '56', '57', '58', '59',
  136 + '60', '61', '62', '63', '64', '65', '66', '67', '68', '69',
  137 + '70', '71', '72', '73', '74', '75', '76', '77', '78', '79',
  138 + '80', '81', '82', '83', '84', '85', '86', '87', '88', '89',
  139 + '90', '91', '92', '93', '94', '95', '96', '97', '98', '99',
  140 + 'Code B', 'Code A', 'FNC1', 'START A', 'START B', 'START C', 'STOP'));
  141 + /*'A' => array(
  142 + ' '=>0, '!'=>1, '"'=>2, '#'=>3, '$'=>4, '%'=>5, '&'=>6, "'"=>7,
  143 + '('=>8, ')'=>9, '*'=>10, '+'=>11, ','=>12, '-'=>13, '.'=>14, '/'=>15,
  144 + '0'=>16, '1'=>17, '2'=>18, '3'=>19, '4'=>20, '5'=>21, '6'=>22, '7'=>23,
  145 + '8'=>24, '9'=>25, ':'=>26, ';'=>27, '<'=>28, '='=>29, '>'=>30, '?'=>31,
  146 + '@'=>32, 'A'=>33, 'B'=>34, 'C'=>35, 'D'=>36, 'E'=>37, 'F'=>38, 'G'=>39,
  147 + 'H'=>40, 'I'=>41, 'J'=>42, 'K'=>43, 'L'=>44, 'M'=>45, 'N'=>46, 'O'=>47,
  148 + 'P'=>48, 'Q'=>49, 'R'=>50, 'S'=>51, 'T'=>52, 'U'=>53, 'V'=>54, 'W'=>55,
  149 + 'X'=>56, 'Y'=>57, 'Z'=>58, '['=>59, '\\'=>60, ']'=>61, '^'=>62, '_'=>63,
  150 + 0x00=>64, 0x01=>65, 0x02=>66, 0x03=>67, 0x04=>68, 0x05=>69, 0x06=>70, 0x07=>71,
  151 + 0x08=>72, 0x09=>73, 0x0A=>74, 0x0B=>75, 0x0C=>76, 0x0D=>77, 0x0E=>78, 0x0F=>79,
  152 + 0x10=>80, 0x11=>81, 0x12=>82, 0x13=>83, 0x14=>84, 0x15=>85, 0x16=>86, 0x17=>87,
  153 + 0x18=>88, 0x19=>89, 0x1A=>90, 0x1B=>91, 0x1C=>92, 0x1D=>93, 0x1E=>94, 0x1F=>95,
  154 + 'FNC3'=>96, 'FNC2'=>97, 'SHIFT'=>98, 'Code C'=>99, 'Code B'=>100, 'FNC4'=>101, 'FNC1'=>102, 'START A'=>103,
  155 + 'START B'=>104, 'START C'=>105, 'STOP'=>106),
  156 + 'B' => array(
  157 + ' '=>0, '!'=>1, '"'=>2, '#'=>3, '$'=>4, '%'=>5, '&'=>6, "'"=>7,
  158 + '('=>8, ')'=>9, '*'=>10, '+'=>11, ','=>12, '-'=>13, '.'=>14, '/'=>15,
  159 + '0'=>16, '1'=>17, '2'=>18, '3'=>19, '4'=>20, '5'=>21, '6'=>22, '7'=>23,
  160 + '8'=>24, '9'=>25, ':'=>26, ';'=>27, '<'=>28, '='=>29, '>'=>30, '?'=>31,
  161 + '@'=>32, 'A'=>33, 'B'=>34, 'C'=>35, 'D'=>36, 'E'=>37, 'F'=>38, 'G'=>39,
  162 + 'H'=>40, 'I'=>41, 'J'=>42, 'K'=>43, 'L'=>44, 'M'=>45, 'N'=>46, 'O'=>47,
  163 + 'P'=>48, 'Q'=>49, 'R'=>50, 'S'=>51, 'T'=>52, 'U'=>53, 'V'=>54, 'W'=>55,
  164 + 'X'=>56, 'Y'=>57, 'Z'=>58, '['=>59, '\\'=>60, ']'=>61, '^'=>62, '_'=>63,
  165 + '`' =>64, 'a'=>65, 'b'=>66, 'c'=>67, 'd'=>68, 'e'=>69, 'f'=>70, 'g'=>71,
  166 + 'h'=>72, 'i'=>73, 'j'=>74, 'k'=>75, 'l'=>76, 'm'=>77, 'n'=>78, 'o'=>79,
  167 + 'p'=>80, 'q'=>81, 'r'=>82, 's'=>83, 't'=>84, 'u'=>85, 'v'=>86, 'w'=>87,
  168 + 'x'=>88, 'y'=>89, 'z'=>90, '{'=>91, '|'=>92, '}'=>93, '~'=>94, 0x7F=>95,
  169 + 'FNC3'=>96, 'FNC2'=>97, 'SHIFT'=>98, 'Code C'=>99, 'FNC4'=>100, 'Code A'=>101, 'FNC1'=>102, 'START A'=>103,
  170 + 'START B'=>104, 'START C'=>105, 'STOP'=>106,),
  171 + 'C' => array(
  172 + '00'=>0, '01'=>1, '02'=>2, '03'=>3, '04'=>4, '05'=>5, '06'=>6, '07'=>7, '08'=>8, '09'=>9,
  173 + '10'=>10, '11'=>11, '12'=>12, '13'=>13, '14'=>14, '15'=>15, '16'=>16, '17'=>17, '18'=>18, '19'=>19,
  174 + '20'=>20, '21'=>21, '22'=>22, '23'=>23, '24'=>24, '25'=>25, '26'=>26, '27'=>27, '28'=>28, '29'=>29,
  175 + '30'=>30, '31'=>31, '32'=>32, '33'=>33, '34'=>34, '35'=>35, '36'=>36, '37'=>37, '38'=>38, '39'=>39,
  176 + '40'=>40, '41'=>41, '42'=>42, '43'=>43, '44'=>44, '45'=>45, '46'=>46, '47'=>47, '48'=>48, '49'=>49,
  177 + '50'=>50, '51'=>51, '52'=>52, '53'=>53, '54'=>54, '55'=>55, '56'=>56, '57'=>57, '58'=>58, '59'=>59,
  178 + '60'=>60, '61'=>61, '62'=>62, '63'=>63, '64'=>64, '65'=>65, '66'=>66, '67'=>67, '68'=>68, '69'=>69,
  179 + '70'=>70, '71'=>71, '72'=>72, '73'=>73, '74'=>74, '75'=>75, '76'=>76, '77'=>77, '78'=>78, '79'=>79,
  180 + '80'=>80, '81'=>81, '82'=>82, '83'=>83, '84'=>84, '85'=>85, '86'=>86, '87'=>87, '88'=>88, '89'=>89,
  181 + '90'=>90, '91'=>91, '92'=>92, '93'=>93, '94'=>94, '95'=>95, '96'=>96, '97'=>97, '98'=>98, '99'=>99,
  182 + 'Code B'=>100, 'Code A'=>101, 'FNC1'=>102, 'START A'=>103, 'START B'=>104, 'START C'=>105, 'STOP'=>106));*/
  183 +
  184 + /**
  185 + * Width of the barcode (in pixels)
  186 + * @return integer
  187 + */
  188 + protected function _calculateBarcodeWidth()
  189 + {
  190 + $quietZone = $this->getQuietZone();
  191 + // Each characters contain 11 bars...
  192 + $characterLength = 11 * $this->_barThinWidth * $this->_factor;
  193 + $convertedChars = count($this->_convertToBarcodeChars($this->getText()));
  194 + if ($this->_withChecksum) {
  195 + $convertedChars++;
  196 + }
  197 + $encodedData = $convertedChars * $characterLength;
  198 + // ...except the STOP character (13)
  199 + $encodedData += $characterLength + 2 * $this->_barThinWidth * $this->_factor;
  200 + $width = $quietZone + $encodedData + $quietZone;
  201 + return $width;
  202 + }
  203 +
  204 + /**
  205 + * Partial check of code128 barcode
  206 + * @return void
  207 + */
  208 + protected function _checkParams()
  209 + {
  210 + }
  211 +
  212 + /**
  213 + * Prepare array to draw barcode
  214 + * @return array
  215 + */
  216 + protected function _prepareBarcode()
  217 + {
  218 + $barcodeTable = array();
  219 +
  220 + $convertedChars = $this->_convertToBarcodeChars($this->getText());
  221 +
  222 + if ($this->_withChecksum) {
  223 + $convertedChars[] = $this->getChecksum($this->getText());
  224 + }
  225 +
  226 + // STOP CHARACTER
  227 + $convertedChars[] = 106;
  228 +
  229 + foreach ($convertedChars as $barcodeChar) {
  230 + $barcodePattern = $this->_codingMap[$barcodeChar];
  231 + foreach (str_split($barcodePattern) as $c) {
  232 + $barcodeTable[] = array($c, $this->_barThinWidth, 0, 1);
  233 + }
  234 + }
  235 + return $barcodeTable;
  236 + }
  237 +
  238 + /**
  239 + * Checks if the next $length chars of $string starting at $pos are numeric.
  240 + * Returns false if the end of the string is reached.
  241 + * @param string $string String to search
  242 + * @param int $pos Starting position
  243 + * @param int $length Length to search
  244 + * @return bool
  245 + */
  246 + protected static function _isDigit($string, $pos, $length = 2)
  247 + {
  248 + if ($pos + $length > strlen($string)) {
  249 + return false;
  250 + }
  251 +
  252 + for ($i = $pos; $i < $pos + $length; $i++) {
  253 + if (!is_numeric($string[$i])) {
  254 + return false;
  255 + }
  256 + }
  257 + return true;
  258 + }
  259 +
  260 + /**
  261 + * Convert string to barcode string
  262 + * @return array
  263 + */
  264 + protected function _convertToBarcodeChars($string)
  265 + {
  266 + $string = (string) $string;
  267 + if (!strlen($string)) {
  268 + return array();
  269 + }
  270 +
  271 + if (isset($this->_convertedText[md5($string)])) {
  272 + return $this->_convertedText[md5($string)];
  273 + }
  274 +
  275 + $currentCharset = null;
  276 + $sum = 0;
  277 + $fak = 0;
  278 + $result = array();
  279 +
  280 + for ($pos = 0; $pos < strlen($string); $pos++) {
  281 + $char = $string[$pos];
  282 + $code = null;
  283 +
  284 + if (self::_isDigit($string, $pos, 4) && $currentCharset != 'C'
  285 + || self::_isDigit($string, $pos, 2) && $currentCharset == 'C') {
  286 + /**
  287 + * Switch to C if the next 4 chars are numeric or stay C if the next 2
  288 + * chars are numeric
  289 + */
  290 + if ($currentCharset != 'C') {
  291 + if ($pos == 0) {
  292 + $code = array_search("START C", $this->_charSets['C']);
  293 + } else {
  294 + $code = array_search("Code C", $this->_charSets[$currentCharset]);
  295 + }
  296 + $result[] = $code;
  297 + $currentCharset = 'C';
  298 + }
  299 + } else if (in_array($char, $this->_charSets['B']) && $currentCharset != 'B'
  300 + && !(in_array($char, $this->_charSets['A']) && $currentCharset == 'A')) {
  301 + /**
  302 + * Switch to B as B contains the char and B is not the current charset.
  303 + */
  304 + if ($pos == 0) {
  305 + $code = array_search("START B", $this->_charSets['B']);
  306 + } else {
  307 + $code = array_search("Code B", $this->_charSets[$currentCharset]);
  308 + }
  309 + $result[] = $code;
  310 + $currentCharset = 'B';
  311 + } else if (array_key_exists($char, $this->_charSets['A']) && $currentCharset != 'A'
  312 + && !(array_key_exists($char, $this->_charSets['B']) && $currentCharset == 'B')) {
  313 + /**
  314 + * Switch to C as C contains the char and C is not the current charset.
  315 + */
  316 + if ($pos == 0) {
  317 + $code = array_search("START A", $this->_charSets['A']);
  318 + } else {
  319 + $code =array_search("Code A", $this->_charSets[$currentCharset]);
  320 + }
  321 + $result[] = $code;
  322 + $currentCharset = 'A';
  323 + }
  324 +
  325 + if ($currentCharset == 'C') {
  326 + $code = array_search(substr($string, $pos, 2), $this->_charSets['C']);
  327 + $pos++; //Two chars from input
  328 + } else {
  329 + $code = array_search($string[$pos], $this->_charSets[$currentCharset]);
  330 + }
  331 + $result[] = $code;
  332 + }
  333 +
  334 + $this->_convertedText[md5($string)] = $result;
  335 + return $result;
  336 + }
  337 +
  338 + /**
  339 + * Set text to encode
  340 + * @param string $value
  341 + * @return Zend_Barcode_Object
  342 + */
  343 + public function setText($value)
  344 + {
  345 + $this->_text = $value;
  346 + return $this;
  347 + }
  348 +
  349 + /**
  350 + * Retrieve text to encode
  351 + * @return string
  352 + */
  353 + public function getText()
  354 + {
  355 + return $this->_text;
  356 + }
  357 +
  358 + /**
  359 + * Get barcode checksum
  360 + *
  361 + * @param string $text
  362 + * @return int
  363 + */
  364 + public function getChecksum($text)
  365 + {
  366 + $tableOfChars = $this->_convertToBarcodeChars($text);
  367 +
  368 + $sum = $tableOfChars[0];
  369 + unset($tableOfChars[0]);
  370 +
  371 + $k = 1;
  372 + foreach ($tableOfChars as $char) {
  373 + $sum += ($k++) * $char;
  374 + }
  375 +
  376 + $checksum = $sum % 103;
  377 +
  378 + return $checksum;
  379 + }
  380 +
  381 + /**
  382 + * Standard validation for most of barcode objects
  383 + * @param string $value
  384 + * @param array $options
  385 + */
  386 + protected function _validateText($value, $options = array())
  387 + {
  388 + // @TODO: add code128 validator
  389 + return true;
  390 + }
  391 +}
... ...
lib/Zend/Barcode/Object/Code25.php 100755 → 100644
... ... @@ -15,9 +15,9 @@
15 15 * @category Zend
16 16 * @package Zend_Barcode
17 17 * @subpackage Object
18   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  18 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19 19 * @license http://framework.zend.com/license/new-bsd New BSD License
20   - * @version $Id: Code25.php 20096 2010-01-06 02:05:09Z bkarwin $
  20 + * @version $Id: Code25.php 24593 2012-01-05 20:35:02Z matthew $
21 21 */
22 22  
23 23 /**
... ... @@ -35,7 +35,7 @@ require_once &#39;Zend/Validate/Barcode.php&#39;;
35 35 *
36 36 * @category Zend
37 37 * @package Zend_Barcode
38   - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  38 + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39 39 * @license http://framework.zend.com/license/new-bsd New BSD License
40 40 */
41 41 class Zend_Barcode_Object_Code25 extends Zend_Barcode_Object_ObjectAbstract
... ... @@ -97,7 +97,7 @@ class Zend_Barcode_Object_Code25 extends Zend_Barcode_Object_ObjectAbstract
97 97 $barcodeTable[] = array(1 , $this->_barThickWidth , 0 , 1);
98 98 $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1);
99 99 $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1);
100   - $barcodeTable[] = array(0 , 1);
  100 + $barcodeTable[] = array(0 , $this->_barThinWidth);
101 101  
102 102 $text = str_split($this->getText());
103 103 foreach ($text as $char) {
... ... @@ -106,7 +106,7 @@ class Zend_Barcode_Object_Code25 extends Zend_Barcode_Object_ObjectAbstract
106 106 /* visible, width, top, length */
107 107 $width = $c ? $this->_barThickWidth : $this->_barThinWidth;
108 108 $barcodeTable[] = array(1 , $width , 0 , 1);
109   - $barcodeTable[] = array(0 , 1);
  109 + $barcodeTable[] = array(0 , $this->_barThinWidth);
110 110 }
111 111 }
112 112  
... ...