diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-14 21:36:23 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-14 21:36:23 +0000 |
commit | eb565e33569541981713c24d643ff89517db237c (patch) | |
tree | 564797c60f1fb86e5d86f4da563693c312948cdc /engine/handlers/xml-rpc_handler.php | |
parent | 13796a10ef50d0afe045a3a199a5b19dd5b9bc45 (diff) | |
download | elgg-eb565e33569541981713c24d643ff89517db237c.tar.gz elgg-eb565e33569541981713c24d643ff89517db237c.tar.bz2 |
Standardized engine/handlers/*
git-svn-id: http://code.elgg.org/elgg/trunk@3545 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/handlers/xml-rpc_handler.php')
-rw-r--r-- | engine/handlers/xml-rpc_handler.php | 90 |
1 files changed, 44 insertions, 46 deletions
diff --git a/engine/handlers/xml-rpc_handler.php b/engine/handlers/xml-rpc_handler.php index bc87306c7..26c1454bf 100644 --- a/engine/handlers/xml-rpc_handler.php +++ b/engine/handlers/xml-rpc_handler.php @@ -1,47 +1,45 @@ <?php - /** - * Elgg XML-RPC handler. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - - // Load Elgg engine - define('externalpage',true); - 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; - set_input('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_view("xml-rpc/output", array('result' => $result))); - -?>
\ No newline at end of file +/** + * Elgg XML-RPC handler. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +// Load Elgg engine +define('externalpage',true); +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; +set_input('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_view("xml-rpc/output", array('result' => $result)));
\ No newline at end of file |