Fixed 2.0 bugs
[moodle.git] / mnet / rpclib.php
CommitLineData
1d422980 1<?php
71558f85 2/**
3 * Some dummy functions to test XML-RPC with
4 */
5
6/**
b16393cb 7 * The xxxx_RPC_OK must exist and return TRUE for the remote call to be
71558f85 8 * permitted
b16393cb 9 *
71558f85 10 * @return bool True if the related function can be executed remotely
11 */
12function mnet_concatenate_strings_RPC_OK() {
13 return true;
14}
15
16function mnet_publishes() {
17 $servicelist = array();
8e472337 18 $service['name'] = 'sso';
19 $function['name'] = 'mnet_concatenate_strings';
71558f85 20
8e472337 21 // first argument
22 $argument['type'] = 'string';
23 $argument['default'] = '';
24 $function['arguments'][] = $argument;
71558f85 25
8e472337 26 // second argument
27 $argument['type'] = 'string';
28 $argument['default'] = '';
29 $function['arguments'][] = $argument;
71558f85 30
8e472337 31 // third argument
32 $argument['type'] = 'string';
33 $argument['default'] = '';
34 $function['arguments'][] = $argument;
8503aae4 35
8e472337 36 $function['description'] = get_string($function['name'], 'mnet');
37 $service['functions'][] = $function;
71558f85 38 $servicelist[] = $service;
39
40 return $servicelist;
41}
42//header('Content-type: text/plain');
43//var_dump(mnet_publishes());
44
45/**
46 * Concatenate (up to) 3 strings and return the result
47 * @service sso
48 * @param string $string1 Some string
49 * @param string $string2 Some string
50 * @param string $string3 Some string
51 * @return string The parameter strings, concatenated together
52 */
53function mnet_concatenate_strings($string1='', $string2='', $string3='') {
54 return $string1.$string2.$string3;
55}
56
57class testClass {
58 function testClass() {
59 $this->first = 'last';
60 $this->last = 'first';
61 }
1d422980 62
71558f85 63 function augment_first($newval) {
64 $this->first = $this->first.$newval;
65 return $this->first;
66 }
1d422980 67
71558f85 68 function augment_first_RPC_OK() {
69 return true;
70 }
1d422980 71
71558f85 72 function mnet_concatenate_strings_RPC_OK() {
73 return true;
74 }
75 function mnet_concatenate_strings($string1='', $string2='', $string3='') {
76 return $string1.$string2.$string3;
77 }
78}