Minahito
minah****@users*****
2006年 9月 28日 (木) 19:23:11 JST
Index: xoops2jp/html/kernel/XCube_Service.class.php diff -u xoops2jp/html/kernel/XCube_Service.class.php:1.1.2.2.2.1 xoops2jp/html/kernel/XCube_Service.class.php:1.1.2.2.2.2 --- xoops2jp/html/kernel/XCube_Service.class.php:1.1.2.2.2.1 Thu Sep 28 14:00:41 2006 +++ xoops2jp/html/kernel/XCube_Service.class.php Thu Sep 28 19:23:10 2006 @@ -1,7 +1,7 @@ <?php /** * @package XCube - * @version $Id: XCube_Service.class.php,v 1.1.2.2.2.1 2006/09/28 05:00:41 minahito Exp $ + * @version $Id: XCube_Service.class.php,v 1.1.2.2.2.2 2006/09/28 10:23:10 minahito Exp $ */ /** @@ -140,7 +140,7 @@ function setError($message) { - $this->mClientErrorStr=$message; + $this->mClientErrorStr = $message; } function getError() @@ -149,6 +149,12 @@ } } +/** + * The client object for XCube_Service(Inner service). This class calls + * functions directly, but exchanges the request object of the context to + * enable the service logic to get values by the request object. After calls, + * restores the original request object. + */ class XCube_ServiceClient extends XCube_AbstractServiceClient { function call($operation, $params) @@ -160,11 +166,22 @@ return null; } + $root =& XCube_Root::getSingleton(); + $request_bak =& $root->mContext->mRequest; + unset($root->mContext->mRequest); + + $root->mContext->mRequest =& new XCube_GenericRequest($params); + if (isset($this->mService->_mFunctions[$operation])) { - return call_user_func_array(array($this->mService, $operation), array($this->mUser, $params)); + $ret = call_user_func(array($this->mService, $operation)); + + unset($root->mContext->mRequest); + $root->mContext->mRequest =& $request_bak; + + return $ret; } else { - $this->mClientErrorStr = "operation $operation not present."; + $this->mClientErrorStr = "operation ${operation} not present."; return null; } }