- fixed the parser to correctly return nested arrays/structs

- added support for datetime.iso8601 type, it is recogniced by the regular  expression '^[0-9]{8}T[0-9]{4}$' as php has no special datetime type
This commit is contained in:
Ralf Becker 2003-10-25 16:08:05 +00:00
parent 24d302ea8b
commit 0ecc01baaa

View File

@ -218,45 +218,28 @@
} }
} }
function build_resp($_res,$recursed=False) function build_resp($_res)
{ {
if (is_array($_res)) if (is_array($_res))
{ {
@reset($_res); foreach($_res as $key => $val)
while (list($key,$val) = @each($_res))
{ {
$ele[$key] = $this->build_resp($val,True); $ele[$key] = $this->build_resp($val,True);
} }
$this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$ele,'struct'); return CreateObject('phpgwapi.xmlrpcval',$ele,'struct');
} }
else $_type = (is_integer($_res) ? 'int' : gettype($_res));
if ($_type == string && ereg('^[0-9]{8}T[0-9]{4}$',$_res))
{ {
$_type = (is_integer($_res)?'int':gettype($_res)); $_type = 'dateTime.iso8601';
if ($recursed)
{
// Passing an integer of 0 to the xmlrpcval constructor results in the value being lost. (jengo)
if ($_type == 'int' && $_res == 0)
{
return CreateObject('phpgwapi.xmlrpcval','0',$_type);
}
else
{
return CreateObject('phpgwapi.xmlrpcval',$_res,$_type);
}
}
else
{
// Passing an integer of 0 to the xmlrpcval constructor results in the value being lost. (jengo)
if ($_type == 'int' && $_res == 0)
{
$this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval','0',$_type);
}
else
{
$this->resp_struct[] = CreateObject('phpgwapi.xmlrpcval',$_res,$_type);
}
}
} }
// Passing an integer of 0 to the xmlrpcval constructor results in the value being lost. (jengo)
if ($_type == 'int' && $_res == 0)
{
return CreateObject('phpgwapi.xmlrpcval','0',$_type);
}
return CreateObject('phpgwapi.xmlrpcval',$_res,$_type);
} }
function parseRequest($data='') function parseRequest($data='')
@ -424,8 +407,7 @@
} }
/* $res = ExecMethod($method,$params); */ /* $res = ExecMethod($method,$params); */
/* _debug_array($res);exit; */ /* _debug_array($res);exit; */
$this->resp_struct = array(); $this->resp_struct = array($this->build_resp($res,True));
$this->build_resp($res);
/*_debug_array($this->resp_struct); */ /*_debug_array($this->resp_struct); */
@reset($this->resp_struct); @reset($this->resp_struct);
$r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->resp_struct,'struct')); $r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->resp_struct,'struct'));