/[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.3 by rabit, Mon Aug 30 02:24:58 2004 UTC revision 1.6 by joko, Tue Aug 31 16:43:35 2004 UTC
# Line 4  Line 4 
4  --- NetFraggle client link page.  --- NetFraggle client link page.
5  --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
6  --- rabit, 01:28 24.08.2004  --- rabit, 01:28 24.08.2004
7    --- joko, 04:05 30.08.2004
8  --- $Id$  --- $Id$
9  ------------------------------------------------------------------------------*/  ------------------------------------------------------------------------------*/
10    
11  //include('inc/common/common.php.inc');  include('inc/common/common.php.inc');
12    
13  //------------------------------------------------------------------------------  //------------------------------------------------------------------------------
14    
15  // ...NetFraggle interconnection code...  // ...NetFraggle interconnection code...
16    // by now using XML-RPC, see API-Documentation at:
17    // http://pear.php.net/manual/en/package.webservices.xml-rpc.api.php
18    
19    $type = 'XMLRPC';
20    
21    switch ($type) {
22      case 'XMLRPC':
23        include('libs/XML/Server.php');
24        $s = new XML_RPC_Server(array(
25          "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"),
38          "listUsers" => array("function" => "nfo_list_users"),
39        ));
40        break;
41      default:
42        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_get_content($params) {
50      $ck = $params->getParam(0);
51      $ck = $ck->scalarval();
52      #nfo_debug_clean();
53      #nfo_debug_write($ck);
54      $content = cms_getcontent('xmlpage', $ck);
55      #nfo_debug_write($content);
56      #return new XML_RPC_Response(new XML_RPC_Value("content", "string"));
57      $struct = array();
58      foreach ($content as $key => $value) {
59        $struct[$key] = new XML_RPC_Value($value, "string");
60      }
61      $xmldoc = new XML_RPC_Response(new XML_RPC_Value($struct, "struct"));
62      #nfo_debug_write($xmldoc);
63      #nfo_debug_write($xmldoc->serialize());
64      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() {
118    }
119    
120    function nfo_debug_clean() {
121      `rm dump`;
122    }
123    
124    function nfo_debug_write($data) {
125      ob_start();
126      print_r($data);
127      $data = ob_get_clean();
128      $f = fopen('dump', 'a');
129      fputs($f, $data . "\n");
130      fclose($f);
131    }
132    
133  //------------------------------------------------------------------------------  //------------------------------------------------------------------------------
134    

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

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