forked from extern/egroupware
wrapped a couple functions in if statements because they are now part of new versions of PHP
This commit is contained in:
parent
ebc98519ce
commit
550d17d454
@ -470,35 +470,38 @@
|
|||||||
* *
|
* *
|
||||||
* author: Dan Libby (dan@libby.com) *
|
* author: Dan Libby (dan@libby.com) *
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
function xmlrpc_decode($xmlrpc_val)
|
if (!function_exists('xmlrpc_decode'))
|
||||||
{
|
{
|
||||||
$kind = @$xmlrpc_val->kindOf();
|
function xmlrpc_decode($xmlrpc_val, $encoding = '')
|
||||||
|
|
||||||
if($kind == 'scalar')
|
|
||||||
{
|
{
|
||||||
return $xmlrpc_val->scalarval();
|
$kind = @$xmlrpc_val->kindOf();
|
||||||
}
|
|
||||||
elseif($kind == 'array')
|
|
||||||
{
|
|
||||||
$size = $xmlrpc_val->arraysize();
|
|
||||||
$arr = array();
|
|
||||||
|
|
||||||
for($i = 0; $i < $size; $i++)
|
if($kind == 'scalar')
|
||||||
{
|
{
|
||||||
$arr[]=xmlrpc_decode($xmlrpc_val->arraymem($i));
|
return $xmlrpc_val->scalarval();
|
||||||
}
|
}
|
||||||
return $arr;
|
elseif($kind == 'array')
|
||||||
}
|
|
||||||
elseif($kind == 'struct')
|
|
||||||
{
|
|
||||||
$xmlrpc_val->structreset();
|
|
||||||
$arr = array();
|
|
||||||
|
|
||||||
while(list($key,$value)=$xmlrpc_val->structeach())
|
|
||||||
{
|
{
|
||||||
$arr[$key] = xmlrpc_decode($value);
|
$size = $xmlrpc_val->arraysize();
|
||||||
|
$arr = array();
|
||||||
|
|
||||||
|
for($i = 0; $i < $size; $i++)
|
||||||
|
{
|
||||||
|
$arr[]=xmlrpc_decode($xmlrpc_val->arraymem($i));
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
elseif($kind == 'struct')
|
||||||
|
{
|
||||||
|
$xmlrpc_val->structreset();
|
||||||
|
$arr = array();
|
||||||
|
|
||||||
|
while(list($key,$value)=$xmlrpc_val->structeach())
|
||||||
|
{
|
||||||
|
$arr[$key] = xmlrpc_decode($value);
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
}
|
}
|
||||||
return $arr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,43 +517,46 @@
|
|||||||
* *
|
* *
|
||||||
* author: Dan Libby (dan@libby.com) *
|
* author: Dan Libby (dan@libby.com) *
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
function xmlrpc_encode($php_val)
|
if (!function_exists('xmlrpc_encode'))
|
||||||
{
|
{
|
||||||
$type = gettype($php_val);
|
function xmlrpc_encode($php_val)
|
||||||
$xmlrpc_val = CreateObject('phpgwapi.xmlrpcval');
|
|
||||||
|
|
||||||
switch($type)
|
|
||||||
{
|
{
|
||||||
case 'array':
|
$type = gettype($php_val);
|
||||||
case 'object':
|
$xmlrpc_val = CreateObject('phpgwapi.xmlrpcval');
|
||||||
$arr = array();
|
|
||||||
while (list($k,$v) = each($php_val))
|
switch($type)
|
||||||
{
|
{
|
||||||
$arr[$k] = xmlrpc_encode($v);
|
case 'array':
|
||||||
}
|
case 'object':
|
||||||
$xmlrpc_val->addStruct($arr);
|
$arr = array();
|
||||||
break;
|
while (list($k,$v) = each($php_val))
|
||||||
case 'integer':
|
{
|
||||||
$xmlrpc_val->addScalar($php_val, xmlrpcInt);
|
$arr[$k] = xmlrpc_encode($v);
|
||||||
break;
|
}
|
||||||
case 'double':
|
$xmlrpc_val->addStruct($arr);
|
||||||
$xmlrpc_val->addScalar($php_val, xmlrpcDouble);
|
break;
|
||||||
break;
|
case 'integer':
|
||||||
case 'string':
|
$xmlrpc_val->addScalar($php_val, xmlrpcInt);
|
||||||
$xmlrpc_val->addScalar($php_val, xmlrpcString);
|
break;
|
||||||
break;
|
case 'double':
|
||||||
// <G_Giunta_2001-02-29>
|
$xmlrpc_val->addScalar($php_val, xmlrpcDouble);
|
||||||
// Add support for encoding/decoding of booleans, since they are supported in PHP
|
break;
|
||||||
case 'boolean':
|
case 'string':
|
||||||
$xmlrpc_val->addScalar($php_val, xmlrpcBoolean);
|
$xmlrpc_val->addScalar($php_val, xmlrpcString);
|
||||||
break;
|
break;
|
||||||
// </G_Giunta_2001-02-29>
|
// <G_Giunta_2001-02-29>
|
||||||
case 'unknown type':
|
// Add support for encoding/decoding of booleans, since they are supported in PHP
|
||||||
default:
|
case 'boolean':
|
||||||
$xmlrpc_val = false;
|
$xmlrpc_val->addScalar($php_val, xmlrpcBoolean);
|
||||||
break;
|
break;
|
||||||
|
// </G_Giunta_2001-02-29>
|
||||||
|
case 'unknown type':
|
||||||
|
default:
|
||||||
|
$xmlrpc_val = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $xmlrpc_val;
|
||||||
}
|
}
|
||||||
return $xmlrpc_val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// listMethods: either a string, or nothing
|
// listMethods: either a string, or nothing
|
||||||
|
Loading…
Reference in New Issue
Block a user