22 |
case 'XMLRPC': |
case 'XMLRPC': |
23 |
include('libs/XML/Server.php'); |
include('libs/XML/Server.php'); |
24 |
$s = new XML_RPC_Server(array( |
$s = new XML_RPC_Server(array( |
25 |
|
"query" => array( |
26 |
|
"function" => "nfo_query" |
27 |
|
), |
28 |
"getContent" => array( |
"getContent" => array( |
29 |
"function" => "nfo_get_content", |
"function" => "nfo_get_content", |
30 |
"signature" => array(array('struct', 'string')), |
"signature" => array(array('struct', 'string')), |
48 |
#"signature" => array(array($xmlrpcStruct, $xmlrpcString)) |
#"signature" => array(array($xmlrpcStruct, $xmlrpcString)) |
49 |
#"signature" => array($XML_RPC_Struct, $XML_RPC_String) |
#"signature" => array($XML_RPC_Struct, $XML_RPC_String) |
50 |
|
|
51 |
|
function nfo_query($params) { |
52 |
|
|
53 |
|
$querytxt = $params->getParam(0); |
54 |
|
$nqlquery = $querytxt->getval(); |
55 |
|
nfo_debug_clean(); |
56 |
|
#nfo_debug_write($params); |
57 |
|
#nfo_debug_write($nqlquery); |
58 |
|
$result = array(); |
59 |
|
cms_query($nqlquery,&$result); |
60 |
|
nfo_debug_write($result); |
61 |
|
|
62 |
|
$structinfo = array(); |
63 |
|
$structcontent = array(); |
64 |
|
$structfields = array(); |
65 |
|
|
66 |
|
foreach ($result[0] as $key => $value) { |
67 |
|
$structinfo[$key] = new XML_RPC_Value($value,"string"); |
68 |
|
} |
69 |
|
|
70 |
|
#foreach ($result[1] as $key => $value) { |
71 |
|
#$structcontent[$key] = new XML_RPC_Value($value,"struct"); |
72 |
|
# } |
73 |
|
|
74 |
|
foreach ($result[1] as $key => $value) { |
75 |
|
$cdata = array(); |
76 |
|
foreach($value as $item => $data) { |
77 |
|
$cdata[$item] = new XML_RPC_Value($data,"string"); |
78 |
|
} |
79 |
|
$structcontent[$key] = new XML_RPC_Value($cdata,"struct"); |
80 |
|
} |
81 |
|
|
82 |
|
foreach ($result[2] as $key => $value) { |
83 |
|
$structfields[$key] = new XML_RPC_Value($value,"string"); |
84 |
|
} |
85 |
|
$struct = array(); |
86 |
|
$struct[0] = new XML_RPC_Value($structinfo,"struct"); |
87 |
|
$struct[1] = new XML_RPC_Value($structcontent,"struct"); |
88 |
|
$struct[2] = new XML_RPC_Value($structfields,"struct"); |
89 |
|
|
90 |
|
$xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); |
91 |
|
nfo_debug_write($xmldoc); |
92 |
|
#nfo_debug_write($xmldoc->serialize()); |
93 |
|
|
94 |
|
return $xmldoc; |
95 |
|
|
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
function nfo_get_content($params) { |
function nfo_get_content($params) { |
100 |
$ck = $params->getParam(0); |
$ck = $params->getParam(0); |
109 |
$struct[$key] = new XML_RPC_Value($value, "string"); |
$struct[$key] = new XML_RPC_Value($value, "string"); |
110 |
} |
} |
111 |
$xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); |
$xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); |
|
#nfo_debug_write($xmldoc); |
|
|
#nfo_debug_write($xmldoc->serialize()); |
|
112 |
return $xmldoc; |
return $xmldoc; |
113 |
} |
} |
114 |
|
|
115 |
function nfo_list_topics($params) { |
function nfo_list_topics($params) { |
116 |
nfo_debug_clean(); |
nfo_debug_clean(); |
117 |
#nfo_debug_write($params); |
nfo_debug_write($params); |
118 |
#nfo_debug_write("list_topics"); |
nfo_debug_write("list_topics"); |
119 |
$meta = $params->getParam(0); |
$meta = $params->getParam(0); |
120 |
#nfo_debug_write($meta); |
nfo_debug_write($meta); |
121 |
$type = $meta->structmem('type'); |
$type = $meta->structmem('type'); |
122 |
$type = $type->scalarval(); |
$type = $type->scalarval(); |
123 |
#nfo_debug_write("$type"); |
#nfo_debug_write("$type"); |
124 |
$res = cms_getindex($type); |
$res = cms_getindex($type); |
125 |
nfo_debug_write($res); |
#nfo_debug_write($res); |
126 |
$newentries = array(); |
$newentries = array(); |
127 |
$tmp = new XML_RPC_Value(); |
$tmp = new XML_RPC_Value(); |
128 |
foreach ($res as $entry) { |
foreach ($res as $entry) { |
154 |
$pass = $pass->scalarval(); |
$pass = $pass->scalarval(); |
155 |
$common_sessiondata['userdata']['name'] = $user; |
$common_sessiondata['userdata']['name'] = $user; |
156 |
$common_sessiondata['userdata']['password'] = $pass; |
$common_sessiondata['userdata']['password'] = $pass; |
157 |
nfo_debug_write($common_sessiondata); |
#nfo_debug_write($common_sessiondata); |
158 |
$retval = common_checkauthorisation(); |
$retval = common_checkauthorisation(); |
159 |
return new XML_RPC_Response(new XML_RPC_Value($retval, 'boolean')); |
return new XML_RPC_Response(new XML_RPC_Value($retval, 'boolean')); |
160 |
} |
} |