| 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 |  | $datall = array(); | 
| 68 |  | if ($key == 'all'){ | 
| 69 |  | #nfo_debug_write($value); | 
| 70 |  | foreach ($result[0][$key] as $keyall => $valall) { | 
| 71 |  | $datall2 = array(); | 
| 72 |  | if ($keyall == 'fieldlist'){ | 
| 73 |  | foreach ($result[0][$key][$keyall] as $fieldkey => $fieldval) | 
| 74 |  | { | 
| 75 |  | $datall2[$fieldkey] = new XML_RPC_Value($fieldval,"string"); | 
| 76 |  | } | 
| 77 |  | $datall[$keyall] = new XML_RPC_Value($datall2,"struct"); | 
| 78 |  | }elseif($keyall == 'with'){ | 
| 79 |  | //nothing yet | 
| 80 |  | }else{ | 
| 81 |  | $datall[$keyall] = new XML_RPC_Value($valall,"string"); | 
| 82 |  | } | 
| 83 |  | } | 
| 84 |  |  | 
| 85 |  | $structinfo[$key] = new XML_RPC_Value($datall,"struct"); | 
| 86 |  |  | 
| 87 |  | }else{ | 
| 88 |  | $structinfo[$key] = new XML_RPC_Value($value,"string"); | 
| 89 |  | } | 
| 90 |  | } | 
| 91 |  |  | 
| 92 |  | foreach ($result[1] as $key => $value)  { | 
| 93 |  | $cdata = array(); | 
| 94 |  | foreach($value as $item => $data) { | 
| 95 |  | $cdata[$item] = new XML_RPC_Value($data,"string"); | 
| 96 |  | } | 
| 97 |  | $structcontent[$key] = new XML_RPC_Value($cdata,"struct"); | 
| 98 |  | } | 
| 99 |  |  | 
| 100 |  | foreach ($result[2] as $key => $value) { | 
| 101 |  | $structfields[$key] = new XML_RPC_Value($value,"string"); | 
| 102 |  | } | 
| 103 |  |  | 
| 104 |  | $struct = array(); | 
| 105 |  | $struct[0] = new XML_RPC_Value($structinfo,"struct"); | 
| 106 |  | $struct[1] = new XML_RPC_Value($structcontent,"struct"); | 
| 107 |  | $struct[2] = new XML_RPC_Value($structfields,"struct"); | 
| 108 |  |  | 
| 109 |  | $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct")); | 
| 110 |  | #nfo_debug_write($xmldoc); | 
| 111 |  | #nfo_debug_write($xmldoc->serialize()); | 
| 112 |  |  | 
| 113 |  | return $xmldoc; | 
| 114 |  |  | 
| 115 |  | } | 
| 116 |  |  | 
| 117 |  |  | 
| 118 | function nfo_get_content($params) { | function nfo_get_content($params) { | 
| 119 | $ck = $params->getParam(0); | $ck = $params->getParam(0); | 
| 128 | $struct[$key] = new XML_RPC_Value($value, "string"); | $struct[$key] = new XML_RPC_Value($value, "string"); | 
| 129 | } | } | 
| 130 | $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()); |  | 
| 131 | return $xmldoc; | return $xmldoc; | 
| 132 | } | } | 
| 133 |  |  | 
| 134 | function nfo_list_topics($params) { | function nfo_list_topics($params) { | 
| 135 | #nfo_debug_clean(); | nfo_debug_clean(); | 
| 136 | #nfo_debug_write($params); | nfo_debug_write($params); | 
| 137 | #nfo_debug_write("list_topics"); | nfo_debug_write("list_topics"); | 
| 138 | $meta = $params->getParam(0); | $meta = $params->getParam(0); | 
| 139 | #nfo_debug_write($meta); | nfo_debug_write($meta); | 
| 140 | $type = $meta->structmem('type'); | $type = $meta->structmem('type'); | 
| 141 | $type = $type->scalarval(); | $type = $type->scalarval(); | 
| 142 | #nfo_debug_write("$type"); | #nfo_debug_write("$type"); |