diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-16 12:40:48 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-16 12:40:48 +0000 |
commit | 9fb0a7a7a32d9f7e8b8a591ca9053168068da16d (patch) | |
tree | f1e7d7caa331b752b77a2c27c0de7e54eba3c02b /engine/handlers/xml-rpc_handler.php | |
parent | b1655a9ac5b0ef8f275ac5a9a99393a1b99a5e8f (diff) | |
download | elgg-9fb0a7a7a32d9f7e8b8a591ca9053168068da16d.tar.gz elgg-9fb0a7a7a32d9f7e8b8a591ca9053168068da16d.tar.bz2 |
CLOSED - #14: XML-RPC handler
http://trac.elgg.org/elgg/ticket/14
git-svn-id: https://code.elgg.org/elgg/trunk@930 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/handlers/xml-rpc_handler.php')
-rw-r--r-- | engine/handlers/xml-rpc_handler.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/engine/handlers/xml-rpc_handler.php b/engine/handlers/xml-rpc_handler.php new file mode 100644 index 000000000..85de621b3 --- /dev/null +++ b/engine/handlers/xml-rpc_handler.php @@ -0,0 +1,48 @@ +<?php + /** + * Elgg XML-RPC handler. + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + // Load Elgg engine + require_once("../start.php"); + global $CONFIG; + + // Register the error handler + error_reporting(E_ALL); + set_error_handler('__php_xmlrpc_error_handler'); + + // Register a default exception handler + set_exception_handler('__php_xmlrpc_exception_handler'); + + // Set some defaults + $result = null; + $view = 'xml'; // Set default view regardless + + // Get the post data + $input = get_post_data(); + + if ($input) + { + // Parse structures from xml + $call = new XMLRPCCall($input); + + // Process call + $result = trigger_xmlrpc_handler($call); + } + else + throw new CallException(elgg_echo('xmlrpc:noinputdata')); + + if (!($result instanceof XMLRPCResponse)) + throw new APIException(elgg_echo('APIException:ApiResultUnknown')); + + // Output result + page_draw("XML-RPC", elgg_echo("xml-rpc/output", array('result' => $result))); + +?>
\ No newline at end of file |