From 039b9fe3fb501d2553c48e2a1bb0cfc7bb458b9e Mon Sep 17 00:00:00 2001 From: skeeter Date: Sun, 26 Aug 2001 04:30:06 +0000 Subject: [PATCH] Passing this on to Milosch for refinement - Handling mutiple layers of an associated array. --- phpgwapi/inc/class.xmlrpc_server.inc.php | 39 ++++++++++++------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/phpgwapi/inc/class.xmlrpc_server.inc.php b/phpgwapi/inc/class.xmlrpc_server.inc.php index ac57d9a556..f02804f043 100644 --- a/phpgwapi/inc/class.xmlrpc_server.inc.php +++ b/phpgwapi/inc/class.xmlrpc_server.inc.php @@ -48,7 +48,6 @@ function serializeDebug() { -// global $_xmlrpc_debuginfo; if ($GLOBALS['_xmlrpc_debuginfo'] != '') { return "\n"; @@ -121,10 +120,26 @@ return array(0, "Wanted $wanted, got $got at param $pno)"); } + function build_array($res) + { + @reset($res); + while(list($key,$val) = @each($res)) + { + if(is_array($val)) + { + $ele[$key] = CreateObject('phpgwapi.xmlrpcval',$this->build_array($val),'struct'); + } + else + { + $ele[$key] = CreateObject('phpgwapi.xmlrpcval',$val,'string'); + } + } + return $ele; + } + function parseRequest($data='') { global $HTTP_RAW_POST_DATA; -// global $_xh, $xmlrpcerr, $xmlrpcstr, $xmlrpcerrxml, $xmlrpc_defencoding, $_xmlrpcs_dmap; if ($data == '') { @@ -262,24 +277,8 @@ /* _debug_array($params); */ $res = ExecMethod($method,$params); /* _debug_array($res);exit; */ - @reset($res); - while(list($key,$val) = @each($res)) - { - if(gettype($val) == 'array') - { - @reset($val); - while(list($x,$y) = @each($val)) - { - $aa[$x] = CreateObject('phpgwapi.xmlrpcval',$y,'string'); - } - $ele[$key] = CreateObject('phpgwapi.xmlrpcval',$aa,'struct'); - } - else - { - $ele[$key] = CreateObject('phpgwapi.xmlrpcval',$val,'string'); - } - } - $r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$ele,'struct')); + + $r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->build_array($res),'struct')); /* _debug_array($r);exit; */ } }