4 * @author Gaetano Giunta
5 * @copyright (C) 2005-2009 G. Giunta
6 * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
8 * @todo switch params for http compression from 0,1,2 to values to be used directly
9 * @todo do some more sanitization of received parameters
12 // work around magic quotes
13 if (get_magic_quotes_gpc())
15 function stripslashes_deep($value)
17 $value = is_array($value) ?
18 array_map('stripslashes_deep', $value) :
23 $_GET = array_map('stripslashes_deep', $_GET);
27 if ( isset( $_GET['usepost'] ) && $_GET['usepost'] === 'true' )
32 // recover input parameters
38 if (isset($_GET['action']))
40 if (isset($_GET['wstype']) && $_GET['wstype'] == '1')
43 if (isset($_GET['id']))
46 $host = isset($_GET['host']) ? $_GET['host'] : 'localhost'; // using '' will trigger an xmlrpc error...
47 if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2'))
48 $protocol = $_GET['protocol'];
49 if (strpos($host, 'http://') === 0)
50 $host = substr($host, 7);
51 else if (strpos($host, 'https://') === 0)
53 $host = substr($host, 8);
56 $port = isset($_GET['port']) ? $_GET['port'] : '';
57 $path = isset($_GET['path']) ? $_GET['path'] : '';
58 // in case user forgot initial '/' in xmlrpc server path, add it back
59 if ($path && ($path[0]) != '/')
62 if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] == '2'))
63 $debug = $_GET['debug'];
65 $verifyhost = (isset($_GET['verifyhost']) && ($_GET['verifyhost'] == '1' || $_GET['verifyhost'] == '2')) ? $_GET['verifyhost'] : 0;
66 if (isset($_GET['verifypeer']) && $_GET['verifypeer'] == '1')
70 $cainfo= isset($_GET['cainfo']) ? $_GET['cainfo'] : '';
71 $proxy = isset($_GET['proxy']) ? $_GET['proxy'] : 0;
72 if (strpos($proxy, 'http://') === 0)
73 $proxy = substr($proxy, 7);
74 $proxyuser= isset($_GET['proxyuser']) ? $_GET['proxyuser'] : '';
75 $proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : '';
76 $timeout = isset($_GET['timeout']) ? $_GET['timeout'] : 0;
77 if (!is_numeric($timeout))
79 $action = $_GET['action'];
81 $method = isset($_GET['method']) ? $_GET['method'] : '';
82 $methodsig = isset($_GET['methodsig']) ? $_GET['methodsig'] : 0;
83 $payload = isset($_GET['methodpayload']) ? $_GET['methodpayload'] : '';
84 $alt_payload = isset($_GET['altmethodpayload']) ? $_GET['altmethodpayload'] : '';
86 if (isset($_GET['run']) && $_GET['run'] == 'now')
89 $username = isset($_GET['username']) ? $_GET['username'] : '';
90 $password = isset($_GET['password']) ? $_GET['password'] : '';
92 $authtype = (isset($_GET['authtype']) && ($_GET['authtype'] == '2' || $_GET['authtype'] == '8')) ? $_GET['authtype'] : 1;
94 if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] == '1' || $_GET['requestcompression'] == '2'))
95 $requestcompression = $_GET['requestcompression'];
97 $requestcompression = 0;
98 if (isset($_GET['responsecompression']) && ($_GET['responsecompression'] == '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression'] == '3'))
99 $responsecompression = $_GET['responsecompression'];
101 $responsecompression = 0;
103 $clientcookies = isset($_GET['clientcookies']) ? $_GET['clientcookies'] : '';
125 $requestcompression = 0;
126 $responsecompression = 0;
130 // check input for known XMLRPC attacks against this or other libs
131 function payload_is_safe($input)