mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-24 11:51:43 +02:00
Handle multi-dimensional array input, decode those xmlrpcvals
This commit is contained in:
parent
47f3ea01eb
commit
57ba2dfff8
@ -221,11 +221,12 @@
|
|||||||
$f = CreateObject('phpgwapi.xmlrpcmsg', $method_name, $arr,'struct');
|
$f = CreateObject('phpgwapi.xmlrpcmsg', $method_name, $arr,'struct');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->debug("<pre>" . htmlentities($f->serialize()) . "</pre>\n",$debug);
|
$this->debug('<pre>' . htmlentities($f->serialize()) . '</pre>' . "\n",$debug);
|
||||||
$c = CreateObject('phpgwapi.xmlrpc_client',$this->urlparts['xmlrpc'], $hostpart, 80);
|
$c = CreateObject('phpgwapi.xmlrpc_client',$this->urlparts['xmlrpc'], $hostpart, 80);
|
||||||
$c->username = $this->sessionid;
|
$c->username = $this->sessionid;
|
||||||
$c->password = $this->kp3;
|
$c->password = $this->kp3;
|
||||||
$c->setDebug(1);
|
// _debug_array($c);
|
||||||
|
$c->setDebug(0);
|
||||||
$r = $c->send($f);
|
$r = $c->send($f);
|
||||||
if (!$r)
|
if (!$r)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
class xmlrpc_server
|
class xmlrpc_server
|
||||||
{
|
{
|
||||||
var $dmap = array();
|
var $dmap = array();
|
||||||
|
var $authed = False;
|
||||||
|
|
||||||
function xmlrpc_server($dispMap='', $serviceNow=0)
|
function xmlrpc_server($dispMap='', $serviceNow=0)
|
||||||
{
|
{
|
||||||
@ -182,6 +183,8 @@
|
|||||||
$sysCall=0;
|
$sysCall=0;
|
||||||
}
|
}
|
||||||
if(!isset($dmap[$methName]['function']))
|
if(!isset($dmap[$methName]['function']))
|
||||||
|
{
|
||||||
|
if($this->authed)
|
||||||
{
|
{
|
||||||
/* phpgw mod - fetch the (bo) class methods to create the dmap */
|
/* phpgw mod - fetch the (bo) class methods to create the dmap */
|
||||||
$method = $methName;
|
$method = $methName;
|
||||||
@ -191,6 +194,7 @@
|
|||||||
$dmap = ExecMethod($listmeth,'xmlrpc');
|
$dmap = ExecMethod($listmeth,'xmlrpc');
|
||||||
$this->dmap = $dmap;
|
$this->dmap = $dmap;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (isset($dmap[$methName]['function']))
|
if (isset($dmap[$methName]['function']))
|
||||||
{
|
{
|
||||||
// dispatch if exists
|
// dispatch if exists
|
||||||
@ -222,15 +226,53 @@
|
|||||||
$code = '$p = ' . $params . ';';
|
$code = '$p = ' . $params . ';';
|
||||||
eval($code);
|
eval($code);
|
||||||
$params = $p->getval();
|
$params = $p->getval();
|
||||||
|
/* _debug_array($params); */
|
||||||
|
if(gettype($params) == 'array')
|
||||||
|
{
|
||||||
|
@reset($params);
|
||||||
|
while(list($key,$val) = @each($params))
|
||||||
|
{
|
||||||
|
if(gettype($val) == 'array')
|
||||||
|
{
|
||||||
|
@reset($val);
|
||||||
|
while(list($key1,$val1) = @each($val))
|
||||||
|
{
|
||||||
|
$tmp = '';
|
||||||
|
if(get_class($val1) == 'xmlrpcval')
|
||||||
|
{
|
||||||
|
$tmp[$key1] = $val1->getval();
|
||||||
|
/* echo '<br>Adding xmlrpc val1: ' . $tmp[$key1] . "\n"; */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* echo '<br>Adding val1: ' . $val1 . "\n"; */
|
||||||
|
$tmp[$key1] = $val1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$_params[$key] = $tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* echo '<br>Adding val: ' . $val . "\n"; */
|
||||||
|
$_params[$key] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$params = $_params;
|
||||||
|
}
|
||||||
|
/* _debug_array($params); */
|
||||||
$res = ExecMethod($method,$params);
|
$res = ExecMethod($method,$params);
|
||||||
|
/* _debug_array($res);exit; */
|
||||||
|
@reset($res);
|
||||||
while(list($key,$val) = @each($res))
|
while(list($key,$val) = @each($res))
|
||||||
{
|
{
|
||||||
if(gettype($val) == 'array')
|
if(gettype($val) == 'array')
|
||||||
{
|
{
|
||||||
|
@reset($val);
|
||||||
while(list($x,$y) = @each($val))
|
while(list($x,$y) = @each($val))
|
||||||
{
|
{
|
||||||
$ele[$x] = CreateObject('phpgwapi.xmlrpcval',$y,'string');
|
$aa[$x] = CreateObject('phpgwapi.xmlrpcval',$y,'string');
|
||||||
}
|
}
|
||||||
|
$ele[$key] = CreateObject('phpgwapi.xmlrpcval',$aa,'struct');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -238,6 +280,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$ele,'struct'));
|
$r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$ele,'struct'));
|
||||||
|
/* _debug_array($r);exit; */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,6 +297,12 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// else prepare error response
|
// else prepare error response
|
||||||
|
if(!$this->authed)
|
||||||
|
{
|
||||||
|
$r = CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval','UNAUTHORIZED','string'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$r = CreateObject(
|
$r = CreateObject(
|
||||||
'phpgwapi.xmlrpcresp',
|
'phpgwapi.xmlrpcresp',
|
||||||
CreateObject('phpgwapi.xmlrpcval'),
|
CreateObject('phpgwapi.xmlrpcval'),
|
||||||
@ -262,6 +311,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user