]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/xmlrpc/xmlrpc-servers.php
more tests
[SourceForge/phpwiki.git] / tests / xmlrpc / xmlrpc-servers.php
1 <?php
2 /**
3   * List of various interop and wiki servers to test against.
4   * interop for the basic library functionality, and then the wiki API.
5   */
6
7 if (empty($GLOBALS['SERVER_NAME'])) {
8     global $HTTP_SERVER_VARS;
9     $GLOBALS['SERVER_NAME'] = $HTTP_SERVER_VARS['SERVER_NAME'];
10     $GLOBALS['SERVER_PORT'] = $HTTP_SERVER_VARS['SERVER_PORT'];
11     $GLOBALS['PHP_SELF'] = $HTTP_SERVER_VARS['SCRIPT_NAME'];
12 }
13
14 function get_user_server() {
15    return
16    array('title' => "user defined",
17          'desc' => "Enter your own server to test against",
18          'args' => null,
19          'host' => $GLOBALS['HTTP_GET_VARS']['user_host'],
20          'uri' => $GLOBALS['HTTP_GET_VARS']['user_uri'],
21          'port' => ($GLOBALS['HTTP_GET_VARS']['user_port'] ? $GLOBALS['HTTP_GET_VARS']['user_port'] : 80),
22          'type' => "user"
23          );
24 }
25
26 function get_wiki_servers($include_user=true) {
27    $list = 
28    array (
29       array('title' => " local ",
30             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/../../index.php",
31             'args' => null,
32             'host' => $GLOBALS['SERVER_NAME'],
33             'uri' => dirname($GLOBALS['PHP_SELF'])."/../../index.php",
34             'port' => $GLOBALS['SERVER_PORT'],
35             "default" => true
36             ),
37       array('title' => "local dba-test",
38             'info_link' => "http://".$GLOBALS['SERVER_NAME']."/wiki/dba",
39             'args' => null,
40             'host' => $GLOBALS['SERVER_NAME'],
41             'uri' => "/wiki/dba",
42             'port' => 80
43             ),
44       array('title' => "local pear-test",
45             'info_link' => "http://".$GLOBALS['SERVER_NAME']."/wiki/pear",
46             'args' => null,
47             'host' => $GLOBALS['SERVER_NAME'],
48             'uri' => "/wiki/pear",
49             'port' => 80
50             ),
51       array('title' => "local adodb-test",
52             'info_link' => "http://".$GLOBALS['SERVER_NAME']."/wiki/adodb",
53             'args' => null,
54             'host' => $GLOBALS['SERVER_NAME'],
55             'uri' => "/wiki/adodb",
56             'port' => 80
57             ),
58       array('title' => "PhpWiki",
59             'info_link' => "http://phpwiki.sourceforge.net/phpwiki/",
60             'args' => null,
61             'host' => "phpwiki.sourceforge.net",
62             'uri' => "/phpwiki/",
63             'port' => 80
64             ),
65       array('title' => "PhpWikiDemo",
66             'info_link' => "http://phpwiki.sourceforge.net/demo/",
67             'args' => null,
68             'host' => "phpwiki.sourceforge.net",
69             'uri' => "/demo/",
70             'port' => 80
71             ),
72       );
73
74    if($include_user) {
75       $list[] = get_user_server();
76    }
77
78    return $list;
79 }
80
81 function get_intro_useful_servers($include_user=true) {
82    $list = 
83    array (
84       array('title' => "xmlrpc-epi ( local! )",
85             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/interop-server.php",
86             'args' => null,
87             'host' => $GLOBALS['SERVER_NAME'],
88             'uri' => substr($GLOBALS['PHP_SELF'], 0, strrpos($GLOBALS['PHP_SELF'], "/") + 1) . "interop-server.php",
89             'port' => $GLOBALS['SERVER_PORT'],
90             "default" => true
91             ),
92       array('title' => "Meerkat",
93             'info_link' => "http://www.oreillynet.com/meerkat/xml-rpc/",
94             'args' => null,
95             'host' => "www.oreillynet.com",
96             'uri' => "/meerkat/xml-rpc/server.php",
97             'port' => 80
98             ),
99       array('title' => "Usefulinc",
100             'info_link' => "http://xmlrpc.usefulinc.com/php.html",
101             'args' => null,
102             'host' => "xmlrpc.usefulinc.com",
103             'uri' => "/demo/server.php",
104             'port' => 80
105             ),
106       );
107
108    if($include_user) {
109       $list[] = get_user_server();
110    }
111
112    return $list;
113 }
114
115 function get_introspection_servers($include_user=true) {
116    $list = 
117    array (
118       array('title' => "xmlrpc-epi interop server",
119             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/interop-server.php",
120             'args' => null,
121             'host' => $GLOBALS['SERVER_NAME'],
122             'uri' => substr($GLOBALS['PHP_SELF'], 0, strrpos($GLOBALS['PHP_SELF'], "/") + 1) . "interop-server.php",
123             'port' => $GLOBALS['SERVER_PORT'],
124             "default" => true
125             ),
126       array('title' => "xmlrpc-epi validation server",
127             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/validate.php",
128             'args' => null,
129             'host' => $GLOBALS['SERVER_NAME'],
130             'uri' => substr($GLOBALS['PHP_SELF'], 0, strrpos($GLOBALS['PHP_SELF'], "/") + 1) . "validate.php",
131             'port' => $GLOBALS['SERVER_PORT'],
132             ),
133       );
134
135    if($include_user) {
136       $list[] = get_user_server();
137    }
138
139    return $list;
140 }
141
142
143 function get_interop_servers($include_user=true) {
144    global $HTTP_SERVER_VARS;
145    $list = 
146    array (
147       array('title' => "local xmlrpc interop-server",
148             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/interop-server.php",
149             'desc' => "a php C extension utilizing the xmlrpc-epi library.  running locally.  by Dan Libby",
150             'args' => "",
151             'host' => $HTTP_SERVER_VARS['SERVER_NAME'],
152             'uri' => dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) . "/interop-server.php",
153             'port' => $HTTP_SERVER_VARS['SERVER_PORT'],
154             "default" => true
155             ),
156       array('title' => "Frontier 7.0b43",
157             'info_link' => "http://groups.yahoo.com/group/xml-rpc/message/2585",
158             'desc' => "Jake Savin's Server.  First Interop Node",
159             'args' => "",
160             'host' => "www.soapware.org",
161             'uri' => "/RPC2",
162             'port' => 80
163             ),
164       array('title' => "XMLRPC.Net",
165             'info_link' => "http://aspx.securedomains.com/cookcomputing/interopechotests.aspx",
166             'desc' => "client/server by Charles Cook",
167             'args' => "",
168             'host' => "aspx.securedomains.com",
169             'uri' => "/cookcomputing/interopechotests.aspx",
170             'port' => 80
171             ),
172       array('title' => "xmlrpc-c",
173             'info_link' => "http://xmlrpc-c.sourceforge.net",
174             'desc' => "a C library by Eric Kidd",
175             'args' => "",
176             'host' => "xmlrpc-c.sourceforge.net",
177             'uri' => "/cgi-bin/interop.cgi",
178             'port' => 80
179             ),
180       array('title' => "Usefulinc",
181             'info_link' => "http://xmlrpc.usefulinc.com/",
182             'desc' => "a PHP script library by Edd Dumbill",
183             'args' => "",
184             'host' => "xmlrpc.usefulinc.com",
185             'uri' => "/demo/server.php",
186             'port' => 80
187             ),
188       array('title' => "XML-RPC for ASP",
189             'info_link' => "http://aspxmlrpc.sourceforge.net",
190             'args' => "",
191             'host' => "www.wc.cc.va.us",
192             'uri' => "/dtod/xmlrpc/testing/interop.asp",
193             'port' => 80
194             ),
195       array('title' => "Frontier-RPC 0.07b3 (Perl)",
196             'args' => "",
197             'host' => "bitsko.slc.ut.us",
198             'uri' => "/cgi-bin/interop.pl",
199             'port' => 80
200             ),
201       array('title' => "XMLRPC::Lite, v0.50",
202             'args' => "",
203             'host' => "xmlrpc.soaplite.com",
204             'uri' => "/interop.cgi",
205             'port' => 80
206             )
207    );
208
209    if($include_user) {
210       $list[] = get_user_server();
211    }
212
213    return $list;
214 }
215
216 function print_servers_form($server_list, $action_url=false, $print_user=true) {
217    $action = $action_url ? "action='$action_url'" : "";
218
219    echo "<form method='get' $action>";
220
221    foreach ($server_list as $key => $server) {
222       $title = $server['title'];
223       $link = $server['info_link'];
224       $type = $server['type'];
225       $port = $server['port'];
226       $default = $server["default"] ? "checked" : "";
227       if($link) {
228          $title = "<a href='$link'>$title</a>";
229       }
230       echo "<input type='radio' name='server' value='$key' $default>&nbsp;$title<br>";
231       
232       if($type === "user") {
233          echo "<DL><DT><DL><DT>host: <input type='text' name='user_host' size='50'></DT>" .
234               "<DT>uri: <input type='text' name='user_uri' size='50'>" .
235               "<DT>port: <input type='text' name='user_port' size='4' MAXLENGTH='4' VALUE='$port'></DT></DL></DT></DL>";
236          
237       }
238    }
239    if ($GLOBALS['HTTP_GET_VARS']['start_debug'])
240        echo "<input type='hidden' name='start_debug' value='1'>";
241    echo <<< END
242    <h3>Verbosity level</h3>
243       <input type='radio' name='debug' value='0' checked>none &nbsp;&nbsp;
244       <input type='radio' name='debug' value='1'>some &nbsp;&nbsp;
245       <input type='radio' name='debug' value='2'>much &nbsp;&nbsp;
246
247         <h3>XML Serialization</h3>
248                 <input type='radio' name='version' value='xmlrpc' checked>XML-RPC &nbsp;&nbsp;
249                 <input type='radio' name='version' value='soap 1.1'>SOAP &nbsp;&nbsp;
250                 <input type='radio' name='version' value='simple'>simpleRPC &nbsp;&nbsp;
251 <p>
252 <input type='submit' value='Start test'>
253 </form>
254
255 END;
256 }
257
258 function get_server_from_user($server_list) {
259    return $server_list[$GLOBALS['HTTP_GET_VARS']['server']];
260 }
261
262 function server_uri_vars() {
263    extract($GLOBALS['HTTP_GET_VARS']);
264    return "server=$server&user_host=$user_host&user_port=$user_port&user_uri=$user_uri";
265 }
266
267 function server_vars() {
268    extract($GLOBALS['HTTP_GET_VARS']);
269    return array(
270       'server' => $server,
271       'user_host' => $user_host,
272       'user_port' => $user_port,
273       'user_uri' => $user_uri
274       );
275 }
276
277 ?>