| 20 |
|
|
| 21 |
switch ($type) { |
switch ($type) { |
| 22 |
case 'XMLRPC': |
case 'XMLRPC': |
| 23 |
|
include('libs/XML/Server.php'); |
| 24 |
$s = new XML_RPC_Server(array( |
$s = new XML_RPC_Server(array( |
| 25 |
"nfo.listTopics" => array("function" => "nfo_list_topics"), |
"listTopics" => array("function" => "nfo_list_topics"), |
| 26 |
"nfo.listContents" => array("function" => "nfo_list_contents"), |
"listContents" => array("function" => "nfo_list_contents"), |
| 27 |
"nfo.getContent" => array("function" => "nfo_get_content"), |
#"getContent" => array("function" => "nfo_get_content", "signature" => array($xmlrpcStruct, xmlrpcString)), |
| 28 |
"nfo.listUsers" => array("function" => "nfo_list_users"), |
"getContent" => array("function" => "nfo_get_content"), |
| 29 |
|
"listUsers" => array("function" => "nfo_list_users"), |
| 30 |
)); |
)); |
| 31 |
break; |
break; |
| 32 |
case default: |
default: |
| 33 |
break; |
break; |
| 34 |
} |
} |
| 35 |
|
|
| 39 |
function nfo_list_contents() { |
function nfo_list_contents() { |
| 40 |
} |
} |
| 41 |
function nfo_get_content($ck) { |
function nfo_get_content($ck) { |
| 42 |
$content = cms_getcontent($ck); |
#nfo_debug_clean(); |
| 43 |
return new XML_RPC_Response(new XML_RPC_Value("content", "array" | "struct")); |
#nfo_debug_write("ck: $ck\n"); |
| 44 |
|
$ck = 'Home'; |
| 45 |
|
$content = cms_getcontent('xmlpage', $ck); |
| 46 |
|
nfo_debug_write($content); |
| 47 |
|
#return new XML_RPC_Response(new XML_RPC_Value("content", "string")); |
| 48 |
|
$struct = array(); |
| 49 |
|
foreach ($content as $key => $value) { |
| 50 |
|
$struct[$key] = new XML_RPC_Value($value, "string"); |
| 51 |
|
} |
| 52 |
|
$xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); |
| 53 |
|
#nfo_debug_write($xmldoc); |
| 54 |
|
nfo_debug_write($xmldoc->serialize()); |
| 55 |
|
return $xmldoc; |
| 56 |
} |
} |
| 57 |
function nfo_list_users() { |
function nfo_list_users() { |
| 58 |
} |
} |
| 59 |
|
|
| 60 |
|
function nfo_debug_clean() { |
| 61 |
|
#`rm dump`; |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
function nfo_debug_write($data) { |
| 65 |
|
ob_start(); |
| 66 |
|
print_r($data); |
| 67 |
|
$data = ob_get_clean(); |
| 68 |
|
$f = fopen('dump', 'w+'); |
| 69 |
|
fputs($f, $data); |
| 70 |
|
fclose($f); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
//------------------------------------------------------------------------------ |
//------------------------------------------------------------------------------ |
| 74 |
|
|
| 75 |
?> |
?> |