--- nfo/site/htdocs/netfraggle.php 2004/08/30 02:33:26 1.4 +++ nfo/site/htdocs/netfraggle.php 2004/08/30 11:27:30 1.5 @@ -5,7 +5,7 @@ -------------------------------------------------------------------------------- --- rabit, 01:28 24.08.2004 --- joko, 04:05 30.08.2004 ---- $Id: netfraggle.php,v 1.4 2004/08/30 02:33:26 joko Exp $ +--- $Id: netfraggle.php,v 1.5 2004/08/30 11:27:30 joko Exp $ ------------------------------------------------------------------------------*/ include('inc/common/common.php.inc'); @@ -20,14 +20,16 @@ switch ($type) { case 'XMLRPC': + include('libs/XML/Server.php'); $s = new XML_RPC_Server(array( - "nfo.listTopics" => array("function" => "nfo_list_topics"), - "nfo.listContents" => array("function" => "nfo_list_contents"), - "nfo.getContent" => array("function" => "nfo_get_content"), - "nfo.listUsers" => array("function" => "nfo_list_users"), + "listTopics" => array("function" => "nfo_list_topics"), + "listContents" => array("function" => "nfo_list_contents"), + #"getContent" => array("function" => "nfo_get_content", "signature" => array($xmlrpcStruct, xmlrpcString)), + "getContent" => array("function" => "nfo_get_content"), + "listUsers" => array("function" => "nfo_list_users"), )); break; - case default: + default: break; } @@ -37,12 +39,37 @@ function nfo_list_contents() { } function nfo_get_content($ck) { - $content = cms_getcontent($ck); - return new XML_RPC_Response(new XML_RPC_Value("content", "array" | "struct")); + #nfo_debug_clean(); + #nfo_debug_write("ck: $ck\n"); + $ck = 'Home'; + $content = cms_getcontent('xmlpage', $ck); + nfo_debug_write($content); + #return new XML_RPC_Response(new XML_RPC_Value("content", "string")); + $struct = array(); + foreach ($content as $key => $value) { + $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_users() { } +function nfo_debug_clean() { + #`rm dump`; +} + +function nfo_debug_write($data) { + ob_start(); + print_r($data); + $data = ob_get_clean(); + $f = fopen('dump', 'w+'); + fputs($f, $data); + fclose($f); +} + //------------------------------------------------------------------------------ ?>