merge upstream phpxmlrpc
[plcapi.git] / php / phpxmlrpc / lib / xmlrpcs.inc
1 <?php
2 // by Edd Dumbill (C) 1999-2002
3 // <edd@usefulinc.com>
4
5 // Copyright (c) 1999,2000,2002 Edd Dumbill.
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 //    * Redistributions of source code must retain the above copyright
13 //      notice, this list of conditions and the following disclaimer.
14 //
15 //    * Redistributions in binary form must reproduce the above
16 //      copyright notice, this list of conditions and the following
17 //      disclaimer in the documentation and/or other materials provided
18 //      with the distribution.
19 //
20 //    * Neither the name of the "XML-RPC for PHP" nor the names of its
21 //      contributors may be used to endorse or promote products derived
22 //      from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 // REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35 // OF THE POSSIBILITY OF SUCH DAMAGE.
36
37 /******************************************************************************
38  *
39  * *** DEPRECATED ***
40  *
41  * This file is only used to insure backwards compatibility
42  * with the API of the library <= rev. 3
43  *****************************************************************************/
44
45 include_once(__DIR__.'/../src/Server.php');
46
47 use PhpXmlRpc\Server;
48
49 class xmlrpc_server extends Server
50 {
51     /**
52      * A debugging routine: just echoes back the input packet as a string value
53      * @deprecated
54      */
55     public function echoInput()
56     {
57         $r = new PhpXmlRpc\Response(new PhpXmlRpc\Value("'Aha said I: '" . file_get_contents('php://input'), 'string'));
58         print $r->serialize();
59     }
60
61     /**
62      * Reinstate access to class members which became protected/private
63      * @param string $name
64      * @return mixed
65      */
66     public function __get($name)
67     {
68         switch($name) {
69             case 'dmap':
70                 return $this->dmap;
71             default:
72                 trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' .
73                     $trace[0]['line'], E_USER_NOTICE);
74                 return null;
75         }
76     }
77
78     /**
79      * @param string $name
80      * @return bool
81      */
82     public function __isset($name)
83     {
84         return $name === 'dmap';
85     }
86 }
87
88 /* Expose as global functions the ones which are now class methods */
89
90 /**
91  * @see Server::xmlrpc_debugmsg
92  * @param string $m
93  */
94 function xmlrpc_debugmsg($m)
95 {
96     Server::xmlrpc_debugmsg($m);
97 }
98
99 function _xmlrpcs_getCapabilities($server, $m=null)
100 {
101     return Server::_xmlrpcs_getCapabilities($server, $m);
102 }
103
104 $_xmlrpcs_listMethods_sig=array(array(\PhpXmlRpc\Value::$xmlrpcArray));
105 $_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
106 $_xmlrpcs_listMethods_sdoc=array(array('list of method names'));
107 function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing
108 {
109     return Server::_xmlrpcs_listMethods($server, $m);
110 }
111
112 $_xmlrpcs_methodSignature_sig=array(array(\PhpXmlRpc\Value::$xmlrpcArray, $GLOBALS['xmlrpcString']));
113 $_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
114 $_xmlrpcs_methodSignature_sdoc=array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described'));
115 function _xmlrpcs_methodSignature($server, $m)
116 {
117     return Server::_xmlrpcs_methodSignature($server, $m);
118 }
119
120 $_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
121 $_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
122 $_xmlrpcs_methodHelp_sdoc=array(array('method description', 'name of the method to be described'));
123 function _xmlrpcs_methodHelp($server, $m)
124 {
125     return Server::_xmlrpcs_methodHelp($server, $m);
126 }
127
128 function _xmlrpcs_multicall_error($err)
129 {
130     return Server::_xmlrpcs_multicall_error($err);
131 }
132
133 function _xmlrpcs_multicall_do_call($server, $call)
134 {
135     return Server::_xmlrpcs_multicall_do_call($server, $call);
136 }
137
138 function _xmlrpcs_multicall_do_call_phpvals($server, $call)
139 {
140     return Server::_xmlrpcs_multicall_do_call_phpvals($server, $call);
141 }
142
143 $_xmlrpcs_multicall_sig = array(array(\PhpXmlRpc\Value::$xmlrpcArray, \PhpXmlRpc\Value::$xmlrpcArray));
144 $_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details';
145 $_xmlrpcs_multicall_sdoc = array(array('list of response structs, where each struct has the usual members', 'list of calls, with each call being represented as a struct, with members "methodname" and "params"'));
146 function _xmlrpcs_multicall($server, $m)
147 {
148     return Server::_xmlrpcs_multicall($server, $m);
149 }