| 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 |  | foreach ($result[1] as $key => $value)  { | 
| 70 |  | $structcontent[$key] = new XML_RPC_Value($value,"struct"); | 
| 71 |  | } | 
| 72 |  | foreach ($result[2] as $key => $value) { | 
| 73 |  | $structfields[$key] = new XML_RPC_Value($value,"string"); | 
| 74 |  | } | 
| 75 |  | $struct = array(); | 
| 76 |  | $struct[0] = new XML_RPC_Value($structinfo,"struct"); | 
| 77 |  | $struct[1] = new XML_RPC_Value($structcontent,"struct"); | 
| 78 |  | $struct[2] = new XML_RPC_Value($structfields,"struct"); | 
| 79 |  |  | 
| 80 |  | $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); | 
| 81 |  | nfo_debug_write($xmldoc); | 
| 82 |  | #nfo_debug_write($xmldoc->serialize()); | 
| 83 |  |  | 
| 84 |  | return $xmldoc; | 
| 85 |  |  | 
| 86 |  | } | 
| 87 |  |  | 
| 88 |  |  | 
| 89 | function nfo_get_content($params) { | function nfo_get_content($params) { | 
| 90 | $ck = $params->getParam(0); | $ck = $params->getParam(0); | 
| 99 | $struct[$key] = new XML_RPC_Value($value, "string"); | $struct[$key] = new XML_RPC_Value($value, "string"); | 
| 100 | } | } | 
| 101 | $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()); |  | 
| 102 | return $xmldoc; | return $xmldoc; | 
| 103 | } | } | 
| 104 |  |  | 
| 105 | function nfo_list_topics($params) { | function nfo_list_topics($params) { | 
| 106 | nfo_debug_clean(); | nfo_debug_clean(); | 
| 107 | #nfo_debug_write($params); | nfo_debug_write($params); | 
| 108 | #nfo_debug_write("list_topics"); | nfo_debug_write("list_topics"); | 
| 109 | $meta = $params->getParam(0); | $meta = $params->getParam(0); | 
| 110 | #nfo_debug_write($meta); | nfo_debug_write($meta); | 
| 111 | $type = $meta->structmem('type'); | $type = $meta->structmem('type'); | 
| 112 | $type = $type->scalarval(); | $type = $type->scalarval(); | 
| 113 | #nfo_debug_write("$type"); | #nfo_debug_write("$type"); | 
| 114 | $res = cms_getindex($type); | $res = cms_getindex($type); | 
| 115 | nfo_debug_write($res); | #nfo_debug_write($res); | 
| 116 | $newentries = array(); | $newentries = array(); | 
| 117 | $tmp = new XML_RPC_Value(); | $tmp = new XML_RPC_Value(); | 
| 118 | foreach ($res as $entry) { | foreach ($res as $entry) { | 
| 144 | $pass = $pass->scalarval(); | $pass = $pass->scalarval(); | 
| 145 | $common_sessiondata['userdata']['name'] = $user; | $common_sessiondata['userdata']['name'] = $user; | 
| 146 | $common_sessiondata['userdata']['password'] = $pass; | $common_sessiondata['userdata']['password'] = $pass; | 
| 147 | nfo_debug_write($common_sessiondata); | #nfo_debug_write($common_sessiondata); | 
| 148 | $retval = common_checkauthorisation(); | $retval = common_checkauthorisation(); | 
| 149 | return new XML_RPC_Response(new XML_RPC_Value($retval, 'boolean')); | return new XML_RPC_Response(new XML_RPC_Value($retval, 'boolean')); | 
| 150 | } | } |