/[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.5 by joko, Mon Aug 30 11:27:30 2004 UTC revision 1.6 by joko, Tue Aug 31 16:43:35 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        "listTopics" => array("function" => "nfo_list_topics"),        "getContent" => array(
26            "function" => "nfo_get_content",
27            "signature" => array(array('struct', 'string')),
28          ),
29          "listTopics" => array(
30            "function" => "nfo_list_topics",
31            "signature" => array(array('struct', 'struct')),
32          ),
33          "authenticate" => array(
34            "function" => "nfo_authenticate",
35            "signature" => array(array('boolean', 'struct')),
36          ),
37        "listContents" => array("function" => "nfo_list_contents"),        "listContents" => array("function" => "nfo_list_contents"),
       #"getContent" => array("function" => "nfo_get_content", "signature" => array($xmlrpcStruct, xmlrpcString)),  
       "getContent" => array("function" => "nfo_get_content"),  
38        "listUsers" => array("function" => "nfo_list_users"),        "listUsers" => array("function" => "nfo_list_users"),
39      ));      ));
40      break;      break;
41    default:    default:
42      break;      break;
43  }  }
44          #"getContent" => array("function" => "nfo_get_content"),
45            #"signature" => array(array($xmlrpcStruct, $xmlrpcString))
46            #"signature" => array($XML_RPC_Struct, $XML_RPC_String)
47    
48    
49  function nfo_list_topics() {  function nfo_get_content($params) {
50  }    $ck = $params->getParam(0);
51  function nfo_list_contents() {    $ck = $ck->scalarval();
 }  
 function nfo_get_content($ck) {  
52    #nfo_debug_clean();    #nfo_debug_clean();
53    #nfo_debug_write("ck: $ck\n");    #nfo_debug_write($ck);
   $ck = 'Home';  
54    $content = cms_getcontent('xmlpage', $ck);    $content = cms_getcontent('xmlpage', $ck);
55    nfo_debug_write($content);    #nfo_debug_write($content);
56    #return new XML_RPC_Response(new XML_RPC_Value("content", "string"));    #return new XML_RPC_Response(new XML_RPC_Value("content", "string"));
57    $struct = array();    $struct = array();
58    foreach ($content as $key => $value) {    foreach ($content as $key => $value) {
# Line 51  function nfo_get_content($ck) { Line 60  function nfo_get_content($ck) {
60    }    }
61    $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct"));    $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct"));
62    #nfo_debug_write($xmldoc);    #nfo_debug_write($xmldoc);
63    nfo_debug_write($xmldoc->serialize());    #nfo_debug_write($xmldoc->serialize());
64    return $xmldoc;    return $xmldoc;
65  }  }
66    
67    function nfo_list_topics($params) {
68      nfo_debug_clean();
69      #nfo_debug_write($params);
70      #nfo_debug_write("list_topics");
71      $meta = $params->getParam(0);
72      #nfo_debug_write($meta);
73      $type = $meta->structmem('type');
74      $type = $type->scalarval();
75      #nfo_debug_write("$type");
76      $res = cms_getindex($type);
77      nfo_debug_write($res);
78      $newentries = array();
79      $tmp = new XML_RPC_Value();
80      foreach ($res as $entry) {
81        $newentry = array();
82        foreach ($entry as $key => $value) {
83           $newvalue = new XML_RPC_Value($value, 'string');
84           $newentry[$key] = $newvalue;
85        }
86        #$tmp->addStruct($newentry);
87        array_push($newentries, new XML_RPC_Value($newentry, 'struct'));
88      }
89      $final = new XML_RPC_Value($newentries, 'array');
90      #$final->addArray($tmp);
91      #nfo_debug_write($final);
92      #$res = array('key' => new XML_RPC_Value('value', 'string'));
93      $msg = new XML_RPC_Response($final);
94      #nfo_debug_write($msg);
95      return $msg;
96    }
97    
98    function nfo_authenticate($params) {
99      global $common_sessiondata;
100      #nfo_debug_clean();
101      #nfo_debug_write($params);
102      $meta = $params->getParam(0);
103      $user = $meta->structmem('user');
104      $user = $user->scalarval();
105      $pass = $meta->structmem('pass');
106      $pass = $pass->scalarval();
107      $common_sessiondata['userdata']['name'] = $user;
108      $common_sessiondata['userdata']['password'] = $pass;
109      nfo_debug_write($common_sessiondata);
110      $retval = common_checkauthorisation();
111      return new XML_RPC_Response(new XML_RPC_Value($retval, 'boolean'));
112    }
113    
114    function nfo_list_contents() {
115    }
116    
117  function nfo_list_users() {  function nfo_list_users() {
118  }  }
119    
120  function nfo_debug_clean() {  function nfo_debug_clean() {
121    #`rm dump`;    `rm dump`;
122  }  }
123    
124  function nfo_debug_write($data) {  function nfo_debug_write($data) {
125    ob_start();    ob_start();
126    print_r($data);    print_r($data);
127    $data = ob_get_clean();    $data = ob_get_clean();
128    $f = fopen('dump', 'w+');    $f = fopen('dump', 'a');
129    fputs($f, $data);    fputs($f, $data . "\n");
130    fclose($f);    fclose($f);
131  }  }
132    

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

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