Passing this on to Milosch for refinement - Handling mutiple layers of an associated array.

This commit is contained in:
skeeter 2001-08-26 04:30:06 +00:00
parent cd6db0dfad
commit 039b9fe3fb

View File

@ -48,7 +48,6 @@
function serializeDebug() function serializeDebug()
{ {
// global $_xmlrpc_debuginfo;
if ($GLOBALS['_xmlrpc_debuginfo'] != '') if ($GLOBALS['_xmlrpc_debuginfo'] != '')
{ {
return "<!-- DEBUG INFO:\n\n" . $GLOBALS['_xmlrpc_debuginfo'] . "\n-->\n"; return "<!-- DEBUG INFO:\n\n" . $GLOBALS['_xmlrpc_debuginfo'] . "\n-->\n";
@ -121,10 +120,26 @@
return array(0, "Wanted $wanted, got $got at param $pno)"); 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='') function parseRequest($data='')
{ {
global $HTTP_RAW_POST_DATA; global $HTTP_RAW_POST_DATA;
// global $_xh, $xmlrpcerr, $xmlrpcstr, $xmlrpcerrxml, $xmlrpc_defencoding, $_xmlrpcs_dmap;
if ($data == '') if ($data == '')
{ {
@ -262,24 +277,8 @@
/* _debug_array($params); */ /* _debug_array($params); */
$res = ExecMethod($method,$params); $res = ExecMethod($method,$params);
/* _debug_array($res);exit; */ /* _debug_array($res);exit; */
@reset($res);
while(list($key,$val) = @each($res)) $r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->build_array($res),'struct'));
{
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'));
/* _debug_array($r);exit; */ /* _debug_array($r);exit; */
} }
} }