Index: xmlrpc.php =================================================================== RCS file: /cvs/drupal/drupal/xmlrpc.php,v retrieving revision 1.12 diff -u -F^f -r1.12 xmlrpc.php --- xmlrpc.php 23 Jul 2005 05:57:27 -0000 1.12 +++ xmlrpc.php 16 Aug 2005 18:00:36 -0000 @@ -6,9 +6,10 @@ * PHP page for handling incoming XML-RPC requests from clients. */ -include_once 'includes/bootstrap.inc'; +include_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); -include_once 'includes/xmlrpcs.inc'; +include_once './includes/xmlrpc.inc'; +include_once './includes/xmlrpcs.inc'; xmlrpc_server(module_invoke_all('xmlrpc')); ?> Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.466 diff -u -F^f -r1.466 common.inc --- includes/common.inc 11 Aug 2005 12:57:41 -0000 1.466 +++ includes/common.inc 16 Aug 2005 18:00:37 -0000 @@ -1782,6 +1787,34 @@ function drupal_implode_autocomplete($ar return implode('||', $output); } +/** +* Performs one or more XML-RPC request(s). +* +* @param $url +* An absolute URL of the XML-RPC endpoint. +* Example: +* http://www.domain.com/xmlrpc.php +* @param ... +* For one request: +* The method name followed by a variable number of arguments to the method. +* For multiple requests (system.multicall): +* An array of call arrays. Each call array follows the pattern of the single +* request: method name followed by the arguments to the method. +* @return +* For one request: +* Either the return value of the method on success, or FALSE. +* If FALSE is returned, see xmlrpc_errno() and xmlrpc_error_msg(). +* For multiple requests: +* An array of results. Each result will either be the result +* returned by the method called, or an xmlrpc_error object if the call +* failed. See xmlrpc_error(). +*/ +function xmlrpc($url) { + require_once './includes/xmlrpc.inc'; + $args = func_get_args(); + return call_user_func_array('_xmlrpc', $args); +} + function _drupal_bootstrap_full() { static $called; global $locale; @@ -1796,7 +1829,6 @@ function _drupal_bootstrap_full() { require_once './includes/tablesort.inc'; require_once './includes/file.inc'; require_once './includes/unicode.inc'; - require_once './includes/xmlrpc.inc'; require_once './includes/image.inc'; // Set the Drupal custom error handler. set_error_handler('error_handler'); Index: includes/xmlrpc.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/xmlrpc.inc,v retrieving revision 1.22 diff -u -F^f -r1.22 xmlrpc.inc --- includes/xmlrpc.inc 15 Aug 2005 11:47:09 -0000 1.22 +++ includes/xmlrpc.inc 16 Aug 2005 18:00:37 -0000 @@ -340,25 +338,21 @@ function xmlrpc_base64_get_xml($xmlrpc_b return ''. base64_encode($xmlrpc_base64->data) .''; } -/** - * Perform an XML-RPC request. - * - * @param $url - * An absolute URL of the XML-RPC server - * @param $method - * The method to be executed - * @param ... - * A variable number of arguments of the method. - * @return - * The return value of the method on success or FALSE. On FALSE, see - * xmlrpc_errno() and xmlrpc_error_msg(). - */ -function xmlrpc() { +function _xmlrpc() { $args = func_get_args(); $url = array_shift($args); - $method = array_shift($args); + if (is_array($args[0])) { + $method = 'system.multicall'; + $multicall_args = array(); + foreach ($args[0] as $call) { + $multicall_args[] = array('methodName' => array_shift($call),'params' => $call); + } + $args = array($multicall_args); + } + else { + $method = array_shift($args); + } $xmlrpc_request = xmlrpc_request($method, $args); -// $request .= "Content-Type: text/xml$r"; $result = drupal_http_request($url, array("Content-Type" => "text/xml"), 'POST', $xmlrpc_request->xml); if ($result->code != 200) { xmlrpc_error(-$result->code, $result->error); @@ -381,30 +375,6 @@ function xmlrpc() { } /** - * Perform multiple calls in one request if possible. - * - * @param $url - * An absolute URL of the XML-RPC server - * @param $calls - * An array of calls. Each call is an array, where the first element - * is the method name, further elements are the arguments. - * @return - * An array of results. - */ -function xmlrpc_multicall() { - $args = func_get_args(); - $url = $args[0]; - foreach ($args[1] as $call) { - $method = array_shift($call); - $calls[] = array( - 'methodName' => $method, - 'params' => $call - ); - } - return xmlrpc($url, 'system.multicall', $calls); -} - -/** * Returns the last XML-RPC client error number */ function xmlrpc_errno() {