--- nfo/site/htdocs/netfraggle.php 2004/08/24 03:28:27 1.2 +++ nfo/site/htdocs/netfraggle.php 2004/08/30 11:27:30 1.5 @@ -4,14 +4,71 @@ --- NetFraggle client link page. -------------------------------------------------------------------------------- --- rabit, 01:28 24.08.2004 ---- $Id: netfraggle.php,v 1.2 2004/08/24 03:28:27 rabit Exp $ +--- joko, 04:05 30.08.2004 +--- $Id: netfraggle.php,v 1.5 2004/08/30 11:27:30 joko Exp $ ------------------------------------------------------------------------------*/ -//include('inc/common/common.php.inc'); +include('inc/common/common.php.inc'); //------------------------------------------------------------------------------ // ...NetFraggle interconnection code... +// by now using XML-RPC, see API-Documentation at: +// http://pear.php.net/manual/en/package.webservices.xml-rpc.api.php + +$type = 'XMLRPC'; + +switch ($type) { + case 'XMLRPC': + include('libs/XML/Server.php'); + $s = new XML_RPC_Server(array( + "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; + default: + break; +} + + +function nfo_list_topics() { +} +function nfo_list_contents() { +} +function nfo_get_content($ck) { + #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); +} //------------------------------------------------------------------------------