]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/xmlrpc/xmlrpc-servers.php
php_closing_tag [PSR-2] The closing ?> tag MUST be omitted from files containing...
[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 function get_interop_servers($include_user=true) {
143    global $HTTP_SERVER_VARS;
144    $list =
145    array (
146       array('title' => "local xmlrpc interop-server",
147             'info_link' => "http://".$GLOBALS['SERVER_NAME'].dirname($GLOBALS['PHP_SELF'])."/interop-server.php",
148             'desc' => "a php C extension utilizing the xmlrpc-epi library.  running locally.  by Dan Libby",
149             'args' => "",
150             'host' => $HTTP_SERVER_VARS['SERVER_NAME'],
151             'uri' => dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) . "/interop-server.php",
152             'port' => $HTTP_SERVER_VARS['SERVER_PORT'],
153             "default" => true
154             ),
155       array('title' => "Frontier 7.0b43",
156             'info_link' => "http://groups.yahoo.com/group/xml-rpc/message/2585",
157             'desc' => "Jake Savin's Server.  First Interop Node",
158             'args' => "",
159             'host' => "www.soapware.org",
160             'uri' => "/RPC2",
161             'port' => 80
162             ),
163       array('title' => "XMLRPC.Net",
164             'info_link' => "http://aspx.securedomains.com/cookcomputing/interopechotests.aspx",
165             'desc' => "client/server by Charles Cook",
166             'args' => "",
167             'host' => "aspx.securedomains.com",
168             'uri' => "/cookcomputing/interopechotests.aspx",
169             'port' => 80
170             ),
171       array('title' => "xmlrpc-c",
172             'info_link' => "http://xmlrpc-c.sourceforge.net",
173             'desc' => "a C library by Eric Kidd",
174             'args' => "",
175             'host' => "xmlrpc-c.sourceforge.net",
176             'uri' => "/cgi-bin/interop.cgi",
177             'port' => 80
178             ),
179       array('title' => "Usefulinc",
180             'info_link' => "http://xmlrpc.usefulinc.com/",
181             'desc' => "a PHP script library by Edd Dumbill",
182             'args' => "",
183             'host' => "xmlrpc.usefulinc.com",
184             'uri' => "/demo/server.php",
185             'port' => 80
186             ),
187       array('title' => "XML-RPC for ASP",
188             'info_link' => "http://aspxmlrpc.sourceforge.net",
189             'args' => "",
190             'host' => "www.wc.cc.va.us",
191             'uri' => "/dtod/xmlrpc/testing/interop.asp",
192             'port' => 80
193             ),
194       array('title' => "Frontier-RPC 0.07b3 (Perl)",
195             'args' => "",
196             'host' => "bitsko.slc.ut.us",
197             'uri' => "/cgi-bin/interop.pl",
198             'port' => 80
199             ),
200       array('title' => "XMLRPC::Lite, v0.50",
201             'args' => "",
202             'host' => "xmlrpc.soaplite.com",
203             'uri' => "/interop.cgi",
204             'port' => 80
205             )
206    );
207
208    if($include_user) {
209       $list[] = get_user_server();
210    }
211
212    return $list;
213 }
214
215 function print_servers_form($server_list, $action_url=false, $print_user=true) {
216    $action = $action_url ? "action='$action_url'" : "";
217
218    echo "<form method='get' $action>";
219
220    foreach ($server_list as $key => $server) {
221       $title = $server['title'];
222       $link = $server['info_link'];
223       $type = $server['type'];
224       $port = $server['port'];
225       $default = $server["default"] ? "checked" : "";
226       if($link) {
227          $title = "<a href='$link'>$title</a>";
228       }
229       echo "<input type='radio' name='server' value='$key' $default>&nbsp;$title<br>";
230
231       if($type === "user") {
232          echo "<DL><DT><DL><DT>host: <input type='text' name='user_host' size='50'></DT>" .
233               "<DT>uri: <input type='text' name='user_uri' size='50'>" .
234               "<DT>port: <input type='text' name='user_port' size='4' MAXLENGTH='4' VALUE='$port'></DT></DL></DT></DL>";
235
236       }
237    }
238    if ($GLOBALS['HTTP_GET_VARS']['start_debug'])
239        echo "<input type='hidden' name='start_debug' value='1'>";
240    echo <<< END
241    <h3>Verbosity level</h3>
242       <input type='radio' name='debug' value='0' checked>none &nbsp;&nbsp;
243       <input type='radio' name='debug' value='1'>some &nbsp;&nbsp;
244       <input type='radio' name='debug' value='2'>much &nbsp;&nbsp;
245
246     <h3>XML Serialization</h3>
247         <input type='radio' name='version' value='xmlrpc' checked>XML-RPC &nbsp;&nbsp;
248         <input type='radio' name='version' value='soap 1.1'>SOAP &nbsp;&nbsp;
249         <input type='radio' name='version' value='simple'>simpleRPC &nbsp;&nbsp;
250 <p>
251 <input type='submit' value='Start test'>
252 </form>
253
254 END;
255 }
256
257 function get_server_from_user($server_list) {
258    return $server_list[$GLOBALS['HTTP_GET_VARS']['server']];
259 }
260
261 function server_uri_vars() {
262    extract($GLOBALS['HTTP_GET_VARS']);
263    return "server=$server&user_host=$user_host&user_port=$user_port&user_uri=$user_uri";
264 }
265
266 function server_vars() {
267    extract($GLOBALS['HTTP_GET_VARS']);
268    return array(
269       'server' => $server,
270       'user_host' => $user_host,
271       'user_port' => $user_port,
272       'user_uri' => $user_uri
273       );
274 }