3 * @author Gaetano Giunta
4 * @copyright (C) 2005-2013 G. Giunta
5 * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
7 * @todo switch params for http compression from 0,1,2 to values to be used directly
8 * @todo do some more sanitization of received parameters
11 // work around magic quotes
12 if (get_magic_quotes_gpc())
14 function stripslashes_deep($value)
16 $value = is_array($value) ?
17 array_map('stripslashes_deep', $value) :
22 $_GET = array_map('stripslashes_deep', $_GET);
26 if ( isset( $_GET['usepost'] ) && $_GET['usepost'] === 'true' )
31 // recover input parameters
37 if (isset($_GET['action']))
39 if (isset($_GET['wstype']) && $_GET['wstype'] == '1')
42 if (isset($_GET['id']))
45 $host = isset($_GET['host']) ? $_GET['host'] : 'localhost'; // using '' will trigger an xmlrpc error...
46 if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2'))
47 $protocol = $_GET['protocol'];
48 if (strpos($host, 'http://') === 0)
49 $host = substr($host, 7);
50 else if (strpos($host, 'https://') === 0)
52 $host = substr($host, 8);
55 $port = isset($_GET['port']) ? $_GET['port'] : '';
56 $path = isset($_GET['path']) ? $_GET['path'] : '';
57 // in case user forgot initial '/' in xmlrpc server path, add it back
58 if ($path && ($path[0]) != '/')
61 if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] == '2'))
62 $debug = $_GET['debug'];
64 $verifyhost = (isset($_GET['verifyhost']) && ($_GET['verifyhost'] == '1' || $_GET['verifyhost'] == '2')) ? $_GET['verifyhost'] : 0;
65 if (isset($_GET['verifypeer']) && $_GET['verifypeer'] == '1')
69 $cainfo= isset($_GET['cainfo']) ? $_GET['cainfo'] : '';
70 $proxy = isset($_GET['proxy']) ? $_GET['proxy'] : 0;
71 if (strpos($proxy, 'http://') === 0)
72 $proxy = substr($proxy, 7);
73 $proxyuser= isset($_GET['proxyuser']) ? $_GET['proxyuser'] : '';
74 $proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : '';
75 $timeout = isset($_GET['timeout']) ? $_GET['timeout'] : 0;
76 if (!is_numeric($timeout))
78 $action = $_GET['action'];
80 $method = isset($_GET['method']) ? $_GET['method'] : '';
81 $methodsig = isset($_GET['methodsig']) ? $_GET['methodsig'] : 0;
82 $payload = isset($_GET['methodpayload']) ? $_GET['methodpayload'] : '';
83 $alt_payload = isset($_GET['altmethodpayload']) ? $_GET['altmethodpayload'] : '';
85 if (isset($_GET['run']) && $_GET['run'] == 'now')
88 $username = isset($_GET['username']) ? $_GET['username'] : '';
89 $password = isset($_GET['password']) ? $_GET['password'] : '';
91 $authtype = (isset($_GET['authtype']) && ($_GET['authtype'] == '2' || $_GET['authtype'] == '8')) ? $_GET['authtype'] : 1;
93 if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] == '1' || $_GET['requestcompression'] == '2'))
94 $requestcompression = $_GET['requestcompression'];
96 $requestcompression = 0;
97 if (isset($_GET['responsecompression']) && ($_GET['responsecompression'] == '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression'] == '3'))
98 $responsecompression = $_GET['responsecompression'];
100 $responsecompression = 0;
102 $clientcookies = isset($_GET['clientcookies']) ? $_GET['clientcookies'] : '';
124 $requestcompression = 0;
125 $responsecompression = 0;
129 // check input for known XMLRPC attacks against this or other libs
130 function payload_is_safe($input)