/[cvs]/nfo/site/htdocs/netfraggle.php
ViewVC logotype

Diff of /nfo/site/htdocs/netfraggle.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by joko, Tue Aug 31 16:43:35 2004 UTC revision 1.13 by xabbu, Mon Sep 20 23:38:14 2004 UTC
# Line 22  switch ($type) { Line 22  switch ($type) {
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')),
# Line 45  switch ($type) { Line 48  switch ($type) {
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       if ($key == 'all'){
68        $datall = array();
69        foreach ($result[0][$key] as $keyall => $valall) {
70      
71        if ($keyall == 'fieldlist'){
72             $datall2 = array();
73            foreach ($result[0][$key][$keyall] as $fieldkey => $fieldval){
74              $datall2 = new XML_RPC_Value($fieldval,"string");
75            }
76            $datall[$keyall] = new XML_RPC_Value($datall2,"struct");
77        }else{
78            if($keyall == 'with'){
79             // DO 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        }else{
87           $structinfo[$key] = new XML_RPC_Value($value,"string");
88         }
89       }
90      
91       #foreach ($result[1] as $key => $value)  {
92       #$structcontent[$key] = new XML_RPC_Value($value,"struct");
93       # }
94      
95       foreach ($result[1] as $key => $value)  {
96            $cdata = array();
97            foreach($value as $item => $data) {
98              $cdata[$item] = new XML_RPC_Value($data,"string");
99            }
100         $structcontent[$key] = new XML_RPC_Value($cdata,"struct");  
101       }
102      
103      foreach ($result[2] as $key => $value) {
104       $structfields[$key] = new XML_RPC_Value($value,"string");
105       }
106      $struct = array();
107      $struct[0] = new XML_RPC_Value($structinfo,"struct");
108      $struct[1] = new XML_RPC_Value($structcontent,"struct");
109      $struct[2] = new XML_RPC_Value($structfields,"struct");
110      
111      $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct"));
112      nfo_debug_write($xmldoc);
113      #nfo_debug_write($xmldoc->serialize());
114    
115    return $xmldoc;
116      
117    }
118    
119    
120  function nfo_get_content($params) {  function nfo_get_content($params) {
121    $ck = $params->getParam(0);    $ck = $params->getParam(0);
# Line 59  function nfo_get_content($params) { Line 130  function nfo_get_content($params) {
130      $struct[$key] = new XML_RPC_Value($value, "string");      $struct[$key] = new XML_RPC_Value($value, "string");
131    }    }
132    $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());  
133    return $xmldoc;    return $xmldoc;
134  }  }
135    
136  function nfo_list_topics($params) {  function nfo_list_topics($params) {
137    nfo_debug_clean();    nfo_debug_clean();
138    #nfo_debug_write($params);    nfo_debug_write($params);
139    #nfo_debug_write("list_topics");    nfo_debug_write("list_topics");
140    $meta = $params->getParam(0);    $meta = $params->getParam(0);
141    #nfo_debug_write($meta);    nfo_debug_write($meta);
142    $type = $meta->structmem('type');    $type = $meta->structmem('type');
143    $type = $type->scalarval();    $type = $type->scalarval();
144    #nfo_debug_write("$type");    #nfo_debug_write("$type");
145    $res = cms_getindex($type);    $res = cms_getindex($type);
146    nfo_debug_write($res);    #nfo_debug_write($res);
147    $newentries = array();    $newentries = array();
148    $tmp = new XML_RPC_Value();    $tmp = new XML_RPC_Value();
149    foreach ($res as $entry) {    foreach ($res as $entry) {
# Line 106  function nfo_authenticate($params) { Line 175  function nfo_authenticate($params) {
175    $pass = $pass->scalarval();    $pass = $pass->scalarval();
176    $common_sessiondata['userdata']['name'] = $user;    $common_sessiondata['userdata']['name'] = $user;
177    $common_sessiondata['userdata']['password'] = $pass;    $common_sessiondata['userdata']['password'] = $pass;
178    nfo_debug_write($common_sessiondata);    #nfo_debug_write($common_sessiondata);
179    $retval = common_checkauthorisation();    $retval = common_checkauthorisation();
180    return new XML_RPC_Response(new XML_RPC_Value($retval, 'boolean'));    return new XML_RPC_Response(new XML_RPC_Value($retval, 'boolean'));
181  }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.13

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed