--- nfo/site/htdocs/netfraggle.php 2004/09/03 22:43:47 1.7 +++ nfo/site/htdocs/netfraggle.php 2004/09/12 00:42:39 1.9 @@ -5,7 +5,7 @@ -------------------------------------------------------------------------------- --- rabit, 01:28 24.08.2004 --- joko, 04:05 30.08.2004 ---- $Id: netfraggle.php,v 1.7 2004/09/03 22:43:47 joko Exp $ +--- $Id: netfraggle.php,v 1.9 2004/09/12 00:42:39 xabbu Exp $ ------------------------------------------------------------------------------*/ include('inc/common/common.php.inc'); @@ -22,6 +22,10 @@ case 'XMLRPC': include('libs/XML/Server.php'); $s = new XML_RPC_Server(array( + "query" => array( + "function" => "nfo_query" + "signature" => array(array('struct','struct','struct')), + ), "getContent" => array( "function" => "nfo_get_content", "signature" => array(array('struct', 'string')), @@ -45,6 +49,43 @@ #"signature" => array(array($xmlrpcStruct, $xmlrpcString)) #"signature" => array($XML_RPC_Struct, $XML_RPC_String) +function nfo_query($params) { + + $querytxt = $params->getParam(0); + $nqlquery = $querytxt->getval(); + nfo_debug_clean(); + #nfo_debug_write($params); + #nfo_debug_write($nqlquery); + $result = array(); + cms_query($nqlquery,&$result); + #nfo_debug_write($result); + + $structinfo = array(); + $structcontent = array(); + $structfields = array(); + + foreach ($result[0] as $key => $value) { + $structinfo[$key] = new XML_RPC_Value($value,"string"); + } + foreach ($result[1] as $key => $value) { + $structcontent[$key] = new XML_RPC_Value($value,"struct"); + } + foreach ($result[2] as $key => $value) { + $structfields[$key] = new XML_RPC_Value($value,"string"); + } + $struct = array(); + $struct[0] = new XML_RPC_Value($structinfo,"struct"); + $struct[1] = new XML_RPC_Value($structcontent,"struct"); + $struct[2] = new XML_RPC_Value($structfields,"struct"); + + $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); + nfo_debug_write($xmldoc); + #nfo_debug_write($xmldoc->serialize()); + +return $xmldoc; + +} + function nfo_get_content($params) { $ck = $params->getParam(0); @@ -59,17 +100,15 @@ $struct[$key] = new XML_RPC_Value($value, "string"); } $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); - #nfo_debug_write($xmldoc); - #nfo_debug_write($xmldoc->serialize()); return $xmldoc; } function nfo_list_topics($params) { - #nfo_debug_clean(); - #nfo_debug_write($params); - #nfo_debug_write("list_topics"); + nfo_debug_clean(); + nfo_debug_write($params); + nfo_debug_write("list_topics"); $meta = $params->getParam(0); - #nfo_debug_write($meta); + nfo_debug_write($meta); $type = $meta->structmem('type'); $type = $type->scalarval(); #nfo_debug_write("$type");