|
@@ -19,31 +19,31 @@
|
|
|
* @version $Id$
|
|
* @version $Id$
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-/** Zend_Server_Interface */
|
|
|
|
|
|
|
+/** @see Zend_Server_Interface */
|
|
|
require_once 'Zend/Server/Interface.php';
|
|
require_once 'Zend/Server/Interface.php';
|
|
|
|
|
|
|
|
-/** Zend_Server_Reflection */
|
|
|
|
|
|
|
+/** @see Zend_Server_Reflection */
|
|
|
require_once 'Zend/Server/Reflection.php';
|
|
require_once 'Zend/Server/Reflection.php';
|
|
|
|
|
|
|
|
-/** Zend_Amf_Constants */
|
|
|
|
|
|
|
+/** @see Zend_Amf_Constants */
|
|
|
require_once 'Zend/Amf/Constants.php';
|
|
require_once 'Zend/Amf/Constants.php';
|
|
|
|
|
|
|
|
-/** Zend_Amf_Value_MessageBody */
|
|
|
|
|
|
|
+/** @see Zend_Amf_Value_MessageBody */
|
|
|
require_once 'Zend/Amf/Value/MessageBody.php';
|
|
require_once 'Zend/Amf/Value/MessageBody.php';
|
|
|
|
|
|
|
|
-/** Zend_Amf_Value_MessageHeader */
|
|
|
|
|
|
|
+/** @see Zend_Amf_Value_MessageHeader */
|
|
|
require_once 'Zend/Amf/Value/MessageHeader.php';
|
|
require_once 'Zend/Amf/Value/MessageHeader.php';
|
|
|
|
|
|
|
|
-/** Zend_Amf_Value_Messaging_CommandMessage */
|
|
|
|
|
|
|
+/** @see Zend_Amf_Value_Messaging_CommandMessage */
|
|
|
require_once 'Zend/Amf/Value/Messaging/CommandMessage.php';
|
|
require_once 'Zend/Amf/Value/Messaging/CommandMessage.php';
|
|
|
|
|
|
|
|
-/** Zend_Loader_PluginLoader */
|
|
|
|
|
|
|
+/** @see Zend_Loader_PluginLoader */
|
|
|
require_once 'Zend/Loader/PluginLoader.php';
|
|
require_once 'Zend/Loader/PluginLoader.php';
|
|
|
|
|
|
|
|
-/** Zend_Amf_Parse_TypeLoader */
|
|
|
|
|
|
|
+/** @see Zend_Amf_Parse_TypeLoader */
|
|
|
require_once 'Zend/Amf/Parse/TypeLoader.php';
|
|
require_once 'Zend/Amf/Parse/TypeLoader.php';
|
|
|
|
|
|
|
|
-/** Zend_Auth */
|
|
|
|
|
|
|
+/** @see Zend_Auth */
|
|
|
require_once 'Zend/Auth.php';
|
|
require_once 'Zend/Auth.php';
|
|
|
/**
|
|
/**
|
|
|
* An AMF gateway server implementation to allow the connection of the Adobe Flash Player to
|
|
* An AMF gateway server implementation to allow the connection of the Adobe Flash Player to
|
|
@@ -62,10 +62,10 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
* @var array
|
|
* @var array
|
|
|
*/
|
|
*/
|
|
|
protected $_methods = array();
|
|
protected $_methods = array();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Array of classes that can be called without being explicitly loaded
|
|
* Array of classes that can be called without being explicitly loaded
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* Keys are class names.
|
|
* Keys are class names.
|
|
|
*
|
|
*
|
|
|
* @var array
|
|
* @var array
|
|
@@ -121,13 +121,13 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Authentication handler object
|
|
* Authentication handler object
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @var Zend_Amf_Auth_Abstract
|
|
* @var Zend_Amf_Auth_Abstract
|
|
|
*/
|
|
*/
|
|
|
protected $_auth;
|
|
protected $_auth;
|
|
|
/**
|
|
/**
|
|
|
* ACL handler object
|
|
* ACL handler object
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @var Zend_Acl
|
|
* @var Zend_Acl
|
|
|
*/
|
|
*/
|
|
|
protected $_acl;
|
|
protected $_acl;
|
|
@@ -136,9 +136,9 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
*/
|
|
*/
|
|
|
public function __construct()
|
|
public function __construct()
|
|
|
{
|
|
{
|
|
|
- Zend_Amf_Parse_TypeLoader::setResourceLoader(new Zend_Loader_PluginLoader(array("Zend_Amf_Parse_Resource" => "Zend/Amf/Parse/Resource")));
|
|
|
|
|
|
|
+ Zend_Amf_Parse_TypeLoader::setResourceLoader(new Zend_Loader_PluginLoader(array("Zend_Amf_Parse_Resource" => "Zend/Amf/Parse/Resource")));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Set authentication adapter
|
|
* Set authentication adapter
|
|
|
*
|
|
*
|
|
@@ -159,7 +159,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
{
|
|
{
|
|
|
return $this->_auth;
|
|
return $this->_auth;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Set ACL adapter
|
|
* Set ACL adapter
|
|
|
*
|
|
*
|
|
@@ -180,7 +180,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
{
|
|
{
|
|
|
return $this->_acl;
|
|
return $this->_acl;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Set production flag
|
|
* Set production flag
|
|
|
*
|
|
*
|
|
@@ -225,8 +225,8 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Check if the ACL allows accessing the function or method
|
|
|
|
|
- *
|
|
|
|
|
|
|
+ * Check if the ACL allows accessing the function or method
|
|
|
|
|
+ *
|
|
|
* @param string|object $object Object or class being accessed
|
|
* @param string|object $object Object or class being accessed
|
|
|
* @param string $function Function or method being acessed
|
|
* @param string $function Function or method being acessed
|
|
|
* @return unknown_type
|
|
* @return unknown_type
|
|
@@ -239,7 +239,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
if($object) {
|
|
if($object) {
|
|
|
$class = is_object($object)?get_class($object):$object;
|
|
$class = is_object($object)?get_class($object):$object;
|
|
|
if(!$this->_acl->has($class)) {
|
|
if(!$this->_acl->has($class)) {
|
|
|
- require_once 'Zend/Acl/Resource.php';
|
|
|
|
|
|
|
+ require_once 'Zend/Acl/Resource.php';
|
|
|
$this->_acl->add(new Zend_Acl_Resource($class));
|
|
$this->_acl->add(new Zend_Acl_Resource($class));
|
|
|
}
|
|
}
|
|
|
$call = array($object, "initAcl");
|
|
$call = array($object, "initAcl");
|
|
@@ -250,15 +250,15 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
} else {
|
|
} else {
|
|
|
$class = null;
|
|
$class = null;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$auth = Zend_Auth::getInstance();
|
|
$auth = Zend_Auth::getInstance();
|
|
|
if($auth->hasIdentity()) {
|
|
if($auth->hasIdentity()) {
|
|
|
$role = $auth->getIdentity()->role;
|
|
$role = $auth->getIdentity()->role;
|
|
|
} else {
|
|
} else {
|
|
|
- if($this->_acl->hasRole(Zend_Amf_Constants::GUEST_ROLE)) {
|
|
|
|
|
|
|
+ if($this->_acl->hasRole(Zend_Amf_Constants::GUEST_ROLE)) {
|
|
|
$role = Zend_Amf_Constants::GUEST_ROLE;
|
|
$role = Zend_Amf_Constants::GUEST_ROLE;
|
|
|
} else {
|
|
} else {
|
|
|
- require_once 'Zend/Amf/Server/Exception.php';
|
|
|
|
|
|
|
+ require_once 'Zend/Amf/Server/Exception.php';
|
|
|
throw new Zend_Amf_Server_Exception("Unauthenticated access not allowed");
|
|
throw new Zend_Amf_Server_Exception("Unauthenticated access not allowed");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -269,7 +269,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
throw new Zend_Amf_Server_Exception("Access not allowed");
|
|
throw new Zend_Amf_Server_Exception("Access not allowed");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Get PluginLoader for the Server
|
|
* Get PluginLoader for the Server
|
|
|
*
|
|
*
|
|
@@ -277,13 +277,13 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
*/
|
|
*/
|
|
|
protected function getLoader()
|
|
protected function getLoader()
|
|
|
{
|
|
{
|
|
|
- if(empty($this->_loader)) {
|
|
|
|
|
- require_once 'Zend/Loader/PluginLoader.php';
|
|
|
|
|
- $this->_loader = new Zend_Loader_PluginLoader();
|
|
|
|
|
- }
|
|
|
|
|
- return $this->_loader;
|
|
|
|
|
|
|
+ if(empty($this->_loader)) {
|
|
|
|
|
+ require_once 'Zend/Loader/PluginLoader.php';
|
|
|
|
|
+ $this->_loader = new Zend_Loader_PluginLoader();
|
|
|
|
|
+ }
|
|
|
|
|
+ return $this->_loader;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Loads a remote class or method and executes the function and returns
|
|
* Loads a remote class or method and executes the function and returns
|
|
|
* the result
|
|
* the result
|
|
@@ -295,23 +295,23 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
*/
|
|
*/
|
|
|
protected function _dispatch($method, $params = null, $source = null)
|
|
protected function _dispatch($method, $params = null, $source = null)
|
|
|
{
|
|
{
|
|
|
- if($source) {
|
|
|
|
|
- if(($mapped = Zend_Amf_Parse_TypeLoader::getMappedClassName($source)) !== false) {
|
|
|
|
|
- $source = $mapped;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if($source) {
|
|
|
|
|
+ if(($mapped = Zend_Amf_Parse_TypeLoader::getMappedClassName($source)) !== false) {
|
|
|
|
|
+ $source = $mapped;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$qualifiedName = empty($source) ? $method : $source.".".$method;
|
|
$qualifiedName = empty($source) ? $method : $source.".".$method;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (!isset($this->_table[$qualifiedName])) {
|
|
if (!isset($this->_table[$qualifiedName])) {
|
|
|
// if source is null a method that was not defined was called.
|
|
// if source is null a method that was not defined was called.
|
|
|
if ($source) {
|
|
if ($source) {
|
|
|
- $className = str_replace(".", "_", $source);
|
|
|
|
|
- if(class_exists($className, false) && !isset($this->_classAllowed[$className])) {
|
|
|
|
|
- require_once 'Zend/Amf/Server/Exception.php';
|
|
|
|
|
|
|
+ $className = str_replace(".", "_", $source);
|
|
|
|
|
+ if(class_exists($className, false) && !isset($this->_classAllowed[$className])) {
|
|
|
|
|
+ require_once 'Zend/Amf/Server/Exception.php';
|
|
|
throw new Zend_Amf_Server_Exception('Can not call "' . $className . '" - use setClass()');
|
|
throw new Zend_Amf_Server_Exception('Can not call "' . $className . '" - use setClass()');
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
try {
|
|
try {
|
|
|
- $this->getLoader()->load($className);
|
|
|
|
|
|
|
+ $this->getLoader()->load($className);
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
require_once 'Zend/Amf/Server/Exception.php';
|
|
require_once 'Zend/Amf/Server/Exception.php';
|
|
|
throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist: '.$e->getMessage());
|
|
throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist: '.$e->getMessage());
|
|
@@ -326,7 +326,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
|
|
|
|
|
$info = $this->_table[$qualifiedName];
|
|
$info = $this->_table[$qualifiedName];
|
|
|
$argv = $info->getInvokeArguments();
|
|
$argv = $info->getInvokeArguments();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (0 < count($argv)) {
|
|
if (0 < count($argv)) {
|
|
|
$params = array_merge($params, $argv);
|
|
$params = array_merge($params, $argv);
|
|
|
}
|
|
}
|
|
@@ -377,13 +377,13 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
|
|
require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
|
|
|
switch($message->operation) {
|
|
switch($message->operation) {
|
|
|
case Zend_Amf_Value_Messaging_CommandMessage::DISCONNECT_OPERATION :
|
|
case Zend_Amf_Value_Messaging_CommandMessage::DISCONNECT_OPERATION :
|
|
|
- case Zend_Amf_Value_Messaging_CommandMessage::CLIENT_PING_OPERATION :
|
|
|
|
|
|
|
+ case Zend_Amf_Value_Messaging_CommandMessage::CLIENT_PING_OPERATION :
|
|
|
$return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message);
|
|
$return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message);
|
|
|
break;
|
|
break;
|
|
|
case Zend_Amf_Value_Messaging_CommandMessage::LOGIN_OPERATION :
|
|
case Zend_Amf_Value_Messaging_CommandMessage::LOGIN_OPERATION :
|
|
|
$data = explode(':', base64_decode($message->body));
|
|
$data = explode(':', base64_decode($message->body));
|
|
|
- $userid = $data[0];
|
|
|
|
|
- $password = isset($data[1])?$data[1]:"";
|
|
|
|
|
|
|
+ $userid = $data[0];
|
|
|
|
|
+ $password = isset($data[1])?$data[1]:"";
|
|
|
if(empty($userid)) {
|
|
if(empty($userid)) {
|
|
|
require_once 'Zend/Amf/Server/Exception.php';
|
|
require_once 'Zend/Amf/Server/Exception.php';
|
|
|
throw new Zend_Amf_Server_Exception('Login failed: username not supplied');
|
|
throw new Zend_Amf_Server_Exception('Login failed: username not supplied');
|
|
@@ -410,7 +410,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Create appropriate error message
|
|
* Create appropriate error message
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @param int $objectEncoding Current AMF encoding
|
|
* @param int $objectEncoding Current AMF encoding
|
|
|
* @param string $message Message that was being processed when error happened
|
|
* @param string $message Message that was being processed when error happened
|
|
|
* @param string $description Error description
|
|
* @param string $description Error description
|
|
@@ -422,55 +422,55 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
protected function _errorMessage($objectEncoding, $message, $description, $detail, $code, $line)
|
|
protected function _errorMessage($objectEncoding, $message, $description, $detail, $code, $line)
|
|
|
{
|
|
{
|
|
|
$return = null;
|
|
$return = null;
|
|
|
- switch ($objectEncoding) {
|
|
|
|
|
- case Zend_Amf_Constants::AMF0_OBJECT_ENCODING :
|
|
|
|
|
- return array (
|
|
|
|
|
- 'description' => ($this->isProduction ()) ? '' : $description,
|
|
|
|
|
- 'detail' => ($this->isProduction ()) ? '' : $detail,
|
|
|
|
|
- 'line' => ($this->isProduction ()) ? 0 : $line,
|
|
|
|
|
- 'code' => $code
|
|
|
|
|
- );
|
|
|
|
|
- case Zend_Amf_Constants::AMF3_OBJECT_ENCODING :
|
|
|
|
|
- require_once 'Zend/Amf/Value/Messaging/ErrorMessage.php';
|
|
|
|
|
- $return = new Zend_Amf_Value_Messaging_ErrorMessage ( $message );
|
|
|
|
|
- $return->faultString = $this->isProduction () ? '' : $description;
|
|
|
|
|
- $return->faultCode = $code;
|
|
|
|
|
- $return->faultDetail = $this->isProduction () ? '' : $detail;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ switch ($objectEncoding) {
|
|
|
|
|
+ case Zend_Amf_Constants::AMF0_OBJECT_ENCODING :
|
|
|
|
|
+ return array (
|
|
|
|
|
+ 'description' => ($this->isProduction ()) ? '' : $description,
|
|
|
|
|
+ 'detail' => ($this->isProduction ()) ? '' : $detail,
|
|
|
|
|
+ 'line' => ($this->isProduction ()) ? 0 : $line,
|
|
|
|
|
+ 'code' => $code
|
|
|
|
|
+ );
|
|
|
|
|
+ case Zend_Amf_Constants::AMF3_OBJECT_ENCODING :
|
|
|
|
|
+ require_once 'Zend/Amf/Value/Messaging/ErrorMessage.php';
|
|
|
|
|
+ $return = new Zend_Amf_Value_Messaging_ErrorMessage ( $message );
|
|
|
|
|
+ $return->faultString = $this->isProduction () ? '' : $description;
|
|
|
|
|
+ $return->faultCode = $code;
|
|
|
|
|
+ $return->faultDetail = $this->isProduction () ? '' : $detail;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
return $return;
|
|
return $return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Handle AMF authenticaton
|
|
|
|
|
- *
|
|
|
|
|
- * @param string $userid
|
|
|
|
|
- * @param string $password
|
|
|
|
|
- * @return boolean
|
|
|
|
|
- */
|
|
|
|
|
- protected function _handleAuth( $userid, $password)
|
|
|
|
|
- {
|
|
|
|
|
- if (!$this->_auth) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- $this->_auth->setCredentials($userid, $password);
|
|
|
|
|
- $auth = Zend_Auth::getInstance();
|
|
|
|
|
- $result = $auth->authenticate($this->_auth);
|
|
|
|
|
- if ($result->isValid()) {
|
|
|
|
|
- if (!$this->isSession()) {
|
|
|
|
|
- $this->setSession();
|
|
|
|
|
- }
|
|
|
|
|
- return true;
|
|
|
|
|
- } else {
|
|
|
|
|
- // authentication failed, good bye
|
|
|
|
|
- require_once 'Zend/Amf/Server/Exception.php';
|
|
|
|
|
- throw new Zend_Amf_Server_Exception(
|
|
|
|
|
- "Authentication failed: " . join("\n",
|
|
|
|
|
- $result->getMessages()), $result->getCode());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Handle AMF authenticaton
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $userid
|
|
|
|
|
+ * @param string $password
|
|
|
|
|
+ * @return boolean
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function _handleAuth( $userid, $password)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->_auth) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->_auth->setCredentials($userid, $password);
|
|
|
|
|
+ $auth = Zend_Auth::getInstance();
|
|
|
|
|
+ $result = $auth->authenticate($this->_auth);
|
|
|
|
|
+ if ($result->isValid()) {
|
|
|
|
|
+ if (!$this->isSession()) {
|
|
|
|
|
+ $this->setSession();
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // authentication failed, good bye
|
|
|
|
|
+ require_once 'Zend/Amf/Server/Exception.php';
|
|
|
|
|
+ throw new Zend_Amf_Server_Exception(
|
|
|
|
|
+ "Authentication failed: " . join("\n",
|
|
|
|
|
+ $result->getMessages()), $result->getCode());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Takes the deserialized AMF request and performs any operations.
|
|
* Takes the deserialized AMF request and performs any operations.
|
|
|
*
|
|
*
|
|
@@ -490,38 +490,38 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
|
|
|
|
|
// set reponse encoding
|
|
// set reponse encoding
|
|
|
$response->setObjectEncoding($objectEncoding);
|
|
$response->setObjectEncoding($objectEncoding);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$responseBody = $request->getAmfBodies();
|
|
$responseBody = $request->getAmfBodies();
|
|
|
|
|
|
|
|
$handleAuth = false;
|
|
$handleAuth = false;
|
|
|
- if ($this->_auth) {
|
|
|
|
|
- $headers = $request->getAmfHeaders();
|
|
|
|
|
- if (isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]) &&
|
|
|
|
|
- isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid)) {
|
|
|
|
|
- $handleAuth = true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if ($this->_auth) {
|
|
|
|
|
+ $headers = $request->getAmfHeaders();
|
|
|
|
|
+ if (isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]) &&
|
|
|
|
|
+ isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid)) {
|
|
|
|
|
+ $handleAuth = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Iterate through each of the service calls in the AMF request
|
|
// Iterate through each of the service calls in the AMF request
|
|
|
foreach($responseBody as $body)
|
|
foreach($responseBody as $body)
|
|
|
{
|
|
{
|
|
|
try {
|
|
try {
|
|
|
- if ($handleAuth) {
|
|
|
|
|
- if ($this->_handleAuth(
|
|
|
|
|
- $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid,
|
|
|
|
|
- $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password)) {
|
|
|
|
|
- // use RequestPersistentHeader to clear credentials
|
|
|
|
|
- $response->addAmfHeader(
|
|
|
|
|
- new Zend_Amf_Value_MessageHeader(
|
|
|
|
|
- Zend_Amf_Constants::PERSISTENT_HEADER,
|
|
|
|
|
- false,
|
|
|
|
|
- new Zend_Amf_Value_MessageHeader(
|
|
|
|
|
- Zend_Amf_Constants::CREDENTIALS_HEADER,
|
|
|
|
|
- false, null)));
|
|
|
|
|
- $handleAuth = false;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if ($handleAuth) {
|
|
|
|
|
+ if ($this->_handleAuth(
|
|
|
|
|
+ $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid,
|
|
|
|
|
+ $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password)) {
|
|
|
|
|
+ // use RequestPersistentHeader to clear credentials
|
|
|
|
|
+ $response->addAmfHeader(
|
|
|
|
|
+ new Zend_Amf_Value_MessageHeader(
|
|
|
|
|
+ Zend_Amf_Constants::PERSISTENT_HEADER,
|
|
|
|
|
+ false,
|
|
|
|
|
+ new Zend_Amf_Value_MessageHeader(
|
|
|
|
|
+ Zend_Amf_Constants::CREDENTIALS_HEADER,
|
|
|
|
|
+ false, null)));
|
|
|
|
|
+ $handleAuth = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if ($objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) {
|
|
if ($objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) {
|
|
|
// AMF0 Object Encoding
|
|
// AMF0 Object Encoding
|
|
|
$targetURI = $body->getTargetURI();
|
|
$targetURI = $body->getTargetURI();
|
|
@@ -567,7 +567,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
}
|
|
}
|
|
|
$responseType = Zend_AMF_Constants::RESULT_METHOD;
|
|
$responseType = Zend_AMF_Constants::RESULT_METHOD;
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
- $return = $this->_errorMessage($objectEncoding, $message,
|
|
|
|
|
|
|
+ $return = $this->_errorMessage($objectEncoding, $message,
|
|
|
$e->getMessage(), $e->getTraceAsString(),$e->getCode(), $e->getLine());
|
|
$e->getMessage(), $e->getTraceAsString(),$e->getCode(), $e->getLine());
|
|
|
$responseType = Zend_AMF_Constants::STATUS_METHOD;
|
|
$responseType = Zend_AMF_Constants::STATUS_METHOD;
|
|
|
}
|
|
}
|
|
@@ -584,10 +584,10 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
if(!strpos($_SERVER['QUERY_STRING'], $currentID) !== FALSE) {
|
|
if(!strpos($_SERVER['QUERY_STRING'], $currentID) !== FALSE) {
|
|
|
if(strrpos($_SERVER['QUERY_STRING'], "?") !== FALSE) {
|
|
if(strrpos($_SERVER['QUERY_STRING'], "?") !== FALSE) {
|
|
|
$joint = "&";
|
|
$joint = "&";
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// create a new AMF message header with the session id as a variable.
|
|
// create a new AMF message header with the session id as a variable.
|
|
|
$sessionValue = $joint . $this->_sessionName . "=" . $currentID;
|
|
$sessionValue = $joint . $this->_sessionName . "=" . $currentID;
|
|
|
$sessionHeader = new Zend_Amf_Value_MessageHeader(Zend_Amf_Constants::URL_APPEND_HEADER, false, $sessionValue);
|
|
$sessionHeader = new Zend_Amf_Value_MessageHeader(Zend_Amf_Constants::URL_APPEND_HEADER, false, $sessionValue);
|
|
@@ -739,11 +739,11 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Use the class name as the name space by default.
|
|
// Use the class name as the name space by default.
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ($namespace == '') {
|
|
if ($namespace == '') {
|
|
|
$namespace = is_object($class) ? get_class($class) : $class;
|
|
$namespace = is_object($class) ? get_class($class) : $class;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$this->_classAllowed[is_object($class) ? get_class($class) : $class] = true;
|
|
$this->_classAllowed[is_object($class) ? get_class($class) : $class] = true;
|
|
|
|
|
|
|
|
$this->_methods[] = Zend_Server_Reflection::reflectClass($class, $argv, $namespace);
|
|
$this->_methods[] = Zend_Server_Reflection::reflectClass($class, $argv, $namespace);
|
|
@@ -793,12 +793,12 @@ class Zend_Amf_Server implements Zend_Server_Interface
|
|
|
/**
|
|
/**
|
|
|
* Creates an array of directories in which services can reside.
|
|
* Creates an array of directories in which services can reside.
|
|
|
* TODO: add support for prefixes?
|
|
* TODO: add support for prefixes?
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @param string $dir
|
|
* @param string $dir
|
|
|
*/
|
|
*/
|
|
|
public function addDirectory($dir)
|
|
public function addDirectory($dir)
|
|
|
{
|
|
{
|
|
|
- $this->getLoader()->addPrefixPath("", $dir);
|
|
|
|
|
|
|
+ $this->getLoader()->addPrefixPath("", $dir);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|