From 94dd77324cfccaaeb2f846580c973e6dcbfa49f3 Mon Sep 17 00:00:00 2001 From: jengo Date: Thu, 29 Nov 2001 22:07:28 +0000 Subject: [PATCH] Added xmlrpcfault for handling faults and stopping execution of the application --- phpgwapi/inc/xml_functions.inc.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/phpgwapi/inc/xml_functions.inc.php b/phpgwapi/inc/xml_functions.inc.php index 69d53a6c8b..f1addf4709 100644 --- a/phpgwapi/inc/xml_functions.inc.php +++ b/phpgwapi/inc/xml_functions.inc.php @@ -91,6 +91,29 @@ // formulate backslashes for escaping regexp $GLOBALS['xmlrpc_backslash'] = chr(92) . chr(92); + /*! + @function xmlrpcfault + @abstract Error reporting for XML-RPC + @discussion Author: jengo
+ Returns XML-RPC fault and stops this execution of the application.
+ Syntax: void xmlrpcfault(string)
+ Example1: xmlrpcfault('Session could not be verifed');
+ @param $string Error message to be returned. + */ + function xmlrpcfault($string) + { + $r = CreateObject('phpgwapi.xmlrpcresp', + CreateObject('phpgwapi.xmlrpcval'), + $GLOBALS['xmlrpcerr']['unknown_method'], + $string + ); + $payload = '' . "\n" . $r->serialize(); + Header('Content-type: text/xml'); + Header('Content-length: ' . strlen($payload)); + print $payload; + $GLOBALS['phpgw']->common->phpgw_exit(False); + } + // used to store state during parsing // quick explanation of components: // st - used to build up a string for evaluation