phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [20836] update XMLRPC to 3.0.0 beta


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [20836] update XMLRPC to 3.0.0 beta
Date: Fri, 20 Nov 2009 09:44:46 +0000

Revision: 20836
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20836
Author:   sigurdne
Date:     2009-11-20 09:44:45 +0000 (Fri, 20 Nov 2009)
Log Message:
-----------
update XMLRPC to 3.0.0 beta

Added Paths:
-----------
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/Changelog
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/Makefile
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/NEWS
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/README
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/action.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/common.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/controller.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/index.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/agesort.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/client.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/comment.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/introspect.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/mail.php
    
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/simple_call.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/which.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/wrap.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/zopetest.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo1.txt
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo2.txt
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo3.txt
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/discuss.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/proxy.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/server.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/vardemo.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/Makefile
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apa.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apb.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apc.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apd.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch01.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s03.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s04.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s05.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s06.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s07.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s08.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s09.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch03.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch04.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch05.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch06.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch06s02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s03.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s04.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s05.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch08.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch08s02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s03.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s04.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s05.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s03.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s04.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s05.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch11.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch11s02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s02.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s03.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s04.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s05.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s06.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s07.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s08.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/index.html
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/xmlrpc_php.pdf
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/xmlrpc_php.xml
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/rsakey.pem
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/test.pl
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/test.py
    
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/workspace.testPhpServer.fttb
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpc.inc
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpc_wrappers.inc
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpcs.inc
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/Assert.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestCase.php
    
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestDecorator.php
    
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestFailure.php
    
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestListener.php
    
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestResult.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestSuite.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/benchmark.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/parse_args.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/phpunit.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/testsuite.php
    people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/verify_compat.php

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/Changelog
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/Changelog                 
        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/Changelog 2009-11-20 
09:44:45 UTC (rev 20836)
@@ -0,0 +1,1573 @@
+2009-09-05 - G. Giunta (address@hidden)
+
+       * xmlrpcs.inc, xmlrpcs.inc: remove code that was left for compatibility
+       with php 4; use __METHOD__ constant for error messages instead of 
hardcoded
+       values
+
+       * xmlrpcs.inc: catch exceptions thrown during execution of invoked 
methods;
+       check for $_SERVER having been disabled via php.ini and log an error if 
so
+
+       * server.php, testsuite.php: add a new test and server method for 
exception
+       catching in the server
+
+       * xmlrpc.inc: added new method SetUserAgent to client to allow having 
different
+       user-agent http headers
+
+       * tagged and released as 3.0.0 beta
+
+2009-08-05 - G. Giunta (address@hidden)
+
+       * xmlrpc_wrappers.inc: improve compatibility with php 5.0 when 
registering
+       class/object methods
+
+2009-08-02 - G. Giunta (address@hidden) thanks Laurens
+
+       * xmlrpcs.inc: add a new member var in server class to allow fine-tuning
+       of the encoding of returned values when the server is in 'phpvals' mode;
+       allow servers in 'xmlrpcvals' mode to also register plain php functions 
by
+       defining them in the dispatch map with an added option:
+       'parameters_type' => 'phpvals' (feature request #2806628)
+
+       * xmlrpc.inc: added new method xmrlpc_client::SetCurlOptions($array) to
+       allow extra flexibility in tweaking http config, such as explicitly
+       binding to an ip address (feature request #2787468); fix bad encoding if
+       same object is encoded twice using php_xmlrpc_encode; removed some 
by-ref
+       assignments and declarations
+
+2009-07-31 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc: add support for dateTime objects in both in 
php_xmlrpc_encode
+       and as parameter for constructor of xmlrpcvals; add support for 
timestamps
+       as parameter for constructor of xmlrpcvals; add option 
'dates_as_objects' to
+       php_xmlrpc_decode to return dateTime objects for xmlrpc datetimes
+
+       * benchmark.php, xmlrpc_wrappers.inc: remove usage of split(), 
deprecated in
+       php 5.3
+
+       * benchmark.php: fixed url of server page used for testing; improved
+       verification of correspondence of test results; added more variants for
+       http options comparison
+
+       * verify_compat.php: check for php version 5 for client side too
+
+       * makefile: remove from build the compat directory
+
+2009-07-26 - G. Giunta (address@hidden)
+
+       * server.php: remove usage of ereg*(), deprecated in php 5.3
+
+2009-07-16 - G. Giunta (address@hidden) thanks Jean-Jacques Sarton
+
+       * xmlrpc.inc: add support for the <ex:nil/> from the apache library, 
both
+       in input and output (feature request #...)
+
+       * xmlrpc.inc, testsuite.php: remove usage of split(), deprecated in php 
5.3
+
+       * testsuite.php: flush better results with output_buffering on
+
+       * server: php: avoid one warning about static function calls
+
+2009-07-02 - G. Giunta (address@hidden) thanks Heiko Stuebner
+
+       * xmlrpc.inc: fix: when checking the parameters against the signatures 
xmlrpc
+       checks for "array" but PHP returns "Array" resulting in a not matches 
signature
+
+2009-05-07 - G. Giunta (address@hidden)
+
+       * replace all usage of '= & new' with '= new', as this is deprecated in 
php 5
+       and has been shown to cause problems too
+
+2009-05-06 - G. Giunta (address@hidden)
+
+       * create php4 branch, rename trunk to 3.0.0beta - it will be the 
php5-only version
+
+       * xmlrpc.inc: removed test for php version and inclusion of compat 
patches for really
+       really old versions of php 4
+
+2009-03-16 - G. Giunta (address@hidden) thanks Tommaso Trani
+
+       * move from CVS to SVN on sf.net; file layout now is the same as in 
packaged lib
+
+       * xmlrpc.inc: fix php warning when receiving 'false' in a bool value
+
+       * Makefile, doc/Makefile: alter to follow new file layout
+
+       * tagged and released as 2.2.2
+
+2009-02-03 - G. Giunta (address@hidden)
+
+       * debugger/action.php: improve code robustness when parsing 
system.listmethods
+       and system.describemethods call
+
+       * xmlrpc.inc: format floating point values using the correct decimal 
separator
+       even when php locale is set to one that uses comma (bug #2517579);
+       use feof() to test if socket connections are to be closed instead of the
+       number of bytes read (bug #2556209)
+
+2008-10-29 - G. Giunta (address@hidden)
+
+       * xmlrpcs.inc: allow add_to_map server method to add docs for single 
params, too
+
+2008-09-20 - G. Giunta (address@hidden)
+
+       * xmlrpc_wrappers.inc: added the possibility to wrap for exposure as 
xmlrpc
+       methods plain php class methods, object methods and even whole classes
+
+       * testsuite.php, server.php: added test cases for the new code
+
+2008-09-07 - G. Giunta (address@hidden) thanks Bruno Zanetti Melotti
+
+       * xmlrpc.inc: be more tolerant in detection of charset in http headers 
(fix for bug #2058158)
+
+2008-04-05 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc: fix encoding of UTF8 chars outside of the BMP
+
+       * xmlrpcs.inc: fix detection of zlib.output_compression (thanks xbert)
+
+2008-03-06 - G. Giunta (address@hidden)
+
+       * tagged and released as 2.2.1
+
+       * Makefile: improve usage on windows xp despite cmd's broken mkdir
+
+2007-10-26 - G. Giunta (address@hidden) thanks sajo_raftman
+
+       * xmlrpc.inc: remove one warning in xmlrpc_client creator
+
+2007-10-26 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc: improve support for windows cp1252 character set (still
+       commented in the code)
+
+2007-09-05 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc, xmlrps.inc: do not try to set invalid charsets as output 
for
+       xml parser, even if user set them up for internal_encoding (helps 
encoding
+       to exotic charsets, while decoding to UTF8)
+
+2007-09-05 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc: fix parsing of '1e+1' as valid float
+
+2007-09-01 - G. Giunta (address@hidden), thanks Frederic Lecointre
+
+       * xmlrpcs.inc: allow errorlevel 3 to work when prev. error handler was 
a static method
+
+       * testsuite.php: fix test on setCookie()
+
+2007-08-31 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc: minor fix in cookie parsing
+
+2007-07-31 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc: Fix usage of client::setcookie() for multiple cookies in 
non-ssl mode
+
+2007-07-26 - G. Giunta (address@hidden) thanks Mark Olive
+
+       * xmlrpc.inc: Fix for bug # 1756274 (usage of cookies in ssl mode)
+
+2007-04-28 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc: give more detailed curl information when DEBUG = 2; fix 
handling
+       of case where curl w. keepalive is used and one connection of many fails
+
+       * testsuite improvements: add one testcase; give feedbcak while tests 
are
+       running
+
+2007-04-01 - G. Giunta (address@hidden)
+
+       * doc/makefile, doc/custom.fo.xsl: improve pdf rendering of php source 
code
+
+       * makefile: recover version number from source instead of having it 
hardcoded
+
+2007-03-10 - G. Giunta (address@hidden)
+
+       * doc/makefile, doc/convert.php, doc/*.xsl: created customizations xslt 
to
+       produce a documentation more in line with the php manual, esp. with 
regards
+       to functions synopsis; added jellyfish book cover as local resource and 
a
+       screenshot of the debugger too; various updates to the manual source; 
added
+       a php script to highlight examples inside html docs
+
+2007-03-09 - G. Giunta (address@hidden)
+
+       * debugger/action.php: css tweak for IE
+
+       * added phpunit license file in the phpunit directory
+
+       * added link to license (on sf.net site) to many files
+
+2007-03-04 - G. Giunta (address@hidden)
+
+       * Makefile, doc/makefile: assorted improvements
+
+2007-03-03 - G. Giunta (address@hidden)
+
+       * xmlrpc.inc: micro-optimization in declaration of global vars 
xmlrpcerr, xmlrpcstr
+
+2007-02-25 Gaetano Giunta <address@hidden>
+
+       * removed a couple of warnings emitted in testsuite.php
+
+       * doc/makefile: added command for invocation of xxe to generate docs
+
+       * better rendering of docs in xml+css format for function prototypes
+
+       * updated documentation
+
+       * tagged and released as 2.2
+
+2007-02-22 Gaetano Giunta <address@hidden>
+
+       * debugger: workaround for case of magic_quotes_gpc being set (properly
+       unescape user input); fix case of user not setting msg id in jsonrpc 
case
+       when executing a remote method; allow strings, false, true and null as 
msg id
+
+2007-02-13 Gaetano Giunta <address@hidden>
+
+       * testsuite.php: added one test for automatic encoding/decoding case
+
+2007-02-05 Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: slightly faster encoding of UTF8 data to ascii
+
+2007-01-11 Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: when calling client::multicall() with an unspecified http 
version,
+       use the client default rather than the fixed 'http 1.0'
+
+2006-09-17 Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc, xmlrpcs.inc, testsuite.php: added support for <NIL/> and
+       system.getCapabilities, and one more testcase to go with it
+
+2006-09-05 Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fix support for https through proxies; client parses debug
+       messages sent by client even for compressed responses;
+
+       * testsuite.php, parse_args.php: added 3 test cases for proxy 
connections
+
+2006-09-01 Gaetano Giunta <address@hidden>
+
+       xmlrpc_wrappers.inc: add two more options in wrap_xmlrpc_method and fix
+       typo to allow obj encoding
+
+2006-08-28 Gaetano Giunta <address@hidden>
+
+       * xmlrpc_wrappers.inc: more options added to wrap_php_function and
+       wrap_xmlrpc_method
+
+       * xmlrpc.inc: pave the way to support for <nil/>
+
+       * doc/xmlrpc_php.xml documentation updated
+
+       * tagged and released as 2.1
+
+2006-08-25 Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: stricter parsing of incoming messages: detect two DATA 
elements
+       inside an ARRAY, a STRUCT or SCALAR inside an already filled VALUE
+
+       * testsuite.php: added two testcases to check for the above cases
+
+2006-08-24 Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: more code optimization in xmlrpcval::serialize() and
+       php_xmlrpc_encode(); fixed bug where struct elements with non-ascii 
chars
+       in their name would not be properly encoded
+
+       * testsuite.php: added a testcase for the new bug
+
+2006-08-23 Gaetano Giunta <address@hidden>
+
+       * remove old code left in comments across many files; many more javadoc
+       comments added
+
+       * xmlrpc.inc: a bit of code optimization: reorder switch() statements of
+       xml parsing element handlers; inline code for xmlrpcval() - this breaks
+       new xmlrpcval('true') and changes error msgs on new xmlrpcval($x, 
'invalid_type')
+
+       * testsuite.php: change according to above
+
+       * benchmark.php: basic support for xdebug 2 profiling
+
+2006-08-22 Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: addscalar() and addstruct() where not returning 1 when 
adding
+       data to an already formed value
+
+2006-08-21 Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc, xmlrpc.inc: added support for emulating the 
xmlrpc-extension
+       API (the full emulation layer is part of the extras package);
+       fix support for the HTTP 'deflate' encoding
+
+       * xmlrpc.inc: better support for http compression with and without CURL;
+       a minor decoding speedup; added a new function: php_xmlrpc_decode_xml(),
+       that will convert into the appropriate object the xml representation of
+       either a request, response or a single value; log reception of invalid
+       datetime values
+
+       * xmlrpcs.inc: add a new parameter and return type to server->service();
+       let server->add_to_map() accept method definitions without parameter 
types
+
+       * xmlrpc_wrappers.inc: more logging of errors; wrap_php_functions now 
takes
+       more options; better support for jsonrpc; escape quote chars when 
wrapping
+       remothe servers / remote methods
+
+       * added cvs Id tag to files that missed it; speling fixes; updated NEWS 
files
+
+2006-08-07 Gaetano Giunta <address@hidden>
+
+       * assorted fixes to make the suite more compatible with php 4.0.5 and 
5.x
+
+2006-07-02 Gaetano Giunta <address@hidden>
+
+       * xmlrpc_warppers.inc: added new function to wrap entire remote server 
into
+       a local php class; changed default calling synopsis of 
wrap_remote_method,
+       to ease passing multiple options at a time (but old syntax still works!)
+
+       * updated makefile, debugger/action.php in accord with the above
+
+2006-06-30 Gaetano Giunta <address@hidden>
+
+       * added to debugger capability to generate json-rpc code stubs
+
+       * added to debugger capability to load and launch self correctly if
+       controller.php is called directly from outside processes (single url 
access)
+
+2006-06-26 Gaetano Giunta <address@hidden>
+
+       * moved wrap_php_functions and wrap_xmlrpc_method into a file of their 
own.
+       This will let us add further stub functionality without the base lib 
growing too much.
+       All of the files that reference this functionality have been modified 
accordingly.
+
+       * made wrap_xmlrpc_method generate better code (with php type 
juggling), and
+       some phpdoc for the generated function, too
+
+       * added to debugger an option to produce for the user the generated php 
code
+       for wrapping a call to a remote method into a php function
+
+2006-06-22 Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: added description of parameters for system.xxx methods 
(useful with
+       html-self-documenting servers);
+       server->service() now returns response object, in case user has need 
for it...
+
+       * xmlrpc.inc: save full response payload into xmlrpcresp obj for better 
debugging
+
+2006-06-15 Gaetano Giunta <address@hidden>
+
+       * verify_compat.php: more tests
+
+2006-06-09 Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: fixed sending of compressed responses when output 
compression
+       is already enabled in php.ini
+
+       * verify_compat.php: split tests between server and client cases
+
+2006-05-29  Gaetano Giunta <address@hidden>
+
+       * added new file: verify_compat.php, to help troubleshooting platform
+       support for the library; added it to makefile, too
+
+2006-05-24  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: removed residual usage of regexp in favour of  pregexps; 
fixed
+       a bug in specifying Host http header with non std ports
+
+2006-05-23  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: improvements to wrap_php_function: let it deal correctly
+       with php functions returning xmlrpcresp objs; make it generate also
+       docs for single parameters (useful for documenting_xmlrpc_server class)
+
+2006-05-22  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc, xmlrpcs.inc: minor performance tuning updates: replaced
+       some explode vs. split, ereg vs. preg, single vs. double quotes
+
+       * xmlrpc.inc: fix wrap_xmlrpc_method to NOT rebuild php objects received
+       from the server by default, as it might pose a security risk
+
+2006-04-24  Gaetano Giunta <address@hidden>
+
+       * minor fixes makefiles. Tagged and released as 2.0 final
+
+2006-04-22  Gaetano Giunta <address@hidden>
+
+       * debugger/*: added option to set cainfo; improve web layout
+
+       * xmlrpc.inc: set sslverifypeer to TRUE instaed of 1 by default
+
+       * doc/php_xmlrpc.xml: documentation updates
+
+2006-04-21  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: added option to set ca certs dir instead of single cert
+       (used to validate server in https connetions)
+
+2006-04-18  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fixed bug in xmlrpcval::structmemexists()
+
+       * testsuite.php: added test case for xmlrpcval::structmemexists()
+
+2006-04-03  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: add support for Digest and NTLM authentication, both to 
server
+       and to proxies (note: must use CURL for this to work)
+
+       * debugger/*: add support for Digest/NTLM auth to remote servers
+
+2006-03-19  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fix a bug parsing of 'true' bool values;
+       added a new method to the client class: SetCaCertificate;
+       add column number in xml parsing error messages;
+       fix serialization of messages to ISO-8859-1 charset with php 5 (by 
adding
+       encoding to the xml prologue of generated messages)
+
+       * xmlrpcs.inc: correct detection of charset in http headers;
+       add column number in xml parsing error messages;
+       fix serialization of responses to ISO-8859-1 charset with php 5 (by 
adding
+       encoding to the xml prologue of generated responses)
+
+       * testsuite.php: added two more tests on charset encoding
+
+       * NEWS: update info for impending release
+
+2006-03-23  Gaetano Giunta <address@hidden>
+
+       * added a new demo file: simple_call.php
+
+2006-02-20  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: more error checking and logging with regard to user-coded
+       method handler functions not being well behaved;
+       fix a case where error handler would not be reset upon user function
+       returning not valid xmlrpresp
+
+       * xmlrpc.inc: fix bug in detection of php 4.3.0
+
+       * Makefile: fix uppercase filenames
+
+2006-02-15
+
+       * xmlrpc.inc: parse 'true' and 'false' as valid booleans, even though 
the
+       spec is quite clear on that; fix small bug w. internal_encoding = utf8; 
add
+       definition of $GLOBALS['xmlrpcNull'] for extensibility, e.g. json or
+       extensions to the xmlrpc spec
+
+2006-02-05  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fix bug in wrap_xmlrpc_method if client passed to 
function has
+       return_type=phpvals
+
+       * all demo files: review code, add more comments and information
+
+       * added 2 demo files: proxy.php (implementing an xmlrpc proxy server) 
and
+       wrap.php (showing usage of wrap_method_call)
+
+2006-02-04  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fix bug in multicall in case of no fallback and server 
error
+
+2006-01-30  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fix recursive serialization of xmlrpcvals loosing UTF8 
charset;
+       correctly set type field of xmlrpcvals returned by send() calls
+
+       * xmlrpcs.inc: add to server checks for correct return type of 
user-coded
+       method handling function; tolerate xmlrpcval instead of xmlrpcresp
+
+       * minor change in xmlrpcresp internals, to ease subclassing (store 
payload
+       in an internal var on serialize(), same as xmlrpcclient does)
+
+2006-01-22  Gaetano Giunta <address@hidden>
+
+       * benchmark.php: do not run http 1.1 tests if CURL notfound
+
+       * Released as 2.0 Rc3
+
+2006-01-19  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: make xmlrpc_client::setDebug() accept int values instead 
of
+       boolean. At level 2, the request payload is printed to screen before 
being
+       sent; fix bug with repeated sending of the same msg object and using 
request
+       compression w. php 5.1.2 (objects passed by ref by default!!!)
+
+       * xmlrpcs.inc: fix detection of clients accepting compressed responses
+
+       * comment.php: remove warnings due to liberal usage of 
$HTTP_POST/GET_VARS
+
+       * benchmark.php: add a test using http compression of both requests and
+       responses
+
+       * testsuite.php: added test for fix in xmlrpc.inc
+
+2006-01-17  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.php: minor fix: do not raise a PHP warning when std server is
+       called via GET (global HTTP_RAW_POST_DATA undefined). Some might have 
called
+       it a security breach (path disclosure)...
+
+2006-01-15  Gaetano Giunta <address@hidden>
+
+       * testsuite.php: minor fix to expected date format in http cookie hedaer
+       to cope with PHP 5.1.2
+
+2006-01-05  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: merge code from the 'extras' subclass that allows server
+       to register plain php functions in dispatch map instead of functions
+       accepting a single xmlrpcmgs obj parameter.
+       One step closer to the kitchen sink!!!
+
+2005-12-31  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: let the server accept 'class::method' syntax in the 
dispatch
+       map
+
+       * testsuite.php, server.php: added new tests for the recent charset 
encoding
+       capabilities
+
+2005-12-24  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: correctly serialize() string xmlrpcvals that have been
+       created out of non-string php variables, when internal encoding is UTF8;
+       serialize to '0' int and double values created out of non-string php
+       variables, eg. 'hello', instead of creating invalid xmlrpc;
+       extend the php_xmlrpc_encode function to allow serializing string values
+       to charsets other tha US-ASCII;
+       minor tweak to xml parsing to allow correct parsing of empty strings 
when
+       in 'direct to php values' mode
+
+       * xmlrpcs.inc: advances in system.multicall with plain php values
+
+2005-12-17  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: let the functions implementing the system.* methods work
+       fine when called with plain php values as parameters instead of 
xmlrpcmsg
+       objects (multicall not quite finished yet...);
+       encode level 3 debug info as base64 data, to avoid charset encoding hell
+
+       * xmlrpc.inc: added a new xmlrpc_2_php_type function, to get the name of
+       php types corresponding to xmlrpc types;
+       in debug mode, when detecting base64 server debug info, print it out 
fine
+
+       * server.php: cosmetic fixes
+
+2005-12-09  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: remove one warning emitted when received xml contains an
+       unknown tag; remove warnings emitted when custom error handler is set
+       and user calls php_xmlrpc_encode/decode without the 2nd parameter
+
+       * xmlrpcs.inc: added a param to service(), to allow the server to parse
+       data other than the POST body (useful for subclassing and debugging);
+       reworked the implementation of server debug messages at debug level 2:
+       since the debug info generated has no known charset, and putting it back
+       into the response's xml would most likely break it, send it back to the
+       client as a base64 encoded comment. Clients can decode it if they need 
it...
+       Add some more javadocs
+
+       * testsuite.php: modified the string test, to see if the server can echo
+       back to the client the received data without breaking the response's xml
+
+2005-12-05  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc, xmlrpcs.inc: let server and client objects decide if they
+       want to use some charset encoding other than US-ASCII for serialized 
data:
+       add a new var to both objects, and lots of parameters to function calls
+       that took none up to now;
+       refactored server method service() and parseRequest(), implementing a
+       new parserequestHeaders() method to explicitly deal with HTTP
+
+2005-12-01  Gaetano Giunta <address@hidden>
+
+       * moved the jsonrpc implementation and the new wsdl stuff to a separate
+       CVS module; updated the makefile to reflect it
+
+2005-11-24  Gaetano Giunta <address@hidden>
+
+       * modified php_xmlrpc_decode() to work on xmlrpcmessages too, besides
+       xmlrpcvals. To achieve this, added a new method: xmlrpcmsg::kindOf()
+
+2005-11-22  Gaetano Giunta <address@hidden>
+
+       * released as 2.0 RC2
+
+2005-11-21  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fix warnings about references for PHP 4.1.X
+
+       * Whitespace cleanup on all the lib
+
+2005-11-16  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: rewritten xmlrpc_encode_entitites adding two extra 
parameters
+       that specify input and output charset encodings. This corrects the bug 
that
+       prevented native UTF-8 strings to be correctly serialized (to have them
+       encoded the user must set $xmlrpc_internalencoing appropriately).
+
+       * xmlrpc.inc: added new method xmlrpcmsg::parseResponseHeaders(), 
refactoring
+       parseResponse(). This makes the code more modular and eases subclassing.
+
+       * xmlrpc.inc: set cookies and http headers to xmlrpcresp objs even when 
calls
+       to send() do not complete correctly
+
+       * added new file: jsonrpcs.inc, to accomodate server jsonrpc objects in 
the future
+
+       * jsonrpc.inc: slow progress...
+
+2005-11-10  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fixed the xmlrpc_client send and sendpayloadhttps methods
+       to fix errors in calling https servers;
+       added a new xmlrpc_client->setkey method to allow usage of client-side 
ssl
+       certs in recent php builds;
+       added to xmlrpcresp objects a content_type var, to be used in HTTP 
headers
+
+       * xmlrpcs.inc: separate generation of content-type http header and xml 
prologue
+       from the service() method, to ease subclassing
+
+2005-11-03  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: moved the 'text/xml' mimetype string as class var of the 
xmlrpcmsg
+       object instead of having it cabled into xmlrpc_client->send(): this 
allows to
+       create subclasses of xmlrpcmsg that use a different mimetype
+
+       * jsonrpc.inc: added a new file, with an extremely experimental set of 
classes,
+        designed to implement a json-rpc client and server, taking advantage 
of the
+        existing xml-rpc infrastructure
+
+2005-10-28  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: changed constructor method for xmlrpcresp, making it 
smarter in
+       case user does not declare the type of value it is passing to it;
+       minor changes in serialization of xmlrpcresp with error codes, so that 
it
+       utputs LF instead of CRLF on windows boxes after an FTP transfer of the 
code, too
+
+2005-10-26  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: added a new var of class xmlrpc_client, indicating what 
kind of
+       object will be stored in the value() of xmlrpcresp's gotten from the 
send()
+       method: xmlrpxc objects, plain php variables or raw xml. This allow the 
coder
+       to make use of xmlrpc_decode for better performances if he wishes so.
+       Modified creator of xmlrpcresp class to allow it to distinguish between 
being
+       created out of raw xml or a plain php string (in the former case, 
serialization
+       is still possible, opening a new world of opportunity for server-side 
programming:
+       the php function implementing a web service has to provide the xml for 
the
+       return value on its own).
+       Modified xmlrpc_client::multicall() to suit; also added a new parameter 
which
+       allows calls to multicall without automatic fallback to many-calls in 
case of
+       error (speeding up the process of doing a failed multicall() call quite 
a bit)
+       Fixed two bugs in guess_encoding.
+       Audited all regexps and fixed some.
+       xmlrpc_client::send() does not call xmlrpcmsg::parseresponsefile() 
anymore.
+       Shuffled parseresponse() a little bit
+
+       * testsuite.php: added a new testcase for the modifications to 
multicall():
+       now we test the case where xmlrpc_client returns php values, too
+
+2005-10-24  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fixed guess_encoding() to always return uppercase chars
+
+       * added new file: benchmark.php. It contains a few tests used to 
evaluate
+       speed of the lib in common use cases
+
+       * added file parse_args.php, containing common code for benchmark and
+       testsuite, and modified testsuite.php accordingly
+
+       * modified makefile adding new files
+
+       * testsuite.php: added a couple of new test cases; fixed one warning
+       emitted in php 5 E_STRICT mode
+
+2005-10-20  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: modify 3d param of ParseResponse(), allowing the function 
to
+       return the raw xml received as value of the xmlrpcresponse object.
+       This allows eg. to have epi-xmlrpc decode the xml for faster execution.
+
+2005-10-09  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fixed error that prevented usage of HTTPS (the client
+       always determined that ssl support was not present)
+
+2005-10-03  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc, xmlrpcs.inc: revert direction of stack growth during xml
+       parsing for faster execution time; add support for detecting charset
+       encoding of received xml; add support for cookies; better parsing of
+       javadoc when building stub code in wrap_php_function; add a lot of
+       javadoc comments everywhere; rewrite most error messages
+
+       * testsuite.php: add many tests for newly introduced features
+
+       * server.php: add a couple of new functions to support debugging new
+       features
+
+       * debugger: add switches to enable all the latest lib features; minor
+       improvements to layout
+
+       * synch included phpunit with latest PEAR release
+
+       * reorganize files included in the distribution in a new hierarchy of 
folders
+
+       * bump revision number to 2.0RC1 and release
+
+2005-8-14  Miles Lott <address@hidden>
+
+       * xmlrpc.inc, xmlrpcs.inc: Remove all use of eval() to avoid potential
+       security hole.
+
+       * As of this release we are no longer php3-compatible.
+
+2005-8-10 Miles Lott <address@hidden>
+
+       * xmlrpc.inc, xmlrpcs.inc: Switched to using $GLOBALS instead of calling
+       global $varname
+
+2005-07-22  Miles Lott <address@hidden>
+
+       * Removed: bug_* files
+
+2005-07-14  Gaetano Giunta <address@hidden>
+
+       * debugger: added a workaround to disable using the debugger for 
attacking
+       older versions of the lib
+
+       * testsuite.php: added code to test wrap_xmlrpc_method;
+       use different wording for failed tests
+
+       * xmlrpcs.inc: change for() with foreach() in system.* methods 
implementations;
+       remove a possible cause of php warning;
+
+       * xmlrpc.inc: let wrap_php_function and wrap_xmlrpc_method find suitable
+       function names if default function names are already in use;
+       correct wrap_xmlrpc_method to not set http protocol to 1.0 when not 
asked to;
+       detect curl compiles without SSL
+
+2005-07-14  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: more auto-fix of xmlrpc_client path: '' -> '/';
+       change to the method used for detecting failed evals (php 4.0.x 
compatibility);
+       complete rework of return-by-ref functions to comply with php 4.4.0
+
+       * xmlrpcs.inc: change to the method used for detecting failed evals 
(php 4.0.x
+       compatibility)
+
+       * testsuite.php: major rewrite of the multi- tests, to give better 
feedback on
+       number of failed tests;
+       flush html page title to screen before starting tests;
+
+2005-07-13  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: let xmlrpcmsg creator be forgiving of target paths that 
miss the
+       starting '/' char;
+       completely reworked assign-by-ref to be compliant with php 4.4.0 
stricter
+       warnings
+
+       * testsuite.php: added ability to be run from cli: (really dumb) 
separation of
+       html and plain text outputs + parsing of argv parameters
+
+2005-07-12  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: compatibility fixes with PHP versions 4.0.x (and remove 
some for
+       PHP 3)
+
+       * xmlrpcs.inc: compatibility fixes for PHP 4.0.x versions
+
+       * testsuite.php: better support for running with php versions 4.0.x;
+       do not generate runtime errors but finish tests anyway if some calls to
+       localhost fail;
+       correctly detect a localhost port different from 80 for running tests 
against
+
+2005-07-11  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: preliminary building of method signature and docs in
+       wrap_php_function;
+       fix a bug in extracting function description from javadoc block in
+       wrap_php_function;
+       small fix for better compatibility with php < 4.2.0
+
+       * added compat subdir with extra code, taken form PEAR package Compat, 
to let
+       the lib run fine with php 4 versions < 4.1
+
+2005-07-10  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: some nazi whitespace corrections;
+       declared global $xmlrpcBoolean too (was the only one missing);
+       used @eval inside getval() to have less path disclosure security 
reports filed
+       in the future;
+       added new global var: $xmlrpcValue, to be used in server dispatch maps 
as
+       placeholder for a param which can be of any kind;
+       big chunks (but still incomplete) of javadoc parsing in 
wrap_php_function
+       + changed type of return val - now it is the complete array to be put 
in the
+       dispatch map
+
+       * xmlrpcs.inc: let previous error handler be called by server to handle 
errors
+       even if in debug level 3;
+       default to compress responses if zlib installed;
+       added a new val useful for only checking number (not type) of params in 
method
+       calls;
+       let user use object methods in dispatch map using the
+       array($obj, 'fmethodname') format
+
+       * server.php: Added code called by testsuite.php to exercise 
registration of
+       object methods as xmlrpc methods and auto-registration of php functions 
as xmlrpc
+       methods
+
+       * testsuite.php: added tests to exercice server registering object 
methods as
+       xmlrpc methods and automatic registration of php functions as server 
methods;
+       added a hint to enable debug if some test goes wrong;
+       renamed https test for better clarity
+
+2005-07-07  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: added function to be used for 'guestimating' charset 
encoding of
+       received xml (not activated yet)
+
+       * server.php: Let server compress content by default if user asks so: 
it allows
+       testsuite to check for compressed responses
+
+       * testsuite.php: added suite of tests for compressed responses; test 
CURL
+       (http1.1) with all possible compression combinations too
+
+2005-07-06  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: Enable setting usage of keepalives on/off (for CURL 
cases);
+       implement compression of xmlrpc requests; enable new syntax of 
xmlrpclient
+       constructor: 1 - allow preferred http method to be set at creation time,
+       2 - allow user to insert a single complete URL as only parameter and 
parse it;
+       try to detect if curl is present whether it has been compiled w. zlib 
to enable
+       automatically the reception of compressed responses
+
+       * xmlrpcs.inc: do not add into logs the content of the request, if it 
was
+       received gzipped/deflated, to avoid breaking the xml sent back as 
response
+       (NB: might be investigated further: is the problem caused by windows 
chars in
+       the range 128-160 ?)
+
+       * testsuite.php: run all localhost tests 2 more times, to stress request
+       compression;
+       run all localhost tests in a row using keepalives, to test keepalive
+       functionality
+
+2005-07-05  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: let CURL pass back to caller function the complete PHP 
headers
+       as it did before: it enables better logging / debugging of 
communication;
+       small change to the way CURL declares its ability to receive compressed
+       messages (fix for the case where zlib is compiled in PHP but not in 
curl);
+       added Keep-alive (ON BY DEFAULT) for http 1.1 and https messages (had 
to modify
+       a lot of functions for that);
+       always make sure a 'Connection: close' header is sent with curl 
connections if
+       keep-alive is not wanted
+
+       * phpunit.php: switched to PEAR PHPUnit (rel 1.2.3), since it is 
maintained a
+       lot more than the old version we were using
+
+       * added new folder with code of phpunit classes
+
+       * testsuite.php: added a new run of tests to check for compliance of 
client
+       when using http 1.1;
+       switched to PEAR PHPUnit classes;
+       divided test for client ability to do multicall() into 2 separate tests
+
+2005-06-30  Gaetano Giunta <address@hidden>
+
+       tagged and released version 1.1.1, backporting security fixes from HEAD
+
+2005-06-28  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: fix changes introuced yesterday in a rush;
+       do not list system.* methods for a server that has them explicitly 
disabled
+
+       * bug_inject.xml: new test case used to check for code injection 
vulnerability
+
+       * testsuite.php: added a test case for zero parameters method calls;
+       added two test cases for recently found code injection vulnerabilities
+
+2005-06-27  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: (tentative) fix for security problem reported by
+       address@hidden: we were not properly php-escaping xml received for
+       BASE64 and NAME tags;
+       some more patching related to junk received in xml messages/responses: 
if the
+       PHP code built from the parsed xml is broken, catch any generated errors
+       without echoing it to screen but take note of the error and propagate 
to user
+       code
+
+       * xmlrpcs.inc: some more patching related to junk received in xml 
messages/
+       responses: if the PHP code built from the parsed xml is broken, catch 
any
+       generated errors without echoing it to screen but take note of the 
error and
+       propagate to user code
+
+2005-06-24  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fixed php_xmlrpc_encode detection of php arrays (again!);
+       removed from wrap_php_function the part about setting a custom error 
handler
+       (it can be activated using the more general $server->setdebug(3) anyway)
+
+       * xmlrpcs.inc: added to server the capability to trap all processing 
errors
+       during execution of user functions and add them to debug info inside 
responses;
+       return a (new) xmlrpcerr response instead of raising some obscure php 
execution
+       error if there is an undefined function in the dispatch map
+
+       * testsuite.php: Added new testcases for recently implemented stuff
+
+2005-06-23  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: added new method: xmlrpcval->structmemexists, to check for
+       presence of a wanted struct member without having to loop through all 
members;
+       fix wrap_php_functions: correctly return false for php internal 
functions,
+       whose param list is unknown;
+       let addscalar fail as it should if called on struct vals;
+       fix addstruct: do not fail when called for adding stuff to initialized 
structs;
+       removed a warning generated when calling addscalar with inexistent type;
+       massive code review for speed: replaced each() loops with foreach(), 
removed
+       lots of useless assignments and duplications of data;
+       added 'http11' as valid method param for xmlrpclient->send: makes use 
of curl
+       for sending http 1.1 requests;
+       changed a couple '=' into '=&' where objects are returned;
+       fixed wrap_php_function() to better detect php errors while processing 
wrapped
+       function
+
+       * xmlrpcs.inc: Fix php warnings generated when clients requested method
+       signature / description for a method that had none in its dispatch map;
+       turned server->debug into an integer value that will change the amount 
of
+       logging going as comments into xmlrpc responses
+
+       * server.php: set default server debug level to 2
+
+       * testsuite.php: removed calls to deleted functions (xmlrpc_encode,
+       xmlrpc_decode);
+       added html page title describing target servers used for tests;
+       added an assign-by-ref
+
+       * phpunit.php: Do not consider as failures PHP 5 E_STRICT errors 
(arbitrary
+       choice, but lib is targeted at PHP 4)
+
+2005-06-22  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: removed lottsa old code that had been left in commented
+
+       * xmlrpc.inc: fixed setting of proxy port
+
+       * xmlrpc.inc: removed one warning when trying to decompress junk sent as
+       deflated response
+
+       * xmlrpc.inc: changed the error messages (but not the code) that will 
be found
+       in xmlrpcresponses when there are socket errors, to differentiate from 
HTTP
+       errors
+
+       * xmlrpc.inc: refactored xmlrpcclient->sendpayloadHTTPS: now it calls a 
new
+       method (sendpayloadCURL) that could be used also for generating HTTP 1.1
+       requests
+
+       * xmlrpc.inc: added two new methods: wrap_php_function and 
wrap_xmlrpc_method:
+       designed to let the lazy programmer automagically convert php functions 
to
+       xmlrpc methods and vice versa. Details are in the code
+
+       * debugger/*: added initial revision of a 'universal xmlrpc debugger'
+
+2005-06-20  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: replace usage of 'echo' with error_log when errors arise
+       in manipulation of xmlrpcval objects
+
+       * xmlrpc.inc: replaced <br> with <br /> in dump function
+
+       * xmlrpc.inc: added method structsize to xmlrpcval class (alias for 
arraysize)
+
+       * xmlrpc.inc: addarray() now will add extra members to an xmlrpcval 
object
+       of array type; addstruct() can be used to add members to an xmlrpcval 
object
+       of struct type
+
+       * xmlrpcs.inc: Added member allow_system_funcs to server: controls 
whether the
+       server accepts or not calls to system.* functions
+
+2005-05-10  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fix regression in php_xmlrpc_encode when encoding php 
hashes;
+       fix decompression of gzip/deflated xmlrpc responses;
+       set user agent string correctly in SSL mode (was forgetting lib name);
+       add allowed encoding http headers in requests;
+       do not pass http headers back from curl to parseresponse, to avoid 
re-decoding
+       compressed xml or http 100 headers
+
+       * xmlrpcs.inc: added method setDebug;
+       renamed compress_output to compress_response;
+       do not try to set http headers if they have already been sent, because 
trying
+       to do so will raise a PHP error, and if headers have been sent 
something has
+       gone wrong already (shall we send a meaningful error response instead?)
+
+2005-05-08  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc, xmlrpcs.inc: reverted to usage of '=& new' for better
+       performance on (some) php4 installs.
+       NB: PHP 3 compatibility is deprecated from now on!
+
+       * xmlrpc.inc: decode xmlrpc boolean type to native php boolean
+
+       * xmlrpcs.inc, xmlrpcs.inc: switched $_xh[$parser] to $_xh, since 
indexing
+       an array by object will give a warning in php 5 (and we were resetting 
the
+       array of _xh elements on every call anyway)
+
+       * xmlrpc.inc: commented unused code used originally for escaping content
+
+       * xmlrpc.inc: commented deprecated methods xmlrpc_encode and 
xmlrpc_decode
+
+       * xmlrpc.inc: php_xmlrpc_encode: encode integer-indexed php arrays as 
xmlrpc
+       arrays instead of structs; if object given to encode is an xmlrpcval 
return it
+       instead of reencoding (makes easier calling encode on an array of 
xmlrpcvals)
+
+       * xmlrpcs.inc: added $debug field to server class; if false will prevent
+       the server from echoing debug info back to the client as xml comment
+
+       * xmlrpcs.inc: let the server add to the debug messages the complete 
request
+       payload received and (if php installed as apache module) http headers, 
so that
+       the client in debug mode can echo a complete fingerprint of the 
communication
+
+       * xmlrpcs.inc: changed API of ParseRequest method: now it cannot be 
called
+       without a 'data' parameter; added 2nd parameter (http encoding); 
changed the
+       call to this method from inside service() method
+
+       * xmlrpc.inc, xmlrpcs.inc: enable both server and client to parse 
compressed xml
+       (if php is compiled with zlib); client should also be able to decode 
chunked
+       http encoding
+
+       * xmlrpc.inc: add support for proxies (only basic auth supported); 
default port
+       is 8080 (if left unspecified)
+
+       * xmlrpc.inc: use lowercase for names of http headers received (makes 
using
+       them much simpler, since servers can use any upper/lowercase 
combination)
+
+       * xmlrpc.inc: bumped version number to '2.0 beta'
+
+2005-05-08  Gaetano Giunta <address@hidden>
+
+       * release of version 1.1
+
+2005-04-24  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: removed charset declaration from xml prologue of 
responses,
+       since we are now escaping all non-ascii chars in an 
encoding-independent way
+
+       * bug_http.xml: modified to exercise some extra functonality of the lib
+       (it should now be failed by the current PEAR implementation of the lib)
+
+       * xmlrpc.inc: bumped up rev. number to 1.1
+
+       * doc/xmlrpc_php.xml, doc/announce1_1.txt: documentation updates
+
+       * Makefile: updated to reflect new xml doc source, modified filelist
+
+2005-04-17  Gaetano Giunta <address@hidden>
+
+       * client.php, agesort.php, introspect.php, introspect_demo.php,
+       which.php, test.pl, test.py: use as default target the server.php page 
hosted
+       on phpxmlrpc.sf.net
+
+       * server.php: fix for register_globals off; refer to docs on 
phpxmlrpc.sf.net
+
+2005-04-15 Miles Lott <address@hidden>
+
+       code formatting and comments
+
+2005-04-03  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: make use of global var $xmlrpcName in building User_Agent 
HTTP
+       header (in conjunction with $xmlrpcVersion)
+
+       * agesort.php, client.php, comment.php, dicuss.php, mail.php, 
server.php,
+       which.php: various janitorial fixes
+       + always html escape content received from xmlrpc server or from user 
input
+       + make the scripts run fine with register_globals off an 
register_long_arrays off
+       + always use the functions php_xmlrpc_en(de)code, even if the EPI 
extension
+       is not installed
+       + in mail.php, allow user to see script source even if support for 
.phps files
+       is not configured in the local web server
+
+       * testsuite.php: better detection of local webserver hostname for 
running tests
+       against (if the user did not supply a webserver name)
+
+2005-03-21  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: revert to a PHP3 compatible script (change '=& new' to 
'= new')
+
+       * xmlrpc.inc: revert to a PHP3 compatible script (lottsa fixes)
+
+       * testsuite.php: default to using local server as test target if no user
+       provided values are available instead of heddley.com server
+
+       * testsuite.php: play nice to PHP3 in retrieving user-passed values
+
+       * testsuite.php: fix constructor method name for a type of tests
+
+       * phpunit.php: fix all cases of call-time-pass-by-ref
+
+       * phpunit.php: rename Exception class to _Exception if the script is 
run with
+       PHP 5 (exception is a reserverd word)
+
+2005-03-19  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fixed bug in new http header parsing code in case there is
+       no correct separator between response headers and body
+
+       * xmlrpc.inc: added recognizing and stripping of HTTP/1.1 100 response 
headers
+
+       * xmlrpc.inc: strip extra whitespace from response body, as well as any 
junk
+       that comes after the last </MethodResponse> tag. It allows the server 
code to
+       be put on public providers that add e.g. javascript advertising to 
served pages
+
+       * xmlrpc.inc: removed unused parts of code, trailing whitespace
+
+       * xmlrpc.inc: fix possible bug (?) in xmlrpc_ee for BOOLEAN values: 
true was
+       being handled differently than false
+
+       * testsuite.php: added a new file-based test to stress the response 
parsing
+       modifications recently introduced; enabled debugging for file based 
tests
+
+2005-03-15  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: fixed missing declaration of global vars in xmlrpc_dh,
+       sendpayloadhttps and sendpayloadhttp10
+
+       * xmlrpc.inc: changed error message for invalid responses: 'enable 
debugging'
+       is more clear that 'enabling debugging' (the user is being encouraged 
to do it)
+
+       * xmlrpc.inc: rewrote HTTP response header parsing. It should be more 
tolerant
+       of invalid headers, give more accurate error messages and be marginally 
faster,
+       too.
+
+       * xmlrpc.inc: cosmetic whitespace fixes and remove useless one-liners
+
+       * xmlrpc.inc: build a shorter PHP command line to be evaluated for 
rebuilding
+       values from parsed xml: use '$val =& nex xmlrpcval("value")' for string 
values
+       instead of '$val =& nex xmlrpcval("value", $xmlrpcString)'
+
+       * xmlrpc.inc: fix change introduced 2005/01/30 moving call to 
curl_close()
+       too early: it did not work on error situations
+
+       * testsuite.php: fix name of testAddingTest method, renamed 
testErrosString
+       into testErrorString and removed useless warning for 
register_globals=off case
+
+2005-02-27  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: do not echo XML parsing error to screen (it is already 
dumped
+       into error log)
+
+       * xmlrpc.inc: set hdrs field into response object in case of XML 
parsing error
+       (uniform behaviour with other responses)
+
+2005-02-26  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: use global var $xmlrpcVersion as number for user agent 
string
+
+       * xmlrpcs.inc: eliminate server side PHP warning and give back to caller
+       a better error msg in case the called method exists but no signature 
matches
+       the number of parameters
+
+2005-02-20  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: accept a + sign in front of floats / integers, since the 
spec
+       clearly mentions it
+
+       * xmlrpc.inc, xmlrpcs.inc: renamed function XmlEntities to 
xmlrpc_encode_entitites,
+       to avoid using the same name as an array already defined
+
+       * xmlrpc.inc: fix bug introduced with escaping of UTF8 chars in xmlrpc 
error
+       responses: correct behaviour is to escape chars inside serialize(), not 
when
+       calling the xmlrpcresp creator
+
+       * testsuite.php: made test suite more friendly to modern PHP configs, 
allowing
+       register_globals to be off and to set in the URL all testing parameters;
+       added tests for newly introduced fixes; renamed existing tests acording 
to the
+       docs inside phpunit.php (e.g. no subclass of TestCase should have a name
+       starting with test...)
+
+2005-02-19  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: accept patch 683153 by mah0: if timeout is set, allow all 
socket
+       operations to timeout at the given time, not only the socket connection
+
+2005-02-13  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: be tolerant to double values received in exponential 
notation:
+       even though the spec forbids their usage PHP is fine with them
+
+       * xmlrpc.inc: fix bug: new xmlrpcval('-1') was creating an empty value 
instead
+       of a string value!
+
+       * xmlrpc.inc, xmlrpcs.inc: fix the payload encoding changes introduced 
by
+       Andres Salomon on 2004-03-17: sending named html entities inside an xml 
chunk
+       makes it invalid, and thus renders the lib absolutely non-interoperable 
with
+       any other xmlrpc implementation; moreover the current implementation 
only ever
+       worked for non-ascii requests, while breaking client-parsing of 
responses
+       containing non-ascii chars.
+       The principle of using entities is preserved though, because it allows 
the
+       client to send correct xml regardless of php internal charset encoding 
vs.
+       xml request charset encoding, but using 'character references' instead.
+
+       * xmlrpc.inc: encode (non-ascii) chars into charset entities also for 
error
+       strings
+
+       * xmlrpcs.inc: encode (non-ascii) chars into charset entities also for 
debug
+       messages
+
+       * xmlrpcs.inc: added 'Accept-Charset' header in http request to let the 
server
+       know what kind of charset encoding we do expect to be used for responses
+
+       * xmlrpc.inc, xmlrpcs.inc: explicitly tell the xml parser what charset 
the
+       application expects to receive content in (notably strings). A new 
variable,
+       $xmlrpc_internalencoding, (defaulting to ISO-8859-1) defines what 
charset the
+       parser will use for passing back string xmlrpcvals to the PHP 
application
+       (both server-side and client-side).
+       This allows transparent usage of e.g. UTF-8 for encoding xml messages 
between
+       server and client and ISO-8859-1 for internal string handling.
+       ISO-8859-1 is, AFAIK, PHP internal encoding for all installs except
+       mbstring-enabled ones.
+
+2005-02-12  Gaetano Giunta <address@hidden>
+
+       * xmlrpcs.inc: use '$var =& new(' construct to assign objects: on older 
versions
+       of PHP objects are first built then copied over if the ampersand is 
omitted.
+       Using it should make the code a little bit faster...
+
+       * doc/xmlrpc.php: update lib version number, release date in 
preparation for
+       next release
+
+       * makefile: update lib version number in preparation for next release
+
+       * xmlrpc.inc: split up parsing of xmlrpc INT and DOUBLE values. This 
allows
+       finer-grained control over valid values: now the '.' char is not allowed
+       any more inside int values.
+
+       * xmlrpc.inc: fix for bug #560303: ints and doubles starting with '0' 
chars are
+       no more parsed as octal values
+
+2005-01-30  Gaetano Giunta <address@hidden>
+
+       * xmlrpc.inc: Modifed last change by Miles: the functions 
php_xmlrpc_encode
+       and php_xmlrpc_decode are now always defined, regardless of the 
existence of
+       XMLRPC-EPI.  This allows users to start using these functions as the 
'default'
+       functions, and pave the way for future deprecation of 
xmlrpc_encode/encode
+       while maintaining a stable API.
+
+       * xmlrpc.inc: use '$var =& new(' construct to assign objects: on older 
versions
+       of PHP objects are first built then copied over if the ampersand is 
omitted.
+       Using it should make the code a little bit faster...
+
+       * xmlrpc.inc: close curl connection as soon as possible for https 
requests:
+       it could save some memory / resources.
+
+       * xmlrpc.inc: added some extra info in the PHP error log message 
generated
+       when an invalid xmlrpc integer/float value is encountered and we try to
+       deserialize it.
+
+       * xmlrpc.inc: added @ char before fsockopen to avoid echoing useless 
warnings
+       when connection to server fails; added the same to avoid echoing 
warnings when
+       deserializing data of an unknown type
+
+       * xmlrpc.inc: reset the _xh array on each xmlrpc call: otherwise a new 
array
+       member is created for each consecutive call and never destroyed, thus 
making it
+       impossible to build an xmlrpc-client daemon beacuse of memory leaking.
+
+       * xmlrpc.inc: declare global the variables that are used as 'constants',
+       so that xmlrpc.inc will work even if it is included from within a 
function
+
+2004-12-27  Miles Lott <address@hidden>
+       * xmlrpc.inc: A new constant, XMLRPC_EPI_ENABLED, is defined depending 
on
+       the existence of the function, xmlrpc_decode.  This function will exist 
in
+       PHP if the extension, XMLRPC-EPI (http://xmlrpc-epi.sourceforge.net), is
+       loaded.  It defines the functions xmlrpc_encode and xmlrpc_decode, which
+       will conflict with functions of the same name in xmlrpc.inc.  If this
+       extension is loaded, we instead use the names php_xmlrpc_encode and
+       php_xmlrpc_decode.  Please look at server.php, testsuite.php, etc., for
+       how this should be handled if using these functions.
+
+2003-04-17  Andres Salomon  <address@hidden>
+       * xmlrpc.inc: encode strings using htmlentities() instead of
+       htmlspecialchars(), and add xmlrpc_html_entity_xlate().  This
+       should fix longstanding issues with sending weird chars (from
+       non-USASCII codesets like UTF-8, ISO-8859-1, etc) that caused
+       the xml parser to choke.  Multi-byte chars are now changed to
+       entities before sending, so that the xmlrpc server doesn't need
+       to know the encoding type of the POST data.
+       * xmlrpcs.inc: call xmlrpc_html_entity_xlate before parsing
+       request packet.  The parser chokes on unknown entities (the
+       entities created by htmlentities() are exactly that; html
+       entities, not xml entities), so they must be converted from
+       name form (&eacute;) to numerical form (&#233;).
+
+2003-01-12  Andres Salomon  <address@hidden>
+
+       * released 1.0.99.2.
+       * Makefile: separate doc/Makefile a bit more from Makefile,
+       and add clean rules.
+
+2003-01-10  Andres Salomon  <address@hidden>
+
+       * xmlrpc.inc: xmlrpcresp and parseResponse cleanups; variable
+       name renames ('xv' to 'val', for example), type checking, and
+       stricter default values.
+       * xmlrpc.inc: fix xmlrpcresp's faultcode; return -1 for FAULT
+       responses from the server whose faultcodes don't reflect any
+       errors.
+
+2003-01-08  Andres Salomon  <address@hidden>
+
+       * xmlrpc.inc: rename $_xh[$parser]['ha'] to
+       $_xh[$parser]['headers'].
+       * xmlrpc.inc: fix bugs related to $_xh[$parser]['headers];
+       some places treated this as an array, others as a scalar.
+       Treat unconditionally as an array.  Also wrap header debugging
+       output in PRE tags.
+
+2002-12-17  Andres Salomon  <address@hidden>
+
+       * released 1.0.99.
+       * Makefile: changed the tarball format/dist rule to a more
+       conventional form, as well as normal release updates.
+       * xmlrpc.inc: added setSSLVerifyPeer and setSSLVerifyHost; as
+       of curl 7.10, various certificate checks are done (by default).
+       The default for CURLOPT_SSL_VERIFYHOST is to ensure the common
+       name on the cert matches the provided hostname.  This breaks a
+       lot of stuff, so allow users to override it.
+       * doc/xmlrpc_php.sgml: updated documentation accordingly.
+
+2002-09-06  Geoffrey T. Dairiki  <address@hidden>
+
+       Add support for system.multicall() to both the client
+       and the server.
+
+       * testsuite.php: Add new tests 'testServerMulticall',
+       and 'testClientMulticall'.
+
+       * xmlrpc.inc: Added new error messages for system.multicall().
+       * xmlrpcs.inc: Added new procedure call system.multicall().
+       See http://www.xmlrpc.com/discuss/msgReader$1208 for details.
+
+       * xmlrpc.inc: Added system.multicall functionality to
+       xmlrpc_client.  xmlrpc_client::send can now take an array of
+       xmlrpcmsg's as an argument.  In that case it will attempt
+       to execute the whole array of procure calls in a single
+       HTTP request using system.multicall().  (If that attempt fails,
+       then the calls will be excuted one at a time.)  The return
+       value will be an array of xmlrpcresp's (or 0 upon transport
+       failure.)
+
+2001-11-29  Edd Dumbill  <address@hidden>
+
+       * xmlrpc.inc: fixed problem with processing HTTP headers that
+       broke any payload with more than one consecutive newline in it.
+       also initialise the 'ac' array member to empty string at start.
+       * testsuite.php: added unit test to exercise above bug
+       * xmlrpcs.inc: fixed uninitialized variable $plist
+
+2001-09-25  Edd Dumbill  <address@hidden>
+
+       * xmlrpc.inc: applied urgent security fixes as identified by Dan
+       Libby
+
+2001-08-27  Edd Dumbill  <address@hidden>
+
+       * xmlrpc.inc: Merged in HTTPS support from Justin Miller, with a
+       few additions for better traceability of failure conditions. Added
+       small fix from Giancarlo Pinerolo. Bumped rev to 1.0. Changed
+       license to BSD license.
+
+2001-06-15  Edd Dumbill  <address@hidden>
+
+       * xmlrpcs.inc: Added \r into return MIME headers for server class
+
+2001-04-25  Edd Dumbill  <address@hidden>
+
+       * server.php: Added interop suite of methods.
+
+2001-04-24  Edd Dumbill  <address@hidden>
+
+       * testsuite.php: added in test case for string handling bug.
+
+       * xmlrpc.inc: merged in minor fixes from G Giunta to fix
+       noninitialization. Created new method, getval(), which includes
+       experimental support for recreating nested arrays, from Giunta and
+       Sofer. Fixed string handling bug where characters after </string>
+       but before </value> weren't ignored. Added in support for native
+       boolean type into xmlrpc_encode (Giunta).
+
+       * xmlrpcs.inc: updated copyright notice
+
+2001-01-15  Edd Dumbill  <address@hidden>
+
+       * xmlrpc.inc: fixed bug with creation of booleans. Put checks in
+       to ensure that numbers were really numeric. Fixed bug with
+       non-escaping of dollar signs in strings.
+
+       * testsuite.php: created test suite.
+
+2000-08-26  Edd Dumbill  <address@hidden>
+
+       * xmlrpcs.inc: added xmlrpc_debugmsg() function which outputs
+       debug information in comments inside the return payload XML
+
+       * xmlrpc.inc: merged in some changes from Dan Libby which fix up
+       whitespace handling.
+
+       * xmlrpcs.inc: added Content-length header on response (bug from
+       Jan Varga <address@hidden>. This means you can no longer print
+       during processing
+
+       * xmlrpc.inc: changed ereg_replace to str_replace in several
+       places (thanks to Dan Libby <address@hidden> for this).
+
+       * xmlrpc.inc: added xmlrpc_encode() and xmlrpc_decode() from Dan
+       Libby--these helper routines make it easier to work in native PHP
+       data structures.
+
+2000-07-21  Edd Dumbill  <address@hidden>
+
+       * xmlrpc.inc: added xmlrpc_client::setCredentials method to pass
+       in authorization information, and modified sendPayload* methods to
+       send this OK. Thanks to Grant Rauscher for the impetus to do this.
+       Also, made the client send empty <params></params> if there are no
+       parameters set by the user.
+
+       * doc/xmlrpc_php.sgml: updated documentation to reflect recent
+       changes
+
+
+2000-07-18  Edd Dumbill  <address@hidden>
+
+       * server.php: added examples.invertBooleans method to server as a
+       useful test method for boolean values.
+
+       * xmlrpc.inc: rearranged the way booleans are handled to fix
+       outstanding problems. Fixed calling addScalar() on arrays so it
+       works. Finally fixed backslashification issues to remove the
+       problem will dollar signs disappearing.
+
+       * booltest.php: really fixed booleans this time.
+
+2000-06-03  Edd Dumbill  <address@hidden>
+
+       * xmlrpcs.inc: made signature verification more useful - now
+       returns what it found was wrong
+
+       * xmlrpc.inc: fixed bug with decoding dateTimes. Also fixed a bug
+       which meant a PHP syntax error happened when attempting to receive
+       empty arrays or structs. Also fixed bug with booleans always being
+       interpreted as 'true'.
+
+       * server.php: Added validator1 suite of tests to test against
+       validator.xmlrpc.com
+
+
+2000-05-06  Edd Dumbill  <address@hidden>
+
+       * released 1.0b6
+
+       * added test.pl and test.py, Perl and Python scripts that exercise
+       server.php somewhat (but not a lot)
+
+       * added extra fault condition for a non 200 OK response from the
+       remote server.
+
+       * added iso8601_encode() and iso8601_decode() to give some support
+       for passing dates around. They translate to and from UNIX
+       timestamps. Updated documentation accordingly.
+
+       * fixed string backslashification -- was previously a little
+       overzealous! new behavior is '\' --> '\\' and '"' -->
+       '\"'. Everything else gets left alone.
+
+2000-04-12  Edd Dumbill  <address@hidden>
+
+       * updated and bugfixed the documentation
+
+       * fixed base 64 encoding to only happen at serialize() time,
+       rather than when a base64 value is created. This fixes the double
+       encoding bug reported by Nicolay Mausz
+       <address@hidden>. The same approach ought to be taken with
+       encoding XML entities in the data - this is a TODO.
+
+       * integrated further code from Peter Kocks: used his new code for
+       send(), adding a second, optional, parameter which is a timeout
+       parameter to fsockopen()
+
+1999-10-11  Edd Dumbill  <address@hidden>
+
+       * added bug fixes from Peter Kocks <address@hidden>
+
+1999-10-10  Edd Dumbill  <address@hidden>
+
+       * updated the documentation
+
+1999-10-08  Edd Dumbill  <address@hidden>
+
+       * added system.* methods and dispatcher, plus documentation
+
+       * fixed bug which meant request::getNumParams was returning an
+       incorrect value
+
+       * added signatures into the dispatch map. This BREAKS
+       COMPATIBILITY with previous releases of this code
+
+1999-08-18  Edd Dumbill  <address@hidden>
+
+       * made entity encoding and decoding transparent now on string
+       passing.
+
+       * de-globalised the globals in the parse routines, using an
+       associative array to hold all parser state $_xh
+
+       * changed default input encoding to be UTF-8 to match expectation
+
+       * separated out parseResponse into parseResponse and
+       parseResponseFile so that you can call parseResponse on a string
+       if you have one handy
+
+1999-07-20  Edd Dumbill  <address@hidden>
+
+       * Moved documentation into Docbook format
+
+1999-07-19  Edd Dumbill  <address@hidden>
+
+       * Added an echo server into server.php and echotest.php, a client
+       which will exercise the new echo routine.
+
+       * Added test for no valid value returned: in this case will now
+       throw the error "invalid payload"
+
+       * Added serialize() method to xmlrpcresp to return a string with
+       the response serialized as XML
+
+       * Added automatic encoding and decoding for base64 types
+
+       * Added setDebug() method to client to enable HTML output
+       debugging in the client
+
+1999-07-08  Edd Dumbill  <address@hidden>
+
+       * Improved XML parse error reporting on the server side to send it
+       back in a faultCode packet. expat errors now begin at 100
+
+1999-07-07  Edd Dumbill  <address@hidden>
+
+       * Changed the structmem and arraymem methods of xmlrpcval to always
+       return xmlrpc vals whether they referred to scalars or complex
+       types.
+
+       * Added the server class and demonstrations
+
+       * Fixed bugs in the XML parsing and reworked it
+
+
+$Id: ChangeLog,v 1.96 2009/03/16 19:39:11 ggiunta Exp $

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/Makefile
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/Makefile                  
        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/Makefile  2009-11-20 
09:44:45 UTC (rev 20836)
@@ -0,0 +1,123 @@
+# Makefile for phpxmlrpc library
+# $Id: Makefile,v 1.37 2008/03/06 22:37:19 ggiunta Exp $
+
+### USER EDITABLE VARS ###
+
+# path to PHP executable, preferably CLI version
+PHP=/usr/local/bin/php
+
+# path were xmlrpc lib files will be copied to
+PHPINCLUDEDIR=/usr/local/lib/php
+
+# mkdir is a thorny beast under windows: make sure we can not use the cmd 
version, running eg. "make MKDIR=mkdir.exe"
+MKDIR=mkdir
+
+#find too
+FIND=find
+
+
+#### DO NOT TOUCH FROM HERE ONWARDS ###
+
+# recover version number from code
+# thanks to Firman Pribadi for unix command line help
+#   on unix shells lasts char should be \\2/g )
+export VERSION=$(shell egrep "\$GLOBALS *\[ *'xmlrpcVersion' *\] *= *'" 
lib/xmlrpc.inc | sed -r s/"(.*= *' *)([0-9a-zA-Z.-]+)(.*)"/\2/g )
+
+LIBFILES=lib/xmlrpc.inc lib/xmlrpcs.inc lib/xmlrpc_wrappers.inc
+
+EXTRAFILES=extras/test.pl \
+ extras/test.py \
+ extras/rsakey.pem \
+ extras/workspace.testPhpServer.fttb
+
+DEMOFILES=demo/vardemo.php \
+ demo/demo1.txt \
+ demo/demo2.txt \
+ demo/demo3.txt
+
+DEMOSFILES=demo/server/discuss.php \
+ demo/server/server.php \
+ demo/server/proxy.php
+
+DEMOCFILES=demo/client/agesort.php \
+ demo/client/client.php \
+ demo/client/comment.php \
+ demo/client/introspect.php \
+ demo/client/mail.php \
+ demo/client/simple_call.php \
+ demo/client/which.php \
+ demo/client/wrap.php \
+ demo/client/zopetest.php
+
+TESTFILES=test/testsuite.php \
+ test/benchmark.php \
+ test/parse_args.php \
+ test/phpunit.php \
+ test/verify_compat.php \
+ test/PHPUnit/*.php
+
+INFOFILES=Changelog \
+ Makefile \
+ NEWS \
+ README
+
+DEBUGGERFILES=debugger/index.php \
+ debugger/action.php \
+ debugger/common.php \
+ debugger/controller.php
+
+
+all: install
+
+install:
+       cd lib && cp ${LIBFILES} ${PHPINCLUDEDIR}
+       @echo Lib files have been copied to ${PHPINCLUDEDIR}
+       cd doc && $(MAKE) install
+
+test:
+       cd test && ${PHP} -q testsuite.php
+
+
+### the following targets are to be used for library development ###
+
+# make tag target: tag existing working copy as release in cvs.
+# todo: convert dots in underscore in $VERSION
+tag:
+       cvs -q tag -p release_${VERSION}
+
+dist: xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz
+
+xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz: ${LIBFILES} ${DEBUGGERFILES} 
${INFOFILES} ${TESTFILES} ${EXTRAFILES} ${DEMOFILES} ${DEMOSFILES} ${DEMOCFILES}
+       @echo ---${VERSION}---
+       rm -rf xmlrpc-${VERSION}
+       ${MKDIR} xmlrpc-${VERSION}
+       ${MKDIR} xmlrpc-${VERSION}/demo
+       ${MKDIR} xmlrpc-${VERSION}/demo/client
+       ${MKDIR} xmlrpc-${VERSION}/demo/server
+       ${MKDIR} xmlrpc-${VERSION}/test
+       ${MKDIR} xmlrpc-${VERSION}/test/PHPUnit
+       ${MKDIR} xmlrpc-${VERSION}/extras
+       ${MKDIR} xmlrpc-${VERSION}/lib
+       ${MKDIR} xmlrpc-${VERSION}/debugger
+       cp --parents ${DEMOFILES} xmlrpc-${VERSION}
+       cp --parents ${DEMOCFILES} xmlrpc-${VERSION}
+       cp --parents ${DEMOSFILES} xmlrpc-${VERSION}
+       cp --parents ${TESTFILES} xmlrpc-${VERSION}
+       cp --parents ${EXTRAFILES} xmlrpc-${VERSION}
+       cp --parents ${LIBFILES} xmlrpc-${VERSION}
+       cp --parents ${DEBUGGERFILES} xmlrpc-${VERSION}
+       cp ${INFOFILES} xmlrpc-${VERSION}
+       cd doc && $(MAKE) dist
+#   on unix shells last char should be \;
+       ${FIND} xmlrpc-${VERSION} -type f ! -name "*.fttb" ! -name "*.pdf" ! 
-name "*.gif" -exec dos2unix {} ;
+       -rm xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz
+       tar -cvf xmlrpc-${VERSION}.tar xmlrpc-${VERSION}
+       gzip xmlrpc-${VERSION}.tar
+       zip -r xmlrpc-${VERSION}.zip xmlrpc-${VERSION}
+
+doc:
+       cd doc && $(MAKE) doc
+
+clean:
+       rm -rf xmlrpc-${VERSION} xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz
+       cd doc && $(MAKE) clean

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/NEWS
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/NEWS                      
        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/NEWS      2009-11-20 
09:44:45 UTC (rev 20836)
@@ -0,0 +1,333 @@
+XML-RPC for PHP version 3.0.0 beta - 2009/09/05
+
+This is the first release of the library to only support PHP 5.
+Some legacy code has been removed, and support for features such as exceptions
+and dateTime objects introduced.
+
+The "beta" tag is meant to indicate the fact that the refactoring has been 
more widespread
+than in precedent releases and that more changes are likely to be introduced 
with time -
+the library is still considered to be production quality.
+
+* improved: removed all usage of php functions deprecated in php 5.3, usage of 
assign-by-ref when creating new objects etc...
+* improved: add support for the <ex:nil/> tag used by the apache library, both 
in input and output
+* improved: add support for dateTime objects in both in php_xmlrpc_encode and 
as parameter for constructor of xmlrpcval
+* improved: add support for timestamps as parameter for constructor of 
xmlrpcval
+* improved: add option 'dates_as_objects' to php_xmlrpc_decode to return 
dateTime objects for xmlrpc datetimes
+* improved: add new method SetCurlOptions to xmrlpc_client to allow extra 
flexibility in tweaking http config, such as explicitly binding to an ip address
+* improved: add new method SetUserAgent to xmrlpc_client to to allow having 
different user-agent http headers
+* improved: add a new member variable in server class to allow fine-tuning of 
the encoding of returned values when the server is in 'phpvals' mode
+* improved: allow servers in 'xmlrpcvals' mode to also register plain php 
functions by defining them in the dispatch map with an added option
+* improved: catch exceptions thrown during execution of php functions exposed 
as methods by the server
+* fixed: bad encoding if same object is encoded twice using php_xmlrpc_encode
+
+
+XML-RPC for PHP version 2.2.2 - 2009/03/16
+
+This release corrects all bugs that have been reported and sucesfully 
reproduced since
+version 2.2.1.
+Regardless of the intimidating message about dropping PHP 4 support, it still 
does
+support that ancient, broken and insecure platform.
+
+* fixed: php warning when receiving 'false' in a bool value
+* fixed: improve robustness of the debugger when parsing weird results from 
non-compliant servers
+* fixed: format floating point values using the correct decimal separator even 
when php locale is set to one that uses comma
+* fixed: use feof() to test if socket connections are to be closed instead of 
the number of bytes read (rare bug when communicating with some servers)
+* fixed: be more tolerant in detection of charset in http headers
+* fixed: fix encoding of UTF8 chars outside of the BMP plane
+* fixed: fix detection of zlib.output_compression
+* improved: allow the add_to_map server method to add docs for single params 
too
+* improved: added the possibility to wrap for exposure as xmlrpc       methods 
plain php class methods, object methods and even whole classes
+
+
+XML-RPC for PHP version 2.2.1 - 2008/03/06
+
+This release corrects all bugs that have been reported and sucesfully 
reproduced.
+It is the last release of the library that will support PHP 4.
+
+* fixed: work aroung bug in php 5.2.2 which broke support of HTTP_RAW_POST_DATA
+* fixed: is_dir parameter of setCaCertificate() method is reversed
+* fixed: a php warning in xmlrpc_client creator method
+* fixed: parsing of '1e+1' as valid float
+* fixed: allow errorlevel 3 to work when prev. error handler was a static 
method
+* fixed: usage of client::setcookie() for multiple cookies in non-ssl mode
+* improved: support for CP1252 charset is not part or the library but almost 
possible
+* improved: more info when curl is enabled and debug mode is on
+
+
+XML-RPC for PHP version 2.2 - 2007/02/25
+
+This release corrects a couple of bugs and adds a few minor features.
+
+* fixed: debugger errors on php installs with magic_quotes_gpc on
+* fixed: support for https connections via proxy
+* fixed: wrap_xmlrpc_method() generated code failed to properly encode php 
objects
+* improved: slightly faster encoding of data which is internally UTF-8
+* improved: debugger always generates a 'null' id for jsonrpc if user omits it
+* new: debugger can take advantage of a graphical value builder
+  (it has to be downloaded separately, as part of jsxmlrpc package)
+* new: support for the <NIL/> xmlrpc extension
+* new: server support for the system.getCapabilities xmlrpc extension
+* new: wrap_xmlrpc_method() accepts two new options: debug and return_on_fault
+
+
+XML-RPC for PHP version 2.1 - 2006/08/28
+
+This release corrects quite a few bugs and adds some interesting new features.
+There is a minor security enhancement and overall speedup too.
+
+It has been tested with PHP 4.0.5 up to 4.4.4 and 5.1.5.
+Please note that 404pl1 is NOT supported, and has not been since 2.0.
+
+*** PLASE READ CAREFULLY BELOW ***
+
+CHANGES THAT MIGHT AFFECT DEPLOYED APPLICATIONS:
+
+The wrap_php_function and wrap_xmlrpc_method functions have been moved out of
+the base library file xmlrpc.inc into a file of their own: xmlrpc_wrappers.inc.
+You will have to include() / require() it in your scripts if you have been 
using
+those functions.
+
+For increased security, the automatic rebuilding of php object instances out of
+received xmlrpc structs in wrap_xmlrpc_method() has been disabled (but it can 
be
+optionally reenabled).
+
+The constructor of xmlrpcval() values has seen major changes, and it will not
+throw a php warning anymore when invoked using an unknown xmlrpc type: the
+error will only be written to php error log. Also new xmlrpcval('true', 
'boolean')
+is not supported anymore.
+
+MAJOR IMPROVEMENTS:
+
+The new function php_xmlrpc_decode_xml() will take the xml representation of
+either an xmlrpc request, response or single value and return the corresponding
+php-xmlrpc object instance.
+
+Both wrap_php_function() and wrap_xmlrpc_method() functions accept many more
+options to fine tune their behaviour, including one to return the php code to
+be saved and later used as standalone php script.
+
+A new function wrap_xmlrpc_server() has been added, to wrap all (or some) of 
the
+methods exposed by a remote xmlrpc server into a php class.
+
+Lib internals have been modified to provide better support for grafting extra
+functionality on top of it. Stay tuned for future releases of the EXTRAS 
package.
+
+Last but not least a new file has been added: verify_compat.php, to help users
+diagnose the level of compliance of the current php install with the library.
+
+CHANGELOG IN DETAIL:
+
+* fixed bug 1311927: client not playing nice with some proxy/firewall on ports 
!= 80
+* fixed bug 1334340: all ereg_ functions have been replaced with corresponding 
preg_
+* fixed bug: wrong handling of 'deflate' http encoding, both server and client 
side
+* fixed bug: sending compressed responses when php output compression is 
enabled was not working
+* fixed bug: addarray() and addstruct() where not returning 1 when adding data 
to already initialized values
+* fixed bug: non-ascii chars used in struct element names where not being 
encoded correctly
+* restored compatibility with php 4.0.5 (for those poor souls still stuck on 
it)
+* server->service() now returns either the payload or xmlrpcresp instance
+* server->add_to_map() now accepts methods with no param definitions
+* added new function: php_xmlrpc_decode_xml()
+* added new function: wrap_xmlrpc_server()
+* major improvements and security enhancements to wrap_php_function() and 
wrap_xmlrpc_method()
+* documentation for single parameters of exposed methods can be added to the 
dispatch map
+  (and turned into html docs in conjunction with a future release of the 
extras package)
+* full response payload is saved into xmlrpcresp object for further debugging
+* stricter parsing of incmoing xmlrpc messages: two more invalid cases are now 
detected
+  (double data element inside array and struct/array after scalar inside value 
element)
+* debugger can now generate code that wraps a remote method into php function 
(works for jsonrpc, too)
+* debugger has better support for being activated via a single GET call (for 
integration into other tools?)
+* more logging of errors in a lot of situations
+* javadoc documentation of lib files almost complete
+* the usual amount of new testcases in the testsuite
+* many performance tweaks and code cleanups
+* added foundation for emulating the API of the xmlrpc extension (extras 
package needed)
+
+
+XML-RPC for PHP version 2.0 - 2006/04/24
+
+I'm pleased to announce XML-RPC for PHP version 2.0, final.
+
+With respect to the last release candidate, this release corrects a few small
+bugs and adds a couple of new features: more authentication options (digest and
+ntlm for servers, ntlm for proxies, and some https custom certificates stuff);
+all the examples have been reviewed and some demo files added,
+including a ready-made xmlrpc proxy (useful e.g. for ajax calls, when the 
xmlrpc
+client is a browser); the server logs more warning messages for incorrect 
situations;
+both client and server are more tolerant of commonly-found mistakes.
+The debugger has been upgraded to reflect the new client capabilities.
+
+In greater detail:
+
+* fixed bug: method xmlrpcval::structmemexists($value) would not work
+* fixed bug: wrap_xmlrpc_method would fail if invoked with a client object that
+  has return_type=phpvals
+* fixed bug: in case of call to client::multicall without fallback and server 
error
+* fixed bug: recursive serialization of xmlrpcvals loosing specified UTF8 
charset
+* fixed bug: serializing to ISO-8859-1 with php 5 would raise an error if 
non-ascii
+  chars where found when decoding
+* new: client can use NTLM and Digest authentication methods for https and 
http 1.1
+  connections; authentication to proxy can be set to NTLM, too
+* new: server tolerates user functions returning a single xmlrpcval object 
instead
+  of an xmlrpcresp
+* new: server does more checks for presence and correct return type of user
+  coded method handling functions, and logs inconsistencies to php error log
+* new: client method SetCaCertificate($cert, $is_dir) to validate server 
against
+* new: both server and client tolerate receiving 'true' and 'false' for bool 
values
+  (which btw are not valid according to the xmlrpc spec)
+
+
+XML-RPC for PHP version 2.0RC3 - 2006/01/22
+
+This release corrects a few bugs and adds some interesting new features.
+It has been tested with PHP up to 4.4.2 and 5.1.2.
+
+* fixed bug: server not recognizing clients that declare support for http 
compression
+* fixed bug: serialization of new xmlrpcval (8, 'string') when internal 
encoding
+  set to UTF-8
+* fixed bug: serialization of new xmlrpcval ('hello', 'int') would produce
+  invalid xml-rpc
+* new: let the server accept 'class::method' syntax in the dispatch map
+* new: php_xmlrpc_decode() can decode xmlrpcmessage objects
+* new: both client and server can specify a charset to be used for serializing
+  values instead of the default 'US-ASCII+xml-entities-for-other-characters'.
+  Values allowed: ISO-8859-1 and UTF-8
+* new: the server object can register 'plain' php functions instead of 
functions
+  that accept a single parameter of type xmlrpcmsg. Faster, uses less memory
+  (but comes with minor drawbacks as well, read the manual for more details)
+* new: client::setDebug(2) can be used to have the request payload printed to
+  screen before being sent
+* new: server::service($data) lets user parse data other than POST body, for
+  easier testing / subclassing
+* changed: framework-generated debug messages are sent back by the server 
base64
+  encoded, to avoid any charset/xml compatibility problem
+* other minor fixes
+
+The usual refactoring of a lot of (private) methods has taken place, with new
+parameters added to some functions.
+Javadoc documentation has been improved a lot.
+The HTML documentation has been shuffled around a bit, hoping to give it a more
+logical organization.
+
+The experimental support for the JSON protocol has been removed, and will be
+packaged as a separate download with some extra very interesting stuff (human
+readable auto-generated documentation, anyone?).
+
+
+XML-RPC for PHP version 2.0RC2 - 2005/11/22
+
+This release corrects a few bugs and adds basically one new method for better
+HTTPS support:
+
+ * fixed two bugs that prevented xmlrpc calls to take place over https
+ * fixed two bugs that prevented proper recognition of xml character set
+   when it was declared inside the xml prologue
+ * added xmlrpc_client::setKey($key, $keypass) method, to allow using client
+   side certificates for https connections
+ * fixed bug that prevented proper serialization of string xmlrpcvals when
+   $xmlrpc_internalencoding was set to UTF-8
+ * fixed bug in xmlrpc_server::echoInput() (and marked method as deprecated)
+ * correctly set cookies/http headers into xmlrpcresp objects even when the
+   sned() method call fails for some reason
+ * added a benchmark file in the testsuite directory
+
+A couple of (private/protected) methods have been refactored, as well as a
+couple of extra parameters added to some (private) functions - this has no
+impact on the public API and should be of interest primarily to people 
extending
+/ subclassing the lib.
+
+There is also new, PARTIAL support for the JSON-RPC protocol, implemented in
+two files in the extras dir (more info about json-rpc at http://json-rpc.org)
+
+
+XML-RPC for PHP version 2.0RC1 - 2005/10/03
+
+I'm pleased to announce XML-RPC for PHP version 2.0, release candidate 1.
+
+This release introduces so many new features it is almost impossible to list 
them
+here, making the library finally on pair with, if not more advanced than, any 
other
+similar offer (e.g. the PEAR XMLRPC package or the Incutio IXR library).
+No, really, trust me.
+
+The minimum supported PHP version is now 4.2 - natively - or 4.0.4pl1 - by 
usage of
+a couple of compatibility classes (code taken from PEAR php_compat package).
+
+The placement of files and directories in the distribution has been deeply 
modified,
+in the hope of making it more clear, now that the file count has increased.
+I hope you find it easy.
+
+Support for "advanced" HTTP features such as cookies, proxies and keep-alives 
has
+been added at last.
+
+It is now much easier to convert between xmlrpcval objects and php values, and
+in fact php_xmlrpc_encode and php_xmlrpc_decode are now the recommended methods
+for all cases, except when encoding base64 data.
+
+Two new (experimental) functions have been added, allowing automagic conversion
+of a php function into an xmlrpc method to be exposed and vice-versa.
+
+PHP objects can be now automatically serialized as xmlrpc struct values and
+correctly deserialized on the other end of the transmission, provided that the
+same class definition is present on both sides and no object members are of
+type resource.
+
+A lot of the existing class methods have been overloaded with extra parameters
+or new functionality, and a few added ex-novo, making usage easier than ever.
+
+A complete debugger solution is included in the distribution. It needs a web 
server
+to run (a freely available version of the same debugger is accessible online, 
it
+can be found at http://phpxmlrpc.sourceforge.net).
+
+For a more detailed list of changes, please read carefully chapter 2 of the
+included documentation, or, even better, take a look at the source code, which
+is commented in javadoc style quite a bit.
+
+
+XML-RPC for PHP version 1.2 - 2005/08/14
+
+This removes all use of eval(), which is a potential security problem.
+All users are encouraged to upgrade as soon as possible.
+As of this release we are no longer php3-compatible.
+
+
+XML-RPC for PHP version 1.1.1 - 2005/06/30
+
+This is a security vulnerability fix release.
+All users are invited to upgrade as soon as possible.
+
+
+XML-RPC for PHP version 1.1 - 2005/05/03
+
+I'm pleased to announce XML-RPC for PHP version 1.1
+It's taken two years to get to the this point, but here we are, finally.
+
+This is a bugfix and maintenance release. No major new features have been 
added.
+All known bugs have been ironed out, unless fixing would have meant breaking
+the API.
+The code has been tested with PHP 3, 4 and 5, even tough PHP 4 is the main
+development platform (and some warnings will be emitted when runnning PHP5).
+
+Notheworthy changes include:
+
+ * do not clash any more with the EPI xmlrpc extension bundled with PHP 4 and 5
+ * fixed the unicode/charset problems that have been plaguing the lib for years
+ * proper parsing of int and float values prepended with zeroes or the '+' char
+ * accept float values in exponential notation
+ * configurable http user-agent string
+ * use the same timeout on client socket reads as used for connecting
+ * more explicative error messages in xmlrpcresponse in many cases
+ * much more tolerant parsing of malformed http responses from xmlrpc servers
+ * fixed memleak that prevented the client to be used in never-ending scripts
+ * parse bigger xmlrpc messages without crashing (1MB in size or more)
+ * be tolerant to xmlrpc responses generated on public servers that add
+   javascript advertising at the end of hosted content
+ * the lib generates quite a few less PHP warnings during standard operation
+
+This is the last release that will support PHP 3.
+The next release will include better support for PHP 5 and (possibly) a slew of
+new features.
+
+The changelog is available at:
+http://cvs.sourceforge.net/viewcvs.py/phpxmlrpc/xmlrpc/ChangeLog?view=markup
+
+Please report bugs to the XML-RPC PHP mailing list or to the sourceforge 
project
+pages at http://sourceforge.net/projects/phpxmlrpc/

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/README
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/README                    
        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/README    2009-11-20 
09:44:45 UTC (rev 20836)
@@ -0,0 +1,13 @@
+NAME: XMLRPC FOR PHP
+
+DESCRIPTION: A php library for building xmlrpc clients and servers
+
+
+
+HTML documentation can be found in the doc/ directory.
+
+Recent changes in the ChangeLog
+
+Use of this software is subject to the terms in doc/index.html
+
+The passphrase for the rsakey.pem certificate is 'test'.

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/action.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/action.php       
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/action.php       
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,527 @@
+<?php
+/**
+ * @version $Id$
+ * @author Gaetano Giunta
+ * @copyright (C) 2005-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ *
+ * @todo switch params for http compression from 0,1,2 to values to be used 
directly
+ * @todo use ob_start to catch debug info and echo it AFTER method call 
results?
+ * @todo be smarter in creating client stub for proxy/auth cases: only set 
appropriate property of client obj
+ **/
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+<head>
+  <title>XMLRPC Debugger</title>
+  <meta name="robots" content="index,nofollow" />
+<style type="text/css">
+<!--
+body {border-top: 1px solid gray; padding: 1em; font-family: Verdana, Arial, 
Helvetica; font-size: 8pt;}
+h3 {font-size: 9.5pt;}
+h2 {font-size: 12pt;}
+.dbginfo {padding: 1em; background-color: #EEEEEE; border: 1px dashed silver; 
font-family: monospace;}
+#response {padding: 1em; margin-top: 1em; background-color: #DDDDDD; border: 
1px solid gray; white-space: pre; font-family: monospace;}
+table {padding: 2px; margin-top: 1em;}
+th {background-color: navy; color: white; padding: 0.5em;}
+td {padding: 0.5em; font-family: monospace;}
+td form {margin: 0;}
+.oddrow {background-color: #EEEEEE;}
+.evidence {color: blue;}
+#phpcode { background-color: #EEEEEE; padding: 1em; margin-top: 1em;}
+-->
+</style>
+</head>
+<body>
+<?php
+
+  include(getcwd().'/common.php');
+  if ($action)
+  {
+
+    // make sure the script waits long enough for the call to complete...
+    if ($timeout)
+      set_time_limit($timeout+10);
+
+    include('xmlrpc.inc');
+    if ($wstype == 1)
+    {
+      @include('jsonrpc.inc');
+      if (!class_exists('jsonrpc_client'))
+      {
+        die('Error: to debug the jsonrpc protocol the jsonrpc.inc file is 
needed');
+      }
+      $clientclass = 'jsonrpc_client';
+      $msgclass = 'jsonrpcmsg';
+      $protoname = 'JSONRPC';
+    }
+    else
+    {
+      $clientclass = 'xmlrpc_client';
+      $msgclass = 'xmlrpcmsg';
+      $protoname = 'XMLRPC';
+    }
+
+    if ($port != "")
+    {
+      $client = new $clientclass($path, $host, $port);
+      $server = "$host:$port$path";
+    } else {
+      $client = new $clientclass($path, $host);
+      $server = "$host$path";
+    }
+    if ($protocol == 2)
+    {
+      $server = 'https://'.$server;
+    }
+    else
+    {
+      $server = 'http://'.$server;
+    }
+    if ($proxy != '') {
+      $pproxy = explode(':', $proxy);
+      if (count($pproxy) > 1)
+        $pport = $pproxy[1];
+      else
+        $pport = 8080;
+      $client->setProxy($pproxy[0], $pport, $proxyuser, $proxypwd);
+    }
+
+    if ($protocol == 2)
+    {
+      $client->setSSLVerifyPeer($verifypeer);
+      $client->setSSLVerifyHost($verifyhost);
+      if ($cainfo)
+      {
+        $client->setCaCertificate($cainfo);
+      }
+      $httpprotocol = 'https';
+    }
+    else if ($protocol == 1)
+      $httpprotocol = 'http11';
+    else
+      $httpprotocol = 'http';
+
+    if ($username)
+      $client->setCredentials($username, $password, $authtype);
+
+    $client->setDebug($debug);
+
+    switch ($requestcompression) {
+      case 0:
+        $client->request_compression = '';
+        break;
+      case 1:
+        $client->request_compression = 'gzip';
+        break;
+      case 2:
+        $client->request_compression = 'deflate';
+        break;
+    }
+
+    switch ($responsecompression) {
+      case 0:
+        $client->accepted_compression = '';
+        break;
+      case 1:
+        $client->accepted_compression = array('gzip');
+        break;
+      case 2:
+        $client->accepted_compression = array('deflate');
+        break;
+      case 3:
+        $client->accepted_compression = array('gzip', 'deflate');
+        break;
+    }
+
+    $cookies = explode(',', $clientcookies);
+    foreach ($cookies as $cookie)
+    {
+      if (strpos($cookie, '='))
+      {
+        $cookie = explode('=', $cookie);
+        $client->setCookie(trim($cookie[0]), trim(@$cookie[1]));
+      }
+    }
+
+    $msg = array();
+    switch ($action) {
+
+      case 'wrap':
+        @include('xmlrpc_wrappers.inc');
+        if (!function_exists('build_remote_method_wrapper_code'))
+        {
+          die('Error: to enable creation of method stubs the 
xmlrpc_wrappers.inc file is needed');
+        }
+        // fall thru intentionally
+      case 'describe':
+      case 'wrap':
+        $msg[0] = new $msgclass('system.methodHelp', null, $id);
+        $msg[0]->addparam(new xmlrpcval($method));
+        $msg[1] = new $msgclass('system.methodSignature', null, $id+1);
+        $msg[1]->addparam(new xmlrpcval($method));
+        $actionname = 'Description of method "'.$method.'"';
+        break;
+      case 'list':
+        $msg[0] = new $msgclass('system.listMethods', null, $id);
+        $actionname = 'List of available methods';
+        break;
+      case 'execute':
+        if (!payload_is_safe($payload))
+          die("Tsk tsk tsk, please stop it or I will have to call in the 
cops!");
+        $msg[0] = new $msgclass($method, null, $id);
+        // hack! build xml payload by hand
+        if ($wstype == 1)
+        {
+          $msg[0]->payload = "{\n".
+            '"method": "' . $method . "\",\n\"params\": [" .
+            $payload .
+            "\n],\n\"id\": ";
+            // fix: if user gave an empty string, use NULL, or we'll break 
json syntax
+            if ($id == "")
+            {
+                $msg[0]->payload .= "null\n}";
+            }
+            else
+            {
+              if (is_numeric($id) || $id == 'false' || $id == 'true' || $id == 
'null')
+              {
+                $msg[0]->payload .= "$id\n}";
+              }
+              else
+              {
+                $msg[0]->payload .= "\"$id\"\n}";
+              }
+            }
+        }
+        else
+          $msg[0]->payload = $msg[0]->xml_header() .
+            '<methodName>' . $method . "</methodName>\n<params>" .
+            $payload .
+            "</params>\n" . $msg[0]->xml_footer();
+        $actionname = 'Execution of method '.$method;
+        break;
+      default: // give a warning
+        $actionname = '[ERROR: unknown action] "'.$action.'"';
+    }
+
+    // Before calling execute, echo out brief description of action taken + 
date and time ???
+    // this gives good user feedback for long-running methods...
+    echo '<h2>'.htmlspecialchars($actionname).' on server 
'.htmlspecialchars($server)." ...</h2>\n";
+    flush();
+
+    $response = null;
+    // execute method(s)
+    if ($debug)
+      echo '<div class="dbginfo"><h2>Debug info:</h2>';  /// @todo use 
ob_start instead
+    $resp = array();
+    $mtime = explode(' ',microtime());
+    $time = (float)$mtime[0] + (float)$mtime[1];
+    foreach ($msg as $message)
+    {
+      // catch errors: for older xmlrpc libs, send does not return by ref
+      @$response =& $client->send($message, $timeout, $httpprotocol);
+      $resp[] = $response;
+      if (!$response || $response->faultCode())
+        break;
+    }
+    $mtime = explode(' ',microtime());
+    $time = (float)$mtime[0] + (float)$mtime[1] - $time;
+    if ($debug)
+      echo "</div>\n";
+
+    if ($response)
+    {
+
+    if ($response->faultCode())
+    {
+      // call failed! echo out error msg!
+      //echo '<h2>'.htmlspecialchars($actionname).' on server 
'.htmlspecialchars($server).'</h2>';
+      echo "<h3>$protoname call FAILED!</h3>\n";
+      echo "<p>Fault code: [" . htmlspecialchars($response->faultCode()) .
+        "] Reason: '" . htmlspecialchars($response->faultString()) . "'</p>\n";
+      echo (strftime("%d/%b/%Y:%H:%M:%S\n"));
+    }
+    else
+    {
+      // call succeeded: parse results
+      //echo '<h2>'.htmlspecialchars($actionname).' on server 
'.htmlspecialchars($server).'</h2>';
+      printf ("<h3>%s call(s) OK (%.2f secs.)</h3>\n", $protoname, $time);
+      echo (strftime("%d/%b/%Y:%H:%M:%S\n"));
+
+      switch ($action)
+      {
+        case 'list':
+
+        $v = $response->value();
+        if ($v->kindOf()=="array")
+        {
+          $max = $v->arraysize();
+          echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
+          echo 
"<thead>\n<tr><th>Method</th><th>Description</th></tr>\n</thead>\n<tbody>\n";
+          for($i=0; $i < $max; $i++)
+          {
+            $rec = $v->arraymem($i);
+            if ($i%2) $class=' class="oddrow"'; else $class = ' 
class="evenrow"';
+            echo 
("<tr><td$class>".htmlspecialchars($rec->scalarval())."</td><td$class><form 
action=\"controller.php\" method=\"get\" target=\"frmcontroller\">".
+              "<input type=\"hidden\" name=\"host\" 
value=\"".htmlspecialchars($host)."\" />".
+              "<input type=\"hidden\" name=\"port\" 
value=\"".htmlspecialchars($port)."\" />".
+              "<input type=\"hidden\" name=\"path\" 
value=\"".htmlspecialchars($path)."\" />".
+              "<input type=\"hidden\" name=\"id\" 
value=\"".htmlspecialchars($id)."\" />".
+              "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />".
+              "<input type=\"hidden\" name=\"username\" 
value=\"".htmlspecialchars($username)."\" />".
+              "<input type=\"hidden\" name=\"password\" 
value=\"".htmlspecialchars($password)."\" />".
+              "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" 
/>".
+              "<input type=\"hidden\" name=\"verifyhost\" 
value=\"$verifyhost\" />".
+              "<input type=\"hidden\" name=\"verifypeer\" 
value=\"$verifypeer\" />".
+              "<input type=\"hidden\" name=\"cainfo\" 
value=\"".htmlspecialchars($cainfo)."\" />".
+              "<input type=\"hidden\" name=\"proxy\" 
value=\"".htmlspecialchars($proxy)."\" />".
+              "<input type=\"hidden\" name=\"proxyuser\" 
value=\"".htmlspecialchars($proxyuser)."\" />".
+              "<input type=\"hidden\" name=\"proxypwd\" 
value=\"".htmlspecialchars($proxypwd)."\" />".
+              "<input type=\"hidden\" name=\"responsecompression\" 
value=\"$responsecompression\" />".
+              "<input type=\"hidden\" name=\"requestcompression\" 
value=\"$requestcompression\" />".
+              "<input type=\"hidden\" name=\"clientcookies\" 
value=\"".htmlspecialchars($clientcookies)."\" />".
+              "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" 
/>".
+              "<input type=\"hidden\" name=\"timeout\" 
value=\"".htmlspecialchars($timeout)."\" />".
+              "<input type=\"hidden\" name=\"method\" 
value=\"".$rec->scalarval()."\" />".
+              "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />".
+              "<input type=\"hidden\" name=\"action\" value=\"describe\" />".
+              "<input type=\"hidden\" name=\"run\" value=\"now\" />".
+              "<input type=\"submit\" value=\"Describe\" /></form></td>");
+            //echo("</tr>\n");
+
+            // generate lo scheletro per il method payload per eventuali test
+            
//$methodpayload="<methodCall>\n<methodName>".$rec->scalarval()."</methodName>\n<params>\n<param><value></value></param>\n</params>\n</methodCall>";
+
+            /*echo ("<form action=\"{$_SERVER['PHP_SELF']}\" 
method=\"get\"><td>".
+              "<input type=\"hidden\" name=\"host\" value=\"$host\" />".
+              "<input type=\"hidden\" name=\"port\" value=\"$port\" />".
+              "<input type=\"hidden\" name=\"path\" value=\"$path\" />".
+              "<input type=\"hidden\" name=\"method\" 
value=\"".$rec->scalarval()."\" />".
+              "<input type=\"hidden\" name=\"methodpayload\" 
value=\"$payload\" />".
+              "<input type=\"hidden\" name=\"action\" value=\"execute\" />".
+              "<input type=\"submit\" value=\"Test\" /></td></form>");*/
+            echo("</tr>\n");
+          }
+          echo "</tbody>\n</table>";
+        }
+          break;
+
+        case 'describe':
+
+        $r1 = $resp[0]->value();
+        $r2 = $resp[1]->value();
+
+        echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
+        echo 
"<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method)."</th><th>&nbsp;</th><th>&nbsp;</th></tr>\n</thead>\n<tbody>\n";
+        $desc = htmlspecialchars($r1->scalarval());
+        if ($desc == "")
+          $desc = "-";
+        echo "<tr><td class=\"evenrow\">Description</td><td colspan=\"3\" 
class=\"evenrow\">$desc</td></tr>\n";
+        $payload="";
+        $alt_payload="";
+        if ($r2->kindOf()!="array")
+          echo "<tr><td class=\"oddrow\">Signature</td><td 
class=\"oddrow\">Unknown</td><td class=\"oddrow\">&nbsp;</td></tr>\n";
+        else
+        {
+          for($i=0; $i < $r2->arraysize(); $i++)
+          {
+            if ($i+1%2) $class=' class="oddrow"'; else $class = ' 
class="evenrow"';
+            echo "<tr><td$class>Signature&nbsp;".($i+1)."</td><td$class>";
+            $x = $r2->arraymem($i);
+            if ($x->kindOf()=="array")
+            {
+              $ret = $x->arraymem(0);
+              echo "<code>OUT:&nbsp;" . htmlspecialchars($ret->scalarval()) . 
"<br />IN: (";
+              if ($x->arraysize() > 1)
+              {
+                for($k = 1; $k < $x->arraysize(); $k++)
+                {
+                  $y = $x->arraymem($k);
+                  echo $y->scalarval();
+                  if ($wstype != 1)
+                  {
+                    $payload = $payload . 
'<param><value><'.htmlspecialchars($y->scalarval()).'></'.htmlspecialchars($y->scalarval())."></value></param>\n";
+                  }
+                  $alt_payload .= $y->scalarval();
+                  if ($k < $x->arraysize()-1)
+                  {
+                    $alt_payload .= ';';
+                    echo ", ";
+                  }
+                }
+              }
+              echo ")</code>";
+            }
+            else
+            {
+              echo 'Unknown';
+            }
+            echo '</td>';
+            //bottone per testare questo metodo
+            
//$payload="<methodCall>\n<methodName>$method</methodName>\n<params>\n$payload</params>\n</methodCall>";
+            echo "<td$class><form action=\"controller.php\" 
target=\"frmcontroller\" method=\"get\">".
+            "<input type=\"hidden\" name=\"host\" 
value=\"".htmlspecialchars($host)."\" />".
+            "<input type=\"hidden\" name=\"port\" 
value=\"".htmlspecialchars($port)."\" />".
+            "<input type=\"hidden\" name=\"path\" 
value=\"".htmlspecialchars($path)."\" />".
+            "<input type=\"hidden\" name=\"id\" 
value=\"".htmlspecialchars($id)."\" />".
+            "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />".
+            "<input type=\"hidden\" name=\"username\" 
value=\"".htmlspecialchars($username)."\" />".
+            "<input type=\"hidden\" name=\"password\" 
value=\"".htmlspecialchars($password)."\" />".
+            "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />".
+            "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" 
/>".
+            "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" 
/>".
+            "<input type=\"hidden\" name=\"cainfo\" 
value=\"".htmlspecialchars($cainfo)."\" />".
+            "<input type=\"hidden\" name=\"proxy\" 
value=\"".htmlspecialchars($proxy)."\" />".
+            "<input type=\"hidden\" name=\"proxyuser\" 
value=\"".htmlspecialchars($proxyuser)."\" />".
+            "<input type=\"hidden\" name=\"proxypwd\" 
value=\"".htmlspecialchars($proxypwd)."\" />".
+            "<input type=\"hidden\" name=\"responsecompression\" 
value=\"$responsecompression\" />".
+            "<input type=\"hidden\" name=\"requestcompression\" 
value=\"$requestcompression\" />".
+            "<input type=\"hidden\" name=\"clientcookies\" 
value=\"".htmlspecialchars($clientcookies)."\" />".
+            "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />".
+            "<input type=\"hidden\" name=\"timeout\" 
value=\"".htmlspecialchars($timeout)."\" />".
+            "<input type=\"hidden\" name=\"method\" 
value=\"".htmlspecialchars($method)."\" />".
+            "<input type=\"hidden\" name=\"methodpayload\" 
value=\"".htmlspecialchars($payload)."\" />".
+            "<input type=\"hidden\" name=\"altmethodpayload\" 
value=\"".htmlspecialchars($alt_payload)."\" />".
+            "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />".
+            "<input type=\"hidden\" name=\"action\" value=\"execute\" />";
+            if ($wstype != 1)
+              echo "<input type=\"submit\" value=\"Load method synopsis\" />";
+            echo "</form></td>\n";
+
+            echo "<td$class><form action=\"controller.php\" 
target=\"frmcontroller\" method=\"get\">".
+            "<input type=\"hidden\" name=\"host\" 
value=\"".htmlspecialchars($host)."\" />".
+            "<input type=\"hidden\" name=\"port\" 
value=\"".htmlspecialchars($port)."\" />".
+            "<input type=\"hidden\" name=\"path\" 
value=\"".htmlspecialchars($path)."\" />".
+            "<input type=\"hidden\" name=\"id\" 
value=\"".htmlspecialchars($id)."\" />".
+            "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />".
+            "<input type=\"hidden\" name=\"username\" 
value=\"".htmlspecialchars($username)."\" />".
+            "<input type=\"hidden\" name=\"password\" 
value=\"".htmlspecialchars($password)."\" />".
+            "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />".
+            "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" 
/>".
+            "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" 
/>".
+            "<input type=\"hidden\" name=\"cainfo\" 
value=\"".htmlspecialchars($cainfo)."\" />".
+            "<input type=\"hidden\" name=\"proxy\" 
value=\"".htmlspecialchars($proxy)."\" />".
+            "<input type=\"hidden\" name=\"proxyuser\" 
value=\"".htmlspecialchars($proxyuser)."\" />".
+            "<input type=\"hidden\" name=\"proxypwd\" 
value=\"".htmlspecialchars($proxypwd)."\" />".
+            "<input type=\"hidden\" name=\"responsecompression\" 
value=\"$responsecompression\" />".
+            "<input type=\"hidden\" name=\"requestcompression\" 
value=\"$requestcompression\" />".
+            "<input type=\"hidden\" name=\"clientcookies\" 
value=\"".htmlspecialchars($clientcookies)."\" />".
+            "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />".
+            "<input type=\"hidden\" name=\"timeout\" 
value=\"".htmlspecialchars($timeout)."\" />".
+            "<input type=\"hidden\" name=\"method\" 
value=\"".htmlspecialchars($method)."\" />".
+            "<input type=\"hidden\" name=\"methodsig\" value=\"".$i."\" />".
+            "<input type=\"hidden\" name=\"methodpayload\" 
value=\"".htmlspecialchars($payload)."\" />".
+            "<input type=\"hidden\" name=\"altmethodpayload\" 
value=\"".htmlspecialchars($alt_payload)."\" />".
+            "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />".
+            "<input type=\"hidden\" name=\"run\" value=\"now\" />".
+            "<input type=\"hidden\" name=\"action\" value=\"wrap\" />".
+            "<input type=\"submit\" value=\"Generate method call stub code\" 
/>";
+            echo "</form></td></tr>\n";
+
+          }
+        }
+        echo "</tbody>\n</table>";
+
+          break;
+
+        case 'wrap':
+          $r1 = $resp[0]->value();
+          $r2 = $resp[1]->value();
+          if ($r2->kindOf()!="array" || $r2->arraysize() <= $methodsig)
+            echo "Error: signature unknown\n";
+          else
+          {
+          $mdesc = $r1->scalarval();
+          $msig = php_xmlrpc_decode($r2);
+          $msig = $msig[$methodsig];
+          $proto = $protocol == 2 ? 'https' : $protocol == 1 ? 'http11' : '';
+          if ($proxy  == '' && $username == '' && !$requestcompression && 
!$responsecompression &&
+            $clientcookies == '')
+          {
+            $opts = 0; // simple client copy in stub code
+          }
+          else
+          {
+            $opts = 1; // complete client copy in stub code
+          }
+          if ($wstype == 1)
+          {
+            $prefix = 'jsonrpc';
+          }
+          else
+          {
+            $prefix = 'xmlrpc';
+          }
+          //$code = wrap_xmlrpc_method($client, $method, $methodsig, 0, 
$proto, '', $opts);
+          $code = build_remote_method_wrapper_code($client, $method, 
str_replace('.', '_', $prefix.'_'.$method), $msig, $mdesc, $timeout, $proto, 
$opts, $prefix);
+          //if ($code)
+          //{
+              echo "<div id=\"phpcode\">\n";
+            
highlight_string("<?php\n".$code['docstring'].$code['source'].'?>');
+            echo "\n</div>";
+          //}
+          //else
+          //{
+          //  echo 'Error while building php code stub...';
+          }
+
+          break;
+
+        case 'execute':
+          echo '<div 
id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>';
+          break;
+
+        default: // give a warning
+      }
+    } // if !$response->faultCode()
+    } // if $response
+  }
+  else
+  {
+    // no action taken yet: give some instructions on debugger usage
+?>
+
+<h3>Instructions on usage of the debugger:</h3>
+<ol>
+<li>Run a 'list available methods' action against desired server</li>
+<li>If list of methods appears, click on 'describe method' for desired 
method</li>
+<li>To run method: click on 'load method synopsis' for desired method. This 
will load a skeleton for method call parameters in the form above. Complete all 
xmlrpc values with appropriate data and click 'Execute'</li>
+</ol>
+<?php
+  if (!extension_loaded('curl'))
+  {
+      echo "<p class=\"evidence\">You will need to enable the CURL extension 
to use the HTTPS and HTTP 1.1 transports</p>\n";
+  }
+?>
+
+<h3>Example:</h3>
+<p>
+Server Address: phpxmlrpc.sourceforge.net<br/>
+Path: /server.php
+</p>
+
+<h3>Notice:</h3>
+<p>all usernames and passwords entered on the above form will be written to 
the web server logs of this server. Use with care.</p>
+
+<h3>Changelog</h3>
+<ul>
+<li>2007-02-20: add visual editor for method payload; allow strings, bools as 
jsonrpc msg id</li>
+<li>2006-06-26: support building php code stub for calling remote methods</li>
+<li>2006-05-25: better support for long running queries; check for no-curl 
installs</li>
+<li>2006-05-02: added support for JSON-RPC. Note that many interesting 
json-rpc features are not implemented yet, such as notifications or 
multicall.</li>
+<li>2006-04-22: added option for setting custom CA certs to verify peer with 
in SSLmode</li>
+<li>2006-03-05: added option for setting Basic/Digest/NTLM auth type</li>
+<li>2006-01-18: added option echoing to screen xmlrpc request before sending 
it ('More' debug)</li>
+<li>2005-10-01: added option for setting cookies to be sent to server</li>
+<li>2005-08-07: added switches for compression of requests and responses and 
http 1.1</li>
+<li>2005-06-27: fixed possible security breach in parsing malformed xml</li>
+<li>2005-06-24: fixed error with calling methods having parameters...</li>
+</ul>
+<?php
+  }
+?>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/action.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/common.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/common.php       
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/common.php       
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,135 @@
+<?php
+/**
+ * @version $Id$
+ * @author Gaetano Giunta
+ * @copyright (C) 2005-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ *
+ * @todo switch params for http compression from 0,1,2 to values to be used 
directly
+ * @todo do some more sanitization of received parameters
+ */
+
+// work around magic quotes
+  if (get_magic_quotes_gpc())
+  {
+    function stripslashes_deep($value)
+    {
+        $value = is_array($value) ?
+                    array_map('stripslashes_deep', $value) :
+                    stripslashes($value);
+
+        return $value;
+    }
+    $_GET = array_map('stripslashes_deep', $_GET);
+  }
+
+
+  if ( isset( $_GET['usepost'] ) && $_GET['usepost'] === 'true' )
+  {
+      $_GET = $_POST;
+  }
+
+// recover input parameters
+  $debug = false;
+  $protocol = 0;
+  $run = false;
+  $wstype = 0;
+  $id = '';
+  if (isset($_GET['action']))
+  {
+    if (isset($_GET['wstype']) && $_GET['wstype'] == '1')
+    {
+      $wstype = 1;
+      if (isset($_GET['id']))
+        $id = $_GET['id'];
+    }
+    $host = isset($_GET['host']) ? $_GET['host'] : 'localhost'; // using '' 
will trigger an xmlrpc error...
+    if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || 
$_GET['protocol'] == '2'))
+      $protocol = $_GET['protocol'];
+    if (strpos($host, 'http://') === 0)
+      $host = substr($host, 7);
+    else if (strpos($host, 'https://') === 0)
+    {
+      $host = substr($host, 8);
+      $protocol = 2;
+    }
+    $port = isset($_GET['port']) ? $_GET['port'] : '';
+    $path = isset($_GET['path']) ? $_GET['path'] : '';
+    // in case user forgot initial '/' in xmlrpc server path, add it back
+    if ($path && ($path[0]) != '/')
+      $path = '/'.$path;
+
+    if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] == 
'2'))
+      $debug = $_GET['debug'];
+
+    $verifyhost = (isset($_GET['verifyhost']) && ($_GET['verifyhost'] == '1' 
|| $_GET['verifyhost'] == '2')) ? $_GET['verifyhost'] : 0;
+    if (isset($_GET['verifypeer']) && $_GET['verifypeer'] == '1')
+      $verifypeer = true;
+    else
+      $verifypeer = false;
+    $cainfo= isset($_GET['cainfo']) ? $_GET['cainfo'] : '';
+    $proxy = isset($_GET['proxy']) ? $_GET['proxy'] : 0;
+    if (strpos($proxy, 'http://') === 0)
+      $proxy = substr($proxy, 7);
+    $proxyuser= isset($_GET['proxyuser']) ? $_GET['proxyuser'] : '';
+    $proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : '';
+    $timeout = isset($_GET['timeout']) ? $_GET['timeout'] : 0;
+    if (!is_numeric($timeout))
+      $timeout = 0;
+    $action = $_GET['action'];
+
+    $method = isset($_GET['method']) ? $_GET['method'] : '';
+    $methodsig = isset($_GET['methodsig']) ? $_GET['methodsig'] : 0;
+    $payload = isset($_GET['methodpayload']) ? $_GET['methodpayload'] : '';
+    $alt_payload = isset($_GET['altmethodpayload']) ? 
$_GET['altmethodpayload'] : '';
+
+    if (isset($_GET['run']) && $_GET['run'] == 'now')
+      $run = true;
+
+    $username = isset($_GET['username']) ? $_GET['username'] : '';
+    $password = isset($_GET['password']) ? $_GET['password'] : '';
+
+    $authtype = (isset($_GET['authtype']) && ($_GET['authtype'] == '2' || 
$_GET['authtype'] == '8')) ? $_GET['authtype'] : 1;
+
+    if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] == 
'1' || $_GET['requestcompression'] == '2'))
+      $requestcompression = $_GET['requestcompression'];
+    else
+      $requestcompression = 0;
+    if (isset($_GET['responsecompression']) && ($_GET['responsecompression'] 
== '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression'] 
== '3'))
+      $responsecompression = $_GET['responsecompression'];
+    else
+      $responsecompression = 0;
+
+    $clientcookies = isset($_GET['clientcookies']) ? $_GET['clientcookies'] : 
'';
+  }
+  else
+  {
+    $host = '';
+    $port = '';
+    $path = '';
+    $action = '';
+    $method = '';
+    $methodsig = 0;
+    $payload = '';
+    $alt_payload = '';
+    $username = '';
+    $password = '';
+    $authtype = 1;
+    $verifyhost = 0;
+    $verifypeer = false;
+    $cainfo = '';
+    $proxy = '';
+    $proxyuser = '';
+    $proxypwd = '';
+    $timeout = 0;
+    $requestcompression = 0;
+    $responsecompression = 0;
+    $clientcookies = '';
+  }
+
+  // check input for known XMLRPC attacks against this or other libs
+  function payload_is_safe($input)
+  {
+      return true;
+  }
+?>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/common.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/controller.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/controller.php   
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/controller.php   
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,321 @@
+<?php
+/**
+ * @version $Id$
+ * @author Gaetano Giunta
+ * @copyright (C) 2005-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ *
+ * @todo add links to documentation from every option caption
+ * @todo switch params for http compression from 0,1,2 to values to be used 
directly
+ * @todo add a little bit more CSS formatting: we broke IE box model getting a 
width > 100%...
+ * @todo add support for more options, such as ntlm auth to proxy, or request 
charset encoding
+ *
+ * @todo parse content of payload textarea to be fed to visual editor
+ * @todo add http no-cache headers
+ **/
+
+  include(getcwd().'/common.php');
+  if ($action == '')
+    $action = 'list';
+
+  // relative path to the visual xmlrpc editing dialog
+  $editorpath = '../../javascript/';
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+<head>
+<title>XMLRPC Debugger</title>
+<meta name="robots" content="index,nofollow" />
+<script type="text/javascript" language="Javascript">
+  if (window.name!='frmcontroller')
+    top.location.replace('index.php?run='+escape(self.location));
+</script>
+<!-- xmlrpc/jsonrpc base library -->
+<script type="text/javascript" src="<?php echo $editorpath; 
?>xmlrpc_lib.js"></script>
+<script type="text/javascript" src="<?php echo $editorpath; 
?>jsonrpc_lib.js"></script>
+<style type="text/css">
+<!--
+html {overflow: -moz-scrollbars-vertical;}
+body {padding: 0.5em; background-color: #EEEEEE; font-family: Verdana, Arial, 
Helvetica; font-size: 8pt;}
+h1 {font-size: 12pt; margin: 0.5em;}
+h2 {font-size: 10pt; display: inline; vertical-align: top;}
+table {border: 1px solid gray; margin-bottom: 0.5em; padding: 0.25em; width: 
100%;}
+#methodpayload {display: inline;}
+td {vertical-align: top; font-family: Verdana, Arial, Helvetica; font-size: 
8pt;}
+.labelcell {text-align: right;}
+-->
+</style>
+<script language="JavaScript" type="text/javascript">
+<!--
+  function verifyserver()
+  {
+    if (document.frmaction.host.value == '')
+    {
+      alert('Please insert a server name or address');
+      return false;
+    }
+    if (document.frmaction.path.value == '')
+      document.frmaction.path.value = '/';
+    var action = '';
+    for (counter = 0; counter < document.frmaction.action.length; counter++)
+      if (document.frmaction.action[counter].checked)
+      {
+        action = document.frmaction.action[counter].value;
+      }
+    if (document.frmaction.method.value == '' && (action == 'execute' || 
action == 'wrap' || action == 'describe'))
+    {
+      alert('Please insert a method name');
+      return false;
+    }
+    if (document.frmaction.authtype.value != '1' && 
document.frmaction.username.value == '')
+    {
+      alert('No username for authenticating to server: authentication 
disabled');
+    }
+    return true;
+  }
+
+  function switchaction()
+  {
+    // reset html layout depending on action to be taken
+    var action = '';
+    for (counter = 0; counter < document.frmaction.action.length; counter++)
+      if (document.frmaction.action[counter].checked)
+      {
+        action = document.frmaction.action[counter].value;
+      }
+    if (action == 'execute')
+    {
+      document.frmaction.methodpayload.disabled = false;
+      displaydialogeditorbtn(true);//if 
(document.getElementById('methodpayloadbtn') != undefined) 
document.getElementById('methodpayloadbtn').disabled = false;
+      document.frmaction.method.disabled = false;
+      document.frmaction.methodpayload.rows = 10;
+    }
+    else
+    {
+      document.frmaction.methodpayload.rows = 1;
+      if (action == 'describe' || action == 'wrap')
+      {
+        document.frmaction.methodpayload.disabled = true;
+        displaydialogeditorbtn(false); //if 
(document.getElementById('methodpayloadbtn') != undefined) 
document.getElementById('methodpayloadbtn').disabled = true;
+        document.frmaction.method.disabled = false;
+      }
+      else // list
+      {
+        document.frmaction.methodpayload.disabled = true;
+        displaydialogeditorbtn(false); //if 
(document.getElementById('methodpayloadbtn') != undefined) 
document.getElementById('methodpayloadbtn').disabled = false;
+        document.frmaction.method.disabled = true;
+      }
+    }
+  }
+
+  function switchssl()
+  {
+    if (document.frmaction.protocol.value != '2')
+    {
+      document.frmaction.verifypeer.disabled = true;
+      document.frmaction.verifyhost.disabled = true;
+      document.frmaction.cainfo.disabled = true;
+    }
+    else
+    {
+      document.frmaction.verifypeer.disabled = false;
+      document.frmaction.verifyhost.disabled = false;
+      document.frmaction.cainfo.disabled = false;
+    }
+  }
+
+  function switchauth()
+  {
+    if (document.frmaction.protocol.value != '0')
+    {
+      document.frmaction.authtype.disabled = false;
+    }
+    else
+    {
+      document.frmaction.authtype.disabled = true;
+      document.frmaction.authtype.value = 1;
+    }
+  }
+
+  function swicthcainfo()
+  {
+    if (document.frmaction.verifypeer.checked == true)
+    {
+      document.frmaction.cainfo.disabled = false;
+    }
+    else
+    {
+      document.frmaction.cainfo.disabled = true;
+    }
+  }
+
+  function switchtransport(is_json)
+  {
+    if (is_json == 0)
+    {
+      document.getElementById("idcell").style.visibility = 'hidden';
+      document.frmjsonrpc.yes.checked = false;
+      document.frmxmlrpc.yes.checked = true;
+      document.frmaction.wstype.value="0";
+    }
+    else
+    {
+      document.getElementById("idcell").style.visibility = 'visible';
+      document.frmjsonrpc.yes.checked = true;
+      document.frmxmlrpc.yes.checked = false;
+      document.frmaction.wstype.value="1";
+    }
+  }
+
+  function displaydialogeditorbtn(show)
+  {
+    if (show && ((typeof base64_decode) == 'function'))
+    {
+         document.getElementById('methodpayloadbtn').innerHTML = '[<a href="#" 
onclick="activateeditor(); return false;">Edit</a>]';
+       }
+       else
+    {
+         document.getElementById('methodpayloadbtn').innerHTML = '';
+       }
+  }
+
+  function activateeditor()
+  {
+         var url = '<?php echo $editorpath; ?>visualeditor.php?params=<?php 
echo $alt_payload; ?>';
+         if (document.frmaction.wstype.value == "1")
+           url += '&type=jsonrpc';
+         var wnd = window.open(url, '_blank', 'width=750, height=400, 
location=0, resizable=1, menubar=0, scrollbars=1');
+  }
+
+  // if javascript version of the lib is found, allow it to send us params
+  function buildparams(base64data)
+  {
+    if (typeof base64_decode == 'function')
+    {
+         if (base64data == '0') // workaround for bug in base64_encode...
+           document.getElementById('methodpayload').value = '';
+         else
+        document.getElementById('methodpayload').value = 
base64_decode(base64data);
+    }
+  }
+
+  // use GET for ease of refresh, switch to POST when payload is too big to 
fit in url (in IE: 2048 bytes! see http://support.microsoft.com/kb/q208427/)
+  function switchFormMethod()
+  {
+      /// @todo use a more precise calculation, adding the rest of the fields 
to the actual generated url lenght
+      if (document.frmaction.methodpayload.value.length > 1536 )
+      {
+          document.frmaction.action = 'action.php?usepost=true';
+          document.frmaction.method = 'post';
+      }
+  }
+
+//-->
+</script>
+</head>
+<body onload="switchtransport(<?php echo $wstype;?>); switchaction(); 
switchssl(); switchauth(); swicthcainfo();<?php if ($run) echo ' 
document.forms[2].submit();'; ?>">
+<h1>XMLRPC <form name="frmxmlrpc" style="display: inline;" action="."><input 
name="yes" type="radio" onclick="switchtransport(0);"/></form>
+/<form name="frmjsonrpc" style="display: inline;" action="."><input name="yes" 
type="radio" onclick="switchtransport(1);"/></form>JSONRPC Debugger (based on 
the <a href="http://phpxmlrpc.sourceforge.net";>PHP-XMLRPC</a> library)</h1>
+<form name="frmaction" method="get" action="action.php" target="frmaction" 
onSubmit="switchFormMethod();"
+>
+
+<table id="serverblock">
+<tr>
+<td><h2>Target server</h2></td>
+<td class="labelcell">Address:</td><td><input type="text" name="host" 
value="<?php echo htmlspecialchars($host); ?>" /></td>
+<td class="labelcell">Port:</td><td><input type="text" name="port" 
value="<?php echo htmlspecialchars($port); ?>" size="5" maxlength="5" /></td>
+<td class="labelcell">Path:</td><td><input type="text" name="path" 
value="<?php echo htmlspecialchars($path); ?>" /></td>
+</tr>
+</table>
+
+<table id="actionblock">
+<tr>
+<td><h2>Action</h2></td>
+<td>List available methods<input type="radio" name="action" value="list"<?php 
if ($action=='list') echo ' checked="checked"'; ?> onclick="switchaction();" 
/></td>
+<td>Describe method<input type="radio" name="action" value="describe"<?php if 
($action=='describe') echo ' checked="checked"'; ?> onclick="switchaction();" 
/></td>
+<td>Execute method<input type="radio" name="action" value="execute"<?php if 
($action=='execute') echo ' checked="checked"'; ?> onclick="switchaction();" 
/></td>
+<td>Generate stub for method call<input type="radio" name="action" 
value="wrap"<?php if ($action=='wrap') echo ' checked="checked"'; ?> 
onclick="switchaction();" /></td>
+</tr>
+</table>
+<input type="hidden" name="methodsig" value="<?php echo 
htmlspecialchars($methodsig); ?>" />
+
+<table id="methodblock">
+<tr>
+<td><h2>Method</h2></td>
+<td class="labelcell">Name:</td><td><input type="text" name="method" 
value="<?php echo htmlspecialchars($method); ?>" /></td>
+<td class="labelcell">Payload:<br/><div 
id="methodpayloadbtn"></div></td><td><textarea id="methodpayload" 
name="methodpayload" rows="1" cols="40"><?php echo htmlspecialchars($payload); 
?></textarea></td>
+<td class="labelcell" id="idcell">Msg id: <input type="text" name="id" 
size="3" value="<?php echo htmlspecialchars($id); ?>"/></td>
+<td><input type="hidden" name="wstype" value="<?php echo $wstype;?>" />
+<input type="submit" value="Execute" onclick="return verifyserver();"/></td>
+</tr>
+</table>
+
+<table id="optionsblock">
+<tr>
+<td><h2>Client options</h2></td>
+<td class="labelcell">Show debug info:</td><td><select name="debug">
+<option value="0"<?php if ($debug == 0) echo ' selected="selected"'; 
?>>No</option>
+<option value="1"<?php if ($debug == 1) echo ' selected="selected"'; 
?>>Yes</option>
+<option value="2"<?php if ($debug == 2) echo ' selected="selected"'; 
?>>More</option>
+</select>
+</td>
+<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" 
size="3" value="<?php if ($timeout > 0) echo $timeout; ?>" /></td>
+<td class="labelcell">Protocol:</td><td><select name="protocol" 
onchange="switchssl(); switchauth(); swicthcainfo();">
+<option value="0"<?php if ($protocol == 0) echo ' selected="selected"'; 
?>>HTTP 1.0</option>
+<option value="1"<?php if ($protocol == 1) echo ' selected="selected"'; 
?>>HTTP 1.1</option>
+<option value="2"<?php if ($protocol == 2) echo ' selected="selected"'; 
?>>HTTPS</option>
+</select></td>
+</tr>
+<tr>
+<td class="labelcell">AUTH:</td>
+<td class="labelcell">Username:</td><td><input type="text" name="username" 
value="<?php echo htmlspecialchars($username); ?>" /></td>
+<td class="labelcell">Pwd:</td><td><input type="password" name="password" 
value="<?php echo htmlspecialchars($password); ?>" /></td>
+<td class="labelcell">Type</td><td><select name="authtype">
+<option value="1"<?php if ($authtype == 1) echo ' selected="selected"'; 
?>>Basic</option>
+<option value="2"<?php if ($authtype == 2) echo ' selected="selected"'; 
?>>Digest</option>
+<option value="8"<?php if ($authtype == 8) echo ' selected="selected"'; 
?>>NTLM</option>
+</select></td>
+<td></td>
+</tr>
+<tr>
+<td class="labelcell">SSL:</td>
+<td class="labelcell">Verify Host's CN:</td><td><select name="verifyhost">
+<option value="0"<?php if ($verifyhost == 0) echo ' selected="selected"'; 
?>>No</option>
+<option value="1"<?php if ($verifyhost == 1) echo ' selected="selected"'; 
?>>Check CN existance</option>
+<option value="2"<?php if ($verifyhost == 2) echo ' selected="selected"'; 
?>>Check CN match</option>
+</select></td>
+<td class="labelcell">Verify Cert:</td><td><input type="checkbox" value="1" 
name="verifypeer" onclick="swicthcainfo();"<?php if ($verifypeer) echo ' 
checked="checked"'; ?> /></td>
+<td class="labelcell">CA Cert file:</td><td><input type="text" name="cainfo" 
value="<?php echo htmlspecialchars($cainfo); ?>" /></td>
+</tr>
+<tr>
+<td class="labelcell">PROXY:</td>
+<td class="labelcell">Server:</td><td><input type="text" name="proxy" 
value="<?php echo htmlspecialchars($proxy); ?>" /></td>
+<td class="labelcell">Proxy user:</td><td><input type="text" name="proxyuser" 
value="<?php echo htmlspecialchars($proxyuser); ?>" /></td>
+<td class="labelcell">Proxy pwd:</td><td><input type="password" 
name="proxypwd" value="<?php echo htmlspecialchars($proxypwd); ?>" /></td>
+</tr>
+<tr>
+<td class="labelcell">COMPRESSION:</td>
+<td class="labelcell">Request:</td><td><select name="requestcompression">
+<option value="0"<?php if ($requestcompression == 0) echo ' 
selected="selected"'; ?>>None</option>
+<option value="1"<?php if ($requestcompression == 1) echo ' 
selected="selected"'; ?>>Gzip</option>
+<option value="2"<?php if ($requestcompression == 2) echo ' 
selected="selected"'; ?>>Deflate</option>
+</select></td>
+<td class="labelcell">Response:</td><td><select name="responsecompression">
+<option value="0"<?php if ($responsecompression == 0) echo ' 
selected="selected"'; ?>>None</option>
+<option value="1"<?php if ($responsecompression == 1) echo ' 
selected="selected"'; ?>>Gzip</option>
+<option value="2"<?php if ($responsecompression == 2) echo ' 
selected="selected"'; ?>>Deflate</option>
+<option value="3"<?php if ($responsecompression == 3) echo ' 
selected="selected"'; ?>>Any</option>
+</select></td>
+<td></td>
+</tr>
+<tr>
+<td class="labelcell">COOKIES:</td>
+<td colspan="4" class="labelcell"><input type="text" name="clientcookies" 
size="80" value="<?php echo htmlspecialchars($clientcookies); ?>" /></td>
+<td colspan="2">Format: 'cookie1=value1, cookie2=value2'</td>
+</tr>
+</table>
+
+</form>
+</body>
+</html>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/controller.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/index.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/index.php        
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/index.php        
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,21 @@
+<?php
+// $Id$
+  $query = '';
+  if (isset($_GET['run']))
+  {
+    $path = parse_url($_GET['run']);
+    if (isset($path['query']))
+      $query = '?'.$path['query'];
+  }
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd";>
+<html>
+<head>
+<title>XMLRPC Debugger</title>
+</head>
+<frameset rows="360,*">
+  <frame name="frmcontroller" src="controller.php<?php echo 
htmlspecialchars($query); ?>" marginwidth="0" marginheight="0" frameborder="0" 
/>
+  <frame name="frmaction" src="action.php" marginwidth="0" marginheight="0" 
frameborder="0" />
+</frameset>
+</html>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/debugger/index.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/agesort.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/agesort.php   
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/agesort.php   
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1 @@
+<html><head><title>xmlrpc</title></head><body><h1>Agesort demo</h1><h2>Send an 
array of 'name' => 'age' pairs to the server that will send it back 
sorted.</h2><h3>The source code demonstrates basic lib usage, including 
handling of xmlrpc arrays and 
structs</h3><p></p><?phpinclude("../../lib/xmlrpc.inc");$inAr=array("Dave" => 
24, "Edd" => 45, "Joe" => 37, "Fred" => 27);reset($inAr);print "This is the 
input data:<br/><pre>";while (list($key, $val)=each($inAr)) {  print $key . ", 
" . $val . "\n";}print "</pre>";// create parameters from the input array: an 
xmlrpc array of xmlrpc structs$p=array();foreach($inAr as $key => $val) {  
$p[]=new xmlrpcval(array("name" => new xmlrpcval($key),                         
  "age" => new xmlrpcval($val, "int")), "struct");}$v=new xmlrpcval($p, 
"array");print "Encoded into xmlrpc format it looks like this: <pre>\n" .  
htmlentities($v->serialize()). "</pre>\n";// create client and message 
objects$f=new xmlrpcmsg('examples.sortByAge',  array($v));$c=new 
xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);// set maximum 
debug level, to have the complete communication printed to 
screen$c->setDebug(2);// send requestprint "Now sending request (detailed debug 
info follows)";$r=&$c->send($f);// check response for errors, and take 
appropriate actionif (!$r->faultCode()) {  print "The server gave me these 
results:<pre>";  $v=$r->value();  $max=$v->arraysize();  for($i=0; $i<$max; 
$i++) {    $rec=$v->arraymem($i);    $n=$rec->structmem("name");    
$a=$rec->structmem("age");    print htmlspecialchars($n->scalarval()) . ", " . 
htmlspecialchars($a->scalarval()) . "\n";  }  print "<hr/>For nerds: I got this 
value back<br/><pre>" .    htmlentities($r->serialize()). "</pre><hr/>\n";} 
else {  print "An error occurred:<pre>";  print "Code: " . 
htmlspecialchars($r->faultCode()) .    "\nReason: '" . 
htmlspecialchars($r->faultString()).'\'</pre><hr/>';}?><em>$Id$</em></body></html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/agesort.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/client.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/client.php    
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/client.php    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,56 @@
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<h1>Getstatename demo</h1>
+<h2>Send a U.S. state number to the server and get back the state name</h2>
+<h3>The code demonstrates usage of the php_xmlrpc_encode function</h3>
+<?php
+       include("../../lib/xmlrpc.inc");
+
+       // Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
+       if(!isset($HTTP_POST_VARS) && isset($_POST))
+       {
+               $HTTP_POST_VARS = $_POST;
+       }
+
+       if(isset($HTTP_POST_VARS["stateno"]) && $HTTP_POST_VARS["stateno"]!="")
+       {
+               $stateno=(integer)$HTTP_POST_VARS["stateno"];
+               $f=new xmlrpcmsg('examples.getStateName',
+                       array(php_xmlrpc_encode($stateno))
+               );
+               print "<pre>Sending the following request:\n\n" . 
htmlentities($f->serialize()) . "\n\nDebug info of server data follows...\n\n";
+               $server =  substr($_SERVER['PHP_SELF'], 0, 
-strlen('/client/client.php')) . '/server/server.php';
+               $c=new xmlrpc_client($server, "localhost", 80);
+//             $c=new xmlrpc_client("/server.php", 
"phpxmlrpc.sourceforge.net", 80);
+               $c->setDebug(1);
+               $r=&$c->send($f);
+               if(!$r->faultCode())
+               {
+                       $v=$r->value();
+                       print "</pre><br/>State number " . $stateno . " is "
+                               . htmlspecialchars($v->scalarval()) . "<br/>";
+                       // print "<HR>I got this value back<BR><PRE>" .
+                       //  htmlentities($r->serialize()). "</PRE><HR>\n";
+               }
+               else
+               {
+                       print "An error occurred: ";
+                       print "Code: " . htmlspecialchars($r->faultCode())
+                               . " Reason: '" . 
htmlspecialchars($r->faultString()) . "'</pre><br/>";
+               }
+       }
+       else
+       {
+               $stateno = "";
+       }
+
+       print "<form action=\"client.php\" method=\"POST\">
+<input name=\"stateno\" value=\"" . $stateno . "\"><input type=\"submit\" 
value=\"go\" name=\"submit\"></form>
+<p>Enter a state number to query its name</p>";
+
+?>
+<hr/>
+<em>$Id$</em>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/client.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/comment.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/comment.php   
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/comment.php   
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,185 @@
+<?php
+include("../../lib/xmlrpc.inc");
+
+$mydir="/demo";
+
+// define some utility functions
+function bomb() { print "</body></html>"; exit(); }
+function dispatch($client, $method, $args) {
+       $msg=new xmlrpcmsg($method, $args);
+       $resp=$client->send($msg);
+       if (!$resp) { print "<p>IO error: ".$client->errstr."</p>"; bomb(); }
+       if ($resp->faultCode()) {
+               print "<p>There was an error: " . $resp->faultCode() . " " .
+                       $resp->faultString() . "</p>";
+               bomb();
+       }
+       return php_xmlrpc_decode($resp->value());
+}
+
+// create client for discussion server
+$dclient=new xmlrpc_client("${mydir}/discuss.php",
+                                                                               
                         "xmlrpc.usefulinc.com", 80);
+
+// check if we're posting a comment, and send it if so
address@hidden"storyid"];
+if ($storyid) {
+
+
+       //      print "Returning to " . $HTTP_POST_VARS["returnto"];
+
+       $res=dispatch($dclient, "discuss.addComment",
+                                                               array(new 
xmlrpcval($storyid),
+                                                                               
        new xmlrpcval(stripslashes
+                                                                               
                                                                
(@$_POST["name"])),
+                                                                               
        new xmlrpcval(stripslashes
+                                                                               
                                                                
(@$_POST["commenttext"]))));
+
+       // send the browser back to the originating page
+       Header("Location: ${mydir}/comment.php?catid=" .
+                                $_POST["catid"] . "&chanid=" .
+                                $_POST["chanid"] . "&oc=" .
+                                $_POST["catid"]);
+       exit(0);
+}
+
+// now we've got here, we're exploring the story store
+
+?>
+<html><head><title>meerkat browser</title></head>
+<body bgcolor="#ffffff">
+<h2>Meerkat integration</h2>
+<?php
address@hidden"catid"];
+if (@$_GET["oc"]==$catid)
+       @$chanid=$_GET["chanid"];
+else
+       $chanid=0;
+
+$client=new xmlrpc_client("/meerkat/xml-rpc/server.php",
+                                                                               
                        "www.oreillynet.com", 80);
+
+if (@$_GET["comment"] &&
+               (address@hidden"cdone"])) {
+       // we're making a comment on a story,
+       // so display a comment form
+?>
+<h3>Make a comment on the story</h3>
+<form method="post">
+<p>Your name:<br /><input type="text" size="30" name="name" /></p>
+<p>Your comment:<br /><textarea rows="5" cols="60"
+   name="commenttext"></textarea></p>
+<input type="submit" value="Send comment" />
+<input type="hidden" name="storyid"
+   value="<?php echo @$_GET["comment"];?>" />
+<input type="hidden" name="chanid"
+   value="<?php echo $chanid; ?>" />
+<input type="hidden" name="catid"
+   value="<?php echo $catid; ?>" />
+
+</form>
+<?php
+} else {
+       $categories=dispatch($client, "meerkat.getCategories", array());
+       if ($catid)
+               $sources = dispatch($client, "meerkat.getChannelsByCategory",
+                                                                               
                array(new xmlrpcval($catid, "int")));
+       if ($chanid) {
+               $stories = dispatch($client, "meerkat.getItems",
+                                       array(new xmlrpcval(
+                                               array(
+                                                       "channel" => new 
xmlrpcval($chanid, "int"),
+                                                       "ids" => new 
xmlrpcval(1, "int"),
+                                                       "descriptions" => new 
xmlrpcval(200, "int"),
+                                                       "num_items" => new 
xmlrpcval(5, "int"),
+                                                       "dates" => new 
xmlrpcval(0, "int")
+                                               ), "struct")));
+       }
+?>
+<form>
+<p>Subject area:<br />
+<select name="catid">
+<?php
+       if (!$catid)
+               print "<option value=\"0\">Choose a category</option>\n";
+       while(list($k,$v) = each($categories)) {
+               print "<option value=\"" . $v['id'] ."\"";
+               if ($v['id']==$catid) print " selected=\"selected\"";
+                       print ">". $v['title'] . "</option>\n";
+       }
+?>
+</select></p>
+<?php
+       if ($catid) {
+?>
+<p>News source:<br />
+<select name="chanid">
+<?php
+               if (!$chanid)
+                       print "<option value=\"0\">Choose a source</option>\n";
+               while(list($k,$v) = each($sources)) {
+                       print "<option value=\"" . $v['id'] ."\"";
+                       if ($v['id']==$chanid) print "\" selected=\"selected\"";
+                       print ">". $v['title'] . "</option>\n";
+               }
+?>
+</select>
+</p>
+
+<?php
+               } // end if ($catid)
+?>
+
+<p><input type="submit" value="Update" /></p>
+<input type="hidden" name="oc" value="<?php echo $catid; ?>" />
+</form>
+
+<?php
+        if ($chanid) {
+?>
+
+<h2>Stories available</h2>
+<table>
+<?php
+        while(list($k,$v) = each($stories)) {
+                print "<tr>";
+                print "<td><b>" . $v['title'] . "</b><br />";
+                print $v['description'] . "<br />";
+                print "<em><a target=\"_blank\" href=\"" .
+                        $v['link'] . "\">Read full story</a> ";
+                print "<a href=\"comment.php?catid=${catid}&chanid=${chanid}&" 
.
+                        "oc=${oc}&comment=" . $v['id'] . "\">Comment on this 
story</a>";
+                print "</em>";
+                print "</td>";
+                print "</tr>\n";
+                // now look for existing comments
+                $res=dispatch($dclient, "discuss.getComments",
+                                                       array(new 
xmlrpcval($v['id'])));
+                if (sizeof($res)>0) {
+                        print "<tr><td bgcolor=\"#dddddd\"><p><b><i>" .
+                                "Comments on this story:</i></b></p>";
+                        for($i=0; $i<sizeof($res); $i++) {
+                                $s=$res[$i];
+                                print "<p><b>From:</b> " . 
htmlentities($s['name']) . "<br />";
+                                print "<b>Comment:</b> " . 
htmlentities($s['comment']) . "</p>";
+                        }
+                        print "</td></tr>\n";
+                }
+                print "<tr><td><hr /></td></tr>\n";
+        }
+?>
+</table>
+
+<?php
+               } // end if ($chanid)
+} // end if comment
+?>
+<hr />
+<p>
+<a href="http://meerkat.oreillynet.com";><img align="right"
+       src="http://meerkat.oreillynet.com/icons/meerkat-powered.jpg";
+       height="31" width="88" alt="Meerkat powered, yeah!"
+       border="0" hspace="8" /></a>
+<em>$Id$</em></p>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/comment.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/introspect.php
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/introspect.php    
                            (rev 0)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/introspect.php    
    2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,110 @@
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<h1>Introspect demo</h1>
+<h2>Query server for available methods and their description</h2>
+<h3>The code demonstrates usage of multicall and introspection methods</h3>
+<?php
+       include("../../lib/xmlrpc.inc");
+
+       function display_error($r)
+       {
+               print "An error occurred: ";
+               print "Code: " . $r->faultCode()
+                       . " Reason: '" .$r->faultString()."'<br/>";
+       }
+
+       // 'new style' client constuctor
+       $server =  'http://' . $_SERVER['HTTP_HOST'] . 
substr($_SERVER['PHP_SELF'], 0, -strlen('/client/introspect.php')) . 
'/server/server.php';
+       $c = new xmlrpc_client($server);
+//     $c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php";);
+       print "<h3>methods available at http://"; . $c->server . $c->path .  
"</h3>\n";
+
+       $m = new xmlrpcmsg('system.listMethods');
+       $r =& $c->send($m);
+       if($r->faultCode())
+       {
+               display_error($r);
+       }
+       else
+       {
+               $v=$r->value();
+               for($i=0; $i<$v->arraysize(); $i++)
+               {
+                       $mname=$v->arraymem($i);
+                       print "<h4>" . $mname->scalarval() . "</h4>\n";
+
+                       // build messages first, add params later
+                       $m1  = new xmlrpcmsg('system.methodHelp');
+                       $m2  = new xmlrpcmsg('system.methodSignature');
+                       $val = new xmlrpcval($mname->scalarval(), "string");
+                       $m1->addParam($val);
+                       $m2->addParam($val);
+
+                       // send multiple messages in one pass.
+                       // If server does not support multicall, client will 
fall back to 2 separate calls
+                       $ms = array($m1, $m2);
+                       $rs =& $c->send($ms);
+
+                       if($rs[0]->faultCode())
+                       {
+                               display_error($rs[0]);
+                       }
+                       else
+                       {
+                               $val=$rs[0]->value();
+                               $txt=$val->scalarval();
+                               if($txt != "")
+                               {
+                                       print 
"<h4>Documentation</h4><p>${txt}</p>\n";
+                               }
+                               else
+                               {
+                                       print "<p>No documentation 
available.</p>\n";
+                               }
+                       }
+
+                       if($rs[1]->faultCode())
+                       {
+                               display_error($rs[1]);
+                       }
+                       else
+                       {
+                               print "<h4>Signature</h4><p>\n";
+                               $val = $rs[1]->value();
+                               if($val->kindOf()=="array")
+                               {
+                                       for($j=0; $j<$val->arraysize(); $j++)
+                                       {
+                                               $x = $val->arraymem($j);
+                                               $ret = $x->arraymem(0);
+                                               print "<code>" . 
$ret->scalarval() . " "
+                                                       . $mname->scalarval() . 
"(";
+                                               if($x->arraysize()>1)
+                                               {
+                                                       for($k=1; 
$k<$x->arraysize(); $k++)
+                                                       {
+                                                               $y = 
$x->arraymem($k);
+                                                               print 
$y->scalarval();
+                                                               if($k < 
$x->arraysize()-1)
+                                                               {
+                                                                       print 
", ";
+                                                               }
+                                                       }
+                                               }
+                                               print ")</code><br/>\n";
+                                       }
+                               }
+                               else
+                               {
+                                       print "Signature unknown\n";
+                               }
+                               print "</p>\n";
+                       }
+               }
+       }
+?>
+<hr/>
+<em>$Id$</em>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/introspect.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/mail.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/mail.php      
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/mail.php      
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,71 @@
+<?php
+// Allow users to see the source of this file even if PHP is not configured 
for it
+if ((isset($HTTP_GET_VARS['showSource']) && $HTTP_GET_VARS['showSource']) ||
+       (isset($_GET['showSource']) && $_GET['showSource']))
+       { highlight_file(__FILE__); die(); }
+?>
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<h1>Mail demo</h1>
+<p>This form enables you to send mail via an XML-RPC server. For public use
+only the "Userland" server will work (see <a 
href="http://www.xmlrpc.com/discuss/msgReader$598";>Dave Winer's message</a>).
+When you press <kbd>Send</kbd> this page will reload, showing you the XML-RPC 
request sent to the host server, the XML-RPC response received and the internal 
evaluation done by the PHP implementation.</p>
+<p>You can find the source to this page here: <a 
href="mail.php?showSource=1">mail.php</a><br/>
+And the source to a functionally identical mail-by-XML-RPC server in the file 
<a href="../server/server.php?showSource=1">server.php</a> included with the 
library (look for the 'mail_send' method)</p>
+<?php
+include("../../lib/xmlrpc.inc");
+
+// Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
+if (!isset($HTTP_POST_VARS) && isset($_POST))
+       $HTTP_POST_VARS = $_POST;
+
+if (isset($HTTP_POST_VARS["server"]) && $HTTP_POST_VARS["server"]) {
+       if ($HTTP_POST_VARS["server"]=="Userland") {
+               $XP="/RPC2"; $XS="206.204.24.2";
+       } else {
+               $XP="/xmlrpc/server.php"; $XS="pingu.heddley.com";
+       }
+       $f=new xmlrpcmsg('mail.send');
+       $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailto"]));
+       $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailsub"]));
+       $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailmsg"]));
+       $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailfrom"]));
+       $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailcc"]));
+       $f->addParam(new xmlrpcval($HTTP_POST_VARS["mailbcc"]));
+       $f->addParam(new xmlrpcval("text/plain"));
+
+       $c=new xmlrpc_client($XP, $XS, 80);
+       $c->setDebug(2);
+       $r=&$c->send($f);
+       if (!$r->faultCode()) {
+               print "Mail sent OK<br/>\n";
+       } else {
+               print "<fonr color=\"red\">";
+               print "Mail send failed<br/>\n";
+               print "Fault: ";
+               print "Code: " . htmlspecialchars($r->faultCode()) .
+         " Reason: '" . htmlspecialchars($r->faultString()) . "'<br/>";
+               print "</font><br/>";
+       }
+}
+?>
+<form method="POST">
+Server <select name="server"><option value="Userland">Userland</option>
+<option value="UsefulInc">UsefulInc private server</option></select>
+<hr/>
+From <input size="60" name="mailfrom" value=""/><br/>
+<hr/>
+To <input size="60" name="mailto" value=""/><br/>
+Cc <input size="60" name="mailcc" value=""/><br/>
+Bcc <input size="60" name="mailbcc" value=""/><br/>
+<hr/>
+Subject <input size="60" name="mailsub" value="A message from xmlrpc"/>
+<hr/>
+Body <textarea rows="7" cols="60" name="mailmsg">Your message 
here</textarea><br/>
+<input type="Submit" value="Send"/>
+</form>
+<hr/>
+<em>$Id$</em>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/mail.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/simple_call.php
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/simple_call.php   
                            (rev 0)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/simple_call.php   
    2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Helper function for the terminally lazy
+ *
+ * @version $Id$
+ * @copyright (c) 2006-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ */
+
+       /**
+        * Takes a client object, a remote method name, and a variable numbers 
of
+        * php values, and calls the method with the supplied parameters. The 
+        * parameters are native php values and the result is an xmlrpcresp 
object.
+        *
+        * Notes:
+        * The function encodes the received parameters using php_xmlrpc_encode:
+        * the limitations of automatic encoding apply to this function too);
+        *
+        * the type of the value returned by the function can be changed setting
+        * beforehand the 'return_type' member of the client object to 
'phpvals' -
+        * see the manual for more details about this capability).
+        *
+        *
+        * @author Toth Istvan
+        *
+        * @param xmlrpc_client client object, properly set up to connect to 
server
+        * @param string remote function name
+        * @param mixed $parameter1
+        * @param mixed $parameter2
+        * @param mixed $parameter3 ...
+        * @return xmlrpcresp or false on error
+        */
+       function xmlrpccall_simple()
+       {
+               if(func_num_args() < 2)
+               {
+                       // Incorrect
+                       return false;
+               }
+               else
+               {
+                       $varargs = func_get_args();
+                       $client = array_shift($varargs);
+                       $remote_function_name = array_shift($varargs);
+                       if (!is_a($client, 'xmlrpc_client') || 
!is_string($remote_function_name))
+                       {
+                               return false;
+                       }
+
+                       $xmlrpcval_array = array();
+                       foreach($varargs as $parameter)
+                       {
+                               $xmlrpcval_array[] = 
php_xmlrpc_encode($parameter);
+                       }
+
+                       return $client->send(new 
xmlrpcmsg($remote_function_name, $xmlrpcval_array));
+               }
+       }
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/simple_call.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/which.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/which.php     
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/which.php     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,34 @@
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<h1>Which toolkit demo</h1>
+<h2>Query server for toolkit information</h2>
+<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>
+<?php
+       include("../../lib/xmlrpc.inc");
+
+       $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());
+       $server =  substr($_SERVER['PHP_SELF'], 0, 
-strlen('/client/which.php')) . '/server/server.php';
+       $c = new xmlrpc_client($server, $_SERVER['HTTP_HOST'], 80);
+//     $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
+       $r = $c->send($f);
+       if(!$r->faultCode())
+       {
+               $v = php_xmlrpc_decode($r->value());
+               print "<pre>";
+               print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";
+               print "version: " . htmlspecialchars($v["toolkitVersion"]) . 
"\n";
+               print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";
+               print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . 
"\n";
+               print "</pre>";
+       }
+       else
+       {
+               print "An error occurred: ";
+               print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: 
'" . htmlspecialchars($r->faultString()) . "'\n";
+       }
+?>
+<hr/>
+<em>$Id$</em>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/which.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/wrap.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/wrap.php      
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/wrap.php      
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,60 @@
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<h1>Webservice wrappper demo</h1>
+<h2>Wrap methods exposed by server into php functions</h2>
+<h3>The code demonstrates usage of the most automagic client usage 
possible:<br/>
+1) client that returns php values instead of xmlrpcval objects<br/>
+2) wrapping of remote methods into php functions
+</h3>
+<?php
+       include("../../lib/xmlrpc.inc");
+       include("../../lib/xmlrpc_wrappers.inc");
+
+       $server =  substr($_SERVER['PHP_SELF'], 0, -strlen('/client/wrap.php')) 
. '/server/server.php';
+       $c = new xmlrpc_client($server, $_SERVER['HTTP_HOST'], 80);
+//     $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
+       $c->return_type = 'phpvals'; // let client give us back php values 
instead of xmlrpcvals
+       $r =& $c->send(new xmlrpcmsg('system.listMethods'));
+       if($r->faultCode())
+       {
+               echo "<p>Server methods list could not be retrieved: error 
'".htmlspecialchars($r->faultString())."'</p>\n";
+       }
+       else
+       {
+               $testcase = '';
+               echo "<p>Server methods list retrieved, now wrapping it 
up...</p>\n<ul>\n";
+               foreach($r->value() as $methodname) // $r->value is an array of 
strings
+               {
+                       // do not wrap remote server system methods
+                       if (strpos($methodname, 'system.') !== 0)
+                       {
+                               $funcname = wrap_xmlrpc_method($c, $methodname);
+                               if($funcname)
+                               {
+                                       echo "<li>Remote server method 
".htmlspecialchars($methodname)." wrapped into php function 
".$funcname."</li>\n";
+                               }
+                               else
+                               {
+                                       echo "<li>Remote server method 
".htmlspecialchars($methodname)." could not be wrapped!</li>\n";
+                               }
+                               if($methodname == 'examples.getStateName')
+                               {
+                                       $testcase = $funcname;
+                               }
+                       }
+               }
+               echo "</ul>\n";
+               if($testcase)
+               {
+                       echo "Now testing function $testcase: remote method to 
convert U.S. state number into state name";
+                       $statenum = 25;
+                       $statename = $testcase($statenum, 2);
+                       echo "State number $statenum is 
".htmlspecialchars($statename);
+               }
+       }
+?>
+<hr/>
+<em>$Id$</em>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/wrap.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/zopetest.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/zopetest.php  
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/zopetest.php  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,31 @@
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<h1>Zope test demo</h1>
+<h3>The code demonstrates usage of basic authentication to connect to the 
server</h3>
+<?php
+       include("../../lib/xmlrpc.inc");
+
+       $f = new xmlrpcmsg('document_src', array());
+       $c = new xmlrpc_client("/index_html", "pingu.heddley.com", 9080);
+       $c->setCredentials("username", "password");
+       $c->setDebug(2);
+       $r = $c->send($f);
+       if(!$r->faultCode())
+       {
+               $v = $r->value();
+               print "I received:" . htmlspecialchars($v->scalarval()) . 
"<br/>";
+               print "<hr/>I got this value back<br/>pre>" .
+               htmlentities($r->serialize()). "</pre>\n";
+       }
+       else
+       {
+               print "An error occurred: ";
+               print "Code: " . htmlspecialchars($r->faultCode())
+                       . " Reason: '" . ($r->faultString()) . "'<br/>";
+       }
+?>
+<hr/>
+<em>$Id$</em>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/client/zopetest.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo1.txt
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo1.txt            
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo1.txt    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+          <methodResponse>
+             <params>
+                <param>
+                   <value>
+               <struct>
+<member><name>thearray</name>
+<value><array>
+<data>
+<value><string>ABCDEFHIJ</string></value>
+<value><int>1234</int></value>
+<value><boolean>1</boolean></value>
+</data>
+</array></value>
+</member>
+<member><name>theint</name>
+<value><int>23</int></value>
+</member>
+<member><name>thestring</name>
+<value><string>foobarwhizz</string></value>
+</member>
+<member><name>thestruct</name>
+<value><struct>
+<member><name>one</name>
+<value><int>1</int></value>
+</member>
+<member><name>two</name>
+<value><int>2</int></value>
+</member>
+</struct></value>
+</member>
+</struct>
+               </value>
+                   </param>
+                </params>
+             </methodResponse>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo1.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo2.txt
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo2.txt            
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo2.txt    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+          <methodResponse>
+             <params>
+                <param>
+                   <value><string>South Dakota's own</string></value>
+                   </param>
+                </params>
+             </methodResponse>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo2.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo3.txt
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo3.txt            
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo3.txt    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+          <methodResponse>
+             <fault>
+                <value>
+                   <struct>
+                      <member>
+                         <name>faultCode</name>
+                         <value><int>4</int></value>
+                         </member>
+                      <member>
+                         <name>faultString</name>
+                         <value><string>Too many parameters.</string></value>
+                         </member>
+                      </struct>
+                   </value>
+                </fault>
+             </methodResponse>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/demo3.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/discuss.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/discuss.php   
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/discuss.php   
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,124 @@
+<?php
+// $Id$
+       include("../../lib/xmlrpc.inc");
+       include("../../lib/xmlrpcs.inc");
+
+       $addcomment_sig=array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString, 
$xmlrpcString));
+
+       $addcomment_doc='Adds a comment to an item. The first parameter
+is the item ID, the second the name of the commenter, and the third
+is the comment itself. Returns the number of comments against that
+ID.';
+
+       function addcomment($m)
+       {
+               global $xmlrpcerruser;
+               $err="";
+               // since validation has already been carried out for us,
+               // we know we got exactly 3 string values
+               $n = php_xmlrpc_decode($m);
+               $msgID = $n[0];
+               $name  = $n[1];
+               $comment = $n[2];
+
+               $dbh=dba_open("/tmp/comments.db", "c", "db2");
+               if($dbh)
+               {
+                       $countID="${msgID}_count";
+                       if(dba_exists($countID, $dbh))
+                       {
+                               $count=dba_fetch($countID, $dbh);
+                       }
+                       else
+                       {
+                               $count=0;
+                       }
+                       // add the new comment in
+                       dba_insert($msgID . "_comment_${count}", $comment, 
$dbh);
+                       dba_insert($msgID . "_name_${count}", $name, $dbh);
+                       $count++;
+                       dba_replace($countID, $count, $dbh);
+                       dba_close($dbh);
+               }
+               else
+               {
+                       $err="Unable to open comments database.";
+               }
+               // if we generated an error, create an error return response
+               if($err)
+               {
+                       return new xmlrpcresp(0, $xmlrpcerruser, $err);
+               }
+               else
+               {
+                       // otherwise, we create the right response
+                       // with the state name
+                       return new xmlrpcresp(new xmlrpcval($count, "int"));
+               }
+       }
+
+       $getcomments_sig=array(array($xmlrpcArray, $xmlrpcString));
+
+       $getcomments_doc='Returns an array of comments for a given ID, which
+is the sole argument. Each array item is a struct containing name
+and comment text.';
+
+       function getcomments($m)
+       {
+               global $xmlrpcerruser;
+               $err="";
+               $ra=array();
+               // get the first param
+               if(XMLRPC_EPI_ENABLED == '1')
+               {
+                       $msgID=xmlrpc_decode($m->getParam(0));
+               }
+               else
+               {
+                       $msgID=php_xmlrpc_decode($m->getParam(0));
+               }
+               $dbh=dba_open("/tmp/comments.db", "r", "db2");
+               if($dbh)
+               {
+                       $countID="${msgID}_count";
+                       if(dba_exists($countID, $dbh))
+                       {
+                               $count=dba_fetch($countID, $dbh);
+                               for($i=0; $i<$count; $i++)
+                               {
+                                       $name=dba_fetch("${msgID}_name_${i}", 
$dbh);
+                                       
$comment=dba_fetch("${msgID}_comment_${i}", $dbh);
+                                       // push a new struct onto the return 
array
+                                       $ra[] = array(
+                                               "name" => $name,
+                                               "comment" => $comment
+                                               );
+                               }
+                       }
+               }
+               // if we generated an error, create an error return response
+               if($err)
+               {
+                       return new xmlrpcresp(0, $xmlrpcerruser, $err);
+               }
+               else
+               {
+                       // otherwise, we create the right response
+                       // with the state name
+                       return new xmlrpcresp(php_xmlrpc_encode($ra));
+               }
+       }
+
+       $s = new xmlrpc_server(array(
+               "discuss.addComment" => array(
+                       "function" => "addcomment",
+                       "signature" => $addcomment_sig,
+                       "docstring" => $addcomment_doc
+               ),
+               "discuss.getComments" => array(
+                       "function" => "getcomments",
+                       "signature" => $getcomments_sig,
+                       "docstring" => $getcomments_doc
+               )
+       ));
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/discuss.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/proxy.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/proxy.php     
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/proxy.php     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,86 @@
+<?php
+/**
+ * XMLRPC server acting as proxy for requests to other servers
+ * (useful e.g. for ajax-originated calls that can only connect back to
+ * the originating server)
+ *
+ * @version $Id$
+ * @author Gaetano Giunta
+ * @copyright (C) 2006-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ */
+
+       include("../../lib/xmlrpc.inc");
+       include("../../lib/xmlrpcs.inc");
+
+       /**
+       * Forward an xmlrpc request to another server, and return to client the 
response received.
+       * @param xmlrpcmsg $m (see method docs below for a description of the 
expected parameters)
+       * @return xmlrpcresp
+       */
+       function forward_request($m)
+       {
+               // create client
+               $timeout = 0;
+               $url = php_xmlrpc_decode($m->getParam(0));
+               $c = new xmlrpc_client($url);
+               if ($m->getNumParams() > 3)
+               {
+                       // we have to set some options onto the client.
+                       // Note that if we do not untaint the received values, 
warnings might be generated...
+                       $options = php_xmlrpc_decode($m->getParam(3));
+                       foreach($options as $key => $val)
+                       {
+                               switch($key)
+                               {
+                                       case 'Cookie':
+                                               break;
+                                       case 'Credentials':
+                                               break;
+                                       case 'RequestCompression':
+                                               $c->setRequestCompression($val);
+                                               break;
+                                       case 'SSLVerifyHost':
+                                               $c->setSSLVerifyHost($val);
+                                               break;
+                                       case 'SSLVerifyPeer':
+                                               $c->setSSLVerifyPeer($val);
+                                               break;
+                                       case 'Timeout':
+                                               $timeout = (integer) $val;
+                                               break;
+                               } // switch
+                       }
+               }
+
+               // build call for remote server
+               /// @todo find a weay to forward client info (such as IP) to 
server, either
+               /// - as xml comments in the payload, or
+               /// - using std http header conventions, such as 
X-forwarded-for...
+               $method = php_xmlrpc_decode($m->getParam(1));
+               $pars = $m->getParam(2);
+               $m = new xmlrpcmsg($method);
+               for ($i = 0; $i < $pars->arraySize(); $i++)
+               {
+                       $m->addParam($pars->arraymem($i));
+               }
+
+               // add debug info into response we give back to caller
+               xmlrpc_debugmsg("Sending to server $url the payload: 
".$m->serialize());
+               return $c->send($m, $timeout);
+       }
+
+       // run the server
+       $server = new xmlrpc_server(
+               array(
+                       'xmlrpcproxy.call' => array(
+                               'function' => 'forward_request',
+                               'signature' => array(
+                                       array('mixed', 'string', 'string', 
'array'),
+                                       array('mixed', 'string', 'string', 
'array', 'stuct'),
+                               ),
+                               'docstring' => 'forwards xmlrpc calls to remote 
servers. Returns remote method\'s response. Accepts params: remote server url 
(might include basic auth credentials), method name, array of params, and 
(optionally) a struct containing call options'
+                       )
+               )
+       );
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/proxy.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/server.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/server.php    
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/server.php    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,853 @@
+<?php
+/**
+ * Demo server for xmlrpc library.
+ *
+ * Implements a lot of webservices, including a suite of services used for
+ * interoperability testing (validator1 methods), and some whose only purpose
+ * is to be used for unit-testing the library.
+ *
+ * Please do not copy this file verbatim into your production server.
+ *
+ * @version $Id$
+ **/
+
+// give user a chance to see the source for this server instead of running the 
services
+if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource']))
+{
+       highlight_file(__FILE__);
+       die();
+}
+
+       include("../../lib/xmlrpc.inc");
+       include("../../lib/xmlrpcs.inc");
+       include("../../lib/xmlrpc_wrappers.inc");
+
+       /**
+       * Used to test usage of object methods in dispatch maps and in wrapper 
code
+       */
+       class xmlrpc_server_methods_container
+       {
+               /**
+               * Method used to test logging of php warnings generated by user 
functions.
+               */
+               function phpwarninggenerator($m)
+               {
+                       $a = $b; // this triggers a warning in E_ALL mode, 
since $b is undefined
+                       return new xmlrpcresp(new xmlrpcval(1, 'boolean'));
+               }
+
+           /**
+            * Method used to testcatching of exceptions in the server.
+            */
+           function exceptiongenerator($m)
+           {
+               throw new Exception("it's just a test", 1);
+           }
+
+               /**
+               * a PHP version of the state-number server. Send me an integer 
and i'll sell you a state
+               * @param integer $s
+               * @return string
+               */
+               static function findstate($s)
+               {
+                       return inner_findstate($s);
+               }
+       }
+
+
+       // a PHP version
+       // of the state-number server
+       // send me an integer and i'll sell you a state
+
+       $stateNames = array(
+               "Alabama", "Alaska", "Arizona", "Arkansas", "California",
+               "Colorado", "Columbia", "Connecticut", "Delaware", "Florida",
+               "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", 
"Kansas",
+               "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", 
"Michigan",
+               "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", 
"Nevada",
+               "New Hampshire", "New Jersey", "New Mexico", "New York", "North 
Carolina",
+               "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", 
"Rhode Island",
+               "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", 
"Vermont",
+               "Virginia", "Washington", "West Virginia", "Wisconsin", 
"Wyoming"
+       );
+
+       $findstate_sig=array(array($xmlrpcString, $xmlrpcInt));
+       $findstate_doc='When passed an integer between 1 and 51 returns the
+name of a US state, where the integer is the index of that state name
+in an alphabetic order.';
+
+
+       function findstate($m)
+       {
+               global $xmlrpcerruser, $stateNames;
+               $err="";
+               // get the first param
+               $sno=$m->getParam(0);
+
+               // param must be there and of the correct type: server object 
does the
+               // validation for us
+
+               // extract the value of the state number
+               $snv=$sno->scalarval();
+               // look it up in our array (zero-based)
+               if (isset($stateNames[$snv-1]))
+               {
+                       $sname=$stateNames[$snv-1];
+               }
+               else
+               {
+                       // not, there so complain
+                       $err="I don't have a state for the index '" . $snv . 
"'";
+               }
+
+               // if we generated an error, create an error return response
+               if ($err)
+               {
+                       return new xmlrpcresp(0, $xmlrpcerruser, $err);
+               }
+               else
+               {
+                       // otherwise, we create the right response
+                       // with the state name
+                       return new xmlrpcresp(new xmlrpcval($sname));
+               }
+       }
+
+       /**
+       * Inner code of the state-number server.
+       * Used to test auto-registration of PHP funcions as xmlrpc methods.
+       * @param integer $stateno the state number
+       * @return string the name of the state (or error descrption)
+       */
+       function inner_findstate($stateno)
+       {
+               global $stateNames;
+               if (isset($stateNames[$stateno-1]))
+               {
+                       return $stateNames[$stateno-1];
+               }
+               else
+               {
+                       // not, there so complain
+                       return "I don't have a state for the index '" . 
$stateno . "'";
+               }
+       }
+       $findstate2_sig = wrap_php_function('inner_findstate');
+
+       $findstate3_sig = 
wrap_php_function(array('xmlrpc_server_methods_container', 'findstate'));
+
+       $findstate5_sig = 
wrap_php_function('xmlrpc_server_methods_container::findstate');
+
+       $obj = new xmlrpc_server_methods_container();
+       $findstate4_sig = wrap_php_function(array($obj, 'findstate'));
+
+       $addtwo_sig=array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt));
+       $addtwo_doc='Add two integers together and return the result';
+       function addtwo($m)
+       {
+               $s=$m->getParam(0);
+               $t=$m->getParam(1);
+               return new xmlrpcresp(new 
xmlrpcval($s->scalarval()+$t->scalarval(),"int"));
+       }
+
+       $addtwodouble_sig=array(array($xmlrpcDouble, $xmlrpcDouble, 
$xmlrpcDouble));
+       $addtwodouble_doc='Add two doubles together and return the result';
+       function addtwodouble($m)
+       {
+               $s=$m->getParam(0);
+               $t=$m->getParam(1);
+               return new xmlrpcresp(new 
xmlrpcval($s->scalarval()+$t->scalarval(),"double"));
+       }
+
+       $stringecho_sig=array(array($xmlrpcString, $xmlrpcString));
+       $stringecho_doc='Accepts a string parameter, returns the string.';
+       function stringecho($m)
+       {
+               // just sends back a string
+               $s=$m->getParam(0);
+               $v = $s->scalarval();
+               return new xmlrpcresp(new xmlrpcval($s->scalarval()));
+       }
+
+       $echoback_sig=array(array($xmlrpcString, $xmlrpcString));
+       $echoback_doc='Accepts a string parameter, returns the entire incoming 
payload';
+       function echoback($m)
+       {
+               // just sends back a string with what i got
+               // sent to me, just escaped, that's all
+               //
+               // $m is an incoming message
+               $s="I got the following message:\n" . $m->serialize();
+               return new xmlrpcresp(new xmlrpcval($s));
+       }
+
+       $echosixtyfour_sig=array(array($xmlrpcString, $xmlrpcBase64));
+       $echosixtyfour_doc='Accepts a base64 parameter and returns it decoded 
as a string';
+       function echosixtyfour($m)
+       {
+               // accepts an encoded value, but sends it back
+               // as a normal string. this is to test base64 encoding
+               // is working as expected
+               $incoming=$m->getParam(0);
+               return new xmlrpcresp(new xmlrpcval($incoming->scalarval(), 
"string"));
+       }
+
+       $bitflipper_sig=array(array($xmlrpcArray, $xmlrpcArray));
+       $bitflipper_doc='Accepts an array of booleans, and returns them 
inverted';
+       function bitflipper($m)
+       {
+               global $xmlrpcArray;
+
+               $v=$m->getParam(0);
+               $sz=$v->arraysize();
+               $rv=new xmlrpcval(array(), $xmlrpcArray);
+
+               for($j=0; $j<$sz; $j++)
+               {
+                       $b=$v->arraymem($j);
+                       if ($b->scalarval())
+                       {
+                               $rv->addScalar(false, "boolean");
+                       }
+                       else
+                       {
+                               $rv->addScalar(true, "boolean");
+                       }
+               }
+
+               return new xmlrpcresp($rv);
+       }
+
+       // Sorting demo
+       //
+       // send me an array of structs thus:
+       //
+       // Dave 35
+       // Edd  45
+       // Fred 23
+       // Barney 37
+       //
+       // and I'll return it to you in sorted order
+
+       function agesorter_compare($a, $b)
+       {
+               global $agesorter_arr;
+
+               // don't even ask me _why_ these come padded with
+               // hyphens, I couldn't tell you :p
+               $a=str_replace("-", "", $a);
+               $b=str_replace("-", "", $b);
+
+               if ($agesorter_arr[$a]==$agesorter[$b])
+               {
+                       return 0;
+               }
+               return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1;
+       }
+
+       $agesorter_sig=array(array($xmlrpcArray, $xmlrpcArray));
+       $agesorter_doc='Send this method an array of [string, int] structs, eg:
+<pre>
+ Dave   35
+ Edd   45
+ Fred   23
+ Barney 37
+</pre>
+And the array will be returned with the entries sorted by their numbers.
+';
+       function agesorter($m)
+       {
+               global $agesorter_arr, $xmlrpcerruser, $s;
+
+               xmlrpc_debugmsg("Entering 'agesorter'");
+               // get the parameter
+               $sno=$m->getParam(0);
+               // error string for [if|when] things go wrong
+               $err="";
+               // create the output value
+               $v=new xmlrpcval();
+               $agar=array();
+
+               if (isset($sno) && $sno->kindOf()=="array")
+               {
+                       $max=$sno->arraysize();
+                       // TODO: create debug method to print can work once more
+                       // print "<!-- found $max array elements -->\n";
+                       for($i=0; $i<$max; $i++)
+                       {
+                               $rec=$sno->arraymem($i);
+                               if ($rec->kindOf()!="struct")
+                               {
+                                       $err="Found non-struct in array at 
element $i";
+                                       break;
+                               }
+                               // extract name and age from struct
+                               $n=$rec->structmem("name");
+                               $a=$rec->structmem("age");
+                               // $n and $a are xmlrpcvals,
+                               // so get the scalarval from them
+                               $agar[$n->scalarval()]=$a->scalarval();
+                       }
+
+                       $agesorter_arr=$agar;
+                       // hack, must make global as uksort() won't
+                       // allow us to pass any other auxilliary information
+                       uksort($agesorter_arr, agesorter_compare);
+                       $outAr=array();
+                       while (list( $key, $val ) = each( $agesorter_arr ) )
+                       {
+                               // recreate each struct element
+                               $outAr[]=new xmlrpcval(array("name" =>
+                               new xmlrpcval($key),
+                               "age" =>
+                               new xmlrpcval($val, "int")), "struct");
+                       }
+                       // add this array to the output value
+                       $v->addArray($outAr);
+               }
+               else
+               {
+                       $err="Must be one parameter, an array of structs";
+               }
+
+               if ($err)
+               {
+                       return new xmlrpcresp(0, $xmlrpcerruser, $err);
+               }
+               else
+               {
+                       return new xmlrpcresp($v);
+               }
+       }
+
+       // signature and instructions, place these in the dispatch
+       // map
+       $mail_send_sig=array(array(
+               $xmlrpcBoolean, $xmlrpcString, $xmlrpcString,
+               $xmlrpcString, $xmlrpcString, $xmlrpcString,
+               $xmlrpcString, $xmlrpcString
+       ));
+
+       $mail_send_doc='mail.send(recipient, subject, text, sender, cc, bcc, 
mimetype)<br/>
+recipient, cc, and bcc are strings, comma-separated lists of email addresses, 
as described above.<br/>
+subject is a string, the subject of the message.<br/>
+sender is a string, it\'s the email address of the person sending the message. 
This string can not be
+a comma-separated list, it must contain a single email address only.<br/>
+text is a string, it contains the body of the message.<br/>
+mimetype, a string, is a standard MIME type, for example, text/plain.
+';
+       // WARNING; this functionality depends on the sendmail -t option
+       // it may not work with Windows machines properly; particularly
+       // the Bcc option. Sneak on your friends at your own risk!
+       function mail_send($m)
+       {
+               global $xmlrpcerruser, $xmlrpcBoolean;
+               $err="";
+
+               $mTo=$m->getParam(0);
+               $mSub=$m->getParam(1);
+               $mBody=$m->getParam(2);
+               $mFrom=$m->getParam(3);
+               $mCc=$m->getParam(4);
+               $mBcc=$m->getParam(5);
+               $mMime=$m->getParam(6);
+
+               if ($mTo->scalarval()=="")
+               {
+                       $err="Error, no 'To' field specified";
+               }
+
+               if ($mFrom->scalarval()=="")
+               {
+                       $err="Error, no 'From' field specified";
+               }
+
+               $msghdr="From: " . $mFrom->scalarval() . "\n";
+               $msghdr.="To: ". $mTo->scalarval() . "\n";
+
+               if ($mCc->scalarval()!="")
+               {
+                       $msghdr.="Cc: " . $mCc->scalarval(). "\n";
+               }
+               if ($mBcc->scalarval()!="")
+               {
+                       $msghdr.="Bcc: " . $mBcc->scalarval(). "\n";
+               }
+               if ($mMime->scalarval()!="")
+               {
+                       $msghdr.="Content-type: " . $mMime->scalarval() . "\n";
+               }
+               $msghdr.="X-Mailer: XML-RPC for PHP mailer 1.0";
+
+               if ($err=="")
+               {
+                       if (!mail("",
+                               $mSub->scalarval(),
+                               $mBody->scalarval(),
+                               $msghdr))
+                       {
+                               $err="Error, could not send the mail.";
+                       }
+               }
+
+               if ($err)
+               {
+                       return new xmlrpcresp(0, $xmlrpcerruser, $err);
+               }
+               else
+               {
+                       return new xmlrpcresp(new xmlrpcval("true", 
$xmlrpcBoolean));
+               }
+       }
+
+       $getallheaders_sig=array(array($xmlrpcStruct));
+       $getallheaders_doc='Returns a struct containing all the HTTP headers 
received with the request. Provides limited functionality with IIS';
+       function getallheaders_xmlrpc($m)
+       {
+               global $xmlrpcerruser;
+               if (function_exists('getallheaders'))
+               {
+                       return new 
xmlrpcresp(php_xmlrpc_encode(getallheaders()));
+               }
+               else
+               {
+                       $headers = array();
+                       // IIS: poor man's version of getallheaders
+                       foreach ($_SERVER as $key => $val)
+                               if (strpos($key, 'HTTP_') === 0)
+                               {
+                                       $key = ucfirst(str_replace('_', '-', 
strtolower(substr($key, 5))));
+                                       $headers[$key] = $val;
+                               }
+                       return new xmlrpcresp(php_xmlrpc_encode($headers));
+               }
+       }
+
+       $setcookies_sig=array(array($xmlrpcInt, $xmlrpcStruct));
+       $setcookies_doc='Sends to client a response containing a single \'1\' 
digit, and sets to it http cookies as received in the request (array of structs 
describing a cookie)';
+       function setcookies($m)
+       {
+               $m = $m->getParam(0);
+               while(list($name,$value) = $m->structeach())
+               {
+                       $cookiedesc = php_xmlrpc_decode($value);
+                       setcookie($name, @$cookiedesc['value'], 
@$cookiedesc['expires'], @$cookiedesc['path'], @$cookiedesc['domain'], 
@$cookiedesc['secure']);
+               }
+               return new xmlrpcresp(new xmlrpcval(1, 'int'));
+       }
+
+       $getcookies_sig=array(array($xmlrpcStruct));
+       $getcookies_doc='Sends to client a response containing all http cookies 
as received in the request (as struct)';
+       function getcookies($m)
+       {
+               return new xmlrpcresp(php_xmlrpc_encode($_COOKIE));
+       }
+
+       $v1_arrayOfStructs_sig=array(array($xmlrpcInt, $xmlrpcArray));
+       $v1_arrayOfStructs_doc='This handler takes a single parameter, an array 
of structs, each of which contains at least three elements named moe, larry and 
curly, all <i4>s. Your handler must add all the struct elements named curly and 
return the result.';
+       function v1_arrayOfStructs($m)
+       {
+               $sno=$m->getParam(0);
+               $numcurly=0;
+               for($i=0; $i<$sno->arraysize(); $i++)
+               {
+                       $str=$sno->arraymem($i);
+                       $str->structreset();
+                       while(list($key,$val)=$str->structeach())
+                       {
+                               if ($key=="curly")
+                               {
+                                       $numcurly+=$val->scalarval();
+                               }
+                       }
+               }
+               return new xmlrpcresp(new xmlrpcval($numcurly, "int"));
+       }
+
+       $v1_easyStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct));
+       $v1_easyStruct_doc='This handler takes a single parameter, a struct, 
containing at least three elements named moe, larry and curly, all &lt;i4&gt;s. 
Your handler must add the three numbers and return the result.';
+       function v1_easyStruct($m)
+       {
+               $sno=$m->getParam(0);
+               $moe=$sno->structmem("moe");
+               $larry=$sno->structmem("larry");
+               $curly=$sno->structmem("curly");
+               $num=$moe->scalarval() + $larry->scalarval() + 
$curly->scalarval();
+               return new xmlrpcresp(new xmlrpcval($num, "int"));
+       }
+
+       $v1_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct));
+       $v1_echoStruct_doc='This handler takes a single parameter, a struct. 
Your handler must return the struct.';
+       function v1_echoStruct($m)
+       {
+               $sno=$m->getParam(0);
+               return new xmlrpcresp($sno);
+       }
+
+       $v1_manyTypes_sig=array(array(
+               $xmlrpcArray, $xmlrpcInt, $xmlrpcBoolean,
+               $xmlrpcString, $xmlrpcDouble, $xmlrpcDateTime,
+               $xmlrpcBase64
+       ));
+       $v1_manyTypes_doc='This handler takes six parameters, and returns an 
array containing all the parameters.';
+       function v1_manyTypes($m)
+       {
+               return new xmlrpcresp(new xmlrpcval(array(
+                       $m->getParam(0),
+                       $m->getParam(1),
+                       $m->getParam(2),
+                       $m->getParam(3),
+                       $m->getParam(4),
+                       $m->getParam(5)),
+                       "array"
+               ));
+       }
+
+       $v1_moderateSizeArrayCheck_sig=array(array($xmlrpcString, 
$xmlrpcArray));
+       $v1_moderateSizeArrayCheck_doc='This handler takes a single parameter, 
which is an array containing between 100 and 200 elements. Each of the items is 
a string, your handler must return a string containing the concatenated text of 
the first and last elements.';
+       function v1_moderateSizeArrayCheck($m)
+       {
+               $ar=$m->getParam(0);
+               $sz=$ar->arraysize();
+               $first=$ar->arraymem(0);
+               $last=$ar->arraymem($sz-1);
+               return new xmlrpcresp(new xmlrpcval($first->scalarval() .
+               $last->scalarval(), "string"));
+       }
+
+       $v1_simpleStructReturn_sig=array(array($xmlrpcStruct, $xmlrpcInt));
+       $v1_simpleStructReturn_doc='This handler takes one parameter, and 
returns a struct containing three elements, times10, times100 and times1000, 
the result of multiplying the number by 10, 100 and 1000.';
+       function v1_simpleStructReturn($m)
+       {
+               $sno=$m->getParam(0);
+               $v=$sno->scalarval();
+               return new xmlrpcresp(new xmlrpcval(array(
+                       "times10"   => new xmlrpcval($v*10, "int"),
+                       "times100"  => new xmlrpcval($v*100, "int"),
+                       "times1000" => new xmlrpcval($v*1000, "int")),
+                       "struct"
+               ));
+       }
+
+       $v1_nestedStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct));
+       $v1_nestedStruct_doc='This handler takes a single parameter, a struct, 
that models a daily calendar. At the top level, there is one struct for each 
year. Each year is broken down into months, and months into days. Most of the 
days are empty in the struct you receive, but the entry for April 1, 2000 
contains a least three elements named moe, larry and curly, all &lt;i4&gt;s. 
Your handler must add the three numbers and return the result.';
+       function v1_nestedStruct($m)
+       {
+               $sno=$m->getParam(0);
+
+               $twoK=$sno->structmem("2000");
+               $april=$twoK->structmem("04");
+               $fools=$april->structmem("01");
+               $curly=$fools->structmem("curly");
+               $larry=$fools->structmem("larry");
+               $moe=$fools->structmem("moe");
+               return new xmlrpcresp(new xmlrpcval($curly->scalarval() + 
$larry->scalarval() + $moe->scalarval(), "int"));
+       }
+
+       $v1_countTheEntities_sig=array(array($xmlrpcStruct, $xmlrpcString));
+       $v1_countTheEntities_doc='This handler takes a single parameter, a 
string, that contains any number of predefined entities, namely &lt;, &gt;, 
&amp; \' and ".<BR>Your handler must return a struct that contains five fields, 
all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, 
ctApostrophes, ctQuotes.';
+       function v1_countTheEntities($m)
+       {
+               $sno=$m->getParam(0);
+               $str=$sno->scalarval();
+               $gt=0; $lt=0; $ap=0; $qu=0; $amp=0;
+               for($i=0; $i<strlen($str); $i++)
+               {
+                       $c=substr($str, $i, 1);
+                       switch($c)
+                       {
+                               case ">":
+                                       $gt++;
+                                       break;
+                               case "<":
+                                       $lt++;
+                                       break;
+                               case "\"":
+                                       $qu++;
+                                       break;
+                               case "'":
+                                       $ap++;
+                                       break;
+                               case "&":
+                                       $amp++;
+                                       break;
+                               default:
+                                       break;
+                       }
+               }
+               return new xmlrpcresp(new xmlrpcval(array(
+                       "ctLeftAngleBrackets"  => new xmlrpcval($lt, "int"),
+                       "ctRightAngleBrackets" => new xmlrpcval($gt, "int"),
+                       "ctAmpersands"           => new xmlrpcval($amp, "int"),
+                       "ctApostrophes"         => new xmlrpcval($ap, "int"),
+                       "ctQuotes"                       => new xmlrpcval($qu, 
"int")),
+                       "struct"
+               ));
+       }
+
+       // trivial interop tests
+       // http://www.xmlrpc.com/stories/storyReader$1636
+
+       $i_echoString_sig=array(array($xmlrpcString, $xmlrpcString));
+       $i_echoString_doc="Echoes string.";
+
+       $i_echoStringArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
+       $i_echoStringArray_doc="Echoes string array.";
+
+       $i_echoInteger_sig=array(array($xmlrpcInt, $xmlrpcInt));
+       $i_echoInteger_doc="Echoes integer.";
+
+       $i_echoIntegerArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
+       $i_echoIntegerArray_doc="Echoes integer array.";
+
+       $i_echoFloat_sig=array(array($xmlrpcDouble, $xmlrpcDouble));
+       $i_echoFloat_doc="Echoes float.";
+
+       $i_echoFloatArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
+       $i_echoFloatArray_doc="Echoes float array.";
+
+       $i_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct));
+       $i_echoStruct_doc="Echoes struct.";
+
+       $i_echoStructArray_sig=array(array($xmlrpcArray, $xmlrpcArray));
+       $i_echoStructArray_doc="Echoes struct array.";
+
+       $i_echoValue_doc="Echoes any value back.";
+       $i_echoValue_sig=array(array($xmlrpcValue, $xmlrpcValue));
+
+       $i_echoBase64_sig=array(array($xmlrpcBase64, $xmlrpcBase64));
+       $i_echoBase64_doc="Echoes base64.";
+
+       $i_echoDate_sig=array(array($xmlrpcDateTime, $xmlrpcDateTime));
+       $i_echoDate_doc="Echoes dateTime.";
+
+       function i_echoParam($m)
+       {
+               $s=$m->getParam(0);
+               return new xmlrpcresp($s);
+       }
+
+       function i_echoString($m) { return i_echoParam($m); }
+       function i_echoInteger($m) { return i_echoParam($m); }
+       function i_echoFloat($m) { return i_echoParam($m); }
+       function i_echoStruct($m) { return i_echoParam($m); }
+       function i_echoStringArray($m) { return i_echoParam($m); }
+       function i_echoIntegerArray($m) { return i_echoParam($m); }
+       function i_echoFloatArray($m) { return i_echoParam($m); }
+       function i_echoStructArray($m) { return i_echoParam($m); }
+       function i_echoValue($m) { return i_echoParam($m); }
+       function i_echoBase64($m) { return i_echoParam($m); }
+       function i_echoDate($m) { return i_echoParam($m); }
+
+       $i_whichToolkit_sig=array(array($xmlrpcStruct));
+       $i_whichToolkit_doc="Returns a struct containing the following strings: 
toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem.";
+
+       function i_whichToolkit($m)
+       {
+               global $xmlrpcName, $xmlrpcVersion,$SERVER_SOFTWARE;
+               $ret=array(
+                       "toolkitDocsUrl" => "http://phpxmlrpc.sourceforge.net/";,
+                       "toolkitName" => $xmlrpcName,
+                       "toolkitVersion" => $xmlrpcVersion,
+                       "toolkitOperatingSystem" => isset ($SERVER_SOFTWARE) ? 
$SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE']
+               );
+               return new xmlrpcresp ( php_xmlrpc_encode($ret));
+       }
+
+       $o=new xmlrpc_server_methods_container;
+       $a=array(
+               "examples.getStateName" => array(
+                       "function" => "findstate",
+                       "signature" => $findstate_sig,
+                       "docstring" => $findstate_doc
+               ),
+               "examples.sortByAge" => array(
+                       "function" => "agesorter",
+                       "signature" => $agesorter_sig,
+                       "docstring" => $agesorter_doc
+               ),
+               "examples.addtwo" => array(
+                       "function" => "addtwo",
+                       "signature" => $addtwo_sig,
+                       "docstring" => $addtwo_doc
+               ),
+               "examples.addtwodouble" => array(
+                       "function" => "addtwodouble",
+                       "signature" => $addtwodouble_sig,
+                       "docstring" => $addtwodouble_doc
+               ),
+               "examples.stringecho" => array(
+                       "function" => "stringecho",
+                       "signature" => $stringecho_sig,
+                       "docstring" => $stringecho_doc
+               ),
+               "examples.echo" => array(
+                       "function" => "echoback",
+                       "signature" => $echoback_sig,
+                       "docstring" => $echoback_doc
+               ),
+               "examples.decode64" => array(
+                       "function" => "echosixtyfour",
+                       "signature" => $echosixtyfour_sig,
+                       "docstring" => $echosixtyfour_doc
+               ),
+               "examples.invertBooleans" => array(
+                       "function" => "bitflipper",
+                       "signature" => $bitflipper_sig,
+                       "docstring" => $bitflipper_doc
+               ),
+               "examples.generatePHPWarning" => array(
+                       "function" => array($o, "phpwarninggenerator")
+                       //'function' => 
'xmlrpc_server_methods_container::phpwarninggenerator'
+               ),
+               "examples.raiseException" => array(
+                       "function" => array($o, "exceptiongenerator")
+               ),
+               "examples.getallheaders" => array(
+                       "function" => 'getallheaders_xmlrpc',
+                       "signature" => $getallheaders_sig,
+                       "docstring" => $getallheaders_doc
+               ),
+               "examples.setcookies" => array(
+                       "function" => 'setcookies',
+                       "signature" => $setcookies_sig,
+                       "docstring" => $setcookies_doc
+               ),
+               "examples.getcookies" => array(
+                       "function" => 'getcookies',
+                       "signature" => $getcookies_sig,
+                       "docstring" => $getcookies_doc
+               ),
+               "mail.send" => array(
+                       "function" => "mail_send",
+                       "signature" => $mail_send_sig,
+                       "docstring" => $mail_send_doc
+               ),
+               "validator1.arrayOfStructsTest" => array(
+                       "function" => "v1_arrayOfStructs",
+                       "signature" => $v1_arrayOfStructs_sig,
+                       "docstring" => $v1_arrayOfStructs_doc
+               ),
+               "validator1.easyStructTest" => array(
+                       "function" => "v1_easyStruct",
+                       "signature" => $v1_easyStruct_sig,
+                       "docstring" => $v1_easyStruct_doc
+               ),
+               "validator1.echoStructTest" => array(
+                       "function" => "v1_echoStruct",
+                       "signature" => $v1_echoStruct_sig,
+                       "docstring" => $v1_echoStruct_doc
+               ),
+               "validator1.manyTypesTest" => array(
+                       "function" => "v1_manyTypes",
+                       "signature" => $v1_manyTypes_sig,
+                       "docstring" => $v1_manyTypes_doc
+               ),
+               "validator1.moderateSizeArrayCheck" => array(
+                       "function" => "v1_moderateSizeArrayCheck",
+                       "signature" => $v1_moderateSizeArrayCheck_sig,
+                       "docstring" => $v1_moderateSizeArrayCheck_doc
+               ),
+               "validator1.simpleStructReturnTest" => array(
+                       "function" => "v1_simpleStructReturn",
+                       "signature" => $v1_simpleStructReturn_sig,
+                       "docstring" => $v1_simpleStructReturn_doc
+               ),
+               "validator1.nestedStructTest" => array(
+                       "function" => "v1_nestedStruct",
+                       "signature" => $v1_nestedStruct_sig,
+                       "docstring" => $v1_nestedStruct_doc
+               ),
+               "validator1.countTheEntities" => array(
+                       "function" => "v1_countTheEntities",
+                       "signature" => $v1_countTheEntities_sig,
+                       "docstring" => $v1_countTheEntities_doc
+               ),
+               "interopEchoTests.echoString" => array(
+                       "function" => "i_echoString",
+                       "signature" => $i_echoString_sig,
+                       "docstring" => $i_echoString_doc
+               ),
+               "interopEchoTests.echoStringArray" => array(
+                       "function" => "i_echoStringArray",
+                       "signature" => $i_echoStringArray_sig,
+                       "docstring" => $i_echoStringArray_doc
+               ),
+               "interopEchoTests.echoInteger" => array(
+                       "function" => "i_echoInteger",
+                       "signature" => $i_echoInteger_sig,
+                       "docstring" => $i_echoInteger_doc
+               ),
+               "interopEchoTests.echoIntegerArray" => array(
+                       "function" => "i_echoIntegerArray",
+                       "signature" => $i_echoIntegerArray_sig,
+                       "docstring" => $i_echoIntegerArray_doc
+               ),
+               "interopEchoTests.echoFloat" => array(
+                       "function" => "i_echoFloat",
+                       "signature" => $i_echoFloat_sig,
+                       "docstring" => $i_echoFloat_doc
+               ),
+               "interopEchoTests.echoFloatArray" => array(
+                       "function" => "i_echoFloatArray",
+                       "signature" => $i_echoFloatArray_sig,
+                       "docstring" => $i_echoFloatArray_doc
+               ),
+               "interopEchoTests.echoStruct" => array(
+                       "function" => "i_echoStruct",
+                       "signature" => $i_echoStruct_sig,
+                       "docstring" => $i_echoStruct_doc
+               ),
+               "interopEchoTests.echoStructArray" => array(
+                       "function" => "i_echoStructArray",
+                       "signature" => $i_echoStructArray_sig,
+                       "docstring" => $i_echoStructArray_doc
+               ),
+               "interopEchoTests.echoValue" => array(
+                       "function" => "i_echoValue",
+                       "signature" => $i_echoValue_sig,
+                       "docstring" => $i_echoValue_doc
+               ),
+               "interopEchoTests.echoBase64" => array(
+                       "function" => "i_echoBase64",
+                       "signature" => $i_echoBase64_sig,
+                       "docstring" => $i_echoBase64_doc
+               ),
+               "interopEchoTests.echoDate" => array(
+                       "function" => "i_echoDate",
+                       "signature" => $i_echoDate_sig,
+                       "docstring" => $i_echoDate_doc
+               ),
+               "interopEchoTests.whichToolkit" => array(
+                       "function" => "i_whichToolkit",
+                       "signature" => $i_whichToolkit_sig,
+                       "docstring" => $i_whichToolkit_doc
+               )
+       );
+
+       if ($findstate2_sig)
+               $a['examples.php.getStateName'] = $findstate2_sig;
+
+       if ($findstate3_sig)
+               $a['examples.php2.getStateName'] = $findstate3_sig;
+
+       if ($findstate4_sig)
+               $a['examples.php3.getStateName'] = $findstate4_sig;
+
+    if ($findstate5_sig)
+        $a['examples.php4.getStateName'] = $findstate5_sig;
+
+       $s=new xmlrpc_server($a, false);
+       $s->setdebug(3);
+       $s->compress_response = true;
+
+       // out-of-band information: let the client manipulate the server 
operations.
+       // we do this to help the testsuite script: do not reproduce in 
production!
+       if (isset($_GET['RESPONSE_ENCODING']))
+               $s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
+       if (isset($_GET['EXCEPTION_HANDLING']))
+               $s->exception_handling = $_GET['EXCEPTION_HANDLING'];
+       $s->service();
+       // that should do all we need!
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/server/server.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/vardemo.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/vardemo.php          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/vardemo.php  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,93 @@
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<?php
+       include("../lib/xmlrpc.inc");
+
+       $f = new xmlrpcmsg('examples.getStateName');
+
+       print "<h3>Testing value serialization</h3>\n";
+
+       $v = new xmlrpcval(23, "int");
+       print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
+       $v = new xmlrpcval("What are you saying? >> << &&");
+       print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
+
+       $v = new xmlrpcval(array(
+               new xmlrpcval("ABCDEFHIJ"),
+               new xmlrpcval(1234, 'int'),
+               new xmlrpcval(1, 'boolean')),
+               "array"
+       );
+
+       print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
+
+       $v = new xmlrpcval(
+               array(
+                       "thearray" => new xmlrpcval(
+                               array(
+                                       new xmlrpcval("ABCDEFHIJ"),
+                                       new xmlrpcval(1234, 'int'),
+                                       new xmlrpcval(1, 'boolean'),
+                                       new xmlrpcval(0, 'boolean'),
+                                       new xmlrpcval(true, 'boolean'),
+                                       new xmlrpcval(false, 'boolean')
+                               ),
+                               "array"
+                       ),
+                       "theint" => new xmlrpcval(23, 'int'),
+                       "thestring" => new xmlrpcval("foobarwhizz"),
+                       "thestruct" => new xmlrpcval(
+                               array(
+                                       "one" => new xmlrpcval(1, 'int'),
+                                       "two" => new xmlrpcval(2, 'int')
+                               ),
+                               "struct"
+                       )
+               ),
+               "struct"
+       );
+
+       print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
+
+       $w = new xmlrpcval(array($v, new xmlrpcval("That was the struct!")), 
"array");
+
+       print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
+
+       $w = new xmlrpcval("Mary had a little lamb,
+Whose fleece was white as snow,
+And everywhere that Mary went
+the lamb was sure to go.
+
+Mary had a little lamb
+She tied it to a pylon
+Ten thousand volts went down its back
+And turned it into nylon", "base64"
+       );
+       print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
+       print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
+
+       $f->method('');
+       $f->addParam(new xmlrpcval("41", "int"));
+
+       print "<h3>Testing request serialization</h3>\n";
+       $op = $f->serialize();
+       print "<PRE>" . htmlentities($op) . "</PRE>";
+
+       print "<h3>Testing ISO date format</h3><pre>\n";
+
+       $t = time();
+       $date = iso8601_encode($t);
+       print "Now is $t --> $date\n";
+       print "Or in UTC, that is " . iso8601_encode($t, 1) . "\n";
+       $tb = iso8601_decode($date);
+       print "That is to say $date --> $tb\n";
+       print "Which comes out at " . iso8601_encode($tb) . "\n";
+       print "Which was the time in UTC at " . iso8601_decode($date, 1) . "\n";
+
+       print "</pre>\n";
+?>
+<hr/>
+<em>$Id$</em>
+</body>
+</html>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/demo/vardemo.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/Makefile
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/Makefile              
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/Makefile      
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,80 @@
+# $Id: Makefile,v 1.13 2008/03/07 13:01:55 ggiunta Exp $
+
+### USER EDITABLE VARS ###
+
+WEB=/var/www/xmlrpc/doc
+
+MKDIR=mkdir
+
+PHP=php
+
+FOP=fop
+
+PHPDOC=phpdoc
+
+
+#### DO NOT TOUCH FROM HERE ONWARDS ###
+
+install:
+       ${MKDIR} -p ${WEB}
+       cp *.html ${WEB}
+       cp *.css ${WEB}
+       cp *.gif ${WEB}
+       @echo HTML version of the manual has been installed to ${WEB}
+
+
+### the following targets are to be used for library development ###
+
+doc: out/index.html xmlrpc_php.pdf javadoc-out/index.html
+
+# tools currently used in building docs: php 5 with xsl extension, apache fop, 
phpdocumentor
+# alternatives include doxygen, jade, saxon, xsltproc etc...
+
+out/index.html xmlrpc_php.pdf: xmlrpc_php.xml
+       -${MKDIR} out
+# Jade cmd yet to be rebuilt, starting from xml file and putting output in 
./out dir, e.g.
+#      jade -t xml -d custom.dsl xmlrpc_php.xml
+#
+# convertdoc command for xmlmind xxe editor
+#      convertdoc docb.toHTML xmlrpc_php.xml -u out
+#
+# saxon + xerces xml parser + saxon extensions + xslthl: adds a little syntax 
highligting
+# (bold and italics only, no color) for php source examples...
+#      java \
+#      -classpath 
c:\programmi\saxon\saxon.jar\;c:\programmi\saxon\xslthl.jar\;c:\programmi\xerces\xercesImpl.jar\;C:\htdocs\xmlrpc_cvs\docbook-xsl\extensions\saxon65.jar
 \
+#      
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
 \
+#      
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
 \
+#      
-Dxslthl.config=file:///c:/htdocs/xmlrpc_cvs/docbook-xsl/highlighting/xslthl-config.xml
 \
+#      com.icl.saxon.StyleSheet -o xmlrpc_php.fo.xml xmlrpc_php.xml 
custom.fo.xsl use.extensions=1
+#
+#      custom php script that does the xslt magic
+       ${PHP} convert.php xmlrpc_php.xml custom.xsl out/
+#      post process html files to highlight php code samples
+       ${PHP} highlight.php out
+#      convert to fo and then to pdf using apache fop
+       ${PHP} convert.php xmlrpc_php.xml custom.fo.xsl xmlrpc_php.fo.xml
+       ${FOP} xmlrpc_php.fo.xml xmlrpc_php.pdf
+#      -rm xmlrpc_php.fo.xml
+
+javadoc-out/index.html: ../lib/xmlrpc.inc ../lib/xmlrpcs.inc 
../lib/xmlrpc_wrappers.inc
+# generate docs out of javadoc via doxygen
+#      doxygen phpxmlrpc.dox
+#
+#      generate docs out of javadoc via phpdocumentor
+       ${PHPDOC} -f 
../lib/xmlrpc.inc,../lib/xmlrpcs.inc,../lib/xmlrpc_wrappers.inc -t javadoc-out 
-ti PHP-XMLRPC -o HTML:frames:default -s
+
+dist: doc
+       ${MKDIR} -p ../xmlrpc-${VERSION}/doc
+       -cp out/*.html ../xmlrpc-${VERSION}/doc
+       -cp out/*.css ../xmlrpc-${VERSION}/doc
+       -cp out/*.gif ../xmlrpc-${VERSION}/doc
+       -cp out/*.pdf ../xmlrpc-${VERSION}/doc
+       cp xmlrpc_php.xml ../xmlrpc-${VERSION}/doc
+       cp xmlrpc_php.pdf ../xmlrpc-${VERSION}/doc
+       cp Makefile ../xmlrpc-${VERSION}/doc
+
+clean:
+       -rm -f out/*.html
+       -rm -rf javadoc-out
+       -rm xmlrpc_php.fo.xml
+       -rm xmlrpc_php.pdf

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apa.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apa.html              
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apa.html      
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix 
A. Integration with the PHP xmlrpc extension</title><link rel="stylesheet" 
href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL 
Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for 
PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link 
rel="prev" href="ch12s08.html" title="Does the library support using cookies / 
http sessions?" /><link rel="next" href="apb.html" title="Appendix B. 
Substitution of the PHP xmlrpc extension" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Appendix A. Integration with the PHP xmlrpc 
extension</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch12s08.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="apb.html">Next</a></td></tr></table><hr /></div><div class="appendix" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="integration"></a>Appendix A. Integration with the PHP xmlrpc 
extension</h2></div></div></div><p>To be documented more...</p><p>In short: for 
the fastest execution possible, you can enable the php
+    native xmlrpc extension, and use it in conjunction with phpxmlrpc. The
+    following code snippet gives an example of such integration</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB"></span><span style="color: 
#FF8000">/***&nbsp;client&nbsp;side&nbsp;***/<br /></span><span style="color: 
#0000BB">$c&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span 
style="color: 
#DD0000">'http://phpxmlrpc.sourceforge.net/server.php'</span><span 
style="color: #007700">);<br /><br /></span><span style="color: 
#FF8000">//&nbsp;tell&nbsp;the&nbsp;client&nbsp;to&nbsp;return&nbsp;raw&nbsp;xml&nbsp;as&nbsp;response&nbsp;value<br
 /></span><span style="color: #0000BB">$c</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">return_type&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#DD0000">'xml'</span><span style="color: #007700">;<br /><br /></span><span 
style="color: 
#FF8000">//&nbsp;let&nbsp;the&nbsp;native&nbsp;xmlrpc&nbsp;extension&nbsp;take&nbsp;care&nbsp;of&nbsp;encoding&nbsp;request&nbsp;parameters<br
 /></span><span style="color: #0000BB">$r&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$c</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">send</span><span style="color: #007700">(</span><span style="color: 
#0000BB">xmlrpc_encode_request</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'examples.getStateName'</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">$_POST</span><span 
style="color: #007700">[</span><span style="color: 
#DD0000">'stateno'</span><span style="color: #007700">]));<br /><br 
/>if&nbsp;(</span><span style="color: #0000BB">$r</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span 
style="color: #007700">())<br />&nbsp;&nbsp;</span><span style="color: 
#FF8000">//&nbsp;HTTP&nbsp;transport&nbsp;error<br />&nbsp;&nbsp;</span><span 
style="color: #007700">echo&nbsp;</span><span style="color: 
#DD0000">'Got&nbsp;error&nbsp;'</span><span style="color: 
#007700">.</span><span style="color: #0000BB">$r</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span 
style="color: #007700">();<br />else<br />{<br />&nbsp;&nbsp;</span><span 
style="color: 
#FF8000">//&nbsp;HTTP&nbsp;request&nbsp;OK,&nbsp;but&nbsp;XML&nbsp;returned&nbsp;from&nbsp;server&nbsp;not&nbsp;parsed&nbsp;yet<br
 />&nbsp;&nbsp;</span><span style="color: #0000BB">$v&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#0000BB">xmlrpc_decode</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span 
style="color: #0000BB">value</span><span style="color: #007700">());<br 
/>&nbsp;&nbsp;</span><span style="color: 
#FF8000">//&nbsp;check&nbsp;if&nbsp;we&nbsp;got&nbsp;a&nbsp;valid&nbsp;xmlrpc&nbsp;response&nbsp;from&nbsp;server<br
 />&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span 
style="color: #0000BB">$v&nbsp;</span><span style="color: 
#007700">===&nbsp;</span><span style="color: #0000BB">NULL</span><span 
style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span 
style="color: #DD0000">'Got&nbsp;invalid&nbsp;response'</span><span 
style="color: #007700">;<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;</span><span 
style="color: 
#FF8000">//&nbsp;check&nbsp;if&nbsp;server&nbsp;sent&nbsp;a&nbsp;fault&nbsp;response<br
 />&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span 
style="color: #0000BB">xmlrpc_is_fault</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$v</span><span style="color: 
#007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">'Got&nbsp;xmlrpc&nbsp;fault&nbsp;'</span><span style="color: 
#007700">.</span><span style="color: #0000BB">$v</span><span style="color: 
#007700">[</span><span style="color: #DD0000">'faultCode'</span><span 
style="color: #007700">];<br />&nbsp;&nbsp;else<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;echo</span><span style="color: 
#DD0000">'Got&nbsp;response:&nbsp;'</span><span style="color: 
#007700">.</span><span style="color: #0000BB">htmlentities</span><span 
style="color: #007700">(</span><span style="color: #0000BB">$v</span><span 
style="color: #007700">);<br />}</span>
+</span>
+</code></pre></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch12s08.html">Prev</a> </td><td width="20%" align="center"> </td><td 
width="40%" align="right"> <a accesskey="n" 
href="apb.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Does the library support using cookies / http sessions? </td><td 
width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td 
width="40%" align="right" valign="top"> Appendix B. Substitution of the PHP 
xmlrpc extension</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apb.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apb.html              
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apb.html      
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix 
B. Substitution of the PHP xmlrpc extension</title><link rel="stylesheet" 
href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL 
Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for 
PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link 
rel="prev" href="apa.html" title="Appendix A. Integration with the PHP xmlrpc 
extension" /><link rel="next" href="apc.html" title="Appendix C. 'Enough of 
xmlrpcvals!': new style library usage" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Appendix B. Substitution of the PHP xmlrpc 
extension</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="apa.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="apc.html">Next</a></td></tr></table><hr /></div><div class="appendix" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="substitution"></a>Appendix B. Substitution of the PHP xmlrpc 
extension</h2></div></div></div><p>Yet another interesting situation is when 
you are using a ready-made
+    php application, that provides support for the XMLRPC protocol via the
+    native php xmlrpc extension, but the extension is not available on your
+    php install (e.g. because of shared hosting constraints).</p><p>Since 
version 2.1, the PHP-XMLRPC library provides a compatibility
+    layer that aims to be 100% compliant with the xmlrpc extension API. This
+    means that any code written to run on the extension should obtain the
+    exact same results, albeit using more resources and a longer processing
+    time, using the PHP-XMLRPC library and the extension compatibility module.
+    The module is part of the EXTRAS package, available as a separate download
+    from the sourceforge.net website, since version 0.2</p></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="apa.html">Prev</a> </td><td 
width="20%" align="center"> </td><td width="40%" align="right"> <a 
accesskey="n" href="apc.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">Appendix A. Integration with the PHP xmlrpc extension 
</td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
Appendix C. 'Enough of xmlrpcvals!': new style library 
usage</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apc.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apc.html              
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apc.html      
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix 
C. 'Enough of xmlrpcvals!': new style library usage</title><link 
rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" 
content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" 
title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for 
PHP" /><link rel="prev" href="apb.html" title="Appendix B. Substitution of the 
PHP xmlrpc extension" /><link rel="next" href="apd.html" title="Appendix D. 
Usage of the debugger" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" 
align="center">Appendix C. 'Enough of xmlrpcvals!': new style library 
usage</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="apb.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="apd.html">Next</a></td></tr></table><hr /></div><div class="appendix" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="enough"></a>Appendix C. 'Enough of xmlrpcvals!': new style library 
usage</h2></div></div></div><p>To be documented...</p><p>In the meantime, see 
docs about xmlrpc_client::return_type and
+    xmlrpc_server::functions_parameters_types, as well as php_xmlrpc_encode,
+    php_xmlrpc_decode and php_xmlrpc_decode_xml</p></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="apb.html">Prev</a> </td><td 
width="20%" align="center"> </td><td width="40%" align="right"> <a 
accesskey="n" href="apd.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">Appendix B. Substitution of the PHP xmlrpc extension 
</td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
Appendix D. Usage of the debugger</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apd.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apd.html              
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/apd.html      
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix 
D. Usage of the debugger</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="apc.html" title="Appendix C. 'Enough of xmlrpcvals!': new style library 
usage" /></head><body><div class="navheader"><table width="100%" 
summary="Navigation header"><tr><th colspan="3" align="center">Appendix D. 
Usage of the debugger</th></tr><tr><td width="20%" align="left"><a 
accesskey="p" href="apc.html">Prev</a> </td><th width="60%" align="center"> 
</th><td width="20%" align="right"> </td></tr></table><hr /></div><div 
class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title"><a id="debugger"></a>Appendix D. Usage of the 
debugger</h2></div></div></div><p>A webservice debugger is included in the 
library to help during
+    development and testing.</p><p>The interface should be self-explicative 
enough to need little
+    documentation.</p><div align="center"><img src="debugger.gif" 
align="middle" /></div><p>The most useful feature of the debugger is without 
doubt the "Show
+    debug info" option. It allows to have a screen dump of the complete http
+    communication between client and server, including the http headers as
+    well as the request and response payloads, and is invaluable when
+    troubleshooting problems with charset encoding, authentication or http
+    compression.</p><p>The debugger can take advantage of the JSONRPC library 
extension, to
+    allow debugging of JSON-RPC webservices, and of the JS-XMLRPC library
+    visual editor to allow easy mouse-driven construction of the payload for
+    remote methods. Both components have to be downloaded separately from the
+    sourceforge.net web pages and copied to the debugger directory to enable
+    the extra functionality:</p><div class="itemizedlist"><ul 
type="disc"><li><p>to enable jsonrpc functionality, download the PHP-XMLRPC
+          EXTRAS package, and copy the file <code 
class="filename">jsonrpc.inc</code>
+          either to the same directory as the debugger or somewhere in your
+          php include path</p></li></ul></div><div class="itemizedlist"><ul 
type="disc"><li><p>to enable the visual value editing dialog, download the
+          JS-XMLRPC library, and copy somewhere in the web root files
+          <code class="filename">visualeditor.php</code>,
+          <code class="filename">visualeditor.css</code> and the folders
+          <code class="filename">yui</code> and <code 
class="filename">img</code>. Then edit the
+          debugger file <code class="filename">controller.php</code> and set
+          appropriately the variable <code 
class="varname">$editorpath</code>.</p></li></ul></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="apc.html">Prev</a> </td><td 
width="20%" align="center"> </td><td width="40%" align="right"> 
</td></tr><tr><td width="40%" align="left" valign="top">Appendix C. 'Enough of 
xmlrpcvals!': new style library usage </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> </td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch01.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch01.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch01.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
1. Introduction</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="index.html" 
title="XML-RPC for PHP" /><link rel="next" href="ch02.html" title="Chapter 2. 
What's new" /></head><body><div class="navheader"><table width="100%" 
summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. 
Introduction</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="index.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="ch02.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="introduction"></a>Chapter 1. Introduction</h2></div></div></div><div 
class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a 
href="ch01.html#id930303">Acknowledgements</a></span></dt></dl></div><p>XML-RPC 
is a format devised by <a class="ulink" href="http://www.userland.com/"; 
target="_top">Userland Software</a> for achieving
+    remote procedure call via XML using HTTP as the transport. XML-RPC has its
+    own web site, <a class="ulink" href="http://www.xmlrpc.com/"; 
target="_top">www.xmlrpc.com</a></p><p>This collection of PHP classes provides 
a framework for writing
+    XML-RPC clients and servers in PHP.</p><p>Main goals of the project are 
ease of use, flexibility and
+    completeness.</p><p>The original author is Edd Dumbill of <a class="ulink" 
href="http://usefulinc.com/"; target="_top">Useful Information Company</a>. As 
of the
+    1.0 stable release, the project was opened to wider involvement and moved
+    to <a class="ulink" href="http://phpxmlrpc.sourceforge.net/"; 
target="_top">SourceForge</a>.</p><p>A list of XML-RPC implementations for 
other languages such as Perl
+    and Python can be found on the <a class="ulink" 
href="http://www.xmlrpc.com/"; target="_top">www.xmlrpc.com</a> site.</p><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a 
id="id930303"></a>Acknowledgements</h2></div></div></div><p>Daniel E. 
Baumann</p><p>James Bercegay</p><p>Leon Blackwell</p><p>Stephane 
Bortzmeyer</p><p>Daniel Convissor</p><p>Geoffrey T. Dairiki</p><p>Stefan 
Esser</p><p>James Flemer</p><p>Ernst de Haan</p><p>Tom Knight</p><p>Axel 
Kollmorgen</p><p>Peter Kocks</p><p>Daniel Krippner</p><p>S. Kuip</p><p>A. 
Lambert</p><p>Frederic Lecointre</p><p>Dan Libby</p><p>Arnaud 
Limbourg</p><p>Ernest MacDougal Campbell III</p><p>Lukasz Mach</p><p>Kjartan 
Mannes</p><p>Ben Margolin</p><p>Nicolay Mausz</p><p>Justin Miller</p><p>Jan 
Pfeifer</p><p>Giancarlo Pinerolo</p><p>Peter Russel</p><p>Jean-Jacques 
Sarton</p><p>Viliam Simko</p><p>Idan Sofer</p><p>Douglas Squirrel</p><p>Heiko 
Stübner</p><p>Anatoly Techtonik</p><p>Tommaso Trani</p><p>Eric van der 
Vlist</p><p>Christian Wenz</p><p>Jim Winstead</p><p>Przemyslaw 
Wroblewski</p><p>Bruno Zanetti Melotti</p></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td 
width="20%" align="center"> </td><td width="40%" align="right"> <a 
accesskey="n" href="ch02.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">XML-RPC for PHP </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Chapter 2. What's 
new</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
2. What's new</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch01.html" 
title="Chapter 1. Introduction" /><link rel="next" href="ch02s02.html" 
title="2.2.2" /></head><body><div class="navheader"><table width="100%" 
summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. 
What's new</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch01.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="ch02s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="news"></a>Chapter 2. What's new</h2></div></div></div><div 
class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a 
href="ch02.html#id930465">3.0.0 beta</a></span></dt><dt><span class="sect1"><a 
href="ch02s02.html">2.2.2</a></span></dt><dt><span class="sect1"><a 
href="ch02s03.html">2.2.1</a></span></dt><dt><span class="sect1"><a 
href="ch02s04.html">2.2</a></span></dt><dt><span class="sect1"><a 
href="ch02s05.html">2.1</a></span></dt><dt><span class="sect1"><a 
href="ch02s06.html">2.0 final</a></span></dt><dt><span class="sect1"><a 
href="ch02s07.html">2.0 Release candidate 3</a></span></dt><dt><span 
class="sect1"><a href="ch02s08.html">2.0 Release candidate 
2</a></span></dt><dt><span class="sect1"><a href="ch02s09.html">2.0 Release 
candidate 1</a></span></dt></dl></div><p><span 
class="emphasis"><em>Note:</em></span> not all items the following list have
+    (yet) been fully documented, and some might not be present in any other
+    chapter in the manual. To find a more detailed description of new
+    functions and methods please take a look at the source code of the
+    library, which is quite thoroughly commented in javadoc-like form.</p><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a id="id930465"></a>3.0.0 
beta</h2></div></div></div><p>This is the first release of the library to only 
support PHP 5.
+      Some legacy code has been removed, and support for features such as
+      exceptions and dateTime objects introduced.</p><p>The "beta" tag is 
meant to indicate the fact that the refactoring
+      has been more widespread than in precedent releases and that more
+      changes are likely to be introduced with time - the library is still
+      considered to be production quality.</p><div class="itemizedlist"><ul 
type="disc"><li><p>improved: removed all usage of php functions deprecated in
+            php 5.3, usage of assign-by-ref when creating new objects
+            etc...</p></li><li><p>improved: add support for the 
&lt;ex:nil/&gt; tag used by
+            the apache library, both in input and 
output</p></li><li><p>improved: add support for <code 
class="classname">dateTime</code>
+            objects in both in <code class="function">php_xmlrpc_encode</code> 
and as
+            parameter for constructor of
+            <code class="classname">xmlrpcval</code></p></li><li><p>improved: 
add support for timestamps as parameter for
+            constructor of <code 
class="classname">xmlrpcval</code></p></li><li><p>improved: add option 
'dates_as_objects' to
+            <code class="function">php_xmlrpc_decode</code> to return
+            <code class="classname">dateTime</code> objects for xmlrpc
+            datetimes</p></li><li><p>improved: add new method
+            <code class="methodname">SetCurlOptions</code> to
+            <code class="classname">xmrlpc_client</code> to allow extra 
flexibility in
+            tweaking http config, such as explicitly binding to an ip
+            address</p></li><li><p>improved: add new method
+            <code class="methodname">SetUserAgent</code> to
+            <code class="classname">xmrlpc_client</code> to to allow having 
different
+            user-agent http headers</p></li><li><p>improved: add a new member 
variable in server class to allow
+            fine-tuning of the encoding of returned values when the server is
+            in 'phpvals' mode</p></li><li><p>improved: allow servers in 
'xmlrpcvals' mode to also
+            register plain php functions by defining them in the dispatch map
+            with an added option</p></li><li><p>improved: catch exceptions 
thrown during execution of php
+            functions exposed as methods by the server</p></li><li><p>fixed: 
bad encoding if same object is encoded twice using
+            php_xmlrpc_encode</p></li></ul></div></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch01.html">Prev</a> </td><td 
width="20%" align="center"> </td><td width="40%" align="right"> <a 
accesskey="n" href="ch02s02.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">Chapter 1. Introduction </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> 2.2.2</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s02.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s02.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>2.2.2</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" 
href="ch02.html" title="Chapter 2. What's new" /><link rel="next" 
href="ch02s03.html" title="2.2.1" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" 
align="center">2.2.2</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's 
new</th><td width="20%" align="right"> <a accesskey="n" 
href="ch02s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id930754"></a>2.2.2</h2></div></div></div><p><span 
class="emphasis"><em>Note:</em></span> this might the last release of the
+      library that will support PHP 4. Future releases (if any) should target
+      php 5.0 as minimum supported version.</p><div class="itemizedlist"><ul 
type="disc"><li><p>fixed: encoding of utf-8 characters outside of the BMP
+            plane</p></li><li><p>fixed: character set declarations surrounded 
by double
+            quotes were not recognized in http headers</p></li><li><p>fixed: 
be more tolerant in detection of charset in http
+            headers</p></li><li><p>fixed: fix detection of 
zlib.output_compression</p></li><li><p>fixed: use feof() to test if socket 
connections are to be
+            closed instead of the number of bytes read (rare bug when
+            communicating with some servers)</p></li><li><p>fixed: format 
floating point values using the correct
+            decimal separator even when php locale is set to one that uses
+            comma</p></li><li><p>fixed: improve robustness of the debugger 
when parsing weird
+            results from non-compliant servers</p></li><li><p>php warning when 
receiving 'false' in a bool value</p></li><li><p>improved: allow the add_to_map 
server method to add docs for
+            single params too</p></li><li><p>improved: added the possibility 
to wrap for exposure as
+            xmlrpc methods plain php class methods, object methods and even
+            whole classes</p></li></ul></div></div><div class="navfooter"><hr 
/><table width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">Chapter 2. What's new </td><td 
width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td 
width="40%" align="right" valign="top"> 
2.2.1</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s03.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s03.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s03.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>2.2.1</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" 
href="ch02s02.html" title="2.2.2" /><link rel="next" href="ch02s04.html" 
title="2.2" /></head><body><div class="navheader"><table width="100%" 
summary="Navigation header"><tr><th colspan="3" 
align="center">2.2.1</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch02s02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
What's new</th><td width="20%" align="right"> <a accesskey="n" 
href="ch02s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id930844"></a>2.2.1</h2></div></div></div><div 
class="itemizedlist"><ul type="disc"><li><p>fixed: work aroung bug in php 5.2.2 
which broke support of
+          HTTP_RAW_POST_DATA</p></li><li><p>fixed: is_dir parameter of 
setCaCertificate() method is
+          reversed</p></li><li><p>fixed: a php warning in xmlrpc_client 
creator method</p></li><li><p>fixed: parsing of '1e+1' as valid 
float</p></li><li><p>fixed: allow errorlevel 3 to work when prev. error handler 
was
+          a static method</p></li><li><p>fixed: usage of client::setcookie() 
for multiple cookies in
+          non-ssl mode</p></li><li><p>improved: support for CP1252 charset is 
not part or the
+          library but almost possible</p></li><li><p>improved: more info when 
curl is enabled and debug mode is
+          on</p></li></ul></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch02s02.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">2.2.2 </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> 2.2</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s04.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s04.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s04.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>2.2</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" 
href="ch02s03.html" title="2.2.1" /><link rel="next" href="ch02s05.html" 
title="2.1" /></head><body><div class="navheader"><table width="100%" 
summary="Navigation header"><tr><th colspan="3" 
align="center">2.2</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch02s03.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
What's new</th><td width="20%" align="right"> <a accesskey="n" 
href="ch02s05.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id930912"></a>2.2</h2></div></div></div><div 
class="itemizedlist"><ul type="disc"><li><p>fixed: debugger errors on php 
installs with magic_quotes_gpc
+          on</p></li><li><p>fixed: support for https connections via 
proxy</p></li><li><p>fixed: wrap_xmlrpc_method() generated code failed to 
properly
+          encode php objects</p></li><li><p>improved: slightly faster encoding 
of data which is internally
+          UTF-8</p></li><li><p>improved: debugger always generates a 'null' id 
for jsonrpc if
+          user omits it</p></li><li><p>new: debugger can take advantage of a 
graphical value builder
+          (it has to be downloaded separately, as part of jsxmlrpc package.
+          See Appendix D for more details)</p></li><li><p>new: support for the 
&lt;NIL/&gt; xmlrpc extension. see below
+          for more details</p></li><li><p>new: server support for the 
system.getCapabilities xmlrpc
+          extension</p></li><li><p>new: <code class="function"><a class="link" 
href="ch09.html#wrap_xmlrpc_method">wrap_xmlrpc_method()</a></code>
+          accepts two new options: debug and 
return_on_fault</p></li></ul></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch02s03.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch02s05.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">2.2.1 </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> 2.1</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s05.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s05.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s05.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>2.1</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" 
href="ch02s04.html" title="2.2" /><link rel="next" href="ch02s06.html" 
title="2.0 final" /></head><body><div class="navheader"><table width="100%" 
summary="Navigation header"><tr><th colspan="3" 
align="center">2.1</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch02s04.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
What's new</th><td width="20%" align="right"> <a accesskey="n" 
href="ch02s06.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id931019"></a>2.1</h2></div></div></div><div 
class="itemizedlist"><ul type="disc"><li><p>The <code 
class="function">wrap_php_function</code> and
+            <code class="function">wrap_xmlrpc_method</code> functions have 
been moved
+            out of the base library file <code 
class="filename">xmlrpc.inc</code> into
+            a file of their own: <code 
class="filename">xmlrpc_wrappers.inc</code>. You
+            will have to include() / require() it in your scripts if you have
+            been using those functions. For increased security, the automatic
+            rebuilding of php object instances out of received xmlrpc structs
+            in <code class="function">wrap_xmlrpc_method()</code> has been 
disabled
+            (but it can be optionally re-enabled). Both
+            <code class="function">wrap_php_function()</code> and
+            <code class="function">wrap_xmlrpc_method()</code> functions 
accept many
+            more options to fine tune their behaviour, including one to return
+            the php code to be saved and later used as standalone php
+            script</p></li><li><p>The constructor of xmlrpcval() values has 
seen some internal
+            changes, and it will not throw a php warning anymore when invoked
+            using an unknown xmlrpc type: the error will only be written to
+            php error log. Also <code class="code">new xmlrpcval('true', 
'boolean')</code>
+            is not supported anymore</p></li><li><p>The new function
+            <code class="function">php_xmlrpc_decode_xml()</code> will take 
the xml
+            representation of either an xmlrpc request, response or single
+            value and return the corresponding php-xmlrpc object
+            instance</p></li><li><p>A new function <code 
class="function">wrap_xmlrpc_server()</code>has
+            been added, to wrap all (or some) of the methods exposed by a
+            remote xmlrpc server into a php class</p></li><li><p>A new file 
has been added:
+            <code class="filename">verify_compat.php</code>, to help users 
diagnose the
+            level of compliance of their php installation with the
+            library</p></li><li><p>Restored compatibility with php 4.0.5 (for 
those poor souls
+            still stuck on it)</p></li><li><p>Method <code 
class="methodname">xmlrpc_server-&gt;service()</code>
+            now returns a value: either the response payload or xmlrpcresp
+            object instance</p></li><li><p>Method
+            <code class="methodname">xmlrpc_server-&gt;add_to_map()</code> now
+            accepts xmlrpc methods with no param 
definitions</p></li><li><p>Documentation for single parameters of exposed 
methods can
+            be added to the dispatch map (and turned into html docs in
+            conjunction with a future release of the 'extras' 
package)</p></li><li><p>Full response payload is saved into xmlrpcresp object 
for
+            further debugging</p></li><li><p>The debugger can now generate 
code that wraps a remote
+            method into a php function (works for jsonrpc, too); it also has
+            better support for being activated via a single GET call (e.g. for
+            integration into other tools)</p></li><li><p>Stricter parsing of 
incoming xmlrpc messages: two more
+            invalid cases are now detected (double <code 
class="literal">data</code>
+            element inside <code class="literal">array</code> and
+            <code class="literal">struct</code>/<code 
class="literal">array</code> after scalar
+            inside <code class="literal">value</code> 
element)</p></li><li><p>More logging of errors in a lot of 
situations</p></li><li><p>Javadoc documentation of lib files (almost) 
complete</p></li><li><p>Many performance tweaks and code cleanups, plus the 
usual
+            crop of bugs fixed (see NEWS file for complete list of
+            bugs)</p></li><li><p>Lib internals have been modified to provide 
better support
+            for grafting extra functionality on top of it. Stay tuned for
+            future releases of the EXTRAS package (or go read Appendix
+            B)...</p></li></ul></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch02s04.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch02s06.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">2.2 </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> 2.0 final</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s06.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s06.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s06.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.0 
final</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta 
name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" 
href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" 
title="Chapter 2. What's new" /><link rel="prev" href="ch02s05.html" 
title="2.1" /><link rel="next" href="ch02s07.html" title="2.0 Release candidate 
3" /></head><body><div class="navheader"><table width="100%" 
summary="Navigation header"><tr><th colspan="3" align="center">2.0 
final</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch02s05.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
What's new</th><td width="20%" align="right"> <a accesskey="n" 
href="ch02s07.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id931211"></a>2.0 final</h2></div></div></div><div 
class="itemizedlist"><ul type="disc"><li><p>Added to the client class the 
possibility to use Digest and
+            NTLM authentication methods (when using the CURL library) for
+            connecting to servers and NTLM for connecting to 
proxies</p></li><li><p>Added to the client class the possibility to specify
+            alternate certificate files/directories for authenticating the
+            peer with when using HTTPS communication</p></li><li><p>Reviewed 
all examples and added a new demo file, containing
+            a proxy to forward xmlrpc requests to other servers (useful e.g.
+            for ajax coding)</p></li><li><p>The debugger has been upgraded to 
reflect the new client
+            capabilities</p></li><li><p>All known bugs have been squashed, and 
the lib is more
+            tolerant than ever of commonly-found 
mistakes</p></li></ul></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch02s05.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch02s07.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">2.1 </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> 2.0 Release candidate 
3</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s07.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s07.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s07.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.0 
Release candidate 3</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" 
href="ch02s06.html" title="2.0 final" /><link rel="next" href="ch02s08.html" 
title="2.0 Release candidate 2" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.0 
Release candidate 3</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch02s06.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
What's new</th><td width="20%" align="right"> <a accesskey="n" 
href="ch02s08.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id931316"></a>2.0 Release candidate 
3</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>Added 
to server class the property
+            <span class="property">functions_parameters_type</span>, that 
allows the
+            server to register plain php functions as xmlrpc methods (i.e.
+            functions that do not take an xmlrpcmsg object as unique
+            param)</p></li><li><p>let server and client objects serialize 
calls using a
+            specified character set encoding for the produced xml instead of
+            US-ASCII (ISO-8859-1 and UTF-8 supported)</p></li><li><p>let 
php_xmlrpc_decode accept xmlrpcmsg objects as valid
+            input</p></li><li><p>'class::method' syntax is now accepted in the 
server
+            dispatch map</p></li><li><p><code 
class="function">xmlrpc_clent::SetDebug()</code> accepts
+            integer values instead of a boolean value, with debugging level 2
+            adding to the information printed to screen the complete client
+            request</p></li></ul></div></div><div class="navfooter"><hr 
/><table width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"><a accesskey="p" href="ch02s06.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch02s08.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">2.0 final </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> 2.0 Release candidate 
2</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s08.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s08.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s08.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.0 
Release candidate 2</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" 
href="ch02s07.html" title="2.0 Release candidate 3" /><link rel="next" 
href="ch02s09.html" title="2.0 Release candidate 1" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">2.0 Release candidate 2</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><th width="60%" 
align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a 
accesskey="n" href="ch02s09.html">Next</a></td></tr></table><hr /></div><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a id="id931370"></a>2.0 Release candidate 
2</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>Added 
a new property of the client object:
+            <code class="code">xmlrpc_client-&gt;return_type</code>, 
indicating whether
+            calls to the send() method will return xmlrpcresp objects whose
+            value() is an xmlrpcval object, a php value (automatically
+            decoded) or the raw xml received from the 
server.</p></li><li><p>Added in the extras dir. two new library file:
+            <code class="filename">jsonrpc.inc</code> and
+            <code class="filename">jsonrpcs.inc</code> containing new classes 
that
+            implement support for the json-rpc protocol (alpha quality
+            code)</p></li><li><p>Added a new client method: <code 
class="code">setKey($key,
+            $keypass)</code> to be used in HTTPS 
connections</p></li><li><p>Added a new file containing some benchmarks in the 
testsuite
+            directory</p></li></ul></div></div><div class="navfooter"><hr 
/><table width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch02s09.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">2.0 Release candidate 3 </td><td 
width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td 
width="40%" align="right" valign="top"> 2.0 Release candidate 
1</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s09.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s09.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch02s09.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.0 
Release candidate 1</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" 
href="ch02s08.html" title="2.0 Release candidate 2" /><link rel="next" 
href="ch03.html" title="Chapter 3. System Requirements" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">2.0 Release candidate 1</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch02s08.html">Prev</a> </td><th width="60%" 
align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a 
accesskey="n" href="ch03.html">Next</a></td></tr></table><hr /></div><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a id="id931426"></a>2.0 Release candidate 
1</h2></div></div></div><div class="itemizedlist"><ul 
type="disc"><li><p>Support for HTTP proxies (new method:
+          <code 
class="code">xmlrpc_client::setProxy()</code>)</p></li><li><p>Support HTTP 
compression of both requests and responses.
+          Clients can specify what kind of compression they accept for
+          responses between deflate/gzip/any, and whether to compress the
+          requests. Servers by default compress responses to clients that
+          explicitly declare support for compression (new methods:
+          <code class="code">xmlrpc_client::setAcceptedCompression()</code>,
+          <code class="code">xmlrpc_client::setRequestCompression()</code>). 
Note that the
+          ZLIB php extension needs to be enabled in PHP to support
+          compression.</p></li><li><p>Implement HTTP 1.1 connections, but only 
if CURL is enabled
+          (added an extra parameter to
+          <code class="code">xmlrpc_client::xmlrpc_client</code> to set the 
desired HTTP
+          protocol at creation time and a new supported value for the last
+          parameter of <code class="code">xmlrpc_client::send</code>, which 
now can be
+          safely omitted if it has been specified at creation time)</p><p>With 
PHP versions greater than 4.3.8 keep-alives are enabled
+          by default for HTTP 1.1 connections. This should yield faster
+          execution times when making multiple calls in sequence to the same
+          xml-rpc server from a single client.</p></li><li><p>Introduce 
support for cookies. Cookies to be sent to the
+          server with a request can be set using
+          <code class="code">xmlrpc_client::setCookie()</code>, while cookies 
received from
+          the server are found in <code 
class="code">xmlrpcresp::cookies()</code>. It is
+          left to the user to check for validity of received cookies and
+          decide whether they apply to successive calls or 
not.</p></li><li><p>Better support for detecting different character set 
encodings
+          of xml-rpc requests and responses: both client and server objects
+          will correctly detect the charset encoding of received xml, and use
+          an appropriate xml parser.</p><p>Supported encodings are US-ASCII, 
UTF-8 and ISO-8859-1.</p></li><li><p>Added one new xmlrpcmsg constructor 
syntax, allowing usage of
+          a single string with the complete URL of the target 
server</p></li><li><p>Convert xml-rpc boolean values into native php values 
instead
+          of 0 and 1</p></li><li><p>Force the <code 
class="code">php_xmlrpc_encode</code> function to properly
+          encode numerically indexed php arrays into xml-rpc arrays
+          (numerically indexed php arrays always start with a key of 0 and
+          increment keys by values of 1)</p></li><li><p>Prevent the <code 
class="code">php_xmlrpc_encode</code> function from
+          further re-encoding any objects of class <code 
class="code">xmlrpcval</code> that
+          are passed to it. This allows to call the function with arguments
+          consisting of mixed php values / xmlrpcval 
objects.</p></li><li><p>Allow a server to NOT respond to system.* method calls
+          (setting the <code class="code">$server-&gt;allow_system_funcs</code>
+          property).</p></li><li><p>Implement a new xmlrpcval method to 
determine if a value of
+          type struct has a member of a given name without having to loop
+          trough all members: <code 
class="code">xmlrpcval::structMemExists()</code></p></li><li><p>Expand methods 
<code class="code">xmlrpcval::addArray</code>,
+          <code class="code">addScalar</code> and <code 
class="code">addStruct</code> allowing extra php
+          values to be added to xmlrpcval objects already 
formed.</p></li><li><p>Let the <code class="code">xmlrpc_client::send</code> 
method accept an XML
+          string for sending instead of an xmlrpcmsg object, to facilitate
+          debugging and integration with the php native xmlrpc
+          extension</p></li><li><p>Extend the <code 
class="code">php_xmlrpc_encode</code> and
+          <code class="code">php_xmlrpc_decode</code> functions to allow 
serialization and
+          rebuilding of PHP objects. To successfully rebuild a serialized
+          object, the object class must be defined in the deserializing end of
+          the transfer. Note that object members of type resource will be
+          deserialized as NULL values.</p><p>Note that his has been 
implemented adding a "php_class"
+          attribute to xml representation of xmlrpcval of STRUCT type, which,
+          strictly speaking, breaks the xml-rpc spec. Other xmlrpc
+          implementations are supposed to ignore such an attribute (unless
+          they implement a brain-dead custom xml parser...), so it should be
+          safe enabling it in heterogeneous environments. The activation of
+          this feature is done by usage of an option passed as second
+          parameter to both <code class="code">php_xmlrpc_encode</code> and
+          <code class="code">php_xmlrpc_decode</code>.</p></li><li><p>Extend 
the <code class="code">php_xmlrpc_encode</code> function to allow
+          automatic serialization of iso8601-conforming php strings as
+          datetime.iso8601 xmlrpcvals, by usage of an optional
+          parameter</p></li><li><p>Added an automatic stub code generator for 
converting xmlrpc
+          methods to php functions and vice-versa.</p><p>This is done via two 
new functions:
+          <code class="code">wrap_php_function</code> and <code 
class="code">wrap_xmlrpc_method</code>,
+          and has many caveats, with php being a typeless language and
+          all...</p><p>With PHP versions lesser than 5.0.3 wrapping of php 
functions
+          into xmlrpc methods is not supported yet.</p></li><li><p>Allow 
object methods to be used in server dispatch map</p></li><li><p>Added a 
complete debugger solution, in the
+          <code class="filename">debugger</code> folder</p></li><li><p>Added 
configurable server-side debug messages, controlled by
+          the new method <code class="code">xmlrpc_server::SetDebug()</code>. 
At level 0,
+          no debug messages are sent to the client; level 1 is the same as the
+          old behaviour; at level 2 a lot more info is echoed back to the
+          client, regarding the received call; at level 3 all warnings raised
+          during server processing are trapped (this prevents breaking the xml
+          to be echoed back to the client) and added to the debug info sent
+          back to the client</p></li><li><p>New XML parsing code, yields 
smaller memory footprint and
+          faster execution times, not to mention complete elimination of the
+          dreaded <code class="filename">eval()</code> construct, so prone to 
code
+          injection exploits</p></li><li><p>Rewritten most of the error 
messages, making text more
+          explicative</p></li></ul></div></div><div class="navfooter"><hr 
/><table width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"><a accesskey="p" href="ch02s08.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">2.0 Release candidate 2 </td><td 
width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td 
width="40%" align="right" valign="top"> Chapter 3. System 
Requirements</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch03.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch03.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch03.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
3. System Requirements</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch02s09.html" title="2.0 Release candidate 1" /><link rel="next" 
href="ch04.html" title="Chapter 4. Files in the distribution" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">Chapter 3. System 
Requirements</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch02s09.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="ch04.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="requirements"></a>Chapter 3. System 
Requirements</h2></div></div></div><p>The library has been designed with goals 
of scalability and backward
+    compatibility. As such, it supports a wide range of PHP installs. Note
+    that not all features of the lib are available in every
+    configuration.</p><p>The <span class="emphasis"><em>minimum 
supported</em></span> PHP version is
+    5.0.</p><p>Automatic generation of xml-rpc methods from php functions is 
only
+    supported with PHP version 5.0.3 and later (note that the lib will
+    generate some warnings with PHP 5 in strict error reporting 
mode).</p><p>If you wish to use SSL or HTTP 1.1 to communicate with remote
+    servers, you need the "curl" extension compiled into your PHP
+    installation.</p><p>The "xmlrpc" native extension is not required to be 
compiled into
+    your PHP installation, but if it is, there will be no interference with
+    the operation of this library.</p></div><div class="navfooter"><hr 
/><table width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"><a accesskey="p" href="ch02s09.html">Prev</a> </td><td width="20%" 
align="center"> </td><td width="40%" align="right"> <a accesskey="n" 
href="ch04.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">2.0 Release candidate 1 </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> Chapter 4. Files in the 
distribution</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch04.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch04.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch04.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
4. Files in the distribution</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch03.html" title="Chapter 3. System Requirements" /><link rel="next" 
href="ch05.html" title="Chapter 5. Known bugs and limitations" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">Chapter 4. Files in the 
distribution</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch03.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="ch05.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="manifest"></a>Chapter 4. Files in the 
distribution</h2></div></div></div><div 
class="glosslist"><dl><dt>lib/xmlrpc.inc</dt><dd><p>the XML-RPC classes. <code 
class="function">include()</code> this in
+          your PHP files to use the 
classes.</p></dd><dt>lib/xmlrpcs.inc</dt><dd><p>the XML-RPC server class. <code 
class="function">include()</code> this
+          in addition to xmlrpc.inc to get server 
functionality</p></dd><dt>lib/xmlrpc_wrappers.inc</dt><dd><p>helper functions 
to "automagically" convert plain php
+          functions to xmlrpc services and vice 
versa</p></dd><dt>demo/server/proxy.php</dt><dd><p>a sample server implementing 
xmlrpc proxy
+          functionality.</p></dd><dt>demo/server/server.php</dt><dd><p>a 
sample server hosting various demo functions, as well as a
+          full suite of functions used for interoperability testing. It is
+          used by testsuite.php (see below) for unit testing the library, and
+          is not to be copied literally into your production 
servers</p></dd><dt>demo/client/client.php, demo/client/agesort.php,
+        demo/client/which.php</dt><dd><p>client code to exercise some of the 
functions in server.php,
+          including the <code 
class="function">interopEchoTests.whichToolkit</code>
+          method.</p></dd><dt>demo/client/wrap.php</dt><dd><p>client code to 
illustrate 'wrapping' of remote methods into
+          php 
functions.</p></dd><dt>demo/client/introspect.php</dt><dd><p>client code to 
illustrate usage of introspection capabilities
+          offered by 
server.php.</p></dd><dt>demo/client/mail.php</dt><dd><p>client code to 
illustrate usage of an xmlrpc-to-email gateway
+          using Dave Winer's XML-RPC server at 
userland.com.</p></dd><dt>demo/client/zopetest.php</dt><dd><p>example client 
code that queries an xmlrpc server built in
+          Zope.</p></dd><dt>demo/vardemo.php</dt><dd><p>examples of how to 
construct xmlrpcval types</p></dd><dt>demo/demo1.txt, demo/demo2.txt, 
demo/demo3.txt</dt><dd><p>XML-RPC responses captured in a file for testing 
purposes (you
+          can use these to test the
+          <code class="function">xmlrpcmsg-&gt;parseResponse()</code> 
method).</p></dd><dt>demo/server/discuss.php,
+        demo/client/comment.php</dt><dd><p>Software used in the PHP chapter of 
<a class="xref" href="ch06s02.html" title="The Jellyfish Book">The Jellyfish 
Book</a> to provide a comment server and allow the
+          attachment of comments to stories from Meerkat's data 
store.</p></dd><dt>test/testsuite.php, test/parse_args.php</dt><dd><p>A unit 
test suite for this software package. If you do
+          development on this software, please consider submitting tests for
+          this suite.</p></dd><dt>test/benchmark.php</dt><dd><p>A (very 
limited) benchmarking suite for this software package.
+          If you do development on this software, please consider submitting
+          benchmarks for this suite.</p></dd><dt>test/phpunit.php, 
test/PHPUnit/*.php</dt><dd><p>An (incomplete) version PEAR's unit test 
framework for PHP.
+          The complete package can be found at <a class="ulink" 
href="http://pear.php.net/package/PHPUnit"; 
target="_top">http://pear.php.net/package/PHPUnit</a></p></dd><dt>test/verify_compat.php</dt><dd><p>Script
 designed to help the user to verify the level of
+          compatibility of the library with the current php 
install</p></dd><dt>extras/test.pl, extras/test.py</dt><dd><p>Perl and Python 
programs to exercise server.php to test that
+          some of the methods 
work.</p></dd><dt>extras/workspace.testPhpServer.fttb</dt><dd><p>Frontier 
scripts to exercise the demo server. Thanks to Dave
+          Winer for permission to include these. See <a class="ulink" 
href="http://www.xmlrpc.com/discuss/msgReader$853"; target="_top">Dave's
+          announcement of 
these.</a></p></dd><dt>extras/rsakey.pem</dt><dd><p>A test certificate key for 
the SSL support, which can be used
+          to generate dummy certificates. It has the passphrase 
"test."</p></dd></dl></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch03.html">Prev</a> </td><td width="20%" align="center"> 
</td><td width="40%" align="right"> <a accesskey="n" 
href="ch05.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Chapter 3. System Requirements </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Chapter 5. Known bugs and 
limitations</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch05.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch05.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch05.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
5. Known bugs and limitations</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch04.html" title="Chapter 4. Files in the distribution" /><link 
rel="next" href="ch06.html" title="Chapter 6. Support" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Chapter 5. Known bugs and 
limitations</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch04.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="ch06.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="bugs"></a>Chapter 5. Known bugs and 
limitations</h2></div></div></div><p>This started out as a bare framework. Many 
"nice" bits haven't been
+    put in yet. Specifically, very little type validation or coercion has been
+    put in. PHP being a loosely-typed language, this is going to have to be
+    done explicitly (in other words: you can call a lot of library functions
+    passing them arguments of the wrong type and receive an error message only
+    much further down the code, where it will be difficult to
+    understand).</p><p>dateTime.iso8601 is supported opaquely. It can't be 
done natively as
+    the XML-RPC specification explicitly forbids passing of timezone
+    specifiers in ISO8601 format dates. You can, however, use the <a 
class="xref" href="ch09.html#iso8601encode" 
title="iso8601_encode">iso8601_encode()</a> and <a class="xref" 
href="ch09.html#iso8601decode" title="iso8601_decode">iso8601_decode()</a> 
functions
+    to do the encoding and decoding for you.</p><p>Very little HTTP response 
checking is performed (e.g. HTTP redirects
+    are not followed and the Content-Length HTTP header, mandated by the
+    xml-rpc spec, is not validated); cookie support still involves quite a bit
+    of coding on the part of the user.</p><p>If a specific character set 
encoding other than US-ASCII, ISO-8859-1
+    or UTF-8 is received in the HTTP header or XML prologue of xml-rpc request
+    or response messages then it will be ignored for the moment, and the
+    content will be parsed as if it had been encoded using the charset defined
+    by <a class="xref" href="ch08s02.html#xmlrpc-defencoding" 
title="xmlrpc_defencoding">xmlrpc_defencoding</a></p><p>Support for receiving 
from servers version 1 cookies (i.e.
+    conforming to RFC 2965) is quite incomplete, and might cause unforeseen
+    errors.</p></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch04.html">Prev</a> </td><td width="20%" align="center"> </td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch06.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Chapter 4. Files in the distribution </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Chapter 6. 
Support</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch06.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch06.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch06.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
6. Support</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch05.html" 
title="Chapter 5. Known bugs and limitations" /><link rel="next" 
href="ch06s02.html" title="The Jellyfish Book" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Chapter 6. Support</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><th width="60%" 
align="center"> </th><td width="20%" align="right"> <a accesskey="n" 
href="ch06s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="support"></a>Chapter 6. Support</h2></div></div></div><div 
class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a 
href="ch06.html#id932516">Online Support</a></span></dt><dt><span 
class="sect1"><a href="ch06s02.html">The Jellyfish 
Book</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h2 class="title" style="clear: both"><a 
id="id932516"></a>Online Support</h2></div></div></div><p>XML-RPC for PHP is 
offered "as-is" without any warranty or
+      commitment to support. However, informal advice and help is available
+      via the XML-RPC for PHP website and mailing list and from
+      XML-RPC.com.</p><div class="itemizedlist"><ul type="disc"><li><p>The 
<span class="emphasis"><em>XML-RPC for PHP</em></span> development is hosted
+          on <a class="ulink" href="http://phpxmlrpc.sourceforge.net"; 
target="_top">phpxmlrpc.sourceforge.net</a>.
+          Bugs, feature requests and patches can be posted to the <a 
class="ulink" href="http://sourceforge.net/projects/phpxmlrpc"; 
target="_top">project's
+          website</a>.</p></li><li><p>The <span class="emphasis"><em>PHP 
XML-RPC interest mailing list</em></span> is
+          run by the author. More details <a class="ulink" 
href="http://lists.gnomehack.com/mailman/listinfo/phpxmlrpc"; target="_top">can 
be
+          found here</a>.</p></li><li><p>For more general XML-RPC questions, 
there is a Yahoo! Groups
+          <a class="ulink" href="http://groups.yahoo.com/group/xml-rpc/"; 
target="_top">XML-RPC mailing
+          list</a>.</p></li><li><p>The <a class="ulink" 
href="http://www.xmlrpc.com/discuss"; target="_top">XML-RPC.com</a> discussion
+          group is a useful place to get help with using XML-RPC. This group
+          is also gatewayed into the Yahoo! Groups mailing 
list.</p></li></ul></div></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch05.html">Prev</a> </td><td width="20%" align="center"> 
</td><td width="40%" align="right"> <a accesskey="n" 
href="ch06s02.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Chapter 5. Known bugs and limitations </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> The Jellyfish 
Book</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch06s02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch06s02.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch06s02.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The 
Jellyfish Book</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="ch06.html" title="Chapter 6. Support" /><link rel="prev" href="ch06.html" 
title="Chapter 6. Support" /><link rel="next" href="ch07.html" title="Chapter 
7. Class documentation" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The 
Jellyfish Book</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch06.html">Prev</a> </td><th width="60%" align="center">Chapter 6. 
Support</th><td width="20%" align="right"> <a accesskey="n" 
href="ch07.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="jellyfish"></a>The Jellyfish 
Book</h2></div></div></div><div align="right"><table border="0" 
summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0" 
width="145"><tr style="height: 190px"><td align="right"><img 
src="progxmlrpc.s.gif" align="right" width="145" 
/></td></tr></table></div><p>Together with Simon St.Laurent and Joe
+      Johnston, Edd Dumbill wrote a book on XML-RPC for O'Reilly and
+      Associates on XML-RPC. It features a rather fetching jellyfish on the
+      cover.</p><p>Complete details of the book are <a class="ulink" 
href="http://www.oreilly.com/catalog/progxmlrpc/"; target="_top">available from
+      O'Reilly's web site.</a></p><p>Edd is responsible for the chapter on 
PHP, which includes a worked
+      example of creating a forum server, and hooking it up the O'Reilly's
+      <a class="ulink" href="http://meerkat.oreillynet.com/"; 
target="_top">Meerkat</a> service in
+      order to allow commenting on news stories from around the Web.</p><p>If 
you've benefited from the effort that has been put into writing
+      this software, then please consider buying the book!</p></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><td 
width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch07.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Chapter 6. Support </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> Chapter 7. Class 
documentation</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
7. Class documentation</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch06s02.html" title="The Jellyfish Book" /><link rel="next" 
href="ch07s02.html" title="xmlrpcmsg" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Chapter 7. Class documentation</th></tr><tr><td 
width="20%" align="left"><a accesskey="p" href="ch06s02.html">Prev</a> </td><th 
width="60%" align="center"> </th><td width="20%" align="right"> <a 
accesskey="n" href="ch07s02.html">Next</a></td></tr></table><hr /></div><div 
class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title"><a id="apidocs"></a>Chapter 7. Class 
documentation</h2></div></div></div><div class="toc"><p><b>Table of 
Contents</b></p><dl><dt><span class="sect1"><a 
href="ch07.html#xmlrpcval">xmlrpcval</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07.html#id932680">Notes on 
types</a></span></dt><dt><span class="sect2"><a 
href="ch07.html#xmlrpcval-creation">Creation</a></span></dt><dt><span 
class="sect2"><a 
href="ch07.html#xmlrpcval-methods">Methods</a></span></dt></dl></dd><dt><span 
class="sect1"><a href="ch07s02.html">xmlrpcmsg</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07s02.html#id934064">Creation</a></span></dt><dt><span 
class="sect2"><a 
href="ch07s02.html#id934152">Methods</a></span></dt></dl></dd><dt><span 
class="sect1"><a 
href="ch07s03.html">xmlrpc_client</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07s03.html#id934526">Creation</a></span></dt><dt><span 
class="sect2"><a href="ch07s03.html#id934666">Methods</a></span></dt><dt><span 
class="sect2"><a 
href="ch07s03.html#id935796">Variables</a></span></dt></dl></dd><dt><span 
class="sect1"><a 
href="ch07s04.html">xmlrpcresp</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07s04.html#id935884">Creation</a></span></dt><dt><span 
class="sect2"><a 
href="ch07s04.html#id935971">Methods</a></span></dt></dl></dd><dt><span 
class="sect1"><a 
href="ch07s05.html">xmlrpc_server</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07s05.html#id936390">Method handler 
functions</a></span></dt><dt><span class="sect2"><a 
href="ch07s05.html#id936453">The dispatch map</a></span></dt><dt><span 
class="sect2"><a href="ch07s05.html#signatures">Method 
signatures</a></span></dt><dt><span class="sect2"><a 
href="ch07s05.html#id936613">Delaying the server 
response</a></span></dt><dt><span class="sect2"><a 
href="ch07s05.html#id936662">Modifying the server 
behaviour</a></span></dt><dt><span class="sect2"><a 
href="ch07s05.html#id936748">Fault reporting</a></span></dt><dt><span 
class="sect2"><a href="ch07s05.html#id937308">'New style' 
servers</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: 
both"><a id="xmlrpcval"></a>xmlrpcval</h2></div></div></div><p>This is where a 
lot of the hard work gets done. This class enables
+      the creation and encapsulation of values for XML-RPC.</p><p>Ensure 
you've read the XML-RPC spec at <a class="ulink" 
href="http://www.xmlrpc.com/stories/storyReader$7"; 
target="_top">http://www.xmlrpc.com/stories/storyReader$7</a>
+      before reading on as it will make things clearer.</p><p>The <code 
class="classname">xmlrpcval</code> class can store arbitrarily
+      complicated values using the following types: <code class="literal">i4 
int boolean
+      string double dateTime.iso8601 base64 array struct</code>
+      <code class="literal">null</code>. You should refer to the <a 
class="ulink" href="http://www.xmlrpc.com/spec"; target="_top">spec</a> for more 
information on
+      what each of these types mean.</p><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id932680"></a>Notes on types</h3></div></div></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id932686"></a>int</h4></div></div></div><p>The type <code 
class="classname">i4</code> is accepted as a synonym
+          for <code class="classname">int</code> when creating xmlrpcval 
objects. The
+          xml parsing code will always convert <code 
class="classname">i4</code> to
+          <code class="classname">int</code>: <code 
class="classname">int</code> is regarded
+          by this implementation as the canonical name for this 
type.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id932715"></a>base64</h4></div></div></div><p>Base 64 encoding is performed 
transparently to the caller when
+          using this type. Decoding is also transparent. Therefore you ought
+          to consider it as a "binary" data type, for use when you want to
+          pass data that is not 7-bit clean.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id932726"></a>boolean</h4></div></div></div><p>The php values <code 
class="literal">true</code> and
+          <code class="literal">1</code> map to <code 
class="literal">true</code>. All other
+          values (including the empty string) are converted to
+          <code class="literal">false</code>.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id932751"></a>string</h4></div></div></div><p>Characters &lt;, &gt;, ', ", 
&amp;, are encoded using their
+          entity reference as &amp;lt; &amp;gt; &amp;apos; &amp;quot; and
+          &amp;amp; All other characters outside of the ASCII range are
+          encoded using their character reference representation (e.g.
+          &amp;#200 for é). The XML-RPC spec recommends only encoding
+          <code class="literal">&lt; &amp;</code> but this implementation goes 
further,
+          for reasons explained by <a class="ulink" 
href="http://www.w3.org/TR/REC-xml#syntax"; target="_top">the XML 1.0
+          recommendation</a>. In particular, using character reference
+          representation has the advantage of producing XML that is valid
+          independently of the charset encoding assumed.</p></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id932770"></a>null</h4></div></div></div><p>There is no 
support for encoding <code class="literal">null</code>
+          values in the XML-RPC spec, but at least a couple of extensions (and
+          many toolkits) do support it. Before using <code 
class="literal">null</code>
+          values in your messages, make sure that the responding party accepts
+          them, and uses the same encoding convention (see 
...).</p></div></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="xmlrpcval-creation"></a>Creation</h3></div></div></div><p>The constructor 
is the normal way to create an
+        <code class="classname">xmlrpcval</code>. The constructor can take 
these
+        forms:</p><div class="funcsynopsis"><table border="0" 
summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
+            <b 
class="fsfunc">xmlrpcval</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" 
summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
+            <b class="fsfunc">xmlrpcval</b>(</code></td><td>string<var 
class="pdparam">$stringVal</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
+            <b class="fsfunc">xmlrpcval</b>(</code></td><td>mixed<var 
class="pdparam">$scalarVal</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$scalartyp</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
+            <b class="fsfunc">xmlrpcval</b>(</code></td><td>array<var 
class="pdparam">$arrayVal</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$arraytyp</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>The first constructor creates an 
empty value, which must be
+        altered using the methods <code class="function">addScalar</code>,
+        <code class="function">addArray</code> or <code 
class="function">addStruct</code> before
+        it can be used.</p><p>The second constructor creates a simple string 
value.</p><p>The third constructor is used to create a scalar value. The
+        second parameter must be a name of an XML-RPC type. Valid types are:
+        "<code class="literal">int</code>", "<code 
class="literal">boolean</code>",
+        "<code class="literal">string</code>", "<code 
class="literal">double</code>",
+        "<code class="literal">dateTime.iso8601</code>", "<code 
class="literal">base64</code>" or
+        "null".</p><p>Examples:</p><pre class="programlisting"><code><span 
style="color: #000000">
+<span style="color: #0000BB">$myInt&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span 
style="color: #0000BB">1267</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span 
style="color: #007700">);<br /></span><span style="color: 
#0000BB">$myString&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"Hello,&nbsp;World!"</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span 
style="color: #007700">);<br /></span><span style="color: 
#0000BB">$myBool&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span 
style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span 
style="color: #DD0000">"boolean"</span><span style="color: #007700">);<br 
/></span><span style="color: #0000BB">$myString2&nbsp;</span><span 
style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span 
style="color: #0000BB">1.24</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span 
style="color: #007700">);&nbsp;</span><span style="color: 
#FF8000">//&nbsp;note:&nbsp;this&nbsp;will&nbsp;serialize&nbsp;a&nbsp;php&nbsp;float&nbsp;value&nbsp;as&nbsp;xmlrpc&nbsp;string</span>
+</span>
+</code></pre><p>The fourth constructor form can be used to compose complex
+        XML-RPC values. The first argument is either a simple array in the
+        case of an XML-RPC <code class="classname">array</code> or an 
associative
+        array in the case of a <code class="classname">struct</code>. The 
elements of
+        the array <span class="emphasis"><em>must be <code 
class="classname">xmlrpcval</code> objects
+        themselves</em></span>.</p><p>The second parameter must be either 
"<code class="literal">array</code>"
+        or "<code class="literal">struct</code>".</p><p>Examples:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$myArray&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(<br 
/>&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span 
style="color: #0000BB">xmlrpcval</span><span style="color: 
#007700">(</span><span style="color: #DD0000">"Tom"</span><span style="color: 
#007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"Dick"</span><span style="color: #007700">),<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"Harry"</span><span style="color: #007700">)<br 
/>&nbsp;&nbsp;),<br />&nbsp;&nbsp;</span><span style="color: 
#DD0000">"array"</span><span style="color: #007700">);<br /><br /></span><span 
style="color: #FF8000">//&nbsp;recursive&nbsp;struct<br /></span><span 
style="color: #0000BB">$myStruct&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(<br 
/>&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"name"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"Tom"</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span 
style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span 
style="color: #DD0000">"age"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #0000BB">34</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span 
style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span 
style="color: #DD0000">"address"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"street"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"Fifht&nbsp;Ave"</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span 
style="color: #007700">),<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"city"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"NY"</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span 
style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),&nbsp;<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"struct"</span><span style="color: #007700">)<br 
/>&nbsp;&nbsp;),&nbsp;<br />&nbsp;&nbsp;</span><span style="color: 
#DD0000">"struct"</span><span style="color: #007700">);</span>
+</span>
+</code></pre><p>See the file <code class="literal">vardemo.php</code> in this 
distribution
+        for more examples.</p></div><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="xmlrpcval-methods"></a>Methods</h3></div></div></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id933111"></a>addScalar</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">int<b class="fsfunc">addScalar</b>(</code></td><td>string<var 
class="pdparam">$stringVal</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">int<b 
class="fsfunc">addScalar</b>(</code></td><td>mixed<var 
class="pdparam">$scalarVal</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$scalartyp</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>If <em 
class="parameter"><code>$val</code></em> is an empty
+          <code class="classname">xmlrpcval</code> this method makes it a 
scalar
+          value, and sets that value.</p><p>If <em 
class="parameter"><code>$val</code></em> is already a scalar value, then
+          no more scalars can be added and <code class="literal">0</code> is
+          returned.</p><p>If <em class="parameter"><code>$val</code></em> is 
an xmlrpcval of type array,
+          the php value <em class="parameter"><code>$scalarval</code></em> is 
added as its last
+          element.</p><p>If all went OK, <code class="literal">1</code> is 
returned, otherwise
+          <code class="literal">0</code>.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id933209"></a>addArray</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">int<b class="fsfunc">addArray</b>(</code></td><td>array<var 
class="pdparam">$arrayVal</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>The argument is a simple 
(numerically indexed) array. The
+          elements of the array <span class="emphasis"><em>must be
+          <code class="classname">xmlrpcval</code> objects
+          themselves</em></span>.</p><p>Turns an empty <code 
class="classname">xmlrpcval</code> into an
+          <code class="classname">array</code> with contents as specified by
+          <em class="parameter"><code>$arrayVal</code></em>.</p><p>If <em 
class="parameter"><code>$val</code></em> is an xmlrpcval of type array,
+          the elements of <em class="parameter"><code>$arrayVal</code></em> 
are appended to the
+          existing ones.</p><p>See the fourth constructor form for more 
information.</p><p>If all went OK, <code class="literal">1</code> is returned, 
otherwise
+          <code class="literal">0</code>.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id933290"></a>addStruct</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">int<b class="fsfunc">addStruct</b>(</code></td><td>array<var 
class="pdparam">$assocArrayVal</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>The argument is an associative 
array. The elements of the
+          array <span class="emphasis"><em>must be <code 
class="classname">xmlrpcval</code> objects
+          themselves</em></span>.</p><p>Turns an empty <code 
class="classname">xmlrpcval</code> into a
+          <code class="classname">struct</code> with contents as specified by
+          <em class="parameter"><code>$assocArrayVal</code></em>.</p><p>If <em 
class="parameter"><code>$val</code></em> is an xmlrpcval of type struct,
+          the elements of <em class="parameter"><code>$arrayVal</code></em> 
are merged with the
+          existing ones.</p><p>See the fourth constructor form for more 
information.</p><p>If all went OK, <code class="literal">1</code> is returned, 
otherwise
+          <code class="literal">0</code>.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id933370"></a>kindOf</h4></div></div></div><div class="funcsynopsis"><table 
border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">string<b 
class="fsfunc">kindOf</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns a 
string containing "struct", "array" or "scalar"
+          describing the base type of the value. If it returns "undef" it
+          means that the value hasn't been initialised.</p></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id933398"></a>serialize</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">string<b 
class="fsfunc">serialize</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns a 
string containing the XML-RPC representation of this
+          value.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id933425"></a>scalarVal</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">mixed<b 
class="fsfunc">scalarVal</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code 
class="function">$val-&gt;kindOf() == "scalar"</code>, this
+          method returns the actual PHP-language value of the scalar (base 64
+          decoding is automatically handled here).</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id933457"></a>scalarTyp</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">string<b 
class="fsfunc">scalarTyp</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code 
class="function">$val-&gt;kindOf() == "scalar"</code>, this
+          method returns a string denoting the type of the scalar. As
+          mentioned before, <code class="literal">i4</code> is always coerced 
to
+          <code class="literal">int</code>.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id933779"></a>arrayMem</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcval<b class="fsfunc">arrayMem</b>(</code></td><td>int<var 
class="pdparam">$n</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>If <code 
class="function">$val-&gt;kindOf() == "array"</code>, returns
+          the <em class="parameter"><code>$n</code></em>th element in the 
array represented by
+          the value <em class="parameter"><code>$val</code></em>. The value 
returned is an
+          <code class="classname">xmlrpcval</code> object.</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB"></span><span style="color: 
#FF8000">//&nbsp;iterating&nbsp;over&nbsp;values&nbsp;of&nbsp;an&nbsp;array&nbsp;object<br
 /></span><span style="color: #007700">for&nbsp;(</span><span style="color: 
#0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span 
style="color: #0000BB">$i&nbsp;</span><span style="color: 
#007700">&lt;&nbsp;</span><span style="color: #0000BB">$val</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">arraySize</span><span style="color: #007700">();&nbsp;</span><span 
style="color: #0000BB">$i</span><span style="color: #007700">++)<br />{<br 
/>&nbsp;&nbsp;</span><span style="color: #0000BB">$v&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#0000BB">$val</span><span style="color: #007700">-&gt;</span><span 
style="color: #0000BB">arrayMem</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$i</span><span style="color: 
#007700">);<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">"Element&nbsp;</span><span style="color: #0000BB">$i</span><span 
style="color: 
#DD0000">&nbsp;of&nbsp;the&nbsp;array&nbsp;is&nbsp;of&nbsp;type&nbsp;"</span><span
 style="color: #007700">.</span><span style="color: #0000BB">$v</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">kindOf</span><span style="color: #007700">();<br />}</span>
+</span>
+</code></pre></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id933833"></a>arraySize</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">int<b 
class="fsfunc">arraySize</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <em 
class="parameter"><code>$val</code></em> is an
+          <code class="classname">array</code>, returns the number of elements 
in that
+          array.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id933869"></a>structMem</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcval<b 
class="fsfunc">structMem</b>(</code></td><td>string<var 
class="pdparam">$memberName</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>If <code 
class="function">$val-&gt;kindOf() == "struct"</code>, returns
+          the element called <em 
class="parameter"><code>$memberName</code></em> from the
+          struct represented by the value <em 
class="parameter"><code>$val</code></em>. The
+          value returned is an <code class="classname">xmlrpcval</code> 
object.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id933915"></a>structEach</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">array<b 
class="fsfunc">structEach</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the 
next (key, value) pair from the struct, when
+          <em class="parameter"><code>$val</code></em> is a struct.
+          <em class="parameter"><code>$value</code></em> is an xmlrpcval 
itself. See also <a class="xref" href="ch07.html#structreset" 
title="structReset">structreset()</a>.</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB"></span><span style="color: 
#FF8000">//&nbsp;iterating&nbsp;over&nbsp;all&nbsp;values&nbsp;of&nbsp;a&nbsp;struct&nbsp;object<br
 /></span><span style="color: #0000BB">$val</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">structreset</span><span 
style="color: #007700">();<br />while&nbsp;(list(</span><span style="color: 
#0000BB">$key</span><span style="color: #007700">,&nbsp;</span><span 
style="color: #0000BB">$v</span><span style="color: 
#007700">)&nbsp;=&nbsp;</span><span style="color: #0000BB">$val</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">structEach</span><span style="color: #007700">())<br />{<br 
/>&nbsp;&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">"Element&nbsp;</span><span style="color: #0000BB">$key</span><span 
style="color: 
#DD0000">&nbsp;of&nbsp;the&nbsp;struct&nbsp;is&nbsp;of&nbsp;type&nbsp;"</span><span
 style="color: #007700">.</span><span style="color: #0000BB">$v</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">kindOf</span><span style="color: #007700">();<br />}</span>
+</span>
+</code></pre></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="structreset"></a>structReset</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">structReset</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Resets the 
internal pointer for
+          <code class="function">structEach()</code> to the beginning of the 
struct,
+          where <em class="parameter"><code>$val</code></em> is a 
struct.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="structmemexists"></a>structMemExists</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">bool<b 
class="fsfunc">structMemExsists</b>(</code></td><td>string<var 
class="pdparam">$memberName</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Returns <code 
class="constant">TRUE</code> or
+          <code class="constant">FALSE</code> depending on whether a member of 
the
+          given name exists in the struct.</p></div></div></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch06s02.html">Prev</a> </td><td 
width="20%" align="center"> </td><td width="40%" align="right"> <a 
accesskey="n" href="ch07s02.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">The Jellyfish Book </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> xmlrpcmsg</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s02.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s02.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>xmlrpcmsg</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch07.html" title="Chapter 7. Class documentation" /><link 
rel="prev" href="ch07.html" title="Chapter 7. Class documentation" /><link 
rel="next" href="ch07s03.html" title="xmlrpc_client" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">xmlrpcmsg</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><th width="60%" 
align="center">Chapter 7. Class documentation</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch07s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a 
id="xmlrpcmsg"></a>xmlrpcmsg</h2></div></div></div><p>This class provides a 
representation for a request to an XML-RPC
+      server. A client sends an <code class="classname">xmlrpcmsg</code> to a 
server,
+      and receives back an <code class="classname">xmlrpcresp</code> (see <a 
class="xref" href="ch07s03.html#xmlrpc-client-send" 
title="send">xmlrpc_client-&gt;send</a>).</p><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id934064"></a>Creation</h3></div></div></div><p>The constructor takes the 
following forms:</p><div class="funcsynopsis"><table border="0" 
summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcmsgnew
+            <b class="fsfunc">xmlrpcmsg</b>(</code></td><td>string<var 
class="pdparam">$methodName</var>, </td></tr><tr><td> </td><td>array<var 
class="pdparam">$parameterArray</var>null<code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Where <em 
class="parameter"><code>methodName</code></em> is a string indicating
+        the name of the method you wish to invoke, and
+        <em class="parameter"><code>parameterArray</code></em> is a simple php
+        <code class="classname">Array</code> of <code 
class="classname">xmlrpcval</code>
+        objects. Here's an example message to the <span 
class="emphasis"><em>US state
+        name</em></span> server:</p><pre class="programlisting"><code><span 
style="color: #000000">
+<span style="color: #0000BB">$msg&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"examples.getStateName"</span><span style="color: 
#007700">,&nbsp;array(new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #0000BB">23</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span 
style="color: #007700">)));</span>
+</span>
+</code></pre><p>This example requests the name of state number 23. For more
+        information on <code class="classname">xmlrpcval</code> objects, see 
<a class="xref" href="ch07.html#xmlrpcval" 
title="xmlrpcval">xmlrpcval</a>.</p><p>Note that the <em 
class="parameter"><code>parameterArray</code></em> parameter is
+        optional and can be omitted for methods that take no input parameters
+        or if you plan to add parameters one by one.</p></div><div 
class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 
class="title"><a id="id934152"></a>Methods</h3></div></div></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id934158"></a>addParam</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">bool<b 
class="fsfunc">addParam</b>(</code></td><td>xmlrpcval<var 
class="pdparam">$xmlrpcVal</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Adds the <code 
class="classname">xmlrpcval</code>
+          <em class="parameter"><code>xmlrpcVal</code></em> to the parameter 
list for this
+          method call. Returns TRUE or FALSE on error.</p></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id934197"></a>getNumParams</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">int<b 
class="fsfunc">getNumParams</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the 
number of parameters attached to this
+          message.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id934225"></a>getParam</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcval<b class="fsfunc">getParam</b>(</code></td><td>int<var 
class="pdparam">$n</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Gets the <em 
class="parameter"><code>n</code></em>th parameter in the message
+          (with the index zero-based). Use this method in server
+          implementations to retrieve the values sent by the 
client.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id934261"></a>method</h4></div></div></div><div class="funcsynopsis"><table 
border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">string<b 
class="fsfunc">method</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" 
summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">string<b 
class="fsfunc">method</b>(</code></td><td>string<var 
class="pdparam">$methName</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Gets or sets the method contained 
in the XML-RPC
+          message.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id934392"></a>parseResponse</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcresp<b 
class="fsfunc">parseResponse</b>(</code></td><td>string<var 
class="pdparam">$xmlString</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Given an incoming XML-RPC server 
response contained in the
+          string <em class="parameter"><code>$xmlString</code></em>, this 
method constructs an
+          <code class="classname">xmlrpcresp</code> response object and 
returns it,
+          setting error codes as appropriate (see <a class="xref" 
href="ch07s03.html#xmlrpc-client-send" 
title="send">xmlrpc_client-&gt;send</a>).</p><p>This method processes any 
HTTP/MIME headers it finds.</p></div><div class="sect3" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id934438"></a>parseResponseFile</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcresp<b 
class="fsfunc">parseResponseFile</b>(</code></td><td>file handle
+              resource<var 
class="pdparam">$fileHandle</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Given an incoming XML-RPC server 
response on the open file
+          handle <em class="parameter"><code>fileHandle</code></em>, this 
method reads all the
+          data it finds and passes it to
+          <code class="function">parseResponse.</code></p><p>This method is 
useful to construct responses from pre-prepared
+          files (see files <code class="literal">demo1.txt, demo2.txt, 
demo3.txt</code>
+          in this distribution). It processes any HTTP headers it finds, and
+          does not close the file handle.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id934484"></a>serialize</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">string
+              <b 
class="fsfunc">serialize</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the 
an XML string representing the XML-RPC
+          message.</p></div></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch07.html">Prev</a> </td><td width="20%" align="center"><a 
accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a 
accesskey="n" href="ch07s03.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">Chapter 7. Class documentation </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> xmlrpc_client</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s03.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s03.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s03.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>xmlrpc_client</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch07.html" title="Chapter 7. Class documentation" /><link 
rel="prev" href="ch07s02.html" title="xmlrpcmsg" /><link rel="next" 
href="ch07s04.html" title="xmlrpcresp" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">xmlrpc_client</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch07s02.html">Prev</a> </td><th width="60%" 
align="center">Chapter 7. Class documentation</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch07s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a 
id="xmlrpc-client"></a>xmlrpc_client</h2></div></div></div><p>This is the basic 
class used to represent a client of an XML-RPC
+      server.</p><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="id934526"></a>Creation</h3></div></div></div><p>The constructor accepts one 
of two possible syntaxes:</p><div class="funcsynopsis"><table border="0" 
summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpc_clientnew
+            <b class="fsfunc">xmlrpc_client</b>(</code></td><td>string<var 
class="pdparam">$server_url</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpc_clientnew
+            <b class="fsfunc">xmlrpc_client</b>(</code></td><td>string<var 
class="pdparam">$server_path</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$server_hostname</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$server_port</var>80, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$transport</var>'http'<code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Here are a couple of usage 
examples of the first form:</p><pre class="programlisting"><code><span 
style="color: #000000">
+<span style="color: #0000BB">$client&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span 
style="color: 
#DD0000">"http://phpxmlrpc.sourceforge.net/server.php";</span><span 
style="color: #007700">);<br /></span><span style="color: 
#0000BB">$another_client&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span 
style="color: 
#DD0000">"https://james:address@hidden:443/xmlrpcserver?agent=007";</span><span 
style="color: #007700">);</span>
+</span>
+</code></pre><p>The second syntax does not allow to express a username and
+        password to be used for basic HTTP authorization as in the second
+        example above, but instead it allows to choose whether xmlrpc calls
+        will be made using the HTTP 1.0 or 1.1 protocol.</p><p>Here's another 
example client set up to query Userland's XML-RPC
+        server at <span 
class="emphasis"><em>betty.userland.com</em></span>:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$client&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"/RPC2"</span><span style="color: 
#007700">,&nbsp;</span><span style="color: 
#DD0000">"betty.userland.com"</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">80</span><span 
style="color: #007700">);</span>
+</span>
+</code></pre><p>The <em class="parameter"><code>server_port</code></em> 
parameter is optional,
+        and if omitted will default to 80 when using HTTP and 443 when using
+        HTTPS (see the <a class="xref" href="ch07s03.html#xmlrpc-client-send" 
title="send">xmlrpc_client-&gt;send</a> method
+        below).</p><p>The <em class="parameter"><code>transport</code></em> 
parameter is optional, and
+        if omitted will default to 'http'. Allowed values are either
+        '<span class="symbol">http'</span>, '<span 
class="symbol">https</span>' or
+        '<span class="symbol">http11'</span>. Its value can be overridden with 
every call
+        to the <code class="methodname">send</code> method. See the
+        <code class="methodname">send</code> method below for more details 
about the
+        meaning of the different values.</p></div><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id934666"></a>Methods</h3></div></div></div><p>This class supports the 
following methods.</p><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="xmlrpc-client-send"></a>send</h4></div></div></div><p>This method takes the 
forms:</p><div class="funcsynopsis"><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcresp<b 
class="fsfunc">send</b>(</code></td><td>xmlrpcmsg<var 
class="pdparam">$xmlrpc_message</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$timeout</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$transport</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">array<b 
class="fsfunc">send</b>(</code></td><td>array<var 
class="pdparam">$xmlrpc_messages</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$timeout</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$transport</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcresp<b 
class="fsfunc">send</b>(</code></td><td>string<var 
class="pdparam">$xml_payload</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$timeout</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$transport</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Where <em 
class="parameter"><code>xmlrpc_message</code></em> is an instance of
+          <code class="classname">xmlrpcmsg</code> (see <a class="xref" 
href="ch07s02.html" title="xmlrpcmsg">xmlrpcmsg</a>),
+          and <em class="parameter"><code>response</code></em> is an instance 
of
+          <code class="classname">xmlrpcresp</code> (see <a class="xref" 
href="ch07s04.html" title="xmlrpcresp">xmlrpcresp</a>).</p><p><em 
class="parameter"><code>If xmlrpc_messages</code></em> is an array of
+          message instances, <code class="code">responses</code> will be an 
array of
+          response instances. The client will try to make use of a single
+          <code class="code">system.multicall</code> xml-rpc method call to 
forward to the
+          server all the messages in a single HTTP round trip, unless
+          <code class="code">$client-&gt;no_multicall</code> has been 
previously set to
+          <code class="code">TRUE</code> (see the multicall method below), in 
which case
+          many consecutive xmlrpc requests will be sent.</p><p>The third 
syntax allows to build by hand (or any other means)
+          a complete xmlrpc request message, and send it to the server.
+          <em class="parameter"><code>xml_payload</code></em> should be a 
string containing the
+          complete xml representation of the request. It is e.g. useful when,
+          for maximal speed of execution, the request is serialized into a
+          string using the native php xmlrpc functions (see <a class="ulink" 
href="http://www.php.net/xmlrpc"; target="_top">the php manual on
+          xmlrpc</a>).</p><p>The <em 
class="parameter"><code>timeout</code></em> is optional, and will be
+          set to <code class="literal">0</code> (wait for platform-specific 
predefined
+          timeout) if omitted. This timeout value is passed to
+          <code class="function">fsockopen()</code>. It is also used for 
detecting
+          server timeouts during communication (i.e. if the server does not
+          send anything to the client for <em 
class="parameter"><code>timeout</code></em>
+          seconds, the connection will be closed).</p><p>The <em 
class="parameter"><code>transport</code></em> parameter is optional,
+          and if omitted will default to the transport set using instance
+          creator or 'http' if omitted. The only other valid values are
+          'https', which will use an SSL HTTP connection to connect to the
+          remote server, and 'http11'. Note that your PHP must have the "curl"
+          extension compiled in order to use both these features. Note that
+          when using SSL you should normally set your port number to 443,
+          unless the SSL server you are contacting runs at any other
+          port.</p><div class="warning" style="margin-left: 0.5in; 
margin-right: 0.5in;"><h3 class="title">Warning</h3><p>PHP 4.0.6 has a bug 
which prevents SSL working.</p></div><p>In addition to low-level errors, the 
XML-RPC server you were
+          querying may return an error in the
+          <code class="classname">xmlrpcresp</code> object. See <a 
class="xref" href="ch07s04.html" title="xmlrpcresp">xmlrpcresp</a> for details 
of how to handle these
+          errors.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="multicall"></a>multiCall</h4></div></div></div><p>This method takes the 
form:</p><div class="funcsynopsis"><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">array<b 
class="fsfunc">multiCall</b>(</code></td><td>array<var 
class="pdparam">$messages</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$timeout</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$transport</var>, </td></tr><tr><td> </td><td>bool<var 
class="pdparam">$fallback</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method is used to boxcar many 
method calls in a single
+          xml-rpc request. It will try first to make use of the
+          <code class="code">system.multicall</code> xml-rpc method call, and 
fall back to
+          executing many separate requests if the server returns any
+          error.</p><p><em class="parameter"><code>msgs</code></em> is an 
array of
+          <code class="classname">xmlrpcmsg</code> objects (see <a 
class="xref" href="ch07s02.html" title="xmlrpcmsg">xmlrpcmsg</a>), and <em 
class="parameter"><code>response</code></em> is an
+          array of <code class="classname">xmlrpcresp</code> objects (see <a 
class="xref" href="ch07s04.html" title="xmlrpcresp">xmlrpcresp</a>).</p><p>The 
<em class="parameter"><code>timeout</code></em> and
+          <em class="parameter"><code>transport</code></em> parameters are 
optional, and behave
+          as in the <code class="methodname">send</code> method 
above.</p><p>The <em class="parameter"><code>fallback</code></em> parameter is 
optional, and
+          defaults to <code class="constant">TRUE</code>. When set to
+          <code class="constant">FALSE</code> it will prevent the client to 
try using
+          many single method calls in case of failure of the first multicall
+          request. It should be set only when the server is known to support
+          the multicall extension.</p></div><div class="sect3" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id935048"></a>setAcceptedCompression</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">setAcceptedCompression</b>(</code></td><td>string<var 
class="pdparam">$compressionmethod</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method defines whether the 
client will accept compressed
+          xml payload forming the bodies of the xmlrpc responses received from
+          servers. Note that enabling reception of compressed responses merely
+          adds some standard http headers to xmlrpc requests. It is up to the
+          xmlrpc server to return compressed responses when receiving such
+          requests. Allowed values for
+          <em class="parameter"><code>compressionmethod</code></em> are: 
'gzip', 'deflate',
+          'any' or null (with any meaning either gzip or deflate).</p><p>This 
requires the "zlib" extension to be enabled in your php
+          install. If it is, by default <code 
class="classname">xmlrpc_client</code>
+          instances will enable reception of compressed content.</p></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id935091"></a>setCaCertificate</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">setCaCertificate</b>(</code></td><td>string<var 
class="pdparam">$certificate</var>, </td></tr><tr><td> </td><td>bool<var 
class="pdparam">$is_dir</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method sets an optional 
certificate to be used in
+          SSL-enabled communication to validate a remote server with (when the
+          <em class="parameter"><code>server_method</code></em> is set to 
'https' in the
+          client's construction or in the send method and
+          <code class="methodname">SetSSLVerifypeer</code> has been set to
+          <code class="constant">TRUE</code>).</p><p>The <em 
class="parameter"><code>certificate</code></em> parameter must be the
+          filename of a PEM formatted certificate, or a directory containing
+          multiple certificate files. The <em 
class="parameter"><code>is_dir</code></em>
+          parameter defaults to <code class="constant">FALSE</code>, set it to
+          <code class="constant">TRUE</code> to specify that
+          <em class="parameter"><code>certificate</code></em> indicates a 
directory instead of
+          a single file.</p><p>This requires the "curl" extension to be 
compiled into your
+          installation of PHP. For more details see the man page for the
+          <code class="function">curl_setopt</code> function.</p></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id935172"></a>setCertificate</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">setCertificate</b>(</code></td><td>string<var 
class="pdparam">$certificate</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$passphrase</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method sets the optional 
certificate and passphrase used
+          in SSL-enabled communication with a remote server (when the
+          <em class="parameter"><code>server_method</code></em> is set to 
'https' in the
+          client's construction or in the send method).</p><p>The <em 
class="parameter"><code>certificate</code></em> parameter must be the
+          filename of a PEM formatted certificate. The
+          <em class="parameter"><code>passphrase</code></em> parameter must 
contain the
+          password required to use the certificate.</p><p>This requires the 
"curl" extension to be compiled into your
+          installation of PHP. For more details see the man page for the
+          <code class="function">curl_setopt</code> function.</p><p>Note: to 
retrieve information about the client certificate on
+          the server side, you will need to look into the environment
+          variables which are set up by the webserver. Different webservers
+          will typically set up different variables.</p></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id935237"></a>setCookie</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b class="fsfunc">setCookie</b>(</code></td><td>string<var 
class="pdparam">$name</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$value</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$path</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$domain</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$port</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method sets a cookie that 
will be sent to the xmlrpc
+          server along with every further request (useful e.g. for keeping
+          session info outside of the xml-rpc payload).</p><p><em 
class="parameter"><code>$value</code></em> is optional, and defaults to
+          null.</p><p><em class="parameter"><code>$path, $domain and 
$port</code></em> are optional,
+          and will be omitted from the cookie header if unspecified. Note that
+          setting any of these values will turn the cookie into a 'version 1'
+          cookie, that might not be fully supported by the server (see RFC2965
+          for more details).</p></div><div class="sect3" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id935310"></a>setCredentials</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">setCredentials</b>(</code></td><td>string<var 
class="pdparam">$username</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$password</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$authtype</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method sets the username and 
password for authorizing the
+          client to a server. With the default (HTTP) transport, this
+          information is used for HTTP Basic authorization. Note that username
+          and password can also be set using the class constructor. With HTTP
+          1.1 and HTTPS transport, NTLM and Digest authentication protocols
+          are also supported. To enable them use the constants
+          <code class="constant">CURLAUTH_DIGEST</code> and
+          <code class="constant">CURLAUTH_NTLM</code> as values for the 
authtype
+          parameter.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id935364"></a>setCurlOptions</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">setCurlOptions</b>(</code></td><td>array<var 
class="pdparam">$options</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method allows to directly set 
any desired
+          option to manipulate the usage of the cURL client (when in cURL
+          mode). It can be used eg. to explicitly bind to an outgoing ip
+          address when the server is multihomed</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id935395"></a>setDebug</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b class="fsfunc">setDebug</b>(</code></td><td>int<var 
class="pdparam">$debugLvl</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p><em 
class="parameter"><code>debugLvl</code></em> is either <code class="literal">0,
+          1</code> or 2 depending on whether you require the client to
+          print debugging information to the browser. The default is not to
+          output this information (0).</p><p>The debugging information at 
level 1includes the raw data
+          returned from the XML-RPC server it was querying (including bot HTTP
+          headers and the full XML payload), and the PHP value the client
+          attempts to create to represent the value returned by the server. At
+          level2, the complete payload of the xmlrpc request is also printed,
+          before being sent t the server.</p><p>This option can be very useful 
when debugging servers as it
+          allows you to see exactly what the client sends and the server
+          returns.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id935441"></a>setKey</h4></div></div></div><div class="funcsynopsis"><table 
border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">void<b 
class="fsfunc">setKey</b>(</code></td><td>int<var class="pdparam">$key</var>, 
</td></tr><tr><td> </td><td>int<var 
class="pdparam">$keypass</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method sets the optional 
certificate key and passphrase
+          used in SSL-enabled communication with a remote server (when the
+          <em class="parameter"><code>transport</code></em> is set to 'https' 
in the client's
+          construction or in the send method).</p><p>This requires the "curl" 
extension to be compiled into your
+          installation of PHP. For more details see the man page for the
+          <code class="function">curl_setopt</code> function.</p></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id935491"></a>setProxy</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b class="fsfunc">setProxy</b>(</code></td><td>string<var 
class="pdparam">$proxyhost</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$proxyport</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$proxyusername</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$proxypassword</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$authtype</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method enables calling 
servers via an HTTP proxy. The
+          <em class="parameter"><code>proxyusername</code></em>,<em 
class="parameter"><code>
+          proxypassword</code></em> and <em 
class="parameter"><code>authtype</code></em>
+          parameters are optional. <em 
class="parameter"><code>Authtype</code></em> defaults to
+          <code class="constant">CURLAUTH_BASIC</code> (Basic authentication 
protocol);
+          the only other valid value is the constant
+          <code class="constant">CURLAUTH_NTLM</code>, and has effect only 
when the
+          client uses the HTTP 1.1 protocol.</p><p>NB: CURL versions before 
7.11.10 cannot use a proxy to
+          communicate with https servers.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id935642"></a>setRequestCompression</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">setRequestCompression</b>(</code></td><td>string<var 
class="pdparam">$compressionmethod</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method defines whether the 
xml payload forming the
+          request body will be sent to the server in compressed format, as per
+          the HTTP specification. This is particularly useful for large
+          request parameters and over slow network connections. Allowed values
+          for <em class="parameter"><code>compressionmethod</code></em> are: 
'gzip', 'deflate',
+          'any' or null (with any meaning either gzip or deflate). Note that
+          there is no automatic fallback mechanism in place for errors due to
+          servers not supporting receiving compressed request bodies, so make
+          sure that the particular server you are querying does accept
+          compressed requests before turning it on.</p><p>This requires the 
"zlib" extension to be enabled in your php
+          install.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id935682"></a>setSSLVerifyHost</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">setSSLVerifyHost</b>(</code></td><td>int<var 
class="pdparam">$i</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method defines whether 
connections made to XML-RPC
+          backends via HTTPS should verify the remote host's SSL certificate's
+          common name (CN). By default, only the existence of a CN is checked.
+          <em class="parameter"><code><em 
class="parameter"><code>$i</code></em></code></em> should be an
+          integer value; 0 to not check the CN at all, 1 to merely check for
+          its existence, and 2 to check that the CN on the certificate matches
+          the hostname that is being connected to.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id935719"></a>setSSLVerifyPeer</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">setSSLVerifyPeer</b>(</code></td><td>bool<var 
class="pdparam">$i</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method defines whether 
connections made to XML-RPC
+          backends via HTTPS should verify the remote host's SSL certificate,
+          and cause the connection to fail if the cert verification fails.
+          <em class="parameter"><code><em 
class="parameter"><code>$i</code></em></code></em> should be a boolean
+          value. Default value: <code class="constant">TRUE</code>. To specify 
custom
+          SSL certificates to validate the server with, use the
+          <code class="methodname">setCaCertificate</code> 
method.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id935763"></a>setUserAgent</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b class="fsfunc">Useragent</b>(</code></td><td>string<var 
class="pdparam">$useragent</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>This method sets a custom 
user-agent that will be
+          used by the client in the http headers sent with the request. The
+          default value is built using the library name and version
+          constants.</p></div></div><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id935796"></a>Variables</h3></div></div></div><p>NB: direct manipulation of 
these variables is only recommended
+        for advanced users.</p><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id935805"></a>no_multicall</h4></div></div></div><p>This member variable 
determines whether the multicall() method
+          will try to take advantage of the system.multicall xmlrpc method to
+          dispatch to the server an array of requests in a single http
+          roundtrip or simply execute many consecutive http calls. Defaults to
+          FALSE, but it will be enabled automatically on the first failure of
+          execution of system.multicall.</p></div><div class="sect3" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id935816"></a>request_charset_encoding</h4></div></div></div><p>This is the 
charset encoding that will be used for serializing
+          request sent by the client.</p><p>If defaults to NULL, which means 
using US-ASCII and encoding
+          all characters outside of the ASCII range using their xml character
+          entity representation (this has the benefit that line end characters
+          will not be mangled in the transfer, a CR-LF will be preserved as
+          well as a singe LF).</p><p>Valid values are 'US-ASCII', 'UTF-8' and 
'ISO-8859-1'</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="return-type"></a>return_type</h4></div></div></div><p>This member variable 
determines whether the value returned
+          inside an xmlrpcresp object as results of calls to the send() and
+          multicall() methods will be an xmlrpcval object, a plain php value
+          or a raw xml string. Allowed values are 'xmlrpcvals' (the default),
+          'phpvals' and 'xml'. To allow the user to differentiate between a
+          correct and a faulty response, fault responses will be returned as
+          xmlrpcresp objects in any case. Note that the 'phpvals' setting will
+          yield faster execution times, but some of the information from the
+          original response will be lost. It will be e.g. impossible to tell
+          whether a particular php string value was sent by the server as an
+          xmlrpc string or base64 value.</p><p>Example usage:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$client&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"phpxmlrpc.sourceforge.net/server"</span><span 
style="color: #007700">);<br /></span><span style="color: 
#0000BB">$client</span><span style="color: #007700">-&gt;</span><span 
style="color: #0000BB">return_type&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #DD0000">'phpvals'</span><span 
style="color: #007700">;<br /></span><span style="color: 
#0000BB">$message&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"examples.getStateName"</span><span style="color: 
#007700">,&nbsp;array(new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #0000BB">23</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span 
style="color: #007700">)));<br /></span><span style="color: 
#0000BB">$resp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">$client</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">send</span><span 
style="color: #007700">(</span><span style="color: 
#0000BB">$message</span><span style="color: #007700">);<br 
/>if&nbsp;(</span><span style="color: #0000BB">$resp</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span 
style="color: #007700">())&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">'KO.&nbsp;Error:&nbsp;'</span><span style="color: 
#007700">.</span><span style="color: #0000BB">$resp</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">faultString</span><span 
style="color: #007700">();&nbsp;else&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">'OK:&nbsp;got&nbsp;'</span><span style="color: #007700">.</span><span 
style="color: #0000BB">$resp</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">value</span><span 
style="color: #007700">();</span>
+</span>
+</code></pre><p>For more details about usage of the 'xml' value, see Appendix
+          A.</p></div></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch07s02.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch07s04.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">xmlrpcmsg </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> xmlrpcresp</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s04.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s04.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s04.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>xmlrpcresp</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch07.html" title="Chapter 7. Class documentation" /><link 
rel="prev" href="ch07s03.html" title="xmlrpc_client" /><link rel="next" 
href="ch07s05.html" title="xmlrpc_server" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">xmlrpcresp</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch07s03.html">Prev</a> </td><th width="60%" 
align="center">Chapter 7. Class documentation</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch07s05.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a 
id="xmlrpcresp"></a>xmlrpcresp</h2></div></div></div><p>This class is used to 
contain responses to XML-RPC requests. A
+      server method handler will construct an
+      <code class="classname">xmlrpcresp</code> and pass it as a return value. 
This
+      same value will be returned by the result of an invocation of the
+      <code class="function">send</code> method of the
+      <code class="classname">xmlrpc_client</code> class.</p><div 
class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 
class="title"><a id="id935884"></a>Creation</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcrespnew
+            <b class="fsfunc">xmlrpcresp</b>(</code></td><td>xmlrpcval<var 
class="pdparam">$xmlrpcval</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcrespnew
+            <b class="fsfunc">xmlrpcresp</b>(</code></td><td><var 
class="pdparam">0</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$errcode</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$err_string</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>The first syntax is used when 
execution has happened without
+        difficulty: <em class="parameter"><code>$xmlrpcval</code></em> is an
+        <code class="classname">xmlrpcval</code> value with the result of the 
method
+        execution contained in it. Alternatively it can be a string containing
+        the xml serialization of the single xml-rpc value result of method
+        execution.</p><p>The second type of constructor is used in case of 
failure.
+        <em class="parameter"><code>errcode</code></em> and <em 
class="parameter"><code>err_string</code></em>
+        are used to provide indication of what has gone wrong. See <a 
class="xref" href="ch07s05.html" title="xmlrpc_server">xmlrpc_server</a> for 
more information on passing error
+        codes.</p></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="id935971"></a>Methods</h3></div></div></div><div class="sect3" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id935977"></a>faultCode</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">int<b 
class="fsfunc">faultCode</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the 
integer fault code return from the XML-RPC
+          response. A zero value indicates success, any other value indicates
+          a failure response.</p></div><div class="sect3" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id936004"></a>faultString</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">string<b 
class="fsfunc">faultString</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the 
human readable explanation of the fault indicated
+          by <code 
class="function">$resp-&gt;faultCode</code>().</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id936036"></a>value</h4></div></div></div><div class="funcsynopsis"><table 
border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b 
class="fsfunc">value</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns an 
<code class="classname">xmlrpcval</code> object containing
+          the return value sent by the server. If the response's
+          <code class="function">faultCode</code> is non-zero then the value 
returned
+          by this method should not be used (it may not even be an
+          object).</p><p>Note: if the xmlrpcresp instance in question has been 
created
+          by an <code class="classname">xmlrpc_client</code> object whose
+          <code class="varname">return_type</code> was set to 'phpvals', then 
a plain
+          php value will be returned instead of an
+          <code class="classname">xmlrpcval</code> object. If the
+          <code class="varname">return_type</code> was set to 'xml', an xml 
string will
+          be returned (see the return_type member var above for more
+          details).</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id936088"></a>serialize</h4></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">string<b 
class="fsfunc">serialize</b>(</code></td><td><code>void)</code>;</td><td> 
</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns an 
XML string representation of the response (xml
+          prologue not included).</p></div></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch07s03.html">Prev</a> </td><td 
width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch07s05.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">xmlrpc_client </td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
xmlrpc_server</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s05.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s05.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch07s05.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>xmlrpc_server</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch07.html" title="Chapter 7. Class documentation" /><link 
rel="prev" href="ch07s04.html" title="xmlrpcresp" /><link rel="next" 
href="ch08.html" title="Chapter 8. Global variables" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">xmlrpc_server</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch07s04.html">Prev</a> </td><th width="60%" 
align="center">Chapter 7. Class documentation</th><td width="20%" 
align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr></table><hr 
/></div><div class="sect1" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h2 class="title" style="clear: both"><a 
id="xmlrpc-server"></a>xmlrpc_server</h2></div></div></div><p>The 
implementation of this class has been kept as simple to use as
+      possible. The constructor for the server basically does all the work.
+      Here's a minimal example:</p><pre class="programlisting"><code><span 
style="color: #000000">
+<span style="color: #0000BB">&nbsp;&nbsp;</span><span style="color: 
#007700">function&nbsp;</span><span style="color: 
#0000BB">foo&nbsp;</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$xmlrpcmsg</span><span style="color: 
#007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcresp</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$some_xmlrpc_val</span><span style="color: 
#007700">);<br />&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;class&nbsp;</span><span 
style="color: #0000BB">bar&nbsp;</span><span style="color: #007700">{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;</span><span style="color: 
#0000BB">foobar</span><span style="color: #007700">(</span><span style="color: 
#0000BB">$xmlrpcmsg</span><span style="color: #007700">)&nbsp;{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;</span><span 
style="color: #0000BB">xmlrpcresp</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$some_xmlrpc_val</span><span 
style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br 
/><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$s&nbsp;</span><span 
style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_server</span><span style="color: #007700">(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;array(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"examples.myFunc1"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;array(</span><span style="color: 
#DD0000">"function"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: #DD0000">"foo"</span><span 
style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span 
style="color: #DD0000">"examples.myFunc2"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;array(</span><span style="color: 
#DD0000">"function"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: 
#DD0000">"bar::foobar"</span><span style="color: #007700">),<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;));</span>
+</span>
+</code></pre><p>This performs everything you need to do with a server. The 
single
+      constructor argument is an associative array from xmlrpc method names to
+      php function names. The incoming request is parsed and dispatched to the
+      relevant php function, which is responsible for returning a
+      <code class="classname">xmlrpcresp</code> object, that will be 
serialized back
+      to the caller.</p><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a id="id936390"></a>Method 
handler functions</h3></div></div></div><p>Both php functions and class methods 
can be registered as xmlrpc
+        method handlers.</p><p>The synopsis of a method handler function 
is:</p><pre class="synopsis">xmlrpcresp $resp = function (xmlrpcmsg 
$msg)</pre><p>No text should be echoed 'to screen' by the handler function, or
+        it will break the xml response sent back to the client. This applies
+        also to error and warning messages that PHP prints to screen unless
+        the appropriate parameters have been set in the php.in file. Another
+        way to prevent echoing of errors inside the response and facilitate
+        debugging is to use the server SetDebug method with debug level 3 (see
+        ...). Exceptions thrown duting execution of handler functions are
+        caught by default and a XML-RPC error reponse is generated instead.
+        This behaviour can be finetuned by usage of the
+        <code class="varname">exception_handling</code> member variable (see
+        ...).</p><p>Note that if you implement a method with a name prefixed by
+        <code class="code">system.</code> the handler function will be invoked 
by the
+        server with two parameters, the first being the server itself and the
+        second being the <code class="classname">xmlrpcmsg</code> 
object.</p><p>The same php function can be registered as handler of multiple
+        xmlrpc methods.</p><p>Here is a more detailed example of what the 
handler function
+        <code class="function">foo</code> may do:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">&nbsp;&nbsp;</span><span style="color: 
#007700">function&nbsp;</span><span style="color: 
#0000BB">foo&nbsp;</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$xmlrpcmsg</span><span style="color: 
#007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span 
style="color: #0000BB">$xmlrpcerruser</span><span style="color: 
#007700">;&nbsp;</span><span style="color: 
#FF8000">//&nbsp;import&nbsp;user&nbsp;errcode&nbsp;base&nbsp;value<br /><br 
/>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">$meth&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">$xmlrpcmsg</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">method</span><span 
style="color: #007700">();&nbsp;</span><span style="color: 
#FF8000">//&nbsp;retrieve&nbsp;method&nbsp;name<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">$par&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">$xmlrpcmsg</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">getParam</span><span 
style="color: #007700">(</span><span style="color: #0000BB">0</span><span 
style="color: #007700">);&nbsp;</span><span style="color: 
#FF8000">//&nbsp;retrieve&nbsp;value&nbsp;of&nbsp;first&nbsp;parameter&nbsp;-&nbsp;assumes&nbsp;at&nbsp;least&nbsp;one&nbsp;param&nbsp;received<br
 />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">$val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">$par</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">scalarval</span><span 
style="color: #007700">();&nbsp;</span><span style="color: 
#FF8000">//&nbsp;decode&nbsp;value&nbsp;of&nbsp;first&nbsp;parameter&nbsp;-&nbsp;assumes&nbsp;it&nbsp;is&nbsp;a&nbsp;scalar&nbsp;value<br
 /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">...<br 
/><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: 
#0000BB">$err</span><span style="color: #007700">)&nbsp;{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#FF8000">//&nbsp;this&nbsp;is&nbsp;an&nbsp;error&nbsp;condition<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#007700">return&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcresp</span><span style="color: #007700">(</span><span 
style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span 
style="color: #0000BB">$xmlrpcerruser</span><span style="color: 
#007700">+</span><span style="color: #0000BB">1</span><span style="color: 
#007700">,&nbsp;</span><span style="color: 
#FF8000">//&nbsp;user&nbsp;error&nbsp;1<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"There's&nbsp;a&nbsp;problem,&nbsp;Captain"</span><span style="color: 
#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#FF8000">//&nbsp;this&nbsp;is&nbsp;a&nbsp;successful&nbsp;value&nbsp;being&nbsp;returned<br
 />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#007700">return&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcresp</span><span style="color: #007700">(new&nbsp;</span><span 
style="color: #0000BB">xmlrpcval</span><span style="color: 
#007700">(</span><span style="color: #DD0000">"All's&nbsp;fine!"</span><span 
style="color: #007700">,&nbsp;</span><span style="color: 
#DD0000">"string"</span><span style="color: #007700">));<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}</span>
+</span>
+</code></pre><p>See <code class="filename">server.php</code> in this 
distribution for
+        more examples of how to do this.</p><p>Since release 2.0RC3 there is a 
new, even simpler way of
+        registering php functions with the server. See section 5.7
+        below</p></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a id="id936453"></a>The dispatch 
map</h3></div></div></div><p>The first argument to the <code 
class="function">xmlrpc_server</code>
+        constructor is an array, called the <span 
class="emphasis"><em>dispatch map</em></span>.
+        In this array is the information the server needs to service the
+        XML-RPC methods you define.</p><p>The dispatch map takes the form of 
an associative array of
+        associative arrays: the outer array has one entry for each method, the
+        key being the method name. The corresponding value is another
+        associative array, which can have the following members:</p><div 
class="itemizedlist"><ul type="disc"><li><p><code class="function"><code 
class="literal">function</code></code> - this
+            entry is mandatory. It must be either a name of a function in the
+            global scope which services the XML-RPC method, or an array
+            containing an instance of an object and a static method name (for
+            static class methods the 'class::method' syntax is also
+            supported).</p></li><li><p><code class="function"><code 
class="literal">signature</code></code> - this
+            entry is an array containing the possible signatures (see <a 
class="xref" href="ch07s05.html#signatures" title="Method 
signatures">Signatures</a>) for the method. If this entry is present
+            then the server will check that the correct number and type of
+            parameters have been sent for this method before dispatching
+            it.</p></li><li><p><code class="function"><code 
class="literal">docstring</code></code> - this
+            entry is a string containing documentation for the method. The
+            documentation may contain HTML markup.</p></li><li><p><code 
class="literal">signature_docs</code> - this entry can be used
+            to provide documentation for the single parameters. It must match
+            in structure the 'signature' member. By default, only the
+            <code class="classname">documenting_xmlrpc_server</code> class in 
the
+            extras package will take advantage of this, since the
+            "system.methodHelp" protocol does not support documenting method
+            parameters individually.</p></li><li><p><code 
class="literal">parameters_type</code> - this entry can be used
+            when the server is working in 'xmlrpcvals' mode (see ...) to
+            define one or more entries in the dispatch map as being functions
+            that follow the 'phpvals' calling convention. The only useful
+            value is currently the string <code 
class="literal">phpvals</code>.</p></li></ul></div><p>Look at the <code 
class="filename">server.php</code> example in the
+        distribution to see what a dispatch map looks like.</p></div><div 
class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 
class="title"><a id="signatures"></a>Method 
signatures</h3></div></div></div><p>A signature is a description of a method's 
return type and its
+        parameter types. A method may have more than one 
signature.</p><p>Within a server's dispatch map, each method has an array of
+        possible signatures. Each signature is an array of types. The first
+        entry is the return type. For instance, the method </p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php&nbsp;string&nbsp;examples</span><span 
style="color: #007700">.</span><span style="color: 
#0000BB">getStateName</span><span style="color: #007700">(int)</span>
+</span>
+</code></pre><p> has the signature </p><pre class="programlisting"><code><span 
style="color: #000000">
+<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: 
#007700">array(</span><span style="color: #0000BB">$xmlrpcString</span><span 
style="color: #007700">,&nbsp;</span><span style="color: 
#0000BB">$xmlrpcInt</span><span style="color: #007700">)</span>
+</span>
+</code></pre><p> and, assuming that it is the only possible signature for the
+        method, it might be used like this in server creation: </p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$findstate_sig&nbsp;</span><span style="color: 
#007700">=&nbsp;array(array(</span><span style="color: 
#0000BB">$xmlrpcString</span><span style="color: #007700">,&nbsp;</span><span 
style="color: #0000BB">$xmlrpcInt</span><span style="color: #007700">));<br 
/><br /></span><span style="color: #0000BB">$findstate_doc&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#DD0000">'When&nbsp;passed&nbsp;an&nbsp;integer&nbsp;between&nbsp;1&nbsp;and&nbsp;51&nbsp;returns&nbsp;the<br
 
/>name&nbsp;of&nbsp;a&nbsp;US&nbsp;state,&nbsp;where&nbsp;the&nbsp;integer&nbsp;is&nbsp;the&nbsp;index&nbsp;of&nbsp;that&nbsp;state&nbsp;name<br
 />in&nbsp;an&nbsp;alphabetic&nbsp;order.'</span><span style="color: 
#007700">;<br /><br /></span><span style="color: #0000BB">$s&nbsp;</span><span 
style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_server</span><span style="color: #007700">(&nbsp;array(<br 
/>&nbsp;&nbsp;</span><span style="color: 
#DD0000">"examples.getStateName"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span 
style="color: #DD0000">"function"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: #DD0000">"findstate"</span><span 
style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span 
style="color: #DD0000">"signature"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: 
#0000BB">$findstate_sig</span><span style="color: #007700">,<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"docstring"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: #0000BB">$findstate_doc<br 
/>&nbsp;&nbsp;</span><span style="color: #007700">)));</span>
+</span>
+</code></pre><p>Note that method signatures do not allow to check nested
+        parameters, e.g. the number, names and types of the members of a
+        struct param cannot be validated.</p><p>If a method that you want to 
expose has a definite number of
+        parameters, but each of those parameters could reasonably be of
+        multiple types, the array of acceptable signatures will easily grow
+        into a combinatorial explosion. To avoid such a situation, the lib
+        defines the global var <code class="varname">$xmlrpcValue</code>, 
which can be
+        used in method signatures as a placeholder for 'any xmlrpc
+        type':</p><pre class="programlisting"><code><span style="color: 
#000000">
+<span style="color: #0000BB">$echoback_sig&nbsp;</span><span style="color: 
#007700">=&nbsp;array(array(</span><span style="color: 
#0000BB">$xmlrpcValue</span><span style="color: #007700">,&nbsp;</span><span 
style="color: #0000BB">$xmlrpcValue</span><span style="color: #007700">));<br 
/><br /></span><span style="color: #0000BB">$findstate_doc&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#DD0000">'Echoes&nbsp;back&nbsp;to&nbsp;the&nbsp;client&nbsp;the&nbsp;received&nbsp;value,&nbsp;regardless&nbsp;of&nbsp;its&nbsp;type'</span><span
 style="color: #007700">;<br /><br /></span><span style="color: 
#0000BB">$s&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_server</span><span style="color: #007700">(&nbsp;array(<br 
/>&nbsp;&nbsp;</span><span style="color: #DD0000">"echoBack"&nbsp;</span><span 
style="color: #007700">=&gt;&nbsp;array(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"function"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: #DD0000">"echoback"</span><span 
style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span 
style="color: #DD0000">"signature"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: 
#0000BB">$echoback_sig</span><span style="color: #007700">,&nbsp;</span><span 
style="color: 
#FF8000">//&nbsp;this&nbsp;sig&nbsp;guarantees&nbsp;that&nbsp;the&nbsp;method&nbsp;handler&nbsp;will&nbsp;be&nbsp;called&nbsp;with&nbsp;one&nbsp;and&nbsp;only&nbsp;one&nbsp;parameter<br
 />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"docstring"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: #0000BB">$echoback_doc<br 
/>&nbsp;&nbsp;</span><span style="color: #007700">)));</span>
+</span>
+</code></pre><p>Methods <code class="methodname">system.listMethods</code>,
+        <code class="methodname">system.methodHelp</code>,
+        <code class="methodname">system.methodSignature</code> and
+        <code class="methodname">system.multicall</code> are already defined 
by the
+        server, and should not be reimplemented (see Reserved Methods
+        below).</p></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a id="id936613"></a>Delaying the 
server response</h3></div></div></div><p>You may want to construct the server, 
but for some reason not
+        fulfill the request immediately (security verification, for instance).
+        If you omit to pass to the constructor the dispatch map or pass it a
+        second argument of <code class="literal">0</code> this will have the 
desired
+        effect. You can then use the <code class="function">service()</code> 
method of
+        the server class to service the request. For example:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$s&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_server</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$myDispMap</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: 
#007700">);&nbsp;</span><span style="color: 
#FF8000">//&nbsp;second&nbsp;parameter&nbsp;=&nbsp;0&nbsp;prevents&nbsp;automatic&nbsp;servicing&nbsp;of&nbsp;request<br
 /><br 
/>//&nbsp;...&nbsp;some&nbsp;code&nbsp;that&nbsp;does&nbsp;other&nbsp;stuff&nbsp;here<br
 /><br /></span><span style="color: #0000BB">$s</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">service</span><span 
style="color: #007700">();</span>
+</span>
+</code></pre><p>Note that the <code class="methodname">service</code> method 
will print
+        the complete result payload to screen and send appropriate HTTP
+        headers back to the client, but also return the response object. This
+        permits further manipulation of the response, possibly in combination
+        with output buffering.</p><p>To prevent the server from sending HTTP 
headers back to the
+        client, you can pass a second parameter with a value of
+        <code class="literal">TRUE</code> to the <code 
class="methodname">service</code>
+        method. In this case, the response payload will be returned instead of
+        the response object.</p><p>Xmlrpc requests retrieved by other means 
than HTTP POST bodies
+        can also be processed. For example:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$s&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_server</span><span style="color: #007700">();&nbsp;</span><span 
style="color: 
#FF8000">//&nbsp;not&nbsp;passing&nbsp;a&nbsp;dispatch&nbsp;map&nbsp;prevents&nbsp;automatic&nbsp;servicing&nbsp;of&nbsp;request<br
 /><br 
/>//&nbsp;...&nbsp;some&nbsp;code&nbsp;that&nbsp;does&nbsp;other&nbsp;stuff&nbsp;here,&nbsp;including&nbsp;setting&nbsp;dispatch&nbsp;map&nbsp;into&nbsp;server&nbsp;object<br
 /><br /></span><span style="color: #0000BB">$resp&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: 
#0000BB">service</span><span style="color: #007700">(</span><span style="color: 
#0000BB">$xmlrpc_request_body</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">true</span><span 
style="color: #007700">);&nbsp;</span><span style="color: 
#FF8000">//&nbsp;parse&nbsp;a&nbsp;variable&nbsp;instead&nbsp;of&nbsp;POST&nbsp;body,&nbsp;retrieve&nbsp;response&nbsp;payload<br
 /><br 
/>//&nbsp;...&nbsp;some&nbsp;code&nbsp;that&nbsp;does&nbsp;other&nbsp;stuff&nbsp;with&nbsp;xml&nbsp;response&nbsp;$resp&nbsp;here</span>
+</span>
+</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a id="id936662"></a>Modifying 
the server behaviour</h3></div></div></div><p>A couple of methods / class 
variables are available to modify
+        the behaviour of the server. The only way to take advantage of their
+        existence is by usage of a delayed server response (see above)</p><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a id="id936672"></a>setDebug()</h4></div></div></div><p>This 
function controls weather the server is going to echo
+          debugging messages back to the client as comments in response body.
+          Valid values: 0,1,2,3, with 1 being the default. At level 0, no
+          debug info is returned to the client. At level 2, the complete
+          client request is added to the response, as part of the xml
+          comments. At level 3, a new PHP error handler is set when executing
+          user functions exposed as server methods, and all non-fatal errors
+          are trapped and added as comments into the response.</p></div><div 
class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 
class="title"><a 
id="id936682"></a>allow_system_funcs</h4></div></div></div><p>Default_value: 
TRUE. When set to FALSE, disables support for
+          <code class="methodname">System.xxx</code> functions in the server. 
It
+          might be useful e.g. if you do not wish the server to respond to
+          requests to <code 
class="methodname">System.ListMethods</code>.</p></div><div class="sect3" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a 
id="id936700"></a>compress_response</h4></div></div></div><p>When set to TRUE, 
enables the server to take advantage of HTTP
+          compression, otherwise disables it. Responses will be transparently
+          compressed, but only when an xmlrpc-client declares its support for
+          compression in the HTTP headers of the request.</p><p>Note that the 
ZLIB php extension must be installed for this to
+          work. If it is, <code class="varname">compress_response</code> will 
default to
+          TRUE.</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id936718"></a>exception_handling</h4></div></div></div><p>This variable 
controls the behaviour of the server when an
+          exception is thrown by a method handler php function. Valid values:
+          0,1,2, with 0 being the default. At level 0, the server catches the
+          exception and return an 'internal error' xmlrpc response; at 1 it
+          catches the exceptions and return an xmlrpc response with the error
+          code and error message corresponding to the exception that was
+          thron; at 2 = the exception is floated to the upper layers in the
+          code</p></div><div class="sect3" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h4 class="title"><a 
id="id936729"></a>response_charset_encoding</h4></div></div></div><p>Charset 
encoding to be used for response (only affects string
+          values).</p><p>If it can, the server will convert the generated 
response from
+          internal_encoding to the intended one.</p><p>Valid values are: a 
supported xml encoding (only UTF-8 and
+          ISO-8859-1 at present, unless mbstring is enabled), null (leave
+          charset unspecified in response and convert output stream to
+          US_ASCII), 'default' (use xmlrpc library default as specified in
+          xmlrpc.inc, convert output stream if needed), or 'auto' (use
+          client-specified charset encoding or same as request if request
+          headers do not specify it (unless request is US-ASCII: then use
+          library default anyway).</p></div></div><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id936748"></a>Fault reporting</h3></div></div></div><p>Fault codes for your 
servers should start at the value indicated
+        by the global <code class="literal">$xmlrpcerruser</code> + 
1.</p><p>Standard errors returned by the server include:</p><div 
class="variablelist"><dl><dt><span class="term"><code class="literal">1</code> 
<span>Unknown method</span></span></dt><dd><p>Returned if the server was asked 
to dispatch a method it
+              didn't know about</p></dd><dt><span class="term"><code 
class="literal">2</code> <span>Invalid return
+            payload</span></span></dt><dd><p>This error is actually generated 
by the client, not
+              server, code, but signifies that a server returned something it
+              couldn't understand. A more detailed error report is sometimes
+              added onto the end of the phrase above.</p></dd><dt><span 
class="term"><code class="literal">3</code> <span>Incorrect
+            parameters</span></span></dt><dd><p>This error is generated when 
the server has signature(s)
+              defined for a method, and the parameters passed by the client do
+              not match any of signatures.</p></dd><dt><span 
class="term"><code class="literal">4</code> <span>Can't introspect: method
+            unknown</span></span></dt><dd><p>This error is generated by the 
builtin
+              <code class="function">system.*</code> methods when any kind of
+              introspection is attempted on a method undefined by the
+              server.</p></dd><dt><span class="term"><code 
class="literal">5</code> <span>Didn't receive 200 OK from
+            remote server</span></span></dt><dd><p>This error is generated by 
the client when a remote server
+              doesn't return HTTP/1.1 200 OK in response to a request. A more
+              detailed error report is added onto the end of the phrase
+              above.</p></dd><dt><span class="term"><code 
class="literal">6</code> <span>No data received from
+            server</span></span></dt><dd><p>This error is generated by the 
client when a remote server
+              returns HTTP/1.1 200 OK in response to a request, but no
+              response body follows the HTTP headers.</p></dd><dt><span 
class="term"><code class="literal">7</code> <span>No SSL support compiled
+            in</span></span></dt><dd><p>This error is generated by the client 
when trying to send
+              a request with HTTPS and the CURL extension is not available to
+              PHP.</p></dd><dt><span class="term"><code 
class="literal">8</code> <span>CURL error</span></span></dt><dd><p>This error 
is generated by the client when trying to send
+              a request with HTTPS and the HTTPS communication 
fails.</p></dd><dt><span class="term"><code class="literal">9-14</code> 
<span>multicall
+            errors</span></span></dt><dd><p>These errors are generated by the 
server when something
+              fails inside a system.multicall request.</p></dd><dt><span 
class="term"><code class="literal">100-</code> <span>XML parse
+            errors</span></span></dt><dd><p>Returns 100 plus the XML parser 
error code for the fault
+              that occurred. The <code class="function">faultString</code> 
returned
+              explains where the parse error was in the incoming XML
+              stream.</p></dd></dl></div></div><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id937308"></a>'New style' servers</h3></div></div></div><p>In the same 
spirit of simplification that inspired the
+        <code class="varname">xmlrpc_client::return_type</code> class 
variable, a new
+        class variable has been added to the server class:
+        <code class="varname">functions_parameters_type</code>. When set to 
'phpvals',
+        the functions registered in the server dispatch map will be called
+        with plain php values as parameters, instead of a single xmlrpcmsg
+        instance parameter. The return value of those functions is expected to
+        be a plain php value, too. An example is worth a thousand
+        words:</p><pre class="programlisting"><code><span style="color: 
#000000">
+<span style="color: #0000BB">&nbsp;&nbsp;</span><span style="color: 
#007700">function&nbsp;</span><span style="color: #0000BB">foo</span><span 
style="color: #007700">(</span><span style="color: #0000BB">$usr_id</span><span 
style="color: #007700">,&nbsp;</span><span style="color: 
#0000BB">$out_lang</span><span style="color: #007700">=</span><span 
style="color: #DD0000">'en'</span><span style="color: #007700">)&nbsp;{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: 
#0000BB">$xmlrpcerruser</span><span style="color: #007700">;<br /><br 
/>&nbsp;&nbsp;&nbsp;&nbsp;...<br /><br 
/>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: 
#0000BB">$someErrorCondition</span><span style="color: #007700">)<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;</span><span 
style="color: #0000BB">xmlrpcresp</span><span style="color: 
#007700">(</span><span style="color: #0000BB">0</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcerruser</span><span 
style="color: #007700">+</span><span style="color: #0000BB">1</span><span 
style="color: #007700">,&nbsp;</span><span style="color: 
#DD0000">'DOH!'</span><span style="color: #007700">);<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;else<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;array(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">'name'&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: #DD0000">'Joe'</span><span 
style="color: #007700">,<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">'age'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span 
style="color: #0000BB">27</span><span style="color: #007700">,<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">'picture'&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #0000BB">file_get_contents</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$picOfTheGuy</span><span 
style="color: #007700">),&nbsp;</span><span style="color: 
#DD0000">'base64'</span><span style="color: #007700">)<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;}<br /><br 
/>&nbsp;&nbsp;</span><span style="color: #0000BB">$s&nbsp;</span><span 
style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_server</span><span style="color: #007700">(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;array(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"examples.myFunc"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;array(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"function"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: 
#DD0000">"bar::foobar"</span><span style="color: #007700">,<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"signature"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;array(<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span
 style="color: #0000BB">$xmlrpcString</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcInt</span><span 
style="color: #007700">),<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span
 style="color: #0000BB">$xmlrpcString</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcInt</span><span 
style="color: #007700">,&nbsp;</span><span style="color: 
#0000BB">$xmlrpcString</span><span style="color: #007700">)<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;),&nbsp;</span><span style="color: 
#0000BB">false</span><span style="color: #007700">);<br 
/>&nbsp;&nbsp;</span><span style="color: #0000BB">$s</span><span style="color: 
#007700">-&gt;</span><span style="color: 
#0000BB">functions_parameters_type&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #DD0000">'phpvals'</span><span 
style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: 
#0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: 
#0000BB">service</span><span style="color: #007700">();</span>
+</span>
+</code></pre><p>There are a few things to keep in mind when using this
+        simplified syntax:</p><p>to return an xmlrpc error, the method handler 
function must
+        return an instance of <code class="classname">xmlrpcresp</code>. The 
only
+        other way for the server to know when an error response should be
+        served to the client is to throw an exception and set the server's
+        <code class="varname">exception_handling</code> memeber var to 
1;</p><p>to return a base64 value, the method handler function must
+        encode it on its own, creating an instance of an xmlrpcval
+        object;</p><p>the method handler function cannot determine the name of 
the
+        xmlrpc method it is serving, unlike standard handler functions that
+        can retrieve it from the message object;</p><p>when receiving nested 
parameters, the method handler function
+        has no way to distinguish a php string that was sent as base64 value
+        from one that was sent as a string value;</p><p>this has a direct 
consequence on the support of
+        system.multicall: a method whose signature contains datetime or base64
+        values will not be available to multicall calls;</p><p>last but not 
least, the direct parsing of xml to php values is
+        much faster than using xmlrpcvals, and allows the library to handle
+        much bigger messages without allocating all available server memory or
+        smashing PHP recursive call stack.</p></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch07s04.html">Prev</a> </td><td 
width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch08.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">xmlrpcresp </td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
Chapter 8. Global variables</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch08.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch08.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch08.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
8. Global variables</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch07s05.html" title="xmlrpc_server" /><link rel="next" 
href="ch08s02.html" title="Variables whose value can be modified" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">Chapter 8. Global 
variables</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch07s05.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="ch08s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="globalvars"></a>Chapter 8. Global variables</h2></div></div></div><div 
class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a 
href="ch08.html#id937374">"Constant" variables</a></span></dt><dd><dl><dt><span 
class="sect2"><a 
href="ch08.html#id937380">$xmlrpcerruser</a></span></dt><dt><span 
class="sect2"><a href="ch08.html#id937400">$xmlrpcI4, $xmlrpcInt, 
$xmlrpcBoolean, $xmlrpcDouble,
+        $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray,
+        $xmlrpcStruct, $xmlrpcValue, $xmlrpcNull</a></span></dt><dt><span 
class="sect2"><a href="ch08.html#id937415">$xmlrpcTypes, $xmlrpc_valid_parents, 
$xmlrpcerr, $xmlrpcstr,
+        $xmlrpcerrxml, $xmlrpc_backslash, $_xh, $xml_iso88591_Entities,
+        $xmlEntities, $xmlrpcs_capabilities</a></span></dt></dl></dd><dt><span 
class="sect1"><a href="ch08s02.html">Variables whose value can be 
modified</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch08s02.html#xmlrpc-defencoding">xmlrpc_defencoding</a></span></dt><dt><span
 class="sect2"><a 
href="ch08s02.html#id937475">xmlrpc_internalencoding</a></span></dt><dt><span 
class="sect2"><a 
href="ch08s02.html#id937501">xmlrpcName</a></span></dt><dt><span 
class="sect2"><a 
href="ch08s02.html#id937522">xmlrpcVersion</a></span></dt><dt><span 
class="sect2"><a 
href="ch08s02.html#id937542">xmlrpc_null_extension</a></span></dt><dt><span 
class="sect2"><a 
href="ch08s02.html#id937560">xmlrpc_null_apache_encoding</a></span></dt></dl></dd></dl></div><p>Many
 global variables are defined in the xmlrpc.inc file. Some of
+    those are meant to be used as constants (and modifying their value might
+    cause unpredictable behaviour), while some others can be modified in your
+    php scripts to alter the behaviour of the xml-rpc client and
+    server.</p><div class="sect1" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h2 class="title" style="clear: both"><a 
id="id937374"></a>"Constant" variables</h2></div></div></div><div class="sect2" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id937380"></a>$xmlrpcerruser</h3></div></div></div><p><code 
class="fieldsynopsis"><span class="varname">$xmlrpcerruser </span><span 
class="initializer">= 800</span>;</code>The minimum value for errors reported 
by user
+        implemented XML-RPC servers. Error numbers lower than that are
+        reserved for library usage.</p></div><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id937400"></a>$xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble,
+        $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray,
+        $xmlrpcStruct, $xmlrpcValue, $xmlrpcNull</h3></div></div></div><p>For 
convenience the strings representing the XML-RPC types have
+        been encoded as global variables:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$xmlrpcI4</span><span style="color: 
#007700">=</span><span style="color: #DD0000">"i4"</span><span style="color: 
#007700">;<br /></span><span style="color: #0000BB">$xmlrpcInt</span><span 
style="color: #007700">=</span><span style="color: #DD0000">"int"</span><span 
style="color: #007700">;<br /></span><span style="color: 
#0000BB">$xmlrpcBoolean</span><span style="color: #007700">=</span><span 
style="color: #DD0000">"boolean"</span><span style="color: #007700">;<br 
/></span><span style="color: #0000BB">$xmlrpcDouble</span><span style="color: 
#007700">=</span><span style="color: #DD0000">"double"</span><span 
style="color: #007700">;<br /></span><span style="color: 
#0000BB">$xmlrpcString</span><span style="color: #007700">=</span><span 
style="color: #DD0000">"string"</span><span style="color: #007700">;<br 
/></span><span style="color: #0000BB">$xmlrpcDateTime</span><span style="color: 
#007700">=</span><span style="color: #DD0000">"dateTime.iso8601"</span><span 
style="color: #007700">;<br /></span><span style="color: 
#0000BB">$xmlrpcBase64</span><span style="color: #007700">=</span><span 
style="color: #DD0000">"base64"</span><span style="color: #007700">;<br 
/></span><span style="color: #0000BB">$xmlrpcArray</span><span style="color: 
#007700">=</span><span style="color: #DD0000">"array"</span><span style="color: 
#007700">;<br /></span><span style="color: #0000BB">$xmlrpcStruct</span><span 
style="color: #007700">=</span><span style="color: 
#DD0000">"struct"</span><span style="color: #007700">;<br /></span><span 
style="color: #0000BB">$xmlrpcValue</span><span style="color: 
#007700">=</span><span style="color: #DD0000">"undefined"</span><span 
style="color: #007700">;<br /></span><span style="color: 
#0000BB">$xmlrpcNull</span><span style="color: #007700">=</span><span 
style="color: #DD0000">"null"</span><span style="color: #007700">;</span>
+</span>
+</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="id937415"></a>$xmlrpcTypes, $xmlrpc_valid_parents, $xmlrpcerr, $xmlrpcstr,
+        $xmlrpcerrxml, $xmlrpc_backslash, $_xh, $xml_iso88591_Entities,
+        $xmlEntities, $xmlrpcs_capabilities</h3></div></div></div><p>Reserved 
for internal usage.</p></div></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch07s05.html">Prev</a> </td><td width="20%" align="center"> 
</td><td width="40%" align="right"> <a accesskey="n" 
href="ch08s02.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">xmlrpc_server </td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
Variables whose value can be modified</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch08s02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch08s02.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch08s02.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Variables 
whose value can be modified</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch08.html" title="Chapter 8. Global variables" /><link 
rel="prev" href="ch08.html" title="Chapter 8. Global variables" /><link 
rel="next" href="ch09.html" title="Chapter 9. Helper functions" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">Variables whose value can be 
modified</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch08.html">Prev</a> </td><th width="60%" align="center">Chapter 8. Global 
variables</th><td width="20%" align="right"> <a accesskey="n" 
href="ch09.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id937427"></a>Variables whose value can be 
modified</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="xmlrpc-defencoding"></a>xmlrpc_defencoding</h3></div></div></div><code 
class="fieldsynopsis"><span class="varname">$xmlrpc_defencoding </span><span 
class="initializer">= "UTF8"</span>;</code><p>This variable defines the 
character set encoding that will be
+        used by the xml-rpc client and server to decode the received messages,
+        when a specific charset declaration is not found (in the messages sent
+        non-ascii chars are always encoded using character references, so that
+        the produced xml is valid regardless of the charset encoding
+        assumed).</p><p>Allowed values: <code class="literal">"UTF8"</code>,
+        <code class="literal">"ISO-8859-1"</code>, <code 
class="literal">"ASCII".</code></p><p>Note that the appropriate RFC actually 
mandates that XML
+        received over HTTP without indication of charset encoding be treated
+        as US-ASCII, but many servers and clients 'in the wild' violate the
+        standard, and assume the default encoding is UTF-8.</p></div><div 
class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 
class="title"><a 
id="id937475"></a>xmlrpc_internalencoding</h3></div></div></div><p><code 
class="fieldsynopsis"><span class="varname">$xmlrpc_internalencoding 
</span><span class="initializer">= "ISO-8859-1"</span>;</code>This variable 
defines the character set encoding
+        that the library uses to transparently encode into valid XML the
+        xml-rpc values created by the user and to re-encode the received
+        xml-rpc values when it passes them to the PHP application. It only
+        affects xml-rpc values of string type. It is a separate value from
+        xmlrpc_defencoding, allowing e.g. to send/receive xml messages encoded
+        on-the-wire in US-ASCII and process them as UTF-8. It defaults to the
+        character set used internally by PHP (unless you are running an
+        MBString-enabled installation), so you should change it only in
+        special situations, if e.g. the string values exchanged in the xml-rpc
+        messages are directly inserted into / fetched from a database
+        configured to return UTF8 encoded strings to PHP. Example
+        usage:</p><pre class="programlisting"><code><span style="color: 
#000000">
+<span style="color: #0000BB"></span><span style="color: 
#007700">&lt;?</span><span style="color: #0000BB">php<br /><br /></span><span 
style="color: #007700">include(</span><span style="color: 
#DD0000">'xmlrpc.inc'</span><span style="color: #007700">);<br /></span><span 
style="color: #0000BB">$xmlrpc_internalencoding&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #DD0000">'UTF-8'</span><span 
style="color: #007700">;&nbsp;</span><span style="color: 
#FF8000">//&nbsp;this&nbsp;has&nbsp;to&nbsp;be&nbsp;set&nbsp;after&nbsp;the&nbsp;inclusion&nbsp;above<br
 /></span><span style="color: #0000BB">$v&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'κόσμε'</span><span style="color: 
#007700">);&nbsp;</span><span style="color: 
#FF8000">//&nbsp;This&nbsp;xmlrpc&nbsp;value&nbsp;will&nbsp;be&nbsp;correctly&nbsp;serialized&nbsp;as&nbsp;the&nbsp;greek&nbsp;word&nbsp;'kosme'</span>
+</span>
+</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="id937501"></a>xmlrpcName</h3></div></div></div><p><code 
class="fieldsynopsis"><span class="varname">$xmlrpcName </span><span 
class="initializer">= "XML-RPC for PHP"</span>;</code>The string representation 
of the name of the XML-RPC
+        for PHP library. It is used by the client for building the User-Agent
+        HTTP header that is sent with every request to the server. You can
+        change its value if you need to customize the User-Agent
+        string.</p></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="id937522"></a>xmlrpcVersion</h3></div></div></div><p><code 
class="fieldsynopsis"><span class="varname">$xmlrpcVersion </span><span 
class="initializer">= "2.2"</span>;</code>The string representation of the 
version number of
+        the XML-RPC for PHP library in use. It is used by the client for
+        building the User-Agent HTTP header that is sent with every request to
+        the server. You can change its value if you need to customize the
+        User-Agent string.</p></div><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="id937542"></a>xmlrpc_null_extension</h3></div></div></div><p>When set to 
<code class="constant">TRUE</code>, the lib will enable
+        support for the &lt;NIL/&gt; (and &lt;EX:NIL/&gt;) xmlrpc value, as
+        per the extension to the standard proposed here. This means that
+        &lt;NIL/&gt; and &lt;EX:NIL/&gt; tags received will be parsed as valid
+        xmlrpc, and the corresponding xmlrpcvals will return "null" for
+        <code class="methodname">scalarTyp()</code>.</p></div><div 
class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 
class="title"><a 
id="id937560"></a>xmlrpc_null_apache_encoding</h3></div></div></div><p>When set 
to <code class="literal">TRUE</code>, php NULL values encoded
+        into <code class="classname">xmlrpcval</code> objects get serialized 
using the
+        <code class="literal">&lt;EX:NIL/&gt;</code> tag instead of
+        <code class="literal">&lt;NIL/&gt;</code>. Please note that both forms 
are
+        always accepted as input regardless of the value of this
+        variable.</p></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch08.html">Prev</a> </td><td width="20%" align="center"><a 
accesskey="u" href="ch08.html">Up</a></td><td width="40%" align="right"> <a 
accesskey="n" href="ch09.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">Chapter 8. Global variables </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Chapter 9. Helper 
functions</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
9. Helper functions</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch08s02.html" title="Variables whose value can be modified" /><link 
rel="next" href="ch09s02.html" title="Easy use with nested PHP values" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">Chapter 9. Helper 
functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch08s02.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="ch09s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="helpers"></a>Chapter 9. Helper functions</h2></div></div></div><div 
class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a 
href="ch09.html#id937598">Date functions</a></span></dt><dd><dl><dt><span 
class="sect2"><a 
href="ch09.html#iso8601encode">iso8601_encode</a></span></dt><dt><span 
class="sect2"><a 
href="ch09.html#iso8601decode">iso8601_decode</a></span></dt></dl></dd><dt><span
 class="sect1"><a href="ch09s02.html">Easy use with nested PHP 
values</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch09s02.html#phpxmlrpcdecode">php_xmlrpc_decode</a></span></dt><dt><span 
class="sect2"><a 
href="ch09s02.html#phpxmlrpcencode">php_xmlrpc_encode</a></span></dt><dt><span 
class="sect2"><a 
href="ch09s02.html#id938212">php_xmlrpc_decode_xml</a></span></dt></dl></dd><dt><span
 class="sect1"><a href="ch09s03.html">Automatic conversion of php functions 
into xmlrpc methods (and
+      vice versa)</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch09s03.html#id938280">wrap_xmlrpc_method</a></span></dt><dt><span 
class="sect2"><a 
href="ch09s03.html#wrap_php_function">wrap_php_function</a></span></dt></dl></dd><dt><span
 class="sect1"><a href="ch09s04.html">Functions removed from the 
library</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch09s04.html#xmlrpcdecode">xmlrpc_decode</a></span></dt><dt><span 
class="sect2"><a 
href="ch09s04.html#xmlrpcencode">xmlrpc_encode</a></span></dt></dl></dd><dt><span
 class="sect1"><a href="ch09s05.html">Debugging 
aids</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch09s05.html#id938694">xmlrpc_debugmsg</a></span></dt></dl></dd></dl></div><p>XML-RPC
 for PHP contains some helper functions which you can use to
+    make processing of XML-RPC requests easier.</p><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id937598"></a>Date 
functions</h2></div></div></div><p>The XML-RPC specification has this to say on 
dates:</p><div class="blockquote"><blockquote class="blockquote"><p><a 
id="wrap_xmlrpc_method"></a>Don't assume a timezone. It should be
+        specified by the server in its documentation what assumptions it makes
+        about timezones.</p></blockquote></div><p>Unfortunately, this means 
that date processing isn't
+      straightforward. Although XML-RPC uses ISO 8601 format dates, it doesn't
+      use the timezone specifier.</p><p>We strongly recommend that in every 
case where you pass dates in
+      XML-RPC calls, you use UTC (GMT) as your timezone. Most computer
+      languages include routines for handling GMT times natively, and you
+      won't have to translate between timezones.</p><p>For more information 
about dates, see <a class="ulink" 
href="http://www.uic.edu/year2000/datefmt.html"; target="_top">ISO 8601: The 
Right
+      Format for Dates</a>, which has a handy link to a PDF of the ISO
+      8601 specification. Note that XML-RPC uses exactly one of the available
+      representations: CCYYMMDDTHH:MM:SS.</p><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="iso8601encode"></a>iso8601_encode</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">string<b 
class="fsfunc">iso8601_encode</b>(</code></td><td>string<var 
class="pdparam">$time_t</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$utc</var>0<code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Returns an ISO 8601 formatted date 
generated from the UNIX
+        timestamp <em class="parameter"><code>$time_t</code></em>, as returned 
by the PHP
+        function <code class="function">time()</code>.</p><p>The argument <em 
class="parameter"><code>$utc</code></em> can be omitted, in
+        which case it defaults to <code class="literal">0</code>. If it is set 
to
+        <code class="literal">1</code>, then the function corrects the time 
passed in
+        for UTC. Example: if you're in the GMT-6:00 timezone and set
+        <em class="parameter"><code>$utc</code></em>, you will receive a date 
representation
+        six hours ahead of your local time.</p><p>The included demo program 
<code class="filename">vardemo.php</code>
+        includes a demonstration of this function.</p></div><div class="sect2" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="iso8601decode"></a>iso8601_decode</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">int<b 
class="fsfunc">iso8601_decode</b>(</code></td><td>string<var 
class="pdparam">$isoString</var>, </td></tr><tr><td> </td><td>int<var 
class="pdparam">$utc</var>0<code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Returns a UNIX timestamp from an 
ISO 8601 encoded time and date
+        string passed in. If <em class="parameter"><code>$utc</code></em> is
+        <code class="literal">1</code> then <em 
class="parameter"><code>$isoString</code></em> is assumed
+        to be in the UTC timezone, and thus the result is also UTC: otherwise,
+        the timezone is assumed to be your local timezone and you receive a
+        local timestamp.</p></div></div></div><div class="navfooter"><hr 
/><table width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"><a accesskey="p" href="ch08s02.html">Prev</a> </td><td width="20%" 
align="center"> </td><td width="40%" align="right"> <a accesskey="n" 
href="ch09s02.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Variables whose value can be modified </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Easy use with nested PHP 
values</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s02.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s02.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Easy use 
with nested PHP values</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch09.html" title="Chapter 9. Helper functions" /><link 
rel="prev" href="ch09.html" title="Chapter 9. Helper functions" /><link 
rel="next" href="ch09s03.html" title="Automatic conversion of php functions 
into xmlrpc methods (and vice versa)" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Easy use with nested PHP values</th></tr><tr><td 
width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><th 
width="60%" align="center">Chapter 9. Helper functions</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch09s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="arrayuse"></a>Easy use with nested PHP 
values</h2></div></div></div><p>Dan Libby was kind enough to contribute two 
helper functions that
+      make it easier to translate to and from PHP values. This makes it easier
+      to deal with complex structures. At the moment support is limited to
+      <span class="type">int</span>, <span class="type">double</span>, <span 
class="type">string</span>,
+      <span class="type">array</span>, <span class="type">datetime</span> and 
<span class="type">struct</span>
+      datatypes; note also that all PHP arrays are encoded as structs, except
+      arrays whose keys are integer numbers starting with 0 and incremented by
+      1.</p><p>These functions reside in <code 
class="filename">xmlrpc.inc</code>.</p><div class="sect2" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a 
id="phpxmlrpcdecode"></a>php_xmlrpc_decode</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">mixed<b 
class="fsfunc">php_xmlrpc_decode</b>(</code></td><td>xmlrpcval<var 
class="pdparam">$xmlrpc_val</var>, </td></tr><tr><td> </td><td>array<var 
class="pdparam">$options</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">array<b 
class="fsfunc">php_xmlrpc_decode</b>(</code></td><td>xmlrpcmsg<var 
class="pdparam">$xmlrpcmsg_val</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$options</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Returns a native PHP value 
corresponding to the values found in
+        the <span class="type">xmlrpcval</span> <em 
class="parameter"><code>$xmlrpc_val</code></em>,
+        translated into PHP types. Base-64 and datetime values are
+        automatically decoded to strings.</p><p>In the second form, returns an 
array containing the parameters
+        of the given
+        <em class="parameter"><code><code 
class="classname">xmlrpcmsg</code>_val</code></em>, decoded
+        to php types.</p><p>The <em 
class="parameter"><code>options</code></em> parameter is optional. If
+        specified, it must consist of an array of options to be enabled in the
+        decoding process. At the moment the only valid option are
+        <span class="symbol">decode_php_objs</span> and
+        <code class="literal">dates_as_objects</code>. When the first is set, 
php
+        objects that have been converted to xml-rpc structs using the
+        <code class="function">php_xmlrpc_encode</code> function and a 
corresponding
+        encoding option will be converted back into object values instead of
+        arrays (provided that the class definition is available at
+        reconstruction time). When the second is set, XML-RPC datetime values
+        will be converted into native <code class="classname">dateTime</code> 
objects
+        instead of strings.</p><p><span class="emphasis"><em><span 
class="emphasis"><em>WARNING</em></span>:</em></span> please take
+        extreme care before enabling the <span 
class="symbol">decode_php_objs</span>
+        option: when php objects are rebuilt from the received xml, their
+        constructor function will be silently invoked. This means that you are
+        allowing the remote end to trigger execution of uncontrolled PHP code
+        on your server, opening the door to code injection exploits. Only
+        enable this option when you have complete trust of the remote
+        server/client.</p><p>Example:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB"></span><span style="color: 
#FF8000">//&nbsp;wrapper&nbsp;to&nbsp;expose&nbsp;an&nbsp;existing&nbsp;php&nbsp;function&nbsp;as&nbsp;xmlrpc&nbsp;method&nbsp;handler<br
 /></span><span style="color: #007700">function&nbsp;</span><span style="color: 
#0000BB">foo_wrapper</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$m</span><span style="color: #007700">)<br />{<br 
/>&nbsp;&nbsp;</span><span style="color: #0000BB">$params&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#0000BB">php_xmlrpc_decode</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$m</span><span style="color: #007700">);<br 
/>&nbsp;&nbsp;</span><span style="color: #0000BB">$retval&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#0000BB">call_user_func_array</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'foo'</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">$params</span><span 
style="color: #007700">);<br />&nbsp;&nbsp;return&nbsp;new&nbsp;</span><span 
style="color: #0000BB">xmlrpcresp</span><span style="color: 
#007700">(new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span 
style="color: #007700">(</span><span style="color: #0000BB">$retval</span><span 
style="color: #007700">));&nbsp;</span><span style="color: 
#FF8000">//&nbsp;foo&nbsp;return&nbsp;value&nbsp;will&nbsp;be&nbsp;serialized&nbsp;as&nbsp;string<br
 /></span><span style="color: #007700">}<br /><br /></span><span style="color: 
#0000BB">$s&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_server</span><span style="color: #007700">(array(<br 
/>&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"examples.myFunc1"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span 
style="color: #DD0000">"function"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: 
#DD0000">"foo_wrapper"</span><span style="color: #007700">,<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#DD0000">"signatures"&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;...<br />&nbsp;&nbsp;)));</span>
+</span>
+</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="phpxmlrpcencode"></a>php_xmlrpc_encode</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcval<b 
class="fsfunc">php_xmlrpc_encode</b>(</code></td><td>mixed<var 
class="pdparam">$phpval</var>, </td></tr><tr><td> </td><td>array<var 
class="pdparam">$options</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Returns an <span 
class="type">xmlrpcval</span> object populated with the PHP
+        values in <em class="parameter"><code>$phpval</code></em>. Works 
recursively on arrays
+        and objects, encoding numerically indexed php arrays into array-type
+        xmlrpcval objects and non numerically indexed php arrays into
+        struct-type xmlrpcval objects. Php objects are encoded into
+        struct-type xmlrpcvals, excepted for php values that are already
+        instances of the xmlrpcval class or descendants thereof, which will
+        not be further encoded. Note that there's no support for encoding php
+        values into base-64 values. Encoding of date-times is optionally
+        carried on on php strings with the correct format.</p><p>The <em 
class="parameter"><code>options</code></em> parameter is optional. If
+        specified, it must consist of an array of options to be enabled in the
+        encoding process. At the moment the only valid options are
+        <span class="symbol">encode_php_objs</span>, <code 
class="literal">null_extension</code>
+        and <span class="symbol">auto_dates</span>.</p><p>The first will 
enable the creation of 'particular' xmlrpcval
+        objects out of php objects, that add a "php_class" xml attribute to
+        their serialized representation. This attribute allows the function
+        php_xmlrpc_decode to rebuild the native php objects (provided that the
+        same class definition exists on both sides of the communication). The
+        second allows to encode php <code class="literal">NULL</code> values 
to the
+        <code class="literal">&lt;NIL/&gt;</code> (or
+        <code class="literal">&lt;EX:NIL/&gt;</code>, see ...) tag. The last 
encodes any
+        string that matches the ISO8601 format into an XML-RPC
+        datetime.</p><p>Example:</p><pre class="programlisting"><code><span 
style="color: #000000">
+<span style="color: #0000BB"></span><span style="color: 
#FF8000">//&nbsp;the&nbsp;easy&nbsp;way&nbsp;to&nbsp;build&nbsp;a&nbsp;complex&nbsp;xml-rpc&nbsp;struct,&nbsp;showing&nbsp;nested&nbsp;base64&nbsp;value&nbsp;and&nbsp;datetime&nbsp;values<br
 /></span><span style="color: #0000BB">$val&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: 
#0000BB">php_xmlrpc_encode</span><span style="color: #007700">(array(<br 
/>&nbsp;&nbsp;</span><span style="color: 
#DD0000">'first&nbsp;struct_element:&nbsp;an&nbsp;int'&nbsp;</span><span 
style="color: #007700">=&gt;&nbsp;</span><span style="color: 
#0000BB">666</span><span style="color: #007700">,<br />&nbsp;&nbsp;</span><span 
style="color: #DD0000">'second:&nbsp;an&nbsp;array'&nbsp;</span><span 
style="color: #007700">=&gt;&nbsp;array&nbsp;(</span><span style="color: 
#DD0000">'apple'</span><span style="color: #007700">,&nbsp;</span><span 
style="color: #DD0000">'orange'</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">'banana'</span><span 
style="color: #007700">),<br />&nbsp;&nbsp;</span><span style="color: 
#DD0000">'third:&nbsp;a&nbsp;base64&nbsp;element'&nbsp;</span><span 
style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'hello&nbsp;world'</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #DD0000">'base64'</span><span 
style="color: #007700">),<br />&nbsp;&nbsp;</span><span style="color: 
#DD0000">'fourth:&nbsp;a&nbsp;datetime'&nbsp;</span><span style="color: 
#007700">=&gt;&nbsp;</span><span style="color: #DD0000">'20060107T01:53:00'<br 
/>&nbsp;&nbsp;</span><span style="color: #007700">),&nbsp;array(</span><span 
style="color: #DD0000">'auto_dates'</span><span style="color: 
#007700">));</span>
+</span>
+</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="id938212"></a>php_xmlrpc_decode_xml</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcval | xmlrpcresp |
+            xmlrpcmsg<b 
class="fsfunc">php_xmlrpc_decode_xml</b>(</code></td><td>string<var 
class="pdparam">$xml</var>, </td></tr><tr><td> </td><td>array<var 
class="pdparam">$options</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Decodes the xml representation of 
either an xmlrpc request,
+        response or single value, returning the corresponding php-xmlrpc
+        object, or <code class="literal">FALSE</code> in case of an 
error.</p><p>The <em class="parameter"><code>options</code></em> parameter is 
optional. If
+        specified, it must consist of an array of options to be enabled in the
+        decoding process. At the moment, no option is 
supported.</p><p>Example:</p><pre class="programlisting"><code><span 
style="color: #000000">
+<span style="color: #0000BB">$text&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: 
#DD0000">'&lt;value&gt;&lt;array&gt;&lt;data&gt;&lt;value&gt;Hello&nbsp;world&lt;/value&gt;&lt;/data&gt;&lt;/array&gt;&lt;/value&gt;'</span><span
 style="color: #007700">;<br /></span><span style="color: 
#0000BB">$val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">php_xmlrpc_decode_xml</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$text</span><span style="color: 
#007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$val</span><span 
style="color: #007700">)&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">'Found&nbsp;a&nbsp;value&nbsp;of&nbsp;type&nbsp;'</span><span 
style="color: #007700">.</span><span style="color: #0000BB">$val</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">kindOf</span><span style="color: 
#007700">();&nbsp;else&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">'Found&nbsp;invalid&nbsp;xml'</span><span style="color: 
#007700">;</span>
+</span>
+</code></pre></div></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch09.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" 
href="ch09.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" 
href="ch09s03.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Chapter 9. Helper functions </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> Automatic conversion of php functions into xmlrpc methods (and
+      vice versa)</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s03.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s03.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s03.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Automatic 
conversion of php functions into xmlrpc methods (and vice versa)</title><link 
rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" 
content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" 
title="XML-RPC for PHP" /><link rel="up" href="ch09.html" title="Chapter 9. 
Helper functions" /><link rel="prev" href="ch09s02.html" title="Easy use with 
nested PHP values" /><link rel="next" href="ch09s04.html" title="Functions 
removed from the library" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" 
align="center">Automatic conversion of php functions into xmlrpc methods (and
+      vice versa)</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch09s02.html">Prev</a> </td><th width="60%" align="center">Chapter 9. 
Helper functions</th><td width="20%" align="right"> <a accesskey="n" 
href="ch09s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id938271"></a>Automatic conversion of php functions 
into xmlrpc methods (and
+      vice versa)</h2></div></div></div><p>For the extremely lazy coder, 
helper functions have been added
+      that allow to convert a php function into an xmlrpc method, and a
+      remotely exposed xmlrpc method into a local php function - or a set of
+      methods into a php class. Note that these comes with many 
caveat.</p><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="id938280"></a>wrap_xmlrpc_method</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">string<b 
class="fsfunc">wrap_xmlrpc_method</b>(</code></td><td>$client, 
</td></tr><tr><td> </td><td>$methodname, </td></tr><tr><td> 
</td><td>$extra_options<code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div><table border="0" summary="Function 
synopsis" cellspacing="0" cellpadding="0" 
class="funcprototype-table"><tr><td><code class="funcdef">string<b 
class="fsfunc">wrap_xmlrpc_method</b>(</code></td><td>$client, 
</td></tr><tr><td> </td><td>$methodname, </td></tr><tr><td> </td><td>$signum, 
</td></tr><tr><td> </td><td>$timeout, </td></tr><tr><td> </td><td>$protocol, 
</td></tr><tr><td> </td><td>$funcname<code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Given an xmlrpc server and a 
method name, creates a php wrapper
+        function that will call the remote method and return results using
+        native php types for both params and results. The generated php
+        function will return an xmlrpcresp object for failed xmlrpc
+        calls.</p><p>The second syntax is deprecated, and is listed here only 
for
+        backward compatibility.</p><p>The server must support the
+        <code class="methodname">system.methodSignature</code> xmlrpc method 
call for
+        this function to work.</p><p>The <em 
class="parameter"><code>client</code></em> param must be a valid
+        xmlrpc_client object, previously created with the address of the
+        target xmlrpc server, and to which the preferred communication options
+        have been set.</p><p>The optional parameters can be passed as array 
key,value pairs
+        in the <em class="parameter"><code>extra_options</code></em> 
param.</p><p>The <em class="parameter"><code>signum</code></em> optional param 
has the purpose
+        of indicating which method signature to use, if the given server
+        method has multiple signatures (defaults to 0).</p><p>The <em 
class="parameter"><code>timeout</code></em> and
+        <em class="parameter"><code>protocol</code></em> optional params are 
the same as in the
+        <code class="methodname">xmlrpc_client::send()</code> method.</p><p>If 
set, the optional <em class="parameter"><code>new_function_name</code></em>
+        parameter indicates which name should be used for the generated
+        function. In case it is not set the function name will be
+        auto-generated.</p><p>If the <code 
class="literal">return_source</code> optional parameter is
+        set, the function will return the php source code to build the wrapper
+        function, instead of evaluating it (useful to save the code and use it
+        later as stand-alone xmlrpc client).</p><p>If the <code 
class="literal">encode_php_objs</code> optional parameter is
+        set, instances of php objects later passed as parameters to the newly
+        created function will receive a 'special' treatment that allows the
+        server to rebuild them as php objects instead of simple arrays. Note
+        that this entails using a "slightly augmented" version of the xmlrpc
+        protocol (ie. using element attributes), which might not be understood
+        by xmlrpc servers implemented using other libraries.</p><p>If the 
<code class="literal">decode_php_objs</code> optional parameter is
+        set, instances of php objects that have been appropriately encoded by
+        the server using a coordinate option will be deserialized as php
+        objects instead of simple arrays (the same class definition should be
+        present server side and client side).</p><p><span 
class="emphasis"><em>Note that this might pose a security risk</em></span>,
+        since in order to rebuild the object instances their constructor
+        method has to be invoked, and this means that the remote server can
+        trigger execution of unforeseen php code on the client: not really a
+        code injection, but almost. Please enable this option only when you
+        trust the remote server.</p><p>In case of an error during generation 
of the wrapper function,
+        FALSE is returned, otherwise the name (or source code) of the new
+        function.</p><p>Known limitations: server must support
+        <code class="methodname">system.methodsignature</code> for the wanted 
xmlrpc
+        method; for methods that expose multiple signatures, only one can be
+        picked; for remote calls with nested xmlrpc params, the caller of the
+        generated php function has to encode on its own the params passed to
+        the php function if these are structs or arrays whose (sub)members
+        include values of type base64.</p><p>Note: calling the generated php 
function 'might' be slow: a new
+        xmlrpc client is created on every invocation and an xmlrpc-connection
+        opened+closed. An extra 'debug' param is appended to the parameter
+        list of the generated php function, useful for debugging
+        purposes.</p><p>Example usage:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$c&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span 
style="color: 
#DD0000">'http://phpxmlrpc.sourceforge.net/server.php'</span><span 
style="color: #007700">);<br /><br /></span><span style="color: 
#0000BB">$function&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">wrap_xmlrpc_method</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$client</span><span style="color: 
#007700">,&nbsp;</span><span style="color: 
#DD0000">'examples.getStateName'</span><span style="color: #007700">);<br /><br 
/>if&nbsp;(!</span><span style="color: #0000BB">$function</span><span 
style="color: #007700">)<br />&nbsp;&nbsp;die(</span><span style="color: 
#DD0000">'Cannot&nbsp;introspect&nbsp;remote&nbsp;method'</span><span 
style="color: #007700">);<br />else&nbsp;{<br />&nbsp;&nbsp;</span><span 
style="color: #0000BB">$stateno&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">15</span><span 
style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: 
#0000BB">$statename&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$function</span><span 
style="color: #007700">(</span><span style="color: #0000BB">$a</span><span 
style="color: #007700">);<br />&nbsp;&nbsp;if&nbsp;(</span><span style="color: 
#0000BB">is_a</span><span style="color: #007700">(</span><span style="color: 
#0000BB">$statename</span><span style="color: #007700">,&nbsp;</span><span 
style="color: #DD0000">'xmlrpcresp'</span><span style="color: 
#007700">))&nbsp;</span><span style="color: 
#FF8000">//&nbsp;call&nbsp;failed<br />&nbsp;&nbsp;</span><span style="color: 
#007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">'Call&nbsp;failed:&nbsp;'</span><span style="color: 
#007700">.</span><span style="color: #0000BB">$statename</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">faultCode</span><span style="color: #007700">().</span><span 
style="color: 
#DD0000">'.&nbsp;Calling&nbsp;again&nbsp;with&nbsp;debug&nbsp;on'</span><span 
style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span 
style="color: #0000BB">$function</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$a</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">true</span><span 
style="color: #007700">);<br />&nbsp;&nbsp;}<br />&nbsp;&nbsp;else<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: 
#DD0000">"OK,&nbsp;state&nbsp;nr.&nbsp;</span><span style="color: 
#0000BB">$stateno</span><span style="color: #DD0000">&nbsp;is&nbsp;</span><span 
style="color: #0000BB">$statename</span><span style="color: 
#DD0000">"</span><span style="color: #007700">;<br />}</span>
+</span>
+</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="wrap_php_function"></a>wrap_php_function</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">array<b 
class="fsfunc">wrap_php_function</b>(</code></td><td>string<var 
class="pdparam">$funcname</var>, </td></tr><tr><td> </td><td>string<var 
class="pdparam">$wrapper_function_name</var>, </td></tr><tr><td> 
</td><td>array<var 
class="pdparam">$extra_options</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Given a user-defined PHP function, 
create a PHP 'wrapper'
+        function that can be exposed as xmlrpc method from an xmlrpc_server
+        object and called from remote clients, and return the appropriate
+        definition to be added to a server's dispatch map.</p><p>The optional 
<em class="parameter"><code>$wrapper_function_name</code></em>
+        specifies the name that will be used for the auto-generated
+        function.</p><p>Since php is a typeless language, to infer types of 
input and
+        output parameters, it relies on parsing the javadoc-style comment
+        block associated with the given function. Usage of xmlrpc native types
+        (such as datetime.dateTime.iso8601 and base64) in the docblock @param
+        tag is also allowed, if you need the php function to receive/send data
+        in that particular format (note that base64 encoding/decoding is
+        transparently carried out by the lib, while datetime vals are passed
+        around as strings).</p><p>Known limitations: requires PHP 5.0.3 +; 
only works for
+        user-defined functions, not for PHP internal functions (reflection
+        does not support retrieving number/type of params for those); the
+        wrapped php function will not be able to programmatically return an
+        xmlrpc error response.</p><p>If the <code 
class="literal">return_source</code> optional parameter is
+        set, the function will return the php source code to build the wrapper
+        function, instead of evaluating it (useful to save the code and use it
+        later in a stand-alone xmlrpc server). It will be in the stored in the
+        <code class="literal">source</code> member of the returned 
array.</p><p>If the <code class="literal">suppress_warnings</code> optional 
parameter
+        is set, any runtime warning generated while processing the
+        user-defined php function will be catched and not be printed in the
+        generated xml response.</p><p>If the <em 
class="parameter"><code>extra_options</code></em> array contains the
+        <code class="literal">encode_php_objs</code> value, wrapped functions 
returning
+        php objects will generate "special" xmlrpc responses: when the xmlrpc
+        decoding of those responses is carried out by this same lib, using the
+        appropriate param in php_xmlrpc_decode(), the objects will be
+        rebuilt.</p><p>In short: php objects can be serialized, too (except 
for their
+        resource members), using this function. Other libs might choke on the
+        very same xml that will be generated in this case (i.e. it has a
+        nonstandard attribute on struct element tags)</p><p>If the <code 
class="literal">decode_php_objs</code> optional parameter is
+        set, instances of php objects that have been appropriately encoded by
+        the client using a coordinate option will be deserialized and passed
+        to the user function as php objects instead of simple arrays (the same
+        class definition should be present server side and client
+        side).</p><p><span class="emphasis"><em>Note that this might pose a 
security risk</em></span>,
+        since in order to rebuild the object instances their constructor
+        method has to be invoked, and this means that the remote client can
+        trigger execution of unforeseen php code on the server: not really a
+        code injection, but almost. Please enable this option only when you
+        trust the remote clients.</p><p>Example usage:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: 
#FF8000">/**<br 
/>*&nbsp;State&nbsp;name&nbsp;from&nbsp;state&nbsp;number&nbsp;decoder.&nbsp;NB:&nbsp;do&nbsp;NOT&nbsp;remove&nbsp;this&nbsp;comment&nbsp;block.<br
 />*&nbsp;@param&nbsp;integer&nbsp;$stateno&nbsp;the&nbsp;state&nbsp;number<br 
/>*&nbsp;@return&nbsp;string&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;state&nbsp;(or&nbsp;error&nbsp;description)<br
 />*/<br /></span><span style="color: #007700">function&nbsp;</span><span 
style="color: #0000BB">findstate</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$stateno</span><span 
style="color: #007700">)<br />{<br />&nbsp;&nbsp;global&nbsp;</span><span 
style="color: #0000BB">$stateNames</span><span style="color: #007700">;<br 
/>&nbsp;&nbsp;if&nbsp;(isset(</span><span style="color: 
#0000BB">$stateNames</span><span style="color: #007700">[</span><span 
style="color: #0000BB">$stateno</span><span style="color: 
#007700">-</span><span style="color: #0000BB">1</span><span style="color: 
#007700">]))<br />&nbsp;&nbsp;{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: 
#0000BB">$stateNames</span><span style="color: #007700">[</span><span 
style="color: #0000BB">$stateno</span><span style="color: 
#007700">-</span><span style="color: #0000BB">1</span><span style="color: 
#007700">];<br />&nbsp;&nbsp;}<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: 
#DD0000">"I&nbsp;don't&nbsp;have&nbsp;a&nbsp;state&nbsp;for&nbsp;the&nbsp;index&nbsp;'"&nbsp;</span><span
 style="color: #007700">.&nbsp;</span><span style="color: 
#0000BB">$stateno&nbsp;</span><span style="color: #007700">.&nbsp;</span><span 
style="color: #DD0000">"'"</span><span style="color: #007700">;<br 
/>&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: 
#FF8000">//&nbsp;wrap&nbsp;php&nbsp;function,&nbsp;build&nbsp;xmlrpc&nbsp;server<br
 /></span><span style="color: #0000BB">$methods&nbsp;</span><span style="color: 
#007700">=&nbsp;array();<br /></span><span style="color: 
#0000BB">$findstate_sig&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: 
#0000BB">wrap_php_function</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'findstate'</span><span style="color: #007700">);<br 
/>if&nbsp;(</span><span style="color: #0000BB">$findstate_sig</span><span 
style="color: #007700">)<br />&nbsp;&nbsp;</span><span style="color: 
#0000BB">$methods</span><span style="color: #007700">[</span><span 
style="color: #DD0000">'examples.getStateName'</span><span style="color: 
#007700">]&nbsp;=&nbsp;</span><span style="color: 
#0000BB">$findstate_sig</span><span style="color: #007700">;<br /></span><span 
style="color: #0000BB">$srv&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_server</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$methods</span><span style="color: #007700">);</span>
+</span>
+</code></pre></div></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch09s02.html">Prev</a> </td><td width="20%" align="center"><a 
accesskey="u" href="ch09.html">Up</a></td><td width="40%" align="right"> <a 
accesskey="n" href="ch09s04.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">Easy use with nested PHP values </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Functions removed from the 
library</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s04.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s04.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s04.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Functions 
removed from the library</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch09.html" title="Chapter 9. Helper functions" /><link 
rel="prev" href="ch09s03.html" title="Automatic conversion of php functions 
into xmlrpc methods (and vice versa)" /><link rel="next" href="ch09s05.html" 
title="Debugging aids" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" 
align="center">Functions removed from the library</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch09s03.html">Prev</a> </td><th width="60%" 
align="center">Chapter 9. Helper functions</th><td width="20%" align="right"> 
<a accesskey="n" href="ch09s05.html">Next</a></td></tr></table><hr /></div><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a id="deprecated"></a>Functions removed from 
the library</h2></div></div></div><p>The following two functions have been 
deprecated in version 1.1 of
+      the library, and removed in version 2, in order to avoid conflicts with
+      the EPI xml-rpc library, which also defines two functions with the same
+      names.</p><p>To ease the transition to the new naming scheme and avoid 
breaking
+      existing implementations, the following scheme has been adopted:
+      </p><div class="itemizedlist"><ul type="disc"><li><p>If EPI-XMLRPC is 
not active in the current PHP installation,
+            the constant <code class="literal">XMLRPC_EPI_ENABLED</code> will 
be set to
+            <code class="literal">'0'</code></p></li><li><p>If EPI-XMLRPC is 
active in the current PHP installation, the
+            constant <code class="literal">XMLRPC_EPI_ENABLED</code> will be 
set to
+            <code class="literal">'1'</code></p></li></ul></div><p>The 
following documentation is kept for historical
+      reference:</p><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="xmlrpcdecode"></a>xmlrpc_decode</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">mixed<b 
class="fsfunc">xmlrpc_decode</b>(</code></td><td>xmlrpcval<var 
class="pdparam">$xmlrpc_val</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Alias for 
php_xmlrpc_decode.</p></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="xmlrpcencode"></a>xmlrpc_encode</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">xmlrpcval<b 
class="fsfunc">xmlrpc_encode</b>(</code></td><td>mixed<var 
class="pdparam">$phpval</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Alias for 
php_xmlrpc_encode.</p></div></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch09s03.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch09.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch09s05.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">Automatic conversion of php functions 
into xmlrpc methods (and
+      vice versa) </td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
Debugging aids</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s05.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s05.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch09s05.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Debugging 
aids</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta 
name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" 
href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch09.html" 
title="Chapter 9. Helper functions" /><link rel="prev" href="ch09s04.html" 
title="Functions removed from the library" /><link rel="next" href="ch10.html" 
title="Chapter 10. Reserved methods" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Debugging aids</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch09s04.html">Prev</a> </td><th width="60%" 
align="center">Chapter 9. Helper functions</th><td width="20%" align="right"> 
<a accesskey="n" href="ch10.html">Next</a></td></tr></table><hr /></div><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a id="debugging"></a>Debugging 
aids</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div 
class="titlepage"><div><div><h3 class="title"><a 
id="id938694"></a>xmlrpc_debugmsg</h3></div></div></div><div 
class="funcsynopsis"><table border="0" summary="Function synopsis" 
cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code 
class="funcdef">void<b 
class="fsfunc">xmlrpc_debugmsg</b>(</code></td><td>string<var 
class="pdparam">$debugstring</var><code>)</code>;</td></tr></table><div 
class="funcprototype-spacer"> </div></div><p>Sends the contents of <em 
class="parameter"><code>$debugstring</code></em> in XML
+        comments in the server return payload. If a PHP client has debugging
+        turned on, the user will be able to see server debug
+        information.</p><p>Use this function in your methods so you can pass 
back
+        diagnostic information. It is only available from
+        <code class="filename">xmlrpcs.inc</code>.</p></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch09s04.html">Prev</a> </td><td 
width="20%" align="center"><a accesskey="u" href="ch09.html">Up</a></td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch10.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Functions removed from the library </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Chapter 10. Reserved 
methods</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
10. Reserved methods</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch09s05.html" title="Debugging aids" /><link rel="next" 
href="ch10s02.html" title="system.listMethods" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Chapter 10. Reserved methods</th></tr><tr><td 
width="20%" align="left"><a accesskey="p" href="ch09s05.html">Prev</a> </td><th 
width="60%" align="center"> </th><td width="20%" align="right"> <a 
accesskey="n" href="ch10s02.html">Next</a></td></tr></table><hr /></div><div 
class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title"><a id="reserved"></a>Chapter 10. Reserved 
methods</h2></div></div></div><div class="toc"><p><b>Table of 
Contents</b></p><dl><dt><span class="sect1"><a 
href="ch10.html#id938774">system.getCapabilities</a></span></dt><dt><span 
class="sect1"><a 
href="ch10s02.html">system.listMethods</a></span></dt><dt><span 
class="sect1"><a 
href="ch10s03.html">system.methodSignature</a></span></dt><dt><span 
class="sect1"><a href="ch10s04.html">system.methodHelp</a></span></dt><dt><span 
class="sect1"><a 
href="ch10s05.html">system.multicall</a></span></dt></dl></div><p>In order to 
extend the functionality offered by XML-RPC servers
+    without impacting on the protocol, reserved methods are supported in this
+    release.</p><p>All methods starting with <code 
class="function">system.</code> are
+    considered reserved by the server. PHP for XML-RPC itself provides four
+    special methods, detailed in this chapter.</p><p>Note that all server 
objects will automatically respond to clients
+    querying these methods, unless the property
+    <span class="property">allow_system_funcs</span> has been set to
+    <code class="constant">false</code> before calling the
+    <code class="methodname">service()</code> method. This might pose a 
security risk
+    if the server is exposed to public access, e.g. on the internet.</p><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a 
id="id938774"></a>system.getCapabilities</h2></div></div></div><p></p></div></div><div
 class="navfooter"><hr /><table width="100%" summary="Navigation 
footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch09s05.html">Prev</a> </td><td width="20%" align="center"> </td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch10s02.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Debugging aids </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> system.listMethods</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s02.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s02.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>system.listMethods</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch10.html" title="Chapter 10. Reserved methods" /><link 
rel="prev" href="ch10.html" title="Chapter 10. Reserved methods" /><link 
rel="next" href="ch10s03.html" title="system.methodSignature" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">system.listMethods</th></tr><tr><td 
width="20%" align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><th 
width="60%" align="center">Chapter 10. Reserved methods</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch10s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a 
id="id938783"></a>system.listMethods</h2></div></div></div><p>This method may 
be used to enumerate the methods implemented by
+      the XML-RPC server.</p><p>The <code 
class="function">system.listMethods</code> method requires no
+      parameters. It returns an array of strings, each of which is the name of
+      a method implemented by the server.</p></div><div class="navfooter"><hr 
/><table width="100%" summary="Navigation footer"><tr><td width="40%" 
align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch10s03.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">Chapter 10. Reserved methods </td><td 
width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td 
width="40%" align="right" valign="top"> 
system.methodSignature</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s03.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s03.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s03.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>system.methodSignature</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch10.html" title="Chapter 10. Reserved methods" /><link 
rel="prev" href="ch10s02.html" title="system.listMethods" /><link rel="next" 
href="ch10s04.html" title="system.methodHelp" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">system.methodSignature</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch10s02.html">Prev</a> </td><th width="60%" 
align="center">Chapter 10. Reserved methods</th><td width="20%" align="right"> 
<a accesskey="n" href="ch10s04.html">Next</a></td></tr></table><hr /></div><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a 
id="sysmethodsig"></a>system.methodSignature</h2></div></div></div><p>This 
method takes one parameter, the name of a method implemented
+      by the XML-RPC server.</p><p>It returns an array of possible signatures 
for this method. A
+      signature is an array of types. The first of these types is the return
+      type of the method, the rest are parameters.</p><p>Multiple signatures 
(i.e. overloading) are permitted: this is the
+      reason that an array of signatures are returned by this 
method.</p><p>Signatures themselves are restricted to the top level parameters
+      expected by a method. For instance if a method expects one array of
+      structs as a parameter, and it returns a string, its signature is simply
+      "string, array". If it expects three integers, its signature is "string,
+      int, int, int".</p><p>For parameters that can be of more than one type, 
the "undefined"
+      string is supported.</p><p>If no signature is defined for the method, a 
not-array value is
+      returned. Therefore this is the way to test for a non-signature, if
+      <em class="parameter"><code>$resp</code></em> below is the response 
object from a method
+      call to <code class="function">system.methodSignature</code>:</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$v&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$resp</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">value</span><span style="color: #007700">();<br 
/>if&nbsp;(</span><span style="color: #0000BB">$v</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">kindOf</span><span 
style="color: #007700">()&nbsp;!=&nbsp;</span><span style="color: 
#DD0000">"array"</span><span style="color: #007700">)&nbsp;{<br 
/>&nbsp;&nbsp;</span><span style="color: 
#FF8000">//&nbsp;then&nbsp;the&nbsp;method&nbsp;did&nbsp;not&nbsp;have&nbsp;a&nbsp;signature&nbsp;defined<br
 /></span><span style="color: #007700">}</span>
+</span>
+</code></pre><p>See the <code class="filename">introspect.php</code> demo 
included in this
+      distribution for an example of using this method.</p></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch10s02.html">Prev</a> </td><td 
width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch10s04.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">system.listMethods </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> system.methodHelp</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s04.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s04.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s04.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>system.methodHelp</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch10.html" title="Chapter 10. Reserved methods" /><link 
rel="prev" href="ch10s03.html" title="system.methodSignature" /><link 
rel="next" href="ch10s05.html" title="system.multicall" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">system.methodHelp</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch10s03.html">Prev</a> </td><th width="60%" 
align="center">Chapter 10. Reserved methods</th><td width="20%" align="right"> 
<a accesskey="n" href="ch10s05.html">Next</a></td></tr></table><hr /></div><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a 
id="sysmethhelp"></a>system.methodHelp</h2></div></div></div><p>This method 
takes one parameter, the name of a method implemented
+      by the XML-RPC server.</p><p>It returns a documentation string 
describing the use of that
+      method. If no such string is available, an empty string is
+      returned.</p><p>The documentation string may contain HTML 
markup.</p></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch10s03.html">Prev</a> </td><td width="20%" align="center"><a 
accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a 
accesskey="n" href="ch10s05.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">system.methodSignature </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> 
system.multicall</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s05.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s05.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch10s05.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><title>system.multicall</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch10.html" title="Chapter 10. Reserved methods" /><link 
rel="prev" href="ch10s04.html" title="system.methodHelp" /><link rel="next" 
href="ch11.html" title="Chapter 11. Examples" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">system.multicall</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch10s04.html">Prev</a> </td><th width="60%" 
align="center">Chapter 10. Reserved methods</th><td width="20%" align="right"> 
<a accesskey="n" href="ch11.html">Next</a></td></tr></table><hr /></div><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a 
id="id938871"></a>system.multicall</h2></div></div></div><p>This method takes 
one parameter, an array of 'request' struct
+      types. Each request struct must contain a
+      <em class="parameter"><code>methodName</code></em> member of type string 
and a
+      <em class="parameter"><code>params</code></em> member of type array, and 
corresponds to
+      the invocation of the corresponding method.</p><p>It returns a response 
of type array, with each value of the array
+      being either an error struct (containing the faultCode and faultString
+      members) or the successful response value of the corresponding single
+      method call.</p></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch10s04.html">Prev</a> </td><td width="20%" align="center"><a 
accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a 
accesskey="n" href="ch11.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">system.methodHelp </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Chapter 11. 
Examples</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch11.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch11.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch11.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
11. Examples</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch10s05.html" title="system.multicall" /><link rel="next" 
href="ch11s02.html" title="Executing a multicall call" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Chapter 11. Examples</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch10s05.html">Prev</a> </td><th width="60%" 
align="center"> </th><td width="20%" align="right"> <a accesskey="n" 
href="ch11s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="examples"></a>Chapter 11. Examples</h2></div></div></div><div 
class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a 
href="ch11.html#statename">XML-RPC client: state name 
query</a></span></dt><dt><span class="sect1"><a href="ch11s02.html">Executing a 
multicall call</a></span></dt></dl></div><p>The best examples are to be found 
in the sample files included with
+    the distribution. Some are included here.</p><div class="sect1" lang="en" 
xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: 
both"><a id="statename"></a>XML-RPC client: state name 
query</h2></div></div></div><p>Code to get the corresponding state name from a 
number (1-50) from
+      the demo server available on SourceForge</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">&nbsp;&nbsp;$m&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'examples.getStateName'</span><span style="color: 
#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;array(new&nbsp;</span><span 
style="color: #0000BB">xmlrpcval</span><span style="color: 
#007700">(</span><span style="color: #0000BB">$HTTP_POST_VARS</span><span 
style="color: #007700">[</span><span style="color: 
#DD0000">"stateno"</span><span style="color: #007700">],&nbsp;</span><span 
style="color: #DD0000">"int"</span><span style="color: #007700">)));<br 
/>&nbsp;&nbsp;</span><span style="color: #0000BB">$c&nbsp;</span><span 
style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span 
style="color: #DD0000">"/server.php"</span><span style="color: 
#007700">,&nbsp;</span><span style="color: 
#DD0000">"phpxmlrpc.sourceforge.net"</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">80</span><span 
style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: 
#0000BB">$r&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span 
style="color: #0000BB">send</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$m</span><span style="color: #007700">);<br 
/>&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">$r</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">faultCode</span><span style="color: #007700">())&nbsp;{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span 
style="color: #0000BB">value</span><span style="color: #007700">();<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: 
#DD0000">"State&nbsp;number&nbsp;"&nbsp;</span><span style="color: 
#007700">.&nbsp;</span><span style="color: #0000BB">htmlentities</span><span 
style="color: #007700">(</span><span style="color: 
#0000BB">$HTTP_POST_VARS</span><span style="color: #007700">[</span><span 
style="color: #DD0000">"stateno"</span><span style="color: 
#007700">])&nbsp;.&nbsp;</span><span style="color: 
#DD0000">"&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">htmlentities</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$v</span><span style="color: #007700">-&gt;</span><span 
style="color: #0000BB">scalarval</span><span style="color: 
#007700">())&nbsp;.&nbsp;</span><span style="color: 
#DD0000">"&lt;BR&gt;"</span><span style="color: #007700">;<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: 
#DD0000">"&lt;HR&gt;I&nbsp;got&nbsp;this&nbsp;value&nbsp;back&lt;BR&gt;&lt;PRE&gt;"&nbsp;</span><span
 style="color: #007700">.<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">htmlentities</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span 
style="color: #0000BB">serialize</span><span style="color: 
#007700">())&nbsp;.&nbsp;</span><span style="color: 
#DD0000">"&lt;/PRE&gt;&lt;HR&gt;\n"</span><span style="color: #007700">;<br 
/>&nbsp;&nbsp;}&nbsp;else&nbsp;{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: 
#DD0000">"Fault&nbsp;&lt;BR&gt;"</span><span style="color: #007700">;<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: 
#DD0000">"Code:&nbsp;"&nbsp;</span><span style="color: 
#007700">.&nbsp;</span><span style="color: #0000BB">htmlentities</span><span 
style="color: #007700">(</span><span style="color: #0000BB">$r</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">faultCode</span><span style="color: 
#007700">())&nbsp;.&nbsp;</span><span style="color: 
#DD0000">"&lt;BR&gt;"&nbsp;</span><span style="color: #007700">.<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span
 style="color: #DD0000">"Reason:&nbsp;'"&nbsp;</span><span style="color: 
#007700">.&nbsp;</span><span style="color: #0000BB">htmlentities</span><span 
style="color: #007700">(</span><span style="color: #0000BB">$r</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">faultString</span><span style="color: 
#007700">())&nbsp;.&nbsp;</span><span style="color: 
#DD0000">"'&lt;BR&gt;"</span><span style="color: #007700">;<br 
/>&nbsp;&nbsp;}</span>
+</span>
+</code></pre></div></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch10s05.html">Prev</a> </td><td width="20%" align="center"> </td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch11s02.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">system.multicall </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> Executing a multicall call</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch11s02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch11s02.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch11s02.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Executing 
a multicall call</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch11.html" title="Chapter 11. Examples" /><link rel="prev" 
href="ch11.html" title="Chapter 11. Examples" /><link rel="next" 
href="ch12.html" title="Chapter 12. Frequently Asked Questions" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">Executing a multicall 
call</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch11.html">Prev</a> </td><th width="60%" align="center">Chapter 11. 
Examples</th><td width="20%" align="right"> <a accesskey="n" 
href="ch12.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id938922"></a>Executing a multicall 
call</h2></div></div></div><p>To be documented...</p></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch11.html">Prev</a> </td><td 
width="20%" align="center"><a accesskey="u" href="ch11.html">Up</a></td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch12.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Chapter 11. Examples </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> Chapter 12. Frequently Asked 
Questions</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12.html             
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12.html     
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 
12. Frequently Asked Questions</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" 
href="ch11s02.html" title="Executing a multicall call" /><link rel="next" 
href="ch12s02.html" title="Is there any limitation on the size of the requests 
/ responses that can be successfully sent?" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Chapter 12. Frequently Asked 
Questions</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch11s02.html">Prev</a> </td><th width="60%" align="center"> </th><td 
width="20%" align="right"> <a accesskey="n" 
href="ch12s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a 
id="faq"></a>Chapter 12. Frequently Asked Questions</h2></div></div></div><div 
class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a 
href="ch12.html#id938942">How to send custom XML as payload of a method 
call</a></span></dt><dt><span class="sect1"><a href="ch12s02.html">Is there any 
limitation on the size of the requests / responses
+      that can be successfully sent?</a></span></dt><dt><span class="sect1"><a 
href="ch12s03.html">My server (client) returns an error whenever the client 
(server)
+      returns accented characters</a></span></dt><dt><span class="sect1"><a 
href="ch12s04.html">How to enable long-lasting method 
calls</a></span></dt><dt><span class="sect1"><a href="ch12s05.html">My client 
returns "XML-RPC Fault #2: Invalid return payload:
+      enable debugging to examine incoming payload": what should I 
do?</a></span></dt><dt><span class="sect1"><a href="ch12s06.html">How can I 
save to a file the xml of the xmlrpc responses received
+      from servers?</a></span></dt><dt><span class="sect1"><a 
href="ch12s07.html">Can I use the ms windows character 
set?</a></span></dt><dt><span class="sect1"><a href="ch12s08.html">Does the 
library support using cookies / http sessions?</a></span></dt></dl></div><div 
class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 
class="title" style="clear: both"><a id="id938942"></a>How to send custom XML 
as payload of a method call</h2></div></div></div><p>Unfortunately, at the time 
the XML-RPC spec was designed, support
+      for namespaces in XML was not as ubiquitous as it is now. As a
+      consequence, no support was provided in the protocol for embedding XML
+      elements from other namespaces into an xmlrpc request.</p><p>To send an 
XML "chunk" as payload of a method call or response,
+      two options are available: either send the complete XML block as a
+      string xmlrpc value, or as a base64 value. Since the '&lt;' character in
+      string values is encoded as '&amp;lt;' in the xml payload of the method
+      call, the XML string will not break the surrounding xmlrpc, unless
+      characters outside of the assumed character set are used. The second
+      method has the added benefits of working independently of the charset
+      encoding used for the xml to be transmitted, and preserving exactly
+      whitespace, whilst incurring in some extra message length and cpu load
+      (for carrying out the base64 encoding/decoding).</p></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch11s02.html">Prev</a> </td><td 
width="20%" align="center"> </td><td width="40%" align="right"> <a 
accesskey="n" href="ch12s02.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">Executing a multicall call </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> Is there any limitation on the size of the requests 
/ responses
+      that can be successfully sent?</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s02.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s02.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s02.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Is there 
any limitation on the size of the requests / responses that can be successfully 
sent?</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta 
name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" 
href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch12.html" 
title="Chapter 12. Frequently Asked Questions" /><link rel="prev" 
href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link 
rel="next" href="ch12s03.html" title="My server (client) returns an error 
whenever the client (server) returns accented characters" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Is there any limitation on the size of the requests 
/ responses
+      that can be successfully sent?</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch12.html">Prev</a> </td><th width="60%" 
align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch12s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id938956"></a>Is there any limitation on the size of 
the requests / responses
+      that can be successfully sent?</h2></div></div></div><p>Yes. But I have 
no hard figure to give; it most likely will depend
+      on the version of PHP in usage and its configuration.</p><p>Keep in mind 
that this library is not optimized for speed nor for
+      memory usage. Better alternatives exist when there are strict
+      requirements on throughput or resource usage, such as the php native
+      xmlrpc extension (see the PHP manual for more information).</p><p>Keep 
in mind also that HTTP is probably not the best choice in
+      such a situation, and XML is a deadly enemy. CSV formatted data over
+      socket would be much more efficient.</p><p>If you really need to move a 
massive amount of data around, and
+      you are crazy enough to do it using phpxmlrpc, your best bet is to
+      bypass usage of the xmlrpcval objects, at least in the decoding phase,
+      and have the server (or client) object return to the calling function
+      directly php values (see <code 
class="varname">xmlrpc_client::return_type</code>
+      and <code 
class="varname">xmlrpc_server::functions_parameters_type</code> for more
+      details).</p></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch12.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" 
href="ch12.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" 
href="ch12s03.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">Chapter 12. Frequently Asked Questions </td><td width="20%" 
align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" 
align="right" valign="top"> My server (client) returns an error whenever the 
client (server)
+      returns accented characters</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s03.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s03.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s03.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>My server 
(client) returns an error whenever the client (server) returns accented 
characters</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link 
rel="prev" href="ch12s02.html" title="Is there any limitation on the size of 
the requests / responses that can be successfully sent?" /><link rel="next" 
href="ch12s04.html" title="How to enable long-lasting method calls" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">My server (client) returns an error 
whenever the client (server)
+      returns accented characters</th></tr><tr><td width="20%" align="left"><a 
accesskey="p" href="ch12s02.html">Prev</a> </td><th width="60%" 
align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch12s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id938985"></a>My server (client) returns an error 
whenever the client (server)
+      returns accented characters</h2></div></div></div><p>To be 
documented...</p></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch12s02.html">Prev</a> </td><td width="20%" align="center"><a 
accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a 
accesskey="n" href="ch12s04.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">Is there any limitation on the size of the requests / 
responses
+      that can be successfully sent? </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> How to enable long-lasting method 
calls</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s04.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s04.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s04.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>How to 
enable long-lasting method calls</title><link rel="stylesheet" 
href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL 
Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for 
PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked 
Questions" /><link rel="prev" href="ch12s03.html" title="My server (client) 
returns an error whenever the client (server) returns accented characters" 
/><link rel="next" href="ch12s05.html" title="My client returns &quot;XML-RPC 
Fault #2: Invalid return payload: enable debugging to examine incoming 
payload&quot;: what should I do?" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" align="center">How 
to enable long-lasting method calls</th></tr><tr><td width="20%" 
align="left"><a accesskey="p" href="ch12s03.html">Prev</a> </td><th width="60%" 
align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch12s05.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id938996"></a>How to enable long-lasting method 
calls</h2></div></div></div><p>To be documented...</p></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch12s03.html">Prev</a> </td><td 
width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch12s05.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">My server (client) returns an error whenever the client (server)
+      returns accented characters </td><td width="20%" align="center"><a 
accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" 
valign="top"> My client returns "XML-RPC Fault #2: Invalid return payload:
+      enable debugging to examine incoming payload": what should I 
do?</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s05.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s05.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s05.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>My client 
returns "XML-RPC Fault #2: Invalid return payload: enable debugging to examine 
incoming payload": what should I do?</title><link rel="stylesheet" 
href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL 
Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for 
PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked 
Questions" /><link rel="prev" href="ch12s04.html" title="How to enable 
long-lasting method calls" /><link rel="next" href="ch12s06.html" title="How 
can I save to a file the xml of the xmlrpc responses received from servers?" 
/></head><body><div class="navheader"><table width="100%" summary="Navigation 
header"><tr><th colspan="3" align="center">My client returns "XML-RPC Fault #2: 
Invalid return payload:
+      enable debugging to examine incoming payload": what should I 
do?</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch12s04.html">Prev</a> </td><th width="60%" align="center">Chapter 12. 
Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" 
href="ch12s06.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id939006"></a>My client returns "XML-RPC Fault #2: 
Invalid return payload:
+      enable debugging to examine incoming payload": what should I 
do?</h2></div></div></div><p>The response you are seeing is a default error 
response that the
+      client object returns to the php application when the server did not
+      respond to the call with a valid xmlrpc response.</p><p>The most likely 
cause is that you are not using the correct URL
+      when creating the client object, or you do not have appropriate access
+      rights to the web page you are requesting, or some other common http
+      misconfiguration.</p><p>To find out what the server is really returning 
to your client,
+      you have to enable the debug mode of the client, using
+      $client-&gt;setdebug(1);</p></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch12s04.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="ch12s06.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">How to enable long-lasting method calls 
</td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> How 
can I save to a file the xml of the xmlrpc responses received
+      from servers?</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s06.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s06.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s06.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>How can I 
save to a file the xml of the xmlrpc responses received from 
servers?</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" 
/><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link 
rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" 
href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link 
rel="prev" href="ch12s05.html" title="My client returns &quot;XML-RPC Fault #2: 
Invalid return payload: enable debugging to examine incoming payload&quot;: 
what should I do?" /><link rel="next" href="ch12s07.html" title="Can I use the 
ms windows character set?" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" align="center">How 
can I save to a file the xml of the xmlrpc responses received
+      from servers?</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch12s05.html">Prev</a> </td><th width="60%" align="center">Chapter 12. 
Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" 
href="ch12s07.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id939024"></a>How can I save to a file the xml of 
the xmlrpc responses received
+      from servers?</h2></div></div></div><p>If what you need is to save the 
responses received from the server
+      as xml, you have two options:</p><p>1- use the serialize() method on the 
response object.</p><pre class="programlisting"><code><span style="color: 
#000000">
+<span style="color: #0000BB">$resp&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">send</span><span style="color: #007700">(</span><span style="color: 
#0000BB">$msg</span><span style="color: #007700">);<br />if&nbsp;(!</span><span 
style="color: #0000BB">$resp</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span 
style="color: #007700">())<br />&nbsp;&nbsp;</span><span style="color: 
#0000BB">$data_to_be_saved&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$resp</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">serialize</span><span style="color: #007700">();</span>
+</span>
+</code></pre><p>Note that this will not be 100% accurate, since the xml 
generated
+      by the response object can be different from the xml received,
+      especially if there is some character set conversion involved, or such
+      (eg. if you receive an empty string tag as &lt;string/&gt;, serialize()
+      will output &lt;string&gt;&lt;/string&gt;), or if the server sent back
+      as response something invalid (in which case the xml generated client
+      side using serialize() will correspond to the error response generated
+      internally by the lib).</p><p>2 - set the client object to return the 
raw xml received instead
+      of the decoded objects:</p><pre class="programlisting"><code><span 
style="color: #000000">
+<span style="color: #0000BB">$client&nbsp;</span><span style="color: 
#007700">=&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$url</span><span style="color: #007700">);<br 
/></span><span style="color: #0000BB">$client</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">return_type&nbsp;</span><span 
style="color: #007700">=&nbsp;</span><span style="color: 
#DD0000">'xml'</span><span style="color: #007700">;<br /></span><span 
style="color: #0000BB">$resp&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">send</span><span style="color: #007700">(</span><span style="color: 
#0000BB">$msg</span><span style="color: #007700">);<br />if&nbsp;(!</span><span 
style="color: #0000BB">$resp</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span 
style="color: #007700">())<br />&nbsp;&nbsp;</span><span style="color: 
#0000BB">$data_to_be_saved&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$resp</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">value</span><span style="color: #007700">();</span>
+</span>
+</code></pre><p>Note that using this method the xml response response will not 
be
+      parsed at all by the library, only the http communication protocol will
+      be checked. This means that xmlrpc responses sent by the server that
+      would have generated an error response on the client (eg. malformed xml,
+      responses that have faultcode set, etc...) now will not be flagged as
+      invalid, and you might end up saving not valid xml but random
+      junk...</p></div><div class="navfooter"><hr /><table width="100%" 
summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" 
href="ch12s05.html">Prev</a> </td><td width="20%" align="center"><a 
accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a 
accesskey="n" href="ch12s07.html">Next</a></td></tr><tr><td width="40%" 
align="left" valign="top">My client returns "XML-RPC Fault #2: Invalid return 
payload:
+      enable debugging to examine incoming payload": what should I do? 
</td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Can 
I use the ms windows character set?</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s07.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s07.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s07.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Can I use 
the ms windows character set?</title><link rel="stylesheet" href="xmlrpc.css" 
type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets 
V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link 
rel="up" href="ch12.html" title="Chapter 12. Frequently Asked Questions" 
/><link rel="prev" href="ch12s06.html" title="How can I save to a file the xml 
of the xmlrpc responses received from servers?" /><link rel="next" 
href="ch12s08.html" title="Does the library support using cookies / http 
sessions?" /></head><body><div class="navheader"><table width="100%" 
summary="Navigation header"><tr><th colspan="3" align="center">Can I use the ms 
windows character set?</th></tr><tr><td width="20%" align="left"><a 
accesskey="p" href="ch12s06.html">Prev</a> </td><th width="60%" 
align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" 
align="right"> <a accesskey="n" 
href="ch12s08.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id939059"></a>Can I use the ms windows character 
set?</h2></div></div></div><p>If the data your application is using comes from 
a Microsoft
+      application, there are some chances that the character set used to
+      encode it is CP1252 (the same might apply to data received from an
+      external xmlrpc server/client, but it is quite rare to find xmlrpc
+      toolkits that encode to CP1252 instead of UTF8). It is a character set
+      which is "almost" compatible with ISO 8859-1, but for a few extra
+      characters.</p><p>PHP-XMLRPC only supports the ISO 8859-1 and UTF8 
character sets.
+      The net result of this situation is that those extra characters will not
+      be properly encoded, and will be received at the other end of the
+      XML-RPC tranmission as "garbled data". Unfortunately the library cannot
+      provide real support for CP1252 because of limitations in the PHP 4 xml
+      parser. Luckily, we tried our best to support this character set anyway,
+      and, since version 2.2.1, there is some form of support, left commented
+      in the code.</p><p>To properly encode outgoing data that is natively in 
CP1252, you
+      will have to uncomment all relative code in the file
+      <code class="filename">xmlrpc.inc</code> (you can search for the string 
"1252"),
+      then set <code 
class="code">$GLOBALS['xmlrpc_internalencoding']='CP1252';</code>
+      Please note that all incoming data will then be fed to your application
+      as UTF-8 to avoid any potentail data loss.</p></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"><a accesskey="p" href="ch12s06.html">Prev</a> </td><td 
width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch12s08.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top">How can I save to a file the xml of the xmlrpc responses received
+      from servers? </td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Does 
the library support using cookies / http 
sessions?</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s08.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s08.html          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/ch12s08.html  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Does the 
library support using cookies / http sessions?</title><link rel="stylesheet" 
href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL 
Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for 
PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked 
Questions" /><link rel="prev" href="ch12s07.html" title="Can I use the ms 
windows character set?" /><link rel="next" href="apa.html" title="Appendix A. 
Integration with the PHP xmlrpc extension" /></head><body><div 
class="navheader"><table width="100%" summary="Navigation header"><tr><th 
colspan="3" align="center">Does the library support using cookies / http 
sessions?</th></tr><tr><td width="20%" align="left"><a accesskey="p" 
href="ch12s07.html">Prev</a> </td><th width="60%" align="center">Chapter 12. 
Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" 
href="apa.html">Next</a></td></tr></table><hr /></div><div class="sect1" 
lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" 
style="clear: both"><a id="id939878"></a>Does the library support using cookies 
/ http sessions?</h2></div></div></div><p>In short: yes, but a little coding is 
needed to make it
+      happen.</p><p>The code below uses sessions to e.g. let the client store 
a value
+      on the server and retrieve it later.</p><pre 
class="programlisting"><code><span style="color: #000000">
+<span style="color: #0000BB">$resp&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span 
style="color: #007700">-&gt;</span><span style="color: 
#0000BB">send</span><span style="color: #007700">(new&nbsp;</span><span 
style="color: #0000BB">xmlrpcmsg</span><span style="color: 
#007700">(</span><span style="color: #DD0000">'registervalue'</span><span 
style="color: #007700">,&nbsp;array(new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'foo'</span><span style="color: 
#007700">),&nbsp;new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'bar'</span><span style="color: #007700">))));<br 
/>if&nbsp;(!</span><span style="color: #0000BB">$resp</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span 
style="color: #007700">())<br />{<br />&nbsp;&nbsp;</span><span style="color: 
#0000BB">$cookies&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">$resp</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">cookies</span><span 
style="color: #007700">();<br />&nbsp;&nbsp;if&nbsp;(</span><span style="color: 
#0000BB">array_key_exists</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'PHPSESSID'</span><span style="color: 
#007700">,&nbsp;</span><span style="color: #0000BB">$cookies</span><span 
style="color: #007700">))&nbsp;</span><span style="color: 
#FF8000">//&nbsp;nb:&nbsp;make&nbsp;sure&nbsp;to&nbsp;use&nbsp;the&nbsp;correct&nbsp;session&nbsp;cookie&nbsp;name<br
 />&nbsp;&nbsp;</span><span style="color: #007700">{<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">$session_id&nbsp;</span><span style="color: 
#007700">=&nbsp;</span><span style="color: #0000BB">$cookies</span><span 
style="color: #007700">[</span><span style="color: 
#DD0000">'PHPSESSID'</span><span style="color: #007700">][</span><span 
style="color: #DD0000">'value'</span><span style="color: #007700">];<br /><br 
/>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#FF8000">//&nbsp;do&nbsp;some&nbsp;other&nbsp;stuff&nbsp;here...<br /><br 
/>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">$client</span><span style="color: #007700">-&gt;</span><span 
style="color: #0000BB">setcookie</span><span style="color: 
#007700">(</span><span style="color: #DD0000">'PHPSESSID'</span><span 
style="color: #007700">,&nbsp;</span><span style="color: 
#0000BB">$session_id</span><span style="color: #007700">);<br 
/>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: 
#0000BB">$val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span 
style="color: #0000BB">$client</span><span style="color: 
#007700">-&gt;</span><span style="color: #0000BB">send</span><span 
style="color: #007700">(new&nbsp;</span><span style="color: 
#0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'getvalue'</span><span style="color: 
#007700">,&nbsp;array(new&nbsp;</span><span style="color: 
#0000BB">xmlrpcval</span><span style="color: #007700">(</span><span 
style="color: #DD0000">'foo'</span><span style="color: #007700">)));<br 
/>&nbsp;&nbsp;}<br />}</span>
+</span>
+</code></pre><p>Server-side sessions are handled normally like in any other
+      php application. Please see the php manual for more information about
+      sessions.</p><p>NB: unlike web browsers, not all xmlrpc clients support 
usage of
+      http cookies. If you have troubles with sessions and control only the
+      server side of the communication, please check with the makers of the
+      xmlrpc client in use.</p></div><div class="navfooter"><hr /><table 
width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a 
accesskey="p" href="ch12s07.html">Prev</a> </td><td width="20%" 
align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" 
align="right"> <a accesskey="n" href="apa.html">Next</a></td></tr><tr><td 
width="40%" align="left" valign="top">Can I use the ms windows character set? 
</td><td width="20%" align="center"><a accesskey="h" 
href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
Appendix A. Integration with the PHP xmlrpc 
extension</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/index.html
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/index.html            
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/index.html    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";><head><meta 
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>XML-RPC 
for PHP</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta 
name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" 
href="index.html" title="XML-RPC for PHP" /><link rel="next" href="ch01.html" 
title="Chapter 1. Introduction" /></head><body><div class="navheader"><table 
width="100%" summary="Navigation header"><tr><th colspan="3" 
align="center">XML-RPC for PHP</th></tr><tr><td width="20%" align="left"> 
</td><th width="60%" align="center"> </th><td width="20%" align="right"> <a 
accesskey="n" href="ch01.html">Next</a></td></tr></table><hr /></div><div 
class="book" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 
class="title"><a id="id916208"></a>XML-RPC for PHP</h1></div><div><h2 
class="subtitle">version 3.0.0 beta</h2></div><div><div 
class="authorgroup"><div class="author"><h3 class="author"><span 
class="firstname">Edd</span> <span 
class="surname">Dumbill</span></h3></div><div class="author"><h3 
class="author"><span class="firstname">Gaetano</span> <span 
class="surname">Giunta</span></h3></div><div class="author"><h3 
class="author"><span class="firstname">Miles</span> <span 
class="surname">Lott</span></h3></div><div class="author"><h3 
class="author"><span class="firstname">Justin R.</span> <span 
class="surname">Miller</span></h3></div><div class="author"><h3 
class="author"><span class="firstname">Andres</span> <span 
class="surname">Salomon</span></h3></div></div></div><div><p 
class="copyright">Copyright © 1999,2000,2001 Edd Dumbill, Useful Information 
Company</p></div><div><div class="legalnotice"><a id="id916294"></a><p>All 
rights reserved.</p><p>Redistribution and use in source and binary forms, with 
or without
+      modification, are permitted provided that the following conditions are
+      met:</p><div class="itemizedlist"><ul type="disc"><li><p>Redistributions 
of source code must retain the above
+            copyright notice, this list of conditions and the following
+            disclaimer.</p></li><li><p>Redistributions in binary form must 
reproduce the above
+            copyright notice, this list of conditions and the following
+            disclaimer in the documentation and/or other materials provided
+            with the distribution.</p></li><li><p>Neither the name of the 
"XML-RPC for PHP" nor the names of
+            its contributors may be used to endorse or promote products
+            derived from this software without specific prior written
+            permission.</p></li></ul></div><p>THIS SOFTWARE IS PROVIDED BY THE 
COPYRIGHT HOLDERS AND
+      CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+      BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+      FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+      REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+      TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+      PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+      LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+      NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+      SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
DAMAGE.</p></div></div></div><hr /></div><div class="toc"><p><b>Table of 
Contents</b></p><dl><dt><span class="chapter"><a href="ch01.html">1. 
Introduction</a></span></dt><dd><dl><dt><span class="sect1"><a 
href="ch01.html#id930303">Acknowledgements</a></span></dt></dl></dd><dt><span 
class="chapter"><a href="ch02.html">2. What's 
new</a></span></dt><dd><dl><dt><span class="sect1"><a 
href="ch02.html#id930465">3.0.0 beta</a></span></dt><dt><span class="sect1"><a 
href="ch02s02.html">2.2.2</a></span></dt><dt><span class="sect1"><a 
href="ch02s03.html">2.2.1</a></span></dt><dt><span class="sect1"><a 
href="ch02s04.html">2.2</a></span></dt><dt><span class="sect1"><a 
href="ch02s05.html">2.1</a></span></dt><dt><span class="sect1"><a 
href="ch02s06.html">2.0 final</a></span></dt><dt><span class="sect1"><a 
href="ch02s07.html">2.0 Release candidate 3</a></span></dt><dt><span 
class="sect1"><a href="ch02s08.html">2.0 Release candidate 
2</a></span></dt><dt><span class="sect1"><a href="ch02s09.html">2.0 Release 
candidate 1</a></span></dt></dl></dd><dt><span class="chapter"><a 
href="ch03.html">3. System Requirements</a></span></dt><dt><span 
class="chapter"><a href="ch04.html">4. Files in the 
distribution</a></span></dt><dt><span class="chapter"><a href="ch05.html">5. 
Known bugs and limitations</a></span></dt><dt><span class="chapter"><a 
href="ch06.html">6. Support</a></span></dt><dd><dl><dt><span class="sect1"><a 
href="ch06.html#id932516">Online Support</a></span></dt><dt><span 
class="sect1"><a href="ch06s02.html">The Jellyfish 
Book</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch07.html">7. 
Class documentation</a></span></dt><dd><dl><dt><span class="sect1"><a 
href="ch07.html#xmlrpcval">xmlrpcval</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07.html#id932680">Notes on 
types</a></span></dt><dt><span class="sect2"><a 
href="ch07.html#xmlrpcval-creation">Creation</a></span></dt><dt><span 
class="sect2"><a 
href="ch07.html#xmlrpcval-methods">Methods</a></span></dt></dl></dd><dt><span 
class="sect1"><a href="ch07s02.html">xmlrpcmsg</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07s02.html#id934064">Creation</a></span></dt><dt><span 
class="sect2"><a 
href="ch07s02.html#id934152">Methods</a></span></dt></dl></dd><dt><span 
class="sect1"><a 
href="ch07s03.html">xmlrpc_client</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07s03.html#id934526">Creation</a></span></dt><dt><span 
class="sect2"><a href="ch07s03.html#id934666">Methods</a></span></dt><dt><span 
class="sect2"><a 
href="ch07s03.html#id935796">Variables</a></span></dt></dl></dd><dt><span 
class="sect1"><a 
href="ch07s04.html">xmlrpcresp</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07s04.html#id935884">Creation</a></span></dt><dt><span 
class="sect2"><a 
href="ch07s04.html#id935971">Methods</a></span></dt></dl></dd><dt><span 
class="sect1"><a 
href="ch07s05.html">xmlrpc_server</a></span></dt><dd><dl><dt><span 
class="sect2"><a href="ch07s05.html#id936390">Method handler 
functions</a></span></dt><dt><span class="sect2"><a 
href="ch07s05.html#id936453">The dispatch map</a></span></dt><dt><span 
class="sect2"><a href="ch07s05.html#signatures">Method 
signatures</a></span></dt><dt><span class="sect2"><a 
href="ch07s05.html#id936613">Delaying the server 
response</a></span></dt><dt><span class="sect2"><a 
href="ch07s05.html#id936662">Modifying the server 
behaviour</a></span></dt><dt><span class="sect2"><a 
href="ch07s05.html#id936748">Fault reporting</a></span></dt><dt><span 
class="sect2"><a href="ch07s05.html#id937308">'New style' 
servers</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a 
href="ch08.html">8. Global variables</a></span></dt><dd><dl><dt><span 
class="sect1"><a href="ch08.html#id937374">"Constant" 
variables</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch08.html#id937380">$xmlrpcerruser</a></span></dt><dt><span 
class="sect2"><a href="ch08.html#id937400">$xmlrpcI4, $xmlrpcInt, 
$xmlrpcBoolean, $xmlrpcDouble,
+        $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray,
+        $xmlrpcStruct, $xmlrpcValue, $xmlrpcNull</a></span></dt><dt><span 
class="sect2"><a href="ch08.html#id937415">$xmlrpcTypes, $xmlrpc_valid_parents, 
$xmlrpcerr, $xmlrpcstr,
+        $xmlrpcerrxml, $xmlrpc_backslash, $_xh, $xml_iso88591_Entities,
+        $xmlEntities, $xmlrpcs_capabilities</a></span></dt></dl></dd><dt><span 
class="sect1"><a href="ch08s02.html">Variables whose value can be 
modified</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch08s02.html#xmlrpc-defencoding">xmlrpc_defencoding</a></span></dt><dt><span
 class="sect2"><a 
href="ch08s02.html#id937475">xmlrpc_internalencoding</a></span></dt><dt><span 
class="sect2"><a 
href="ch08s02.html#id937501">xmlrpcName</a></span></dt><dt><span 
class="sect2"><a 
href="ch08s02.html#id937522">xmlrpcVersion</a></span></dt><dt><span 
class="sect2"><a 
href="ch08s02.html#id937542">xmlrpc_null_extension</a></span></dt><dt><span 
class="sect2"><a 
href="ch08s02.html#id937560">xmlrpc_null_apache_encoding</a></span></dt></dl></dd></dl></dd><dt><span
 class="chapter"><a href="ch09.html">9. Helper 
functions</a></span></dt><dd><dl><dt><span class="sect1"><a 
href="ch09.html#id937598">Date functions</a></span></dt><dd><dl><dt><span 
class="sect2"><a 
href="ch09.html#iso8601encode">iso8601_encode</a></span></dt><dt><span 
class="sect2"><a 
href="ch09.html#iso8601decode">iso8601_decode</a></span></dt></dl></dd><dt><span
 class="sect1"><a href="ch09s02.html">Easy use with nested PHP 
values</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch09s02.html#phpxmlrpcdecode">php_xmlrpc_decode</a></span></dt><dt><span 
class="sect2"><a 
href="ch09s02.html#phpxmlrpcencode">php_xmlrpc_encode</a></span></dt><dt><span 
class="sect2"><a 
href="ch09s02.html#id938212">php_xmlrpc_decode_xml</a></span></dt></dl></dd><dt><span
 class="sect1"><a href="ch09s03.html">Automatic conversion of php functions 
into xmlrpc methods (and
+      vice versa)</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch09s03.html#id938280">wrap_xmlrpc_method</a></span></dt><dt><span 
class="sect2"><a 
href="ch09s03.html#wrap_php_function">wrap_php_function</a></span></dt></dl></dd><dt><span
 class="sect1"><a href="ch09s04.html">Functions removed from the 
library</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch09s04.html#xmlrpcdecode">xmlrpc_decode</a></span></dt><dt><span 
class="sect2"><a 
href="ch09s04.html#xmlrpcencode">xmlrpc_encode</a></span></dt></dl></dd><dt><span
 class="sect1"><a href="ch09s05.html">Debugging 
aids</a></span></dt><dd><dl><dt><span class="sect2"><a 
href="ch09s05.html#id938694">xmlrpc_debugmsg</a></span></dt></dl></dd></dl></dd><dt><span
 class="chapter"><a href="ch10.html">10. Reserved 
methods</a></span></dt><dd><dl><dt><span class="sect1"><a 
href="ch10.html#id938774">system.getCapabilities</a></span></dt><dt><span 
class="sect1"><a 
href="ch10s02.html">system.listMethods</a></span></dt><dt><span 
class="sect1"><a 
href="ch10s03.html">system.methodSignature</a></span></dt><dt><span 
class="sect1"><a href="ch10s04.html">system.methodHelp</a></span></dt><dt><span 
class="sect1"><a 
href="ch10s05.html">system.multicall</a></span></dt></dl></dd><dt><span 
class="chapter"><a href="ch11.html">11. 
Examples</a></span></dt><dd><dl><dt><span class="sect1"><a 
href="ch11.html#statename">XML-RPC client: state name 
query</a></span></dt><dt><span class="sect1"><a href="ch11s02.html">Executing a 
multicall call</a></span></dt></dl></dd><dt><span class="chapter"><a 
href="ch12.html">12. Frequently Asked 
Questions</a></span></dt><dd><dl><dt><span class="sect1"><a 
href="ch12.html#id938942">How to send custom XML as payload of a method 
call</a></span></dt><dt><span class="sect1"><a href="ch12s02.html">Is there any 
limitation on the size of the requests / responses
+      that can be successfully sent?</a></span></dt><dt><span class="sect1"><a 
href="ch12s03.html">My server (client) returns an error whenever the client 
(server)
+      returns accented characters</a></span></dt><dt><span class="sect1"><a 
href="ch12s04.html">How to enable long-lasting method 
calls</a></span></dt><dt><span class="sect1"><a href="ch12s05.html">My client 
returns "XML-RPC Fault #2: Invalid return payload:
+      enable debugging to examine incoming payload": what should I 
do?</a></span></dt><dt><span class="sect1"><a href="ch12s06.html">How can I 
save to a file the xml of the xmlrpc responses received
+      from servers?</a></span></dt><dt><span class="sect1"><a 
href="ch12s07.html">Can I use the ms windows character 
set?</a></span></dt><dt><span class="sect1"><a href="ch12s08.html">Does the 
library support using cookies / http 
sessions?</a></span></dt></dl></dd><dt><span class="appendix"><a 
href="apa.html">A. Integration with the PHP xmlrpc 
extension</a></span></dt><dt><span class="appendix"><a href="apb.html">B. 
Substitution of the PHP xmlrpc extension</a></span></dt><dt><span 
class="appendix"><a href="apc.html">C. 'Enough of xmlrpcvals!': new style 
library usage</a></span></dt><dt><span class="appendix"><a href="apd.html">D. 
Usage of the debugger</a></span></dt></dl></div></div><div 
class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td 
width="40%" align="left"> </td><td width="20%" align="center"> </td><td 
width="40%" align="right"> <a accesskey="n" 
href="ch01.html">Next</a></td></tr><tr><td width="40%" align="left" 
valign="top"> </td><td width="20%" align="center"> </td><td width="40%" 
align="right" valign="top"> Chapter 1. 
Introduction</td></tr></table></div></body></html>

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/xmlrpc_php.pdf
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/xmlrpc_php.pdf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/xmlrpc_php.xml
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/xmlrpc_php.xml        
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/doc/xmlrpc_php.xml        
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,4254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet href="docbook-css/driver.css" type="text/css"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
+<!--
+PHP-XMLRPC User manual
+$Id: xmlrpc_php.xml,v 1.27 2008/09/19 18:35:33 ggiunta Exp $
+-->
+<book lang="en">
+  <title>XML-RPC for PHP</title>
+
+  <subtitle>version 3.0.0 beta</subtitle>
+
+  <bookinfo>
+    <date>Sep 5, 2009</date>
+
+    <authorgroup>
+      <author>
+        <firstname>Edd</firstname>
+
+        <surname>Dumbill</surname>
+      </author>
+
+      <author>
+        <firstname>Gaetano</firstname>
+
+        <surname>Giunta</surname>
+      </author>
+
+      <author>
+        <firstname>Miles</firstname>
+
+        <surname>Lott</surname>
+      </author>
+
+      <author>
+        <firstname>Justin R.</firstname>
+
+        <surname>Miller</surname>
+      </author>
+
+      <author>
+        <firstname>Andres</firstname>
+
+        <surname>Salomon</surname>
+      </author>
+    </authorgroup>
+
+    <copyright>
+      <year>1999,2000,2001</year>
+
+      <holder>Edd Dumbill, Useful Information Company</holder>
+    </copyright>
+
+    <legalnotice>
+      <para>All rights reserved.</para>
+
+      <para>Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions are
+      met:</para>
+
+      <para><itemizedlist>
+          <listitem>
+            <para>Redistributions of source code must retain the above
+            copyright notice, this list of conditions and the following
+            disclaimer.</para>
+          </listitem>
+
+          <listitem>
+            <para>Redistributions in binary form must reproduce the above
+            copyright notice, this list of conditions and the following
+            disclaimer in the documentation and/or other materials provided
+            with the distribution.</para>
+          </listitem>
+
+          <listitem>
+            <para>Neither the name of the "XML-RPC for PHP" nor the names of
+            its contributors may be used to endorse or promote products
+            derived from this software without specific prior written
+            permission.</para>
+          </listitem>
+        </itemizedlist></para>
+
+      <para>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+      CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+      BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+      FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+      REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+      TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+      PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+      LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+      NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+      SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</para>
+    </legalnotice>
+  </bookinfo>
+
+  <chapter id="introduction">
+    <title>Introduction</title>
+
+    <para>XML-RPC is a format devised by <ulink
+    url="http://www.userland.com/";>Userland Software</ulink> for achieving
+    remote procedure call via XML using HTTP as the transport. XML-RPC has its
+    own web site, <ulink
+    url="http://www.xmlrpc.com/";>www.xmlrpc.com</ulink></para>
+
+    <para>This collection of PHP classes provides a framework for writing
+    XML-RPC clients and servers in PHP.</para>
+
+    <para>Main goals of the project are ease of use, flexibility and
+    completeness.</para>
+
+    <para>The original author is Edd Dumbill of <ulink
+    url="http://usefulinc.com/";>Useful Information Company</ulink>. As of the
+    1.0 stable release, the project was opened to wider involvement and moved
+    to <ulink
+    url="http://phpxmlrpc.sourceforge.net/";>SourceForge</ulink>.</para>
+
+    <para>A list of XML-RPC implementations for other languages such as Perl
+    and Python can be found on the <ulink
+    url="http://www.xmlrpc.com/";>www.xmlrpc.com</ulink> site.</para>
+
+    <sect1>
+      <title>Acknowledgements</title>
+
+      <para>Daniel E. Baumann</para>
+
+      <para>James Bercegay</para>
+
+      <para>Leon Blackwell</para>
+
+      <para>Stephane Bortzmeyer</para>
+
+      <para>Daniel Convissor</para>
+
+      <para>Geoffrey T. Dairiki</para>
+
+      <para>Stefan Esser</para>
+
+      <para>James Flemer</para>
+
+      <para>Ernst de Haan</para>
+
+      <para>Tom Knight</para>
+
+      <para>Axel Kollmorgen</para>
+
+      <para>Peter Kocks</para>
+
+      <para>Daniel Krippner</para>
+
+      <para>S. Kuip</para>
+
+      <para>A. Lambert</para>
+
+      <para>Frederic Lecointre</para>
+
+      <para>Dan Libby</para>
+
+      <para>Arnaud Limbourg</para>
+
+      <para>Ernest MacDougal Campbell III</para>
+
+      <para>Lukasz Mach</para>
+
+      <para>Kjartan Mannes</para>
+
+      <para>Ben Margolin</para>
+
+      <para>Nicolay Mausz</para>
+
+      <para>Justin Miller</para>
+
+      <para>Jan Pfeifer</para>
+
+      <para>Giancarlo Pinerolo</para>
+
+      <para>Peter Russel</para>
+
+      <para>Jean-Jacques Sarton</para>
+
+      <para>Viliam Simko</para>
+
+      <para>Idan Sofer</para>
+
+      <para>Douglas Squirrel</para>
+
+      <para>Heiko Stübner</para>
+
+      <para>Anatoly Techtonik</para>
+
+      <para>Tommaso Trani</para>
+
+      <para>Eric van der Vlist</para>
+
+      <para>Christian Wenz</para>
+
+      <para>Jim Winstead</para>
+
+      <para>Przemyslaw Wroblewski</para>
+
+      <para>Bruno Zanetti Melotti</para>
+    </sect1>
+  </chapter>
+
+  <chapter id="news">
+    <title>What's new</title>
+
+    <para><emphasis>Note:</emphasis> not all items the following list have
+    (yet) been fully documented, and some might not be present in any other
+    chapter in the manual. To find a more detailed description of new
+    functions and methods please take a look at the source code of the
+    library, which is quite thoroughly commented in javadoc-like form.</para>
+
+    <sect1>
+      <title>3.0.0 beta</title>
+
+      <para>This is the first release of the library to only support PHP 5.
+      Some legacy code has been removed, and support for features such as
+      exceptions and dateTime objects introduced.</para>
+
+      <para>The "beta" tag is meant to indicate the fact that the refactoring
+      has been more widespread than in precedent releases and that more
+      changes are likely to be introduced with time - the library is still
+      considered to be production quality.</para>
+
+      <para><itemizedlist>
+          <listitem>
+            <para>improved: removed all usage of php functions deprecated in
+            php 5.3, usage of assign-by-ref when creating new objects
+            etc...</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: add support for the &lt;ex:nil/&gt; tag used by
+            the apache library, both in input and output</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: add support for <classname>dateTime</classname>
+            objects in both in <function>php_xmlrpc_encode</function> and as
+            parameter for constructor of
+            <classname>xmlrpcval</classname></para>
+          </listitem>
+
+          <listitem>
+            <para>improved: add support for timestamps as parameter for
+            constructor of <classname>xmlrpcval</classname></para>
+          </listitem>
+
+          <listitem>
+            <para>improved: add option 'dates_as_objects' to
+            <function>php_xmlrpc_decode</function> to return
+            <classname>dateTime</classname> objects for xmlrpc
+            datetimes</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: add new method
+            <methodname>SetCurlOptions</methodname> to
+            <classname>xmrlpc_client</classname> to allow extra flexibility in
+            tweaking http config, such as explicitly binding to an ip
+            address</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: add new method
+            <methodname>SetUserAgent</methodname> to
+            <classname>xmrlpc_client</classname> to to allow having different
+            user-agent http headers</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: add a new member variable in server class to allow
+            fine-tuning of the encoding of returned values when the server is
+            in 'phpvals' mode</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: allow servers in 'xmlrpcvals' mode to also
+            register plain php functions by defining them in the dispatch map
+            with an added option</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: catch exceptions thrown during execution of php
+            functions exposed as methods by the server</para>
+          </listitem>
+
+          <listitem>
+            <para>fixed: bad encoding if same object is encoded twice using
+            php_xmlrpc_encode</para>
+          </listitem>
+        </itemizedlist></para>
+    </sect1>
+
+    <sect1>
+      <title>2.2.2</title>
+
+      <para><emphasis>Note:</emphasis> this might the last release of the
+      library that will support PHP 4. Future releases (if any) should target
+      php 5.0 as minimum supported version.</para>
+
+      <para><itemizedlist>
+          <listitem>
+            <para>fixed: encoding of utf-8 characters outside of the BMP
+            plane</para>
+          </listitem>
+
+          <listitem>
+            <para>fixed: character set declarations surrounded by double
+            quotes were not recognized in http headers</para>
+          </listitem>
+
+          <listitem>
+            <para>fixed: be more tolerant in detection of charset in http
+            headers</para>
+          </listitem>
+
+          <listitem>
+            <para>fixed: fix detection of zlib.output_compression</para>
+          </listitem>
+
+          <listitem>
+            <para>fixed: use feof() to test if socket connections are to be
+            closed instead of the number of bytes read (rare bug when
+            communicating with some servers)</para>
+          </listitem>
+
+          <listitem>
+            <para>fixed: format floating point values using the correct
+            decimal separator even when php locale is set to one that uses
+            comma</para>
+          </listitem>
+
+          <listitem>
+            <para>fixed: improve robustness of the debugger when parsing weird
+            results from non-compliant servers</para>
+          </listitem>
+
+          <listitem>
+            <para>php warning when receiving 'false' in a bool value</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: allow the add_to_map server method to add docs for
+            single params too</para>
+          </listitem>
+
+          <listitem>
+            <para>improved: added the possibility to wrap for exposure as
+            xmlrpc methods plain php class methods, object methods and even
+            whole classes</para>
+          </listitem>
+        </itemizedlist></para>
+    </sect1>
+
+    <sect1>
+      <title>2.2.1</title>
+
+      <itemizedlist>
+        <listitem>
+          <para>fixed: work aroung bug in php 5.2.2 which broke support of
+          HTTP_RAW_POST_DATA</para>
+        </listitem>
+
+        <listitem>
+          <para>fixed: is_dir parameter of setCaCertificate() method is
+          reversed</para>
+        </listitem>
+
+        <listitem>
+          <para>fixed: a php warning in xmlrpc_client creator method</para>
+        </listitem>
+
+        <listitem>
+          <para>fixed: parsing of '1e+1' as valid float</para>
+        </listitem>
+
+        <listitem>
+          <para>fixed: allow errorlevel 3 to work when prev. error handler was
+          a static method</para>
+        </listitem>
+
+        <listitem>
+          <para>fixed: usage of client::setcookie() for multiple cookies in
+          non-ssl mode</para>
+        </listitem>
+
+        <listitem>
+          <para>improved: support for CP1252 charset is not part or the
+          library but almost possible</para>
+        </listitem>
+
+        <listitem>
+          <para>improved: more info when curl is enabled and debug mode is
+          on</para>
+        </listitem>
+      </itemizedlist>
+    </sect1>
+
+    <sect1>
+      <title>2.2</title>
+
+      <itemizedlist>
+        <listitem>
+          <para>fixed: debugger errors on php installs with magic_quotes_gpc
+          on</para>
+        </listitem>
+
+        <listitem>
+          <para>fixed: support for https connections via proxy</para>
+        </listitem>
+
+        <listitem>
+          <para>fixed: wrap_xmlrpc_method() generated code failed to properly
+          encode php objects</para>
+        </listitem>
+
+        <listitem>
+          <para>improved: slightly faster encoding of data which is internally
+          UTF-8</para>
+        </listitem>
+
+        <listitem>
+          <para>improved: debugger always generates a 'null' id for jsonrpc if
+          user omits it</para>
+        </listitem>
+
+        <listitem>
+          <para>new: debugger can take advantage of a graphical value builder
+          (it has to be downloaded separately, as part of jsxmlrpc package.
+          See Appendix D for more details)</para>
+        </listitem>
+
+        <listitem>
+          <para>new: support for the &lt;NIL/&gt; xmlrpc extension. see below
+          for more details</para>
+        </listitem>
+
+        <listitem>
+          <para>new: server support for the system.getCapabilities xmlrpc
+          extension</para>
+        </listitem>
+
+        <listitem>
+          <para>new: <function><link
+          linkend="wrap_xmlrpc_method">wrap_xmlrpc_method()</link></function>
+          accepts two new options: debug and return_on_fault</para>
+        </listitem>
+      </itemizedlist>
+    </sect1>
+
+    <sect1>
+      <title>2.1</title>
+
+      <para><itemizedlist>
+          <listitem>
+            <para>The <function>wrap_php_function</function> and
+            <function>wrap_xmlrpc_method</function> functions have been moved
+            out of the base library file <filename>xmlrpc.inc</filename> into
+            a file of their own: <filename>xmlrpc_wrappers.inc</filename>. You
+            will have to include() / require() it in your scripts if you have
+            been using those functions. For increased security, the automatic
+            rebuilding of php object instances out of received xmlrpc structs
+            in <function>wrap_xmlrpc_method()</function> has been disabled
+            (but it can be optionally re-enabled). Both
+            <function>wrap_php_function()</function> and
+            <function>wrap_xmlrpc_method()</function> functions accept many
+            more options to fine tune their behaviour, including one to return
+            the php code to be saved and later used as standalone php
+            script</para>
+          </listitem>
+
+          <listitem>
+            <para>The constructor of xmlrpcval() values has seen some internal
+            changes, and it will not throw a php warning anymore when invoked
+            using an unknown xmlrpc type: the error will only be written to
+            php error log. Also <code>new xmlrpcval('true', 'boolean')</code>
+            is not supported anymore</para>
+          </listitem>
+
+          <listitem>
+            <para>The new function
+            <function>php_xmlrpc_decode_xml()</function> will take the xml
+            representation of either an xmlrpc request, response or single
+            value and return the corresponding php-xmlrpc object
+            instance</para>
+          </listitem>
+
+          <listitem>
+            <para>A new function <function>wrap_xmlrpc_server()</function>has
+            been added, to wrap all (or some) of the methods exposed by a
+            remote xmlrpc server into a php class</para>
+          </listitem>
+
+          <listitem>
+            <para>A new file has been added:
+            <filename>verify_compat.php</filename>, to help users diagnose the
+            level of compliance of their php installation with the
+            library</para>
+          </listitem>
+
+          <listitem>
+            <para>Restored compatibility with php 4.0.5 (for those poor souls
+            still stuck on it)</para>
+          </listitem>
+
+          <listitem>
+            <para>Method <methodname>xmlrpc_server-&gt;service()</methodname>
+            now returns a value: either the response payload or xmlrpcresp
+            object instance</para>
+          </listitem>
+
+          <listitem>
+            <para>Method
+            <methodname>xmlrpc_server-&gt;add_to_map()</methodname> now
+            accepts xmlrpc methods with no param definitions</para>
+          </listitem>
+
+          <listitem>
+            <para>Documentation for single parameters of exposed methods can
+            be added to the dispatch map (and turned into html docs in
+            conjunction with a future release of the 'extras' package)</para>
+          </listitem>
+
+          <listitem>
+            <para>Full response payload is saved into xmlrpcresp object for
+            further debugging</para>
+          </listitem>
+
+          <listitem>
+            <para>The debugger can now generate code that wraps a remote
+            method into a php function (works for jsonrpc, too); it also has
+            better support for being activated via a single GET call (e.g. for
+            integration into other tools)</para>
+          </listitem>
+
+          <listitem>
+            <para>Stricter parsing of incoming xmlrpc messages: two more
+            invalid cases are now detected (double <literal>data</literal>
+            element inside <literal>array</literal> and
+            <literal>struct</literal>/<literal>array</literal> after scalar
+            inside <literal>value</literal> element)</para>
+          </listitem>
+
+          <listitem>
+            <para>More logging of errors in a lot of situations</para>
+          </listitem>
+
+          <listitem>
+            <para>Javadoc documentation of lib files (almost) complete</para>
+          </listitem>
+
+          <listitem>
+            <para>Many performance tweaks and code cleanups, plus the usual
+            crop of bugs fixed (see NEWS file for complete list of
+            bugs)</para>
+          </listitem>
+
+          <listitem>
+            <para>Lib internals have been modified to provide better support
+            for grafting extra functionality on top of it. Stay tuned for
+            future releases of the EXTRAS package (or go read Appendix
+            B)...</para>
+          </listitem>
+        </itemizedlist></para>
+    </sect1>
+
+    <sect1>
+      <title>2.0 final</title>
+
+      <para><itemizedlist>
+          <listitem>
+            <para>Added to the client class the possibility to use Digest and
+            NTLM authentication methods (when using the CURL library) for
+            connecting to servers and NTLM for connecting to proxies</para>
+          </listitem>
+
+          <listitem>
+            <para>Added to the client class the possibility to specify
+            alternate certificate files/directories for authenticating the
+            peer with when using HTTPS communication</para>
+          </listitem>
+
+          <listitem>
+            <para>Reviewed all examples and added a new demo file, containing
+            a proxy to forward xmlrpc requests to other servers (useful e.g.
+            for ajax coding)</para>
+          </listitem>
+
+          <listitem>
+            <para>The debugger has been upgraded to reflect the new client
+            capabilities</para>
+          </listitem>
+
+          <listitem>
+            <para>All known bugs have been squashed, and the lib is more
+            tolerant than ever of commonly-found mistakes</para>
+          </listitem>
+        </itemizedlist></para>
+    </sect1>
+
+    <sect1>
+      <title>2.0 Release candidate 3</title>
+
+      <para><itemizedlist>
+          <listitem>
+            <para>Added to server class the property
+            <property>functions_parameters_type</property>, that allows the
+            server to register plain php functions as xmlrpc methods (i.e.
+            functions that do not take an xmlrpcmsg object as unique
+            param)</para>
+          </listitem>
+
+          <listitem>
+            <para>let server and client objects serialize calls using a
+            specified character set encoding for the produced xml instead of
+            US-ASCII (ISO-8859-1 and UTF-8 supported)</para>
+          </listitem>
+
+          <listitem>
+            <para>let php_xmlrpc_decode accept xmlrpcmsg objects as valid
+            input</para>
+          </listitem>
+
+          <listitem>
+            <para>'class::method' syntax is now accepted in the server
+            dispatch map</para>
+          </listitem>
+
+          <listitem>
+            <para><function>xmlrpc_clent::SetDebug()</function> accepts
+            integer values instead of a boolean value, with debugging level 2
+            adding to the information printed to screen the complete client
+            request</para>
+          </listitem>
+        </itemizedlist></para>
+    </sect1>
+
+    <sect1>
+      <title>2.0 Release candidate 2</title>
+
+      <para><itemizedlist>
+          <listitem>
+            <para>Added a new property of the client object:
+            <code>xmlrpc_client-&gt;return_type</code>, indicating whether
+            calls to the send() method will return xmlrpcresp objects whose
+            value() is an xmlrpcval object, a php value (automatically
+            decoded) or the raw xml received from the server.</para>
+          </listitem>
+
+          <listitem>
+            <para>Added in the extras dir. two new library file:
+            <filename>jsonrpc.inc</filename> and
+            <filename>jsonrpcs.inc</filename> containing new classes that
+            implement support for the json-rpc protocol (alpha quality
+            code)</para>
+          </listitem>
+
+          <listitem>
+            <para>Added a new client method: <code>setKey($key,
+            $keypass)</code> to be used in HTTPS connections</para>
+          </listitem>
+
+          <listitem>
+            <para>Added a new file containing some benchmarks in the testsuite
+            directory</para>
+          </listitem>
+        </itemizedlist></para>
+    </sect1>
+
+    <sect1>
+      <title>2.0 Release candidate 1</title>
+
+      <itemizedlist>
+        <listitem>
+          <para>Support for HTTP proxies (new method:
+          <code>xmlrpc_client::setProxy()</code>)</para>
+        </listitem>
+
+        <listitem>
+          <para>Support HTTP compression of both requests and responses.
+          Clients can specify what kind of compression they accept for
+          responses between deflate/gzip/any, and whether to compress the
+          requests. Servers by default compress responses to clients that
+          explicitly declare support for compression (new methods:
+          <code>xmlrpc_client::setAcceptedCompression()</code>,
+          <code>xmlrpc_client::setRequestCompression()</code>). Note that the
+          ZLIB php extension needs to be enabled in PHP to support
+          compression.</para>
+        </listitem>
+
+        <listitem>
+          <para>Implement HTTP 1.1 connections, but only if CURL is enabled
+          (added an extra parameter to
+          <code>xmlrpc_client::xmlrpc_client</code> to set the desired HTTP
+          protocol at creation time and a new supported value for the last
+          parameter of <code>xmlrpc_client::send</code>, which now can be
+          safely omitted if it has been specified at creation time)</para>
+
+          <para>With PHP versions greater than 4.3.8 keep-alives are enabled
+          by default for HTTP 1.1 connections. This should yield faster
+          execution times when making multiple calls in sequence to the same
+          xml-rpc server from a single client.</para>
+        </listitem>
+
+        <listitem>
+          <para>Introduce support for cookies. Cookies to be sent to the
+          server with a request can be set using
+          <code>xmlrpc_client::setCookie()</code>, while cookies received from
+          the server are found in <code>xmlrpcresp::cookies()</code>. It is
+          left to the user to check for validity of received cookies and
+          decide whether they apply to successive calls or not.</para>
+        </listitem>
+
+        <listitem>
+          <para>Better support for detecting different character set encodings
+          of xml-rpc requests and responses: both client and server objects
+          will correctly detect the charset encoding of received xml, and use
+          an appropriate xml parser.</para>
+
+          <para>Supported encodings are US-ASCII, UTF-8 and ISO-8859-1.</para>
+        </listitem>
+
+        <listitem>
+          <para>Added one new xmlrpcmsg constructor syntax, allowing usage of
+          a single string with the complete URL of the target server</para>
+        </listitem>
+
+        <listitem>
+          <para>Convert xml-rpc boolean values into native php values instead
+          of 0 and 1</para>
+        </listitem>
+
+        <listitem>
+          <para>Force the <code>php_xmlrpc_encode</code> function to properly
+          encode numerically indexed php arrays into xml-rpc arrays
+          (numerically indexed php arrays always start with a key of 0 and
+          increment keys by values of 1)</para>
+        </listitem>
+
+        <listitem>
+          <para>Prevent the <code>php_xmlrpc_encode</code> function from
+          further re-encoding any objects of class <code>xmlrpcval</code> that
+          are passed to it. This allows to call the function with arguments
+          consisting of mixed php values / xmlrpcval objects.</para>
+        </listitem>
+
+        <listitem>
+          <para>Allow a server to NOT respond to system.* method calls
+          (setting the <code>$server-&gt;allow_system_funcs</code>
+          property).</para>
+        </listitem>
+
+        <listitem>
+          <para>Implement a new xmlrpcval method to determine if a value of
+          type struct has a member of a given name without having to loop
+          trough all members: <code>xmlrpcval::structMemExists()</code></para>
+        </listitem>
+
+        <listitem>
+          <para>Expand methods <code>xmlrpcval::addArray</code>,
+          <code>addScalar</code> and <code>addStruct</code> allowing extra php
+          values to be added to xmlrpcval objects already formed.</para>
+        </listitem>
+
+        <listitem>
+          <para>Let the <code>xmlrpc_client::send</code> method accept an XML
+          string for sending instead of an xmlrpcmsg object, to facilitate
+          debugging and integration with the php native xmlrpc
+          extension</para>
+        </listitem>
+
+        <listitem>
+          <para>Extend the <code>php_xmlrpc_encode</code> and
+          <code>php_xmlrpc_decode</code> functions to allow serialization and
+          rebuilding of PHP objects. To successfully rebuild a serialized
+          object, the object class must be defined in the deserializing end of
+          the transfer. Note that object members of type resource will be
+          deserialized as NULL values.</para>
+
+          <para>Note that his has been implemented adding a "php_class"
+          attribute to xml representation of xmlrpcval of STRUCT type, which,
+          strictly speaking, breaks the xml-rpc spec. Other xmlrpc
+          implementations are supposed to ignore such an attribute (unless
+          they implement a brain-dead custom xml parser...), so it should be
+          safe enabling it in heterogeneous environments. The activation of
+          this feature is done by usage of an option passed as second
+          parameter to both <code>php_xmlrpc_encode</code> and
+          <code>php_xmlrpc_decode</code>.</para>
+        </listitem>
+
+        <listitem>
+          <para>Extend the <code>php_xmlrpc_encode</code> function to allow
+          automatic serialization of iso8601-conforming php strings as
+          datetime.iso8601 xmlrpcvals, by usage of an optional
+          parameter</para>
+        </listitem>
+
+        <listitem>
+          <para>Added an automatic stub code generator for converting xmlrpc
+          methods to php functions and vice-versa.</para>
+
+          <para>This is done via two new functions:
+          <code>wrap_php_function</code> and <code>wrap_xmlrpc_method</code>,
+          and has many caveats, with php being a typeless language and
+          all...</para>
+
+          <para>With PHP versions lesser than 5.0.3 wrapping of php functions
+          into xmlrpc methods is not supported yet.</para>
+        </listitem>
+
+        <listitem>
+          <para>Allow object methods to be used in server dispatch map</para>
+        </listitem>
+
+        <listitem>
+          <para>Added a complete debugger solution, in the
+          <filename>debugger</filename> folder</para>
+        </listitem>
+
+        <listitem>
+          <para>Added configurable server-side debug messages, controlled by
+          the new method <code>xmlrpc_server::SetDebug()</code>. At level 0,
+          no debug messages are sent to the client; level 1 is the same as the
+          old behaviour; at level 2 a lot more info is echoed back to the
+          client, regarding the received call; at level 3 all warnings raised
+          during server processing are trapped (this prevents breaking the xml
+          to be echoed back to the client) and added to the debug info sent
+          back to the client</para>
+        </listitem>
+
+        <listitem>
+          <para>New XML parsing code, yields smaller memory footprint and
+          faster execution times, not to mention complete elimination of the
+          dreaded <filename>eval()</filename> construct, so prone to code
+          injection exploits</para>
+        </listitem>
+
+        <listitem>
+          <para>Rewritten most of the error messages, making text more
+          explicative</para>
+        </listitem>
+      </itemizedlist>
+    </sect1>
+  </chapter>
+
+  <chapter id="requirements">
+    <title>System Requirements</title>
+
+    <para>The library has been designed with goals of scalability and backward
+    compatibility. As such, it supports a wide range of PHP installs. Note
+    that not all features of the lib are available in every
+    configuration.</para>
+
+    <para>The <emphasis>minimum supported</emphasis> PHP version is
+    5.0.</para>
+
+    <para>Automatic generation of xml-rpc methods from php functions is only
+    supported with PHP version 5.0.3 and later (note that the lib will
+    generate some warnings with PHP 5 in strict error reporting mode).</para>
+
+    <para>If you wish to use SSL or HTTP 1.1 to communicate with remote
+    servers, you need the "curl" extension compiled into your PHP
+    installation.</para>
+
+    <para>The "xmlrpc" native extension is not required to be compiled into
+    your PHP installation, but if it is, there will be no interference with
+    the operation of this library.</para>
+  </chapter>
+
+  <chapter id="manifest">
+    <title>Files in the distribution</title>
+
+    <glosslist>
+      <glossentry>
+        <glossterm>lib/xmlrpc.inc</glossterm>
+
+        <glossdef>
+          <para>the XML-RPC classes. <function>include()</function> this in
+          your PHP files to use the classes.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>lib/xmlrpcs.inc</glossterm>
+
+        <glossdef>
+          <para>the XML-RPC server class. <function>include()</function> this
+          in addition to xmlrpc.inc to get server functionality</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>lib/xmlrpc_wrappers.inc</glossterm>
+
+        <glossdef>
+          <para>helper functions to "automagically" convert plain php
+          functions to xmlrpc services and vice versa</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/server/proxy.php</glossterm>
+
+        <glossdef>
+          <para>a sample server implementing xmlrpc proxy
+          functionality.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/server/server.php</glossterm>
+
+        <glossdef>
+          <para>a sample server hosting various demo functions, as well as a
+          full suite of functions used for interoperability testing. It is
+          used by testsuite.php (see below) for unit testing the library, and
+          is not to be copied literally into your production servers</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/client/client.php, demo/client/agesort.php,
+        demo/client/which.php</glossterm>
+
+        <glossdef>
+          <para>client code to exercise some of the functions in server.php,
+          including the <function>interopEchoTests.whichToolkit</function>
+          method.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/client/wrap.php</glossterm>
+
+        <glossdef>
+          <para>client code to illustrate 'wrapping' of remote methods into
+          php functions.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/client/introspect.php</glossterm>
+
+        <glossdef>
+          <para>client code to illustrate usage of introspection capabilities
+          offered by server.php.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/client/mail.php</glossterm>
+
+        <glossdef>
+          <para>client code to illustrate usage of an xmlrpc-to-email gateway
+          using Dave Winer's XML-RPC server at userland.com.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/client/zopetest.php</glossterm>
+
+        <glossdef>
+          <para>example client code that queries an xmlrpc server built in
+          Zope.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/vardemo.php</glossterm>
+
+        <glossdef>
+          <para>examples of how to construct xmlrpcval types</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/demo1.txt, demo/demo2.txt, demo/demo3.txt</glossterm>
+
+        <glossdef>
+          <para>XML-RPC responses captured in a file for testing purposes (you
+          can use these to test the
+          <function>xmlrpcmsg-&gt;parseResponse()</function> method).</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>demo/server/discuss.php,
+        demo/client/comment.php</glossterm>
+
+        <glossdef>
+          <para>Software used in the PHP chapter of <xref
+          linkend="jellyfish" /> to provide a comment server and allow the
+          attachment of comments to stories from Meerkat's data store.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>test/testsuite.php, test/parse_args.php</glossterm>
+
+        <glossdef>
+          <para>A unit test suite for this software package. If you do
+          development on this software, please consider submitting tests for
+          this suite.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>test/benchmark.php</glossterm>
+
+        <glossdef>
+          <para>A (very limited) benchmarking suite for this software package.
+          If you do development on this software, please consider submitting
+          benchmarks for this suite.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>test/phpunit.php, test/PHPUnit/*.php</glossterm>
+
+        <glossdef>
+          <para>An (incomplete) version PEAR's unit test framework for PHP.
+          The complete package can be found at <ulink
+          
url="http://pear.php.net/package/PHPUnit";>http://pear.php.net/package/PHPUnit</ulink></para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>test/verify_compat.php</glossterm>
+
+        <glossdef>
+          <para>Script designed to help the user to verify the level of
+          compatibility of the library with the current php install</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>extras/test.pl, extras/test.py</glossterm>
+
+        <glossdef>
+          <para>Perl and Python programs to exercise server.php to test that
+          some of the methods work.</para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>extras/workspace.testPhpServer.fttb</glossterm>
+
+        <glossdef>
+          <para>Frontier scripts to exercise the demo server. Thanks to Dave
+          Winer for permission to include these. See <ulink
+          url="http://www.xmlrpc.com/discuss/msgReader$853";>Dave's
+          announcement of these.</ulink></para>
+        </glossdef>
+      </glossentry>
+
+      <glossentry>
+        <glossterm>extras/rsakey.pem</glossterm>
+
+        <glossdef>
+          <para>A test certificate key for the SSL support, which can be used
+          to generate dummy certificates. It has the passphrase "test."</para>
+        </glossdef>
+      </glossentry>
+    </glosslist>
+  </chapter>
+
+  <chapter id="bugs">
+    <title>Known bugs and limitations</title>
+
+    <para>This started out as a bare framework. Many "nice" bits haven't been
+    put in yet. Specifically, very little type validation or coercion has been
+    put in. PHP being a loosely-typed language, this is going to have to be
+    done explicitly (in other words: you can call a lot of library functions
+    passing them arguments of the wrong type and receive an error message only
+    much further down the code, where it will be difficult to
+    understand).</para>
+
+    <para>dateTime.iso8601 is supported opaquely. It can't be done natively as
+    the XML-RPC specification explicitly forbids passing of timezone
+    specifiers in ISO8601 format dates. You can, however, use the <xref
+    linkend="iso8601encode" /> and <xref linkend="iso8601decode" /> functions
+    to do the encoding and decoding for you.</para>
+
+    <para>Very little HTTP response checking is performed (e.g. HTTP redirects
+    are not followed and the Content-Length HTTP header, mandated by the
+    xml-rpc spec, is not validated); cookie support still involves quite a bit
+    of coding on the part of the user.</para>
+
+    <para>If a specific character set encoding other than US-ASCII, ISO-8859-1
+    or UTF-8 is received in the HTTP header or XML prologue of xml-rpc request
+    or response messages then it will be ignored for the moment, and the
+    content will be parsed as if it had been encoded using the charset defined
+    by <xref linkend="xmlrpc-defencoding" /></para>
+
+    <para>Support for receiving from servers version 1 cookies (i.e.
+    conforming to RFC 2965) is quite incomplete, and might cause unforeseen
+    errors.</para>
+  </chapter>
+
+  <chapter id="support">
+    <title>Support</title>
+
+    <sect1>
+      <title>Online Support</title>
+
+      <para>XML-RPC for PHP is offered "as-is" without any warranty or
+      commitment to support. However, informal advice and help is available
+      via the XML-RPC for PHP website and mailing list and from
+      XML-RPC.com.</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>The <emphasis>XML-RPC for PHP</emphasis> development is hosted
+          on <ulink
+          
url="http://phpxmlrpc.sourceforge.net";>phpxmlrpc.sourceforge.net</ulink>.
+          Bugs, feature requests and patches can be posted to the <ulink
+          url="http://sourceforge.net/projects/phpxmlrpc";>project's
+          website</ulink>.</para>
+        </listitem>
+
+        <listitem>
+          <para>The <emphasis>PHP XML-RPC interest mailing list</emphasis> is
+          run by the author. More details <ulink
+          url="http://lists.gnomehack.com/mailman/listinfo/phpxmlrpc";>can be
+          found here</ulink>.</para>
+        </listitem>
+
+        <listitem>
+          <para>For more general XML-RPC questions, there is a Yahoo! Groups
+          <ulink url="http://groups.yahoo.com/group/xml-rpc/";>XML-RPC mailing
+          list</ulink>.</para>
+        </listitem>
+
+        <listitem>
+          <para>The <ulink
+          url="http://www.xmlrpc.com/discuss";>XML-RPC.com</ulink> discussion
+          group is a useful place to get help with using XML-RPC. This group
+          is also gatewayed into the Yahoo! Groups mailing list.</para>
+        </listitem>
+      </itemizedlist>
+    </sect1>
+
+    <sect1 id="jellyfish" xreflabel="The Jellyfish Book">
+      <title>The Jellyfish Book</title>
+
+      <para><graphic align="right" depth="190" fileref="progxmlrpc.s.gif"
+      format="GIF" width="145" />Together with Simon St.Laurent and Joe
+      Johnston, Edd Dumbill wrote a book on XML-RPC for O'Reilly and
+      Associates on XML-RPC. It features a rather fetching jellyfish on the
+      cover.</para>
+
+      <para>Complete details of the book are <ulink
+      url="http://www.oreilly.com/catalog/progxmlrpc/";>available from
+      O'Reilly's web site.</ulink></para>
+
+      <para>Edd is responsible for the chapter on PHP, which includes a worked
+      example of creating a forum server, and hooking it up the O'Reilly's
+      <ulink url="http://meerkat.oreillynet.com/";>Meerkat</ulink> service in
+      order to allow commenting on news stories from around the Web.</para>
+
+      <para>If you've benefited from the effort that has been put into writing
+      this software, then please consider buying the book!</para>
+    </sect1>
+  </chapter>
+
+  <chapter id="apidocs">
+    <title>Class documentation</title>
+
+    <sect1 id="xmlrpcval" xreflabel="xmlrpcval">
+      <title>xmlrpcval</title>
+
+      <para>This is where a lot of the hard work gets done. This class enables
+      the creation and encapsulation of values for XML-RPC.</para>
+
+      <para>Ensure you've read the XML-RPC spec at <ulink
+      
url="http://www.xmlrpc.com/stories/storyReader$7";>http://www.xmlrpc.com/stories/storyReader$7</ulink>
+      before reading on as it will make things clearer.</para>
+
+      <para>The <classname>xmlrpcval</classname> class can store arbitrarily
+      complicated values using the following types: <literal>i4 int boolean
+      string double dateTime.iso8601 base64 array struct</literal>
+      <literal>null</literal>. You should refer to the <ulink
+      url="http://www.xmlrpc.com/spec";>spec</ulink> for more information on
+      what each of these types mean.</para>
+
+      <sect2>
+        <title>Notes on types</title>
+
+        <sect3>
+          <title>int</title>
+
+          <para>The type <classname>i4</classname> is accepted as a synonym
+          for <classname>int</classname> when creating xmlrpcval objects. The
+          xml parsing code will always convert <classname>i4</classname> to
+          <classname>int</classname>: <classname>int</classname> is regarded
+          by this implementation as the canonical name for this type.</para>
+        </sect3>
+
+        <sect3>
+          <title>base64</title>
+
+          <para>Base 64 encoding is performed transparently to the caller when
+          using this type. Decoding is also transparent. Therefore you ought
+          to consider it as a "binary" data type, for use when you want to
+          pass data that is not 7-bit clean.</para>
+        </sect3>
+
+        <sect3>
+          <title>boolean</title>
+
+          <para>The php values <literal>true</literal> and
+          <literal>1</literal> map to <literal>true</literal>. All other
+          values (including the empty string) are converted to
+          <literal>false</literal>.</para>
+        </sect3>
+
+        <sect3>
+          <title>string</title>
+
+          <para>Characters &lt;, &gt;, ', ", &amp;, are encoded using their
+          entity reference as &amp;lt; &amp;gt; &amp;apos; &amp;quot; and
+          &amp;amp; All other characters outside of the ASCII range are
+          encoded using their character reference representation (e.g.
+          &amp;#200 for é). The XML-RPC spec recommends only encoding
+          <literal>&lt; &amp;</literal> but this implementation goes further,
+          for reasons explained by <ulink
+          url="http://www.w3.org/TR/REC-xml#syntax";>the XML 1.0
+          recommendation</ulink>. In particular, using character reference
+          representation has the advantage of producing XML that is valid
+          independently of the charset encoding assumed.</para>
+        </sect3>
+
+        <sect3>
+          <title>null</title>
+
+          <para>There is no support for encoding <literal>null</literal>
+          values in the XML-RPC spec, but at least a couple of extensions (and
+          many toolkits) do support it. Before using <literal>null</literal>
+          values in your messages, make sure that the responding party accepts
+          them, and uses the same encoding convention (see ...).</para>
+        </sect3>
+      </sect2>
+
+      <sect2 id="xmlrpcval-creation" xreflabel="xmlrpcval constructors">
+        <title>Creation</title>
+
+        <para>The constructor is the normal way to create an
+        <classname>xmlrpcval</classname>. The constructor can take these
+        forms:</para>
+
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef><type>xmlrpcval</type>new
+            <function>xmlrpcval</function></funcdef>
+
+            <void />
+          </funcprototype>
+
+          <funcprototype>
+            <funcdef><type>xmlrpcval</type>new
+            <function>xmlrpcval</function></funcdef>
+
+            
<paramdef><type>string</type><parameter>$stringVal</parameter></paramdef>
+          </funcprototype>
+
+          <funcprototype>
+            <funcdef><type>xmlrpcval</type>new
+            <function>xmlrpcval</function></funcdef>
+
+            
<paramdef><type>mixed</type><parameter>$scalarVal</parameter></paramdef>
+
+            
<paramdef><type>string</type><parameter>$scalartyp</parameter></paramdef>
+          </funcprototype>
+
+          <funcprototype>
+            <funcdef><type>xmlrpcval</type>new
+            <function>xmlrpcval</function></funcdef>
+
+            
<paramdef><type>array</type><parameter>$arrayVal</parameter></paramdef>
+
+            
<paramdef><type>string</type><parameter>$arraytyp</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>The first constructor creates an empty value, which must be
+        altered using the methods <function>addScalar</function>,
+        <function>addArray</function> or <function>addStruct</function> before
+        it can be used.</para>
+
+        <para>The second constructor creates a simple string value.</para>
+
+        <para>The third constructor is used to create a scalar value. The
+        second parameter must be a name of an XML-RPC type. Valid types are:
+        "<literal>int</literal>", "<literal>boolean</literal>",
+        "<literal>string</literal>", "<literal>double</literal>",
+        "<literal>dateTime.iso8601</literal>", "<literal>base64</literal>" or
+        "null".</para>
+
+        <para>Examples:</para>
+
+        <programlisting language="php">
+$myInt = new xmlrpcvalue(1267, "int");
+$myString = new xmlrpcvalue("Hello, World!", "string");
+$myBool = new xmlrpcvalue(1, "boolean");
+$myString2 = new xmlrpcvalue(1.24, "string"); // note: this will serialize a 
php float value as xmlrpc string
+</programlisting>
+
+        <para>The fourth constructor form can be used to compose complex
+        XML-RPC values. The first argument is either a simple array in the
+        case of an XML-RPC <classname>array</classname> or an associative
+        array in the case of a <classname>struct</classname>. The elements of
+        the array <emphasis>must be <classname>xmlrpcval</classname> objects
+        themselves</emphasis>.</para>
+
+        <para>The second parameter must be either "<literal>array</literal>"
+        or "<literal>struct</literal>".</para>
+
+        <para>Examples:</para>
+
+        <programlisting language="php">
+$myArray = new xmlrpcval(
+  array(
+    new xmlrpcval("Tom"),
+    new xmlrpcval("Dick"),
+    new xmlrpcval("Harry")
+  ),
+  "array");
+
+// recursive struct
+$myStruct = new xmlrpcval(
+  array(
+    "name" =&gt; new xmlrpcval("Tom", "string"),
+    "age" =&gt; new xmlrpcval(34, "int"),
+    "address" =&gt; new xmlrpcval(
+      array(
+        "street" =&gt; new xmlrpcval("Fifht Ave", "string"),
+        "city" =&gt; new xmlrpcval("NY", "string")
+      ), 
+      "struct")
+  ), 
+  "struct");
+</programlisting>
+
+        <para>See the file <literal>vardemo.php</literal> in this distribution
+        for more examples.</para>
+      </sect2>
+
+      <sect2 id="xmlrpcval-methods" xreflabel="xmlrpcval methods">
+        <title>Methods</title>
+
+        <sect3>
+          <title>addScalar</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>int</type><function>addScalar</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$stringVal</parameter></paramdef>
+            </funcprototype>
+
+            <funcprototype>
+              <funcdef><type>int</type><function>addScalar</function></funcdef>
+
+              
<paramdef><type>mixed</type><parameter>$scalarVal</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$scalartyp</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>If <parameter>$val</parameter> is an empty
+          <classname>xmlrpcval</classname> this method makes it a scalar
+          value, and sets that value.</para>
+
+          <para>If <parameter>$val</parameter> is already a scalar value, then
+          no more scalars can be added and <literal>0</literal> is
+          returned.</para>
+
+          <para>If <parameter>$val</parameter> is an xmlrpcval of type array,
+          the php value <parameter>$scalarval</parameter> is added as its last
+          element.</para>
+
+          <para>If all went OK, <literal>1</literal> is returned, otherwise
+          <literal>0</literal>.</para>
+        </sect3>
+
+        <sect3>
+          <title>addArray</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>int</type><function>addArray</function></funcdef>
+
+              
<paramdef><type>array</type><parameter>$arrayVal</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>The argument is a simple (numerically indexed) array. The
+          elements of the array <emphasis>must be
+          <classname>xmlrpcval</classname> objects
+          themselves</emphasis>.</para>
+
+          <para>Turns an empty <classname>xmlrpcval</classname> into an
+          <classname>array</classname> with contents as specified by
+          <parameter>$arrayVal</parameter>.</para>
+
+          <para>If <parameter>$val</parameter> is an xmlrpcval of type array,
+          the elements of <parameter>$arrayVal</parameter> are appended to the
+          existing ones.</para>
+
+          <para>See the fourth constructor form for more information.</para>
+
+          <para>If all went OK, <literal>1</literal> is returned, otherwise
+          <literal>0</literal>.</para>
+        </sect3>
+
+        <sect3>
+          <title>addStruct</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>int</type><function>addStruct</function></funcdef>
+
+              
<paramdef><type>array</type><parameter>$assocArrayVal</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>The argument is an associative array. The elements of the
+          array <emphasis>must be <classname>xmlrpcval</classname> objects
+          themselves</emphasis>.</para>
+
+          <para>Turns an empty <classname>xmlrpcval</classname> into a
+          <classname>struct</classname> with contents as specified by
+          <parameter>$assocArrayVal</parameter>.</para>
+
+          <para>If <parameter>$val</parameter> is an xmlrpcval of type struct,
+          the elements of <parameter>$arrayVal</parameter> are merged with the
+          existing ones.</para>
+
+          <para>See the fourth constructor form for more information.</para>
+
+          <para>If all went OK, <literal>1</literal> is returned, otherwise
+          <literal>0</literal>.</para>
+        </sect3>
+
+        <sect3>
+          <title>kindOf</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>string</type><function>kindOf</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns a string containing "struct", "array" or "scalar"
+          describing the base type of the value. If it returns "undef" it
+          means that the value hasn't been initialised.</para>
+        </sect3>
+
+        <sect3>
+          <title>serialize</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>string</type><function>serialize</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns a string containing the XML-RPC representation of this
+          value.</para>
+        </sect3>
+
+        <sect3>
+          <title>scalarVal</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>mixed</type><function>scalarVal</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>If <function>$val-&gt;kindOf() == "scalar"</function>, this
+          method returns the actual PHP-language value of the scalar (base 64
+          decoding is automatically handled here).</para>
+        </sect3>
+
+        <sect3>
+          <title>scalarTyp</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>string</type><function>scalarTyp</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>If <function>$val-&gt;kindOf() == "scalar"</function>, this
+          method returns a string denoting the type of the scalar. As
+          mentioned before, <literal>i4</literal> is always coerced to
+          <literal>int</literal>.</para>
+        </sect3>
+
+        <sect3>
+          <title>arrayMem</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>xmlrpcval</type><function>arrayMem</function></funcdef>
+
+              <paramdef><type>int</type><parameter>$n</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>If <function>$val-&gt;kindOf() == "array"</function>, returns
+          the <parameter>$n</parameter>th element in the array represented by
+          the value <parameter>$val</parameter>. The value returned is an
+          <classname>xmlrpcval</classname> object.</para>
+
+          <para><programlisting language="php">
+// iterating over values of an array object
+for ($i = 0; $i &lt; $val-&gt;arraySize(); $i++)
+{
+  $v = $val-&gt;arrayMem($i);
+  echo "Element $i of the array is of type ".$v-&gt;kindOf();
+}
+</programlisting></para>
+        </sect3>
+
+        <sect3>
+          <title>arraySize</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>int</type><function>arraySize</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>If <parameter>$val</parameter> is an
+          <classname>array</classname>, returns the number of elements in that
+          array.</para>
+        </sect3>
+
+        <sect3>
+          <title>structMem</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>xmlrpcval</type><function>structMem</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$memberName</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>If <function>$val-&gt;kindOf() == "struct"</function>, returns
+          the element called <parameter>$memberName</parameter> from the
+          struct represented by the value <parameter>$val</parameter>. The
+          value returned is an <classname>xmlrpcval</classname> object.</para>
+        </sect3>
+
+        <sect3>
+          <title>structEach</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>array</type><function>structEach</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns the next (key, value) pair from the struct, when
+          <parameter>$val</parameter> is a struct.
+          <parameter>$value</parameter> is an xmlrpcval itself. See also <xref
+          linkend="structreset" />.</para>
+
+          <para><programlisting language="php">
+// iterating over all values of a struct object
+$val-&gt;structreset();
+while (list($key, $v) = $val-&gt;structEach())
+{
+  echo "Element $key of the struct is of type ".$v-&gt;kindOf();
+}
+</programlisting></para>
+        </sect3>
+
+        <sect3 id="structreset" xreflabel="structreset()">
+          <title>structReset</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>structReset</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Resets the internal pointer for
+          <function>structEach()</function> to the beginning of the struct,
+          where <parameter>$val</parameter> is a struct.</para>
+        </sect3>
+
+        <sect3 id="structmemexists" xreflabel="structmemexists()">
+          <title>structMemExists</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>bool</type><function>structMemExsists</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$memberName</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns <constant>TRUE</constant> or
+          <constant>FALSE</constant> depending on whether a member of the
+          given name exists in the struct.</para>
+        </sect3>
+      </sect2>
+    </sect1>
+
+    <sect1 id="xmlrpcmsg" xreflabel="xmlrpcmsg">
+      <title>xmlrpcmsg</title>
+
+      <para>This class provides a representation for a request to an XML-RPC
+      server. A client sends an <classname>xmlrpcmsg</classname> to a server,
+      and receives back an <classname>xmlrpcresp</classname> (see <xref
+      linkend="xmlrpc-client-send" />).</para>
+
+      <sect2>
+        <title>Creation</title>
+
+        <para>The constructor takes the following forms:</para>
+
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef><type>xmlrpcmsg</type>new
+            <function>xmlrpcmsg</function></funcdef>
+
+            
<paramdef><type>string</type><parameter>$methodName</parameter></paramdef>
+
+            
<paramdef><type>array</type><parameter>$parameterArray</parameter><initializer>null</initializer></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Where <parameter>methodName</parameter> is a string indicating
+        the name of the method you wish to invoke, and
+        <parameter>parameterArray</parameter> is a simple php
+        <classname>Array</classname> of <classname>xmlrpcval</classname>
+        objects. Here's an example message to the <emphasis>US state
+        name</emphasis> server:</para>
+
+        <programlisting language="php">
+$msg = new xmlrpcmsg("examples.getStateName", array(new xmlrpcval(23, "int")));
+</programlisting>
+
+        <para>This example requests the name of state number 23. For more
+        information on <classname>xmlrpcval</classname> objects, see <xref
+        linkend="xmlrpcval" />.</para>
+
+        <para>Note that the <parameter>parameterArray</parameter> parameter is
+        optional and can be omitted for methods that take no input parameters
+        or if you plan to add parameters one by one.</para>
+      </sect2>
+
+      <sect2>
+        <title>Methods</title>
+
+        <sect3>
+          <title>addParam</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>bool</type><function>addParam</function></funcdef>
+
+              
<paramdef><type>xmlrpcval</type><parameter>$xmlrpcVal</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Adds the <classname>xmlrpcval</classname>
+          <parameter>xmlrpcVal</parameter> to the parameter list for this
+          method call. Returns TRUE or FALSE on error.</para>
+        </sect3>
+
+        <sect3>
+          <title>getNumParams</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>int</type><function>getNumParams</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns the number of parameters attached to this
+          message.</para>
+        </sect3>
+
+        <sect3>
+          <title>getParam</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>xmlrpcval</type><function>getParam</function></funcdef>
+
+              <paramdef><type>int</type><parameter>$n</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Gets the <parameter>n</parameter>th parameter in the message
+          (with the index zero-based). Use this method in server
+          implementations to retrieve the values sent by the client.</para>
+        </sect3>
+
+        <sect3>
+          <title>method</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>string</type><function>method</function></funcdef>
+
+              <void />
+            </funcprototype>
+
+            <funcprototype>
+              <funcdef><type>string</type><function>method</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$methName</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Gets or sets the method contained in the XML-RPC
+          message.</para>
+        </sect3>
+
+        <sect3>
+          <title>parseResponse</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>xmlrpcresp</type><function>parseResponse</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$xmlString</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Given an incoming XML-RPC server response contained in the
+          string <parameter>$xmlString</parameter>, this method constructs an
+          <classname>xmlrpcresp</classname> response object and returns it,
+          setting error codes as appropriate (see <xref
+          linkend="xmlrpc-client-send" />).</para>
+
+          <para>This method processes any HTTP/MIME headers it finds.</para>
+        </sect3>
+
+        <sect3>
+          <title>parseResponseFile</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>xmlrpcresp</type><function>parseResponseFile</function></funcdef>
+
+              <paramdef><type>file handle
+              resource</type><parameter>$fileHandle</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Given an incoming XML-RPC server response on the open file
+          handle <parameter>fileHandle</parameter>, this method reads all the
+          data it finds and passes it to
+          <function>parseResponse.</function></para>
+
+          <para>This method is useful to construct responses from pre-prepared
+          files (see files <literal>demo1.txt, demo2.txt, demo3.txt</literal>
+          in this distribution). It processes any HTTP headers it finds, and
+          does not close the file handle.</para>
+        </sect3>
+
+        <sect3>
+          <title>serialize</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>string
+              </type><function>serialize</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns the an XML string representing the XML-RPC
+          message.</para>
+        </sect3>
+      </sect2>
+    </sect1>
+
+    <sect1 id="xmlrpc-client" xreflabel="xmlrpc_client">
+      <title>xmlrpc_client</title>
+
+      <para>This is the basic class used to represent a client of an XML-RPC
+      server.</para>
+
+      <sect2>
+        <title>Creation</title>
+
+        <para>The constructor accepts one of two possible syntaxes:</para>
+
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef><type>xmlrpc_client</type>new
+            <function>xmlrpc_client</function></funcdef>
+
+            
<paramdef><type>string</type><parameter>$server_url</parameter></paramdef>
+          </funcprototype>
+
+          <funcprototype>
+            <funcdef><type>xmlrpc_client</type>new
+            <function>xmlrpc_client</function></funcdef>
+
+            
<paramdef><type>string</type><parameter>$server_path</parameter></paramdef>
+
+            
<paramdef><type>string</type><parameter>$server_hostname</parameter></paramdef>
+
+            
<paramdef><type>int</type><parameter>$server_port</parameter><initializer>80</initializer></paramdef>
+
+            
<paramdef><type>string</type><parameter>$transport</parameter><initializer>'http'</initializer></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Here are a couple of usage examples of the first form:</para>
+
+        <programlisting language="php">
+$client = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php";);
+$another_client = new 
xmlrpc_client("https://james:address@hidden:443/xmlrpcserver?agent=007";);
+</programlisting>
+
+        <para>The second syntax does not allow to express a username and
+        password to be used for basic HTTP authorization as in the second
+        example above, but instead it allows to choose whether xmlrpc calls
+        will be made using the HTTP 1.0 or 1.1 protocol.</para>
+
+        <para>Here's another example client set up to query Userland's XML-RPC
+        server at <emphasis>betty.userland.com</emphasis>:</para>
+
+        <programlisting language="php">
+$client = new xmlrpc_client("/RPC2", "betty.userland.com", 80);
+</programlisting>
+
+        <para>The <parameter>server_port</parameter> parameter is optional,
+        and if omitted will default to 80 when using HTTP and 443 when using
+        HTTPS (see the <xref linkend="xmlrpc-client-send" /> method
+        below).</para>
+
+        <para>The <parameter>transport</parameter> parameter is optional, and
+        if omitted will default to 'http'. Allowed values are either
+        '<symbol>http'</symbol>, '<symbol>https</symbol>' or
+        '<symbol>http11'</symbol>. Its value can be overridden with every call
+        to the <methodname>send</methodname> method. See the
+        <methodname>send</methodname> method below for more details about the
+        meaning of the different values.</para>
+      </sect2>
+
+      <sect2>
+        <title>Methods</title>
+
+        <para>This class supports the following methods.</para>
+
+        <sect3 id="xmlrpc-client-send" xreflabel="xmlrpc_client-&gt;send">
+          <title>send</title>
+
+          <para>This method takes the forms:</para>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>xmlrpcresp</type><function>send</function></funcdef>
+
+              
<paramdef><type>xmlrpcmsg</type><parameter>$xmlrpc_message</parameter></paramdef>
+
+              
<paramdef><type>int</type><parameter>$timeout</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$transport</parameter></paramdef>
+            </funcprototype>
+
+            <funcprototype>
+              <funcdef><type>array</type><function>send</function></funcdef>
+
+              
<paramdef><type>array</type><parameter>$xmlrpc_messages</parameter></paramdef>
+
+              
<paramdef><type>int</type><parameter>$timeout</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$transport</parameter></paramdef>
+            </funcprototype>
+
+            <funcprototype>
+              
<funcdef><type>xmlrpcresp</type><function>send</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$xml_payload</parameter></paramdef>
+
+              
<paramdef><type>int</type><parameter>$timeout</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$transport</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Where <parameter>xmlrpc_message</parameter> is an instance of
+          <classname>xmlrpcmsg</classname> (see <xref linkend="xmlrpcmsg" />),
+          and <parameter>response</parameter> is an instance of
+          <classname>xmlrpcresp</classname> (see <xref
+          linkend="xmlrpcresp" />).</para>
+
+          <para><parameter>If xmlrpc_messages</parameter> is an array of
+          message instances, <code>responses</code> will be an array of
+          response instances. The client will try to make use of a single
+          <code>system.multicall</code> xml-rpc method call to forward to the
+          server all the messages in a single HTTP round trip, unless
+          <code>$client-&gt;no_multicall</code> has been previously set to
+          <code>TRUE</code> (see the multicall method below), in which case
+          many consecutive xmlrpc requests will be sent.</para>
+
+          <para>The third syntax allows to build by hand (or any other means)
+          a complete xmlrpc request message, and send it to the server.
+          <parameter>xml_payload</parameter> should be a string containing the
+          complete xml representation of the request. It is e.g. useful when,
+          for maximal speed of execution, the request is serialized into a
+          string using the native php xmlrpc functions (see <ulink
+          url="http://www.php.net/xmlrpc";>the php manual on
+          xmlrpc</ulink>).</para>
+
+          <para>The <parameter>timeout</parameter> is optional, and will be
+          set to <literal>0</literal> (wait for platform-specific predefined
+          timeout) if omitted. This timeout value is passed to
+          <function>fsockopen()</function>. It is also used for detecting
+          server timeouts during communication (i.e. if the server does not
+          send anything to the client for <parameter>timeout</parameter>
+          seconds, the connection will be closed).</para>
+
+          <para>The <parameter>transport</parameter> parameter is optional,
+          and if omitted will default to the transport set using instance
+          creator or 'http' if omitted. The only other valid values are
+          'https', which will use an SSL HTTP connection to connect to the
+          remote server, and 'http11'. Note that your PHP must have the "curl"
+          extension compiled in order to use both these features. Note that
+          when using SSL you should normally set your port number to 443,
+          unless the SSL server you are contacting runs at any other
+          port.</para>
+
+          <warning>
+            <para>PHP 4.0.6 has a bug which prevents SSL working.</para>
+          </warning>
+
+          <para>In addition to low-level errors, the XML-RPC server you were
+          querying may return an error in the
+          <classname>xmlrpcresp</classname> object. See <xref
+          linkend="xmlrpcresp" /> for details of how to handle these
+          errors.</para>
+        </sect3>
+
+        <sect3 id="multicall" xreflabel="xmlrpc_client-&gt;multicall">
+          <title>multiCall</title>
+
+          <para>This method takes the form:</para>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>array</type><function>multiCall</function></funcdef>
+
+              
<paramdef><type>array</type><parameter>$messages</parameter></paramdef>
+
+              
<paramdef><type>int</type><parameter>$timeout</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$transport</parameter></paramdef>
+
+              
<paramdef><type>bool</type><parameter>$fallback</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method is used to boxcar many method calls in a single
+          xml-rpc request. It will try first to make use of the
+          <code>system.multicall</code> xml-rpc method call, and fall back to
+          executing many separate requests if the server returns any
+          error.</para>
+
+          <para><parameter>msgs</parameter> is an array of
+          <classname>xmlrpcmsg</classname> objects (see <xref
+          linkend="xmlrpcmsg" />), and <parameter>response</parameter> is an
+          array of <classname>xmlrpcresp</classname> objects (see <xref
+          linkend="xmlrpcresp" />).</para>
+
+          <para>The <parameter>timeout</parameter> and
+          <parameter>transport</parameter> parameters are optional, and behave
+          as in the <methodname>send</methodname> method above.</para>
+
+          <para>The <parameter>fallback</parameter> parameter is optional, and
+          defaults to <constant>TRUE</constant>. When set to
+          <constant>FALSE</constant> it will prevent the client to try using
+          many single method calls in case of failure of the first multicall
+          request. It should be set only when the server is known to support
+          the multicall extension.</para>
+        </sect3>
+
+        <sect3>
+          <title>setAcceptedCompression</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>setAcceptedCompression</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$compressionmethod</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method defines whether the client will accept compressed
+          xml payload forming the bodies of the xmlrpc responses received from
+          servers. Note that enabling reception of compressed responses merely
+          adds some standard http headers to xmlrpc requests. It is up to the
+          xmlrpc server to return compressed responses when receiving such
+          requests. Allowed values for
+          <parameter>compressionmethod</parameter> are: 'gzip', 'deflate',
+          'any' or null (with any meaning either gzip or deflate).</para>
+
+          <para>This requires the "zlib" extension to be enabled in your php
+          install. If it is, by default <classname>xmlrpc_client</classname>
+          instances will enable reception of compressed content.</para>
+        </sect3>
+
+        <sect3>
+          <title>setCaCertificate</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>setCaCertificate</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$certificate</parameter></paramdef>
+
+              
<paramdef><type>bool</type><parameter>$is_dir</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method sets an optional certificate to be used in
+          SSL-enabled communication to validate a remote server with (when the
+          <parameter>server_method</parameter> is set to 'https' in the
+          client's construction or in the send method and
+          <methodname>SetSSLVerifypeer</methodname> has been set to
+          <constant>TRUE</constant>).</para>
+
+          <para>The <parameter>certificate</parameter> parameter must be the
+          filename of a PEM formatted certificate, or a directory containing
+          multiple certificate files. The <parameter>is_dir</parameter>
+          parameter defaults to <constant>FALSE</constant>, set it to
+          <constant>TRUE</constant> to specify that
+          <parameter>certificate</parameter> indicates a directory instead of
+          a single file.</para>
+
+          <para>This requires the "curl" extension to be compiled into your
+          installation of PHP. For more details see the man page for the
+          <function>curl_setopt</function> function.</para>
+        </sect3>
+
+        <sect3>
+          <title>setCertificate</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>setCertificate</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$certificate</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$passphrase</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method sets the optional certificate and passphrase used
+          in SSL-enabled communication with a remote server (when the
+          <parameter>server_method</parameter> is set to 'https' in the
+          client's construction or in the send method).</para>
+
+          <para>The <parameter>certificate</parameter> parameter must be the
+          filename of a PEM formatted certificate. The
+          <parameter>passphrase</parameter> parameter must contain the
+          password required to use the certificate.</para>
+
+          <para>This requires the "curl" extension to be compiled into your
+          installation of PHP. For more details see the man page for the
+          <function>curl_setopt</function> function.</para>
+
+          <para>Note: to retrieve information about the client certificate on
+          the server side, you will need to look into the environment
+          variables which are set up by the webserver. Different webservers
+          will typically set up different variables.</para>
+        </sect3>
+
+        <sect3>
+          <title>setCookie</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>setCookie</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$name</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$value</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$path</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$domain</parameter></paramdef>
+
+              <paramdef><type>int</type><parameter>$port</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method sets a cookie that will be sent to the xmlrpc
+          server along with every further request (useful e.g. for keeping
+          session info outside of the xml-rpc payload).</para>
+
+          <para><parameter>$value</parameter> is optional, and defaults to
+          null.</para>
+
+          <para><parameter>$path, $domain and $port</parameter> are optional,
+          and will be omitted from the cookie header if unspecified. Note that
+          setting any of these values will turn the cookie into a 'version 1'
+          cookie, that might not be fully supported by the server (see RFC2965
+          for more details).</para>
+        </sect3>
+
+        <sect3>
+          <title>setCredentials</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>setCredentials</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$username</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$password</parameter></paramdef>
+
+              
<paramdef><type>int</type><parameter>$authtype</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method sets the username and password for authorizing the
+          client to a server. With the default (HTTP) transport, this
+          information is used for HTTP Basic authorization. Note that username
+          and password can also be set using the class constructor. With HTTP
+          1.1 and HTTPS transport, NTLM and Digest authentication protocols
+          are also supported. To enable them use the constants
+          <constant>CURLAUTH_DIGEST</constant> and
+          <constant>CURLAUTH_NTLM</constant> as values for the authtype
+          parameter.</para>
+        </sect3>
+
+        <sect3>
+          <title>setCurlOptions</title>
+
+          <para><funcsynopsis>
+              <funcprototype>
+                
<funcdef><type>void</type><function>setCurlOptions</function></funcdef>
+
+                
<paramdef><type>array</type><parameter>$options</parameter></paramdef>
+              </funcprototype>
+            </funcsynopsis>This method allows to directly set any desired
+          option to manipulate the usage of the cURL client (when in cURL
+          mode). It can be used eg. to explicitly bind to an outgoing ip
+          address when the server is multihomed</para>
+        </sect3>
+
+        <sect3>
+          <title>setDebug</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>void</type><function>setDebug</function></funcdef>
+
+              
<paramdef><type>int</type><parameter>$debugLvl</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para><parameter>debugLvl</parameter> is either <literal>0,
+          1</literal> or 2 depending on whether you require the client to
+          print debugging information to the browser. The default is not to
+          output this information (0).</para>
+
+          <para>The debugging information at level 1includes the raw data
+          returned from the XML-RPC server it was querying (including bot HTTP
+          headers and the full XML payload), and the PHP value the client
+          attempts to create to represent the value returned by the server. At
+          level2, the complete payload of the xmlrpc request is also printed,
+          before being sent t the server.</para>
+
+          <para>This option can be very useful when debugging servers as it
+          allows you to see exactly what the client sends and the server
+          returns.</para>
+        </sect3>
+
+        <sect3>
+          <title>setKey</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>void</type><function>setKey</function></funcdef>
+
+              <paramdef><type>int</type><parameter>$key</parameter></paramdef>
+
+              
<paramdef><type>int</type><parameter>$keypass</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method sets the optional certificate key and passphrase
+          used in SSL-enabled communication with a remote server (when the
+          <parameter>transport</parameter> is set to 'https' in the client's
+          construction or in the send method).</para>
+
+          <para>This requires the "curl" extension to be compiled into your
+          installation of PHP. For more details see the man page for the
+          <function>curl_setopt</function> function.</para>
+        </sect3>
+
+        <sect3>
+          <title>setProxy</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>void</type><function>setProxy</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$proxyhost</parameter></paramdef>
+
+              
<paramdef><type>int</type><parameter>$proxyport</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$proxyusername</parameter></paramdef>
+
+              
<paramdef><type>string</type><parameter>$proxypassword</parameter></paramdef>
+
+              
<paramdef><type>int</type><parameter>$authtype</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method enables calling servers via an HTTP proxy. The
+          <parameter>proxyusername</parameter>,<parameter>
+          proxypassword</parameter> and <parameter>authtype</parameter>
+          parameters are optional. <parameter>Authtype</parameter> defaults to
+          <constant>CURLAUTH_BASIC</constant> (Basic authentication protocol);
+          the only other valid value is the constant
+          <constant>CURLAUTH_NTLM</constant>, and has effect only when the
+          client uses the HTTP 1.1 protocol.</para>
+
+          <para>NB: CURL versions before 7.11.10 cannot use a proxy to
+          communicate with https servers.</para>
+        </sect3>
+
+        <sect3>
+          <title>setRequestCompression</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>setRequestCompression</function></funcdef>
+
+              
<paramdef><type>string</type><parameter>$compressionmethod</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method defines whether the xml payload forming the
+          request body will be sent to the server in compressed format, as per
+          the HTTP specification. This is particularly useful for large
+          request parameters and over slow network connections. Allowed values
+          for <parameter>compressionmethod</parameter> are: 'gzip', 'deflate',
+          'any' or null (with any meaning either gzip or deflate). Note that
+          there is no automatic fallback mechanism in place for errors due to
+          servers not supporting receiving compressed request bodies, so make
+          sure that the particular server you are querying does accept
+          compressed requests before turning it on.</para>
+
+          <para>This requires the "zlib" extension to be enabled in your php
+          install.</para>
+        </sect3>
+
+        <sect3>
+          <title>setSSLVerifyHost</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>setSSLVerifyHost</function></funcdef>
+
+              <paramdef><type>int</type><parameter>$i</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method defines whether connections made to XML-RPC
+          backends via HTTPS should verify the remote host's SSL certificate's
+          common name (CN). By default, only the existence of a CN is checked.
+          <parameter><parameter>$i</parameter></parameter> should be an
+          integer value; 0 to not check the CN at all, 1 to merely check for
+          its existence, and 2 to check that the CN on the certificate matches
+          the hostname that is being connected to.</para>
+        </sect3>
+
+        <sect3>
+          <title>setSSLVerifyPeer</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>void</type><function>setSSLVerifyPeer</function></funcdef>
+
+              <paramdef><type>bool</type><parameter>$i</parameter></paramdef>
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>This method defines whether connections made to XML-RPC
+          backends via HTTPS should verify the remote host's SSL certificate,
+          and cause the connection to fail if the cert verification fails.
+          <parameter><parameter>$i</parameter></parameter> should be a boolean
+          value. Default value: <constant>TRUE</constant>. To specify custom
+          SSL certificates to validate the server with, use the
+          <methodname>setCaCertificate</methodname> method.</para>
+        </sect3>
+
+        <sect3>
+          <title>setUserAgent</title>
+
+          <para><funcsynopsis>
+              <funcprototype>
+                
<funcdef><type>void</type><function>Useragent</function></funcdef>
+
+                
<paramdef><type>string</type><parameter>$useragent</parameter></paramdef>
+              </funcprototype>
+            </funcsynopsis>This method sets a custom user-agent that will be
+          used by the client in the http headers sent with the request. The
+          default value is built using the library name and version
+          constants.</para>
+        </sect3>
+      </sect2>
+
+      <sect2>
+        <title>Variables</title>
+
+        <para>NB: direct manipulation of these variables is only recommended
+        for advanced users.</para>
+
+        <sect3>
+          <title>no_multicall</title>
+
+          <para>This member variable determines whether the multicall() method
+          will try to take advantage of the system.multicall xmlrpc method to
+          dispatch to the server an array of requests in a single http
+          roundtrip or simply execute many consecutive http calls. Defaults to
+          FALSE, but it will be enabled automatically on the first failure of
+          execution of system.multicall.</para>
+        </sect3>
+
+        <sect3>
+          <title>request_charset_encoding</title>
+
+          <para>This is the charset encoding that will be used for serializing
+          request sent by the client.</para>
+
+          <para>If defaults to NULL, which means using US-ASCII and encoding
+          all characters outside of the ASCII range using their xml character
+          entity representation (this has the benefit that line end characters
+          will not be mangled in the transfer, a CR-LF will be preserved as
+          well as a singe LF).</para>
+
+          <para>Valid values are 'US-ASCII', 'UTF-8' and 'ISO-8859-1'</para>
+        </sect3>
+
+        <sect3 id="return-type" xreflabel="return_type">
+          <title>return_type</title>
+
+          <para>This member variable determines whether the value returned
+          inside an xmlrpcresp object as results of calls to the send() and
+          multicall() methods will be an xmlrpcval object, a plain php value
+          or a raw xml string. Allowed values are 'xmlrpcvals' (the default),
+          'phpvals' and 'xml'. To allow the user to differentiate between a
+          correct and a faulty response, fault responses will be returned as
+          xmlrpcresp objects in any case. Note that the 'phpvals' setting will
+          yield faster execution times, but some of the information from the
+          original response will be lost. It will be e.g. impossible to tell
+          whether a particular php string value was sent by the server as an
+          xmlrpc string or base64 value.</para>
+
+          <para>Example usage:</para>
+
+          <programlisting language="php">
+$client = new xmlrpc_client("phpxmlrpc.sourceforge.net/server");
+$client-&gt;return_type = 'phpvals';
+$message = new xmlrpcmsg("examples.getStateName", array(new xmlrpcval(23, 
"int")));
+$resp = $client-&gt;send($message);
+if ($resp-&gt;faultCode()) echo 'KO. Error: '.$resp-&gt;faultString(); else 
echo 'OK: got '.$resp-&gt;value();
+</programlisting>
+
+          <para>For more details about usage of the 'xml' value, see Appendix
+          A.</para>
+        </sect3>
+      </sect2>
+    </sect1>
+
+    <sect1 id="xmlrpcresp" xreflabel="xmlrpcresp">
+      <title>xmlrpcresp</title>
+
+      <para>This class is used to contain responses to XML-RPC requests. A
+      server method handler will construct an
+      <classname>xmlrpcresp</classname> and pass it as a return value. This
+      same value will be returned by the result of an invocation of the
+      <function>send</function> method of the
+      <classname>xmlrpc_client</classname> class.</para>
+
+      <sect2>
+        <title>Creation</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef><type>xmlrpcresp</type>new
+            <function>xmlrpcresp</function></funcdef>
+
+            
<paramdef><type>xmlrpcval</type><parameter>$xmlrpcval</parameter></paramdef>
+          </funcprototype>
+
+          <funcprototype>
+            <funcdef><type>xmlrpcresp</type>new
+            <function>xmlrpcresp</function></funcdef>
+
+            <paramdef><parameter>0</parameter></paramdef>
+
+            
<paramdef><type>int</type><parameter>$errcode</parameter></paramdef>
+
+            
<paramdef><type>string</type><parameter>$err_string</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>The first syntax is used when execution has happened without
+        difficulty: <parameter>$xmlrpcval</parameter> is an
+        <classname>xmlrpcval</classname> value with the result of the method
+        execution contained in it. Alternatively it can be a string containing
+        the xml serialization of the single xml-rpc value result of method
+        execution.</para>
+
+        <para>The second type of constructor is used in case of failure.
+        <parameter>errcode</parameter> and <parameter>err_string</parameter>
+        are used to provide indication of what has gone wrong. See <xref
+        linkend="xmlrpc-server" /> for more information on passing error
+        codes.</para>
+      </sect2>
+
+      <sect2>
+        <title>Methods</title>
+
+        <sect3>
+          <title>faultCode</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              <funcdef><type>int</type><function>faultCode</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns the integer fault code return from the XML-RPC
+          response. A zero value indicates success, any other value indicates
+          a failure response.</para>
+        </sect3>
+
+        <sect3>
+          <title>faultString</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>string</type><function>faultString</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns the human readable explanation of the fault indicated
+          by <function>$resp-&gt;faultCode</function>().</para>
+        </sect3>
+
+        <sect3>
+          <title>value</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>xmlrpcval</type><function>value</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns an <classname>xmlrpcval</classname> object containing
+          the return value sent by the server. If the response's
+          <function>faultCode</function> is non-zero then the value returned
+          by this method should not be used (it may not even be an
+          object).</para>
+
+          <para>Note: if the xmlrpcresp instance in question has been created
+          by an <classname>xmlrpc_client</classname> object whose
+          <varname>return_type</varname> was set to 'phpvals', then a plain
+          php value will be returned instead of an
+          <classname>xmlrpcval</classname> object. If the
+          <varname>return_type</varname> was set to 'xml', an xml string will
+          be returned (see the return_type member var above for more
+          details).</para>
+        </sect3>
+
+        <sect3>
+          <title>serialize</title>
+
+          <funcsynopsis>
+            <funcprototype>
+              
<funcdef><type>string</type><function>serialize</function></funcdef>
+
+              <void />
+            </funcprototype>
+          </funcsynopsis>
+
+          <para>Returns an XML string representation of the response (xml
+          prologue not included).</para>
+        </sect3>
+      </sect2>
+    </sect1>
+
+    <sect1 id="xmlrpc-server" xreflabel="xmlrpc_server">
+      <title>xmlrpc_server</title>
+
+      <para>The implementation of this class has been kept as simple to use as
+      possible. The constructor for the server basically does all the work.
+      Here's a minimal example:</para>
+
+      <programlisting language="php">
+  function foo ($xmlrpcmsg) {
+    ...
+    return new xmlrpcresp($some_xmlrpc_val);
+  }
+
+  class bar {
+    function foobar($xmlrpcmsg) {
+      ...
+      return new xmlrpcresp($some_xmlrpc_val);
+    }
+  }
+
+  $s = new xmlrpc_server(
+    array(
+      "examples.myFunc1" =&gt; array("function" =&gt; "foo"),
+      "examples.myFunc2" =&gt; array("function" =&gt; "bar::foobar"),
+    ));
+</programlisting>
+
+      <para>This performs everything you need to do with a server. The single
+      constructor argument is an associative array from xmlrpc method names to
+      php function names. The incoming request is parsed and dispatched to the
+      relevant php function, which is responsible for returning a
+      <classname>xmlrpcresp</classname> object, that will be serialized back
+      to the caller.</para>
+
+      <sect2>
+        <title>Method handler functions</title>
+
+        <para>Both php functions and class methods can be registered as xmlrpc
+        method handlers.</para>
+
+        <para>The synopsis of a method handler function is:</para>
+
+        <para><synopsis>xmlrpcresp $resp = function (xmlrpcmsg 
$msg)</synopsis></para>
+
+        <para>No text should be echoed 'to screen' by the handler function, or
+        it will break the xml response sent back to the client. This applies
+        also to error and warning messages that PHP prints to screen unless
+        the appropriate parameters have been set in the php.in file. Another
+        way to prevent echoing of errors inside the response and facilitate
+        debugging is to use the server SetDebug method with debug level 3 (see
+        ...). Exceptions thrown duting execution of handler functions are
+        caught by default and a XML-RPC error reponse is generated instead.
+        This behaviour can be finetuned by usage of the
+        <varname>exception_handling</varname> member variable (see
+        ...).</para>
+
+        <para>Note that if you implement a method with a name prefixed by
+        <code>system.</code> the handler function will be invoked by the
+        server with two parameters, the first being the server itself and the
+        second being the <classname>xmlrpcmsg</classname> object.</para>
+
+        <para>The same php function can be registered as handler of multiple
+        xmlrpc methods.</para>
+
+        <para>Here is a more detailed example of what the handler function
+        <function>foo</function> may do:</para>
+
+        <programlisting language="php">
+  function foo ($xmlrpcmsg) {
+    global $xmlrpcerruser; // import user errcode base value
+
+    $meth = $xmlrpcmsg-&gt;method(); // retrieve method name
+    $par = $xmlrpcmsg-&gt;getParam(0); // retrieve value of first parameter - 
assumes at least one param received
+    $val = $par-&gt;scalarval(); // decode value of first parameter - assumes 
it is a scalar value
+
+    ...
+
+    if ($err) {
+      // this is an error condition
+      return new xmlrpcresp(0, $xmlrpcerruser+1, // user error 1
+        "There's a problem, Captain");
+    } else {
+      // this is a successful value being returned
+      return new xmlrpcresp(new xmlrpcval("All's fine!", "string"));
+    }
+  }
+</programlisting>
+
+        <para>See <filename>server.php</filename> in this distribution for
+        more examples of how to do this.</para>
+
+        <para>Since release 2.0RC3 there is a new, even simpler way of
+        registering php functions with the server. See section 5.7
+        below</para>
+      </sect2>
+
+      <sect2>
+        <title>The dispatch map</title>
+
+        <para>The first argument to the <function>xmlrpc_server</function>
+        constructor is an array, called the <emphasis>dispatch map</emphasis>.
+        In this array is the information the server needs to service the
+        XML-RPC methods you define.</para>
+
+        <para>The dispatch map takes the form of an associative array of
+        associative arrays: the outer array has one entry for each method, the
+        key being the method name. The corresponding value is another
+        associative array, which can have the following members:</para>
+
+        <itemizedlist>
+          <listitem>
+            <para><function><literal>function</literal></function> - this
+            entry is mandatory. It must be either a name of a function in the
+            global scope which services the XML-RPC method, or an array
+            containing an instance of an object and a static method name (for
+            static class methods the 'class::method' syntax is also
+            supported).</para>
+          </listitem>
+
+          <listitem>
+            <para><function><literal>signature</literal></function> - this
+            entry is an array containing the possible signatures (see <xref
+            linkend="signatures" />) for the method. If this entry is present
+            then the server will check that the correct number and type of
+            parameters have been sent for this method before dispatching
+            it.</para>
+          </listitem>
+
+          <listitem>
+            <para><function><literal>docstring</literal></function> - this
+            entry is a string containing documentation for the method. The
+            documentation may contain HTML markup.</para>
+          </listitem>
+
+          <listitem>
+            <para><literal>signature_docs</literal> - this entry can be used
+            to provide documentation for the single parameters. It must match
+            in structure the 'signature' member. By default, only the
+            <classname>documenting_xmlrpc_server</classname> class in the
+            extras package will take advantage of this, since the
+            "system.methodHelp" protocol does not support documenting method
+            parameters individually.</para>
+          </listitem>
+
+          <listitem>
+            <para><literal>parameters_type</literal> - this entry can be used
+            when the server is working in 'xmlrpcvals' mode (see ...) to
+            define one or more entries in the dispatch map as being functions
+            that follow the 'phpvals' calling convention. The only useful
+            value is currently the string <literal>phpvals</literal>.</para>
+          </listitem>
+        </itemizedlist>
+
+        <para>Look at the <filename>server.php</filename> example in the
+        distribution to see what a dispatch map looks like.</para>
+      </sect2>
+
+      <sect2 id="signatures" xreflabel="Signatures">
+        <title>Method signatures</title>
+
+        <para>A signature is a description of a method's return type and its
+        parameter types. A method may have more than one signature.</para>
+
+        <para>Within a server's dispatch map, each method has an array of
+        possible signatures. Each signature is an array of types. The first
+        entry is the return type. For instance, the method <programlisting
+        language="php">string examples.getStateName(int)
+</programlisting> has the signature <programlisting 
language="php">array($xmlrpcString, $xmlrpcInt)
+</programlisting> and, assuming that it is the only possible signature for the
+        method, it might be used like this in server creation: <programlisting
+        language="php">
+$findstate_sig = array(array($xmlrpcString, $xmlrpcInt));
+
+$findstate_doc = 'When passed an integer between 1 and 51 returns the
+name of a US state, where the integer is the index of that state name
+in an alphabetic order.';
+
+$s = new xmlrpc_server( array(
+  "examples.getStateName" =&gt; array(
+    "function" =&gt; "findstate",
+    "signature" =&gt; $findstate_sig,
+    "docstring" =&gt; $findstate_doc
+  )));
+</programlisting></para>
+
+        <para>Note that method signatures do not allow to check nested
+        parameters, e.g. the number, names and types of the members of a
+        struct param cannot be validated.</para>
+
+        <para>If a method that you want to expose has a definite number of
+        parameters, but each of those parameters could reasonably be of
+        multiple types, the array of acceptable signatures will easily grow
+        into a combinatorial explosion. To avoid such a situation, the lib
+        defines the global var <varname>$xmlrpcValue</varname>, which can be
+        used in method signatures as a placeholder for 'any xmlrpc
+        type':</para>
+
+        <para><programlisting language="php">
+$echoback_sig = array(array($xmlrpcValue, $xmlrpcValue));
+
+$findstate_doc = 'Echoes back to the client the received value, regardless of 
its type';
+
+$s = new xmlrpc_server( array(
+  "echoBack" =&gt; array(
+    "function" =&gt; "echoback",
+    "signature" =&gt; $echoback_sig, // this sig guarantees that the method 
handler will be called with one and only one parameter
+    "docstring" =&gt; $echoback_doc
+  )));
+</programlisting></para>
+
+        <para>Methods <methodname>system.listMethods</methodname>,
+        <methodname>system.methodHelp</methodname>,
+        <methodname>system.methodSignature</methodname> and
+        <methodname>system.multicall</methodname> are already defined by the
+        server, and should not be reimplemented (see Reserved Methods
+        below).</para>
+      </sect2>
+
+      <sect2>
+        <title>Delaying the server response</title>
+
+        <para>You may want to construct the server, but for some reason not
+        fulfill the request immediately (security verification, for instance).
+        If you omit to pass to the constructor the dispatch map or pass it a
+        second argument of <literal>0</literal> this will have the desired
+        effect. You can then use the <function>service()</function> method of
+        the server class to service the request. For example:</para>
+
+        <programlisting language="php">
+$s = new xmlrpc_server($myDispMap, 0); // second parameter = 0 prevents 
automatic servicing of request
+
+// ... some code that does other stuff here
+
+$s-&gt;service();
+</programlisting>
+
+        <para>Note that the <methodname>service</methodname> method will print
+        the complete result payload to screen and send appropriate HTTP
+        headers back to the client, but also return the response object. This
+        permits further manipulation of the response, possibly in combination
+        with output buffering.</para>
+
+        <para>To prevent the server from sending HTTP headers back to the
+        client, you can pass a second parameter with a value of
+        <literal>TRUE</literal> to the <methodname>service</methodname>
+        method. In this case, the response payload will be returned instead of
+        the response object.</para>
+
+        <para>Xmlrpc requests retrieved by other means than HTTP POST bodies
+        can also be processed. For example:</para>
+
+        <programlisting language="php">
+$s = new xmlrpc_server(); // not passing a dispatch map prevents automatic 
servicing of request
+
+// ... some code that does other stuff here, including setting dispatch map 
into server object
+
+$resp = $s-&gt;service($xmlrpc_request_body, true); // parse a variable 
instead of POST body, retrieve response payload
+
+// ... some code that does other stuff with xml response $resp here
+</programlisting>
+      </sect2>
+
+      <sect2>
+        <title>Modifying the server behaviour</title>
+
+        <para>A couple of methods / class variables are available to modify
+        the behaviour of the server. The only way to take advantage of their
+        existence is by usage of a delayed server response (see above)</para>
+
+        <sect3>
+          <title>setDebug()</title>
+
+          <para>This function controls weather the server is going to echo
+          debugging messages back to the client as comments in response body.
+          Valid values: 0,1,2,3, with 1 being the default. At level 0, no
+          debug info is returned to the client. At level 2, the complete
+          client request is added to the response, as part of the xml
+          comments. At level 3, a new PHP error handler is set when executing
+          user functions exposed as server methods, and all non-fatal errors
+          are trapped and added as comments into the response.</para>
+        </sect3>
+
+        <sect3>
+          <title>allow_system_funcs</title>
+
+          <para>Default_value: TRUE. When set to FALSE, disables support for
+          <methodname>System.xxx</methodname> functions in the server. It
+          might be useful e.g. if you do not wish the server to respond to
+          requests to <methodname>System.ListMethods</methodname>.</para>
+        </sect3>
+
+        <sect3>
+          <title>compress_response</title>
+
+          <para>When set to TRUE, enables the server to take advantage of HTTP
+          compression, otherwise disables it. Responses will be transparently
+          compressed, but only when an xmlrpc-client declares its support for
+          compression in the HTTP headers of the request.</para>
+
+          <para>Note that the ZLIB php extension must be installed for this to
+          work. If it is, <varname>compress_response</varname> will default to
+          TRUE.</para>
+        </sect3>
+
+        <sect3>
+          <title>exception_handling</title>
+
+          <para>This variable controls the behaviour of the server when an
+          exception is thrown by a method handler php function. Valid values:
+          0,1,2, with 0 being the default. At level 0, the server catches the
+          exception and return an 'internal error' xmlrpc response; at 1 it
+          catches the exceptions and return an xmlrpc response with the error
+          code and error message corresponding to the exception that was
+          thron; at 2 = the exception is floated to the upper layers in the
+          code</para>
+        </sect3>
+
+        <sect3>
+          <title>response_charset_encoding</title>
+
+          <para>Charset encoding to be used for response (only affects string
+          values).</para>
+
+          <para>If it can, the server will convert the generated response from
+          internal_encoding to the intended one.</para>
+
+          <para>Valid values are: a supported xml encoding (only UTF-8 and
+          ISO-8859-1 at present, unless mbstring is enabled), null (leave
+          charset unspecified in response and convert output stream to
+          US_ASCII), 'default' (use xmlrpc library default as specified in
+          xmlrpc.inc, convert output stream if needed), or 'auto' (use
+          client-specified charset encoding or same as request if request
+          headers do not specify it (unless request is US-ASCII: then use
+          library default anyway).</para>
+        </sect3>
+      </sect2>
+
+      <sect2>
+        <title>Fault reporting</title>
+
+        <para>Fault codes for your servers should start at the value indicated
+        by the global <literal>$xmlrpcerruser</literal> + 1.</para>
+
+        <para>Standard errors returned by the server include:</para>
+
+        <variablelist>
+          <varlistentry>
+            <term><literal>1</literal> <phrase>Unknown method</phrase></term>
+
+            <listitem>
+              <para>Returned if the server was asked to dispatch a method it
+              didn't know about</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>2</literal> <phrase>Invalid return
+            payload</phrase></term>
+
+            <listitem>
+              <para>This error is actually generated by the client, not
+              server, code, but signifies that a server returned something it
+              couldn't understand. A more detailed error report is sometimes
+              added onto the end of the phrase above.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>3</literal> <phrase>Incorrect
+            parameters</phrase></term>
+
+            <listitem>
+              <para>This error is generated when the server has signature(s)
+              defined for a method, and the parameters passed by the client do
+              not match any of signatures.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>4</literal> <phrase>Can't introspect: method
+            unknown</phrase></term>
+
+            <listitem>
+              <para>This error is generated by the builtin
+              <function>system.*</function> methods when any kind of
+              introspection is attempted on a method undefined by the
+              server.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>5</literal> <phrase>Didn't receive 200 OK from
+            remote server</phrase></term>
+
+            <listitem>
+              <para>This error is generated by the client when a remote server
+              doesn't return HTTP/1.1 200 OK in response to a request. A more
+              detailed error report is added onto the end of the phrase
+              above.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>6</literal> <phrase>No data received from
+            server</phrase></term>
+
+            <listitem>
+              <para>This error is generated by the client when a remote server
+              returns HTTP/1.1 200 OK in response to a request, but no
+              response body follows the HTTP headers.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>7</literal> <phrase>No SSL support compiled
+            in</phrase></term>
+
+            <listitem>
+              <para>This error is generated by the client when trying to send
+              a request with HTTPS and the CURL extension is not available to
+              PHP.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>8</literal> <phrase>CURL error</phrase></term>
+
+            <listitem>
+              <para>This error is generated by the client when trying to send
+              a request with HTTPS and the HTTPS communication fails.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>9-14</literal> <phrase>multicall
+            errors</phrase></term>
+
+            <listitem>
+              <para>These errors are generated by the server when something
+              fails inside a system.multicall request.</para>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+            <term><literal>100-</literal> <phrase>XML parse
+            errors</phrase></term>
+
+            <listitem>
+              <para>Returns 100 plus the XML parser error code for the fault
+              that occurred. The <function>faultString</function> returned
+              explains where the parse error was in the incoming XML
+              stream.</para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+      </sect2>
+
+      <sect2>
+        <title>'New style' servers</title>
+
+        <para>In the same spirit of simplification that inspired the
+        <varname>xmlrpc_client::return_type</varname> class variable, a new
+        class variable has been added to the server class:
+        <varname>functions_parameters_type</varname>. When set to 'phpvals',
+        the functions registered in the server dispatch map will be called
+        with plain php values as parameters, instead of a single xmlrpcmsg
+        instance parameter. The return value of those functions is expected to
+        be a plain php value, too. An example is worth a thousand
+        words:<programlisting language="php">
+  function foo($usr_id, $out_lang='en') {
+    global $xmlrpcerruser;
+
+    ...
+
+    if ($someErrorCondition)
+      return new xmlrpcresp(0, $xmlrpcerruser+1, 'DOH!');
+    else
+      return array(
+        'name' =&gt; 'Joe',
+        'age' =&gt; 27,
+        'picture' =&gt; new xmlrpcval(file_get_contents($picOfTheGuy), 
'base64')
+      );
+  }
+
+  $s = new xmlrpc_server(
+    array(
+      "examples.myFunc" =&gt; array(
+        "function" =&gt; "bar::foobar",
+        "signature" =&gt; array(
+          array($xmlrpcString, $xmlrpcInt),
+          array($xmlrpcString, $xmlrpcInt, $xmlrpcString)
+        )
+      )
+    ), false);
+  $s-&gt;functions_parameters_type = 'phpvals';
+  $s-&gt;service();
+</programlisting>There are a few things to keep in mind when using this
+        simplified syntax:</para>
+
+        <para>to return an xmlrpc error, the method handler function must
+        return an instance of <classname>xmlrpcresp</classname>. The only
+        other way for the server to know when an error response should be
+        served to the client is to throw an exception and set the server's
+        <varname>exception_handling</varname> memeber var to 1;</para>
+
+        <para>to return a base64 value, the method handler function must
+        encode it on its own, creating an instance of an xmlrpcval
+        object;</para>
+
+        <para>the method handler function cannot determine the name of the
+        xmlrpc method it is serving, unlike standard handler functions that
+        can retrieve it from the message object;</para>
+
+        <para>when receiving nested parameters, the method handler function
+        has no way to distinguish a php string that was sent as base64 value
+        from one that was sent as a string value;</para>
+
+        <para>this has a direct consequence on the support of
+        system.multicall: a method whose signature contains datetime or base64
+        values will not be available to multicall calls;</para>
+
+        <para>last but not least, the direct parsing of xml to php values is
+        much faster than using xmlrpcvals, and allows the library to handle
+        much bigger messages without allocating all available server memory or
+        smashing PHP recursive call stack.</para>
+      </sect2>
+    </sect1>
+  </chapter>
+
+  <chapter id="globalvars">
+    <title>Global variables</title>
+
+    <para>Many global variables are defined in the xmlrpc.inc file. Some of
+    those are meant to be used as constants (and modifying their value might
+    cause unpredictable behaviour), while some others can be modified in your
+    php scripts to alter the behaviour of the xml-rpc client and
+    server.</para>
+
+    <sect1>
+      <title>"Constant" variables</title>
+
+      <sect2>
+        <title>$xmlrpcerruser</title>
+
+        <para><fieldsynopsis>
+            <varname>$xmlrpcerruser</varname>
+
+            <initializer>800</initializer>
+          </fieldsynopsis>The minimum value for errors reported by user
+        implemented XML-RPC servers. Error numbers lower than that are
+        reserved for library usage.</para>
+      </sect2>
+
+      <sect2>
+        <title>$xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble,
+        $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray,
+        $xmlrpcStruct, $xmlrpcValue, $xmlrpcNull</title>
+
+        <para>For convenience the strings representing the XML-RPC types have
+        been encoded as global variables:<programlisting language="php">
+$xmlrpcI4="i4";
+$xmlrpcInt="int";
+$xmlrpcBoolean="boolean";
+$xmlrpcDouble="double";
+$xmlrpcString="string";
+$xmlrpcDateTime="dateTime.iso8601";
+$xmlrpcBase64="base64";
+$xmlrpcArray="array";
+$xmlrpcStruct="struct";
+$xmlrpcValue="undefined";
+$xmlrpcNull="null";
+</programlisting></para>
+      </sect2>
+
+      <sect2>
+        <title>$xmlrpcTypes, $xmlrpc_valid_parents, $xmlrpcerr, $xmlrpcstr,
+        $xmlrpcerrxml, $xmlrpc_backslash, $_xh, $xml_iso88591_Entities,
+        $xmlEntities, $xmlrpcs_capabilities</title>
+
+        <para>Reserved for internal usage.</para>
+      </sect2>
+    </sect1>
+
+    <sect1>
+      <title>Variables whose value can be modified</title>
+
+      <sect2 id="xmlrpc-defencoding" xreflabel="xmlrpc_defencoding">
+        <title xreflabel="">xmlrpc_defencoding</title>
+
+        <fieldsynopsis>
+          <varname>$xmlrpc_defencoding</varname>
+
+          <initializer>"UTF8"</initializer>
+        </fieldsynopsis>
+
+        <para>This variable defines the character set encoding that will be
+        used by the xml-rpc client and server to decode the received messages,
+        when a specific charset declaration is not found (in the messages sent
+        non-ascii chars are always encoded using character references, so that
+        the produced xml is valid regardless of the charset encoding
+        assumed).</para>
+
+        <para>Allowed values: <literal>"UTF8"</literal>,
+        <literal>"ISO-8859-1"</literal>, <literal>"ASCII".</literal></para>
+
+        <para>Note that the appropriate RFC actually mandates that XML
+        received over HTTP without indication of charset encoding be treated
+        as US-ASCII, but many servers and clients 'in the wild' violate the
+        standard, and assume the default encoding is UTF-8.</para>
+      </sect2>
+
+      <sect2>
+        <title>xmlrpc_internalencoding</title>
+
+        <para><fieldsynopsis>
+            <varname>$xmlrpc_internalencoding</varname>
+
+            <initializer>"ISO-8859-1"</initializer>
+          </fieldsynopsis>This variable defines the character set encoding
+        that the library uses to transparently encode into valid XML the
+        xml-rpc values created by the user and to re-encode the received
+        xml-rpc values when it passes them to the PHP application. It only
+        affects xml-rpc values of string type. It is a separate value from
+        xmlrpc_defencoding, allowing e.g. to send/receive xml messages encoded
+        on-the-wire in US-ASCII and process them as UTF-8. It defaults to the
+        character set used internally by PHP (unless you are running an
+        MBString-enabled installation), so you should change it only in
+        special situations, if e.g. the string values exchanged in the xml-rpc
+        messages are directly inserted into / fetched from a database
+        configured to return UTF8 encoded strings to PHP. Example
+        usage:</para>
+
+        <para><programlisting language="php">
+&lt;?php
+
+include('xmlrpc.inc');
+$xmlrpc_internalencoding = 'UTF-8'; // this has to be set after the inclusion 
above
+$v = new xmlrpcval('κόσμε'); // This xmlrpc value will be correctly 
serialized as the greek word 'kosme'
+</programlisting></para>
+      </sect2>
+
+      <sect2>
+        <title>xmlrpcName</title>
+
+        <para><fieldsynopsis>
+            <varname>$xmlrpcName</varname>
+
+            <initializer>"XML-RPC for PHP"</initializer>
+          </fieldsynopsis>The string representation of the name of the XML-RPC
+        for PHP library. It is used by the client for building the User-Agent
+        HTTP header that is sent with every request to the server. You can
+        change its value if you need to customize the User-Agent
+        string.</para>
+      </sect2>
+
+      <sect2>
+        <title>xmlrpcVersion</title>
+
+        <para><fieldsynopsis>
+            <varname>$xmlrpcVersion</varname>
+
+            <initializer>"2.2"</initializer>
+          </fieldsynopsis>The string representation of the version number of
+        the XML-RPC for PHP library in use. It is used by the client for
+        building the User-Agent HTTP header that is sent with every request to
+        the server. You can change its value if you need to customize the
+        User-Agent string.</para>
+      </sect2>
+
+      <sect2>
+        <title>xmlrpc_null_extension</title>
+
+        <para>When set to <constant>TRUE</constant>, the lib will enable
+        support for the &lt;NIL/&gt; (and &lt;EX:NIL/&gt;) xmlrpc value, as
+        per the extension to the standard proposed here. This means that
+        &lt;NIL/&gt; and &lt;EX:NIL/&gt; tags received will be parsed as valid
+        xmlrpc, and the corresponding xmlrpcvals will return "null" for
+        <methodname>scalarTyp()</methodname>.</para>
+      </sect2>
+
+      <sect2>
+        <title>xmlrpc_null_apache_encoding</title>
+
+        <para>When set to <literal>TRUE</literal>, php NULL values encoded
+        into <classname>xmlrpcval</classname> objects get serialized using the
+        <literal>&lt;EX:NIL/&gt;</literal> tag instead of
+        <literal>&lt;NIL/&gt;</literal>. Please note that both forms are
+        always accepted as input regardless of the value of this
+        variable.</para>
+      </sect2>
+    </sect1>
+  </chapter>
+
+  <chapter id="helpers">
+    <title>Helper functions</title>
+
+    <para>XML-RPC for PHP contains some helper functions which you can use to
+    make processing of XML-RPC requests easier.</para>
+
+    <sect1>
+      <title>Date functions</title>
+
+      <para>The XML-RPC specification has this to say on dates:</para>
+
+      <blockquote>
+        <para id="wrap_xmlrpc_method">Don't assume a timezone. It should be
+        specified by the server in its documentation what assumptions it makes
+        about timezones.</para>
+      </blockquote>
+
+      <para>Unfortunately, this means that date processing isn't
+      straightforward. Although XML-RPC uses ISO 8601 format dates, it doesn't
+      use the timezone specifier.</para>
+
+      <para>We strongly recommend that in every case where you pass dates in
+      XML-RPC calls, you use UTC (GMT) as your timezone. Most computer
+      languages include routines for handling GMT times natively, and you
+      won't have to translate between timezones.</para>
+
+      <para>For more information about dates, see <ulink
+      url="http://www.uic.edu/year2000/datefmt.html";>ISO 8601: The Right
+      Format for Dates</ulink>, which has a handy link to a PDF of the ISO
+      8601 specification. Note that XML-RPC uses exactly one of the available
+      representations: CCYYMMDDTHH:MM:SS.</para>
+
+      <sect2 id="iso8601encode" xreflabel="iso8601_encode()">
+        <title>iso8601_encode</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>string</type><function>iso8601_encode</function></funcdef>
+
+            
<paramdef><type>string</type><parameter>$time_t</parameter></paramdef>
+
+            <paramdef
+            
choice="opt"><type>int</type><parameter>$utc</parameter><initializer>0</initializer></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Returns an ISO 8601 formatted date generated from the UNIX
+        timestamp <parameter>$time_t</parameter>, as returned by the PHP
+        function <function>time()</function>.</para>
+
+        <para>The argument <parameter>$utc</parameter> can be omitted, in
+        which case it defaults to <literal>0</literal>. If it is set to
+        <literal>1</literal>, then the function corrects the time passed in
+        for UTC. Example: if you're in the GMT-6:00 timezone and set
+        <parameter>$utc</parameter>, you will receive a date representation
+        six hours ahead of your local time.</para>
+
+        <para>The included demo program <filename>vardemo.php</filename>
+        includes a demonstration of this function.</para>
+      </sect2>
+
+      <sect2 id="iso8601decode" xreflabel="iso8601_decode()">
+        <title>iso8601_decode</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>int</type><function>iso8601_decode</function></funcdef>
+
+            
<paramdef><type>string</type><parameter>$isoString</parameter></paramdef>
+
+            
<paramdef><type>int</type><parameter>$utc</parameter><initializer>0</initializer></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Returns a UNIX timestamp from an ISO 8601 encoded time and date
+        string passed in. If <parameter>$utc</parameter> is
+        <literal>1</literal> then <parameter>$isoString</parameter> is assumed
+        to be in the UTC timezone, and thus the result is also UTC: otherwise,
+        the timezone is assumed to be your local timezone and you receive a
+        local timestamp.</para>
+      </sect2>
+    </sect1>
+
+    <sect1 id="arrayuse">
+      <title>Easy use with nested PHP values</title>
+
+      <para>Dan Libby was kind enough to contribute two helper functions that
+      make it easier to translate to and from PHP values. This makes it easier
+      to deal with complex structures. At the moment support is limited to
+      <type>int</type>, <type>double</type>, <type>string</type>,
+      <type>array</type>, <type>datetime</type> and <type>struct</type>
+      datatypes; note also that all PHP arrays are encoded as structs, except
+      arrays whose keys are integer numbers starting with 0 and incremented by
+      1.</para>
+
+      <para>These functions reside in <filename>xmlrpc.inc</filename>.</para>
+
+      <sect2 id="phpxmlrpcdecode">
+        <title>php_xmlrpc_decode</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>mixed</type><function>php_xmlrpc_decode</function></funcdef>
+
+            
<paramdef><type>xmlrpcval</type><parameter>$xmlrpc_val</parameter></paramdef>
+
+            
<paramdef><type>array</type><parameter>$options</parameter></paramdef>
+          </funcprototype>
+
+          <funcprototype>
+            
<funcdef><type>array</type><function>php_xmlrpc_decode</function></funcdef>
+
+            
<paramdef><type>xmlrpcmsg</type><parameter>$xmlrpcmsg_val</parameter></paramdef>
+
+            
<paramdef><type>string</type><parameter>$options</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Returns a native PHP value corresponding to the values found in
+        the <type>xmlrpcval</type> <parameter>$xmlrpc_val</parameter>,
+        translated into PHP types. Base-64 and datetime values are
+        automatically decoded to strings.</para>
+
+        <para>In the second form, returns an array containing the parameters
+        of the given
+        <parameter><classname>xmlrpcmsg</classname>_val</parameter>, decoded
+        to php types.</para>
+
+        <para>The <parameter>options</parameter> parameter is optional. If
+        specified, it must consist of an array of options to be enabled in the
+        decoding process. At the moment the only valid option are
+        <symbol>decode_php_objs</symbol> and
+        <literal>dates_as_objects</literal>. When the first is set, php
+        objects that have been converted to xml-rpc structs using the
+        <function>php_xmlrpc_encode</function> function and a corresponding
+        encoding option will be converted back into object values instead of
+        arrays (provided that the class definition is available at
+        reconstruction time). When the second is set, XML-RPC datetime values
+        will be converted into native <classname>dateTime</classname> objects
+        instead of strings.</para>
+
+        <para><emphasis><emphasis>WARNING</emphasis>:</emphasis> please take
+        extreme care before enabling the <symbol>decode_php_objs</symbol>
+        option: when php objects are rebuilt from the received xml, their
+        constructor function will be silently invoked. This means that you are
+        allowing the remote end to trigger execution of uncontrolled PHP code
+        on your server, opening the door to code injection exploits. Only
+        enable this option when you have complete trust of the remote
+        server/client.</para>
+
+        <para>Example:<programlisting language="php">
+// wrapper to expose an existing php function as xmlrpc method handler
+function foo_wrapper($m)
+{
+  $params = php_xmlrpc_decode($m);
+  $retval = call_user_func_array('foo', $params);
+  return new xmlrpcresp(new xmlrpcval($retval)); // foo return value will be 
serialized as string
+}
+
+$s = new xmlrpc_server(array(
+   "examples.myFunc1" =&gt; array(
+     "function" =&gt; "foo_wrapper",
+     "signatures" =&gt; ...
+  )));
+</programlisting></para>
+      </sect2>
+
+      <sect2 id="phpxmlrpcencode">
+        <title>php_xmlrpc_encode</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>xmlrpcval</type><function>php_xmlrpc_encode</function></funcdef>
+
+            
<paramdef><type>mixed</type><parameter>$phpval</parameter></paramdef>
+
+            
<paramdef><type>array</type><parameter>$options</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Returns an <type>xmlrpcval</type> object populated with the PHP
+        values in <parameter>$phpval</parameter>. Works recursively on arrays
+        and objects, encoding numerically indexed php arrays into array-type
+        xmlrpcval objects and non numerically indexed php arrays into
+        struct-type xmlrpcval objects. Php objects are encoded into
+        struct-type xmlrpcvals, excepted for php values that are already
+        instances of the xmlrpcval class or descendants thereof, which will
+        not be further encoded. Note that there's no support for encoding php
+        values into base-64 values. Encoding of date-times is optionally
+        carried on on php strings with the correct format.</para>
+
+        <para>The <parameter>options</parameter> parameter is optional. If
+        specified, it must consist of an array of options to be enabled in the
+        encoding process. At the moment the only valid options are
+        <symbol>encode_php_objs</symbol>, <literal>null_extension</literal>
+        and <symbol>auto_dates</symbol>.</para>
+
+        <para>The first will enable the creation of 'particular' xmlrpcval
+        objects out of php objects, that add a "php_class" xml attribute to
+        their serialized representation. This attribute allows the function
+        php_xmlrpc_decode to rebuild the native php objects (provided that the
+        same class definition exists on both sides of the communication). The
+        second allows to encode php <literal>NULL</literal> values to the
+        <literal>&lt;NIL/&gt;</literal> (or
+        <literal>&lt;EX:NIL/&gt;</literal>, see ...) tag. The last encodes any
+        string that matches the ISO8601 format into an XML-RPC
+        datetime.</para>
+
+        <para>Example:<programlisting language="php">
+// the easy way to build a complex xml-rpc struct, showing nested base64 value 
and datetime values
+$val = php_xmlrpc_encode(array(
+  'first struct_element: an int' =&gt; 666,
+  'second: an array' =&gt; array ('apple', 'orange', 'banana'),
+  'third: a base64 element' =&gt; new xmlrpcval('hello world', 'base64'),
+  'fourth: a datetime' =&gt; '20060107T01:53:00'
+  ), array('auto_dates'));
+</programlisting></para>
+      </sect2>
+
+      <sect2>
+        <title>php_xmlrpc_decode_xml</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef><type>xmlrpcval | xmlrpcresp |
+            
xmlrpcmsg</type><function>php_xmlrpc_decode_xml</function></funcdef>
+
+            <paramdef><type>string</type><parameter>$xml</parameter></paramdef>
+
+            
<paramdef><type>array</type><parameter>$options</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Decodes the xml representation of either an xmlrpc request,
+        response or single value, returning the corresponding php-xmlrpc
+        object, or <literal>FALSE</literal> in case of an error.</para>
+
+        <para>The <parameter>options</parameter> parameter is optional. If
+        specified, it must consist of an array of options to be enabled in the
+        decoding process. At the moment, no option is supported.</para>
+
+        <para>Example:<programlisting language="php">
+$text = '&lt;value&gt;&lt;array&gt;&lt;data&gt;&lt;value&gt;Hello 
world&lt;/value&gt;&lt;/data&gt;&lt;/array&gt;&lt;/value&gt;';
+$val = php_xmlrpc_decode_xml($text);
+if ($val) echo 'Found a value of type '.$val-&gt;kindOf(); else echo 'Found 
invalid xml';
+</programlisting></para>
+      </sect2>
+    </sect1>
+
+    <sect1>
+      <title>Automatic conversion of php functions into xmlrpc methods (and
+      vice versa)</title>
+
+      <para>For the extremely lazy coder, helper functions have been added
+      that allow to convert a php function into an xmlrpc method, and a
+      remotely exposed xmlrpc method into a local php function - or a set of
+      methods into a php class. Note that these comes with many caveat.</para>
+
+      <sect2>
+        <title>wrap_xmlrpc_method</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>string</type><function>wrap_xmlrpc_method</function></funcdef>
+
+            <paramdef>$client</paramdef>
+
+            <paramdef>$methodname</paramdef>
+
+            <paramdef>$extra_options</paramdef>
+          </funcprototype>
+
+          <funcprototype>
+            
<funcdef><type>string</type><function>wrap_xmlrpc_method</function></funcdef>
+
+            <paramdef>$client</paramdef>
+
+            <paramdef>$methodname</paramdef>
+
+            <paramdef>$signum</paramdef>
+
+            <paramdef>$timeout</paramdef>
+
+            <paramdef>$protocol</paramdef>
+
+            <paramdef>$funcname</paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Given an xmlrpc server and a method name, creates a php wrapper
+        function that will call the remote method and return results using
+        native php types for both params and results. The generated php
+        function will return an xmlrpcresp object for failed xmlrpc
+        calls.</para>
+
+        <para>The second syntax is deprecated, and is listed here only for
+        backward compatibility.</para>
+
+        <para>The server must support the
+        <methodname>system.methodSignature</methodname> xmlrpc method call for
+        this function to work.</para>
+
+        <para>The <parameter>client</parameter> param must be a valid
+        xmlrpc_client object, previously created with the address of the
+        target xmlrpc server, and to which the preferred communication options
+        have been set.</para>
+
+        <para>The optional parameters can be passed as array key,value pairs
+        in the <parameter>extra_options</parameter> param.</para>
+
+        <para>The <parameter>signum</parameter> optional param has the purpose
+        of indicating which method signature to use, if the given server
+        method has multiple signatures (defaults to 0).</para>
+
+        <para>The <parameter>timeout</parameter> and
+        <parameter>protocol</parameter> optional params are the same as in the
+        <methodname>xmlrpc_client::send()</methodname> method.</para>
+
+        <para>If set, the optional <parameter>new_function_name</parameter>
+        parameter indicates which name should be used for the generated
+        function. In case it is not set the function name will be
+        auto-generated.</para>
+
+        <para>If the <literal>return_source</literal> optional parameter is
+        set, the function will return the php source code to build the wrapper
+        function, instead of evaluating it (useful to save the code and use it
+        later as stand-alone xmlrpc client).</para>
+
+        <para>If the <literal>encode_php_objs</literal> optional parameter is
+        set, instances of php objects later passed as parameters to the newly
+        created function will receive a 'special' treatment that allows the
+        server to rebuild them as php objects instead of simple arrays. Note
+        that this entails using a "slightly augmented" version of the xmlrpc
+        protocol (ie. using element attributes), which might not be understood
+        by xmlrpc servers implemented using other libraries.</para>
+
+        <para>If the <literal>decode_php_objs</literal> optional parameter is
+        set, instances of php objects that have been appropriately encoded by
+        the server using a coordinate option will be deserialized as php
+        objects instead of simple arrays (the same class definition should be
+        present server side and client side).</para>
+
+        <para><emphasis>Note that this might pose a security risk</emphasis>,
+        since in order to rebuild the object instances their constructor
+        method has to be invoked, and this means that the remote server can
+        trigger execution of unforeseen php code on the client: not really a
+        code injection, but almost. Please enable this option only when you
+        trust the remote server.</para>
+
+        <para>In case of an error during generation of the wrapper function,
+        FALSE is returned, otherwise the name (or source code) of the new
+        function.</para>
+
+        <para>Known limitations: server must support
+        <methodname>system.methodsignature</methodname> for the wanted xmlrpc
+        method; for methods that expose multiple signatures, only one can be
+        picked; for remote calls with nested xmlrpc params, the caller of the
+        generated php function has to encode on its own the params passed to
+        the php function if these are structs or arrays whose (sub)members
+        include values of type base64.</para>
+
+        <para>Note: calling the generated php function 'might' be slow: a new
+        xmlrpc client is created on every invocation and an xmlrpc-connection
+        opened+closed. An extra 'debug' param is appended to the parameter
+        list of the generated php function, useful for debugging
+        purposes.</para>
+
+        <para>Example usage:</para>
+
+        <programlisting language="php">
+$c = new xmlrpc_client('http://phpxmlrpc.sourceforge.net/server.php');
+
+$function = wrap_xmlrpc_method($client, 'examples.getStateName');
+
+if (!$function)
+  die('Cannot introspect remote method');
+else {
+  $stateno = 15;
+  $statename = $function($a);
+  if (is_a($statename, 'xmlrpcresp')) // call failed
+  {
+    echo 'Call failed: '.$statename-&gt;faultCode().'. Calling again with 
debug on';
+    $function($a, true);
+  }
+  else
+    echo "OK, state nr. $stateno is $statename";
+}
+</programlisting>
+      </sect2>
+
+      <sect2 id="wrap_php_function">
+        <title>wrap_php_function</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>array</type><function>wrap_php_function</function></funcdef>
+
+            
<paramdef><type>string</type><parameter>$funcname</parameter></paramdef>
+
+            
<paramdef><type>string</type><parameter>$wrapper_function_name</parameter></paramdef>
+
+            
<paramdef><type>array</type><parameter>$extra_options</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Given a user-defined PHP function, create a PHP 'wrapper'
+        function that can be exposed as xmlrpc method from an xmlrpc_server
+        object and called from remote clients, and return the appropriate
+        definition to be added to a server's dispatch map.</para>
+
+        <para>The optional <parameter>$wrapper_function_name</parameter>
+        specifies the name that will be used for the auto-generated
+        function.</para>
+
+        <para>Since php is a typeless language, to infer types of input and
+        output parameters, it relies on parsing the javadoc-style comment
+        block associated with the given function. Usage of xmlrpc native types
+        (such as datetime.dateTime.iso8601 and base64) in the docblock @param
+        tag is also allowed, if you need the php function to receive/send data
+        in that particular format (note that base64 encoding/decoding is
+        transparently carried out by the lib, while datetime vals are passed
+        around as strings).</para>
+
+        <para>Known limitations: requires PHP 5.0.3 +; only works for
+        user-defined functions, not for PHP internal functions (reflection
+        does not support retrieving number/type of params for those); the
+        wrapped php function will not be able to programmatically return an
+        xmlrpc error response.</para>
+
+        <para>If the <literal>return_source</literal> optional parameter is
+        set, the function will return the php source code to build the wrapper
+        function, instead of evaluating it (useful to save the code and use it
+        later in a stand-alone xmlrpc server). It will be in the stored in the
+        <literal>source</literal> member of the returned array.</para>
+
+        <para>If the <literal>suppress_warnings</literal> optional parameter
+        is set, any runtime warning generated while processing the
+        user-defined php function will be catched and not be printed in the
+        generated xml response.</para>
+
+        <para>If the <parameter>extra_options</parameter> array contains the
+        <literal>encode_php_objs</literal> value, wrapped functions returning
+        php objects will generate "special" xmlrpc responses: when the xmlrpc
+        decoding of those responses is carried out by this same lib, using the
+        appropriate param in php_xmlrpc_decode(), the objects will be
+        rebuilt.</para>
+
+        <para>In short: php objects can be serialized, too (except for their
+        resource members), using this function. Other libs might choke on the
+        very same xml that will be generated in this case (i.e. it has a
+        nonstandard attribute on struct element tags)</para>
+
+        <para>If the <literal>decode_php_objs</literal> optional parameter is
+        set, instances of php objects that have been appropriately encoded by
+        the client using a coordinate option will be deserialized and passed
+        to the user function as php objects instead of simple arrays (the same
+        class definition should be present server side and client
+        side).</para>
+
+        <para><emphasis>Note that this might pose a security risk</emphasis>,
+        since in order to rebuild the object instances their constructor
+        method has to be invoked, and this means that the remote client can
+        trigger execution of unforeseen php code on the server: not really a
+        code injection, but almost. Please enable this option only when you
+        trust the remote clients.</para>
+
+        <para>Example usage:</para>
+
+        <para><programlisting language="php">/**
+* State name from state number decoder. NB: do NOT remove this comment block.
+* @param integer $stateno the state number
+* @return string the name of the state (or error description)
+*/
+function findstate($stateno)
+{
+  global $stateNames;
+  if (isset($stateNames[$stateno-1]))
+  {
+    return $stateNames[$stateno-1];
+  }
+  else
+  {
+    return "I don't have a state for the index '" . $stateno . "'";
+  }
+}
+
+// wrap php function, build xmlrpc server
+$methods = array();
+$findstate_sig = wrap_php_function('findstate');
+if ($findstate_sig)
+  $methods['examples.getStateName'] = $findstate_sig;
+$srv = new xmlrpc_server($methods);
+</programlisting></para>
+      </sect2>
+    </sect1>
+
+    <sect1 id="deprecated">
+      <title>Functions removed from the library</title>
+
+      <para>The following two functions have been deprecated in version 1.1 of
+      the library, and removed in version 2, in order to avoid conflicts with
+      the EPI xml-rpc library, which also defines two functions with the same
+      names.</para>
+
+      <para>To ease the transition to the new naming scheme and avoid breaking
+      existing implementations, the following scheme has been adopted:
+      <itemizedlist>
+          <listitem>
+            <para>If EPI-XMLRPC is not active in the current PHP installation,
+            the constant <literal>XMLRPC_EPI_ENABLED</literal> will be set to
+            <literal>'0'</literal></para>
+          </listitem>
+
+          <listitem>
+            <para>If EPI-XMLRPC is active in the current PHP installation, the
+            constant <literal>XMLRPC_EPI_ENABLED</literal> will be set to
+            <literal>'1'</literal></para>
+          </listitem>
+        </itemizedlist></para>
+
+      <para>The following documentation is kept for historical
+      reference:</para>
+
+      <sect2 id="xmlrpcdecode">
+        <title>xmlrpc_decode</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>mixed</type><function>xmlrpc_decode</function></funcdef>
+
+            
<paramdef><type>xmlrpcval</type><parameter>$xmlrpc_val</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Alias for php_xmlrpc_decode.</para>
+      </sect2>
+
+      <sect2 id="xmlrpcencode">
+        <title>xmlrpc_encode</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>xmlrpcval</type><function>xmlrpc_encode</function></funcdef>
+
+            
<paramdef><type>mixed</type><parameter>$phpval</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Alias for php_xmlrpc_encode.</para>
+      </sect2>
+    </sect1>
+
+    <sect1 id="debugging">
+      <title>Debugging aids</title>
+
+      <sect2>
+        <title>xmlrpc_debugmsg</title>
+
+        <funcsynopsis>
+          <funcprototype>
+            
<funcdef><type>void</type><function>xmlrpc_debugmsg</function></funcdef>
+
+            
<paramdef><type>string</type><parameter>$debugstring</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+
+        <para>Sends the contents of <parameter>$debugstring</parameter> in XML
+        comments in the server return payload. If a PHP client has debugging
+        turned on, the user will be able to see server debug
+        information.</para>
+
+        <para>Use this function in your methods so you can pass back
+        diagnostic information. It is only available from
+        <filename>xmlrpcs.inc</filename>.</para>
+      </sect2>
+    </sect1>
+  </chapter>
+
+  <chapter id="reserved" xreflabel="Reserved methods">
+    <title>Reserved methods</title>
+
+    <para>In order to extend the functionality offered by XML-RPC servers
+    without impacting on the protocol, reserved methods are supported in this
+    release.</para>
+
+    <para>All methods starting with <function>system.</function> are
+    considered reserved by the server. PHP for XML-RPC itself provides four
+    special methods, detailed in this chapter.</para>
+
+    <para>Note that all server objects will automatically respond to clients
+    querying these methods, unless the property
+    <property>allow_system_funcs</property> has been set to
+    <constant>false</constant> before calling the
+    <methodname>service()</methodname> method. This might pose a security risk
+    if the server is exposed to public access, e.g. on the internet.</para>
+
+    <sect1>
+      <title>system.getCapabilities</title>
+
+      <para></para>
+    </sect1>
+
+    <sect1>
+      <title>system.listMethods</title>
+
+      <para>This method may be used to enumerate the methods implemented by
+      the XML-RPC server.</para>
+
+      <para>The <function>system.listMethods</function> method requires no
+      parameters. It returns an array of strings, each of which is the name of
+      a method implemented by the server.</para>
+    </sect1>
+
+    <sect1 id="sysmethodsig">
+      <title>system.methodSignature</title>
+
+      <para>This method takes one parameter, the name of a method implemented
+      by the XML-RPC server.</para>
+
+      <para>It returns an array of possible signatures for this method. A
+      signature is an array of types. The first of these types is the return
+      type of the method, the rest are parameters.</para>
+
+      <para>Multiple signatures (i.e. overloading) are permitted: this is the
+      reason that an array of signatures are returned by this method.</para>
+
+      <para>Signatures themselves are restricted to the top level parameters
+      expected by a method. For instance if a method expects one array of
+      structs as a parameter, and it returns a string, its signature is simply
+      "string, array". If it expects three integers, its signature is "string,
+      int, int, int".</para>
+
+      <para>For parameters that can be of more than one type, the "undefined"
+      string is supported.</para>
+
+      <para>If no signature is defined for the method, a not-array value is
+      returned. Therefore this is the way to test for a non-signature, if
+      <parameter>$resp</parameter> below is the response object from a method
+      call to <function>system.methodSignature</function>:</para>
+
+      <programlisting language="php">
+$v = $resp-&gt;value();
+if ($v-&gt;kindOf() != "array") {
+  // then the method did not have a signature defined
+}
+</programlisting>
+
+      <para>See the <filename>introspect.php</filename> demo included in this
+      distribution for an example of using this method.</para>
+    </sect1>
+
+    <sect1 id="sysmethhelp">
+      <title>system.methodHelp</title>
+
+      <para>This method takes one parameter, the name of a method implemented
+      by the XML-RPC server.</para>
+
+      <para>It returns a documentation string describing the use of that
+      method. If no such string is available, an empty string is
+      returned.</para>
+
+      <para>The documentation string may contain HTML markup.</para>
+    </sect1>
+
+    <sect1>
+      <title>system.multicall</title>
+
+      <para>This method takes one parameter, an array of 'request' struct
+      types. Each request struct must contain a
+      <parameter>methodName</parameter> member of type string and a
+      <parameter>params</parameter> member of type array, and corresponds to
+      the invocation of the corresponding method.</para>
+
+      <para>It returns a response of type array, with each value of the array
+      being either an error struct (containing the faultCode and faultString
+      members) or the successful response value of the corresponding single
+      method call.</para>
+    </sect1>
+  </chapter>
+
+  <chapter id="examples" xreflabel="Examples">
+    <title>Examples</title>
+
+    <para>The best examples are to be found in the sample files included with
+    the distribution. Some are included here.</para>
+
+    <sect1 id="statename">
+      <title>XML-RPC client: state name query</title>
+
+      <para>Code to get the corresponding state name from a number (1-50) from
+      the demo server available on SourceForge</para>
+
+      <programlisting language="php">
+  $m = new xmlrpcmsg('examples.getStateName',
+    array(new xmlrpcval($HTTP_POST_VARS["stateno"], "int")));
+  $c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
+  $r = $c-&gt;send($m);
+  if (!$r-&gt;faultCode()) {
+      $v = $r-&gt;value();
+      print "State number " . htmlentities($HTTP_POST_VARS["stateno"]) . " is 
" .
+        htmlentities($v-&gt;scalarval()) . "&lt;BR&gt;";
+      print "&lt;HR&gt;I got this value back&lt;BR&gt;&lt;PRE&gt;" .
+        htmlentities($r-&gt;serialize()) . "&lt;/PRE&gt;&lt;HR&gt;\n";
+  } else {
+      print "Fault &lt;BR&gt;";
+      print "Code: " . htmlentities($r-&gt;faultCode()) . "&lt;BR&gt;" .
+            "Reason: '" . htmlentities($r-&gt;faultString()) . "'&lt;BR&gt;";
+  }
+</programlisting>
+    </sect1>
+
+    <sect1>
+      <title>Executing a multicall call</title>
+
+      <para>To be documented...</para>
+    </sect1>
+  </chapter>
+
+  <chapter id="faq">
+    <title>Frequently Asked Questions</title>
+
+    <sect1>
+      <title>How to send custom XML as payload of a method call</title>
+
+      <para>Unfortunately, at the time the XML-RPC spec was designed, support
+      for namespaces in XML was not as ubiquitous as it is now. As a
+      consequence, no support was provided in the protocol for embedding XML
+      elements from other namespaces into an xmlrpc request.</para>
+
+      <para>To send an XML "chunk" as payload of a method call or response,
+      two options are available: either send the complete XML block as a
+      string xmlrpc value, or as a base64 value. Since the '&lt;' character in
+      string values is encoded as '&amp;lt;' in the xml payload of the method
+      call, the XML string will not break the surrounding xmlrpc, unless
+      characters outside of the assumed character set are used. The second
+      method has the added benefits of working independently of the charset
+      encoding used for the xml to be transmitted, and preserving exactly
+      whitespace, whilst incurring in some extra message length and cpu load
+      (for carrying out the base64 encoding/decoding).</para>
+    </sect1>
+
+    <sect1>
+      <title>Is there any limitation on the size of the requests / responses
+      that can be successfully sent?</title>
+
+      <para>Yes. But I have no hard figure to give; it most likely will depend
+      on the version of PHP in usage and its configuration.</para>
+
+      <para>Keep in mind that this library is not optimized for speed nor for
+      memory usage. Better alternatives exist when there are strict
+      requirements on throughput or resource usage, such as the php native
+      xmlrpc extension (see the PHP manual for more information).</para>
+
+      <para>Keep in mind also that HTTP is probably not the best choice in
+      such a situation, and XML is a deadly enemy. CSV formatted data over
+      socket would be much more efficient.</para>
+
+      <para>If you really need to move a massive amount of data around, and
+      you are crazy enough to do it using phpxmlrpc, your best bet is to
+      bypass usage of the xmlrpcval objects, at least in the decoding phase,
+      and have the server (or client) object return to the calling function
+      directly php values (see <varname>xmlrpc_client::return_type</varname>
+      and <varname>xmlrpc_server::functions_parameters_type</varname> for more
+      details).</para>
+    </sect1>
+
+    <sect1>
+      <title>My server (client) returns an error whenever the client (server)
+      returns accented characters</title>
+
+      <para>To be documented...</para>
+    </sect1>
+
+    <sect1>
+      <title>How to enable long-lasting method calls</title>
+
+      <para>To be documented...</para>
+    </sect1>
+
+    <sect1>
+      <title>My client returns "XML-RPC Fault #2: Invalid return payload:
+      enable debugging to examine incoming payload": what should I do?</title>
+
+      <para>The response you are seeing is a default error response that the
+      client object returns to the php application when the server did not
+      respond to the call with a valid xmlrpc response.</para>
+
+      <para>The most likely cause is that you are not using the correct URL
+      when creating the client object, or you do not have appropriate access
+      rights to the web page you are requesting, or some other common http
+      misconfiguration.</para>
+
+      <para>To find out what the server is really returning to your client,
+      you have to enable the debug mode of the client, using
+      $client-&gt;setdebug(1);</para>
+    </sect1>
+
+    <sect1>
+      <title>How can I save to a file the xml of the xmlrpc responses received
+      from servers?</title>
+
+      <para>If what you need is to save the responses received from the server
+      as xml, you have two options:</para>
+
+      <para>1- use the serialize() method on the response object.</para>
+
+      <programlisting language="php">
+$resp = $client-&gt;send($msg);
+if (!$resp-&gt;faultCode())
+  $data_to_be_saved = $resp-&gt;serialize();
+</programlisting>
+
+      <para>Note that this will not be 100% accurate, since the xml generated
+      by the response object can be different from the xml received,
+      especially if there is some character set conversion involved, or such
+      (eg. if you receive an empty string tag as &lt;string/&gt;, serialize()
+      will output &lt;string&gt;&lt;/string&gt;), or if the server sent back
+      as response something invalid (in which case the xml generated client
+      side using serialize() will correspond to the error response generated
+      internally by the lib).</para>
+
+      <para>2 - set the client object to return the raw xml received instead
+      of the decoded objects:</para>
+
+      <programlisting language="php">
+$client = new xmlrpc_client($url);
+$client-&gt;return_type = 'xml';
+$resp = $client-&gt;send($msg);
+if (!$resp-&gt;faultCode())
+  $data_to_be_saved = $resp-&gt;value();
+</programlisting>
+
+      <para>Note that using this method the xml response response will not be
+      parsed at all by the library, only the http communication protocol will
+      be checked. This means that xmlrpc responses sent by the server that
+      would have generated an error response on the client (eg. malformed xml,
+      responses that have faultcode set, etc...) now will not be flagged as
+      invalid, and you might end up saving not valid xml but random
+      junk...</para>
+    </sect1>
+
+    <sect1>
+      <title>Can I use the ms windows character set?</title>
+
+      <para>If the data your application is using comes from a Microsoft
+      application, there are some chances that the character set used to
+      encode it is CP1252 (the same might apply to data received from an
+      external xmlrpc server/client, but it is quite rare to find xmlrpc
+      toolkits that encode to CP1252 instead of UTF8). It is a character set
+      which is "almost" compatible with ISO 8859-1, but for a few extra
+      characters.</para>
+
+      <para>PHP-XMLRPC only supports the ISO 8859-1 and UTF8 character sets.
+      The net result of this situation is that those extra characters will not
+      be properly encoded, and will be received at the other end of the
+      XML-RPC tranmission as "garbled data". Unfortunately the library cannot
+      provide real support for CP1252 because of limitations in the PHP 4 xml
+      parser. Luckily, we tried our best to support this character set anyway,
+      and, since version 2.2.1, there is some form of support, left commented
+      in the code.</para>
+
+      <para>To properly encode outgoing data that is natively in CP1252, you
+      will have to uncomment all relative code in the file
+      <filename>xmlrpc.inc</filename> (you can search for the string "1252"),
+      then set <code>$GLOBALS['xmlrpc_internalencoding']='CP1252';</code>
+      Please note that all incoming data will then be fed to your application
+      as UTF-8 to avoid any potentail data loss.</para>
+    </sect1>
+
+    <sect1>
+      <title>Does the library support using cookies / http sessions?</title>
+
+      <para>In short: yes, but a little coding is needed to make it
+      happen.</para>
+
+      <para>The code below uses sessions to e.g. let the client store a value
+      on the server and retrieve it later.</para>
+
+      <para><programlisting>
+$resp = $client-&gt;send(new xmlrpcmsg('registervalue', array(new 
xmlrpcval('foo'), new xmlrpcval('bar'))));
+if (!$resp-&gt;faultCode())
+{
+  $cookies = $resp-&gt;cookies();
+  if (array_key_exists('PHPSESSID', $cookies)) // nb: make sure to use the 
correct session cookie name
+  {
+    $session_id = $cookies['PHPSESSID']['value'];
+
+    // do some other stuff here...
+
+    $client-&gt;setcookie('PHPSESSID', $session_id);
+    $val = $client-&gt;send(new xmlrpcmsg('getvalue', array(new 
xmlrpcval('foo')));
+  }
+}
+</programlisting>Server-side sessions are handled normally like in any other
+      php application. Please see the php manual for more information about
+      sessions.</para>
+
+      <para>NB: unlike web browsers, not all xmlrpc clients support usage of
+      http cookies. If you have troubles with sessions and control only the
+      server side of the communication, please check with the makers of the
+      xmlrpc client in use.</para>
+    </sect1>
+  </chapter>
+
+  <appendix id="integration">
+    <title>Integration with the PHP xmlrpc extension</title>
+
+    <para>To be documented more...</para>
+
+    <para>In short: for the fastest execution possible, you can enable the php
+    native xmlrpc extension, and use it in conjunction with phpxmlrpc. The
+    following code snippet gives an example of such integration</para>
+
+    <programlisting language="php">
+/*** client side ***/
+$c = new xmlrpc_client('http://phpxmlrpc.sourceforge.net/server.php');
+
+// tell the client to return raw xml as response value
+$c-&gt;return_type = 'xml';
+
+// let the native xmlrpc extension take care of encoding request parameters
+$r = $c-&gt;send(xmlrpc_encode_request('examples.getStateName', 
$_POST['stateno']));
+
+if ($r-&gt;faultCode())
+  // HTTP transport error
+  echo 'Got error '.$r-&gt;faultCode();
+else
+{
+  // HTTP request OK, but XML returned from server not parsed yet
+  $v = xmlrpc_decode($r-&gt;value());
+  // check if we got a valid xmlrpc response from server
+  if ($v === NULL)
+    echo 'Got invalid response';
+  else
+  // check if server sent a fault response
+  if (xmlrpc_is_fault($v))
+    echo 'Got xmlrpc fault '.$v['faultCode'];
+  else
+    echo'Got response: '.htmlentities($v);
+}
+</programlisting>
+  </appendix>
+
+  <appendix id="substitution">
+    <title>Substitution of the PHP xmlrpc extension</title>
+
+    <para>Yet another interesting situation is when you are using a ready-made
+    php application, that provides support for the XMLRPC protocol via the
+    native php xmlrpc extension, but the extension is not available on your
+    php install (e.g. because of shared hosting constraints).</para>
+
+    <para>Since version 2.1, the PHP-XMLRPC library provides a compatibility
+    layer that aims to be 100% compliant with the xmlrpc extension API. This
+    means that any code written to run on the extension should obtain the
+    exact same results, albeit using more resources and a longer processing
+    time, using the PHP-XMLRPC library and the extension compatibility module.
+    The module is part of the EXTRAS package, available as a separate download
+    from the sourceforge.net website, since version 0.2</para>
+  </appendix>
+
+  <appendix id="enough">
+    <title>'Enough of xmlrpcvals!': new style library usage</title>
+
+    <para>To be documented...</para>
+
+    <para>In the meantime, see docs about xmlrpc_client::return_type and
+    xmlrpc_server::functions_parameters_types, as well as php_xmlrpc_encode,
+    php_xmlrpc_decode and php_xmlrpc_decode_xml</para>
+  </appendix>
+
+  <appendix id="debugger">
+    <title>Usage of the debugger</title>
+
+    <para>A webservice debugger is included in the library to help during
+    development and testing.</para>
+
+    <para>The interface should be self-explicative enough to need little
+    documentation.</para>
+
+    <para><graphic align="center" fileref="debugger.gif"
+    format="GIF" /></para>
+
+    <para>The most useful feature of the debugger is without doubt the "Show
+    debug info" option. It allows to have a screen dump of the complete http
+    communication between client and server, including the http headers as
+    well as the request and response payloads, and is invaluable when
+    troubleshooting problems with charset encoding, authentication or http
+    compression.</para>
+
+    <para>The debugger can take advantage of the JSONRPC library extension, to
+    allow debugging of JSON-RPC webservices, and of the JS-XMLRPC library
+    visual editor to allow easy mouse-driven construction of the payload for
+    remote methods. Both components have to be downloaded separately from the
+    sourceforge.net web pages and copied to the debugger directory to enable
+    the extra functionality:</para>
+
+    <para><itemizedlist>
+        <listitem>
+          <para>to enable jsonrpc functionality, download the PHP-XMLRPC
+          EXTRAS package, and copy the file <filename>jsonrpc.inc</filename>
+          either to the same directory as the debugger or somewhere in your
+          php include path</para>
+        </listitem>
+      </itemizedlist><itemizedlist>
+        <listitem>
+          <para>to enable the visual value editing dialog, download the
+          JS-XMLRPC library, and copy somewhere in the web root files
+          <filename>visualeditor.php</filename>,
+          <filename>visualeditor.css</filename> and the folders
+          <filename>yui</filename> and <filename>img</filename>. Then edit the
+          debugger file <filename>controller.php</filename> and set
+          appropriately the variable <varname>$editorpath</varname>.</para>
+        </listitem>
+      </itemizedlist></para>
+  </appendix>
+</book>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:nil
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+sgml-namecase-general:t
+sgml-general-insert-case:lower
+End:
+-->

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/rsakey.pem
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/rsakey.pem         
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/rsakey.pem 
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOgIBAAJBAM12w6/J20HMj0V9VC24xPFQG9RKSDt8vmviM+tnc1BgCrzPyF1v
+3/rWGoWDjkJrE9WFOeqIjJHeEWWT4uKq2ZkCAwEAAQJAZZYJ7Nld+et9DvuHak/H
+uBRGnjDYA+mKcObXitWMUzk2ZodL8UoCP1J9kKqV8Zp/l2cBZkLo0aWTN94sWkHy
+rQIhAOhxWxRXSZ4kArIQqZnDG9JgtOAeaaFso/zpxIHpN6OrAiEA4klzl+rUc32/
+7SDcJYa9j5vehp1jCTnkN+n0rujTM8sCIAGwMRUovSQk5tAcRt8TB7SzdxzZm7LM
+czR3DjJTW1AZAiEAlYN+svPgJ+cAdwdtLgZXHZoZb8xx8Vik6CTXHPKNCf0CIBQL
+zF4Qp8/C+gjsXtEZJvhxY7i1luHn6iNwNnE932r3
+-----END RSA PRIVATE KEY-----

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/test.pl
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/test.pl            
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/test.pl    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,52 @@
+#!/usr/local/bin/perl
+
+use Frontier::Client;
+
+my $serverURL='http://phpxmlrpc.sourceforge.net/server.php';
+
+# try the simplest example
+
+my $client = Frontier::Client->new( 'url' => $serverURL,
+               'debug' => 0, 'encoding' => 'iso-8859-1' );
+my $resp = $client->call("examples.getStateName", 32);
+
+print "Got '${resp}'\n";
+
+# now send a mail to nobody in particular
+
+$resp = $client->call("mail.send", ("edd", "Test",  
+       "Bonjour. Je m'appelle G\xE9rard. Ma\xF1ana. ", "freddy", "", "", 
+       'text/plain; charset="iso-8859-1"'));
+
+if ($resp->value()) {
+       print "Mail sent OK.\n";
+} else {
+       print "Error sending mail.\n";
+}
+
+# test echoing of characters works fine
+
+$resp = $client->call("examples.echo", 'Three "blind" mice - ' . 
+       "See 'how' they run");
+print $resp . "\n";
+
+# test name and age example. this exercises structs and arrays 
+
+$resp = $client->call("examples.sortByAge", 
+                                                                               
        [ { 'name' => 'Dave', 'age' => 35},
+                                                                               
                { 'name' => 'Edd', 'age' => 45 },
+                                                                               
                { 'name' => 'Fred', 'age' => 23 },
+                                                                               
                { 'name' => 'Barney', 'age' => 36 } ] );
+
+my $e;
+foreach $e (@$resp) {
+       print $$e{'name'} . ", " . $$e{'age'} . "\n";
+}
+
+# test base64
+
+$resp = $client->call("examples.decode64", 
+                                                                               
        $client->base64("TWFyeSBoYWQgYSBsaXR0bGUgbGFtYiBTaGUgd" .
+                                                                               
                                                                        
"GllZCBpdCB0byBhIHB5bG9u"));
+
+print $resp . "\n";

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/test.py
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/test.py            
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/test.py    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,37 @@
+#!/usr/local/bin/python
+
+from xmlrpclib import *
+import sys
+
+server = Server("http://phpxmlrpc.sourceforge.net/server.php";)
+
+try:
+    print "Got '" + server.examples.getStateName(32) + "'"
+
+    r = server.mail.send("edd", "Test",
+                         "Bonjour. Je m'appelle G\xE9rard. Ma\xF1ana. ", 
"freddy", "", "", 
+                         'text/plain; charset="iso-8859-1"')
+    if r:
+        print "Mail sent OK"
+    else:
+        print "Error sending mail"
+
+
+    r = server.examples.echo('Three "blind" mice - ' + "See 'how' they run")
+    print r
+
+    # name/age example. this exercises structs and arrays
+
+    a = [ {'name': 'Dave', 'age': 35}, {'name': 'Edd', 'age': 45 },
+          {'name': 'Fred', 'age': 23}, {'name': 'Barney', 'age': 36 }]
+    r = server.examples.sortByAge(a)
+    print r
+
+    # test base 64
+    b = Binary("Mary had a little lamb She tied it to a pylon")
+    b.encode(sys.stdout)
+    r = server.examples.decode64(b)
+    print r
+    
+except Error, v:
+    print "XML-RPC Error:",v

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/workspace.testPhpServer.fttb
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/workspace.testPhpServer.fttb
                               (rev 0)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/extras/workspace.testPhpServer.fttb
       2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,10 @@
+
+<!--
+#fatPage
+#version 1
+#docs http://www.scripting.com/fatPages/faq.html
+#adrPageData workspace.testPhpServer
+#objectType application/x-frontier-tabl
+#runnable false
+#pageData 
AAEDAAAADxcAAABMAAMAALU6OiG1Oj+vAAAAAAAAAAANAAAAAAUAAAGDDQAAAAGQAAAC4w0AAAAC7AAABecNAAAABe4AAAskDQAAAAsrAAALpg0AAAALsARlY2hvAAABegABBAIAAgAAABIAAADsAAAAAgAPBUFyaWFsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAZUAAC1OjqKtTo+ZAAAAAYAAADoAN0C4AP3TEFORP///////wAAAAAAAAB3aW4AAAAAAAAAAAAAAAB3aXRoIHdvcmtzcGFjZS50ZXN0UGhwU2VydmVyLnNlcnZlcg0JbG9jYWwgKHBhcmFtcyA9IHsib2ggdGhlIGJ1enppbmcgb2YgdGhlIGJlZXMifSkNCXdwLm5ld3RleHRvYmplY3QgKGJldHR5LnJwYy5jbGllbnQgKGRvbWFpbiwgcG9ydCwgImV4YW1wbGVzLmVjaG8iLCBAcGFyYW1zLCBycGNwYXRoOnBhdGgsIGZsU2hvd01lc3NhZ2VzOiBmYWxzZSwgZmxkZWJ1ZzpmYWxzZSksIEBzY3JhdGNocGFkLnBocFRleHQpDYAAAAAAAIAAAAAAAIAAAAAAAAxnZXRTdGF0ZU5hbWUAAAFPAAEEAgACAAAAGAAAALsAAwACAA8FQXJpYWwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAABlQAALU6Ooq1OjuFAAAAAgAAAaAAogKQAy5MQU5E////////AAAAAAAAAHdpbgAAAAAAAAAAAAAAAHdpdGggd29ya3NwYWNlLnRlc3RQaHBTZXJ2ZXIuc2VydmVyDQlmb3IgaSA9IDEgdG8gNTANCQlsb2NhbCAocGFyYW1zID0ge2l9KQ0JCW1zZyAoYmV0dHkucnBjLmNsaWVudCAoZG9tYWluLCBwb3J0LCAiZXhhbXBsZXMuZ2V0U3RhdGVOYW1lIiwgQHBhcmFtcywgcnBjcGF0aDpwYXRoLCBmbFNob3dNZXNzYWdlczogZmFsc2UpKQ2AAAAAAACAAAAAAACAAAAAAACAAAAAAAAIbWFpbFNlbmQAAAL3AAEEAgACAAAAMAAAAksAAwACAA8FQXJpYWwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAABlQAALU6Pqm1Oj90AAAAAQAAAK4ADgLDAzZMQU5E////////AAAAAAAAAHdpbgAAAAAAAAAAAAAAAHdpdGggd29ya3NwYWNlLnRlc3RQaHBTZXJ2ZXIuc2VydmVyDQlsb2NhbCAocmVjaXBpZW50ID0gImRhdmVAdXNlcmxhbmQuY29tIikNCWxvY2FsIChzdWJqZWN0ID0gIkhpIERhdmUhIikNCWxvY2FsICh0ZXh0ID0gIlRoaXMgaXMgYSBtZXNzYWdlIHNlbnQgYnkgYSBzY3JpcHQgb24gIiArIHRjcC5kbnMuZ2V0TXlEb21haW5OYW1lICgpICsgIiBzZW50IHRocm91Z2ggYSBQSFAgc2VydmVyIHJ1bm5pbmcgb24gIiArIGRvbWFpbiArICIgYXQgIiArIGNsb2NrLm5vdyAoKSArICIuIikNCWxvY2FsIChzZW5kZXIgPSB1c2VyLnByZWZzLm1haWxhZGRyZXNzKQ0JbG9jYWwgKGNjID0gIiIsIGJjYyA9ICIiLCBtaW1ldHlwZSA9ICJ0ZXh0L3BsYWluIikNCWxvY2FsIChwYXJhbXMgPSB7cmVjaXBpZW50LCBzdWJqZWN0LCB0ZXh0LCBzZW5kZXIsIGNjLCBiY2MsIG1pbWV0eXBlfSkNCXdwLm5ld3RleHRvYmplY3QgKGJldHR5LnJwYy5jbGllbnQgKGRvbWFpbiwgcG9ydCwgIm1haWwuc2VuZCIsIEBwYXJhbXMsIHJwY3BhdGg6cGF0aCwgZmxTaG93TWVzc2FnZXM6IGZhbHNlLCBmbGRlYnVnOmZhbHNlKSwgQHNjcmF0Y2hwYWQucGhwVGV4dCkNgAAAAAAAgAAAAAAAgAAAAAAAgAAAAAAAgAAAAAAAgAAAAAAAgAAAAAAAgAAAAAAABnJlYWRtZQAABTIAAQECRkZGRjAwMDAwMDA2MDAwMTAwMTcBNzdBQQMwMDAwMDAwMDAwNUIwMDAwMDAwMAIxMDAxNwIxMDECODA0OTAwMgIxODAwMDACMIKCAjYwMDA2MAIwAjMCOTMBMjABMIGBAi0xggIwwggCM4ICOTMCMjFGAUZGRkaBgQEwgoICMQIwwgQCQjMBMAMwMDAxMDAwMDAwMzYwMDAwMDAwMQIwAkIzATQwODQCMIGCgYICM4ICOTMCMjFGATlCATABMwE4RTAwATACODMCMwI5MwI5OQIwAzAwMDIwMDAwMDBCODAwMDAwMDAwAEIzLFRoZXNlIHNjcmlwdHMgdGVzdCB0aGUgcHVibGljIGhhbmRsZXJzIGF0Og0NaHR0cDovL3htbHJwYy51c2VmdWxpbmMuY29tL2RlbW8vaW50cm9zcGVjdC5waHANDURvY3VtZW50YXRpb24gaXMgaGVyZToNDWh0dHA6Ly94bWxycGMudXNlZnVsaW5jLmNvbS9waHAuaHRtbA0NNS82LzAwOyA5OjMyOjA1IFBNIGJ5IERXAzAwMDQwMDAwMDAwOTAwMDAwMDAyAjCBAkI1ATADMDAwNTAwMDAwMDA5MDAwMDAwMDICMIECQjUBMAMwMDA2MDAwMDAwMzEwMDAwMDAwMQEwwQMBRAEzATCBgoLBBAFGRkZGgYEBMIICQTAwMDACMMIKAjICMMIHwSCCgsEDggMwMDA3MDAwMDAwMTkwMDAwMDAwMQEwgYHCD4GCAjICMMIHgQIxOAEwgsEDggMwMDA4MDAwMDAwQUEwMDAwMDAwMQA0MCwNTVMgU2FucyBTZXJpZgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQwLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNAEwgYECNEU0AjQwMAIwAjECMgIxggIwwgMCMTAxATADMDAwOTAwMDAwMDE1MDAwMDAwMDICMIICOTkCMTdBAjCCAjk5AjE3QQMwMDBBMDAwMDAwMTUwMDAwMDAwMgIzggI5MwIyMUYCM4ICOTMCMjFGAzAwMEIwMDAwMDAwNTAwMDAwMDAyAjDCBwMwMDBDMDAwMDAwMTAwMDAwMDAwMQJCMwIwwgMBOAI5NoIBMAMwMDBGMDAwMDAwNTIwMDAwMDAwMAI0MAEwwgsBMQIwwgmBgYKBgcIFwQXCA8EEgoLBA8IeADQsAAAAAAA0LHUAAAAANCxSAGUAADQsAgAhAAA0LAE3N0EANCwAAAAAADQsNCzYAAMwMDEzMDAwMDAwN0UwMDAwMDAwMAFEAUEBOQExRgE4AUMBRQExQwExRAExRQExRgE3RgExQgEwADQ0LAEtAAABLgAAAbYAAAG1AAABlQAAAbUAAAGlAAABpQAAAS4AAAEnAAABIgAAAZEAAAGSAAABkwAAAZQAAAGFAAABgwAAAUZGRkaBgQEwAUZGRkaBgQEwA0ZGRkUwMDAwMDAwNjAwMDEwMDE3ATc3QUEDAAG1Oj+vtTo/1QAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzAAAAAAAAAAAAAAEsAL8B1QJJAAAAAAAABKoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABnNlcnZlcgAAAHcAAQMCAAAAbwAAAC4AAwAAtTo6TLU6PHkAAAAAAAAAAAwAAAAABwAAAB8MAAAAACQAAAA4AwAAAABQBmRvbWFpbgAAABR4bWxycGMudXNlZnVsaW5jLmNvbQRwYXRoAAAAEC9kZW1vL3NlcnZlci5waHAEcG9ydAlzb3J0QnlBZ2UAAAMTAAEEAgACAAAAcgAAAiUAEgACAA8FQXJpYWwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAABlQAALU6Ooq1Oj3dAAAABQAAAIgAGQKGAzlMQU5E////////AAAAAAAAAHdpbgAAAAAAAAAAAAAAAHdpdGggd29ya3NwYWNlLnRlc3RQaHBTZXJ2ZXIuc2VydmVyDQlsb2NhbCAobGlzdHRvYmVzb3J0ZWQgPSB7fSwgc29ydGVkbGlzdCkNCWJ1bmRsZSAvL2J1aWxkIHRoZSBsaXN0DQkJb24gYWRkIChuYW1lLCBhZ2UpDQkJCWxvY2FsICh0KQ0JCQluZXcgKHRhYmxldHlwZSwgQHQpDQkJCXQubmFtZSA9IG5hbWUNCQkJdC5hZ2UgPSBhZ2UNCQkJbGlzdHRvYmVzb3J0ZWQgPSBsaXN0dG9iZXNvcnRlZCArIHt0fQ0JCWFkZCAoIkRhdmUiLCAzNSkNCQlhZGQgKCJFZGQiLCA0NSkNCQlhZGQgKCJGcmVkIiwgMjMpDQkJYWRkICgiQmFybmV5IiwgMzcpDQlsb2NhbCAocGFyYW1zID0ge2xpc3R0b2Jlc29ydGVkfSkNCXNvcnRlZGxpc3QgPSBiZXR0eS5ycGMuY2xpZW50IChkb21haW4sIHBvcnQsICJleGFtcGxlcy5zb3J0QnlBZ2UiLCBAcGFyYW1zLCBycGNwYXRoOnBhdGgsIGZsU2hvd01lc3NhZ2VzOiBmYWxzZSwgZmxkZWJ1ZzpmYWxzZSkNCQ0JbG9jYWwgKGl0ZW0pDQlmb3IgaXRlbSBpbiBzb3J0ZWRsaXN0DQkJbXNnIChpdGVtLm5hbWUgKyAiLCAiICsgaXRlbS5hZ2UpDYAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAIAAAAAAAAAQAFYNTVMgU2FucyBTZXJpZgAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAwAAALEAzQBIALwA8wG8AucBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAEOAAAARwAGAAIADw1NUyBTYW5zIFNlcmlmAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAAAAAAAAAAAtTo6RLU6P6sAAAAEAAABYAGIAigDCUxBTkT///////8AAAAAAAAAd2luAAAAAAAAAAAAAAAAZWNobw1nZXRTdGF0ZU5hbWUNcmVhZG1lDW1haWxTZW5kDXNlcnZlcg0JZG9tYWluDQlwb3J0DQlwYXRoDXNvcnRCeUFnZQ2AAAAAABgAAHgb/wA4ZRwBAAAAAAAAAAAAAAAAAACAAAAAABgAAHgb/wA4ZRwBAAAAAAAAAAAAAAAAAACAAAAAABgAAHgb/wA4ZRwBAAAAAAAAAAAAAAAAAACAAAAAABgAAHgb/wA4ZRwBAAAAAAAAAAAAAAAAAACAAAAAABgBAHgb/wA4ZRwBAAABAAAAAAAAAAAAAACAAAAAABgAAHgb/wBYSgECAAAAAAAAAAAAAAAAAACAAAAAABgAAHgb/wBYSgECAAAAAAAAAAAAAAAAAACAAAAAABgAAHgb/wBYSgECAAAAAAAAAAAAAAAAAACAAAAAABgAAHgb/wA4ZRwBAAAAAAAAAAAAAAAAAAA=
+-->
Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpc.inc
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpc.inc            
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpc.inc    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,3776 @@
+<?php
+// by Edd Dumbill (C) 1999-2002
+// <address@hidden>
+// $Id: xmlrpc.inc,v 1.174 2009/03/16 19:36:38 ggiunta Exp $
+
+// Copyright (c) 1999,2000,2002 Edd Dumbill.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+//    * Redistributions of source code must retain the above copyright
+//      notice, this list of conditions and the following disclaimer.
+//
+//    * Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials provided
+//      with the distribution.
+//
+//    * Neither the name of the "XML-RPC for PHP" nor the names of its
+//      contributors may be used to endorse or promote products derived
+//      from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+// OF THE POSSIBILITY OF SUCH DAMAGE.
+
+       if(!function_exists('xml_parser_create'))
+       {
+               // For PHP 4 onward, XML functionality is always compiled-in on 
windows:
+               // no more need to dl-open it. It might have been compiled out 
on *nix...
+               if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN'))
+               {
+                       dl('xml.so');
+               }
+       }
+
+       // G. Giunta 2005/01/29: declare global these variables,
+       // so that xmlrpc.inc will work even if included from within a function
+       // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where 
used.
+       $GLOBALS['xmlrpcI4']='i4';
+       $GLOBALS['xmlrpcInt']='int';
+       $GLOBALS['xmlrpcBoolean']='boolean';
+       $GLOBALS['xmlrpcDouble']='double';
+       $GLOBALS['xmlrpcString']='string';
+       $GLOBALS['xmlrpcDateTime']='dateTime.iso8601';
+       $GLOBALS['xmlrpcBase64']='base64';
+       $GLOBALS['xmlrpcArray']='array';
+       $GLOBALS['xmlrpcStruct']='struct';
+       $GLOBALS['xmlrpcValue']='undefined';
+
+       $GLOBALS['xmlrpcTypes']=array(
+               $GLOBALS['xmlrpcI4']       => 1,
+               $GLOBALS['xmlrpcInt']      => 1,
+               $GLOBALS['xmlrpcBoolean']  => 1,
+               $GLOBALS['xmlrpcString']   => 1,
+               $GLOBALS['xmlrpcDouble']   => 1,
+               $GLOBALS['xmlrpcDateTime'] => 1,
+               $GLOBALS['xmlrpcBase64']   => 1,
+               $GLOBALS['xmlrpcArray']    => 2,
+               $GLOBALS['xmlrpcStruct']   => 3
+       );
+
+       $GLOBALS['xmlrpc_valid_parents'] = array(
+               'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'),
+               'BOOLEAN' => array('VALUE'),
+               'I4' => array('VALUE'),
+               'INT' => array('VALUE'),
+               'STRING' => array('VALUE'),
+               'DOUBLE' => array('VALUE'),
+               'DATETIME.ISO8601' => array('VALUE'),
+               'BASE64' => array('VALUE'),
+               'MEMBER' => array('STRUCT'),
+               'NAME' => array('MEMBER'),
+               'DATA' => array('ARRAY'),
+               'ARRAY' => array('VALUE'),
+               'STRUCT' => array('VALUE'),
+               'PARAM' => array('PARAMS'),
+               'METHODNAME' => array('METHODCALL'),
+               'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
+               'FAULT' => array('METHODRESPONSE'),
+               'NIL' => array('VALUE'), // only used when extension activated
+               'EX:NIL' => array('VALUE') // only used when extension activated
+       );
+
+       // define extra types for supporting NULL (useful for json or <NIL/>)
+       $GLOBALS['xmlrpcNull']='null';
+       $GLOBALS['xmlrpcTypes']['null']=1;
+
+       // Not in use anymore since 2.0. Shall we remove it?
+       /// @deprecated
+       $GLOBALS['xmlEntities']=array(
+               'amp'  => '&',
+               'quot' => '"',
+               'lt'   => '<',
+               'gt'   => '>',
+               'apos' => "'"
+       );
+
+       // tables used for transcoding different charsets into us-ascii xml
+
+       $GLOBALS['xml_iso88591_Entities']=array();
+       $GLOBALS['xml_iso88591_Entities']['in'] = array();
+       $GLOBALS['xml_iso88591_Entities']['out'] = array();
+       for ($i = 0; $i < 32; $i++)
+       {
+               $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
+               $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
+       }
+       for ($i = 160; $i < 256; $i++)
+       {
+               $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
+               $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
+       }
+
+       /// @todo add to iso table the characters from cp_1252 range, i.e. 128 
to 159?
+       /// These will NOT be present in true ISO-8859-1, but will save the 
unwary
+       /// windows user from sending junk (though no luck when reciving 
them...)
+  /*
+       $GLOBALS['xml_cp1252_Entities']=array();
+       for ($i = 128; $i < 160; $i++)
+       {
+               $GLOBALS['xml_cp1252_Entities']['in'][] = chr($i);
+       }
+       $GLOBALS['xml_cp1252_Entities']['out'] = array(
+               '&#x20AC;', '?',        '&#x201A;', '&#x0192;',
+               '&#x201E;', '&#x2026;', '&#x2020;', '&#x2021;',
+               '&#x02C6;', '&#x2030;', '&#x0160;', '&#x2039;',
+               '&#x0152;', '?',        '&#x017D;', '?',
+               '?',        '&#x2018;', '&#x2019;', '&#x201C;',
+               '&#x201D;', '&#x2022;', '&#x2013;', '&#x2014;',
+               '&#x02DC;', '&#x2122;', '&#x0161;', '&#x203A;',
+               '&#x0153;', '?',        '&#x017E;', '&#x0178;'
+       );
+  */
+
+       $GLOBALS['xmlrpcerr'] = array(
+       'unknown_method'=>1,
+       'invalid_return'=>2,
+       'incorrect_params'=>3,
+       'introspect_unknown'=>4,
+       'http_error'=>5,
+       'no_data'=>6,
+       'no_ssl'=>7,
+       'curl_fail'=>8,
+       'invalid_request'=>15,
+       'no_curl'=>16,
+       'server_error'=>17,
+       'multicall_error'=>18,
+       'multicall_notstruct'=>9,
+       'multicall_nomethod'=>10,
+       'multicall_notstring'=>11,
+       'multicall_recursion'=>12,
+       'multicall_noparams'=>13,
+       'multicall_notarray'=>14,
+
+       'cannot_decompress'=>103,
+       'decompress_fail'=>104,
+       'dechunk_fail'=>105,
+       'server_cannot_decompress'=>106,
+       'server_decompress_fail'=>107
+       );
+
+       $GLOBALS['xmlrpcstr'] = array(
+       'unknown_method'=>'Unknown method',
+       'invalid_return'=>'Invalid return payload: enable debugging to examine 
incoming payload',
+       'incorrect_params'=>'Incorrect parameters passed to method',
+       'introspect_unknown'=>"Can't introspect: method unknown",
+       'http_error'=>"Didn't receive 200 OK from remote server.",
+       'no_data'=>'No data received from server.',
+       'no_ssl'=>'No SSL support compiled in.',
+       'curl_fail'=>'CURL error',
+       'invalid_request'=>'Invalid request payload',
+       'no_curl'=>'No CURL support compiled in.',
+       'server_error'=>'Internal server error',
+       'multicall_error'=>'Received from server invalid multicall response',
+       'multicall_notstruct'=>'system.multicall expected struct',
+       'multicall_nomethod'=>'missing methodName',
+       'multicall_notstring'=>'methodName is not a string',
+       'multicall_recursion'=>'recursive system.multicall forbidden',
+       'multicall_noparams'=>'missing params',
+       'multicall_notarray'=>'params is not an array',
+
+       'cannot_decompress'=>'Received from server compressed HTTP and cannot 
decompress',
+       'decompress_fail'=>'Received from server invalid compressed HTTP',
+       'dechunk_fail'=>'Received from server invalid chunked HTTP',
+       'server_cannot_decompress'=>'Received from client compressed HTTP 
request and cannot decompress',
+       'server_decompress_fail'=>'Received from client invalid compressed HTTP 
request'
+       );
+
+       // The charset encoding used by the server for received messages and
+       // by the client for received responses when received charset cannot be 
determined
+       // or is not supported
+       $GLOBALS['xmlrpc_defencoding']='UTF-8';
+
+       // The encoding used internally by PHP.
+       // String values received as xml will be converted to this, and php 
strings will be converted to xml
+       // as if having been coded with this
+       $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';
+
+       $GLOBALS['xmlrpcName']='XML-RPC for PHP';
+       $GLOBALS['xmlrpcVersion']='3.0.0.beta';
+
+       // let user errors start at 800
+       $GLOBALS['xmlrpcerruser']=800;
+       // let XML parse errors start at 100
+       $GLOBALS['xmlrpcerrxml']=100;
+
+       // formulate backslashes for escaping regexp
+       // Not in use anymore since 2.0. Shall we remove it?
+       /// @deprecated
+       $GLOBALS['xmlrpc_backslash']=chr(92).chr(92);
+
+       // set to TRUE to enable correct decoding of <NIL/> and <EX:NIL/> values
+       $GLOBALS['xmlrpc_null_extension']=false;
+
+       // set to TRUE to enable encoding of php NULL values to <EX:NIL/> 
instead of <NIL/>
+       $GLOBALS['xmlrpc_null_apache_encoding']=false;
+
+       // used to store state during parsing
+       // quick explanation of components:
+       //   ac - used to accumulate values
+       //   isf - used to indicate a parsing fault (2) or xmlrpcresp fault (1)
+       //   isf_reason - used for storing xmlrpcresp fault string
+       //   lv - used to indicate "looking for a value": implements
+       //        the logic to allow values with no types to be strings
+       //   params - used to store parameters in method calls
+       //   method - used to store method name
+       //   stack - array with genealogy of xml elements names:
+       //           used to validate nesting of xmlrpc elements
+       $GLOBALS['_xh']=null;
+
+       /**
+       * Convert a string to the correct XML representation in a target charset
+       * To help correct communication of non-ascii chars inside strings, 
regardless
+       * of the charset used when sending requests, parsing them, sending 
responses
+       * and parsing responses, an option is to convert all non-ascii chars 
present in the message
+       * into their equivalent 'charset entity'. Charset entities enumerated 
this way
+       * are independent of the charset encoding used to transmit them, and 
all XML
+       * parsers are bound to understand them.
+       * Note that in the std case we are not sending a charset encoding mime 
type
+       * along with http headers, so we are bound by RFC 3023 to emit strict 
us-ascii.
+       *
+       * @todo do a bit of basic benchmarking (strtr vs. str_replace)
+       * @todo make usage of iconv() or recode_string() or mb_string() where 
available
+       */
+       function xmlrpc_encode_entitites($data, $src_encoding='', 
$dest_encoding='')
+       {
+               if ($src_encoding == '')
+               {
+                       // lame, but we know no better...
+                       $src_encoding = $GLOBALS['xmlrpc_internalencoding'];
+               }
+
+               switch(strtoupper($src_encoding.'_'.$dest_encoding))
+               {
+                       case 'ISO-8859-1_':
+                       case 'ISO-8859-1_US-ASCII':
+                               $escaped_data = str_replace(array('&', '"', 
"'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               $escaped_data = 
str_replace($GLOBALS['xml_iso88591_Entities']['in'], 
$GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
+                               break;
+                       case 'ISO-8859-1_UTF-8':
+                               $escaped_data = str_replace(array('&', '"', 
"'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               $escaped_data = utf8_encode($escaped_data);
+                               break;
+                       case 'ISO-8859-1_ISO-8859-1':
+                       case 'US-ASCII_US-ASCII':
+                       case 'US-ASCII_UTF-8':
+                       case 'US-ASCII_':
+                       case 'US-ASCII_ISO-8859-1':
+                       case 'UTF-8_UTF-8':
+                       //case 'CP1252_CP1252':
+                               $escaped_data = str_replace(array('&', '"', 
"'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               break;
+                       case 'UTF-8_':
+                       case 'UTF-8_US-ASCII':
+                       case 'UTF-8_ISO-8859-1':
+       // NB: this will choke on invalid UTF-8, going most likely beyond EOF
+       $escaped_data = '';
+       // be kind to users creating string xmlrpcvals out of different php 
types
+       $data = (string) $data;
+       $ns = strlen ($data);
+       for ($nn = 0; $nn < $ns; $nn++)
+       {
+               $ch = $data[$nn];
+               $ii = ord($ch);
+               //1 7 0bbbbbbb (127)
+               if ($ii < 128)
+               {
+                       /// @todo shall we replace this with a (supposedly) 
faster str_replace?
+                       switch($ii){
+                               case 34:
+                                       $escaped_data .= '&quot;';
+                                       break;
+                               case 38:
+                                       $escaped_data .= '&amp;';
+                                       break;
+                               case 39:
+                                       $escaped_data .= '&apos;';
+                                       break;
+                               case 60:
+                                       $escaped_data .= '&lt;';
+                                       break;
+                               case 62:
+                                       $escaped_data .= '&gt;';
+                                       break;
+                               default:
+                                       $escaped_data .= $ch;
+                       } // switch
+               }
+               //2 11 110bbbbb 10bbbbbb (2047)
+               else if ($ii>>5 == 6)
+               {
+                       $b1 = ($ii & 31);
+                       $ii = ord($data[$nn+1]);
+                       $b2 = ($ii & 63);
+                       $ii = ($b1 * 64) + $b2;
+                       $ent = sprintf ('&#%d;', $ii);
+                       $escaped_data .= $ent;
+                       $nn += 1;
+               }
+               //3 16 1110bbbb 10bbbbbb 10bbbbbb
+               else if ($ii>>4 == 14)
+               {
+                       $b1 = ($ii & 15);
+                       $ii = ord($data[$nn+1]);
+                       $b2 = ($ii & 63);
+                       $ii = ord($data[$nn+2]);
+                       $b3 = ($ii & 63);
+                       $ii = ((($b1 * 64) + $b2) * 64) + $b3;
+                       $ent = sprintf ('&#%d;', $ii);
+                       $escaped_data .= $ent;
+                       $nn += 2;
+               }
+               //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+               else if ($ii>>3 == 30)
+               {
+                       $b1 = ($ii & 7);
+                       $ii = ord($data[$nn+1]);
+                       $b2 = ($ii & 63);
+                       $ii = ord($data[$nn+2]);
+                       $b3 = ($ii & 63);
+                       $ii = ord($data[$nn+3]);
+                       $b4 = ($ii & 63);
+                       $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
+                       $ent = sprintf ('&#%d;', $ii);
+                       $escaped_data .= $ent;
+                       $nn += 3;
+               }
+       }
+                               break;
+/*
+                       case 'CP1252_':
+                       case 'CP1252_US-ASCII':
+                               $escaped_data = str_replace(array('&', '"', 
"'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               $escaped_data = 
str_replace($GLOBALS['xml_iso88591_Entities']['in'], 
$GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
+                               $escaped_data = 
str_replace($GLOBALS['xml_cp1252_Entities']['in'], 
$GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
+                               break;
+                       case 'CP1252_UTF-8':
+                               $escaped_data = str_replace(array('&', '"', 
"'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               /// @todo we could use real UTF8 chars here 
instead of xml entities... (note that utf_8 encode all allone will NOT convert 
them)
+                               $escaped_data = 
str_replace($GLOBALS['xml_cp1252_Entities']['in'], 
$GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
+                               $escaped_data = utf8_encode($escaped_data);
+                               break;
+                       case 'CP1252_ISO-8859-1':
+                               $escaped_data = str_replace(array('&', '"', 
"'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               // we might as well replave all funky chars 
with a '?' here, but we are kind and leave it to the receiving application 
layer to decide what to do with these weird entities...
+                               $escaped_data = 
str_replace($GLOBALS['xml_cp1252_Entities']['in'], 
$GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
+                               break;
+*/
+                       default:
+                               $escaped_data = '';
+                               error_log("Converting from $src_encoding to 
$dest_encoding: not supported...");
+               }
+               return $escaped_data;
+       }
+
+       /// xml parser handler function for opening element tags
+       function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false)
+       {
+               // if invalid xmlrpc already detected, skip all processing
+               if ($GLOBALS['_xh']['isf'] < 2)
+               {
+                       // check for correct element nesting
+                       // top level element can only be of 2 types
+                       /// @todo optimization creep: save this check into a 
bool variable, instead of using count() every time:
+                       ///       there is only a single top level element in 
xml anyway
+                       if (count($GLOBALS['_xh']['stack']) == 0)
+                       {
+                               if ($name != 'METHODRESPONSE' && $name != 
'METHODCALL' && (
+                                       $name != 'VALUE' && 
!$accept_single_vals))
+                               {
+                                       $GLOBALS['_xh']['isf'] = 2;
+                                       $GLOBALS['_xh']['isf_reason'] = 
'missing top level xmlrpc element';
+                                       return;
+                               }
+                               else
+                               {
+                                       $GLOBALS['_xh']['rt'] = 
strtolower($name);
+                                       $GLOBALS['_xh']['rt'] = 
strtolower($name);
+                               }
+                       }
+                       else
+                       {
+                               // not top level element: see if parent is OK
+                               $parent = end($GLOBALS['_xh']['stack']);
+                               if (!array_key_exists($name, 
$GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, 
$GLOBALS['xmlrpc_valid_parents'][$name]))
+                               {
+                                       $GLOBALS['_xh']['isf'] = 2;
+                                       $GLOBALS['_xh']['isf_reason'] = "xmlrpc 
element $name cannot be child of $parent";
+                                       return;
+                               }
+                       }
+
+                       switch($name)
+                       {
+                               // optimize for speed switch cases: most common 
cases first
+                               case 'VALUE':
+                                       /// @todo we could check for 2 VALUE 
elements inside a MEMBER or PARAM element
+                                       $GLOBALS['_xh']['vt']='value'; // 
indicator: no value found yet
+                                       $GLOBALS['_xh']['ac']='';
+                                       $GLOBALS['_xh']['lv']=1;
+                                       $GLOBALS['_xh']['php_class']=null;
+                                       break;
+                               case 'I4':
+                               case 'INT':
+                               case 'STRING':
+                               case 'BOOLEAN':
+                               case 'DOUBLE':
+                               case 'DATETIME.ISO8601':
+                               case 'BASE64':
+                                       if ($GLOBALS['_xh']['vt']!='value')
+                                       {
+                                               //two data elements inside a 
value: an error occurred!
+                                               $GLOBALS['_xh']['isf'] = 2;
+                                               $GLOBALS['_xh']['isf_reason'] = 
"$name element following a {$GLOBALS['_xh']['vt']} element inside a single 
value";
+                                               return;
+                                       }
+                                       $GLOBALS['_xh']['ac']=''; // reset the 
accumulator
+                                       break;
+                               case 'STRUCT':
+                               case 'ARRAY':
+                                       if ($GLOBALS['_xh']['vt']!='value')
+                                       {
+                                               //two data elements inside a 
value: an error occurred!
+                                               $GLOBALS['_xh']['isf'] = 2;
+                                               $GLOBALS['_xh']['isf_reason'] = 
"$name element following a {$GLOBALS['_xh']['vt']} element inside a single 
value";
+                                               return;
+                                       }
+                                       // create an empty array to hold child 
values, and push it onto appropriate stack
+                                       $cur_val = array();
+                                       $cur_val['values'] = array();
+                                       $cur_val['type'] = $name;
+                                       // check for out-of-band information to 
rebuild php objs
+                                       // and in case it is found, save it
+                                       if (@isset($attrs['PHP_CLASS']))
+                                       {
+                                               $cur_val['php_class'] = 
$attrs['PHP_CLASS'];
+                                       }
+                                       $GLOBALS['_xh']['valuestack'][] = 
$cur_val;
+                                       $GLOBALS['_xh']['vt']='data'; // be 
prepared for a data element next
+                                       break;
+                               case 'DATA':
+                                       if ($GLOBALS['_xh']['vt']!='data')
+                                       {
+                                               //two data elements inside a 
value: an error occurred!
+                                               $GLOBALS['_xh']['isf'] = 2;
+                                               $GLOBALS['_xh']['isf_reason'] = 
"found two data elements inside an array element";
+                                               return;
+                                       }
+                               case 'METHODCALL':
+                               case 'METHODRESPONSE':
+                               case 'PARAMS':
+                                       // valid elements that add little to 
processing
+                                       break;
+                               case 'METHODNAME':
+                               case 'NAME':
+                                       /// @todo we could check for 2 NAME 
elements inside a MEMBER element
+                                       $GLOBALS['_xh']['ac']='';
+                                       break;
+                               case 'FAULT':
+                                       $GLOBALS['_xh']['isf']=1;
+                                       break;
+                               case 'MEMBER':
+                                       
$GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']='';
 // set member name to null, in case we do not find in the xml later on
+                                       //$GLOBALS['_xh']['ac']='';
+                                       // Drop trough intentionally
+                               case 'PARAM':
+                                       // clear value type, so we can check 
later if no value has been passed for this param/member
+                                       $GLOBALS['_xh']['vt']=null;
+                                       break;
+                               case 'NIL':
+                               case 'EX:NIL':
+                                       if ($GLOBALS['xmlrpc_null_extension'])
+                                       {
+                                               if 
($GLOBALS['_xh']['vt']!='value')
+                                               {
+                                                       //two data elements 
inside a value: an error occurred!
+                                                       $GLOBALS['_xh']['isf'] 
= 2;
+                                                       
$GLOBALS['_xh']['isf_reason'] = "$name element following a 
{$GLOBALS['_xh']['vt']} element inside a single value";
+                                                       return;
+                                               }
+                                               $GLOBALS['_xh']['ac']=''; // 
reset the accumulator
+                                               break;
+                                       }
+                                       // we do not support the <NIL/> 
extension, so
+                                       // drop through intentionally
+                               default:
+                                       /// INVALID ELEMENT: RAISE ISF so that 
it is later recognized!!!
+                                       $GLOBALS['_xh']['isf'] = 2;
+                                       $GLOBALS['_xh']['isf_reason'] = "found 
not-xmlrpc xml element $name";
+                                       break;
+                       }
+
+                       // Save current element name to stack, to validate 
nesting
+                       $GLOBALS['_xh']['stack'][] = $name;
+
+                       /// @todo optimization creep: move this inside the big 
switch() above
+                       if($name!='VALUE')
+                       {
+                               $GLOBALS['_xh']['lv']=0;
+                       }
+               }
+       }
+
+       /// Used in decoding xml chunks that might represent single xmlrpc 
values
+       function xmlrpc_se_any($parser, $name, $attrs)
+       {
+               xmlrpc_se($parser, $name, $attrs, true);
+       }
+
+       /// xml parser handler function for close element tags
+       function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
+       {
+               if ($GLOBALS['_xh']['isf'] < 2)
+               {
+                       // push this element name from stack
+                       // NB: if XML validates, correct opening/closing is 
guaranteed and
+                       // we do not have to check for $name == $curr_elem.
+                       // we also checked for proper nesting at start of 
elements...
+                       $curr_elem = array_pop($GLOBALS['_xh']['stack']);
+
+                       switch($name)
+                       {
+                               case 'VALUE':
+                                       // This if() detects if no scalar was 
inside <VALUE></VALUE>
+                                       if ($GLOBALS['_xh']['vt']=='value')
+                                       {
+                                               
$GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+                                               
$GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString'];
+                                       }
+
+                                       if ($rebuild_xmlrpcvals)
+                                       {
+                                               // build the xmlrpc val out of 
the data received, and substitute it
+                                               $temp = new 
xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
+                                               // in case we got info about 
underlying php class, save it
+                                               // in the object we're 
rebuilding
+                                               if 
(isset($GLOBALS['_xh']['php_class']))
+                                                       $temp->_php_class = 
$GLOBALS['_xh']['php_class'];
+                                               // check if we are inside an 
array or struct:
+                                               // if value just built is 
inside an array, let's move it into array on the stack
+                                               $vscount = 
count($GLOBALS['_xh']['valuestack']);
+                                               if ($vscount && 
$GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
+                                               {
+                                                       
$GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;
+                                               }
+                                               else
+                                               {
+                                                       
$GLOBALS['_xh']['value'] = $temp;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               /// @todo this needs to treat 
correctly php-serialized objects,
+                                               /// since std deserializing is 
done by php_xmlrpc_decode,
+                                               /// which we will not be 
calling...
+                                               if 
(isset($GLOBALS['_xh']['php_class']))
+                                               {
+                                               }
+
+                                               // check if we are inside an 
array or struct:
+                                               // if value just built is 
inside an array, let's move it into array on the stack
+                                               $vscount = 
count($GLOBALS['_xh']['valuestack']);
+                                               if ($vscount && 
$GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
+                                               {
+                                                       
$GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = 
$GLOBALS['_xh']['value'];
+                                               }
+                                       }
+                                       break;
+                               case 'BOOLEAN':
+                               case 'I4':
+                               case 'INT':
+                               case 'STRING':
+                               case 'DOUBLE':
+                               case 'DATETIME.ISO8601':
+                               case 'BASE64':
+                                       $GLOBALS['_xh']['vt']=strtolower($name);
+                                       /// @todo: optimization creep - remove 
the if/elseif cycle below
+                                       /// since the case() in which we are 
already did that
+                                       if ($name=='STRING')
+                                       {
+                                               
$GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+                                       }
+                                       elseif ($name=='DATETIME.ISO8601')
+                                       {
+                                               if 
(!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac']))
+                                               {
+                                                       error_log('XML-RPC: 
invalid value received in DATETIME: '.$GLOBALS['_xh']['ac']);
+                                               }
+                                               
$GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];
+                                               
$GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+                                       }
+                                       elseif ($name=='BASE64')
+                                       {
+                                               /// @todo check for failure of 
base64 decoding / catch warnings
+                                               
$GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);
+                                       }
+                                       elseif ($name=='BOOLEAN')
+                                       {
+                                               // special case here: we 
translate boolean 1 or 0 into PHP
+                                               // constants true or false.
+                                               // Strings 'true' and 'false' 
are accepted, even though the
+                                               // spec never mentions them 
(see eg. Blogger api docs)
+                                               // NB: this simple checks helps 
a lot sanitizing input, ie no
+                                               // security problems around here
+                                               if ($GLOBALS['_xh']['ac']=='1' 
|| strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0)
+                                               {
+                                                       
$GLOBALS['_xh']['value']=true;
+                                               }
+                                               else
+                                               {
+                                                       // log if receiveing 
something strange, even though we set the value to false anyway
+                                                       if 
($GLOBALS['_xh']['ac']!='0' && strcasecmp($GLOBALS['_xh']['ac'], 'false') != 0)
+                                                               
error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
+                                                       
$GLOBALS['_xh']['value']=false;
+                                               }
+                                       }
+                                       elseif ($name=='DOUBLE')
+                                       {
+                                               // we have a DOUBLE
+                                               // we must check that only 
0123456789-.<space> are characters here
+                                               // NOTE: regexp could be much 
stricter than this...
+                                               if 
(!preg_match('/^[+-eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac']))
+                                               {
+                                                       /// @todo: find a 
better way of throwing an error than this!
+                                                       error_log('XML-RPC: non 
numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);
+                                                       
$GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
+                                               }
+                                               else
+                                               {
+                                                       // it's ok, add it on
+                                                       
$GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];
+                                               }
+                                       }
+                                       else
+                                       {
+                                               // we have an I4/INT
+                                               // we must check that only 
0123456789-<space> are characters here
+                                               if 
(!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac']))
+                                               {
+                                                       /// @todo find a better 
way of throwing an error than this!
+                                                       error_log('XML-RPC: non 
numeric value received in INT: '.$GLOBALS['_xh']['ac']);
+                                                       
$GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
+                                               }
+                                               else
+                                               {
+                                                       // it's ok, add it on
+                                                       
$GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];
+                                               }
+                                       }
+                                       //$GLOBALS['_xh']['ac']=''; // is this 
necessary?
+                                       $GLOBALS['_xh']['lv']=3; // indicate 
we've found a value
+                                       break;
+                               case 'NAME':
+                                       
$GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = 
$GLOBALS['_xh']['ac'];
+                                       break;
+                               case 'MEMBER':
+                                       //$GLOBALS['_xh']['ac']=''; // is this 
necessary?
+                                       // add to array in the stack the last 
element built,
+                                       // unless no VALUE was found
+                                       if ($GLOBALS['_xh']['vt'])
+                                       {
+                                               $vscount = 
count($GLOBALS['_xh']['valuestack']);
+                                               
$GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']]
 = $GLOBALS['_xh']['value'];
+                                       } else
+                                               error_log('XML-RPC: missing 
VALUE inside STRUCT in received xml');
+                                       break;
+                               case 'DATA':
+                                       //$GLOBALS['_xh']['ac']=''; // is this 
necessary?
+                                       $GLOBALS['_xh']['vt']=null; // reset 
this to check for 2 data elements in a row - even if they're empty
+                                       break;
+                               case 'STRUCT':
+                               case 'ARRAY':
+                                       // fetch out of stack array of values, 
and promote it to current value
+                                       $curr_val = 
array_pop($GLOBALS['_xh']['valuestack']);
+                                       $GLOBALS['_xh']['value'] = 
$curr_val['values'];
+                                       $GLOBALS['_xh']['vt']=strtolower($name);
+                                       if (isset($curr_val['php_class']))
+                                       {
+                                               $GLOBALS['_xh']['php_class'] = 
$curr_val['php_class'];
+                                       }
+                                       break;
+                               case 'PARAM':
+                                       // add to array of params the current 
value,
+                                       // unless no VALUE was found
+                                       if ($GLOBALS['_xh']['vt'])
+                                       {
+                                               
$GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];
+                                               
$GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];
+                                       }
+                                       else
+                                               error_log('XML-RPC: missing 
VALUE inside PARAM in received xml');
+                                       break;
+                               case 'METHODNAME':
+                                       
$GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', 
$GLOBALS['_xh']['ac']);
+                                       break;
+                               case 'NIL':
+                               case 'EX:NIL':
+                                       if ($GLOBALS['xmlrpc_null_extension'])
+                                       {
+                                               $GLOBALS['_xh']['vt']='null';
+                                               $GLOBALS['_xh']['value']=null;
+                                               $GLOBALS['_xh']['lv']=3;
+                                               break;
+                                       }
+                                       // drop through intentionally if nil 
extension not enabled
+                               case 'PARAMS':
+                               case 'FAULT':
+                               case 'METHODCALL':
+                               case 'METHORESPONSE':
+                                       break;
+                               default:
+                                       // End of INVALID ELEMENT!
+                                       // shall we add an assert here for 
unreachable code???
+                                       break;
+                       }
+               }
+       }
+
+       /// Used in decoding xmlrpc requests/responses without rebuilding 
xmlrpc values
+       function xmlrpc_ee_fast($parser, $name)
+       {
+               xmlrpc_ee($parser, $name, false);
+       }
+
+       /// xml parser handler function for character data
+       function xmlrpc_cd($parser, $data)
+       {
+               // skip processing if xml fault already detected
+               if ($GLOBALS['_xh']['isf'] < 2)
+               {
+                       // "lookforvalue==3" means that we've found an entire 
value
+                       // and should discard any further character data
+                       if($GLOBALS['_xh']['lv']!=3)
+                       {
+                               // G. Giunta 2006-08-23: useless change of 'lv' 
from 1 to 2
+                               //if($GLOBALS['_xh']['lv']==1)
+                               //{
+                                       // if we've found text and we're just 
in a <value> then
+                                       // say we've found a value
+                                       //$GLOBALS['_xh']['lv']=2;
+                               //}
+                               // we always initialize the accumulator before 
starting parsing, anyway...
+                               //if(address@hidden($GLOBALS['_xh']['ac']))
+                               //{
+                               //      $GLOBALS['_xh']['ac'] = '';
+                               //}
+                               $GLOBALS['_xh']['ac'].=$data;
+                       }
+               }
+       }
+
+       /// xml parser handler function for 'other stuff', ie. not char data or
+       /// element start/end tag. In fact it only gets called on unknown 
entities...
+       function xmlrpc_dh($parser, $data)
+       {
+               // skip processing if xml fault already detected
+               if ($GLOBALS['_xh']['isf'] < 2)
+               {
+                       if(substr($data, 0, 1) == '&' && substr($data, -1, 1) 
== ';')
+                       {
+                               // G. Giunta 2006-08-25: useless change of 'lv' 
from 1 to 2
+                               //if($GLOBALS['_xh']['lv']==1)
+                               //{
+                               //      $GLOBALS['_xh']['lv']=2;
+                               //}
+                               $GLOBALS['_xh']['ac'].=$data;
+                       }
+               }
+               return true;
+       }
+
+       class xmlrpc_client
+       {
+               var $path;
+               var $server;
+               var $port=0;
+               var $method='http';
+               var $errno;
+               var $errstr;
+               var $debug=0;
+               var $username='';
+               var $password='';
+               var $authtype=1;
+               var $cert='';
+               var $certpass='';
+               var $cacert='';
+               var $cacertdir='';
+               var $key='';
+               var $keypass='';
+               var $verifypeer=true;
+               var $verifyhost=1;
+               var $no_multicall=false;
+               var $proxy='';
+               var $proxyport=0;
+               var $proxy_user='';
+               var $proxy_pass='';
+               var $proxy_authtype=1;
+               var $cookies=array();
+               var $extracurlopts=array();
+
+               /**
+               * List of http compression methods accepted by the client for 
responses.
+               * NB: PHP supports deflate, gzip compressions out of the box if 
compiled w. zlib
+               *
+               * NNB: you can set it to any non-empty array for HTTP11 and 
HTTPS, since
+               * in those cases it will be up to CURL to decide the 
compression methods
+               * it supports. You might check for the presence of 'zlib' in 
the output of
+               * curl_version() to determine wheter compression is supported 
or not
+               */
+               var $accepted_compression = array();
+               /**
+               * Name of compression scheme to be used for sending requests.
+               * Either null, gzip or deflate
+               */
+               var $request_compression = '';
+               /**
+               * CURL handle: used for keep-alive connections (PHP 4.3.8 up, 
see:
+               * http://curl.haxx.se/docs/faq.html#7.3)
+               */
+               var $xmlrpc_curl_handle = null;
+               /// Wheter to use persistent connections for http 1.1 and https
+               var $keepalive = false;
+               /// Charset encodings that can be decoded without problems by 
the client
+               var $accepted_charset_encodings = array();
+               /// Charset encoding to be used in serializing request. NULL = 
use ASCII
+               var $request_charset_encoding = '';
+               /**
+               * Decides the content of xmlrpcresp objects returned by calls 
to send()
+               * valid strings are 'xmlrpcvals', 'phpvals' or 'xml'
+               */
+               var $return_type = 'xmlrpcvals';
+               /**
+               * Sent to servers in http headers
+               */
+               var $user_agent;
+
+               /**
+               * @param string $path either the complete server URL or the 
PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
+               * @param string $server the server name / ip address
+               * @param integer $port the port the server is listening on, 
defaults to 80 or 443 depending on protocol used
+               * @param string $method the http protocol variant: defaults to 
'http', 'https' and 'http11' can be used if CURL is installed
+               */
+               function xmlrpc_client($path, $server='', $port='', $method='')
+               {
+                       // allow user to specify all params in $path
+                       if($server == '' and $port == '' and $method == '')
+                       {
+                               $parts = parse_url($path);
+                               $server = $parts['host'];
+                               $path = isset($parts['path']) ? $parts['path'] 
: '';
+                               if(isset($parts['query']))
+                               {
+                                       $path .= '?'.$parts['query'];
+                               }
+                               if(isset($parts['fragment']))
+                               {
+                                       $path .= '#'.$parts['fragment'];
+                               }
+                               if(isset($parts['port']))
+                               {
+                                       $port = $parts['port'];
+                               }
+                               if(isset($parts['scheme']))
+                               {
+                                       $method = $parts['scheme'];
+                               }
+                               if(isset($parts['user']))
+                               {
+                                       $this->username = $parts['user'];
+                               }
+                               if(isset($parts['pass']))
+                               {
+                                       $this->password = $parts['pass'];
+                               }
+                       }
+                       if($path == '' || $path[0] != '/')
+                       {
+                               $this->path='/'.$path;
+                       }
+                       else
+                       {
+                               $this->path=$path;
+                       }
+                       $this->server=$server;
+                       if($port != '')
+                       {
+                               $this->port=$port;
+                       }
+                       if($method != '')
+                       {
+                               $this->method=$method;
+                       }
+
+                       // if ZLIB is enabled, let the client by default accept 
compressed responses
+                       if(function_exists('gzinflate') || (
+                               function_exists('curl_init') && (($info = 
curl_version()) &&
+                               ((is_string($info) && strpos($info, 'zlib') !== 
null) || isset($info['libz_version'])))
+                       ))
+                       {
+                               $this->accepted_compression = array('gzip', 
'deflate');
+                       }
+
+                       // keepalives: enabled by default
+                       $this->keepalive = true;
+
+                       // by default the xml parser can support these 3 
charset encodings
+                       $this->accepted_charset_encodings = array('UTF-8', 
'ISO-8859-1', 'US-ASCII');
+
+                       // initialize user_agent string
+                       $this->user_agent = $GLOBALS['xmlrpcName'] . ' ' . 
$GLOBALS['xmlrpcVersion'];
+               }
+
+               /**
+               * Enables/disables the echoing to screen of the xmlrpc 
responses received
+               * @param integer $debug values 0, 1 and 2 are supported (2 = 
echo sent msg too, before received response)
+               * @access public
+               */
+               function setDebug($in)
+               {
+                       $this->debug=$in;
+               }
+
+               /**
+               * Add some http BASIC AUTH credentials, used by the client to 
authenticate
+               * @param string $u username
+               * @param string $p password
+               * @param integer $t auth type. See curl_setopt man page for 
supported auth types. Defaults to CURLAUTH_BASIC (basic auth)
+               * @access public
+               */
+               function setCredentials($u, $p, $t=1)
+               {
+                       $this->username=$u;
+                       $this->password=$p;
+                       $this->authtype=$t;
+               }
+
+               /**
+               * Add a client-side https certificate
+               * @param string $cert
+               * @param string $certpass
+               * @access public
+               */
+               function setCertificate($cert, $certpass)
+               {
+                       $this->cert = $cert;
+                       $this->certpass = $certpass;
+               }
+
+               /**
+               * Add a CA certificate to verify server with (see man page about
+               * CURLOPT_CAINFO for more details
+               * @param string $cacert certificate file name (or dir holding 
certificates)
+               * @param bool $is_dir set to true to indicate cacert is a dir. 
defaults to false
+               * @access public
+               */
+               function setCaCertificate($cacert, $is_dir=false)
+               {
+                       if ($is_dir)
+                       {
+                               $this->cacertdir = $cacert;
+                       }
+                       else
+                       {
+                               $this->cacert = $cacert;
+                       }
+               }
+
+               /**
+               * Set attributes for SSL communication: private SSL key
+               * NB: does not work in older php/curl installs
+               * Thanks to Daniel Convissor
+               * @param string $key The name of a file containing a private 
SSL key
+               * @param string $keypass The secret password needed to use the 
private SSL key
+               * @access public
+               */
+               function setKey($key, $keypass)
+               {
+                       $this->key = $key;
+                       $this->keypass = $keypass;
+               }
+
+               /**
+               * Set attributes for SSL communication: verify server 
certificate
+               * @param bool $i enable/disable verification of peer certificate
+               * @access public
+               */
+               function setSSLVerifyPeer($i)
+               {
+                       $this->verifypeer = $i;
+               }
+
+               /**
+               * Set attributes for SSL communication: verify match of server 
cert w. hostname
+               * @param int $i
+               * @access public
+               */
+               function setSSLVerifyHost($i)
+               {
+                       $this->verifyhost = $i;
+               }
+
+               /**
+               * Set proxy info
+               * @param string $proxyhost
+               * @param string $proxyport Defaults to 8080 for HTTP and 443 
for HTTPS
+               * @param string $proxyusername Leave blank if proxy has public 
access
+               * @param string $proxypassword Leave blank if proxy has public 
access
+               * @param int $proxyauthtype set to constant CURLAUTH_NTLM to 
use NTLM auth with proxy
+               * @access public
+               */
+               function setProxy($proxyhost, $proxyport, $proxyusername = '', 
$proxypassword = '', $proxyauthtype = 1)
+               {
+                       $this->proxy = $proxyhost;
+                       $this->proxyport = $proxyport;
+                       $this->proxy_user = $proxyusername;
+                       $this->proxy_pass = $proxypassword;
+                       $this->proxy_authtype = $proxyauthtype;
+               }
+
+               /**
+               * Enables/disables reception of compressed xmlrpc responses.
+               * Note that enabling reception of compressed responses merely 
adds some standard
+               * http headers to xmlrpc requests. It is up to the xmlrpc 
server to return
+               * compressed responses when receiving such requests.
+               * @param string $compmethod either 'gzip', 'deflate', 'any' or 
''
+               * @access public
+               */
+               function setAcceptedCompression($compmethod)
+               {
+                       if ($compmethod == 'any')
+                               $this->accepted_compression = array('gzip', 
'deflate');
+                       else
+                               $this->accepted_compression = 
array($compmethod);
+               }
+
+               /**
+               * Enables/disables http compression of xmlrpc request.
+               * Take care when sending compressed requests: servers might not 
support them
+               * (and automatic fallback to uncompressed requests is not yet 
implemented)
+               * @param string $compmethod either 'gzip', 'deflate' or ''
+               * @access public
+               */
+               function setRequestCompression($compmethod)
+               {
+                       $this->request_compression = $compmethod;
+               }
+
+               /**
+               * Adds a cookie to list of cookies that will be sent to server.
+               * NB: setting any param but name and value will turn the cookie 
into a 'version 1' cookie:
+               * do not do it unless you know what you are doing
+               * @param string $name
+               * @param string $value
+               * @param string $path
+               * @param string $domain
+               * @param int $port
+               * @access public
+               *
+               * @todo check correctness of urlencoding cookie value (copied 
from php way of doing it...)
+               */
+               function setCookie($name, $value='', $path='', $domain='', 
$port=null)
+               {
+                       $this->cookies[$name]['value'] = urlencode($value);
+                       if ($path || $domain || $port)
+                       {
+                               $this->cookies[$name]['path'] = $path;
+                               $this->cookies[$name]['domain'] = $domain;
+                               $this->cookies[$name]['port'] = $port;
+                               $this->cookies[$name]['version'] = 1;
+                       }
+                       else
+                       {
+                               $this->cookies[$name]['version'] = 0;
+                       }
+               }
+
+               /**
+               * Directly set cURL options, for extra flexibility
+               * It allows eg. to bind client to a specific IP interface / 
address
+               * @param $options array
+               */
+               function SetCurlOptions( $options )
+               {
+                       $this->extracurlopts = $options;
+               }
+
+               /**
+               * Set user-agent string that will be used by this client 
instance
+               * in http headers sent to the server
+               */
+               function SetUserAgent( $agentstring )
+               {
+                       $this->user_agent = $agentstring;
+               }
+
+               /**
+               * Send an xmlrpc request
+               * @param mixed $msg The message object, or an array of messages 
for using multicall, or the complete xml representation of a request
+               * @param integer $timeout Connection timeout, in seconds, If 
unspecified, a platform specific timeout will apply
+               * @param string $method if left unspecified, the http protocol 
chosen during creation of the object will be used
+               * @return xmlrpcresp
+               * @access public
+               */
+               function& send($msg, $timeout=0, $method='')
+               {
+                       // if user deos not specify http protocol, use native 
method of this client
+                       // (i.e. method set during call to constructor)
+                       if($method == '')
+                       {
+                               $method = $this->method;
+                       }
+
+                       if(is_array($msg))
+                       {
+                               // $msg is an array of xmlrpcmsg's
+                               $r = $this->multicall($msg, $timeout, $method);
+                               return $r;
+                       }
+                       elseif(is_string($msg))
+                       {
+                               $n = new xmlrpcmsg('');
+                               $n->payload = $msg;
+                               $msg = $n;
+                       }
+
+                       // where msg is an xmlrpcmsg
+                       $msg->debug=$this->debug;
+
+                       if($method == 'https')
+                       {
+                               $r =& $this->sendPayloadHTTPS(
+                                       $msg,
+                                       $this->server,
+                                       $this->port,
+                                       $timeout,
+                                       $this->username,
+                                       $this->password,
+                                       $this->authtype,
+                                       $this->cert,
+                                       $this->certpass,
+                                       $this->cacert,
+                                       $this->cacertdir,
+                                       $this->proxy,
+                                       $this->proxyport,
+                                       $this->proxy_user,
+                                       $this->proxy_pass,
+                                       $this->proxy_authtype,
+                                       $this->keepalive,
+                                       $this->key,
+                                       $this->keypass
+                               );
+                       }
+                       elseif($method == 'http11')
+                       {
+                               $r =& $this->sendPayloadCURL(
+                                       $msg,
+                                       $this->server,
+                                       $this->port,
+                                       $timeout,
+                                       $this->username,
+                                       $this->password,
+                                       $this->authtype,
+                                       null,
+                                       null,
+                                       null,
+                                       null,
+                                       $this->proxy,
+                                       $this->proxyport,
+                                       $this->proxy_user,
+                                       $this->proxy_pass,
+                                       $this->proxy_authtype,
+                                       'http',
+                                       $this->keepalive
+                               );
+                       }
+                       else
+                       {
+                               $r =& $this->sendPayloadHTTP10(
+                                       $msg,
+                                       $this->server,
+                                       $this->port,
+                                       $timeout,
+                                       $this->username,
+                                       $this->password,
+                                       $this->authtype,
+                                       $this->proxy,
+                                       $this->proxyport,
+                                       $this->proxy_user,
+                                       $this->proxy_pass,
+                                       $this->proxy_authtype
+                               );
+                       }
+
+                       return $r;
+               }
+
+               /**
+               * @access private
+               */
+               function &sendPayloadHTTP10($msg, $server, $port, $timeout=0,
+                       $username='', $password='', $authtype=1, $proxyhost='',
+                       $proxyport=0, $proxyusername='', $proxypassword='', 
$proxyauthtype=1)
+               {
+                       if($port==0)
+                       {
+                               $port=80;
+                       }
+
+                       // Only create the payload if it was not created 
previously
+                       if(empty($msg->payload))
+                       {
+                               
$msg->createPayload($this->request_charset_encoding);
+                       }
+
+                       $payload = $msg->payload;
+                       // Deflate request body and set appropriate request 
headers
+                       if(function_exists('gzdeflate') && 
($this->request_compression == 'gzip' || $this->request_compression == 
'deflate'))
+                       {
+                               if($this->request_compression == 'gzip')
+                               {
+                                       $a = @gzencode($payload);
+                                       if($a)
+                                       {
+                                               $payload = $a;
+                                               $encoding_hdr = 
"Content-Encoding: gzip\r\n";
+                                       }
+                               }
+                               else
+                               {
+                                       $a = @gzcompress($payload);
+                                       if($a)
+                                       {
+                                               $payload = $a;
+                                               $encoding_hdr = 
"Content-Encoding: deflate\r\n";
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $encoding_hdr = '';
+                       }
+
+                       // thanks to Grant Rauscher <address@hidden> for this
+                       $credentials='';
+                       if($username!='')
+                       {
+                               $credentials='Authorization: Basic ' . 
base64_encode($username . ':' . $password) . "\r\n";
+                               if ($authtype != 1)
+                               {
+                                       error_log('XML-RPC: '.__METHOD__.': 
warning. Only Basic auth is supported with HTTP 1.0');
+                               }
+                       }
+
+                       $accepted_encoding = '';
+                       if(is_array($this->accepted_compression) && 
count($this->accepted_compression))
+                       {
+                               $accepted_encoding = 'Accept-Encoding: ' . 
implode(', ', $this->accepted_compression) . "\r\n";
+                       }
+
+                       $proxy_credentials = '';
+                       if($proxyhost)
+                       {
+                               if($proxyport == 0)
+                               {
+                                       $proxyport = 8080;
+                               }
+                               $connectserver = $proxyhost;
+                               $connectport = $proxyport;
+                               $uri = 'http://'.$server.':'.$port.$this->path;
+                               if($proxyusername != '')
+                               {
+                                       if ($proxyauthtype != 1)
+                                       {
+                                               error_log('XML-RPC: 
'.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
+                                       }
+                                       $proxy_credentials = 
'Proxy-Authorization: Basic ' . 
base64_encode($proxyusername.':'.$proxypassword) . "\r\n";
+                               }
+                       }
+                       else
+                       {
+                               $connectserver = $server;
+                               $connectport = $port;
+                               $uri = $this->path;
+                       }
+
+                       // Cookie generation, as per rfc2965 (version 1 
cookies) or
+                       // netscape's rules (version 0 cookies)
+                       $cookieheader='';
+                       if (count($this->cookies))
+                       {
+                               $version = '';
+                               foreach ($this->cookies as $name => $cookie)
+                               {
+                                       if ($cookie['version'])
+                                       {
+                                               $version = ' $Version="' . 
$cookie['version'] . '";';
+                                               $cookieheader .= ' ' . $name . 
'="' . $cookie['value'] . '";';
+                                               if ($cookie['path'])
+                                                       $cookieheader .= ' 
$Path="' . $cookie['path'] . '";';
+                                               if ($cookie['domain'])
+                                                       $cookieheader .= ' 
$Domain="' . $cookie['domain'] . '";';
+                                               if ($cookie['port'])
+                                                       $cookieheader .= ' 
$Port="' . $cookie['port'] . '";';
+                                       }
+                                       else
+                                       {
+                                               $cookieheader .= ' ' . $name . 
'=' . $cookie['value'] . ";";
+                                       }
+                               }
+                               $cookieheader = 'Cookie:' . $version . 
substr($cookieheader, 0, -1) . "\r\n";
+                       }
+
+                       $op= 'POST ' . $uri. " HTTP/1.0\r\n" .
+                               'User-Agent: ' . $this->user_agent . "\r\n" .
+                               'Host: '. $server . ':' . $port . "\r\n" .
+                               $credentials .
+                               $proxy_credentials .
+                               $accepted_encoding .
+                               $encoding_hdr .
+                               'Accept-Charset: ' . implode(',', 
$this->accepted_charset_encodings) . "\r\n" .
+                               $cookieheader .
+                               'Content-Type: ' . $msg->content_type . 
"\r\nContent-Length: " .
+                               strlen($payload) . "\r\n\r\n" .
+                               $payload;
+
+                       if($this->debug > 1)
+                       {
+                               print "<PRE>\n---SENDING---\n" . 
htmlentities($op) . "\n---END---\n</PRE>";
+                               // let the client see this now in case http 
times out...
+                               flush();
+                       }
+
+                       if($timeout>0)
+                       {
+                               address@hidden($connectserver, $connectport, 
$this->errno, $this->errstr, $timeout);
+                       }
+                       else
+                       {
+                               address@hidden($connectserver, $connectport, 
$this->errno, $this->errstr);
+                       }
+                       if($fp)
+                       {
+                               if($timeout>0 && 
function_exists('stream_set_timeout'))
+                               {
+                                       stream_set_timeout($fp, $timeout);
+                               }
+                       }
+                       else
+                       {
+                               $this->errstr='Connect error: '.$this->errstr;
+                               $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
+                               return $r;
+                       }
+
+                       if(!fputs($fp, $op, strlen($op)))
+                       {
+                               fclose($fp);
+                               $this->errstr='Write error';
+                               $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
+                               return $r;
+                       }
+                       else
+                       {
+                               // reset errno and errstr on succesful socket 
connection
+                               $this->errstr = '';
+                       }
+                       // G. Giunta 2005/10/24: close socket before parsing.
+                       // should yeld slightly better execution times, and 
make easier recursive calls (e.g. to follow http redirects)
+                       $ipd='';
+                       do
+                       {
+                               // shall we check for $data === FALSE?
+                               // as per the manual, it signals an error
+                               $ipd.=fread($fp, 32768);
+                       } while(!feof($fp));
+                       fclose($fp);
+                       $r =& $msg->parseResponse($ipd, false, 
$this->return_type);
+                       return $r;
+
+               }
+
+               /**
+               * @access private
+               */
+               function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, 
$username='',
+                       $password='', $authtype=1, $cert='',$certpass='', 
$cacert='', $cacertdir='',
+                       $proxyhost='', $proxyport=0, $proxyusername='', 
$proxypassword='', $proxyauthtype=1,
+                       $keepalive=false, $key='', $keypass='')
+               {
+                       $r =& $this->sendPayloadCURL($msg, $server, $port, 
$timeout, $username,
+                               $password, $authtype, $cert, $certpass, 
$cacert, $cacertdir, $proxyhost, $proxyport,
+                               $proxyusername, $proxypassword, $proxyauthtype, 
'https', $keepalive, $key, $keypass);
+                       return $r;
+               }
+
+               /**
+               * Contributed by Justin Miller <address@hidden>
+               * Requires curl to be built into PHP
+               * NB: CURL versions before 7.11.10 cannot use proxy to talk to 
https servers!
+               * @access private
+               */
+               function &sendPayloadCURL($msg, $server, $port, $timeout=0, 
$username='',
+                       $password='', $authtype=1, $cert='', $certpass='', 
$cacert='', $cacertdir='',
+                       $proxyhost='', $proxyport=0, $proxyusername='', 
$proxypassword='', $proxyauthtype=1, $method='https',
+                       $keepalive=false, $key='', $keypass='')
+               {
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->errstr='CURL unavailable on this 
install';
+                               $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);
+                               return $r;
+                       }
+                       if($method == 'https')
+                       {
+                               if(($info = curl_version()) &&
+                                       ((is_string($info) && strpos($info, 
'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version']))))
+                               {
+                                       $this->errstr='SSL unavailable on this 
install';
+                                       $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);
+                                       return $r;
+                               }
+                       }
+
+                       if($port == 0)
+                       {
+                               if($method == 'http')
+                               {
+                                       $port = 80;
+                               }
+                               else
+                               {
+                                       $port = 443;
+                               }
+                       }
+
+                       // Only create the payload if it was not created 
previously
+                       if(empty($msg->payload))
+                       {
+                               
$msg->createPayload($this->request_charset_encoding);
+                       }
+
+                       // Deflate request body and set appropriate request 
headers
+                       $payload = $msg->payload;
+                       if(function_exists('gzdeflate') && 
($this->request_compression == 'gzip' || $this->request_compression == 
'deflate'))
+                       {
+                               if($this->request_compression == 'gzip')
+                               {
+                                       $a = @gzencode($payload);
+                                       if($a)
+                                       {
+                                               $payload = $a;
+                                               $encoding_hdr = 
'Content-Encoding: gzip';
+                                       }
+                               }
+                               else
+                               {
+                                       $a = @gzcompress($payload);
+                                       if($a)
+                                       {
+                                               $payload = $a;
+                                               $encoding_hdr = 
'Content-Encoding: deflate';
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $encoding_hdr = '';
+                       }
+
+                       if($this->debug > 1)
+                       {
+                               print "<PRE>\n---SENDING---\n" . 
htmlentities($payload) . "\n---END---\n</PRE>";
+                               // let the client see this now in case http 
times out...
+                               flush();
+                       }
+
+                       if(!$keepalive || !$this->xmlrpc_curl_handle)
+                       {
+                               $curl = curl_init($method . '://' . $server . 
':' . $port . $this->path);
+                               if($keepalive)
+                               {
+                                       $this->xmlrpc_curl_handle = $curl;
+                               }
+                       }
+                       else
+                       {
+                               $curl = $this->xmlrpc_curl_handle;
+                       }
+
+                       // results into variable
+                       curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+
+                       if($this->debug)
+                       {
+                               curl_setopt($curl, CURLOPT_VERBOSE, 1);
+                       }
+                       curl_setopt($curl, CURLOPT_USERAGENT, 
$this->user_agent);
+                       // required for XMLRPC: post the data
+                       curl_setopt($curl, CURLOPT_POST, 1);
+                       // the data
+                       curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
+
+                       // return the header too
+                       curl_setopt($curl, CURLOPT_HEADER, 1);
+
+                       // will only work with PHP >= 5.0
+                       // NB: if we set an empty string, CURL will add http 
header indicating
+                       // ALL methods it is supporting. This is possibly a 
better option than
+                       // letting the user tell what curl can / cannot do...
+                       if(is_array($this->accepted_compression) && 
count($this->accepted_compression))
+                       {
+                               //curl_setopt($curl, CURLOPT_ENCODING, 
implode(',', $this->accepted_compression));
+                               // empty string means 'any supported by CURL' 
(shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+                               if (count($this->accepted_compression) == 1)
+                               {
+                                       curl_setopt($curl, CURLOPT_ENCODING, 
$this->accepted_compression[0]);
+                               }
+                               else
+                                       curl_setopt($curl, CURLOPT_ENCODING, 
'');
+                       }
+                       // extra headers
+                       $headers = array('Content-Type: ' . $msg->content_type 
, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
+                       // if no keepalive is wanted, let the server know it in 
advance
+                       if(!$keepalive)
+                       {
+                               $headers[] = 'Connection: close';
+                       }
+                       // request compression header
+                       if($encoding_hdr)
+                       {
+                               $headers[] = $encoding_hdr;
+                       }
+
+                       curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
+                       // timeout is borked
+                       if($timeout)
+                       {
+                               curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 
1 ? 1 : $timeout - 1);
+                       }
+
+                       if($username && $password)
+                       {
+                               curl_setopt($curl, CURLOPT_USERPWD, 
$username.':'.$password);
+                               if (defined('CURLOPT_HTTPAUTH'))
+                               {
+                                       curl_setopt($curl, CURLOPT_HTTPAUTH, 
$authtype);
+                               }
+                               else if ($authtype != 1)
+                               {
+                                       error_log('XML-RPC: '.__METHOD__.': 
warning. Only Basic auth is supported by the current PHP/curl install');
+                               }
+                       }
+
+                       if($method == 'https')
+                       {
+                               // set cert file
+                               if($cert)
+                               {
+                                       curl_setopt($curl, CURLOPT_SSLCERT, 
$cert);
+                               }
+                               // set cert password
+                               if($certpass)
+                               {
+                                       curl_setopt($curl, 
CURLOPT_SSLCERTPASSWD, $certpass);
+                               }
+                               // whether to verify remote host's cert
+                               curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 
$this->verifypeer);
+                               // set ca certificates file/dir
+                               if($cacert)
+                               {
+                                       curl_setopt($curl, CURLOPT_CAINFO, 
$cacert);
+                               }
+                               if($cacertdir)
+                               {
+                                       curl_setopt($curl, CURLOPT_CAPATH, 
$cacertdir);
+                               }
+                               // set key file (shall we catch errors in case 
CURLOPT_SSLKEY undefined ?)
+                               if($key)
+                               {
+                                       curl_setopt($curl, CURLOPT_SSLKEY, 
$key);
+                               }
+                               // set key password (shall we catch errors in 
case CURLOPT_SSLKEY undefined ?)
+                               if($keypass)
+                               {
+                                       curl_setopt($curl, 
CURLOPT_SSLKEYPASSWD, $keypass);
+                               }
+                               // whether to verify cert's common name (CN); 0 
for no, 1 to verify that it exists, and 2 to verify that it matches the 
hostname used
+                               curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 
$this->verifyhost);
+                       }
+
+                       // proxy info
+                       if($proxyhost)
+                       {
+                               if($proxyport == 0)
+                               {
+                                       $proxyport = 8080; // NB: even for 
HTTPS, local connection is on port 8080
+                               }
+                               curl_setopt($curl, CURLOPT_PROXY, 
$proxyhost.':'.$proxyport);
+                               //curl_setopt($curl, 
CURLOPT_PROXYPORT,$proxyport);
+                               if($proxyusername)
+                               {
+                                       curl_setopt($curl, 
CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword);
+                                       if (defined('CURLOPT_PROXYAUTH'))
+                                       {
+                                               curl_setopt($curl, 
CURLOPT_PROXYAUTH, $proxyauthtype);
+                                       }
+                                       else if ($proxyauthtype != 1)
+                                       {
+                                               error_log('XML-RPC: 
'.__METHOD__.': warning. Only Basic auth to proxy is supported by the current 
PHP/curl install');
+                                       }
+                               }
+                       }
+
+                       // NB: should we build cookie http headers by hand 
rather than let CURL do it?
+                       // the following code does not honour 'expires', 'path' 
and 'domain' cookie attributes
+                       // set to client obj the the user...
+                       if (count($this->cookies))
+                       {
+                               $cookieheader = '';
+                               foreach ($this->cookies as $name => $cookie)
+                               {
+                                       $cookieheader .= $name . '=' . 
$cookie['value'] . '; ';
+                               }
+                               curl_setopt($curl, CURLOPT_COOKIE, 
substr($cookieheader, 0, -2));
+                       }
+
+                       foreach ($this->extracurlopts as $opt => $val)
+                       {
+                               curl_setopt($curl, $opt, $val);
+                       }
+
+                       $result = curl_exec($curl);
+
+                       if ($this->debug > 1)
+                       {
+                               print "<PRE>\n---CURL INFO---\n";
+                               foreach(curl_getinfo($curl) as $name => $val)
+                                        print $name . ': ' . 
htmlentities($val). "\n";
+                               print "---END---\n</PRE>";
+                       }
+
+                       if(!$result) /// @todo we should use a better check 
here - what if we get back '' or '0'?
+                       {
+                               $this->errstr='no response';
+                               $resp=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. 
curl_error($curl));
+                               curl_close($curl);
+                               if($keepalive)
+                               {
+                                       $this->xmlrpc_curl_handle = null;
+                               }
+                       }
+                       else
+                       {
+                               if(!$keepalive)
+                               {
+                                       curl_close($curl);
+                               }
+                               $resp =& $msg->parseResponse($result, true, 
$this->return_type);
+                       }
+                       return $resp;
+               }
+
+               /**
+               * Send an array of request messages and return an array of 
responses.
+               * Unless $this->no_multicall has been set to true, it will try 
first
+               * to use one single xmlrpc call to server method 
system.multicall, and
+               * revert to sending many successive calls in case of failure.
+               * This failure is also stored in $this->no_multicall for 
subsequent calls.
+               * Unfortunately, there is no server error code universally used 
to denote
+               * the fact that multicall is unsupported, so there is no way to 
reliably
+               * distinguish between that and a temporary failure.
+               * If you are sure that server supports multicall and do not 
want to
+               * fallback to using many single calls, set the fourth parameter 
to FALSE.
+               *
+               * NB: trying to shoehorn extra functionality into existing 
syntax has resulted
+               * in pretty much convoluted code...
+               *
+               * @param array $msgs an array of xmlrpcmsg objects
+               * @param integer $timeout connection timeout (in seconds)
+               * @param string $method the http protocol variant to be used
+               * @param boolean fallback When true, upon receiveing an error 
during multicall, multiple single calls will be attempted
+               * @return array
+               * @access public
+               */
+               function multicall($msgs, $timeout=0, $method='', 
$fallback=true)
+               {
+                       if ($method == '')
+                       {
+                               $method = $this->method;
+                       }
+                       if(!$this->no_multicall)
+                       {
+                               $results = $this->_try_multicall($msgs, 
$timeout, $method);
+                               if(is_array($results))
+                               {
+                                       // System.multicall succeeded
+                                       return $results;
+                               }
+                               else
+                               {
+                                       // either system.multicall is 
unsupported by server,
+                                       // or call failed for some other reason.
+                                       if ($fallback)
+                                       {
+                                               // Don't try it next time...
+                                               $this->no_multicall = true;
+                                       }
+                                       else
+                                       {
+                                               if (is_a($results, 
'xmlrpcresp'))
+                                               {
+                                                       $result = $results;
+                                               }
+                                               else
+                                               {
+                                                       $result = new 
xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], 
$GLOBALS['xmlrpcstr']['multicall_error']);
+                                               }
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               // override fallback, in case careless user 
tries to do two
+                               // opposite things at the same time
+                               $fallback = true;
+                       }
+
+                       $results = array();
+                       if ($fallback)
+                       {
+                               // system.multicall is (probably) unsupported 
by server:
+                               // emulate multicall via multiple requests
+                               foreach($msgs as $msg)
+                               {
+                                       $results[] =& $this->send($msg, 
$timeout, $method);
+                               }
+                       }
+                       else
+                       {
+                               // user does NOT want to fallback on many 
single calls:
+                               // since we should always return an array of 
responses,
+                               // return an array with the same error repeated 
n times
+                               foreach($msgs as $msg)
+                               {
+                                       $results[] = $result;
+                               }
+                       }
+                       return $results;
+               }
+
+               /**
+               * Attempt to boxcar $msgs via system.multicall.
+               * Returns either an array of xmlrpcreponses, an xmlrpc error 
response
+               * or false (when received response does not respect valid 
multicall syntax)
+               * @access private
+               */
+               function _try_multicall($msgs, $timeout, $method)
+               {
+                       // Construct multicall message
+                       $calls = array();
+                       foreach($msgs as $msg)
+                       {
+                               $call['methodName'] = new 
xmlrpcval($msg->method(),'string');
+                               $numParams = $msg->getNumParams();
+                               $params = array();
+                               for($i = 0; $i < $numParams; $i++)
+                               {
+                                       $params[$i] = $msg->getParam($i);
+                               }
+                               $call['params'] = new xmlrpcval($params, 
'array');
+                               $calls[] = new xmlrpcval($call, 'struct');
+                       }
+                       $multicall = new xmlrpcmsg('system.multicall');
+                       $multicall->addParam(new xmlrpcval($calls, 'array'));
+
+                       // Attempt RPC call
+                       $result =& $this->send($multicall, $timeout, $method);
+
+                       if($result->faultCode() != 0)
+                       {
+                               // call to system.multicall failed
+                               return $result;
+                       }
+
+                       // Unpack responses.
+                       $rets = $result->value();
+
+                       if ($this->return_type == 'xml')
+                       {
+                                       return $rets;
+                       }
+                       else if ($this->return_type == 'phpvals')
+                       {
+                               ///@todo test this code branch...
+                               $rets = $result->value();
+                               if(!is_array($rets))
+                               {
+                                       return false;           // bad return 
type from system.multicall
+                               }
+                               $numRets = count($rets);
+                               if($numRets != count($msgs))
+                               {
+                                       return false;           // wrong number 
of return values.
+                               }
+
+                               $response = array();
+                               for($i = 0; $i < $numRets; $i++)
+                               {
+                                       $val = $rets[$i];
+                                       if (!is_array($val)) {
+                                               return false;
+                                       }
+                                       switch(count($val))
+                                       {
+                                               case 1:
+                                                       if(!isset($val[0]))
+                                                       {
+                                                               return false;   
        // Bad value
+                                                       }
+                                                       // Normal return value
+                                                       $response[$i] = new 
xmlrpcresp($val[0], 0, '', 'phpvals');
+                                                       break;
+                                               case 2:
+                                                       ///     @todo remove 
usage of @: it is apparently quite slow
+                                                       $code = 
@$val['faultCode'];
+                                                       if(!is_int($code))
+                                                       {
+                                                               return false;
+                                                       }
+                                                       $str = 
@$val['faultString'];
+                                                       if(!is_string($str))
+                                                       {
+                                                               return false;
+                                                       }
+                                                       $response[$i] = new 
xmlrpcresp(0, $code, $str);
+                                                       break;
+                                               default:
+                                                       return false;
+                                       }
+                               }
+                               return $response;
+                       }
+                       else // return type == 'xmlrpcvals'
+                       {
+                               $rets = $result->value();
+                               if($rets->kindOf() != 'array')
+                               {
+                                       return false;           // bad return 
type from system.multicall
+                               }
+                               $numRets = $rets->arraysize();
+                               if($numRets != count($msgs))
+                               {
+                                       return false;           // wrong number 
of return values.
+                               }
+
+                               $response = array();
+                               for($i = 0; $i < $numRets; $i++)
+                               {
+                                       $val = $rets->arraymem($i);
+                                       switch($val->kindOf())
+                                       {
+                                               case 'array':
+                                                       if($val->arraysize() != 
1)
+                                                       {
+                                                               return false;   
        // Bad value
+                                                       }
+                                                       // Normal return value
+                                                       $response[$i] = new 
xmlrpcresp($val->arraymem(0));
+                                                       break;
+                                               case 'struct':
+                                                       $code = 
$val->structmem('faultCode');
+                                                       if($code->kindOf() != 
'scalar' || $code->scalartyp() != 'int')
+                                                       {
+                                                               return false;
+                                                       }
+                                                       $str = 
$val->structmem('faultString');
+                                                       if($str->kindOf() != 
'scalar' || $str->scalartyp() != 'string')
+                                                       {
+                                                               return false;
+                                                       }
+                                                       $response[$i] = new 
xmlrpcresp(0, $code->scalarval(), $str->scalarval());
+                                                       break;
+                                               default:
+                                                       return false;
+                                       }
+                               }
+                               return $response;
+                       }
+               }
+       } // end class xmlrpc_client
+
+       class xmlrpcresp
+       {
+               var $val = 0;
+               var $valtyp;
+               var $errno = 0;
+               var $errstr = '';
+               var $payload;
+               var $hdrs = array();
+               var $_cookies = array();
+               var $content_type = 'text/xml';
+               var $raw_data = '';
+
+               /**
+               * @param mixed $val either an xmlrpcval obj, a php value or the 
xml serialization of an xmlrpcval (a string)
+               * @param integer $fcode set it to anything but 0 to create an 
error response
+               * @param string $fstr the error string, in case of an error 
response
+               * @param string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml'
+               *
+               * @todo add check that $val / $fcode / $fstr is of correct 
type???
+               * NB: as of now we do not do it, since it might be either an 
xmlrpcval or a plain
+               * php val, or a complete xml chunk, depending on usage of 
xmlrpc_client::send() inside which creator is called...
+               */
+               function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')
+               {
+                       if($fcode != 0)
+                       {
+                               // error response
+                               $this->errno = $fcode;
+                               $this->errstr = $fstr;
+                               //$this->errstr = htmlspecialchars($fstr); // 
XXX: encoding probably shouldn't be done here; fix later.
+                       }
+                       else
+                       {
+                               // successful response
+                               $this->val = $val;
+                               if ($valtyp == '')
+                               {
+                                       // user did not declare type of 
response value: try to guess it
+                                       if (is_object($this->val) && 
is_a($this->val, 'xmlrpcval'))
+                                       {
+                                               $this->valtyp = 'xmlrpcvals';
+                                       }
+                                       else if (is_string($this->val))
+                                       {
+                                               $this->valtyp = 'xml';
+
+                                       }
+                                       else
+                                       {
+                                               $this->valtyp = 'phpvals';
+                                       }
+                               }
+                               else
+                               {
+                                       // user declares type of resp value: 
believe him
+                                       $this->valtyp = $valtyp;
+                               }
+                       }
+               }
+
+               /**
+               * Returns the error code of the response.
+               * @return integer the error code of this response (0 for 
not-error responses)
+               * @access public
+               */
+               function faultCode()
+               {
+                       return $this->errno;
+               }
+
+               /**
+               * Returns the error code of the response.
+               * @return string the error string of this response ('' for 
not-error responses)
+               * @access public
+               */
+               function faultString()
+               {
+                       return $this->errstr;
+               }
+
+               /**
+               * Returns the value received by the server.
+               * @return mixed the xmlrpcval object returned by the server. 
Might be an xml string or php value if the response has been created by 
specially configured xmlrpc_client objects
+               * @access public
+               */
+               function value()
+               {
+                       return $this->val;
+               }
+
+               /**
+               * Returns an array with the cookies received from the server.
+               * Array has the form: $cookiename => array ('value' => $val, 
$attr1 => $val1, $attr2 = $val2, ...)
+               * with attributes being e.g. 'expires', 'path', domain'.
+               * NB: cookies sent as 'expired' by the server (i.e. with an 
expiry date in the past)
+               * are still present in the array. It is up to the user-defined 
code to decide
+               * how to use the received cookies, and wheter they have to be 
sent back with the next
+               * request to the server (using xmlrpc_client::setCookie) or not
+               * @return array array of cookies received from the server
+               * @access public
+               */
+               function cookies()
+               {
+                       return $this->_cookies;
+               }
+
+               /**
+               * Returns xml representation of the response. XML prologue not 
included
+               * @param string $charset_encoding the charset to be used for 
serialization. if null, US-ASCII is assumed
+               * @return string the xml representation of the response
+               * @access public
+               */
+               function serialize($charset_encoding='')
+               {
+                       if ($charset_encoding != '')
+                               $this->content_type = 'text/xml; charset=' . 
$charset_encoding;
+                       else
+                               $this->content_type = 'text/xml';
+                       $result = "<methodResponse>\n";
+                       if($this->errno)
+                       {
+                               // G. Giunta 2005/2/13: let non-ASCII response 
messages be tolerated by clients
+                               // by xml-encoding non ascii chars
+                               $result .= "<fault>\n" .
+"<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno 
.
+"</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>"
 .
+xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], 
$charset_encoding) . "</string></value>\n</member>\n" .
+"</struct>\n</value>\n</fault>";
+                       }
+                       else
+                       {
+                               if(!is_object($this->val) || !is_a($this->val, 
'xmlrpcval'))
+                               {
+                                       if (is_string($this->val) && 
$this->valtyp == 'xml')
+                                       {
+                                               $result .= 
"<params>\n<param>\n" .
+                                                       $this->val .
+                                                       "</param>\n</params>";
+                                       }
+                                       else
+                                       {
+                                               /// @todo try to build 
something serializable?
+                                               die('cannot serialize 
xmlrpcresp objects whose content is native php values');
+                                       }
+                               }
+                               else
+                               {
+                                       $result .= "<params>\n<param>\n" .
+                                               
$this->val->serialize($charset_encoding) .
+                                               "</param>\n</params>";
+                               }
+                       }
+                       $result .= "\n</methodResponse>";
+                       $this->payload = $result;
+                       return $result;
+               }
+       }
+
+       class xmlrpcmsg
+       {
+               var $payload;
+               var $methodname;
+               var $params=array();
+               var $debug=0;
+               var $content_type = 'text/xml';
+
+               /**
+               * @param string $meth the name of the method to invoke
+               * @param array $pars array of parameters to be paased to the 
method (xmlrpcval objects)
+               */
+               function xmlrpcmsg($meth, $pars=0)
+               {
+                       $this->methodname=$meth;
+                       if(is_array($pars) && count($pars)>0)
+                       {
+                               for($i=0; $i<count($pars); $i++)
+                               {
+                                       $this->addParam($pars[$i]);
+                               }
+                       }
+               }
+
+               /**
+               * @access private
+               */
+               function xml_header($charset_encoding='')
+               {
+                       if ($charset_encoding != '')
+                       {
+                               return "<?xml version=\"1.0\" 
encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n";
+                       }
+                       else
+                       {
+                               return "<?xml version=\"1.0\"?" . 
">\n<methodCall>\n";
+                       }
+               }
+
+               /**
+               * @access private
+               */
+               function xml_footer()
+               {
+                       return '</methodCall>';
+               }
+
+               /**
+               * @access private
+               */
+               function kindOf()
+               {
+                       return 'msg';
+               }
+
+               /**
+               * @access private
+               */
+               function createPayload($charset_encoding='')
+               {
+                       if ($charset_encoding != '')
+                               $this->content_type = 'text/xml; charset=' . 
$charset_encoding;
+                       else
+                               $this->content_type = 'text/xml';
+                       $this->payload=$this->xml_header($charset_encoding);
+                       $this->payload.='<methodName>' . $this->methodname . 
"</methodName>\n";
+                       $this->payload.="<params>\n";
+                       for($i=0; $i<count($this->params); $i++)
+                       {
+                               $p=$this->params[$i];
+                               $this->payload.="<param>\n" . 
$p->serialize($charset_encoding) .
+                               "</param>\n";
+                       }
+                       $this->payload.="</params>\n";
+                       $this->payload.=$this->xml_footer();
+               }
+
+               /**
+               * Gets/sets the xmlrpc method to be invoked
+               * @param string $meth the method to be set (leave empty not to 
set it)
+               * @return string the method that will be invoked
+               * @access public
+               */
+               function method($meth='')
+               {
+                       if($meth!='')
+                       {
+                               $this->methodname=$meth;
+                       }
+                       return $this->methodname;
+               }
+
+               /**
+               * Returns xml representation of the message. XML prologue 
included
+               * @return string the xml representation of the message, xml 
prologue included
+               * @access public
+               */
+               function serialize($charset_encoding='')
+               {
+                       $this->createPayload($charset_encoding);
+                       return $this->payload;
+               }
+
+               /**
+               * Add a parameter to the list of parameters to be used upon 
method invocation
+               * @param xmlrpcval $par
+               * @return boolean false on failure
+               * @access public
+               */
+               function addParam($par)
+               {
+                       // add check: do not add to self params which are not 
xmlrpcvals
+                       if(is_object($par) && is_a($par, 'xmlrpcval'))
+                       {
+                               $this->params[]=$par;
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+
+               /**
+               * Returns the nth parameter in the message. The index 
zero-based.
+               * @param integer $i the index of the parameter to fetch (zero 
based)
+               * @return xmlrpcval the i-th parameter
+               * @access public
+               */
+               function getParam($i) { return $this->params[$i]; }
+
+               /**
+               * Returns the number of parameters in the messge.
+               * @return integer the number of parameters currently set
+               * @access public
+               */
+               function getNumParams() { return count($this->params); }
+
+               /**
+               * Given an open file handle, read all data available and parse 
it as axmlrpc response.
+               * NB: the file handle is not closed by this function.
+               * NNB: might have trouble in rare cases to work on network 
streams, as we
+               *      check for a read of 0 bytes instead of feof($fp).
+               *      But since checking for feof(null) returns false, we 
would risk an
+               *      infinite loop in that case, because we cannot trust the 
caller
+               *      to give us a valid pointer to an open file...
+               * @access public
+               * @return xmlrpcresp
+               * @todo add 2nd & 3rd param to be passed to ParseResponse() ???
+               */
+               function &parseResponseFile($fp)
+               {
+                       $ipd='';
+                       while($data=fread($fp, 32768))
+                       {
+                               $ipd.=$data;
+                       }
+                       //fclose($fp);
+                       $r =& $this->parseResponse($ipd);
+                       return $r;
+               }
+
+               /**
+               * Parses HTTP headers and separates them from data.
+               * @access private
+               */
+               function &parseResponseHeaders(&$data, $headers_processed=false)
+               {
+                               // Support "web-proxy-tunelling" connections 
for https through proxies
+                               if(preg_match('/^HTTP\/1\.[0-1] 200 Connection 
established/', $data))
+                               {
+                                       // Look for CR/LF or simple LF as line 
separator,
+                                       // (even though it is not valid http)
+                                       $pos = strpos($data,"\r\n\r\n");
+                                       if($pos || is_int($pos))
+                                       {
+                                               $bd = $pos+4;
+                                       }
+                                       else
+                                       {
+                                               $pos = strpos($data,"\n\n");
+                                               if($pos || is_int($pos))
+                                               {
+                                                       $bd = $pos+2;
+                                               }
+                                               else
+                                               {
+                                                       // No separation 
between response headers and body: fault?
+                                                       $bd = 0;
+                                               }
+                                       }
+                                       if ($bd)
+                                       {
+                                               // this filters out all http 
headers from proxy.
+                                               // maybe we could take them 
into account, too?
+                                               $data = substr($data, $bd);
+                                       }
+                                       else
+                                       {
+                                               error_log('XML-RPC: 
'.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
+                                               $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' 
(HTTPS via proxy error, tunnel connection possibly failed)');
+                                               return $r;
+                                       }
+                               }
+
+                               // Strip HTTP 1.1 100 Continue header if present
+                               while(preg_match('/^HTTP\/1\.1 1[0-9]{2} /', 
$data))
+                               {
+                                       $pos = strpos($data, 'HTTP', 12);
+                                       // server sent a Continue header 
without any (valid) content following...
+                                       // give the client a chance to know it
+                                       if(!$pos && !is_int($pos)) // works 
fine in php 3, 4 and 5
+                                       {
+                                               break;
+                                       }
+                                       $data = substr($data, $pos);
+                               }
+                               if(!preg_match('/^HTTP\/[0-9.]+ 200 /', $data))
+                               {
+                                       $errstr= substr($data, 0, strpos($data, 
"\n")-1);
+                                       error_log('XML-RPC: '.__METHOD__.': 
HTTP error, got response: ' .$errstr);
+                                       $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' 
. $errstr . ')');
+                                       return $r;
+                               }
+
+                               $GLOBALS['_xh']['headers'] = array();
+                               $GLOBALS['_xh']['cookies'] = array();
+
+                               // be tolerant to usage of \n instead of \r\n 
to separate headers and data
+                               // (even though it is not valid http)
+                               $pos = strpos($data,"\r\n\r\n");
+                               if($pos || is_int($pos))
+                               {
+                                       $bd = $pos+4;
+                               }
+                               else
+                               {
+                                       $pos = strpos($data,"\n\n");
+                                       if($pos || is_int($pos))
+                                       {
+                                               $bd = $pos+2;
+                                       }
+                                       else
+                                       {
+                                               // No separation between 
response headers and body: fault?
+                                               // we could take some action 
here instead of going on...
+                                               $bd = 0;
+                                       }
+                               }
+                               // be tolerant to line endings, and extra empty 
lines
+                               $ar = preg_split("/\r?\n/", trim(substr($data, 
0, $pos)));
+                               while(list(,$line) = @each($ar))
+                               {
+                                       // take care of multi-line headers and 
cookies
+                                       $arr = explode(':',$line,2);
+                                       if(count($arr) > 1)
+                                       {
+                                               $header_name = 
strtolower(trim($arr[0]));
+                                               /// @todo some other headers 
(the ones that allow a CSV list of values)
+                                               /// do allow many values to be 
passed using multiple header lines.
+                                               /// We should add content to 
$GLOBALS['_xh']['headers'][$header_name]
+                                               /// instead of replacing it for 
those...
+                                               if ($header_name == 
'set-cookie' || $header_name == 'set-cookie2')
+                                               {
+                                                       if ($header_name == 
'set-cookie2')
+                                                       {
+                                                               // version 2 
cookies:
+                                                               // there could 
be many cookies on one line, comma separated
+                                                               $cookies = 
explode(',', $arr[1]);
+                                                       }
+                                                       else
+                                                       {
+                                                               $cookies = 
array($arr[1]);
+                                                       }
+                                                       foreach ($cookies as 
$cookie)
+                                                       {
+                                                               // glue 
together all received cookies, using a comma to separate them
+                                                               // (same as php 
does with getallheaders())
+                                                               if 
(isset($GLOBALS['_xh']['headers'][$header_name]))
+                                                                       
$GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);
+                                                               else
+                                                                       
$GLOBALS['_xh']['headers'][$header_name] = trim($cookie);
+                                                               // parse cookie 
attributes, in case user wants to correctly honour them
+                                                               // feature 
creep: only allow rfc-compliant cookie attributes?
+                                                               // @todo 
support for server sending multiple time cookie with same name, but using 
different PATHs
+                                                               $cookie = 
explode(';', $cookie);
+                                                               foreach 
($cookie as $pos => $val)
+                                                               {
+                                                                       $val = 
explode('=', $val, 2);
+                                                                       $tag = 
trim($val[0]);
+                                                                       $val = 
trim(@$val[1]);
+                                                                       /// 
@todo with version 1 cookies, we should strip leading and trailing " chars
+                                                                       if 
($pos == 0)
+                                                                       {
+                                                                               
$cookiename = $tag;
+                                                                               
$GLOBALS['_xh']['cookies'][$tag] = array();
+                                                                               
$GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               
if ($tag != 'value')
+                                                                               
{
+                                                                               
  $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;
+                                                                               
}
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       
$GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
+                                               }
+                                       }
+                                       elseif(isset($header_name))
+                                       {
+                                               ///     @todo version1 cookies 
might span multiple lines, thus breaking the parsing above
+                                               
$GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
+                                       }
+                               }
+
+                               $data = substr($data, $bd);
+
+                               if($this->debug && 
count($GLOBALS['_xh']['headers']))
+                               {
+                                       print '<PRE>';
+                                       foreach($GLOBALS['_xh']['headers'] as 
$header => $value)
+                                       {
+                                               print htmlentities("HEADER: 
$header: $value\n");
+                                       }
+                                       foreach($GLOBALS['_xh']['cookies'] as 
$header => $value)
+                                       {
+                                               print htmlentities("COOKIE: 
$header={$value['value']}\n");
+                                       }
+                                       print "</PRE>\n";
+                               }
+
+                               // if CURL was used for the call, http headers 
have been processed,
+                               // and dechunking + reinflating have been 
carried out
+                               if(!$headers_processed)
+                               {
+                                       // Decode chunked encoding sent by http 
1.1 servers
+                                       
if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && 
$GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked')
+                                       {
+                                               if(!$data = 
decode_chunked($data))
+                                               {
+                                                       error_log('XML-RPC: 
'.__METHOD__.': errors occurred when trying to rebuild the chunked data 
received from server');
+                                                       $r = new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);
+                                                       return $r;
+                                               }
+                                       }
+
+                                       // Decode gzip-compressed stuff
+                                       // code shamelessly inspired from 
nusoap library by Dietrich Ayala
+                                       
if(isset($GLOBALS['_xh']['headers']['content-encoding']))
+                                       {
+                                               
$GLOBALS['_xh']['headers']['content-encoding'] = str_replace('x-', '', 
$GLOBALS['_xh']['headers']['content-encoding']);
+                                               
if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || 
$GLOBALS['_xh']['headers']['content-encoding'] == 'gzip')
+                                               {
+                                                       // if decoding works, 
use it. else assume data wasn't gzencoded
+                                                       
if(function_exists('gzinflate'))
+                                                       {
+                                                               
if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = 
@gzuncompress($data))
+                                                               {
+                                                                       $data = 
$degzdata;
+                                                                       
if($this->debug)
+                                                                       print 
"<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . 
htmlentities($data) . "\n---END---</PRE>";
+                                                               }
+                                                               
elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = 
@gzinflate(substr($data, 10)))
+                                                               {
+                                                                       $data = 
$degzdata;
+                                                                       
if($this->debug)
+                                                                       print 
"<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . 
htmlentities($data) . "\n---END---</PRE>";
+                                                               }
+                                                               else
+                                                               {
+                                                                       
error_log('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the 
deflated data received from server');
+                                                                       $r = 
new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], 
$GLOBALS['xmlrpcstr']['decompress_fail']);
+                                                                       return 
$r;
+                                                               }
+                                                       }
+                                                       else
+                                                       {
+                                                               
error_log('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php 
install must have the Zlib extension compiled in to support this.');
+                                                               $r = new 
xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], 
$GLOBALS['xmlrpcstr']['cannot_decompress']);
+                                                               return $r;
+                                                       }
+                                               }
+                                       }
+                               } // end of 'if needed, de-chunk, re-inflate 
response'
+
+                               // real stupid hack to avoid PHP complaining 
about returning NULL by ref
+                               $r = null;
+                               $r =& $r;
+                               return $r;
+               }
+
+               /**
+               * Parse the xmlrpc response contained in the string $data and 
return an xmlrpcresp object.
+               * @param string $data the xmlrpc response, eventually including 
http headers
+               * @param bool $headers_processed when true prevents parsing 
HTTP headers for interpretation of content-encoding and consequent decoding
+               * @param string $return_type decides return type, i.e. content 
of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'
+               * @return xmlrpcresp
+               * @access public
+               */
+               function &parseResponse($data='', $headers_processed=false, 
$return_type='xmlrpcvals')
+               {
+                       if($this->debug)
+                       {
+                               //by maHo, replaced htmlspecialchars with 
htmlentities
+                               print "<PRE>---GOT---\n" . htmlentities($data) 
. "\n---END---\n</PRE>";
+                       }
+
+                       if($data == '')
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': no response 
received from server.');
+                               $r = new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
+                               return $r;
+                       }
+
+                       $GLOBALS['_xh']=array();
+
+                       $raw_data = $data;
+                       // parse the HTTP headers of the response, if present, 
and separate them from data
+                       if(substr($data, 0, 4) == 'HTTP')
+                       {
+                               $r =& $this->parseResponseHeaders($data, 
$headers_processed);
+                               if ($r)
+                               {
+                                       // failed processing of HTTP response 
headers
+                                       // save into response obj the full 
payload received, for debugging
+                                       $r->raw_data = $data;
+                                       return $r;
+                               }
+                       }
+                       else
+                       {
+                               $GLOBALS['_xh']['headers'] = array();
+                               $GLOBALS['_xh']['cookies'] = array();
+                       }
+
+                       if($this->debug)
+                       {
+                               $start = strpos($data, '<!-- SERVER DEBUG INFO 
(BASE64 ENCODED):');
+                               if ($start)
+                               {
+                                       $start += strlen('<!-- SERVER DEBUG 
INFO (BASE64 ENCODED):');
+                                       $end = strpos($data, '-->', $start);
+                                       $comments = substr($data, $start, 
$end-$start);
+                                       print "<PRE>---SERVER DEBUG INFO 
(DECODED) ---\n\t".htmlentities(str_replace("\n", "\n\t", 
base64_decode($comments)))."\n---END---\n</PRE>";
+                               }
+                       }
+
+                       // be tolerant of extra whitespace in response body
+                       $data = trim($data);
+
+                       /// @todo return an error msg if $data=='' ?
+
+                       // be tolerant of junk after methodResponse (e.g. 
javascript ads automatically inserted by free hosts)
+                       // idea from Luca Mariano <address@hidden> originally 
in PEARified version of the lib
+                       $pos = strrpos($data, '</methodResponse>');
+                       if($pos !== false)
+                       {
+                               $data = substr($data, 0, $pos+17);
+                       }
+
+                       // if user wants back raw xml, give it to him
+                       if ($return_type == 'xml')
+                       {
+                               $r = new xmlrpcresp($data, 0, '', 'xml');
+                               $r->hdrs = $GLOBALS['_xh']['headers'];
+                               $r->_cookies = $GLOBALS['_xh']['cookies'];
+                               $r->raw_data = $raw_data;
+                               return $r;
+                       }
+
+                       // try to 'guestimate' the character encoding of the 
received response
+                       $resp_encoding = 
guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);
+
+                       $GLOBALS['_xh']['ac']='';
+                       //$GLOBALS['_xh']['qt']=''; //unused...
+                       $GLOBALS['_xh']['stack'] = array();
+                       $GLOBALS['_xh']['valuestack'] = array();
+                       $GLOBALS['_xh']['isf']=0; // 0 = OK, 1 for xmlrpc fault 
responses, 2 = invalid xmlrpc
+                       $GLOBALS['_xh']['isf_reason']='';
+                       $GLOBALS['_xh']['rt']=''; // 'methodcall or 
'methodresponse'
+
+                       // if response charset encoding is not known / 
supported, try to use
+                       // the default encoding and parse the xml anyway, but 
log a warning...
+                       if (!in_array($resp_encoding, array('UTF-8', 
'ISO-8859-1', 'US-ASCII')))
+                       // the following code might be better for mb_string 
enabled installs, but
+                       // makes the lib about 200% slower...
+                       //if (!is_valid_charset($resp_encoding, array('UTF-8', 
'ISO-8859-1', 'US-ASCII')))
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': invalid 
charset encoding of received response: '.$resp_encoding);
+                               $resp_encoding = $GLOBALS['xmlrpc_defencoding'];
+                       }
+                       $parser = xml_parser_create($resp_encoding);
+                       xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 
true);
+                       // G. Giunta 2005/02/13: PHP internally uses 
ISO-8859-1, so we have to tell
+                       // the xml parser to give us back data in the expected 
charset.
+                       // What if internal encoding is not in one of the 3 
allowed?
+                       // we use the broadest one, ie. utf8
+                       // This allows to send data which is native in various 
charset,
+                       // by extending xmlrpc_encode_entitites() and setting 
xmlrpc_internalencoding
+                       if (!in_array($GLOBALS['xmlrpc_internalencoding'], 
array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                       {
+                               xml_parser_set_option($parser, 
XML_OPTION_TARGET_ENCODING, 'UTF-8');
+                       }
+                       else
+                       {
+                               xml_parser_set_option($parser, 
XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+                       }
+
+                       if ($return_type == 'phpvals')
+                       {
+                               xml_set_element_handler($parser, 'xmlrpc_se', 
'xmlrpc_ee_fast');
+                       }
+                       else
+                       {
+                               xml_set_element_handler($parser, 'xmlrpc_se', 
'xmlrpc_ee');
+                       }
+
+                       xml_set_character_data_handler($parser, 'xmlrpc_cd');
+                       xml_set_default_handler($parser, 'xmlrpc_dh');
+
+                       // first error check: xml not well formed
+                       if(!xml_parse($parser, $data, count($data)))
+                       {
+                               // thanks to Peter Kocks <address@hidden>
+                               if((xml_get_current_line_number($parser)) == 1)
+                               {
+                                       $errstr = 'XML error at line 1, check 
URL';
+                               }
+                               else
+                               {
+                                       $errstr = sprintf('XML error: %s at 
line %d, column %d',
+                                               
xml_error_string(xml_get_error_code($parser)),
+                                               
xml_get_current_line_number($parser), xml_get_current_column_number($parser));
+                               }
+                               error_log($errstr);
+                               $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['invalid_return'], 
$GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')');
+                               xml_parser_free($parser);
+                               if($this->debug)
+                               {
+                                       print $errstr;
+                               }
+                               $r->hdrs = $GLOBALS['_xh']['headers'];
+                               $r->_cookies = $GLOBALS['_xh']['cookies'];
+                               $r->raw_data = $raw_data;
+                               return $r;
+                       }
+                       xml_parser_free($parser);
+                       // second error check: xml well formed but not xml-rpc 
compliant
+                       if ($GLOBALS['_xh']['isf'] > 1)
+                       {
+                               if ($this->debug)
+                               {
+                                       /// @todo echo something for user?
+                               }
+
+                               $r = new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['invalid_return'],
+                               $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . 
$GLOBALS['_xh']['isf_reason']);
+                       }
+                       // third error check: parsing of the response has 
somehow gone boink.
+                       // NB: shall we omit this check, since we trust the 
parsing code?
+                       elseif ($return_type == 'xmlrpcvals' && 
!is_object($GLOBALS['_xh']['value']))
+                       {
+                               // something odd has happened
+                               // and it's time to generate a client side error
+                               // indicating something odd went on
+                               $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['invalid_return'],
+                                       
$GLOBALS['xmlrpcstr']['invalid_return']);
+                       }
+                       else
+                       {
+                               if ($this->debug)
+                               {
+                                       print "<PRE>---PARSED---\n";
+                                       // somehow htmlentities chokes on 
var_export, and some full html string...
+                                       //print 
htmlentitites(var_export($GLOBALS['_xh']['value'], true));
+                                       print 
htmlspecialchars(var_export($GLOBALS['_xh']['value'], true));
+                                       print "\n---END---</PRE>";
+                               }
+
+                               // note that using =& will raise an error if 
$GLOBALS['_xh']['st'] does not generate an object.
+                               $v =& $GLOBALS['_xh']['value'];
+
+                               if($GLOBALS['_xh']['isf'])
+                               {
+                                       /// @todo we should test here if server 
sent an int and a string,
+                                       /// and/or coerce them into such...
+                                       if ($return_type == 'xmlrpcvals')
+                                       {
+                                               $errno_v = 
$v->structmem('faultCode');
+                                               $errstr_v = 
$v->structmem('faultString');
+                                               $errno = $errno_v->scalarval();
+                                               $errstr = 
$errstr_v->scalarval();
+                                       }
+                                       else
+                                       {
+                                               $errno = $v['faultCode'];
+                                               $errstr = $v['faultString'];
+                                       }
+
+                                       if($errno == 0)
+                                       {
+                                               // FAULT returned, errno needs 
to reflect that
+                                               $errno = -1;
+                                       }
+
+                                       $r = new xmlrpcresp(0, $errno, $errstr);
+                               }
+                               else
+                               {
+                                       $r=new xmlrpcresp($v, 0, '', 
$return_type);
+                               }
+                       }
+
+                       $r->hdrs = $GLOBALS['_xh']['headers'];
+                       $r->_cookies = $GLOBALS['_xh']['cookies'];
+                       $r->raw_data = $raw_data;
+                       return $r;
+               }
+       }
+
+       class xmlrpcval
+       {
+               var $me=array();
+               var $mytype=0;
+               var $_php_class=null;
+
+               /**
+               * @param mixed $val
+               * @param string $type any valid xmlrpc type name (lowercase). 
If null, 'string' is assumed
+               */
+               function xmlrpcval($val=-1, $type='')
+               {
+                       /// @todo: optimization creep - do not call addXX, do 
it all inline.
+                       /// downside: booleans will not be coerced anymore
+                       if($val!==-1 || $type!='')
+                       {
+                               // optimization creep: inlined all work done by 
constructor
+                               switch($type)
+                               {
+                                       case '':
+                                               $this->mytype=1;
+                                               $this->me['string']=$val;
+                                               break;
+                                       case 'i4':
+                                       case 'int':
+                                       case 'double':
+                                       case 'string':
+                                       case 'boolean':
+                                       case 'dateTime.iso8601':
+                                       case 'base64':
+                                       case 'null':
+                                               $this->mytype=1;
+                                               $this->me[$type]=$val;
+                                               break;
+                                       case 'array':
+                                               $this->mytype=2;
+                                               $this->me['array']=$val;
+                                               break;
+                                       case 'struct':
+                                               $this->mytype=3;
+                                               $this->me['struct']=$val;
+                                               break;
+                                       default:
+                                               error_log("XML-RPC: 
".__METHOD__.": not a known type ($type)");
+                               }
+                               /*if($type=='')
+                               {
+                                       $type='string';
+                               }
+                               if($GLOBALS['xmlrpcTypes'][$type]==1)
+                               {
+                                       $this->addScalar($val,$type);
+                               }
+                               elseif($GLOBALS['xmlrpcTypes'][$type]==2)
+                               {
+                                       $this->addArray($val);
+                               }
+                               elseif($GLOBALS['xmlrpcTypes'][$type]==3)
+                               {
+                                       $this->addStruct($val);
+                               }*/
+                       }
+               }
+
+               /**
+               * Add a single php value to an (unitialized) xmlrpcval
+               * @param mixed $val
+               * @param string $type
+               * @return int 1 or 0 on failure
+               */
+               function addScalar($val, $type='string')
+               {
+                       address@hidden'xmlrpcTypes'][$type];
+                       if($typeof!=1)
+                       {
+                               error_log("XML-RPC: ".__METHOD__.": not a 
scalar type ($type)");
+                               return 0;
+                       }
+
+                       // coerce booleans into correct values
+                       // NB: we should either do it for datetimes, integers 
and doubles, too,
+                       // or just plain remove this check, implemented on 
booleans only...
+                       if($type==$GLOBALS['xmlrpcBoolean'])
+                       {
+                               if(strcasecmp($val,'true')==0 || $val==1 || 
($val==true && strcasecmp($val,'false')))
+                               {
+                                       $val=true;
+                               }
+                               else
+                               {
+                                       $val=false;
+                               }
+                       }
+
+                       switch($this->mytype)
+                       {
+                               case 1:
+                                       error_log('XML-RPC: '.__METHOD__.': 
scalar xmlrpcval can have only one value');
+                                       return 0;
+                               case 3:
+                                       error_log('XML-RPC: '.__METHOD__.': 
cannot add anonymous scalar to struct xmlrpcval');
+                                       return 0;
+                               case 2:
+                                       // we're adding a scalar value to an 
array here
+                                       //$ar=$this->me['array'];
+                                       //$ar[]=new xmlrpcval($val, $type);
+                                       //$this->me['array']=$ar;
+                                       // Faster (?) avoid all the costly 
array-copy-by-val done here...
+                                       $this->me['array'][]=new 
xmlrpcval($val, $type);
+                                       return 1;
+                               default:
+                                       // a scalar, so set the value and 
remember we're scalar
+                                       $this->me[$type]=$val;
+                                       $this->mytype=$typeof;
+                                       return 1;
+                       }
+               }
+
+               /**
+               * Add an array of xmlrpcval objects to an xmlrpcval
+               * @param array $vals
+               * @return int 1 or 0 on failure
+               * @access public
+               *
+               * @todo add some checking for $vals to be an array of 
xmlrpcvals?
+               */
+               function addArray($vals)
+               {
+                       if($this->mytype==0)
+                       {
+                               $this->mytype=$GLOBALS['xmlrpcTypes']['array'];
+                               $this->me['array']=$vals;
+                               return 1;
+                       }
+                       elseif($this->mytype==2)
+                       {
+                               // we're adding to an array here
+                               $this->me['array'] = 
array_merge($this->me['array'], $vals);
+                               return 1;
+                       }
+                       else
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': already 
initialized as a [' . $this->kindOf() . ']');
+                               return 0;
+                       }
+               }
+
+               /**
+               * Add an array of named xmlrpcval objects to an xmlrpcval
+               * @param array $vals
+               * @return int 1 or 0 on failure
+               * @access public
+               *
+               * @todo add some checking for $vals to be an array?
+               */
+               function addStruct($vals)
+               {
+                       if($this->mytype==0)
+                       {
+                               $this->mytype=$GLOBALS['xmlrpcTypes']['struct'];
+                               $this->me['struct']=$vals;
+                               return 1;
+                       }
+                       elseif($this->mytype==3)
+                       {
+                               // we're adding to a struct here
+                               $this->me['struct'] = 
array_merge($this->me['struct'], $vals);
+                               return 1;
+                       }
+                       else
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': already 
initialized as a [' . $this->kindOf() . ']');
+                               return 0;
+                       }
+               }
+
+               // poor man's version of print_r ???
+               // DEPRECATED!
+               function dump($ar)
+               {
+                       foreach($ar as $key => $val)
+                       {
+                               echo "$key => $val<br />";
+                               if($key == 'array')
+                               {
+                                       while(list($key2, $val2) = each($val))
+                                       {
+                                               echo "-- $key2 => $val2<br />";
+                                       }
+                               }
+                       }
+               }
+
+               /**
+               * Returns a string containing "struct", "array" or "scalar" 
describing the base type of the value
+               * @return string
+               * @access public
+               */
+               function kindOf()
+               {
+                       switch($this->mytype)
+                       {
+                               case 3:
+                                       return 'struct';
+                                       break;
+                               case 2:
+                                       return 'array';
+                                       break;
+                               case 1:
+                                       return 'scalar';
+                                       break;
+                               default:
+                                       return 'undef';
+                       }
+               }
+
+               /**
+               * @access private
+               */
+               function serializedata($typ, $val, $charset_encoding='')
+               {
+                       $rs='';
+                       switch(@$GLOBALS['xmlrpcTypes'][$typ])
+                       {
+                               case 1:
+                                       switch($typ)
+                                       {
+                                               case $GLOBALS['xmlrpcBase64']:
+                                                       $rs.="<${typ}>" . 
base64_encode($val) . "</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcBoolean']:
+                                                       $rs.="<${typ}>" . ($val 
? '1' : '0') . "</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcString']:
+                                                       // G. Giunta 2005/2/13: 
do NOT use htmlentities, since
+                                                       // it will produce 
named html entities, which are invalid xml
+                                                       $rs.="<${typ}>" . 
xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], 
$charset_encoding). "</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcInt']:
+                                               case $GLOBALS['xmlrpcI4']:
+                                                       
$rs.="<${typ}>".(int)$val."</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcDouble']:
+                                                       // avoid using standard 
conversion of float to string because it is locale-dependent,
+                                                       // and also because the 
xmlrpc spec forbids exponential notation.
+                                                       // sprintf('%F') could 
be most likely ok but it fails eg. on 2e-14.
+                                                       // The code below tries 
its best at keeping max precision while avoiding exp notation,
+                                                       // but there is of 
course no limit in the number of decimal places to be used...
+                                                       
$rs.="<${typ}>".preg_replace('/\\.?0+$/','',number_format((double)$val, 128, 
'.', ''))."</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcDateTime']:
+                                                       if (is_string($val))
+                                                       {
+                                                               
$rs.="<${typ}>${val}</${typ}>";
+                                                       }
+                                                       else if(is_a($val, 
'DateTime'))
+                                                       {
+                                                               
$rs.="<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>";
+                                                       }
+                                                       else if(is_int($val))
+                                                       {
+                                                               
$rs.="<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>";
+                                                       }
+                                                       else
+                                                       {
+                                                               // not really a 
good idea here: but what shall we output anyway? left for backward compat...
+                                                               
$rs.="<${typ}>${val}</${typ}>";
+                                                       }
+                                                       break;
+                                               case $GLOBALS['xmlrpcNull']:
+                                                       if 
($GLOBALS['xmlrpc_null_apache_encoding'])
+                                                       {
+                                                               
$rs.="<ex:nil/>";
+                                                       }
+                                                       else
+                                                       {
+                                                               $rs.="<nil/>";
+                                                       }
+                                                       break;
+                                               default:
+                                                       // no standard type 
value should arrive here, but provide a possibility
+                                                       // for xmlrpcvals of 
unknown type...
+                                                       
$rs.="<${typ}>${val}</${typ}>";
+                                       }
+                                       break;
+                               case 3:
+                                       // struct
+                                       if ($this->_php_class)
+                                       {
+                                               $rs.='<struct php_class="' . 
$this->_php_class . "\">\n";
+                                       }
+                                       else
+                                       {
+                                               $rs.="<struct>\n";
+                                       }
+                                       foreach($val as $key2 => $val2)
+                                       {
+                                               
$rs.='<member><name>'.xmlrpc_encode_entitites($key2, 
$GLOBALS['xmlrpc_internalencoding'], $charset_encoding)."</name>\n";
+                                               
//$rs.=$this->serializeval($val2);
+                                               
$rs.=$val2->serialize($charset_encoding);
+                                               $rs.="</member>\n";
+                                       }
+                                       $rs.='</struct>';
+                                       break;
+                               case 2:
+                                       // array
+                                       $rs.="<array>\n<data>\n";
+                                       for($i=0; $i<count($val); $i++)
+                                       {
+                                               
//$rs.=$this->serializeval($val[$i]);
+                                               
$rs.=$val[$i]->serialize($charset_encoding);
+                                       }
+                                       $rs.="</data>\n</array>";
+                                       break;
+                               default:
+                                       break;
+                       }
+                       return $rs;
+               }
+
+               /**
+               * Returns xml representation of the value. XML prologue not 
included
+               * @param string $charset_encoding the charset to be used for 
serialization. if null, US-ASCII is assumed
+               * @return string
+               * @access public
+               */
+               function serialize($charset_encoding='')
+               {
+                       // add check? slower, but helps to avoid recursion in 
serializing broken xmlrpcvals...
+                       //if (is_object($o) && (get_class($o) == 'xmlrpcval' || 
is_subclass_of($o, 'xmlrpcval')))
+                       //{
+                               reset($this->me);
+                               list($typ, $val) = each($this->me);
+                               return '<value>' . $this->serializedata($typ, 
$val, $charset_encoding) . "</value>\n";
+                       //}
+               }
+
+               // DEPRECATED
+               function serializeval($o)
+               {
+                       // add check? slower, but helps to avoid recursion in 
serializing broken xmlrpcvals...
+                       //if (is_object($o) && (get_class($o) == 'xmlrpcval' || 
is_subclass_of($o, 'xmlrpcval')))
+                       //{
+                               $ar=$o->me;
+                               reset($ar);
+                               list($typ, $val) = each($ar);
+                               return '<value>' . $this->serializedata($typ, 
$val) . "</value>\n";
+                       //}
+               }
+
+               /**
+               * Checks wheter a struct member with a given name is present.
+               * Works only on xmlrpcvals of type struct.
+               * @param string $m the name of the struct member to be looked up
+               * @return boolean
+               * @access public
+               */
+               function structmemexists($m)
+               {
+                       return array_key_exists($m, $this->me['struct']);
+               }
+
+               /**
+               * Returns the value of a given struct member (an xmlrpcval 
object in itself).
+               * Will raise a php warning if struct member of given name does 
not exist
+               * @param string $m the name of the struct member to be looked up
+               * @return xmlrpcval
+               * @access public
+               */
+               function structmem($m)
+               {
+                       return $this->me['struct'][$m];
+               }
+
+               /**
+               * Reset internal pointer for xmlrpcvals of type struct.
+               * @access public
+               */
+               function structreset()
+               {
+                       reset($this->me['struct']);
+               }
+
+               /**
+               * Return next member element for xmlrpcvals of type struct.
+               * @return xmlrpcval
+               * @access public
+               */
+               function structeach()
+               {
+                       return each($this->me['struct']);
+               }
+
+               // DEPRECATED! this code looks like it is very fragile and has 
not been fixed
+               // for a long long time. Shall we remove it for 2.0?
+               function getval()
+               {
+                       // UNSTABLE
+                       reset($this->me);
+                       list($a,$b)=each($this->me);
+                       // contributed by I Sofer, 2001-03-24
+                       // add support for nested arrays to scalarval
+                       // i've created a new method here, so as to
+                       // preserve back compatibility
+
+                       if(is_array($b))
+                       {
+                               @reset($b);
+                               while(list($id,$cont) = @each($b))
+                               {
+                                       $b[$id] = $cont->scalarval();
+                               }
+                       }
+
+                       // add support for structures directly encoding php 
objects
+                       if(is_object($b))
+                       {
+                               $t = get_object_vars($b);
+                               @reset($t);
+                               while(list($id,$cont) = @each($t))
+                               {
+                                       $t[$id] = $cont->scalarval();
+                               }
+                               @reset($t);
+                               while(list($id,$cont) = @each($t))
+                               {
+                                       @$b->$id = $cont;
+                               }
+                       }
+                       // end contrib
+                       return $b;
+               }
+
+               /**
+               * Returns the value of a scalar xmlrpcval
+               * @return mixed
+               * @access public
+               */
+               function scalarval()
+               {
+                       reset($this->me);
+                       list(,$b)=each($this->me);
+                       return $b;
+               }
+
+               /**
+               * Returns the type of the xmlrpcval.
+               * For integers, 'int' is always returned in place of 'i4'
+               * @return string
+               * @access public
+               */
+               function scalartyp()
+               {
+                       reset($this->me);
+                       list($a,)=each($this->me);
+                       if($a==$GLOBALS['xmlrpcI4'])
+                       {
+                               $a=$GLOBALS['xmlrpcInt'];
+                       }
+                       return $a;
+               }
+
+               /**
+               * Returns the m-th member of an xmlrpcval of struct type
+               * @param integer $m the index of the value to be retrieved 
(zero based)
+               * @return xmlrpcval
+               * @access public
+               */
+               function arraymem($m)
+               {
+                       return $this->me['array'][$m];
+               }
+
+               /**
+               * Returns the number of members in an xmlrpcval of array type
+               * @return integer
+               * @access public
+               */
+               function arraysize()
+               {
+                       return count($this->me['array']);
+               }
+
+               /**
+               * Returns the number of members in an xmlrpcval of struct type
+               * @return integer
+               * @access public
+               */
+               function structsize()
+               {
+                       return count($this->me['struct']);
+               }
+       }
+
+
+       // date helpers
+
+       /**
+       * Given a timestamp, return the corresponding ISO8601 encoded string.
+       *
+       * Really, timezones ought to be supported
+       * but the XML-RPC spec says:
+       *
+       * "Don't assume a timezone. It should be specified by the server in its
+       * documentation what assumptions it makes about timezones."
+       *
+       * These routines always assume localtime unless
+       * $utc is set to 1, in which case UTC is assumed
+       * and an adjustment for locale is made when encoding
+       *
+       * @param int $timet (timestamp)
+       * @param int $utc (0 or 1)
+       * @return string
+       */
+       function iso8601_encode($timet, $utc=0)
+       {
+               if(!$utc)
+               {
+                       $t=strftime("%Y%m%dT%H:%M:%S", $timet);
+               }
+               else
+               {
+                       if(function_exists('gmstrftime'))
+                       {
+                               // gmstrftime doesn't exist in some versions
+                               // of PHP
+                               $t=gmstrftime("%Y%m%dT%H:%M:%S", $timet);
+                       }
+                       else
+                       {
+                               $t=strftime("%Y%m%dT%H:%M:%S", 
$timet-date('Z'));
+                       }
+               }
+               return $t;
+       }
+
+       /**
+       * Given an ISO8601 date string, return a timet in the localtime, or UTC
+       * @param string $idate
+       * @param int $utc either 0 or 1
+       * @return int (datetime)
+       */
+       function iso8601_decode($idate, $utc=0)
+       {
+               $t=0;
+               
if(preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/',
 $idate, $regs))
+               {
+                       if($utc)
+                       {
+                               $t=gmmktime($regs[4], $regs[5], $regs[6], 
$regs[2], $regs[3], $regs[1]);
+                       }
+                       else
+                       {
+                               $t=mktime($regs[4], $regs[5], $regs[6], 
$regs[2], $regs[3], $regs[1]);
+                       }
+               }
+               return $t;
+       }
+
+       /**
+       * Takes an xmlrpc value in PHP xmlrpcval object format and translates 
it into native PHP types.
+       *
+       * Works with xmlrpc message objects as input, too.
+       *
+       * Given proper options parameter, can rebuild generic php object 
instances
+       * (provided those have been encoded to xmlrpc format using a 
corresponding
+       * option in php_xmlrpc_encode())
+       * PLEASE NOTE that rebuilding php objects involves calling their 
constructor function.
+       * This means that the remote communication end can decide which php 
code will
+       * get executed on your server, leaving the door possibly open to 
'php-injection'
+       * style of attacks (provided you have some classes defined on your 
server that
+       * might wreak havoc if instances are built outside an appropriate 
context).
+       * Make sure you trust the remote server/client before eanbling this!
+       *
+       * @author Dan Libby (address@hidden)
+       *
+       * @param xmlrpcval $xmlrpc_val
+       * @param array $options if 'decode_php_objs' is set in the options 
array, xmlrpc structs can be decoded into php objects; if 'dates_as_objects' is 
set xmlrpc datetimes are decoded as php DateTime objects (standard is
+       * @return mixed
+       */
+       function php_xmlrpc_decode($xmlrpc_val, $options=array())
+       {
+               switch($xmlrpc_val->kindOf())
+               {
+                       case 'scalar':
+                               if (in_array('extension_api', $options))
+                               {
+                                       reset($xmlrpc_val->me);
+                                       list($typ,$val) = each($xmlrpc_val->me);
+                                       switch ($typ)
+                                       {
+                                               case 'dateTime.iso8601':
+                                                       $xmlrpc_val->scalar = 
$val;
+                                                       
$xmlrpc_val->xmlrpc_type = 'datetime';
+                                                       $xmlrpc_val->timestamp 
= iso8601_decode($val);
+                                                       return $xmlrpc_val;
+                                               case 'base64':
+                                                       $xmlrpc_val->scalar = 
$val;
+                                                       $xmlrpc_val->type = 
$typ;
+                                                       return $xmlrpc_val;
+                                               default:
+                                                       return 
$xmlrpc_val->scalarval();
+                                       }
+                               }
+                               if (in_array('dates_as_objects', $options) && 
$xmlrpc_val->scalartyp() == 'dateTime.iso8601')
+                               {
+                                       // we return a Datetime object instead 
of a string
+                                       // since now the constructor of 
xmlrpcval accepts safely strings, ints and datetimes,
+                                       // we cater to all 3 cases here
+                                       $out = $xmlrpc_val->scalarval();
+                                       if (is_string($out))
+                                       {
+                                               $out = strtotime($out);
+                                       }
+                                       if (is_int($out))
+                                       {
+                                               $result = new Datetime();
+                                               $result->setTimestamp($out);
+                                               return $result;
+                                       }
+                                       elseif (is_a($out, 'Datetime'))
+                                       {
+                                               return $out;
+                                       }
+                               }
+                               return $xmlrpc_val->scalarval();
+                       case 'array':
+                               $size = $xmlrpc_val->arraysize();
+                               $arr = array();
+                               for($i = 0; $i < $size; $i++)
+                               {
+                                       $arr[] = 
php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);
+                               }
+                               return $arr;
+                       case 'struct':
+                               $xmlrpc_val->structreset();
+                               // If user said so, try to rebuild php objects 
for specific struct vals.
+                               /// @todo should we raise a warning for class 
not found?
+                               // shall we check for proper subclass of 
xmlrpcval instead of
+                               // presence of _php_class to detect what we can 
do?
+                               if (in_array('decode_php_objs', $options) && 
$xmlrpc_val->_php_class != ''
+                                       && 
class_exists($xmlrpc_val->_php_class))
+                               {
+                                       $obj = @new $xmlrpc_val->_php_class;
+                                       
while(list($key,$value)=$xmlrpc_val->structeach())
+                                       {
+                                               $obj->$key = 
php_xmlrpc_decode($value, $options);
+                                       }
+                                       return $obj;
+                               }
+                               else
+                               {
+                                       $arr = array();
+                                       
while(list($key,$value)=$xmlrpc_val->structeach())
+                                       {
+                                               $arr[$key] = 
php_xmlrpc_decode($value, $options);
+                                       }
+                                       return $arr;
+                               }
+                       case 'msg':
+                               $paramcount = $xmlrpc_val->getNumParams();
+                               $arr = array();
+                               for($i = 0; $i < $paramcount; $i++)
+                               {
+                                       $arr[] = 
php_xmlrpc_decode($xmlrpc_val->getParam($i));
+                               }
+                               return $arr;
+                       }
+       }
+
+       // This constant left here only for historical reasons...
+       // it was used to decide if we have to define xmlrpc_encode on our own, 
but
+       // we do not do it anymore
+       if(function_exists('xmlrpc_decode'))
+       {
+               define('XMLRPC_EPI_ENABLED','1');
+       }
+       else
+       {
+               define('XMLRPC_EPI_ENABLED','0');
+       }
+
+       /**
+       * Takes native php types and encodes them into xmlrpc PHP object format.
+       * It will not re-encode xmlrpcval objects.
+       *
+       * Feature creep -- could support more types via optional type argument
+       * (string => datetime support has been added, ??? => base64 not yet)
+       *
+       * If given a proper options parameter, php object instances will be 
encoded
+       * into 'special' xmlrpc values, that can later be decoded into php 
objects
+       * by calling php_xmlrpc_decode() with a corresponding option
+       *
+       * @author Dan Libby (address@hidden)
+       *
+       * @param mixed $php_val the value to be converted into an xmlrpcval 
object
+       * @param array $options can include 'encode_php_objs', 'auto_dates', 
'null_extension' or 'extension_api'
+       * @return xmlrpcval
+       */
+       function php_xmlrpc_encode($php_val, $options=array())
+       {
+               $type = gettype($php_val);
+               switch($type)
+               {
+                       case 'string':
+                               if (in_array('auto_dates', $options) && 
preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val))
+                                       $xmlrpc_val = new xmlrpcval($php_val, 
$GLOBALS['xmlrpcDateTime']);
+                               else
+                                       $xmlrpc_val = new xmlrpcval($php_val, 
$GLOBALS['xmlrpcString']);
+                               break;
+                       case 'integer':
+                               $xmlrpc_val = new xmlrpcval($php_val, 
$GLOBALS['xmlrpcInt']);
+                               break;
+                       case 'double':
+                               $xmlrpc_val = new xmlrpcval($php_val, 
$GLOBALS['xmlrpcDouble']);
+                               break;
+                               // <G_Giunta_2001-02-29>
+                               // Add support for encoding/decoding of 
booleans, since they are supported in PHP
+                       case 'boolean':
+                               $xmlrpc_val = new xmlrpcval($php_val, 
$GLOBALS['xmlrpcBoolean']);
+                               break;
+                               // </G_Giunta_2001-02-29>
+                       case 'array':
+                               // PHP arrays can be encoded to either xmlrpc 
structs or arrays,
+                               // depending on wheter they are hashes or plain 
0..n integer indexed
+                               // A shorter one-liner would be
+                               // $tmp = array_diff(array_keys($php_val), 
range(0, count($php_val)-1));
+                               // but execution time skyrockets!
+                               $j = 0;
+                               $arr = array();
+                               $ko = false;
+                               foreach($php_val as $key => $val)
+                               {
+                                       $arr[$key] = php_xmlrpc_encode($val, 
$options);
+                                       if(!$ko && $key !== $j)
+                                       {
+                                               $ko = true;
+                                       }
+                                       $j++;
+                               }
+                               if($ko)
+                               {
+                                       $xmlrpc_val = new xmlrpcval($arr, 
$GLOBALS['xmlrpcStruct']);
+                               }
+                               else
+                               {
+                                       $xmlrpc_val = new xmlrpcval($arr, 
$GLOBALS['xmlrpcArray']);
+                               }
+                               break;
+                       case 'object':
+                               if(is_a($php_val, 'xmlrpcval'))
+                               {
+                                       $xmlrpc_val = $php_val;
+                               }
+                               else if(is_a($php_val, 'DateTime'))
+                               {
+                                       $xmlrpc_val = new 
xmlrpcval($php_val->format('Ymd\TH:i:s'), $GLOBALS['xmlrpcStruct']);
+                               }
+                               else
+                               {
+                                       $arr = array();
+                                       reset($php_val);
+                                       while(list($k,$v) = each($php_val))
+                                       {
+                                               $arr[$k] = 
php_xmlrpc_encode($v, $options);
+                                       }
+                                       $xmlrpc_val = new xmlrpcval($arr, 
$GLOBALS['xmlrpcStruct']);
+                                       if (in_array('encode_php_objs', 
$options))
+                                       {
+                                               // let's save original class 
name into xmlrpcval:
+                                               // might be useful later on...
+                                               $xmlrpc_val->_php_class = 
get_class($php_val);
+                                       }
+                               }
+                               break;
+                       case 'NULL':
+                               if (in_array('extension_api', $options))
+                               {
+                                       $xmlrpc_val = new xmlrpcval('', 
$GLOBALS['xmlrpcString']);
+                               }
+                               else if (in_array('null_extension', $options))
+                               {
+                                       $xmlrpc_val = new xmlrpcval('', 
$GLOBALS['xmlrpcNull']);
+                               }
+                               else
+                               {
+                                       $xmlrpc_val = new xmlrpcval();
+                               }
+                               break;
+                       case 'resource':
+                               if (in_array('extension_api', $options))
+                               {
+                                       $xmlrpc_val = new 
xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);
+                               }
+                               else
+                               {
+                                       $xmlrpc_val = new xmlrpcval();
+                               }
+                       // catch "user function", "unknown type"
+                       default:
+                               // giancarlo pinerolo <address@hidden>
+                               // it has to return
+                               // an empty object in case, not a boolean.
+                               $xmlrpc_val = new xmlrpcval();
+                               break;
+                       }
+                       return $xmlrpc_val;
+       }
+
+       /**
+       * Convert the xml representation of a method response, method request 
or single
+       * xmlrpc value into the appropriate object (a.k.a. deserialize)
+       * @param string $xml_val
+       * @param array $options
+       * @return mixed false on error, or an instance of either xmlrpcval, 
xmlrpcmsg or xmlrpcresp
+       */
+       function php_xmlrpc_decode_xml($xml_val, $options=array())
+       {
+               $GLOBALS['_xh'] = array();
+               $GLOBALS['_xh']['ac'] = '';
+               $GLOBALS['_xh']['stack'] = array();
+               $GLOBALS['_xh']['valuestack'] = array();
+               $GLOBALS['_xh']['params'] = array();
+               $GLOBALS['_xh']['pt'] = array();
+               $GLOBALS['_xh']['isf'] = 0;
+               $GLOBALS['_xh']['isf_reason'] = '';
+               $GLOBALS['_xh']['method'] = false;
+               $GLOBALS['_xh']['rt'] = '';
+               /// @todo 'guestimate' encoding
+               $parser = xml_parser_create();
+               xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+               // What if internal encoding is not in one of the 3 allowed?
+               // we use the broadest one, ie. utf8!
+               if (!in_array($GLOBALS['xmlrpc_internalencoding'], 
array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+               {
+                       xml_parser_set_option($parser, 
XML_OPTION_TARGET_ENCODING, 'UTF-8');
+               }
+               else
+               {
+                       xml_parser_set_option($parser, 
XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+               }
+               xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee');
+               xml_set_character_data_handler($parser, 'xmlrpc_cd');
+               xml_set_default_handler($parser, 'xmlrpc_dh');
+               if(!xml_parse($parser, $xml_val, 1))
+               {
+                       $errstr = sprintf('XML error: %s at line %d, column %d',
+                                               
xml_error_string(xml_get_error_code($parser)),
+                                               
xml_get_current_line_number($parser), xml_get_current_column_number($parser));
+                       error_log($errstr);
+                       xml_parser_free($parser);
+                       return false;
+               }
+               xml_parser_free($parser);
+               if ($GLOBALS['_xh']['isf'] > 1) // test that 
$GLOBALS['_xh']['value'] is an obj, too???
+               {
+                       error_log($GLOBALS['_xh']['isf_reason']);
+                       return false;
+               }
+               switch ($GLOBALS['_xh']['rt'])
+               {
+                       case 'methodresponse':
+                               $v =& $GLOBALS['_xh']['value'];
+                               if ($GLOBALS['_xh']['isf'] == 1)
+                               {
+                                       $vc = $v->structmem('faultCode');
+                                       $vs = $v->structmem('faultString');
+                                       $r = new xmlrpcresp(0, 
$vc->scalarval(), $vs->scalarval());
+                               }
+                               else
+                               {
+                                       $r = new xmlrpcresp($v);
+                               }
+                               return $r;
+                       case 'methodcall':
+                               $m = new xmlrpcmsg($GLOBALS['_xh']['method']);
+                               for($i=0; $i < 
count($GLOBALS['_xh']['params']); $i++)
+                               {
+                                       
$m->addParam($GLOBALS['_xh']['params'][$i]);
+                               }
+                               return $m;
+                       case 'value':
+                               return $GLOBALS['_xh']['value'];
+                       default:
+                               return false;
+               }
+       }
+
+       /**
+       * decode a string that is encoded w/ "chunked" transfer encoding
+       * as defined in rfc2068 par. 19.4.6
+       * code shamelessly stolen from nusoap library by Dietrich Ayala
+       *
+       * @param string $buffer the string to be decoded
+       * @return string
+       */
+       function decode_chunked($buffer)
+       {
+               // length := 0
+               $length = 0;
+               $new = '';
+
+               // read chunk-size, chunk-extension (if any) and crlf
+               // get the position of the linebreak
+               $chunkend = strpos($buffer,"\r\n") + 2;
+               $temp = substr($buffer,0,$chunkend);
+               $chunk_size = hexdec( trim($temp) );
+               $chunkstart = $chunkend;
+               while($chunk_size > 0)
+               {
+                       $chunkend = strpos($buffer, "\r\n", $chunkstart + 
$chunk_size);
+
+                       // just in case we got a broken connection
+                       if($chunkend == false)
+                       {
+                               $chunk = substr($buffer,$chunkstart);
+                               // append chunk-data to entity-body
+                               $new .= $chunk;
+                               $length += strlen($chunk);
+                               break;
+                       }
+
+                       // read chunk-data and crlf
+                       $chunk = 
substr($buffer,$chunkstart,$chunkend-$chunkstart);
+                       // append chunk-data to entity-body
+                       $new .= $chunk;
+                       // length := length + chunk-size
+                       $length += strlen($chunk);
+                       // read chunk-size and crlf
+                       $chunkstart = $chunkend + 2;
+
+                       $chunkend = strpos($buffer,"\r\n",$chunkstart)+2;
+                       if($chunkend == false)
+                       {
+                               break; //just in case we got a broken connection
+                       }
+                       $temp = 
substr($buffer,$chunkstart,$chunkend-$chunkstart);
+                       $chunk_size = hexdec( trim($temp) );
+                       $chunkstart = $chunkend;
+               }
+               return $new;
+       }
+
+       /**
+       * xml charset encoding guessing helper function.
+       * Tries to determine the charset encoding of an XML chunk received over 
HTTP.
+       * NB: according to the spec (RFC 3023), if text/xml content-type is 
received over HTTP without a content-type,
+       * we SHOULD assume it is strictly US-ASCII. But we try to be more 
tolerant of unconforming (legacy?) clients/servers,
+       * which will be most probably using UTF-8 anyway...
+       *
+       * @param string $httpheaders the http Content-type header
+       * @param string $xmlchunk xml content buffer
+       * @param string $encoding_prefs comma separated list of character 
encodings to be used as default (when mb extension is enabled)
+       *
+       * @todo explore usage of mb_http_input(): does it detect http headers + 
post data? if so, use it instead of hand-detection!!!
+       */
+       function guess_encoding($httpheader='', $xmlchunk='', 
$encoding_prefs=null)
+       {
+               // discussion: see http://www.yale.edu/pclt/encoding/
+               // 1 - test if encoding is specified in HTTP HEADERS
+
+               //Details:
+               // LWS:           (\13\10)?( |\t)+
+               // token:         (any char but excluded stuff)+
+               // quoted string: " (any char but double quotes and cointrol 
chars)* "
+               // header:        Content-type = ...; charset=value(; ...)*
+               //   where value is of type token, no LWS allowed between 
'charset' and value
+               // Note: we do not check for invalid chars in VALUE:
+               //   this had better be done using pure ereg as below
+               // Note 2: we might be removing whitespace/tabs that ought to 
be left in if
+               //   the received charset is a quoted string. But nobody uses 
such charset names...
+
+               /// @todo this test will pass if ANY header has charset 
specification, not only Content-Type. Fix it?
+               $matches = array();
+               if(preg_match('/;\s*charset\s*=([^;]+)/i', $httpheader, 
$matches))
+               {
+                       return strtoupper(trim($matches[1], " \t\""));
+               }
+
+               // 2 - scan the first bytes of the data for a UTF-16 (or other) 
BOM pattern
+               //     (source: http://www.w3.org/TR/2000/REC-xml-20001006)
+               //     NOTE: actually, according to the spec, even if we find 
the BOM and determine
+               //     an encoding, we should check if there is an encoding 
specified
+               //     in the xml declaration, and verify if they match.
+               /// @todo implement check as described above?
+               /// @todo implement check for first bytes of string even 
without a BOM? (It sure looks harder than for cases WITH a BOM)
+               
if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/',
 $xmlchunk))
+               {
+                       return 'UCS-4';
+               }
+               elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk))
+               {
+                       return 'UTF-16';
+               }
+               elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))
+               {
+                       return 'UTF-8';
+               }
+
+               // 3 - test if encoding is specified in the xml declaration
+               // Details:
+               // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
+               // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
+               if (preg_match('/^<\?xml\s+version\s*=\s*'. 
"((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
+                       '\s+encoding\s*=\s*' . 
"((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
+                       $xmlchunk, $matches))
+               {
+                       return strtoupper(substr($matches[2], 1, -1));
+               }
+
+               // 4 - if mbstring is available, let it do the guesswork
+               // NB: we favour finding an encoding that is compatible with 
what we can process
+               if(extension_loaded('mbstring'))
+               {
+                       if($encoding_prefs)
+                       {
+                               $enc = mb_detect_encoding($xmlchunk, 
$encoding_prefs);
+                       }
+                       else
+                       {
+                               $enc = mb_detect_encoding($xmlchunk);
+                       }
+                       // NB: mb_detect likes to call it ascii, xml parser 
likes to call it US_ASCII...
+                       // IANA also likes better US-ASCII, so go with it
+                       if($enc == 'ASCII')
+                       {
+                               $enc = 'US-'.$enc;
+                       }
+                       return $enc;
+               }
+               else
+               {
+                       // no encoding specified: as per HTTP1.1 assume it is 
iso-8859-1?
+                       // Both RFC 2616 (HTTP 1.1) and 1945 (HTTP 1.0) clearly 
state that for text/xxx content types
+                       // this should be the standard. And we should be 
getting text/xml as request and response.
+                       // BUT we have to be backward compatible with the lib, 
which always used UTF-8 as default...
+                       return $GLOBALS['xmlrpc_defencoding'];
+               }
+       }
+
+       /**
+       * Checks if a given charset encoding is present in a list of encodings 
or
+       * if it is a valid subset of any encoding in the list
+       * @param string $encoding charset to be tested
+       * @param mixed $validlist comma separated list of valid charsets (or 
array of charsets)
+       */
+       function is_valid_charset($encoding, $validlist)
+       {
+               $charset_supersets = array(
+                       'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 
'ISO-8859-3', 'ISO-8859-4',
+                               'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 
'ISO-8859-8',
+                               'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 
'ISO-8859-12',
+                               'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 
'UTF-8',
+                               'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN')
+               );
+               if (is_string($validlist))
+                       $validlist = explode(',', $validlist);
+               if (@in_array(strtoupper($encoding), $validlist))
+                       return true;
+               else
+               {
+                       if (array_key_exists($encoding, $charset_supersets))
+                               foreach ($validlist as $allowed)
+                                       if (in_array($allowed, 
$charset_supersets[$encoding]))
+                                               return true;
+                               return false;
+               }
+       }
+
+?>
\ No newline at end of file

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpc_wrappers.inc
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpc_wrappers.inc   
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpc_wrappers.inc   
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,955 @@
+<?php
+/**
+ * PHP-XMLRPC "wrapper" functions
+ * Generate stubs to transparently access xmlrpc methods as php functions and 
viceversa
+ *
+ * @version $Id: xmlrpc_wrappers.inc,v 1.13 2008/09/20 01:23:47 ggiunta Exp $
+ * @author Gaetano Giunta
+ * @copyright (C) 2006-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ *
+ * @todo separate introspection from code generation for func-2-method wrapping
+ * @todo use some better templating system for code generation?
+ * @todo implement method wrapping with preservation of php objs in calls
+ * @todo when wrapping methods without obj rebuilding, use return_type = 
'phpvals' (faster)
+ * @todo implement self-parsing of php code for PHP <= 4
+ */
+
+       // requires: xmlrpc.inc
+
+       /**
+       * Given a string defining a php type or phpxmlrpc type (loosely 
defined: strings
+       * accepted come from javadoc blocks), return corresponding phpxmlrpc 
type.
+       * NB: for php 'resource' types returns empty string, since resources 
cannot be serialized;
+       * for php class names returns 'struct', since php objects can be 
serialized as xmlrpc structs
+       * for php arrays always return array, even though arrays sometiles 
serialize as json structs
+       * @param string $phptype
+       * @return string
+       */
+       function php_2_xmlrpc_type($phptype)
+       {
+               switch(strtolower($phptype))
+               {
+                       case 'string':
+                               return $GLOBALS['xmlrpcString'];
+                       case 'integer':
+                       case $GLOBALS['xmlrpcInt']: // 'int'
+                       case $GLOBALS['xmlrpcI4']:
+                               return $GLOBALS['xmlrpcInt'];
+                       case 'double':
+                               return $GLOBALS['xmlrpcDouble'];
+                       case 'boolean':
+                               return $GLOBALS['xmlrpcBoolean'];
+                       case 'array':
+                               return $GLOBALS['xmlrpcArray'];
+                       case 'object':
+                               return $GLOBALS['xmlrpcStruct'];
+                       case $GLOBALS['xmlrpcBase64']:
+                       case $GLOBALS['xmlrpcStruct']:
+                               return strtolower($phptype);
+                       case 'resource':
+                               return '';
+                       default:
+                               if(class_exists($phptype))
+                               {
+                                       return $GLOBALS['xmlrpcStruct'];
+                               }
+                               else
+                               {
+                                       // unknown: might be any 'extended' 
xmlrpc type
+                                       return $GLOBALS['xmlrpcValue'];
+                               }
+               }
+       }
+
+       /**
+       * Given a string defining a phpxmlrpc type return corresponding php 
type.
+       * @param string $xmlrpctype
+       * @return string
+       */
+       function xmlrpc_2_php_type($xmlrpctype)
+       {
+               switch(strtolower($xmlrpctype))
+               {
+                       case 'base64':
+                       case 'datetime.iso8601':
+                       case 'string':
+                               return $GLOBALS['xmlrpcString'];
+                       case 'int':
+                       case 'i4':
+                               return 'integer';
+                       case 'struct':
+                       case 'array':
+                               return 'array';
+                       case 'double':
+                               return 'float';
+                       case 'undefined':
+                               return 'mixed';
+                       case 'boolean':
+                       case 'null':
+                       default:
+                               // unknown: might be any xmlrpc type
+                               return strtolower($xmlrpctype);
+               }
+       }
+
+       /**
+       * Given a user-defined PHP function, create a PHP 'wrapper' function 
that can
+       * be exposed as xmlrpc method from an xmlrpc_server object and called 
from remote
+       * clients (as well as its corresponding signature info).
+       *
+       * Since php is a typeless language, to infer types of input and output 
parameters,
+       * it relies on parsing the javadoc-style comment block associated with 
the given
+       * function. Usage of xmlrpc native types (such as 
datetime.dateTime.iso8601 and base64)
+       * in the @param tag is also allowed, if you need the php function to 
receive/send
+       * data in that particular format (note that base64 encoding/decoding is 
transparently
+       * carried out by the lib, while datetime vals are passed around as 
strings)
+       *
+       * Known limitations:
+       * - requires PHP 5.0.3 +
+       * - only works for user-defined functions, not for PHP internal 
functions
+       *   (reflection does not support retrieving number/type of params for 
those)
+       * - functions returning php objects will generate special xmlrpc 
responses:
+       *   when the xmlrpc decoding of those responses is carried out by this 
same lib, using
+       *   the appropriate param in php_xmlrpc_decode, the php objects will be 
rebuilt.
+       *   In short: php objects can be serialized, too (except for their 
resource members),
+       *   using this function.
+       *   Other libs might choke on the very same xml that will be generated 
in this case
+       *   (i.e. it has a nonstandard attribute on struct element tags)
+       * - usage of javadoc @param tags using param names in a different order 
from the
+       *   function prototype is not considered valid (to be fixed?)
+       *
+       * Note that since rel. 2.0RC3 the preferred method to have the server 
call 'standard'
+       * php functions (ie. functions not expecting a single xmlrpcmsg obj as 
parameter)
+       * is by making use of the functions_parameters_type class member.
+       *
+       * @param string $funcname the name of the PHP user function to be 
exposed as xmlrpc method; array($obj, 'methodname') and array('class', 
'methodname') are ok too
+       * @param string $newfuncname (optional) name for function to be created
+       * @param array $extra_options (optional) array of options for 
conversion. valid values include:
+       *        bool  return_source when true, php code w. function definition 
will be returned, not evaluated
+       *        bool  encode_php_objs let php objects be sent to server using 
the 'improved' xmlrpc notation, so server can deserialize them as php objects
+       *        bool  decode_php_objs --- WARNING !!! possible security 
hazard. only use it with trusted servers ---
+       *        bool  suppress_warnings  remove from produced xml any runtime 
warnings due to the php function being invoked
+       * @return false on error, or an array containing the name of the new 
php function,
+       *         its signature and docs, to be used in the server dispatch map
+       *
+       * @todo decide how to deal with params passed by ref: bomb out or allow?
+       * @todo finish using javadoc info to build method sig if all params are 
named but out of order
+       * @todo add a check for params of 'resource' type
+       * @todo add some trigger_errors / error_log when returning false?
+       * @todo what to do when the PHP function returns NULL? we are currently 
returning an empty string value...
+       * @todo add an option to suppress php warnings in invocation of user 
function, similar to server debug level 3?
+       * @todo if $newfuncname is empty, we could use create_user_func instead 
of eval, as it is possibly faster
+       * @todo add a verbatim_object_copy parameter to allow avoiding the same 
obj instance?
+       */
+       function wrap_php_function($funcname, $newfuncname='', 
$extra_options=array())
+       {
+               $buildit = isset($extra_options['return_source']) ? 
!($extra_options['return_source']) : true;
+               $prefix = isset($extra_options['prefix']) ? 
$extra_options['prefix'] : 'xmlrpc';
+               $encode_php_objects = isset($extra_options['encode_php_objs']) 
? (bool)$extra_options['encode_php_objs'] : false;
+               $decode_php_objects = isset($extra_options['decode_php_objs']) 
? (bool)$extra_options['decode_php_objs'] : false;
+               $catch_warnings = isset($extra_options['suppress_warnings']) && 
$extra_options['suppress_warnings'] ? '@' : '';
+
+               if(version_compare(phpversion(), '5.0.3') == -1)
+               {
+                       // up to php 5.0.3 some useful reflection methods were 
missing
+                       error_log('XML-RPC: cannot not wrap php functions 
unless running php version bigger than 5.0.3');
+                       return false;
+               }
+
+        $exists = false;
+           if (is_string($funcname) && strpos($funcname, '::') !== false)
+           {
+               $funcname = explode('::', $funcname);
+           }
+        if(is_array($funcname))
+        {
+            if(count($funcname) < 2 || (!is_string($funcname[0]) && 
!is_object($funcname[0])))
+            {
+                       error_log('XML-RPC: syntax for function to be wrapped 
is wrong');
+                       return false;
+            }
+            if(is_string($funcname[0]))
+            {
+                $plainfuncname = implode('::', $funcname);
+            }
+            elseif(is_object($funcname[0]))
+            {
+                $plainfuncname = get_class($funcname[0]) . '->' . $funcname[1];
+            }
+            $exists = method_exists($funcname[0], $funcname[1]);
+            if (!$exists && version_compare(phpversion(), '5.1') < 0)
+            {
+               // workaround for php 5.0: static class methods are not seen by 
method_exists
+               $exists = is_callable( $funcname );
+            }
+        }
+        else
+        {
+            $plainfuncname = $funcname;
+            $exists = function_exists($funcname);
+        }
+
+               if(!$exists)
+               {
+                       error_log('XML-RPC: function to be wrapped is not 
defined: '.$plainfuncname);
+                       return false;
+               }
+               else
+               {
+                       // determine name of new php function
+                       if($newfuncname == '')
+                       {
+                               if(is_array($funcname))
+                               {
+                               if(is_string($funcname[0]))
+                                       $xmlrpcfuncname = 
"{$prefix}_".implode('_', $funcname);
+                               else
+                                       $xmlrpcfuncname = 
"{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1];
+                               }
+                               else
+                               {
+                                       $xmlrpcfuncname = "{$prefix}_$funcname";
+                               }
+                       }
+                       else
+                       {
+                               $xmlrpcfuncname = $newfuncname;
+                       }
+                       while($buildit && function_exists($xmlrpcfuncname))
+                       {
+                               $xmlrpcfuncname .= 'x';
+                       }
+
+                       // start to introspect PHP code
+                       if(is_array($funcname))
+                       {
+                       $func = new ReflectionMethod($funcname[0], 
$funcname[1]);
+                       if($func->isPrivate())
+                       {
+                               error_log('XML-RPC: method to be wrapped is 
private: '.$plainfuncname);
+                               return false;
+                       }
+                       if($func->isProtected())
+                       {
+                               error_log('XML-RPC: method to be wrapped is 
protected: '.$plainfuncname);
+                               return false;
+                       }
+                       if($func->isConstructor())
+                       {
+                               error_log('XML-RPC: method to be wrapped is the 
constructor: '.$plainfuncname);
+                               return false;
+                       }
+                           // php 503 always says isdestructor = true...
+                if( version_compare(phpversion(), '5.0.3') != 0 && 
$func->isDestructor())
+                       {
+                               error_log('XML-RPC: method to be wrapped is the 
destructor: '.$plainfuncname);
+                               return false;
+                       }
+                       if($func->isAbstract())
+                       {
+                               error_log('XML-RPC: method to be wrapped is 
abstract: '.$plainfuncname);
+                               return false;
+                       }
+                /// @todo add more checks for static vs. nonstatic?
+            }
+                       else
+                       {
+                       $func = new ReflectionFunction($funcname);
+            }
+                       if($func->isInternal())
+                       {
+                               // Note: from PHP 5.1.0 onward, we will 
possibly be able to use invokeargs
+                               // instead of getparameters to fully reflect 
internal php functions ?
+                               error_log('XML-RPC: function to be wrapped is 
internal: '.$plainfuncname);
+                               return false;
+                       }
+
+                       // retrieve parameter names, types and description from 
javadoc comments
+
+                       // function description
+                       $desc = '';
+                       // type of return val: by default 'any'
+                       $returns = $GLOBALS['xmlrpcValue'];
+                       // desc of return val
+                       $returnsDocs = '';
+                       // type + name of function parameters
+                       $paramDocs = array();
+
+                       $docs = $func->getDocComment();
+                       if($docs != '')
+                       {
+                               $docs = explode("\n", $docs);
+                               $i = 0;
+                               foreach($docs as $doc)
+                               {
+                                       $doc = trim($doc, " \r\t/*");
+                                       if(strlen($doc) && strpos($doc, '@') 
!== 0 && !$i)
+                                       {
+                                               if($desc)
+                                               {
+                                                       $desc .= "\n";
+                                               }
+                                               $desc .= $doc;
+                                       }
+                                       elseif(strpos($doc, '@param') === 0)
+                                       {
+                                               // syntax: @param type [$name] 
desc
+                                               
if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches))
+                                               {
+                                                       if(strpos($matches[1], 
'|'))
+                                                       {
+                                                               
//$paramDocs[$i]['type'] = explode('|', $matches[1]);
+                                                               
$paramDocs[$i]['type'] = 'mixed';
+                                                       }
+                                                       else
+                                                       {
+                                                               
$paramDocs[$i]['type'] = $matches[1];
+                                                       }
+                                                       $paramDocs[$i]['name'] 
= trim($matches[2]);
+                                                       $paramDocs[$i]['doc'] = 
$matches[3];
+                                               }
+                                               $i++;
+                                       }
+                                       elseif(strpos($doc, '@return') === 0)
+                                       {
+                                               // syntax: @return type desc
+                                               //$returns = 
preg_split('/\s+/', $doc);
+                                               
if(preg_match('/@return\s+(\S+)\s+(.+)/', $doc, $matches))
+                                               {
+                                                       $returns = 
php_2_xmlrpc_type($matches[1]);
+                                                       if(isset($matches[2]))
+                                                       {
+                                                               $returnsDocs = 
$matches[2];
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+
+                       // execute introspection of actual function prototype
+                       $params = array();
+                       $i = 0;
+                       foreach($func->getParameters() as $paramobj)
+                       {
+                               $params[$i] = array();
+                               $params[$i]['name'] = '$'.$paramobj->getName();
+                               $params[$i]['isoptional'] = 
$paramobj->isOptional();
+                               $i++;
+                       }
+
+
+                       // start  building of PHP code to be eval'd
+                       $innercode = '';
+                       $i = 0;
+                       $parsvariations = array();
+                       $pars = array();
+                       $pnum = count($params);
+                       foreach($params as $param)
+                       {
+                               if (isset($paramDocs[$i]['name']) && 
$paramDocs[$i]['name'] && strtolower($paramDocs[$i]['name']) != 
strtolower($param['name']))
+                               {
+                                       // param name from phpdoc info does not 
match param definition!
+                                       $paramDocs[$i]['type'] = 'mixed';
+                               }
+
+                               if($param['isoptional'])
+                               {
+                                       // this particular parameter is 
optional. save as valid previous list of parameters
+                                       $innercode .= "if (\$paramcount > $i) 
{\n";
+                                       $parsvariations[] = $pars;
+                               }
+                               $innercode .= "\$p$i = \$msg->getParam($i);\n";
+                               if ($decode_php_objects)
+                               {
+                                       $innercode .= "if (\$p{$i}->kindOf() == 
'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = 
php_{$prefix}_decode(\$p$i, array('decode_php_objs'));\n";
+                               }
+                               else
+                               {
+                                       $innercode .= "if (\$p{$i}->kindOf() == 
'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = 
php_{$prefix}_decode(\$p$i);\n";
+                               }
+
+                               $pars[] = "\$p$i";
+                               $i++;
+                               if($param['isoptional'])
+                               {
+                                       $innercode .= "}\n";
+                               }
+                               if($i == $pnum)
+                               {
+                                       // last allowed parameters combination
+                                       $parsvariations[] = $pars;
+                               }
+                       }
+
+                       $sigs = array();
+                       $psigs = array();
+                       if(count($parsvariations) == 0)
+                       {
+                               // only known good synopsis = no parameters
+                               $parsvariations[] = array();
+                               $minpars = 0;
+                       }
+                       else
+                       {
+                               $minpars = count($parsvariations[0]);
+                       }
+
+                       if($minpars)
+                       {
+                               // add to code the check for min params number
+                               // NB: this check needs to be done BEFORE 
decoding param values
+                               $innercode = "\$paramcount = 
\$msg->getNumParams();\n" .
+                               "if (\$paramcount < $minpars) return new 
{$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, 
'{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode;
+                       }
+                       else
+                       {
+                               $innercode = "\$paramcount = 
\$msg->getNumParams();\n" . $innercode;
+                       }
+
+                       $innercode .= "\$np = false;\n";
+                       // since there are no closures in php, if we are given 
an object instance,
+            // we store a pointer to it in a global var...
+                       if ( is_array($funcname) && is_object($funcname[0]) )
+                       {
+                           $GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] =& 
$funcname[0];
+                           $innercode .= "\$obj =& 
\$GLOBALS['xmlrpcWPFObjHolder']['$xmlrpcfuncname'];\n";
+                           $realfuncname = '$obj->'.$funcname[1];
+                       }
+                       else
+                       {
+                       $realfuncname = $plainfuncname;
+            }
+                       foreach($parsvariations as $pars)
+                       {
+                               $innercode .= "if (\$paramcount == " . 
count($pars) . ") \$retval = {$catch_warnings}$realfuncname(" . implode(',', 
$pars) . "); else\n";
+                               // build a 'generic' signature (only use an 
appropriate return type)
+                               $sig = array($returns);
+                               $psig = array($returnsDocs);
+                               for($i=0; $i < count($pars); $i++)
+                               {
+                                       if (isset($paramDocs[$i]['type']))
+                                       {
+                                               $sig[] = 
php_2_xmlrpc_type($paramDocs[$i]['type']);
+                                       }
+                                       else
+                                       {
+                                               $sig[] = 
$GLOBALS['xmlrpcValue'];
+                                       }
+                                       $psig[] = isset($paramDocs[$i]['doc']) 
? $paramDocs[$i]['doc'] : '';
+                               }
+                               $sigs[] = $sig;
+                               $psigs[] = $psig;
+                       }
+                       $innercode .= "\$np = true;\n";
+                       $innercode .= "if (\$np) return new {$prefix}resp(0, 
{$GLOBALS['xmlrpcerr']['incorrect_params']}, 
'{$GLOBALS['xmlrpcstr']['incorrect_params']}'); else {\n";
+                       //$innercode .= "if (\$_xmlrpcs_error_occurred) return 
new xmlrpcresp(0, $GLOBALS['xmlrpcerr']user, \$_xmlrpcs_error_occurred); 
else\n";
+                       $innercode .= "if (is_a(\$retval, '{$prefix}resp')) 
return \$retval; else\n";
+                       if($returns == $GLOBALS['xmlrpcDateTime'] || $returns 
== $GLOBALS['xmlrpcBase64'])
+                       {
+                               $innercode .= "return new {$prefix}resp(new 
{$prefix}val(\$retval, '$returns'));";
+                       }
+                       else
+                       {
+                               if ($encode_php_objects)
+                                       $innercode .= "return new 
{$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n";
+                               else
+                                       $innercode .= "return new 
{$prefix}resp(php_{$prefix}_encode(\$retval));\n";
+                       }
+                       // shall we exclude functions returning by ref?
+                       // if($func->returnsReference())
+                       //      return false;
+                       $code = "function $xmlrpcfuncname(\$msg) {\n" . 
$innercode . "}\n}";
+                       //print_r($code);
+                       if ($buildit)
+                       {
+                               $allOK = 0;
+                               eval($code.'$allOK=1;');
+                               // alternative
+                               //$xmlrpcfuncname = create_function('$m', 
$innercode);
+
+                               if(!$allOK)
+                               {
+                                       error_log('XML-RPC: could not create 
function '.$xmlrpcfuncname.' to wrap php function '.$plainfuncname);
+                                       return false;
+                               }
+                       }
+
+                       /// @todo examine if $paramDocs matches $parsvariations 
and build array for
+                       /// usage as method signature, plus put together a nice 
string for docs
+
+                       $ret = array('function' => $xmlrpcfuncname, 'signature' 
=> $sigs, 'docstring' => $desc, 'signature_docs' => $psigs, 'source' => $code);
+                       return $ret;
+               }
+       }
+
+    /**
+    * Given a user-defined PHP class or php object, map its methods onto a 
list of
+       * PHP 'wrapper' functions that can be exposed as xmlrpc methods from an 
xmlrpc_server
+       * object and called from remote clients (as well as their corresponding 
signature info).
+       *
+    * @param mixed $classname the name of the class whose methods are to be 
exposed as xmlrpc methods, or an object instance of that class
+    * @param array $extra_options see the docs for wrap_php_method for more 
options
+    *        string method_type 'static', 'nonstatic', 'all' and 'auto' 
(default); the latter will switch between static and non-static depending on 
wheter $classname is a class name or object instance
+    * @return array or false on failure
+    *
+    * @todo get_class_methods will return both static and non-static methods.
+    *       we have to differentiate the action, depending on wheter we 
recived a class name or object
+    */
+    function wrap_php_class($classname, $extra_options=array())
+    {
+               $methodfilter = isset($extra_options['method_filter']) ? 
$extra_options['method_filter'] : '';
+               $methodtype = isset($extra_options['method_type']) ? 
$extra_options['method_type'] : 'auto';
+
+        if(version_compare(phpversion(), '5.0.3') == -1)
+               {
+                       // up to php 5.0.3 some useful reflection methods were 
missing
+                       error_log('XML-RPC: cannot not wrap php functions 
unless running php version bigger than 5.0.3');
+                       return false;
+               }
+
+        $result = array();
+               $mlist = get_class_methods($classname);
+               foreach($mlist as $mname)
+               {
+               if ($methodfilter == '' || preg_match($methodfilter, $mname))
+                       {
+                       // echo $mlist."\n";
+                       $func = new ReflectionMethod($classname, $mname);
+                       if(!$func->isPrivate() && !$func->isProtected() && 
!$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract())
+                       {
+                               if(($func->isStatic && ($methodtype == 'all' || 
$methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) ||
+                               (!$func->isStatic && ($methodtype == 'all' || 
$methodtype == 'nonstatic' || ($methodtype == 'auto' && 
is_object($classname)))))
+                       {
+                        $methodwrap = wrap_php_function(array($classname, 
$mname), '', $extra_options);
+                        if ( $methodwrap )
+                        {
+                            $result[$methodwrap['function']] = 
$methodwrap['function'];
+                        }
+                    }
+                       }
+                       }
+               }
+        return $result;
+    }
+
+       /**
+       * Given an xmlrpc client and a method name, register a php wrapper 
function
+       * that will call it and return results using native php types for both
+       * params and results. The generated php function will return an 
xmlrpcresp
+       * oject for failed xmlrpc calls
+       *
+       * Known limitations:
+       * - server must support system.methodsignature for the wanted xmlrpc 
method
+       * - for methods that expose many signatures, only one can be picked (we
+       *   could in priciple check if signatures differ only by number of 
params
+       *   and not by type, but it would be more complication than we can 
spare time)
+       * - nested xmlrpc params: the caller of the generated php function has 
to
+       *   encode on its own the params passed to the php function if these 
are structs
+       *   or arrays whose (sub)members include values of type datetime or 
base64
+       *
+       * Notes: the connection properties of the given client will be copied
+       * and reused for the connection used during the call to the generated
+       * php function.
+       * Calling the generated php function 'might' be slow: a new xmlrpc 
client
+       * is created on every invocation and an xmlrpc-connection opened+closed.
+       * An extra 'debug' param is appended to param list of xmlrpc method, 
useful
+       * for debugging purposes.
+       *
+       * @param xmlrpc_client $client     an xmlrpc client set up correctly to 
communicate with target server
+       * @param string        $methodname the xmlrpc method to be mapped to a 
php function
+       * @param array         $extra_options array of options that specify 
conversion details. valid ptions include
+       *        integer       signum      the index of the method signature to 
use in mapping (if method exposes many sigs)
+       *        integer       timeout     timeout (in secs) to be used when 
executing function/calling remote method
+       *        string        protocol    'http' (default), 'http11' or 'https'
+       *        string        new_function_name the name of php function to 
create. If unsepcified, lib will pick an appropriate name
+       *        string        return_source if true return php code w. 
function definition instead fo function name
+       *        bool          encode_php_objs let php objects be sent to 
server using the 'improved' xmlrpc notation, so server can deserialize them as 
php objects
+       *        bool          decode_php_objs --- WARNING !!! possible 
security hazard. only use it with trusted servers ---
+       *        mixed         return_on_fault a php value to be returned when 
the xmlrpc call fails/returns a fault response (by default the xmlrpcresp 
object is returned in this case). If a string is used, '%faultCode%' and 
'%faultString%' tokens will be substituted with actual error values
+       *        bool          debug        set it to 1 or 2 to see debug 
results of querying server for method synopsis
+       * @return string                   the name of the generated php 
function (or false) - OR AN ARRAY...
+       */
+       function wrap_xmlrpc_method($client, $methodname, $extra_options=0, 
$timeout=0, $protocol='', $newfuncname='')
+       {
+               // mind numbing: let caller use sane calling convention (as per 
javadoc, 3 params),
+               // OR the 2.0 calling convention (no options) - we really love 
backward compat, don't we?
+               if (!is_array($extra_options))
+               {
+                       $signum = $extra_options;
+                       $extra_options = array();
+               }
+               else
+               {
+                       $signum = isset($extra_options['signum']) ? 
(int)$extra_options['signum'] : 0;
+                       $timeout = isset($extra_options['timeout']) ? 
(int)$extra_options['timeout'] : 0;
+                       $protocol = isset($extra_options['protocol']) ? 
$extra_options['protocol'] : '';
+                       $newfuncname = 
isset($extra_options['new_function_name']) ? 
$extra_options['new_function_name'] : '';
+               }
+               //$encode_php_objects = in_array('encode_php_objects', 
$extra_options);
+               //$verbatim_client_copy = in_array('simple_client_copy', 
$extra_options) ? 1 :
+               //      in_array('build_class_code', $extra_options) ? 2 : 0;
+
+               $encode_php_objects = isset($extra_options['encode_php_objs']) 
? (bool)$extra_options['encode_php_objs'] : false;
+               $decode_php_objects = isset($extra_options['decode_php_objs']) 
? (bool)$extra_options['decode_php_objs'] : false;
+               $simple_client_copy = 
isset($extra_options['simple_client_copy']) ? 
(int)($extra_options['simple_client_copy']) : 0;
+               $buildit = isset($extra_options['return_source']) ? 
!($extra_options['return_source']) : true;
+               $prefix = isset($extra_options['prefix']) ? 
$extra_options['prefix'] : 'xmlrpc';
+               if (isset($extra_options['return_on_fault']))
+               {
+                       $decode_fault = true;
+                       $fault_response = $extra_options['return_on_fault'];
+               }
+               else
+               {
+                       $decode_fault = false;
+                       $fault_response = '';
+               }
+               $debug = isset($extra_options['debug']) ? 
($extra_options['debug']) : 0;
+
+               $msgclass = $prefix.'msg';
+               $valclass = $prefix.'val';
+               $decodefunc = 'php_'.$prefix.'_decode';
+
+               $msg = new $msgclass('system.methodSignature');
+               $msg->addparam(new $valclass($methodname));
+               $client->setDebug($debug);
+               $response =& $client->send($msg, $timeout, $protocol);
+               if($response->faultCode())
+               {
+                       error_log('XML-RPC: could not retrieve method signature 
from remote server for method '.$methodname);
+                       return false;
+               }
+               else
+               {
+                       $msig = $response->value();
+                       if ($client->return_type != 'phpvals')
+                       {
+                               $msig = $decodefunc($msig);
+                       }
+                       if(!is_array($msig) || count($msig) <= $signum)
+                       {
+                               error_log('XML-RPC: could not retrieve method 
signature nr.'.$signum.' from remote server for method '.$methodname);
+                               return false;
+                       }
+                       else
+                       {
+                               // pick a suitable name for the new function, 
avoiding collisions
+                               if($newfuncname != '')
+                               {
+                                       $xmlrpcfuncname = $newfuncname;
+                               }
+                               else
+                               {
+                                       // take care to insure that methodname 
is translated to valid
+                                       // php function name
+                                       $xmlrpcfuncname = 
$prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
+                                               array('_', ''), $methodname);
+                               }
+                               while($buildit && 
function_exists($xmlrpcfuncname))
+                               {
+                                       $xmlrpcfuncname .= 'x';
+                               }
+
+                               $msig = $msig[$signum];
+                               $mdesc = '';
+                               // if in 'offline' mode, get method description 
too.
+                               // in online mode, favour speed of operation
+                               if(!$buildit)
+                               {
+                                       $msg = new 
$msgclass('system.methodHelp');
+                                       $msg->addparam(new 
$valclass($methodname));
+                                       $response =& $client->send($msg, 
$timeout, $protocol);
+                                       if (!$response->faultCode())
+                                       {
+                                               $mdesc = $response->value();
+                                               if ($client->return_type != 
'phpvals')
+                                               {
+                                                       $mdesc = 
$mdesc->scalarval();
+                                               }
+                                       }
+                               }
+
+                               $results = 
build_remote_method_wrapper_code($client, $methodname,
+                                       $xmlrpcfuncname, $msig, $mdesc, 
$timeout, $protocol, $simple_client_copy,
+                                       $prefix, $decode_php_objects, 
$encode_php_objects, $decode_fault,
+                                       $fault_response);
+
+                               //print_r($code);
+                               if ($buildit)
+                               {
+                                       $allOK = 0;
+                                       eval($results['source'].'$allOK=1;');
+                                       // alternative
+                                       //$xmlrpcfuncname = 
create_function('$m', $innercode);
+                                       if($allOK)
+                                       {
+                                               return $xmlrpcfuncname;
+                                       }
+                                       else
+                                       {
+                                               error_log('XML-RPC: could not 
create function '.$xmlrpcfuncname.' to wrap remote method '.$methodname);
+                                               return false;
+                                       }
+                               }
+                               else
+                               {
+                                       $results['function'] = $xmlrpcfuncname;
+                                       return $results;
+                               }
+                       }
+               }
+       }
+
+       /**
+       * Similar to wrap_xmlrpc_method, but will generate a php class that 
wraps
+       * all xmlrpc methods exposed by the remote server as own methods.
+       * For more details see wrap_xmlrpc_method.
+       * @param xmlrpc_client $client the client obj all set to query the 
desired server
+       * @param array $extra_options list of options for wrapped code
+       * @return mixed false on error, the name of the created class if all ok 
or an array with code, class name and comments (if the appropriatevoption is 
set in extra_options)
+       */
+       function wrap_xmlrpc_server($client, $extra_options=array())
+       {
+               $methodfilter = isset($extra_options['method_filter']) ? 
$extra_options['method_filter'] : '';
+               //$signum = isset($extra_options['signum']) ? 
(int)$extra_options['signum'] : 0;
+               $timeout = isset($extra_options['timeout']) ? 
(int)$extra_options['timeout'] : 0;
+               $protocol = isset($extra_options['protocol']) ? 
$extra_options['protocol'] : '';
+               $newclassname = isset($extra_options['new_class_name']) ? 
$extra_options['new_class_name'] : '';
+               $encode_php_objects = isset($extra_options['encode_php_objs']) 
? (bool)$extra_options['encode_php_objs'] : false;
+               $decode_php_objects = isset($extra_options['decode_php_objs']) 
? (bool)$extra_options['decode_php_objs'] : false;
+               $verbatim_client_copy = 
isset($extra_options['simple_client_copy']) ? 
!($extra_options['simple_client_copy']) : true;
+               $buildit = isset($extra_options['return_source']) ? 
!($extra_options['return_source']) : true;
+               $prefix = isset($extra_options['prefix']) ? 
$extra_options['prefix'] : 'xmlrpc';
+
+               $msgclass = $prefix.'msg';
+               //$valclass = $prefix.'val';
+               $decodefunc = 'php_'.$prefix.'_decode';
+
+               $msg = new $msgclass('system.listMethods');
+               $response =& $client->send($msg, $timeout, $protocol);
+               if($response->faultCode())
+               {
+                       error_log('XML-RPC: could not retrieve method list from 
remote server');
+                       return false;
+               }
+               else
+               {
+                       $mlist = $response->value();
+                       if ($client->return_type != 'phpvals')
+                       {
+                               $mlist = $decodefunc($mlist);
+                       }
+                       if(!is_array($mlist) || !count($mlist))
+                       {
+                               error_log('XML-RPC: could not retrieve 
meaningful method list from remote server');
+                               return false;
+                       }
+                       else
+                       {
+                               // pick a suitable name for the new function, 
avoiding collisions
+                               if($newclassname != '')
+                               {
+                                       $xmlrpcclassname = $newclassname;
+                               }
+                               else
+                               {
+                                       $xmlrpcclassname = 
$prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
+                                               array('_', ''), 
$client->server).'_client';
+                               }
+                               while($buildit && 
class_exists($xmlrpcclassname))
+                               {
+                                       $xmlrpcclassname .= 'x';
+                               }
+
+                               /// @todo add function setdebug() to new class, 
to enable/disable debugging
+                               $source = "class $xmlrpcclassname\n{\nvar 
\$client;\n\n";
+                               $source .= "function $xmlrpcclassname()\n{\n";
+                               $source .= build_client_wrapper_code($client, 
$verbatim_client_copy, $prefix);
+                               $source .= "\$this->client =& \$client;\n}\n\n";
+                               $opts = array('simple_client_copy' => 2, 
'return_source' => true,
+                                       'timeout' => $timeout, 'protocol' => 
$protocol,
+                                       'encode_php_objs' => 
$encode_php_objects, 'prefix' => $prefix,
+                                       'decode_php_objs' => $decode_php_objects
+                                       );
+                               /// @todo build javadoc for class definition, 
too
+                               foreach($mlist as $mname)
+                               {
+                                       if ($methodfilter == '' || 
preg_match($methodfilter, $mname))
+                                       {
+                                               $opts['new_function_name'] = 
preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
+                                                       array('_', ''), $mname);
+                                               $methodwrap = 
wrap_xmlrpc_method($client, $mname, $opts);
+                                               if ($methodwrap)
+                                               {
+                                                       if (!$buildit)
+                                                       {
+                                                               $source .= 
$methodwrap['docstring'];
+                                                       }
+                                                       $source .= 
$methodwrap['source']."\n";
+                                               }
+                                               else
+                                               {
+                                                       error_log('XML-RPC: 
will not create class method to wrap remote method '.$mname);
+                                               }
+                                       }
+                               }
+                               $source .= "}\n";
+                               if ($buildit)
+                               {
+                                       $allOK = 0;
+                                       eval($source.'$allOK=1;');
+                                       // alternative
+                                       //$xmlrpcfuncname = 
create_function('$m', $innercode);
+                                       if($allOK)
+                                       {
+                                               return $xmlrpcclassname;
+                                       }
+                                       else
+                                       {
+                                               error_log('XML-RPC: could not 
create class '.$xmlrpcclassname.' to wrap remote server '.$client->server);
+                                               return false;
+                                       }
+                               }
+                               else
+                               {
+                                       return array('class' => 
$xmlrpcclassname, 'code' => $source, 'docstring' => '');
+                               }
+                       }
+               }
+       }
+
+       /**
+       * Given the necessary info, build php code that creates a new function 
to
+       * invoke a remote xmlrpc method.
+       * Take care that no full checking of input parameters is done to ensure 
that
+       * valid php code is emitted.
+       * Note: real spaghetti code follows...
+       * @access private
+       */
+       function build_remote_method_wrapper_code($client, $methodname, 
$xmlrpcfuncname,
+               $msig, $mdesc='', $timeout=0, $protocol='', 
$client_copy_mode=0, $prefix='xmlrpc',
+               $decode_php_objects=false, $encode_php_objects=false, 
$decode_fault=false,
+               $fault_response='')
+       {
+               $code = "function $xmlrpcfuncname (";
+               if ($client_copy_mode < 2)
+               {
+                       // client copy mode 0 or 1 == partial / full client 
copy in emitted code
+                       $innercode = build_client_wrapper_code($client, 
$client_copy_mode, $prefix);
+                       $innercode .= "\$client->setDebug(\$debug);\n";
+                       $this_ = '';
+               }
+               else
+               {
+                       // client copy mode 2 == no client copy in emitted code
+                       $innercode = '';
+                       $this_ = 'this->';
+               }
+               $innercode .= "\$msg = new {$prefix}msg('$methodname');\n";
+
+               if ($mdesc != '')
+               {
+                       // take care that PHP comment is not terminated 
unwillingly by method description
+                       $mdesc = "/**\n* ".str_replace('*/', '* /', 
$mdesc)."\n";
+               }
+               else
+               {
+                       $mdesc = "/**\nFunction $xmlrpcfuncname\n";
+               }
+
+               // param parsing
+               $plist = array();
+               $pcount = count($msig);
+               for($i = 1; $i < $pcount; $i++)
+               {
+                       $plist[] = "\$p$i";
+                       $ptype = $msig[$i];
+                       if($ptype == 'i4' || $ptype == 'int' || $ptype == 
'boolean' || $ptype == 'double' ||
+                               $ptype == 'string' || $ptype == 
'dateTime.iso8601' || $ptype == 'base64' || $ptype == 'null')
+                       {
+                               // only build directly xmlrpcvals when type is 
known and scalar
+                               $innercode .= "\$p$i = new {$prefix}val(\$p$i, 
'$ptype');\n";
+                       }
+                       else
+                       {
+                               if ($encode_php_objects)
+                               {
+                                       $innercode .= "\$p$i =& 
php_{$prefix}_encode(\$p$i, array('encode_php_objs'));\n";
+                               }
+                               else
+                               {
+                                       $innercode .= "\$p$i =& 
php_{$prefix}_encode(\$p$i);\n";
+                               }
+                       }
+                       $innercode .= "\$msg->addparam(\$p$i);\n";
+                       $mdesc .= '* @param '.xmlrpc_2_php_type($ptype)." 
\$p$i\n";
+               }
+               if ($client_copy_mode < 2)
+               {
+                       $plist[] = '$debug=0';
+                       $mdesc .= "* @param int \$debug when 1 (or 2) will 
enable debugging of the underlying {$prefix} call (defaults to 0)\n";
+               }
+               $plist = implode(', ', $plist);
+               $mdesc .= '* @return '.xmlrpc_2_php_type($msig[0])." (or an 
{$prefix}resp obj instance if call fails)\n*/\n";
+
+               $innercode .= "\$res =& \${$this_}client->send(\$msg, $timeout, 
'$protocol');\n";
+               if ($decode_fault)
+               {
+                       if (is_string($fault_response) && 
((strpos($fault_response, '%faultCode%') !== false) || (strpos($fault_response, 
'%faultString%') !== false)))
+                       {
+                               $respcode = "str_replace(array('%faultCode%', 
'%faultString%'), array(\$res->faultCode(), \$res->faultString()), 
'".str_replace("'", "''", $fault_response)."')";
+                       }
+                       else
+                       {
+                               $respcode = var_export($fault_response, true);
+                       }
+               }
+               else
+               {
+                       $respcode = '$res';
+               }
+               if ($decode_php_objects)
+               {
+                       $innercode .= "if (\$res->faultcode()) return 
$respcode; else return php_{$prefix}_decode(\$res->value(), 
array('decode_php_objs'));";
+               }
+               else
+               {
+                       $innercode .= "if (\$res->faultcode()) return 
$respcode; else return php_{$prefix}_decode(\$res->value());";
+               }
+
+               $code = $code . $plist. ") {\n" . $innercode . "\n}\n";
+
+               return array('source' => $code, 'docstring' => $mdesc);
+       }
+
+       /**
+       * Given necessary info, generate php code that will rebuild a client 
object
+       * Take care that no full checking of input parameters is done to ensure 
that
+       * valid php code is emitted.
+       * @access private
+       */
+       function build_client_wrapper_code($client, $verbatim_client_copy, 
$prefix='xmlrpc')
+       {
+               $code = "\$client = new {$prefix}_client('".str_replace("'", 
"\'", $client->path).
+                       "', '" . str_replace("'", "\'", $client->server) . "', 
$client->port);\n";
+
+               // copy all client fields to the client that will be generated 
runtime
+               // (this provides for future expansion or subclassing of client 
obj)
+               if ($verbatim_client_copy)
+               {
+                       foreach($client as $fld => $val)
+                       {
+                               if($fld != 'debug' && $fld != 'return_type')
+                               {
+                                       $val = var_export($val, true);
+                                       $code .= "\$client->$fld = $val;\n";
+                               }
+                       }
+               }
+               // only make sure that client always returns the correct data 
type
+               $code .= "\$client->return_type = '{$prefix}vals';\n";
+               //$code .= "\$client->setDebug(\$debug);\n";
+               return $code;
+       }
+?>
\ No newline at end of file

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpcs.inc
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpcs.inc           
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/lib/xmlrpcs.inc   
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,1246 @@
+<?php
+// by Edd Dumbill (C) 1999-2002
+// <address@hidden>
+// $Id: xmlrpcs.inc,v 1.71 2008/10/29 23:41:28 ggiunta Exp $
+
+// Copyright (c) 1999,2000,2002 Edd Dumbill.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+//    * Redistributions of source code must retain the above copyright
+//      notice, this list of conditions and the following disclaimer.
+//
+//    * Redistributions in binary form must reproduce the above
+//      copyright notice, this list of conditions and the following
+//      disclaimer in the documentation and/or other materials provided
+//      with the distribution.
+//
+//    * Neither the name of the "XML-RPC for PHP" nor the names of its
+//      contributors may be used to endorse or promote products derived
+//      from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+// OF THE POSSIBILITY OF SUCH DAMAGE.
+
+       // XML RPC Server class
+       // requires: xmlrpc.inc
+
+       $GLOBALS['xmlrpcs_capabilities'] = array(
+               // xmlrpc spec: always supported
+               'xmlrpc' => new xmlrpcval(array(
+                       'specUrl' => new 
xmlrpcval('http://www.xmlrpc.com/spec', 'string'),
+                       'specVersion' => new xmlrpcval(1, 'int')
+               ), 'struct'),
+               // if we support system.xxx functions, we always support 
multicall, too...
+               // Note that, as of 2006/09/17, the following URL does not 
respond anymore
+               'system.multicall' => new xmlrpcval(array(
+                       'specUrl' => new 
xmlrpcval('http://www.xmlrpc.com/discuss/msgReader$1208', 'string'),
+                       'specVersion' => new xmlrpcval(1, 'int')
+               ), 'struct'),
+               // introspection: version 2! we support 'mixed', too
+               'introspection' => new xmlrpcval(array(
+                       'specUrl' => new 
xmlrpcval('http://phpxmlrpc.sourceforge.net/doc-2/ch10.html', 'string'),
+                       'specVersion' => new xmlrpcval(2, 'int')
+               ), 'struct')
+       );
+
+       /* Functions that implement system.XXX methods of xmlrpc servers */
+       $_xmlrpcs_getCapabilities_sig=array(array($GLOBALS['xmlrpcStruct']));
+       $_xmlrpcs_getCapabilities_doc='This method lists all the capabilites 
that the XML-RPC server has: the (more or less standard) extensions to the 
xmlrpc spec that it adheres to';
+       $_xmlrpcs_getCapabilities_sdoc=array(array('list of capabilities, 
described as structs with a version number and url for the spec'));
+       function _xmlrpcs_getCapabilities($server, $m=null)
+       {
+               $outAr = $GLOBALS['xmlrpcs_capabilities'];
+               // NIL extension
+               if ($GLOBALS['xmlrpc_null_extension']) {
+                       $outAr['nil'] = new xmlrpcval(array(
+                               'specUrl' => new 
xmlrpcval('http://www.ontosys.com/xml-rpc/extensions.php', 'string'),
+                               'specVersion' => new xmlrpcval(1, 'int')
+                       ), 'struct');
+               }
+               return new xmlrpcresp(new xmlrpcval($outAr, 'struct'));
+       }
+
+       // listMethods: signature was either a string, or nothing.
+       // The useless string variant has been removed
+       $_xmlrpcs_listMethods_sig=array(array($GLOBALS['xmlrpcArray']));
+       $_xmlrpcs_listMethods_doc='This method lists all the methods that the 
XML-RPC server knows how to dispatch';
+       $_xmlrpcs_listMethods_sdoc=array(array('list of method names'));
+       function _xmlrpcs_listMethods($server, $m=null) // if called in plain 
php values mode, second param is missing
+       {
+
+               $outAr=array();
+               foreach($server->dmap as $key => $val)
+               {
+                       $outAr[]=new xmlrpcval($key, 'string');
+               }
+               if($server->allow_system_funcs)
+               {
+                       foreach($GLOBALS['_xmlrpcs_dmap'] as $key => $val)
+                       {
+                               $outAr[]=new xmlrpcval($key, 'string');
+                       }
+               }
+               return new xmlrpcresp(new xmlrpcval($outAr, 'array'));
+       }
+
+       $_xmlrpcs_methodSignature_sig=array(array($GLOBALS['xmlrpcArray'], 
$GLOBALS['xmlrpcString']));
+       $_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an 
array of arrays) for the method name passed. If no signatures are known, 
returns a none-array (test for type != array to detect missing signature)';
+       $_xmlrpcs_methodSignature_sdoc=array(array('list of known signatures, 
each sig being an array of xmlrpc type names', 'name of method to be 
described'));
+       function _xmlrpcs_methodSignature($server, $m)
+       {
+               // let accept as parameter both an xmlrpcval or string
+               if (is_object($m))
+               {
+                       $methName=$m->getParam(0);
+                       $methName=$methName->scalarval();
+               }
+               else
+               {
+                       $methName=$m;
+               }
+               if(strpos($methName, "system.") === 0)
+               {
+                       $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
+               }
+               else
+               {
+                       $dmap=$server->dmap; $sysCall=0;
+               }
+               if(isset($dmap[$methName]))
+               {
+                       if(isset($dmap[$methName]['signature']))
+                       {
+                               $sigs=array();
+                               foreach($dmap[$methName]['signature'] as $inSig)
+                               {
+                                       $cursig=array();
+                                       foreach($inSig as $sig)
+                                       {
+                                               $cursig[]=new xmlrpcval($sig, 
'string');
+                                       }
+                                       $sigs[]=new xmlrpcval($cursig, 'array');
+                               }
+                               $r=new xmlrpcresp(new xmlrpcval($sigs, 
'array'));
+                       }
+                       else
+                       {
+                               // NB: according to the official docs, we 
should be returning a
+                               // "none-array" here, which means not-an-array
+                               $r=new xmlrpcresp(new xmlrpcval('undef', 
'string'));
+                       }
+               }
+               else
+               {
+                       $r=new 
xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], 
$GLOBALS['xmlrpcstr']['introspect_unknown']);
+               }
+               return $r;
+       }
+
+       $_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], 
$GLOBALS['xmlrpcString']));
+       $_xmlrpcs_methodHelp_doc='Returns help text if defined for the method 
passed, otherwise returns an empty string';
+       $_xmlrpcs_methodHelp_sdoc=array(array('method description', 'name of 
the method to be described'));
+       function _xmlrpcs_methodHelp($server, $m)
+       {
+               // let accept as parameter both an xmlrpcval or string
+               if (is_object($m))
+               {
+                       $methName=$m->getParam(0);
+                       $methName=$methName->scalarval();
+               }
+               else
+               {
+                       $methName=$m;
+               }
+               if(strpos($methName, "system.") === 0)
+               {
+                       $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
+               }
+               else
+               {
+                       $dmap=$server->dmap; $sysCall=0;
+               }
+               if(isset($dmap[$methName]))
+               {
+                       if(isset($dmap[$methName]['docstring']))
+                       {
+                               $r=new xmlrpcresp(new 
xmlrpcval($dmap[$methName]['docstring']), 'string');
+                       }
+                       else
+                       {
+                               $r=new xmlrpcresp(new xmlrpcval('', 'string'));
+                       }
+               }
+               else
+               {
+                       $r=new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['introspect_unknown'], 
$GLOBALS['xmlrpcstr']['introspect_unknown']);
+               }
+               return $r;
+       }
+
+       $_xmlrpcs_multicall_sig = array(array($GLOBALS['xmlrpcArray'], 
$GLOBALS['xmlrpcArray']));
+       $_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. 
See http://www.xmlrpc.com/discuss/msgReader$1208 for details';
+       $_xmlrpcs_multicall_sdoc = array(array('list of response structs, where 
each struct has the usual members', 'list of calls, with each call being 
represented as a struct, with members "methodname" and "params"'));
+       function _xmlrpcs_multicall_error($err)
+       {
+               if(is_string($err))
+               {
+                       $str = $GLOBALS['xmlrpcstr']["multicall_${err}"];
+                       $code = $GLOBALS['xmlrpcerr']["multicall_${err}"];
+               }
+               else
+               {
+                       $code = $err->faultCode();
+                       $str = $err->faultString();
+               }
+               $struct = array();
+               $struct['faultCode'] = new xmlrpcval($code, 'int');
+               $struct['faultString'] = new xmlrpcval($str, 'string');
+               return new xmlrpcval($struct, 'struct');
+       }
+
+       function _xmlrpcs_multicall_do_call($server, $call)
+       {
+               if($call->kindOf() != 'struct')
+               {
+                       return _xmlrpcs_multicall_error('notstruct');
+               }
+               $methName = @$call->structmem('methodName');
+               if(!$methName)
+               {
+                       return _xmlrpcs_multicall_error('nomethod');
+               }
+               if($methName->kindOf() != 'scalar' || $methName->scalartyp() != 
'string')
+               {
+                       return _xmlrpcs_multicall_error('notstring');
+               }
+               if($methName->scalarval() == 'system.multicall')
+               {
+                       return _xmlrpcs_multicall_error('recursion');
+               }
+
+               $params = @$call->structmem('params');
+               if(!$params)
+               {
+                       return _xmlrpcs_multicall_error('noparams');
+               }
+               if($params->kindOf() != 'array')
+               {
+                       return _xmlrpcs_multicall_error('notarray');
+               }
+               $numParams = $params->arraysize();
+
+               $msg = new xmlrpcmsg($methName->scalarval());
+               for($i = 0; $i < $numParams; $i++)
+               {
+                       if(!$msg->addParam($params->arraymem($i)))
+                       {
+                               $i++;
+                               return _xmlrpcs_multicall_error(new 
xmlrpcresp(0,
+                                       
$GLOBALS['xmlrpcerr']['incorrect_params'],
+                                       
$GLOBALS['xmlrpcstr']['incorrect_params'] . ": probable xml error in param " . 
$i));
+                       }
+               }
+
+               $result = $server->execute($msg);
+
+               if($result->faultCode() != 0)
+               {
+                       return _xmlrpcs_multicall_error($result);               
// Method returned fault.
+               }
+
+               return new xmlrpcval(array($result->value()), 'array');
+       }
+
+       function _xmlrpcs_multicall_do_call_phpvals($server, $call)
+       {
+               if(!is_array($call))
+               {
+                       return _xmlrpcs_multicall_error('notstruct');
+               }
+               if(!array_key_exists('methodName', $call))
+               {
+                       return _xmlrpcs_multicall_error('nomethod');
+               }
+               if (!is_string($call['methodName']))
+               {
+                       return _xmlrpcs_multicall_error('notstring');
+               }
+               if($call['methodName'] == 'system.multicall')
+               {
+                       return _xmlrpcs_multicall_error('recursion');
+               }
+               if(!array_key_exists('params', $call))
+               {
+                       return _xmlrpcs_multicall_error('noparams');
+               }
+               if(!is_array($call['params']))
+               {
+                       return _xmlrpcs_multicall_error('notarray');
+               }
+
+               // this is a real dirty and simplistic hack, since we might 
have received a
+               // base64 or datetime values, but they will be listed as 
strings here...
+               $numParams = count($call['params']);
+               $pt = array();
+               foreach($call['params'] as $val)
+                       $pt[] = php_2_xmlrpc_type(gettype($val));
+
+               $result = $server->execute($call['methodName'], 
$call['params'], $pt);
+
+               if($result->faultCode() != 0)
+               {
+                       return _xmlrpcs_multicall_error($result);               
// Method returned fault.
+               }
+
+               return new xmlrpcval(array($result->value()), 'array');
+       }
+
+       function _xmlrpcs_multicall($server, $m)
+       {
+               $result = array();
+               // let accept a plain list of php parameters, beside a single 
xmlrpc msg object
+               if (is_object($m))
+               {
+                       $calls = $m->getParam(0);
+                       $numCalls = $calls->arraysize();
+                       for($i = 0; $i < $numCalls; $i++)
+                       {
+                               $call = $calls->arraymem($i);
+                               $result[$i] = 
_xmlrpcs_multicall_do_call($server, $call);
+                       }
+               }
+               else
+               {
+                       $numCalls=count($m);
+                       for($i = 0; $i < $numCalls; $i++)
+                       {
+                               $result[$i] = 
_xmlrpcs_multicall_do_call_phpvals($server, $m[$i]);
+                       }
+               }
+
+               return new xmlrpcresp(new xmlrpcval($result, 'array'));
+       }
+
+       $GLOBALS['_xmlrpcs_dmap']=array(
+               'system.listMethods' => array(
+                       'function' => '_xmlrpcs_listMethods',
+                       'signature' => $_xmlrpcs_listMethods_sig,
+                       'docstring' => $_xmlrpcs_listMethods_doc,
+                       'signature_docs' => $_xmlrpcs_listMethods_sdoc),
+               'system.methodHelp' => array(
+                       'function' => '_xmlrpcs_methodHelp',
+                       'signature' => $_xmlrpcs_methodHelp_sig,
+                       'docstring' => $_xmlrpcs_methodHelp_doc,
+                       'signature_docs' => $_xmlrpcs_methodHelp_sdoc),
+               'system.methodSignature' => array(
+                       'function' => '_xmlrpcs_methodSignature',
+                       'signature' => $_xmlrpcs_methodSignature_sig,
+                       'docstring' => $_xmlrpcs_methodSignature_doc,
+                       'signature_docs' => $_xmlrpcs_methodSignature_sdoc),
+               'system.multicall' => array(
+                       'function' => '_xmlrpcs_multicall',
+                       'signature' => $_xmlrpcs_multicall_sig,
+                       'docstring' => $_xmlrpcs_multicall_doc,
+                       'signature_docs' => $_xmlrpcs_multicall_sdoc),
+               'system.getCapabilities' => array(
+                       'function' => '_xmlrpcs_getCapabilities',
+                       'signature' => $_xmlrpcs_getCapabilities_sig,
+                       'docstring' => $_xmlrpcs_getCapabilities_doc,
+                       'signature_docs' => $_xmlrpcs_getCapabilities_sdoc)
+       );
+
+       $GLOBALS['_xmlrpcs_occurred_errors'] = '';
+       $GLOBALS['_xmlrpcs_prev_ehandler'] = '';
+
+       /**
+       * Error handler used to track errors that occur during server-side 
execution of PHP code.
+       * This allows to report back to the client whether an internal error 
has occurred or not
+       * using an xmlrpc response object, instead of letting the client deal 
with the html junk
+       * that a PHP execution error on the server generally entails.
+       *
+       * NB: in fact a user defined error handler can only handle WARNING, 
NOTICE and USER_* errors.
+       *
+       */
+       function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, 
$lineno=null, $context=null)
+       {
+               // obey the @ protocol
+               if (error_reporting() == 0)
+                       return;
+
+               //if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode 
!= E_USER_NOTICE && $errcode != E_USER_WARNING)
+               if($errcode != E_STRICT)
+               {
+                       $GLOBALS['_xmlrpcs_occurred_errors'] = 
$GLOBALS['_xmlrpcs_occurred_errors'] . $errstring . "\n";
+               }
+               // Try to avoid as much as possible disruption to the previous 
error handling
+               // mechanism in place
+               if($GLOBALS['_xmlrpcs_prev_ehandler'] == '')
+               {
+                       // The previous error handler was the default: all we 
should do is log error
+                       // to the default error log (if level high enough)
+                       if(ini_get('log_errors') && 
(intval(ini_get('error_reporting')) & $errcode))
+                       {
+                               error_log($errstring);
+                       }
+               }
+               else
+               {
+                       // Pass control on to previous error handler, trying to 
avoid loops...
+                       if($GLOBALS['_xmlrpcs_prev_ehandler'] != 
'_xmlrpcs_errorHandler')
+                       {
+                               // NB: this code will NOT work on php < 4.0.2: 
only 2 params were used for error handlers
+                               if(is_array($GLOBALS['_xmlrpcs_prev_ehandler']))
+                               {
+                                       // the following works both with static 
class methods and plain object methods as error handler
+                                       
call_user_func_array($GLOBALS['_xmlrpcs_prev_ehandler'], array($errcode, 
$errstring, $filename, $lineno, $context));
+                               }
+                               else
+                               {
+                                       
$GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, 
$context);
+                               }
+                       }
+               }
+       }
+
+       $GLOBALS['_xmlrpc_debuginfo']='';
+
+       /**
+       * Add a string to the debug info that can be later seralized by the 
server
+       * as part of the response message.
+       * Note that for best compatbility, the debug string should be encoded 
using
+       * the $GLOBALS['xmlrpc_internalencoding'] character set.
+       * @param string $m
+       * @access public
+       */
+       function xmlrpc_debugmsg($m)
+       {
+               $GLOBALS['_xmlrpc_debuginfo'] .= $m . "\n";
+       }
+
+       class xmlrpc_server
+       {
+               /**
+               * Array defining php functions exposed as xmlrpc methods by 
this server
+               * @access private
+               */
+               var $dmap=array();
+               /**
+               * Defines how functions in dmap will be invoked: either using 
an xmlrpc msg object
+               * or plain php values.
+               * valid strings are 'xmlrpcvals', 'phpvals' or 'epivals'
+               */
+               var $functions_parameters_type='xmlrpcvals';
+               /**
+               * Option used for fine-tuning the encoding the php values 
returned from
+               * functions registered in the dispatch map when the 
functions_parameters_types
+               * member is set to 'phpvals'
+               * @see php_xmlrpc_encode for a list of values
+               */
+               var $phpvals_encoding_options = array( 'auto_dates' );
+               /// controls wether the server is going to echo debugging 
messages back to the client as comments in response body. valid values: 0,1,2,3
+               var $debug = 1;
+               /**
+               * Controls behaviour of server when invoked user function 
throws an exception:
+               * 0 = catch it and return an 'internal error' xmlrpc response 
(default)
+               * 1 = catch it and return an xmlrpc response with the error 
corresponding to the exception
+               * 2 = allow the exception to float to the upper layers
+               */
+               var $exception_handling = 0;
+               /**
+               * When set to true, it will enable HTTP compression of the 
response, in case
+               * the client has declared its support for compression in the 
request.
+               */
+               var $compress_response = false;
+               /**
+               * List of http compression methods accepted by the server for 
requests.
+               * NB: PHP supports deflate, gzip compressions out of the box if 
compiled w. zlib
+               */
+               var $accepted_compression = array();
+               /// shall we serve calls to system.* methods?
+               var $allow_system_funcs = true;
+               /// list of charset encodings natively accepted for requests
+               var $accepted_charset_encodings = array();
+               /**
+               * charset encoding to be used for response.
+               * NB: if we can, we will convert the generated response from 
internal_encoding to the intended one.
+               * can be: a supported xml encoding (only UTF-8 and ISO-8859-1 
at present, unless mbstring is enabled),
+               * null (leave unspecified in response, convert output stream to 
US_ASCII),
+               * 'default' (use xmlrpc library default as specified in 
xmlrpc.inc, convert output stream if needed),
+               * or 'auto' (use client-specified charset encoding or same as 
request if request headers do not specify it (unless request is US-ASCII: then 
use library default anyway).
+               * NB: pretty dangerous if you accept every charset and do not 
have mbstring enabled)
+               */
+               var $response_charset_encoding = '';
+               /**
+               * Storage for internal debug info
+               * @access private
+               */
+               var $debug_info = '';
+               /**
+               * Extra data passed at runtime to method handling functions. 
Used only by EPI layer
+               */
+               var $user_data = null;
+
+               /**
+               * @param array $dispmap the dispatch map withd efinition of 
exposed services
+               * @param boolean $servicenow set to false to prevent the server 
from runnung upon construction
+               */
+               function xmlrpc_server($dispMap=null, $serviceNow=true)
+               {
+                       // if ZLIB is enabled, let the server by default accept 
compressed requests,
+                       // and compress responses sent to clients that support 
them
+                       if(function_exists('gzinflate'))
+                       {
+                               $this->accepted_compression = array('gzip', 
'deflate');
+                               $this->compress_response = true;
+                       }
+
+                       // by default the xml parser can support these 3 
charset encodings
+                       $this->accepted_charset_encodings = array('UTF-8', 
'ISO-8859-1', 'US-ASCII');
+
+                       // dispMap is a dispatch array of methods
+                       // mapped to function names and signatures
+                       // if a method
+                       // doesn't appear in the map then an unknown
+                       // method error is generated
+                       /* milosch - changed to make passing dispMap optional.
+                        * instead, you can use the class add_to_map() function
+                        * to add functions manually (borrowed from SOAPX4)
+                        */
+                       if($dispMap)
+                       {
+                               $this->dmap = $dispMap;
+                               if($serviceNow)
+                               {
+                                       $this->service();
+                               }
+                       }
+               }
+
+               /**
+               * Set debug level of server.
+               * @param integer $in debug lvl: determines info added to xmlrpc 
responses (as xml comments)
+               * 0 = no debug info,
+               * 1 = msgs set from user with debugmsg(),
+               * 2 = add complete xmlrpc request (headers and body),
+               * 3 = add also all processing warnings happened during method 
processing
+               * (NB: this involves setting a custom error handler, and might 
interfere
+               * with the standard processing of the php function exposed as 
method. In
+               * particular, triggering an USER_ERROR level error will not 
halt script
+               * execution anymore, but just end up logged in the xmlrpc 
response)
+               * Note that info added at elevel 2 and 3 will be base64 encoded
+               * @access public
+               */
+               function setDebug($in)
+               {
+                       $this->debug=$in;
+               }
+
+               /**
+               * Return a string with the serialized representation of all 
debug info
+               * @param string $charset_encoding the target charset encoding 
for the serialization
+               * @return string an XML comment (or two)
+               */
+               function serializeDebug($charset_encoding='')
+               {
+                       // Tough encoding problem: which internal charset 
should we assume for debug info?
+                       // It might contain a copy of raw data received from 
client, ie with unknown encoding,
+                       // intermixed with php generated data and user 
generated data...
+                       // so we split it: system debug is base 64 encoded,
+                       // user debug info should be encoded by the end user 
using the INTERNAL_ENCODING
+                       $out = '';
+                       if ($this->debug_info != '')
+                       {
+                               $out .= "<!-- SERVER DEBUG INFO (BASE64 
ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
+                       }
+                       if($GLOBALS['_xmlrpc_debuginfo']!='')
+                       {
+
+                               $out .= "<!-- DEBUG INFO:\n" . 
xmlrpc_encode_entitites(str_replace('--', '_-', $GLOBALS['_xmlrpc_debuginfo']), 
$GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "\n-->\n";
+                               // NB: a better solution MIGHT be to use CDATA, 
but we need to insert it
+                               // into return payload AFTER the beginning tag
+                               //$out .= "<![CDATA[ DEBUG INFO:\n\n" . 
str_replace(']]>', ']_]_>', $GLOBALS['_xmlrpc_debuginfo']) . "\n]]>\n";
+                       }
+                       return $out;
+               }
+
+               /**
+               * Execute the xmlrpc request, printing the response
+               * @param string $data the request body. If null, the http POST 
request will be examined
+               * @return xmlrpcresp the response object (usually not used by 
caller...)
+               * @access public
+               */
+               function service($data=null, $return_payload=false)
+               {
+                       if ($data === null)
+                       {
+                               // workaround for a known bug in php ver. 5.2.2 
that broke $HTTP_RAW_POST_DATA
+                               $ver = phpversion();
+                               if ($ver[0] >= 5)
+                               {
+                                       $data = 
file_get_contents('php://input');
+                               }
+                               else
+                               {
+                                       $data = 
isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
+                               }
+                       }
+                       $raw_data = $data;
+
+                       // reset internal debug info
+                       $this->debug_info = '';
+
+                       // Echo back what we received, before parsing it
+                       if($this->debug > 1)
+                       {
+                               $this->debugmsg("+++GOT+++\n" . $data . 
"\n+++END+++");
+                       }
+
+                       $r = $this->parseRequestHeaders($data, $req_charset, 
$resp_charset, $resp_encoding);
+                       if (!$r)
+                       {
+                               $r=$this->parseRequest($data, $req_charset);
+                       }
+
+                       // save full body of request into response, for more 
debugging usages
+                       $r->raw_data = $raw_data;
+
+                       if($this->debug > 2 && 
$GLOBALS['_xmlrpcs_occurred_errors'])
+                       {
+                               $this->debugmsg("+++PROCESSING ERRORS AND 
WARNINGS+++\n" .
+                                       $GLOBALS['_xmlrpcs_occurred_errors'] . 
"+++END+++");
+                       }
+
+                       $payload=$this->xml_header($resp_charset);
+                       if($this->debug > 0)
+                       {
+                               $payload = $payload . 
$this->serializeDebug($resp_charset);
+                       }
+
+                       // G. Giunta 2006-01-27: do not create response 
serialization if it has
+                       // already happened. Helps building json magic
+                       if (empty($r->payload))
+                       {
+                               $r->serialize($resp_charset);
+                       }
+                       $payload = $payload . $r->payload;
+
+                       if ($return_payload)
+                       {
+                               return $payload;
+                       }
+
+                       // if we get a warning/error that has output some text 
before here, then we cannot
+                       // add a new header. We cannot say we are sending xml, 
either...
+                       if(!headers_sent())
+                       {
+                               header('Content-Type: '.$r->content_type);
+                               // we do not know if client actually told us an 
accepted charset, but if he did
+                               // we have to tell him what we did
+                               header("Vary: Accept-Charset");
+
+                               // http compression of output: only
+                               // if we can do it, and we want to do it, and 
client asked us to,
+                               // and php ini settings do not force it already
+                               $php_no_self_compress = 
!ini_get('zlib.output_compression') && (ini_get('output_handler') != 
'ob_gzhandler');
+                               if($this->compress_response && 
function_exists('gzencode') && $resp_encoding != ''
+                                       && $php_no_self_compress)
+                               {
+                                       if(strpos($resp_encoding, 'gzip') !== 
false)
+                                       {
+                                               $payload = gzencode($payload);
+                                               header("Content-Encoding: 
gzip");
+                                               header("Vary: Accept-Encoding");
+                                       }
+                                       elseif (strpos($resp_encoding, 
'deflate') !== false)
+                                       {
+                                               $payload = gzcompress($payload);
+                                               header("Content-Encoding: 
deflate");
+                                               header("Vary: Accept-Encoding");
+                                       }
+                               }
+
+                               // do not ouput content-length header if php is 
compressing output for us:
+                               // it will mess up measurements
+                               if($php_no_self_compress)
+                               {
+                                       header('Content-Length: ' . 
(int)strlen($payload));
+                               }
+                       }
+                       else
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': http 
headers already sent before response is fully generated. Check for php warning 
or error messages');
+                       }
+
+                       print $payload;
+
+                       // return request, in case subclasses want it
+                       return $r;
+               }
+
+               /**
+               * Add a method to the dispatch map
+               * @param string $methodname the name with which the method will 
be made available
+               * @param string $function the php function that will get invoked
+               * @param array $sig the array of valid method signatures
+               * @param string $doc method documentation
+               * @param array $sigdoc the array of valid method signatures 
docs (one string per param, one for return type)
+               * @access public
+               */
+               function 
add_to_map($methodname,$function,$sig=null,$doc=false,$sigdoc=false)
+               {
+                       $this->dmap[$methodname] = array(
+                               'function'      => $function,
+                               'docstring' => $doc
+                       );
+                       if ($sig)
+                       {
+                               $this->dmap[$methodname]['signature'] = $sig;
+                       }
+                       if ($sigdoc)
+                       {
+                               $this->dmap[$methodname]['signature_docs'] = 
$sigdoc;
+                       }
+               }
+
+               /**
+               * Verify type and number of parameters received against a list 
of known signatures
+               * @param array $in array of either xmlrpcval objects or xmlrpc 
type definitions
+               * @param array $sig array of known signatures to match against
+               * @access private
+               */
+               function verifySignature($in, $sig)
+               {
+                       // check each possible signature in turn
+                       if (is_object($in))
+                       {
+                               $numParams = $in->getNumParams();
+                       }
+                       else
+                       {
+                               $numParams = count($in);
+                       }
+                       foreach($sig as $cursig)
+                       {
+                               if(count($cursig)==$numParams+1)
+                               {
+                                       $itsOK=1;
+                                       for($n=0; $n<$numParams; $n++)
+                                       {
+                                               if (is_object($in))
+                                               {
+                                                       $p=$in->getParam($n);
+                                                       if($p->kindOf() == 
'scalar')
+                                                       {
+                                                               
$pt=$p->scalartyp();
+                                                       }
+                                                       else
+                                                       {
+                                                               
$pt=$p->kindOf();
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $pt= $in[$n] == 'i4' ? 
'int' : strtolower($in[$n]); // dispatch maps never use i4...
+                                               }
+
+                                               // param index is $n+1, as 
first member of sig is return type
+                                               if($pt != $cursig[$n+1] && 
$cursig[$n+1] != $GLOBALS['xmlrpcValue'])
+                                               {
+                                                       $itsOK=0;
+                                                       $pno=$n+1;
+                                                       $wanted=$cursig[$n+1];
+                                                       $got=$pt;
+                                                       break;
+                                               }
+                                       }
+                                       if($itsOK)
+                                       {
+                                               return array(1,'');
+                                       }
+                               }
+                       }
+                       if(isset($wanted))
+                       {
+                               return array(0, "Wanted ${wanted}, got ${got} 
at param ${pno}");
+                       }
+                       else
+                       {
+                               return array(0, "No method signature matches 
number of parameters");
+                       }
+               }
+
+               /**
+               * Parse http headers received along with xmlrpc request. If 
needed, inflate request
+               * @return null on success or an xmlrpcresp
+               * @access private
+               */
+               function parseRequestHeaders(&$data, &$req_encoding, 
&$resp_encoding, &$resp_compression)
+               {
+                       // check if $_SERVER is populated: it might have been 
disabled via ini file
+                       // (this is true even when in CLI mode)
+                       if (count($_SERVER) == 0)
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': cannot 
parse request headers as $_SERVER is not populated');
+                       }
+
+                       if($this->debug > 1)
+                       {
+                               if(function_exists('getallheaders'))
+                               {
+                                       $this->debugmsg(''); // empty line
+                                       foreach(getallheaders() as $name => 
$val)
+                                       {
+                                               $this->debugmsg("HEADER: $name: 
$val");
+                                       }
+                               }
+
+                       }
+
+                       if(isset($_SERVER['HTTP_CONTENT_ENCODING']))
+                       {
+                               $content_encoding = str_replace('x-', '', 
$_SERVER['HTTP_CONTENT_ENCODING']);
+                       }
+                       else
+                       {
+                               $content_encoding = '';
+                       }
+
+                       // check if request body has been compressed and 
decompress it
+                       if($content_encoding != '' && strlen($data))
+                       {
+                               if($content_encoding == 'deflate' || 
$content_encoding == 'gzip')
+                               {
+                                       // if decoding works, use it. else 
assume data wasn't gzencoded
+                                       if(function_exists('gzinflate') && 
in_array($content_encoding, $this->accepted_compression))
+                                       {
+                                               if($content_encoding == 
'deflate' && $degzdata = @gzuncompress($data))
+                                               {
+                                                       $data = $degzdata;
+                                                       if($this->debug > 1)
+                                                       {
+                                                               
$this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . 
$data . "\n+++END+++");
+                                                       }
+                                               }
+                                               elseif($content_encoding == 
'gzip' && $degzdata = @gzinflate(substr($data, 10)))
+                                               {
+                                                       $data = $degzdata;
+                                                       if($this->debug > 1)
+                                                               
$this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data 
. "\n+++END+++");
+                                               }
+                                               else
+                                               {
+                                                       $r = new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['server_decompress_fail'], 
$GLOBALS['xmlrpcstr']['server_decompress_fail']);
+                                                       return $r;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               //error_log('The server sent 
deflated data. Your php install must have the Zlib extension compiled in to 
support this.');
+                                               $r = new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['server_cannot_decompress'], 
$GLOBALS['xmlrpcstr']['server_cannot_decompress']);
+                                               return $r;
+                                       }
+                               }
+                       }
+
+                       // check if client specified accepted charsets, and if 
we know how to fulfill
+                       // the request
+                       if ($this->response_charset_encoding == 'auto')
+                       {
+                               $resp_encoding = '';
+                               if (isset($_SERVER['HTTP_ACCEPT_CHARSET']))
+                               {
+                                       // here we should check if we can match 
the client-requested encoding
+                                       // with the encodings we know we can 
generate.
+                                       /// @todo we should parse q=0.x 
preferences instead of getting first charset specified...
+                                       $client_accepted_charsets = 
explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']));
+                                       // Give preference to internal encoding
+                                       $known_charsets = 
array($GLOBALS['xmlrpc_internalencoding'], 'UTF-8', 'ISO-8859-1', 'US-ASCII');
+                                       foreach ($known_charsets as $charset)
+                                       {
+                                               foreach 
($client_accepted_charsets as $accepted)
+                                                       if (strpos($accepted, 
$charset) === 0)
+                                                       {
+                                                               $resp_encoding 
= $charset;
+                                                               break;
+                                                       }
+                                               if ($resp_encoding)
+                                                       break;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $resp_encoding = 
$this->response_charset_encoding;
+                       }
+
+                       if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
+                       {
+                               $resp_compression = 
$_SERVER['HTTP_ACCEPT_ENCODING'];
+                       }
+                       else
+                       {
+                               $resp_compression = '';
+                       }
+
+                       // 'guestimate' request encoding
+                       /// @todo check if mbstring is enabled and automagic 
input conversion is on: it might mingle with this check???
+                       $req_encoding = 
guess_encoding(isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '',
+                               $data);
+
+                       return null;
+               }
+
+               /**
+               * Parse an xml chunk containing an xmlrpc request and execute 
the corresponding
+               * php function registered with the server
+               * @param string $data the xml request
+               * @param string $req_encoding (optional) the charset encoding 
of the xml request
+               * @return xmlrpcresp
+               * @access private
+               */
+               function parseRequest($data, $req_encoding='')
+               {
+                       // 2005/05/07 commented and moved into caller function 
code
+                       //if($data=='')
+                       //{
+                       //      $data=$GLOBALS['HTTP_RAW_POST_DATA'];
+                       //}
+
+                       // G. Giunta 2005/02/13: we do NOT expect to receive 
html entities
+                       // so we do not try to convert them into xml character 
entities
+                       //$data = xmlrpc_html_entity_xlate($data);
+
+                       $GLOBALS['_xh']=array();
+                       $GLOBALS['_xh']['ac']='';
+                       $GLOBALS['_xh']['stack']=array();
+                       $GLOBALS['_xh']['valuestack'] = array();
+                       $GLOBALS['_xh']['params']=array();
+                       $GLOBALS['_xh']['pt']=array();
+                       $GLOBALS['_xh']['isf']=0;
+                       $GLOBALS['_xh']['isf_reason']='';
+                       $GLOBALS['_xh']['method']=false; // so we can check 
later if we got a methodname or not
+                       $GLOBALS['_xh']['rt']='';
+
+                       // decompose incoming XML into request structure
+                       if ($req_encoding != '')
+                       {
+                               if (!in_array($req_encoding, array('UTF-8', 
'ISO-8859-1', 'US-ASCII')))
+                               // the following code might be better for 
mb_string enabled installs, but
+                               // makes the lib about 200% slower...
+                               //if (!is_valid_charset($req_encoding, 
array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                               {
+                                       error_log('XML-RPC: '.__METHOD__.': 
invalid charset encoding of received request: '.$req_encoding);
+                                       $req_encoding = 
$GLOBALS['xmlrpc_defencoding'];
+                               }
+                               /// @BUG this will fail on PHP 5 if charset is 
not specified in the xml prologue,
+                               // the encoding is not UTF8 and there are 
non-ascii chars in the text...
+                               /// @todo use an ampty string for php 5 ???
+                               $parser = xml_parser_create($req_encoding);
+                       }
+                       else
+                       {
+                               $parser = xml_parser_create();
+                       }
+
+                       xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 
true);
+                       // G. Giunta 2005/02/13: PHP internally uses 
ISO-8859-1, so we have to tell
+                       // the xml parser to give us back data in the expected 
charset
+                       // What if internal encoding is not in one of the 3 
allowed?
+                       // we use the broadest one, ie. utf8
+                       // This allows to send data which is native in various 
charset,
+                       // by extending xmlrpc_encode_entitites() and setting 
xmlrpc_internalencoding
+                       if (!in_array($GLOBALS['xmlrpc_internalencoding'], 
array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                       {
+                               xml_parser_set_option($parser, 
XML_OPTION_TARGET_ENCODING, 'UTF-8');
+                       }
+                       else
+                       {
+                               xml_parser_set_option($parser, 
XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+                       }
+
+                       if ($this->functions_parameters_type != 'xmlrpcvals')
+                               xml_set_element_handler($parser, 'xmlrpc_se', 
'xmlrpc_ee_fast');
+                       else
+                               xml_set_element_handler($parser, 'xmlrpc_se', 
'xmlrpc_ee');
+                       xml_set_character_data_handler($parser, 'xmlrpc_cd');
+                       xml_set_default_handler($parser, 'xmlrpc_dh');
+                       if(!xml_parse($parser, $data, 1))
+                       {
+                               // return XML error as a faultCode
+                               $r=new xmlrpcresp(0,
+                               
$GLOBALS['xmlrpcerrxml']+xml_get_error_code($parser),
+                               sprintf('XML error: %s at line %d, column %d',
+                                       
xml_error_string(xml_get_error_code($parser)),
+                                       xml_get_current_line_number($parser), 
xml_get_current_column_number($parser)));
+                               xml_parser_free($parser);
+                       }
+                       elseif ($GLOBALS['_xh']['isf'])
+                       {
+                               xml_parser_free($parser);
+                               $r=new xmlrpcresp(0,
+                                       
$GLOBALS['xmlrpcerr']['invalid_request'],
+                                       
$GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']);
+                       }
+                       else
+                       {
+                               xml_parser_free($parser);
+                               // small layering violation in favor of speed 
and memory usage:
+                               // we should allow the 'execute' method handle 
this, but in the
+                               // most common scenario (xmlrpcvals type server 
with some methods
+                               // registered as phpvals) that would mean a 
useless encode+decode pass
+                               if ($this->functions_parameters_type != 
'xmlrpcvals' || 
(isset($this->dmap[$GLOBALS['_xh']['method']]['parameters_type']) && 
($this->dmap[$GLOBALS['_xh']['method']]['parameters_type'] == 'phpvals')))
+                               {
+                                       if($this->debug > 1)
+                                       {
+                                               
$this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], 
true)."\n+++END+++");
+                                       }
+                                       $r = 
$this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], 
$GLOBALS['_xh']['pt']);
+                               }
+                               else
+                               {
+                                       // build an xmlrpcmsg object with data 
parsed from xml
+                                       $m=new 
xmlrpcmsg($GLOBALS['_xh']['method']);
+                                       // now add parameters in
+                                       for($i=0; 
$i<count($GLOBALS['_xh']['params']); $i++)
+                                       {
+                                               
$m->addParam($GLOBALS['_xh']['params'][$i]);
+                                       }
+
+                                       if($this->debug > 1)
+                                       {
+                                               
$this->debugmsg("\n+++PARSED+++\n".var_export($m, true)."\n+++END+++");
+                                       }
+                                       $r = $this->execute($m);
+                               }
+                       }
+                       return $r;
+               }
+
+               /**
+               * Execute a method invoked by the client, checking parameters 
used
+               * @param mixed $m either an xmlrpcmsg obj or a method name
+               * @param array $params array with method parameters as php 
types (if m is method name only)
+               * @param array $paramtypes array with xmlrpc types of method 
parameters (if m is method name only)
+               * @return xmlrpcresp
+               * @access private
+               */
+               function execute($m, $params=null, $paramtypes=null)
+               {
+                       if (is_object($m))
+                       {
+                               $methName = $m->method();
+                       }
+                       else
+                       {
+                               $methName = $m;
+                       }
+                       $sysCall = $this->allow_system_funcs && 
(strpos($methName, "system.") === 0);
+                       $dmap = $sysCall ? $GLOBALS['_xmlrpcs_dmap'] : 
$this->dmap;
+
+                       if(!isset($dmap[$methName]['function']))
+                       {
+                               // No such method
+                               return new xmlrpcresp(0,
+                                       $GLOBALS['xmlrpcerr']['unknown_method'],
+                                       
$GLOBALS['xmlrpcstr']['unknown_method']);
+                       }
+
+                       // Check signature
+                       if(isset($dmap[$methName]['signature']))
+                       {
+                               $sig = $dmap[$methName]['signature'];
+                               if (is_object($m))
+                               {
+                                       list($ok, $errstr) = 
$this->verifySignature($m, $sig);
+                               }
+                               else
+                               {
+                                       list($ok, $errstr) = 
$this->verifySignature($paramtypes, $sig);
+                               }
+                               if(!$ok)
+                               {
+                                       // Didn't match.
+                                       return new xmlrpcresp(
+                                               0,
+                                               
$GLOBALS['xmlrpcerr']['incorrect_params'],
+                                               
$GLOBALS['xmlrpcstr']['incorrect_params'] . ": ${errstr}"
+                                       );
+                               }
+                       }
+
+                       $func = $dmap[$methName]['function'];
+                       // let the 'class::function' syntax be accepted in 
dispatch maps
+                       if(is_string($func) && strpos($func, '::'))
+                       {
+                               $func = explode('::', $func);
+                       }
+                       // verify that function to be invoked is in fact 
callable
+                       if(!is_callable($func))
+                       {
+                               error_log("XML-RPC: ".__METHOD__.": function 
$func registered as method handler is not callable");
+                               return new xmlrpcresp(
+                                       0,
+                                       $GLOBALS['xmlrpcerr']['server_error'],
+                                       $GLOBALS['xmlrpcstr']['server_error'] . 
": no function matches method"
+                               );
+                       }
+
+                       // If debug level is 3, we should catch all errors 
generated during
+                       // processing of user function, and log them as part of 
response
+                       if($this->debug > 2)
+                       {
+                               $GLOBALS['_xmlrpcs_prev_ehandler'] = 
set_error_handler('_xmlrpcs_errorHandler');
+                       }
+                       try
+                       {
+                               // Allow mixed-convention servers
+                               if (is_object($m))
+                               {
+                                       if($sysCall)
+                                       {
+                                               $r = call_user_func($func, 
$this, $m);
+                                       }
+                                       else
+                                       {
+                                               $r = call_user_func($func, $m);
+                                       }
+                                       if (!is_a($r, 'xmlrpcresp'))
+                                       {
+                                               error_log("XML-RPC: 
".__METHOD__.": function $func registered as method handler does not return an 
xmlrpcresp object");
+                                               if (is_a($r, 'xmlrpcval'))
+                                               {
+                                                       $r = new xmlrpcresp($r);
+                                               }
+                                               else
+                                               {
+                                                       $r = new xmlrpcresp(
+                                                               0,
+                                                               
$GLOBALS['xmlrpcerr']['server_error'],
+                                                               
$GLOBALS['xmlrpcstr']['server_error'] . ": function does not return xmlrpcresp 
object"
+                                                       );
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       // call a 'plain php' function
+                                       if($sysCall)
+                                       {
+                                               array_unshift($params, $this);
+                                               $r = 
call_user_func_array($func, $params);
+                                       }
+                                       else
+                                       {
+                                               // 3rd API convention for 
method-handling functions: EPI-style
+                                               if 
($this->functions_parameters_type == 'epivals')
+                                               {
+                                                       $r = 
call_user_func_array($func, array($methName, $params, $this->user_data));
+                                                       // mimic EPI behaviour: 
if we get an array that looks like an error, make it
+                                                       // an eror response
+                                                       if (is_array($r) && 
array_key_exists('faultCode', $r) && array_key_exists('faultString', $r))
+                                                       {
+                                                               $r = new 
xmlrpcresp(0, (integer)$r['faultCode'], (string)$r['faultString']);
+                                                       }
+                                                       else
+                                                       {
+                                                               // functions 
using EPI api should NOT return resp objects,
+                                                               // so make sure 
we encode the return type correctly
+                                                               $r = new 
xmlrpcresp(php_xmlrpc_encode($r, array('extension_api')));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $r = 
call_user_func_array($func, $params);
+                                               }
+                                       }
+                                       // the return type can be either an 
xmlrpcresp object or a plain php value...
+                                       if (!is_a($r, 'xmlrpcresp'))
+                                       {
+                                               // what should we assume here 
about automatic encoding of datetimes
+                                               // and php classes instances???
+                                               $r = new 
xmlrpcresp(php_xmlrpc_encode($r, $this->phpvals_encoding_options));
+                                       }
+                               }
+                       }
+                       catch(Exception $e)
+                       {
+                               // (barring errors in the lib) an uncatched 
exception happened
+                               // in the called function, we wrap it in a 
proper error-response
+                               switch($this->exception_handling)
+                               {
+                                       case 2:
+                                               throw $e;
+                                               break;
+                                       case 1:
+                                               $r = new xmlrpcresp(0, 
$e->getCode(), $e->getMessage());
+                                               break;
+                                       default:
+                                               $r = new xmlrpcresp(0, 
$GLOBALS['xmlrpcerr']['server_error'], $GLOBALS['xmlrpcstr']['server_error']);
+                               }
+                       }
+                       if($this->debug > 2)
+                       {
+                               // note: restore the error handler we found 
before calling the
+                               // user func, even if it has been changed 
inside the func itself
+                               if($GLOBALS['_xmlrpcs_prev_ehandler'])
+                               {
+                                       
set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);
+                               }
+                               else
+                               {
+                                       restore_error_handler();
+                               }
+                       }
+                       return $r;
+               }
+
+               /**
+               * add a string to the 'internal debug message' (separate from 
'user debug message')
+               * @param string $strings
+               * @access private
+               */
+               function debugmsg($string)
+               {
+                       $this->debug_info .= $string."\n";
+               }
+
+               /**
+               * @access private
+               */
+               function xml_header($charset_encoding='')
+               {
+                       if ($charset_encoding != '')
+                       {
+                               return "<?xml version=\"1.0\" 
encoding=\"$charset_encoding\"?" . ">\n";
+                       }
+                       else
+                       {
+                               return "<?xml version=\"1.0\"?" . ">\n";
+                       }
+               }
+
+               /**
+               * A debugging routine: just echoes back the input packet as a 
string value
+               * DEPRECATED!
+               */
+               function echoInput()
+               {
+                       $r=new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . 
$GLOBALS['HTTP_RAW_POST_DATA'], 'string'));
+                       print $r->serialize();
+               }
+       }
+?>
\ No newline at end of file

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/Assert.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/Assert.php   
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/Assert.php   
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,400 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 4
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to address@hidden so we can mail you a copy immediately.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      File available since Release 1.0.0
+ */
+
+/**
+ * A set of assert methods.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      Class available since Release 1.0.0
+ */
+class PHPUnit_Assert {
+    /**
+     * @var    boolean
+     * @access private
+     */
+    var $_looselyTyped = FALSE;
+
+    /**
+     * Asserts that a haystack contains a needle.
+     *
+     * @param  mixed
+     * @param  mixed
+     * @param  string
+     * @access public
+     * @since  Method available since Release 1.1.0
+     */
+    function assertContains($needle, $haystack, $message = '') {
+        if (is_string($needle) && is_string($haystack)) {
+            $this->assertTrue(strpos($haystack, $needle) !== FALSE, $message);
+        }
+
+        else if (is_array($haystack) && !is_object($needle)) {
+            $this->assertTrue(in_array($needle, $haystack), $message);
+        }
+
+        else {
+            $this->fail('Unsupported parameter passed to assertContains().');
+        }
+    }
+
+    /**
+     * Asserts that a haystack does not contain a needle.
+     *
+     * @param  mixed
+     * @param  mixed
+     * @param  string
+     * @access public
+     * @since  Method available since Release 1.1.0
+     */
+    function assertNotContains($needle, $haystack, $message = '') {
+        if (is_string($needle) && is_string($haystack)) {
+            $this->assertFalse(strpos($haystack, $needle) !== FALSE, $message);
+        }
+
+        else if (is_array($haystack) && !is_object($needle)) {
+            $this->assertFalse(in_array($needle, $haystack), $message);
+        }
+
+        else {
+            $this->fail('Unsupported parameter passed to 
assertNotContains().');
+        }
+    }
+
+    /**
+     * Asserts that two variables are equal.
+     *
+     * @param  mixed
+     * @param  mixed
+     * @param  string
+     * @param  mixed
+     * @access public
+     */
+    function assertEquals($expected, $actual, $message = '', $delta = 0) {
+        if ((is_array($actual)  && is_array($expected)) ||
+            (is_object($actual) && is_object($expected))) {
+            if (is_array($actual) && is_array($expected)) {
+                ksort($actual);
+                ksort($expected);
+            }
+
+            if ($this->_looselyTyped) {
+                $actual   = $this->_convertToString($actual);
+                $expected = $this->_convertToString($expected);
+            }
+
+            $actual   = serialize($actual);
+            $expected = serialize($expected);
+
+            $message = sprintf(
+              '%sexpected %s, actual %s',
+
+              !empty($message) ? $message . ' ' : '',
+              $expected,
+              $actual
+            );
+
+            if ($actual !== $expected) {
+                return $this->fail($message);
+            }
+        }
+
+        elseif (is_numeric($actual) && is_numeric($expected)) {
+            $message = sprintf(
+              '%sexpected %s%s, actual %s',
+
+              !empty($message) ? $message . ' ' : '',
+              $expected,
+              ($delta != 0) ? ('+/- ' . $delta) : '',
+              $actual
+            );
+
+            if (!($actual >= ($expected - $delta) && $actual <= ($expected + 
$delta))) {
+                return $this->fail($message);
+            }
+        }
+
+        else {
+            $message = sprintf(
+              '%sexpected %s, actual %s',
+
+              !empty($message) ? $message . ' ' : '',
+              $expected,
+              $actual
+            );
+
+            if ($actual !== $expected) {
+                return $this->fail($message);
+            }
+        }
+    }
+
+    /**
+     * Asserts that two variables reference the same object.
+     * This requires the Zend Engine 2 to work.
+     *
+     * @param  object
+     * @param  object
+     * @param  string
+     * @access public
+     * @deprecated
+     */
+    function assertSame($expected, $actual, $message = '') {
+        if (!version_compare(phpversion(), '5.0.0', '>=')) {
+            $this->fail('assertSame() only works with PHP >= 5.0.0.');
+        }
+
+        if ((is_object($expected) || is_null($expected)) &&
+            (is_object($actual)   || is_null($actual))) {
+            $message = sprintf(
+              '%sexpected two variables to reference the same object',
+
+              !empty($message) ? $message . ' ' : ''
+            );
+
+            if ($expected !== $actual) {
+                return $this->fail($message);
+            }
+        } else {
+            $this->fail('Unsupported parameter passed to assertSame().');
+        }
+    }
+
+    /**
+     * Asserts that two variables do not reference the same object.
+     * This requires the Zend Engine 2 to work.
+     *
+     * @param  object
+     * @param  object
+     * @param  string
+     * @access public
+     * @deprecated
+     */
+    function assertNotSame($expected, $actual, $message = '') {
+        if (!version_compare(phpversion(), '5.0.0', '>=')) {
+            $this->fail('assertNotSame() only works with PHP >= 5.0.0.');
+        }
+
+        if ((is_object($expected) || is_null($expected)) &&
+            (is_object($actual)   || is_null($actual))) {
+            $message = sprintf(
+              '%sexpected two variables to reference different objects',
+
+              !empty($message) ? $message . ' ' : ''
+            );
+
+            if ($expected === $actual) {
+                return $this->fail($message);
+            }
+        } else {
+            $this->fail('Unsupported parameter passed to assertNotSame().');
+        }
+    }
+
+    /**
+     * Asserts that a variable is not NULL.
+     *
+     * @param  mixed
+     * @param  string
+     * @access public
+     */
+    function assertNotNull($actual, $message = '') {
+        $message = sprintf(
+          '%sexpected NOT NULL, actual NULL',
+
+          !empty($message) ? $message . ' ' : ''
+        );
+
+        if (is_null($actual)) {
+            return $this->fail($message);
+        }
+    }
+
+    /**
+     * Asserts that a variable is NULL.
+     *
+     * @param  mixed
+     * @param  string
+     * @access public
+     */
+    function assertNull($actual, $message = '') {
+        $message = sprintf(
+          '%sexpected NULL, actual NOT NULL',
+
+          !empty($message) ? $message . ' ' : ''
+        );
+
+        if (!is_null($actual)) {
+            return $this->fail($message);
+        }
+    }
+
+    /**
+     * Asserts that a condition is true.
+     *
+     * @param  boolean
+     * @param  string
+     * @access public
+     */
+    function assertTrue($condition, $message = '') {
+        $message = sprintf(
+          '%sexpected TRUE, actual FALSE',
+
+          !empty($message) ? $message . ' ' : ''
+        );
+
+        if (!$condition) {
+            return $this->fail($message);
+        }
+    }
+
+    /**
+     * Asserts that a condition is false.
+     *
+     * @param  boolean
+     * @param  string
+     * @access public
+     */
+    function assertFalse($condition, $message = '') {
+        $message = sprintf(
+          '%sexpected FALSE, actual TRUE',
+
+          !empty($message) ? $message . ' ' : ''
+        );
+
+        if ($condition) {
+            return $this->fail($message);
+        }
+    }
+
+    /**
+     * Asserts that a string matches a given regular expression.
+     *
+     * @param  string
+     * @param  string
+     * @param  string
+     * @access public
+     */
+    function assertRegExp($pattern, $string, $message = '') {
+        $message = sprintf(
+          '%s"%s" does not match pattern "%s"',
+
+          !empty($message) ? $message . ' ' : '',
+          $string,
+          $pattern
+        );
+
+        if (!preg_match($pattern, $string)) {
+            return $this->fail($message);
+        }
+    }
+
+    /**
+     * Asserts that a string does not match a given regular expression.
+     *
+     * @param  string
+     * @param  string
+     * @param  string
+     * @access public
+     * @since  Method available since Release 1.1.0
+     */
+    function assertNotRegExp($pattern, $string, $message = '') {
+        $message = sprintf(
+          '%s"%s" matches pattern "%s"',
+
+          !empty($message) ? $message . ' ' : '',
+          $string,
+          $pattern
+        );
+
+        if (preg_match($pattern, $string)) {
+            return $this->fail($message);
+        }
+    }
+
+    /**
+     * Asserts that a variable is of a given type.
+     *
+     * @param  string          $expected
+     * @param  mixed           $actual
+     * @param  optional string $message
+     * @access public
+     */
+    function assertType($expected, $actual, $message = '') {
+        return $this->assertEquals(
+          $expected,
+          gettype($actual),
+          $message
+        );
+    }
+
+    /**
+     * Converts a value to a string.
+     *
+     * @param  mixed   $value
+     * @access private
+     */
+    function _convertToString($value) {
+        foreach ($value as $k => $v) {
+            if (is_array($v)) {
+                $value[$k] = $this->_convertToString($value[$k]);
+            } else {
+                settype($value[$k], 'string');
+            }
+        }
+
+        return $value;
+    }
+
+    /**
+     * @param  boolean $looselyTyped
+     * @access public
+     */
+    function setLooselyTyped($looselyTyped) {
+        if (is_bool($looselyTyped)) {
+            $this->_looselyTyped = $looselyTyped;
+        }
+    }
+
+    /**
+     * Fails a test with the given message.
+     *
+     * @param  string
+     * @access protected
+     * @abstract
+     */
+    function fail($message = '') { /* abstract */ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/Assert.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestCase.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestCase.php 
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestCase.php 
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,267 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 4
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to address@hidden so we can mail you a copy immediately.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      File available since Release 1.0.0
+ */
+
+require_once 'PHPUnit/Assert.php';
+require_once 'PHPUnit/TestResult.php';
+
+/**
+ * A TestCase defines the fixture to run multiple tests.
+ *
+ * To define a TestCase
+ *
+ *   1) Implement a subclass of PHPUnit_TestCase.
+ *   2) Define instance variables that store the state of the fixture.
+ *   3) Initialize the fixture state by overriding setUp().
+ *   4) Clean-up after a test by overriding tearDown().
+ *
+ * Each test runs in its own fixture so there can be no side effects
+ * among test runs.
+ *
+ * Here is an example:
+ *
+ * <code>
+ * <?php
+ * class MathTest extends PHPUnit_TestCase {
+ *     var $fValue1;
+ *     var $fValue2;
+ *
+ *     function MathTest($name) {
+ *         $this->PHPUnit_TestCase($name);
+ *     }
+ *
+ *     function setUp() {
+ *         $this->fValue1 = 2;
+ *         $this->fValue2 = 3;
+ *     }
+ * }
+ * ?>
+ * </code>
+ *
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified by calling
+ * assert with a boolean.
+ *
+ * <code>
+ * <?php
+ * function testPass() {
+ *     $this->assertTrue($this->fValue1 + $this->fValue2 == 5);
+ * }
+ * ?>
+ * </code>
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      Class available since Release 1.0.0
+ */
+class PHPUnit_TestCase extends PHPUnit_Assert {
+    /**
+     * @var    boolean
+     * @access private
+     */
+    var $_failed = FALSE;
+
+    /**
+     * The name of the test case.
+     *
+     * @var    string
+     * @access private
+     */
+    var $_name = '';
+
+    /**
+     * PHPUnit_TestResult object
+     *
+     * @var    object
+     * @access private
+     */
+    var $_result;
+
+    /**
+     * Constructs a test case with the given name.
+     *
+     * @param  string
+     * @access public
+     */
+    function PHPUnit_TestCase($name = FALSE) {
+        if ($name !== FALSE) {
+            $this->setName($name);
+        }
+    }
+
+    /**
+     * Counts the number of test cases executed by run(TestResult result).
+     *
+     * @return integer
+     * @access public
+     */
+    function countTestCases() {
+        return 1;
+    }
+
+    /**
+     * Gets the name of a TestCase.
+     *
+     * @return string
+     * @access public
+     */
+    function getName() {
+        return $this->_name;
+    }
+
+    /**
+     * Runs the test case and collects the results in a given TestResult 
object.
+     *
+     * @param  object
+     * @return object
+     * @access public
+     */
+    function run(&$result) {
+        $this->_result = &$result;
+        $this->_result->run($this);
+
+        return $this->_result;
+    }
+
+    /**
+     * Runs the bare test sequence.
+     *
+     * @access public
+     */
+    function runBare() {
+        $this->setUp();
+        $this->runTest();
+        $this->tearDown();
+        $this->pass();
+    }
+
+    /**
+     * Override to run the test and assert its state.
+     *
+     * @access protected
+     */
+    function runTest() {
+        call_user_func(
+          array(
+            &$this,
+            $this->_name
+          )
+        );
+    }
+
+    /**
+     * Sets the name of a TestCase.
+     *
+     * @param  string
+     * @access public
+     */
+    function setName($name) {
+        $this->_name = $name;
+    }
+
+    /**
+     * Returns a string representation of the test case.
+     *
+     * @return string
+     * @access public
+     */
+    function toString() {
+        return '';
+    }
+
+    /**
+     * Creates a default TestResult object.
+     *
+     * @return object
+     * @access protected
+     */
+    function &createResult() {
+        return new PHPUnit_TestResult;
+    }
+
+    /**
+     * Fails a test with the given message.
+     *
+     * @param  string
+     * @access protected
+     */
+    function fail($message = '') {
+        if (function_exists('debug_backtrace')) {
+            $trace = debug_backtrace();
+
+            if (isset($trace['1']['file'])) {
+                $message = sprintf(
+                  "%s in %s:%s",
+
+                  $message,
+                  $trace['1']['file'],
+                  $trace['1']['line']
+                );
+            }
+        }
+
+        $this->_result->addFailure($this, $message);
+        $this->_failed = TRUE;
+    }
+
+    /**
+     * Passes a test.
+     *
+     * @access protected
+     */
+    function pass() {
+        if (!$this->_failed) {
+            $this->_result->addPassedTest($this);
+        }
+    }
+
+    /**
+     * Sets up the fixture, for example, open a network connection.
+     * This method is called before a test is executed.
+     *
+     * @access protected
+     * @abstract
+     */
+    function setUp() { /* abstract */ }
+
+    /**
+     * Tears down the fixture, for example, close a network connection.
+     * This method is called after a test is executed.
+     *
+     * @access protected
+     * @abstract
+     */
+    function tearDown() { /* abstract */ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestCase.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestDecorator.php
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestDecorator.php
                            (rev 0)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestDecorator.php
    2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,130 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 4
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to address@hidden so we can mail you a copy immediately.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      File available since Release 1.0.0
+ */
+
+require_once 'PHPUnit/TestCase.php';
+require_once 'PHPUnit/TestSuite.php';
+
+if (!function_exists('is_a')) {
+    require_once 'PHP/Compat/Function/is_a.php';
+}
+
+/**
+ * A Decorator for Tests.
+ *
+ * Use TestDecorator as the base class for defining new
+ * test decorators. Test decorator subclasses can be introduced
+ * to add behaviour before or after a test is run.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      Class available since Release 1.0.0
+ */
+class PHPUnit_TestDecorator {
+    /**
+     * The Test to be decorated.
+     *
+     * @var    object
+     * @access protected
+     */
+    var $_test = NULL;
+
+    /**
+     * Constructor.
+     *
+     * @param  object
+     * @access public
+     */
+    function PHPUnit_TestDecorator(&$test) {
+        if (is_object($test) &&
+            (is_a($test, 'PHPUnit_TestCase') ||
+             is_a($test, 'PHPUnit_TestSuite'))) {
+
+            $this->_test = &$test;
+        }
+    }
+
+    /**
+     * Runs the test and collects the
+     * result in a TestResult.
+     *
+     * @param  object
+     * @access public
+     */
+    function basicRun(&$result) {
+        $this->_test->run($result);
+    }
+
+    /**
+     * Counts the number of test cases that
+     * will be run by this test.
+     *
+     * @return integer
+     * @access public
+     */
+    function countTestCases() {
+        return $this->_test->countTestCases();
+    }
+
+    /**
+     * Returns the test to be run.
+     *
+     * @return object
+     * @access public
+     */
+    function &getTest() {
+        return $this->_test;
+    }
+
+    /**
+     * Runs the decorated test and collects the
+     * result in a TestResult.
+     *
+     * @param  object
+     * @access public
+     * @abstract
+     */
+    function run(&$result) { /* abstract */ }
+
+    /**
+     * Returns a string representation of the test.
+     *
+     * @return string
+     * @access public
+     */
+    function toString() {
+        return $this->_test->toString();
+    }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestDecorator.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestFailure.php
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestFailure.php  
                            (rev 0)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestFailure.php  
    2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,104 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 4
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to address@hidden so we can mail you a copy immediately.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      File available since Release 1.0.0
+ */
+
+/**
+ * A TestFailure collects a failed test together with the caught exception.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      Class available since Release 1.0.0
+ */
+class PHPUnit_TestFailure {
+    /**
+     * @var    object
+     * @access private
+     */
+    var $_failedTest;
+
+    /**
+     * @var    string
+     * @access private
+     */
+    var $_thrownException;
+
+    /**
+     * Constructs a TestFailure with the given test and exception.
+     *
+     * @param  object
+     * @param  string
+     * @access public
+     */
+    function PHPUnit_TestFailure(&$failedTest, &$thrownException) {
+        $this->_failedTest      = &$failedTest;
+        $this->_thrownException = &$thrownException;
+    }
+
+    /**
+     * Gets the failed test.
+     *
+     * @return object
+     * @access public
+     */
+    function &failedTest() {
+        return $this->_failedTest;
+    }
+
+    /**
+     * Gets the thrown exception.
+     *
+     * @return object
+     * @access public
+     */
+    function &thrownException() {
+        return $this->_thrownException;
+    }
+
+    /**
+     * Returns a short description of the failure.
+     *
+     * @return string
+     * @access public
+     */
+    function toString() {
+        return sprintf(
+          "TestCase %s->%s() failed: %s\n",
+
+          get_class($this->_failedTest),
+          $this->_failedTest->getName(),
+          $this->_thrownException
+        );
+    }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestFailure.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestListener.php
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestListener.php 
                            (rev 0)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestListener.php 
    2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,136 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 4
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to address@hidden so we can mail you a copy immediately.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      File available since Release 1.0.0
+ */
+
+/**
+ * A Listener for test progress.
+ *
+ * Here is an example:
+ *
+ * <code>
+ * <?php
+ * require_once 'PHPUnit.php';
+ * require_once 'PHPUnit/TestListener.php';
+ *
+ * class MathTest extends PHPUnit_TestCase {
+ *     var $fValue1;
+ *     var $fValue2;
+ *
+ *     function MathTest($name) {
+ *         $this->PHPUnit_TestCase($name);
+ *     }
+ *
+ *     function setUp() {
+ *         $this->fValue1 = 2;
+ *         $this->fValue2 = 3;
+ *     }
+ *
+ *     function testAdd() {
+ *         $this->assertTrue($this->fValue1 + $this->fValue2 == 4);
+ *     }
+ * }
+ *
+ * class MyListener extends PHPUnit_TestListener {
+ *     function addError(&$test, &$t) {
+ *         print "MyListener::addError() called.\n";
+ *     }
+ *
+ *     function addFailure(&$test, &$t) {
+ *         print "MyListener::addFailure() called.\n";
+ *     }
+ *
+ *     function endTest(&$test) {
+ *         print "MyListener::endTest() called.\n";
+ *     }
+ *
+ *     function startTest(&$test) {
+ *         print "MyListener::startTest() called.\n";
+ *     }
+ * }
+ *
+ * $suite = new PHPUnit_TestSuite;
+ * $suite->addTest(new MathTest('testAdd'));
+ *
+ * $result = new PHPUnit_TestResult;
+ * $result->addListener(new MyListener);
+ *
+ * $suite->run($result);
+ * print $result->toString();
+ * ?>
+ * </code>
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      Class available since Release 1.0.0
+ */
+class PHPUnit_TestListener {
+    /**
+     * An error occurred.
+     *
+     * @param  object
+     * @param  object
+     * @access public
+     * @abstract
+     */
+    function addError(&$test, &$t) { /*abstract */ }
+
+    /**
+     * A failure occurred.
+     *
+     * @param  object
+     * @param  object
+     * @access public
+     * @abstract
+     */
+    function addFailure(&$test, &$t) { /*abstract */ }
+
+    /**
+     * A test ended.
+     *
+     * @param  object
+     * @access public
+     * @abstract
+     */
+    function endTest(&$test) { /*abstract */ }
+
+    /**
+     * A test started.
+     *
+     * @param  object
+     * @access public
+     * @abstract
+     */
+    function startTest(&$test) { /*abstract */ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestListener.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestResult.php
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestResult.php   
                            (rev 0)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestResult.php   
    2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,321 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 4
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to address@hidden so we can mail you a copy immediately.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      File available since Release 1.0.0
+ */
+
+require_once 'PHPUnit/TestFailure.php';
+require_once 'PHPUnit/TestListener.php';
+
+if (!function_exists('is_a')) {
+    require_once 'PHP/Compat/Function/is_a.php';
+}
+
+/**
+ * A TestResult collects the results of executing a test case.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      Class available since Release 1.0.0
+ */
+class PHPUnit_TestResult {
+    /**
+     * @var    array
+     * @access protected
+     */
+    var $_errors = array();
+
+    /**
+     * @var    array
+     * @access protected
+     */
+    var $_failures = array();
+
+     /**
+     * @var    array
+     * @access protected
+     */
+    var $_listeners = array();
+
+    /**
+     * @var    array
+     * @access protected
+     */
+    var $_passedTests = array();
+
+    /**
+     * @var    integer
+     * @access protected
+     */
+    var $_runTests = 0;
+
+    /**
+     * @var    boolean
+     * @access private
+     */
+    var $_stop = FALSE;
+
+    /**
+     * Adds an error to the list of errors.
+     * The passed in exception caused the error.
+     *
+     * @param  object
+     * @param  object
+     * @access public
+     */
+    function addError(&$test, &$t) {
+        $this->_errors[] = new PHPUnit_TestFailure($test, $t);
+
+        for ($i = 0; $i < sizeof($this->_listeners); $i++) {
+            $this->_listeners[$i]->addError($test, $t);
+        }
+    }
+
+    /**
+     * Adds a failure to the list of failures.
+     * The passed in exception caused the failure.
+     *
+     * @param  object
+     * @param  object
+     * @access public
+     */
+    function addFailure(&$test, &$t) {
+        $this->_failures[] = new PHPUnit_TestFailure($test, $t);
+
+        for ($i = 0; $i < sizeof($this->_listeners); $i++) {
+            $this->_listeners[$i]->addFailure($test, $t);
+        }
+    }
+
+    /**
+     * Registers a TestListener.
+     *
+     * @param  object
+     * @access public
+     */
+    function addListener(&$listener) {
+        if (is_object($listener) &&
+            is_a($listener, 'PHPUnit_TestListener')) {
+            $this->_listeners[] = &$listener;
+        }
+    }
+
+    /**
+     * Adds a passed test to the list of passed tests.
+     *
+     * @param  object
+     * @access public
+     */
+    function addPassedTest(&$test) {
+        $this->_passedTests[] = &$test;
+    }
+
+    /**
+     * Informs the result that a test was completed.
+     *
+     * @param  object
+     * @access public
+     */
+    function endTest(&$test) {
+        for ($i = 0; $i < sizeof($this->_listeners); $i++) {
+            $this->_listeners[$i]->endTest($test);
+        }
+    }
+
+    /**
+     * Gets the number of detected errors.
+     *
+     * @return integer
+     * @access public
+     */
+    function errorCount() {
+        return sizeof($this->_errors);
+    }
+
+    /**
+     * Returns an Enumeration for the errors.
+     *
+     * @return array
+     * @access public
+     */
+    function &errors() {
+        return $this->_errors;
+    }
+
+    /**
+     * Gets the number of detected failures.
+     *
+     * @return integer
+     * @access public
+     */
+    function failureCount() {
+        return sizeof($this->_failures);
+    }
+
+    /**
+     * Returns an Enumeration for the failures.
+     *
+     * @return array
+     * @access public
+     */
+    function &failures() {
+        return $this->_failures;
+    }
+
+    /**
+     * Returns an Enumeration for the passed tests.
+     *
+     * @return array
+     * @access public
+     */
+    function &passedTests() {
+        return $this->_passedTests;
+    }
+
+    /**
+     * Unregisters a TestListener.
+     * This requires the Zend Engine 2 (to work properly).
+     *
+     * @param  object
+     * @access public
+     */
+    function removeListener(&$listener) {
+        for ($i = 0; $i < sizeof($this->_listeners); $i++) {
+            if ($this->_listeners[$i] === $listener) {
+                unset($this->_listeners[$i]);
+            }
+        }
+    }
+
+    /**
+     * Runs a TestCase.
+     *
+     * @param  object
+     * @access public
+     */
+    function run(&$test) {
+        $this->startTest($test);
+        $this->_runTests++;
+        $test->runBare();
+        $this->endTest($test);
+    }
+
+    /**
+     * Gets the number of run tests.
+     *
+     * @return integer
+     * @access public
+     */
+    function runCount() {
+        return $this->_runTests;
+    }
+
+    /**
+     * Checks whether the test run should stop.
+     *
+     * @access public
+     */
+    function shouldStop() {
+        return $this->_stop;
+    }
+
+    /**
+     * Informs the result that a test will be started.
+     *
+     * @param  object
+     * @access public
+     */
+    function startTest(&$test) {
+        for ($i = 0; $i < sizeof($this->_listeners); $i++) {
+            $this->_listeners[$i]->startTest($test);
+        }
+    }
+
+    /**
+     * Marks that the test run should stop.
+     *
+     * @access public
+     */
+    function stop() {
+        $this->_stop = TRUE;
+    }
+
+    /**
+     * Returns a HTML representation of the test result.
+     *
+     * @return string
+     * @access public
+     */
+    function toHTML() {
+        return '<pre>' . htmlspecialchars($this->toString()) . '</pre>';
+    }
+
+    /**
+     * Returns a text representation of the test result.
+     *
+     * @return string
+     * @access public
+     */
+    function toString() {
+        $result = '';
+
+        foreach ($this->_passedTests as $passedTest) {
+            $result .= sprintf(
+              "TestCase %s->%s() passed\n",
+
+              get_class($passedTest),
+              $passedTest->getName()
+            );
+        }
+
+        foreach ($this->_failures as $failedTest) {
+            $result .= $failedTest->toString();
+        }
+
+        return $result;
+    }
+
+    /**
+     * Returns whether the entire test was successful or not.
+     *
+     * @return boolean
+     * @access public
+     */
+    function wasSuccessful() {
+        if (empty($this->_errors) && empty($this->_failures)) {
+            return TRUE;
+        } else {
+            return FALSE;
+        }
+    }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestResult.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestSuite.php
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestSuite.php    
                            (rev 0)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestSuite.php    
    2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,239 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 4
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to address@hidden so we can mail you a copy immediately.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      File available since Release 1.0.0
+ */
+
+require_once 'PHPUnit/TestCase.php';
+
+/**
+ * A TestSuite is a Composite of Tests. It runs a collection of test cases.
+ *
+ * Here is an example using the dynamic test definition.
+ *
+ * <code>
+ * <?php
+ * $suite = new PHPUnit_TestSuite();
+ * $suite->addTest(new MathTest('testPass'));
+ * ?>
+ * </code>
+ *
+ * Alternatively, a TestSuite can extract the tests to be run automatically.
+ * To do so you pass the classname of your TestCase class to the TestSuite
+ * constructor.
+ *
+ * <code>
+ * <?php
+ * $suite = new TestSuite('classname');
+ * ?>
+ * </code>
+ *
+ * This constructor creates a suite with all the methods starting with
+ * "test" that take no arguments.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      Class available since Release 1.0.0
+ */
+class PHPUnit_TestSuite {
+    /**
+     * The name of the test suite.
+     *
+     * @var    string
+     * @access private
+     */
+    var $_name = '';
+
+    /**
+     * The tests in the test suite.
+     *
+     * @var    array
+     * @access private
+     */
+    var $_tests = array();
+
+    /**
+     * Constructs a TestSuite.
+     *
+     * @param  mixed
+     * @access public
+     */
+    function PHPUnit_TestSuite($test = FALSE) {
+        if ($test !== FALSE) {
+            $this->setName($test);
+            $this->addTestSuite($test);
+        }
+    }
+
+    /**
+     * Adds a test to the suite.
+     *
+     * @param  object
+     * @access public
+     */
+    function addTest(&$test) {
+        $this->_tests[] = &$test;
+    }
+
+    /**
+     * Adds the tests from the given class to the suite.
+     *
+     * @param  string
+     * @access public
+     */
+    function addTestSuite($testClass) {
+        if (class_exists($testClass)) {
+            $methods       = get_class_methods($testClass);
+            $parentClasses = array(strtolower($testClass));
+            $parentClass   = $testClass;
+
+            while(is_string($parentClass = get_parent_class($parentClass))) {
+                $parentClasses[] = $parentClass;
+            }
+
+            foreach ($methods as $method) {
+                if (substr($method, 0, 4) == 'test' &&
+                    !in_array($method, $parentClasses)) {
+                    $this->addTest(new $testClass($method));
+                }
+            }
+        }
+    }
+
+    /**
+     * Counts the number of test cases that will be run by this test.
+     *
+     * @return integer
+     * @access public
+     */
+    function countTestCases() {
+        $count = 0;
+
+        foreach ($this->_tests as $test) {
+            $count += $test->countTestCases();
+        }
+
+        return $count;
+    }
+
+    /**
+     * Returns the name of the suite.
+     *
+     * @return string
+     * @access public
+     */
+    function getName() {
+        return $this->_name;
+    }
+
+    /**
+     * Runs the tests and collects their result in a TestResult.
+     *
+     * @param  object
+     * @access public
+     */
+    function run(&$result, $show_progress='') {
+        for ($i = 0; $i < sizeof($this->_tests) && !$result->shouldStop(); 
$i++) {
+            $this->_tests[$i]->run($result);
+            if ($show_progress != '') {
+                echo $show_progress; flush(); @ob_flush();
+            }
+        }
+    }
+
+    /**
+     * Runs a test.
+     *
+     * @param  object
+     * @param  object
+     * @access public
+     */
+    function runTest(&$test, &$result) {
+        $test->run($result);
+    }
+
+    /**
+     * Sets the name of the suite.
+     *
+     * @param  string
+     * @access public
+     */
+    function setName($name) {
+        $this->_name = $name;
+    }
+
+    /**
+     * Returns the test at the given index.
+     *
+     * @param  integer
+     * @return object
+     * @access public
+     */
+    function &testAt($index) {
+        if (isset($this->_tests[$index])) {
+            return $this->_tests[$index];
+        } else {
+            return FALSE;
+        }
+    }
+
+    /**
+     * Returns the number of tests in this suite.
+     *
+     * @return integer
+     * @access public
+     */
+    function testCount() {
+        return sizeof($this->_tests);
+    }
+
+    /**
+     * Returns the tests as an enumeration.
+     *
+     * @return array
+     * @access public
+     */
+    function &tests() {
+        return $this->_tests;
+    }
+
+    /**
+     * Returns a string representation of the test suite.
+     *
+     * @return string
+     * @access public
+     */
+    function toString() {
+        return '';
+    }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/PHPUnit/TestSuite.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/benchmark.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/benchmark.php        
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/benchmark.php        
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,301 @@
+<?php
+/**
+ * Benchamrking suite for the PHP-XMLRPC lib
+ * @author Gaetano Giunta
+ * @version $Id$
+ * @copyright (c) 2005-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ *
+ * @todo add a test for response ok in call testing?
+ **/
+
+       include(getcwd().'/parse_args.php');
+
+       require_once('xmlrpc.inc');
+
+       // Set up PHP structures to be used in many tests
+       $data1 = array(1, 1.0, 'hello world', true, '20051021T23:43:00', -1, 
11.0, 'address@hidden&*()_+|', false, '20051021T23:43:00');
+       $data2 = array('zero' => $data1, 'one' => $data1, 'two' => $data1, 
'three' => $data1, 'four' => $data1, 'five' => $data1, 'six' => $data1, 'seven' 
=> $data1, 'eight' => $data1, 'nine' => $data1);
+       $data = array($data2, $data2, $data2, $data2, $data2, $data2, $data2, 
$data2, $data2, $data2);
+       $keys = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 
'seven', 'eight', 'nine');
+
+       $test_results=array();
+       $xd = extension_loaded('xdebug') && ini_get('xdebug.profiler_enable');
+       if ($xd)
+               $num_tests = 1;
+       else
+               $num_tests = 10;
+
+       $title = 'XML-RPC Benchmark Tests';
+
+       if(isset($_SERVER['REQUEST_METHOD']))
+       {
+               echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 
Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\n<html 
xmlns=\"http://www.w3.org/1999/xhtml\"; lang=\"en\" 
xml:lang=\"en\">\n<head>\n<title>$title</title>\n</head>\n<body>\n<h1>$title</h1>\n<pre>\n";
+       }
+       else
+       {
+               echo "$title\n\n";
+       }
+
+       if(isset($_SERVER['REQUEST_METHOD']))
+       {
+               echo "<h3>Using lib version: $xmlrpcVersion on PHP version: 
".phpversion()."</h3>\n";
+               if ($xd) echo "<h4>XDEBUG profiling enabled: skipping remote 
tests. Trace file is: 
".htmlspecialchars(xdebug_get_profiler_filename())."</h4>\n";
+               flush();
+               ob_flush();
+       }
+       else
+       {
+               echo "Using lib version: $xmlrpcVersion on PHP version: 
".phpversion()."\n";
+               if ($xd) echo "XDEBUG profiling enabled: skipping remote 
tests\nTrace file is: ".xdebug_get_profiler_filename()."\n";
+       }
+
+       // test 'old style' data encoding vs. 'automatic style' encoding
+       begin_test('Data encoding (large array)', 'manual encoding');
+       for ($i = 0; $i < $num_tests; $i++)
+       {
+               $vals = array();
+               for ($j = 0; $j < 10; $j++)
+               {
+                       $valarray = array();
+                       foreach ($data[$j] as $key => $val)
+                       {
+                               $values = array();
+                               $values[] = new xmlrpcval($val[0], 'int');
+                               $values[] = new xmlrpcval($val[1], 'double');
+                               $values[] = new xmlrpcval($val[2], 'string');
+                               $values[] = new xmlrpcval($val[3], 'boolean');
+                               $values[] = new xmlrpcval($val[4], 
'dateTime.iso8601');
+                               $values[] = new xmlrpcval($val[5], 'int');
+                               $values[] = new xmlrpcval($val[6], 'double');
+                               $values[] = new xmlrpcval($val[7], 'string');
+                               $values[] = new xmlrpcval($val[8], 'boolean');
+                               $values[] = new xmlrpcval($val[9], 
'dateTime.iso8601');
+                               $valarray[$key] = new xmlrpcval($values, 
'array');
+                       }
+                       $vals[] = new xmlrpcval($valarray, 'struct');
+               }
+               $value = new xmlrpcval($vals, 'array');
+               $out = $value->serialize();
+       }
+       end_test('Data encoding (large array)', 'manual encoding', $out);
+
+       begin_test('Data encoding (large array)', 'automatic encoding');
+       for ($i = 0; $i < $num_tests; $i++)
+       {
+               $value = php_xmlrpc_encode($data, array('auto_dates'));
+               $out = $value->serialize();
+       }
+       end_test('Data encoding (large array)', 'automatic encoding', $out);
+
+       if (function_exists('xmlrpc_set_type'))
+       {
+       begin_test('Data encoding (large array)', 'xmlrpc-epi encoding');
+       for ($i = 0; $i < $num_tests; $i++)
+       {
+               for ($j = 0; $j < 10; $j++)
+                       foreach ($keys as $k)
+                       {
+                               xmlrpc_set_type($data[$j][$k][4], 'datetime');
+                               xmlrpc_set_type($data[$j][$k][8], 'datetime');
+                       }
+               $out = xmlrpc_encode($data);
+       }
+       end_test('Data encoding (large array)', 'xmlrpc-epi encoding', $out);
+       }
+
+       // test 'old style' data decoding vs. 'automatic style' decoding
+       $dummy = new xmlrpcmsg('');
+       $out = new xmlrpcresp($value);
+       $in = '<?xml version="1.0" ?>'."\n".$out->serialize();
+
+       begin_test('Data decoding (large array)', 'manual decoding');
+       for ($i = 0; $i < $num_tests; $i++)
+       {
+               $response =& $dummy->ParseResponse($in, true);
+               $value = $response->value();
+               $result = array();
+               for ($k = 0; $k < $value->arraysize(); $k++)
+               {
+                       $val1 = $value->arraymem($k);
+                       $out = array();
+                       while (list($name, $val) = $val1->structeach())
+                       {
+                               $out[$name] = array();
+                               for ($j = 0; $j < $val->arraysize(); $j++)
+                               {
+                                       $data = $val->arraymem($j);
+                                       $out[$name][] = $data->scalarval();
+                               }
+                       } // while
+                       $result[] = $out;
+               }
+       }
+       end_test('Data decoding (large array)', 'manual decoding', $result);
+
+       begin_test('Data decoding (large array)', 'automatic decoding');
+       for ($i = 0; $i < $num_tests; $i++)
+       {
+               $response =& $dummy->ParseResponse($in, true, 'phpvals');
+               $value = $response->value();
+       }
+       end_test('Data decoding (large array)', 'automatic decoding', $value);
+
+       if (function_exists('xmlrpc_decode'))
+       {
+       begin_test('Data decoding (large array)', 'xmlrpc-epi decoding');
+       for ($i = 0; $i < $num_tests; $i++)
+       {
+               $response =& $dummy->ParseResponse($in, true, 'xml');
+               $value = xmlrpc_decode($response->value());
+       }
+       end_test('Data decoding (large array)', 'xmlrpc-epi decoding', $value);
+       }
+
+       if (!$xd) {
+
+       /// test multicall vs. many calls vs. keep-alives
+       $value = php_xmlrpc_encode($data1, array('auto_dates'));
+       $msg = new xmlrpcmsg('interopEchoTests.echoValue', array($value));
+       $msgs=array();
+       for ($i = 0; $i < 25; $i++)
+               $msgs[] = $msg;
+       $server = explode(':', $LOCALSERVER);
+       if(count($server) > 1)
+       {
+               $c = new xmlrpc_client($URI, $server[0], $server[1]);
+       }
+       else
+       {
+               $c = new xmlrpc_client($URI, $LOCALSERVER);
+       }
+       // do not interfere with http compression
+       $c->accepted_compression = array();
+       //$c->debug=true;
+
+       if (function_exists('gzinflate')) {
+               $c->accepted_compression = null;
+       }
+       begin_test('Repeated send (small array)', 'http 10');
+       $response = array();
+       for ($i = 0; $i < 25; $i++)
+       {
+               $resp =& $c->send($msg);
+               $response[] = $resp->value();
+       }
+       end_test('Repeated send (small array)', 'http 10', $response);
+
+       if (function_exists('curl_init'))
+       {
+               begin_test('Repeated send (small array)', 'http 11 w. 
keep-alive');
+               $response = array();
+               for ($i = 0; $i < 25; $i++)
+               {
+                       $resp =& $c->send($msg, 10, 'http11');
+                       $response[] = $resp->value();
+               }
+               end_test('Repeated send (small array)', 'http 11 w. 
keep-alive', $response);
+
+               $c->keepalive = false;
+               begin_test('Repeated send (small array)', 'http 11');
+               $response = array();
+               for ($i = 0; $i < 25; $i++)
+               {
+                       $resp =& $c->send($msg, 10, 'http11');
+                       $response[] = $resp->value();
+               }
+               end_test('Repeated send (small array)', 'http 11', $response);
+       }
+
+       begin_test('Repeated send (small array)', 'multicall');
+       $response =& $c->send($msgs);
+       foreach ($response as $key =>& $val)
+       {
+           $val = $val->value();
+       }
+       end_test('Repeated send (small array)', 'multicall', $response);
+
+       if (function_exists('gzinflate'))
+       {
+               $c->accepted_compression = array('gzip');
+               $c->request_compression = 'gzip';
+
+               begin_test('Repeated send (small array)', 'http 10 w. 
compression');
+               $response = array();
+               for ($i = 0; $i < 25; $i++)
+               {
+                       $resp =& $c->send($msg);
+                       $response[] = $resp->value();
+               }
+               end_test('Repeated send (small array)', 'http 10 w. 
compression', $response);
+
+        if (function_exists('curl_init'))
+        {
+            begin_test('Repeated send (small array)', 'http 11 w. keep-alive 
and compression');
+            $response = array();
+            for ($i = 0; $i < 25; $i++)
+            {
+                $resp =& $c->send($msg, 10, 'http11');
+                $response[] = $resp->value();
+            }
+            end_test('Repeated send (small array)', 'http 11 w. keep-alive and 
compression', $response);
+
+            $c->keepalive = false;
+            begin_test('Repeated send (small array)', 'http 11 w. 
compression');
+            $response = array();
+            for ($i = 0; $i < 25; $i++)
+            {
+                $resp =& $c->send($msg, 10, 'http11');
+                $response[] = $resp->value();
+            }
+            end_test('Repeated send (small array)', 'http 11 w. compression', 
$response);
+        }
+
+        begin_test('Repeated send (small array)', 'multicall w. compression');
+        $response =& $c->send($msgs);
+        foreach ($response as $key =>& $val)
+        {
+            $val = $val->value();
+        }
+        end_test('Repeated send (small array)', 'multicall w. compression', 
$response);
+       }
+
+       } // end of 'if no xdebug profiling'
+
+       function begin_test($test_name, $test_case)
+       {
+               global $test_results;
+               if (!isset($test_results[$test_name]))
+                       $test_results[$test_name]=array();
+               $test_results[$test_name][$test_case] = array();
+               $test_results[$test_name][$test_case]['time'] = microtime(true);
+       }
+
+       function end_test($test_name, $test_case, $test_result)
+       {
+               global $test_results;
+               $end = microtime(true);
+               if (!isset($test_results[$test_name][$test_case]))
+                       trigger_error('ending test that was not sterted');
+               $test_results[$test_name][$test_case]['time'] = $end - 
$test_results[$test_name][$test_case]['time'];
+               $test_results[$test_name][$test_case]['result'] = $test_result;
+               echo '.';
+               flush();
+               ob_flush();
+       }
+
+
+       echo "\n";
+       foreach($test_results as $test => $results)
+       {
+               echo "\nTEST: $test\n";
+               foreach ($results as $case => $data)
+                       echo "  $case: {$data['time']} secs - Output data CRC: 
".crc32(serialize($data['result']))."\n";
+       }
+
+
+       if(isset($_SERVER['REQUEST_METHOD']))
+       {
+               echo "\n</pre>\n</body>\n</html>\n";
+       }
+?>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/benchmark.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/parse_args.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/parse_args.php       
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/parse_args.php       
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Common parameter parsing for benchmarks and tests scripts
+ *
+ * @param integer DEBUG
+ * @param string  LOCALSERVER
+ * @param string  URI
+ * @param string  HTTPSSERVER
+ * @param string  HTTPSSURI
+ * @param string  PROXY
+ *
+ * @version $Id$
+ * @copyright (C) 2007-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ **/
+
+       require_once('xmlrpc.inc');
+       require_once('xmlrpcs.inc');
+
+       // play nice to older PHP versions that miss superglobals
+       if(!isset($_SERVER))
+       {
+               $_SERVER = $HTTP_SERVER_VARS;
+               $_GET = isset($HTTP_GET_VARS) ? $HTTP_GET_VARS : array();
+               $_POST = isset($HTTP_POST_VARS) ? $HTTP_POST_VARS : array();
+       }
+
+       // check for command line vs web page input params
+       if(!isset($_SERVER['REQUEST_METHOD']))
+       {
+               if(isset($argv))
+               {
+                       foreach($argv as $param)
+                       {
+                               $param = explode('=', $param);
+                               if(count($param) > 1)
+                               {
+                                       $$param[0]=$param[1];
+                               }
+                       }
+               }
+       }
+       elseif(!ini_get('register_globals'))
+       {
+               // play nice to 'safe' PHP installations with register globals 
OFF
+               // NB: we might as well consider using $_GET stuff later on...
+               extract($_GET);
+               extract($_POST);
+       }
+
+       if(!isset($DEBUG))
+       {
+               $DEBUG = 0;
+       }
+       else
+       {
+               $DEBUG = intval($DEBUG);
+       }
+
+       if(!isset($LOCALSERVER))
+       {
+               if(isset($HTTP_HOST))
+               {
+                       $LOCALSERVER = $HTTP_HOST;
+               }
+               elseif(isset($_SERVER['HTTP_HOST']))
+               {
+                       $LOCALSERVER = $_SERVER['HTTP_HOST'];
+               }
+               else
+               {
+                       $LOCALSERVER = 'localhost';
+               }
+       }
+       if(!isset($HTTPSSERVER))
+       {
+               $HTTPSSERVER = 'xmlrpc.usefulinc.com';
+       }
+       if(!isset($HTTPSURI))
+       {
+               $HTTPSURI = '/server.php';
+       }
+       if(!isset($PROXY))
+       {
+               $PROXYSERVER = null;
+       }
+       else
+       {
+               $arr = explode(':',$PROXY);
+               $PROXYSERVER = $arr[0];
+               if(count($arr) > 1)
+               {
+                       $PROXYPORT = $arr[1];
+               }
+               else
+               {
+                       $PROXYPORT = 8080;
+               }
+       }
+       if(!isset($URI))
+       {
+               // GUESTIMATE the url of local demo server
+               // play nice to php 3 and 4-5 in retrieving URL of server.php
+               /// @todo filter out query string from REQUEST_URI
+               if(isset($REQUEST_URI))
+               {
+                       $URI = str_replace('/test/testsuite.php', 
'/demo/server/server.php', $REQUEST_URI);
+                       $URI = str_replace('/testsuite.php', '/server.php', 
$URI);
+                       $URI = str_replace('/test/benchmark.php', 
'/demo/server/server.php', $URI);
+                       $URI = str_replace('/benchmark.php', '/server.php', 
$URI);
+               }
+               elseif(isset($_SERVER['PHP_SELF']) && 
isset($_SERVER['REQUEST_METHOD']))
+               {
+                       $URI = str_replace('/test/testsuite.php', 
'/demo/server/server.php', $_SERVER['PHP_SELF']);
+                       $URI = str_replace('/testsuite.php', '/server.php', 
$URI);
+                       $URI = str_replace('/test/benchmark.php', 
'/demo/server/server.php', $URI);
+                       $URI = str_replace('/benchmark.php', '/server.php', 
$URI);
+               }
+               else
+               {
+                       $URI = '/demo/server/server.php';
+               }
+       }
+       if($URI[0] != '/')
+       {
+               $URI = '/'.$URI;
+       }
+       if(!isset($LOCALPATH))
+       {
+               $LOCALPATH = dirname(__FILE__);
+       }
+?>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/parse_args.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/phpunit.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/phpunit.php          
                (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/phpunit.php  
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,106 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 4
+ *
+ * LICENSE: This source file is subject to version 3.0 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to address@hidden so we can mail you a copy immediately.
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    CVS: $Id$
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      File available since Release 1.0.0
+ */
+
+require_once 'PHPUnit/TestCase.php';
+require_once 'PHPUnit/TestResult.php';
+require_once 'PHPUnit/TestSuite.php';
+
+/**
+ * PHPUnit runs a TestSuite and returns a TestResult object.
+ *
+ * Here is an example:
+ *
+ * <code>
+ * <?php
+ * require_once 'PHPUnit.php';
+ *
+ * class MathTest extends PHPUnit_TestCase {
+ *     var $fValue1;
+ *     var $fValue2;
+ *
+ *     function MathTest($name) {
+ *       $this->PHPUnit_TestCase($name);
+ *     }
+ *
+ *     function setUp() {
+ *       $this->fValue1 = 2;
+ *       $this->fValue2 = 3;
+ *     }
+ *
+ *     function testAdd() {
+ *       $this->assertTrue($this->fValue1 + $this->fValue2 == 5);
+ *     }
+ * }
+ *
+ * $suite = new PHPUnit_TestSuite();
+ * $suite->addTest(new MathTest('testAdd'));
+ *
+ * $result = PHPUnit::run($suite);
+ * print $result->toHTML();
+ * ?>
+ * </code>
+ *
+ * Alternatively, you can pass a class name to the PHPUnit_TestSuite()
+ * constructor and let it automatically add all methods of that class
+ * that start with 'test' to the suite:
+ *
+ * <code>
+ * <?php
+ * $suite  = new PHPUnit_TestSuite('MathTest');
+ * $result = PHPUnit::run($suite);
+ * print $result->toHTML();
+ * ?>
+ * </code>
+ *
+ * @category   Testing
+ * @package    PHPUnit
+ * @author     Sebastian Bergmann <address@hidden>
+ * @copyright  2002-2005 Sebastian Bergmann <address@hidden>
+ * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
+ * @version    Release: @package_version@
+ * @link       http://pear.php.net/package/PHPUnit
+ * @since      Class available since Release 1.0.0
+ */
+class PHPUnit {
+    /**
+     * Runs a test(suite).
+     *
+     * @param  mixed
+     * @return PHPUnit_TestResult
+     * @access public
+     */
+    function &run(&$suite, $show_progress=false) {
+        $result = new PHPUnit_TestResult();
+        $suite->run($result, $show_progress);
+
+        return $result;
+    }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/phpunit.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/testsuite.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/testsuite.php        
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/testsuite.php        
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,1519 @@
+<?php
+       /* $Id$ */
+
+       include(getcwd().'/parse_args.php');
+
+       require_once('xmlrpc.inc');
+       require_once('xmlrpcs.inc');
+       require_once('xmlrpc_wrappers.inc');
+
+       require_once 'phpunit.php';
+       //require_once 'PHPUnit/TestDecorator.php';
+
+       // let testuite run for the needed time
+       if ((int)ini_get('max_execution_time') < 180)
+               ini_set('max_execution_time', 180);
+
+       ini_set('max_execution_time', 180);
+
+       $suite = new PHPUnit_TestSuite();
+
+       // array with list of failed tests
+       $failed_tests = array();
+
+       class LocalhostTests extends PHPUnit_TestCase
+       {
+               var $client = null;
+               var $method = 'http';
+               var $timeout = 10;
+               var $request_compression = null;
+               var $accepted_compression = '';
+
+               function fail($message = '')
+               {
+                       PHPUnit_TestCase::fail($message);
+                       // save in global var that this particular test has 
failed
+                       // (but only if not called from subclass objects / 
multitests)
+                       if (function_exists('debug_backtrace') && 
strtolower(get_class($this)) == 'localhosttests')
+                       {
+                               global $failed_tests;
+                               $trace = debug_backtrace();
+                               for ($i = 0; $i < count($trace); $i++)
+                               {
+                                       if (strpos($trace[$i]['function'], 
'test') === 0)
+                                       {
+                                               
$failed_tests[$trace[$i]['function']] = true;
+                                               break;
+                                       }
+                               }
+                       }
+               }
+
+               function setUp()
+               {
+                       global $DEBUG, $LOCALSERVER, $URI;
+                       $server = explode(':', $LOCALSERVER);
+                       if(count($server) > 1)
+                       {
+                               $this->client=new xmlrpc_client($URI, 
$server[0], $server[1]);
+                       }
+                       else
+                       {
+                               $this->client=new xmlrpc_client($URI, 
$LOCALSERVER);
+                       }
+                       if($DEBUG)
+                       {
+                               $this->client->setDebug($DEBUG);
+                       }
+                       $this->client->request_compression = 
$this->request_compression;
+                       $this->client->accepted_compression = 
$this->accepted_compression;
+               }
+
+               function send($msg, $errrorcode=0, $return_response=false)
+               {
+                       $r = $this->client->send($msg, $this->timeout, 
$this->method);
+                       // for multicall, return directly array of responses
+                       if(is_array($r))
+                       {
+                               return $r;
+                       }
+                       $this->assertEquals($r->faultCode(), $errrorcode, 
'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
+                       if(!$r->faultCode())
+                       {
+                               if($return_response)
+                                       return $r;
+                               else
+                                       return $r->value();
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+
+               function testString()
+               {
+                       $sendstring="here are 3 \"entities\": < > &" .
+                               "and here's a dollar sign: \$pretendvarname and 
a backslash too: " . chr(92) .
+                               " - isn't that great? \\\"hackery\\\" at it's 
best " .
+                               " also don't want to miss out on \$item[0]. ".
+                               "The real weird stuff follows: CRLF 
here".chr(13).chr(10).
+                               "a simple CR here".chr(13).
+                               "a simple LF here".chr(10).
+                               "and then LFCR".chr(10).chr(13).
+                               "last but not least weird names: G\xFCnter, 
El\xE8ne, and an xml comment closing tag: -->";
+                       $f=new xmlrpcmsg('examples.stringecho', array(
+                               new xmlrpcval($sendstring, 'string')
+                       ));
+                       $v=$this->send($f);
+                       if($v)
+                       {
+                               // when sending/receiving non-US-ASCII encoded 
strings, XML says cr-lf can be normalized.
+                               // so we relax our tests...
+                               $l1 = strlen($sendstring);
+                               $l2 = strlen($v->scalarval());
+                               if ($l1 == $l2)
+                                       $this->assertEquals($sendstring, 
$v->scalarval());
+                               else
+                                       
$this->assertEquals(str_replace(array("\r\n", "\r"), array("\n", "\n"), 
$sendstring), $v->scalarval());
+                       }
+               }
+
+               function testAddingDoubles()
+               {
+                       // note that rounding errors mean i
+                       // keep precision to sensible levels here ;-)
+                       $a=12.13; $b=-23.98;
+                       $f=new xmlrpcmsg('examples.addtwodouble',array(
+                               new xmlrpcval($a, 'double'),
+                               new xmlrpcval($b, 'double')
+                       ));
+                       $v=$this->send($f);
+                       if($v)
+                       {
+                               $this->assertEquals($a+$b,$v->scalarval());
+                       }
+               }
+
+               function testAdding()
+               {
+                       $f=new xmlrpcmsg('examples.addtwo',array(
+                               new xmlrpcval(12, 'int'),
+                               new xmlrpcval(-23, 'int')
+                       ));
+                       $v=$this->send($f);
+                       if($v)
+                       {
+                               $this->assertEquals(12-23, $v->scalarval());
+                       }
+               }
+
+               function testInvalidNumber()
+               {
+                       $f=new xmlrpcmsg('examples.addtwo',array(
+                               new xmlrpcval('fred', 'int'),
+                               new xmlrpcval("\"; exec('ls')", 'int')
+                       ));
+                       $v=$this->send($f);
+                       /// @todo a fault condition should be generated here
+                       /// by the server, which we pick up on
+                       if($v)
+                       {
+                               $this->assertEquals(0, $v->scalarval());
+                       }
+               }
+
+               function testBoolean()
+               {
+                       $f=new xmlrpcmsg('examples.invertBooleans', array(
+                               new xmlrpcval(array(
+                                       new xmlrpcval(true, 'boolean'),
+                                       new xmlrpcval(false, 'boolean'),
+                                       new xmlrpcval(1, 'boolean'),
+                                       new xmlrpcval(0, 'boolean'),
+                                       //new xmlrpcval('true', 'boolean'),
+                                       //new xmlrpcval('false', 'boolean')
+                               ),
+                               'array'
+                       )));
+                       $answer='0101';
+                       $v=$this->send($f);
+                       if($v)
+                       {
+                               $sz=$v->arraysize();
+                               $got='';
+                               for($i=0; $i<$sz; $i++)
+                               {
+                                       $b=$v->arraymem($i);
+                                       if($b->scalarval())
+                                       {
+                                               $got.='1';
+                                       }
+                                       else
+                                       {
+                                               $got.='0';
+                                       }
+                               }
+                               $this->assertEquals($answer, $got);
+                       }
+               }
+
+               function testBase64()
+               {
+                       $sendstring='Mary had a little lamb,
+Whose fleece was white as snow,
+And everywhere that Mary went
+the lamb was sure to go.
+
+Mary had a little lamb
+She tied it to a pylon
+Ten thousand volts went down its back
+And turned it into nylon';
+                       $f=new xmlrpcmsg('examples.decode64',array(
+                               new xmlrpcval($sendstring, 'base64')
+                       ));
+                       $v=$this->send($f);
+                       if($v)
+                       {
+                               if (strlen($sendstring) == 
strlen($v->scalarval()))
+                                       $this->assertEquals($sendstring, 
$v->scalarval());
+                               else
+                                       
$this->assertEquals(str_replace(array("\r\n", "\r"), array("\n", "\n"), 
$sendstring), $v->scalarval());
+                       }
+               }
+
+        function testDateTime()
+        {
+            $time = time();
+            $t1 = new xmlrpcval($time, 'dateTime.iso8601');
+            $t2 = new xmlrpcval(iso8601_encode($time), 'dateTime.iso8601');
+            $this->assertEquals($t1->serialize(), $t2->serialize());
+            if (class_exists('DateTime'))
+            {
+                $datetime = new DateTime();
+                $t3 = new xmlrpcval($datetime->setTimestamp($time), 
'dateTime.iso8601');
+                $this->assertEquals($t1->serialize(), $t3->serialize());
+            }
+        }
+
+               function testCountEntities()
+               {
+                       $sendstring = "h'fd>onc>>l>>rw&bpu>q>e<v&gxs<ytjzkami<";
+                       $f = new xmlrpcmsg('validator1.countTheEntities',array(
+                               new xmlrpcval($sendstring, 'string')
+                       ));
+                       $v = $this->send($f);
+                       if($v)
+                       {
+                               $got = '';
+                               $expected = '37210';
+                               $expect_array = 
array('ctLeftAngleBrackets','ctRightAngleBrackets','ctAmpersands','ctApostrophes','ctQuotes');
+                               while(list(,$val) = each($expect_array))
+                               {
+                                       $b = $v->structmem($val);
+                                       $got .= $b->me['int'];
+                               }
+                               $this->assertEquals($expected, $got);
+                       }
+               }
+
+               function _multicall_msg($method, $params)
+               {
+                       $struct['methodName'] = new xmlrpcval($method, 
'string');
+                       $struct['params'] = new xmlrpcval($params, 'array');
+                       return new xmlrpcval($struct, 'struct');
+               }
+
+               function testServerMulticall()
+               {
+                       // We manually construct a system.multicall() call to 
ensure
+                       // that the server supports it.
+
+                       // NB: This test will NOT pass if server does not 
support system.multicall.
+
+                       // Based on 
http://xmlrpc-c.sourceforge.net/hacks/test_multicall.py
+                       $good1 = $this->_multicall_msg(
+                               'system.methodHelp',
+                               array(php_xmlrpc_encode('system.listMethods')));
+                       $bad = $this->_multicall_msg(
+                               'test.nosuch',
+                               array(php_xmlrpc_encode(1), 
php_xmlrpc_encode(2)));
+                       $recursive = $this->_multicall_msg(
+                               'system.multicall',
+                               array(new xmlrpcval(array(), 'array')));
+                       $good2 = $this->_multicall_msg(
+                               'system.methodSignature',
+                               array(php_xmlrpc_encode('system.listMethods')));
+                       $arg = new xmlrpcval(
+                               array($good1, $bad, $recursive, $good2),
+                               'array'
+                       );
+
+                       $f = new xmlrpcmsg('system.multicall', array($arg));
+                       $v = $this->send($f);
+                       if($v)
+                       {
+                               //$this->assertTrue($r->faultCode() == 0, 
"fault from system.multicall");
+                               $this->assertTrue($v->arraysize() == 4, "bad 
number of return values");
+
+                               $r1 = $v->arraymem(0);
+                               $this->assertTrue(
+                                       $r1->kindOf() == 'array' && 
$r1->arraysize() == 1,
+                                       "did not get array of size 1 from good1"
+                               );
+
+                               $r2 = $v->arraymem(1);
+                               $this->assertTrue(
+                                       $r2->kindOf() == 'struct',
+                                       "no fault from bad"
+                               );
+
+                               $r3 = $v->arraymem(2);
+                               $this->assertTrue(
+                                       $r3->kindOf() == 'struct',
+                                       "recursive system.multicall did not 
fail"
+                               );
+
+                               $r4 = $v->arraymem(3);
+                               $this->assertTrue(
+                                       $r4->kindOf() == 'array' && 
$r4->arraysize() == 1,
+                                       "did not get array of size 1 from good2"
+                               );
+                       }
+               }
+
+               function testClientMulticall1()
+               {
+                       // NB: This test will NOT pass if server does not 
support system.multicall.
+
+                       $this->client->no_multicall = false;
+
+                       $good1 = new xmlrpcmsg('system.methodHelp',
+                               array(php_xmlrpc_encode('system.listMethods')));
+                       $bad = new xmlrpcmsg('test.nosuch',
+                               array(php_xmlrpc_encode(1), 
php_xmlrpc_encode(2)));
+                       $recursive = new xmlrpcmsg('system.multicall',
+                               array(new xmlrpcval(array(), 'array')));
+                       $good2 = new xmlrpcmsg('system.methodSignature',
+                               array(php_xmlrpc_encode('system.listMethods'))
+                       );
+
+                       $r = $this->send(array($good1, $bad, $recursive, 
$good2));
+                       if($r)
+                       {
+                               $this->assertTrue(count($r) == 4, "wrong number 
of return values");
+                       }
+
+                       $this->assertTrue($r[0]->faultCode() == 0, "fault from 
good1");
+                       if(!$r[0]->faultCode())
+                       {
+                               $val = $r[0]->value();
+                               $this->assertTrue(
+                                       $val->kindOf() == 'scalar' && 
$val->scalartyp() == 'string',
+                                       "good1 did not return string"
+                               );
+                       }
+                       $this->assertTrue($r[1]->faultCode() != 0, "no fault 
from bad");
+                       $this->assertTrue($r[2]->faultCode() != 0, "no fault 
from recursive system.multicall");
+                       $this->assertTrue($r[3]->faultCode() == 0, "fault from 
good2");
+                       if(!$r[3]->faultCode())
+                       {
+                               $val = $r[3]->value();
+                               $this->assertTrue($val->kindOf() == 'array', 
"good2 did not return array");
+                       }
+                       // This is the only assert in this test which should 
fail
+                       // if the test server does not support system.multicall.
+                       $this->assertTrue($this->client->no_multicall == false,
+                               "server does not support system.multicall"
+                       );
+               }
+
+               function testClientMulticall2()
+               {
+                       // NB: This test will NOT pass if server does not 
support system.multicall.
+
+                       $this->client->no_multicall = true;
+
+                       $good1 = new xmlrpcmsg('system.methodHelp',
+                               array(php_xmlrpc_encode('system.listMethods')));
+                       $bad = new xmlrpcmsg('test.nosuch',
+                               array(php_xmlrpc_encode(1), 
php_xmlrpc_encode(2)));
+                       $recursive = new xmlrpcmsg('system.multicall',
+                               array(new xmlrpcval(array(), 'array')));
+                       $good2 = new xmlrpcmsg('system.methodSignature',
+                               array(php_xmlrpc_encode('system.listMethods'))
+                       );
+
+                       $r = $this->send(array($good1, $bad, $recursive, 
$good2));
+                       if($r)
+                       {
+                               $this->assertTrue(count($r) == 4, "wrong number 
of return values");
+                       }
+
+                       $this->assertTrue($r[0]->faultCode() == 0, "fault from 
good1");
+                       if(!$r[0]->faultCode())
+                       {
+                               $val = $r[0]->value();
+                               $this->assertTrue(
+                                       $val->kindOf() == 'scalar' && 
$val->scalartyp() == 'string',
+                                       "good1 did not return string");
+                       }
+                       $this->assertTrue($r[1]->faultCode() != 0, "no fault 
from bad");
+                       $this->assertTrue($r[2]->faultCode() == 0, "fault from 
(non recursive) system.multicall");
+                       $this->assertTrue($r[3]->faultCode() == 0, "fault from 
good2");
+                       if(!$r[3]->faultCode())
+                       {
+                               $val = $r[3]->value();
+                               $this->assertTrue($val->kindOf() == 'array', 
"good2 did not return array");
+                       }
+               }
+
+               function testClientMulticall3()
+               {
+                       // NB: This test will NOT pass if server does not 
support system.multicall.
+
+                       $this->client->return_type = 'phpvals';
+                       $this->client->no_multicall = false;
+
+                       $good1 = new xmlrpcmsg('system.methodHelp',
+                               array(php_xmlrpc_encode('system.listMethods')));
+                       $bad = new xmlrpcmsg('test.nosuch',
+                               array(php_xmlrpc_encode(1), 
php_xmlrpc_encode(2)));
+                       $recursive = new xmlrpcmsg('system.multicall',
+                               array(new xmlrpcval(array(), 'array')));
+                       $good2 = new xmlrpcmsg('system.methodSignature',
+                               array(php_xmlrpc_encode('system.listMethods'))
+                       );
+
+                       $r = $this->send(array($good1, $bad, $recursive, 
$good2));
+                       if($r)
+                       {
+                               $this->assertTrue(count($r) == 4, "wrong number 
of return values");
+                       }
+                       $this->assertTrue($r[0]->faultCode() == 0, "fault from 
good1");
+                       if(!$r[0]->faultCode())
+                       {
+                               $val = $r[0]->value();
+                               $this->assertTrue(
+                                       is_string($val) , "good1 did not return 
string");
+                       }
+                       $this->assertTrue($r[1]->faultCode() != 0, "no fault 
from bad");
+                       $this->assertTrue($r[2]->faultCode() != 0, "no fault 
from recursive system.multicall");
+                       $this->assertTrue($r[3]->faultCode() == 0, "fault from 
good2");
+                       if(!$r[3]->faultCode())
+                       {
+                               $val = $r[3]->value();
+                               $this->assertTrue(is_array($val), "good2 did 
not return array");
+                       }
+                       $this->client->return_type = 'xmlrpcvals';
+               }
+
+               function testCatchWarnings()
+               {
+                       $f = new xmlrpcmsg('examples.generatePHPWarning', array(
+                               new xmlrpcval('whatever', 'string')
+                       ));
+                       $v = $this->send($f);
+                       if($v)
+                       {
+                               $this->assertEquals($v->scalarval(), true);
+                       }
+               }
+
+           function testCatchExceptions()
+           {
+               global $URI;
+               $f = new xmlrpcmsg('examples.raiseException', array(
+                       new xmlrpcval('whatever', 'string')
+               ));
+               $v = $this->send($f, $GLOBALS['xmlrpcerr']['server_error']);
+               $this->client->path = $URI.'?EXCEPTION_HANDLING=1';
+               $v = $this->send($f, 1);
+               $this->client->path = $URI.'?EXCEPTION_HANDLING=2';
+               $v = $this->send($f, $GLOBALS['xmlrpcerr']['invalid_return']);
+           }
+
+               function testZeroParams()
+               {
+                       $f = new xmlrpcmsg('system.listMethods');
+                       $v = $this->send($f);
+               }
+
+               function testCodeInjectionServerSide()
+               {
+                       $f = new xmlrpcmsg('system.MethodHelp');
+                       $f->payload = "<?xml 
version=\"1.0\"?><methodCall><methodName>validator1.echoStructTest</methodName><params><param><value><struct><member><name>',''));
 echo('gotcha!'); die(); 
//</name></member></struct></value></param></params></methodCall>";
+                       $v = $this->send($f);
+                       //$v = $r->faultCode();
+                       if ($v)
+                       {
+                               $this->assertEquals(0, $v->structsize());
+                       }
+               }
+
+               function testAutoRegisteredFunction()
+               {
+                       $f=new xmlrpcmsg('examples.php.getStateName',array(
+                               new xmlrpcval(23, 'int')
+                       ));
+                       $v=$this->send($f);
+                       if($v)
+                       {
+                               $this->assertEquals('Michigan', 
$v->scalarval());
+                       }
+                       else
+                       {
+                               $this->fail('Note: server can only auto 
register functions if running with PHP 5.0.3 and up');
+                       }
+               }
+
+               function testAutoRegisteredClass()
+               {
+                       $f=new xmlrpcmsg('examples.php2.getStateName',array(
+                               new xmlrpcval(23, 'int')
+                       ));
+                       $v=$this->send($f);
+                       if($v)
+                       {
+                               $this->assertEquals('Michigan', 
$v->scalarval());
+                       $f=new xmlrpcmsg('examples.php3.getStateName',array(
+                               new xmlrpcval(23, 'int')
+                       ));
+                       $v=$this->send($f);
+                       if($v)
+                       {
+                               $this->assertEquals('Michigan', 
$v->scalarval());
+                       }
+               }
+                       else
+                       {
+                               $this->fail('Note: server can only auto 
register class methods if running with PHP 5.0.3 and up');
+                       }
+               }
+
+               function testAutoRegisteredMethod()
+               {
+                       $func=wrap_xmlrpc_method($this->client, 
'examples.getStateName');
+                       if($func == '')
+                       {
+                               $this->fail('Registration of 
examples.getStateName failed');
+                       }
+                       else
+                       {
+                               $v=$func(23);
+                               $this->assertEquals('Michigan', $v);
+                       }
+               }
+
+               function testGetCookies()
+               {
+                       // let server set to us some cookies we tell it
+                       $cookies = array(
+                               //'c1' => array(),
+                               'c2' => array('value' => 'c2'),
+                               'c3' => array('value' => 'c3', 'expires' => 
time()+60*60*24*30),
+                               'c4' => array('value' => 'c4', 'expires' => 
time()+60*60*24*30, 'path' => '/'),
+                               'c5' => array('value' => 'c5', 'expires' => 
time()+60*60*24*30, 'path' => '/', 'domain' => 'localhost'),
+                       );
+                       $cookiesval = php_xmlrpc_encode($cookies);
+                       $f=new 
xmlrpcmsg('examples.setcookies',array($cookiesval));
+                       $r=$this->send($f, 0, true);
+                       if($r)
+                       {
+                               $v = $r->value();
+                               $this->assertEquals(1, $v->scalarval());
+                               // now check if we decoded the cookies as we 
had set them
+                               $rcookies = $r->cookies();
+                               foreach($cookies as $c => $v)
+                               // format for date string in cookies: 'Mon, 31 
Oct 2005 13:50:56 GMT'
+                               // but PHP versions differ on that, some use 
'Mon, 31-Oct-2005 13:50:56 GMT'...
+                                       if(isset($v['expires']))
+                                       {
+                                               if 
(isset($rcookies[$c]['expires']) && strpos($rcookies[$c]['expires'], '-'))
+                                               {
+                                                       $cookies[$c]['expires'] 
= gmdate('D, d\-M\-Y H:i:s \G\M\T' ,$cookies[$c]['expires']);
+                                               }
+                                               else
+                                               {
+                                                       $cookies[$c]['expires'] 
= gmdate('D, d M Y H:i:s \G\M\T' ,$cookies[$c]['expires']);
+                                               }
+                                       }
+                               $this->assertEquals($cookies, $rcookies);
+                       }
+               }
+
+               function testSetCookies()
+               {
+                       // let server set to us some cookies we tell it
+                       $cookies = array(
+                               'c0' => null,
+                               'c1' => 1,
+                               'c2' => '2 3',
+                               'c3' => 
'address@hidden&*()_+|}{":?><,./\';[]\\=-'
+                       );
+                       $f=new xmlrpcmsg('examples.getcookies',array());
+                       foreach ($cookies as $cookie => $val)
+                       {
+                               $this->client->setCookie($cookie, $val);
+                               $cookies[$cookie] = (string) $cookies[$cookie];
+                       }
+                       $r = $this->client->send($f, $this->timeout, 
$this->method);
+                       $this->assertEquals($r->faultCode(), 0, 'Error 
'.$r->faultCode().' connecting to server: '.$r->faultString());
+                       if(!$r->faultCode())
+                       {
+                               $v = $r->value();
+                               $v = php_xmlrpc_decode($v);
+                               // on IIS and Apache getallheaders returns 
something slightly different...
+                               $this->assertEquals($v, $cookies);
+                       }
+               }
+
+               function testSendTwiceSameMsg()
+               {
+                       $f=new xmlrpcmsg('examples.stringecho', array(
+                               new xmlrpcval('hello world', 'string')
+                       ));
+                       $v1 = $this->send($f);
+                       $v2 = $this->send($f);
+                       //$v = $r->faultCode();
+                       if ($v1 && $v2)
+                       {
+                               $this->assertEquals($v2, $v1);
+                       }
+               }
+       }
+
+       class LocalHostMultiTests extends LocalhostTests
+       {
+               function _runtests()
+               {
+                       global $failed_tests;
+                       foreach(get_class_methods('LocalhostTests') as $meth)
+                       {
+                               if(strpos($meth, 'test') === 0 && $meth != 
'testHttps' && $meth != 'testCatchExceptions')
+                               {
+                                       if (!isset($failed_tests[$meth]))
+                                               $this->$meth();
+                               }
+                               if ($this->_failed)
+                               {
+                                       break;
+                               }
+                       }
+               }
+
+               function testDeflate()
+               {
+                       if(!function_exists('gzdeflate'))
+                       {
+                               $this->fail('Zlib missing: cannot test deflate 
functionality');
+                               return;
+                       }
+                       $this->client->accepted_compression = array('deflate');
+                       $this->client->request_compression = 'deflate';
+                       $this->_runtests();
+               }
+
+               function testGzip()
+               {
+                       if(!function_exists('gzdeflate'))
+                       {
+                               $this->fail('Zlib missing: cannot test gzip 
functionality');
+                               return;
+                       }
+                       $this->client->accepted_compression = array('gzip');
+                       $this->client->request_compression = 'gzip';
+                       $this->_runtests();
+               }
+
+               function testKeepAlives()
+               {
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->fail('CURL missing: cannot test http 
1.1');
+                               return;
+                       }
+                       $this->method = 'http11';
+                       $this->client->keepalive = true;
+                       $this->_runtests();
+               }
+
+               function testProxy()
+               {
+                       global $PROXYSERVER, $PROXYPORT;
+            if ($PROXYSERVER)
+            {
+                               $this->client->setProxy($PROXYSERVER, 
$PROXYPORT);
+                               $this->_runtests();
+            }
+            else
+               $this->fail('PROXY definition missing: cannot test proxy');
+               }
+
+               function testHttp11()
+               {
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->fail('CURL missing: cannot test http 
1.1');
+                               return;
+                       }
+                       $this->method = 'http11'; // not an error the double 
assignment!
+                       $this->client->method = 'http11';
+                       //$this->client->verifyhost = 0;
+                       //$this->client->verifypeer = 0;
+                       $this->client->keepalive = false;
+                       $this->_runtests();
+               }
+
+               function testHttp11Gzip()
+               {
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->fail('CURL missing: cannot test http 
1.1');
+                               return;
+                       }
+                       $this->method = 'http11'; // not an error the double 
assignment!
+                       $this->client->method = 'http11';
+                       $this->client->keepalive = false;
+                       $this->client->accepted_compression = array('gzip');
+                       $this->client->request_compression = 'gzip';
+                       $this->_runtests();
+               }
+
+               function testHttp11Deflate()
+               {
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->fail('CURL missing: cannot test http 
1.1');
+                               return;
+                       }
+                       $this->method = 'http11'; // not an error the double 
assignment!
+                       $this->client->method = 'http11';
+                       $this->client->keepalive = false;
+                       $this->client->accepted_compression = array('deflate');
+                       $this->client->request_compression = 'deflate';
+                       $this->_runtests();
+               }
+
+               function testHttp11Proxy()
+               {
+                       global $PROXYSERVER, $PROXYPORT;
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->fail('CURL missing: cannot test http 1.1 
w. proxy');
+                               return;
+                       }
+            else if ($PROXYSERVER == '')
+            {
+               $this->fail('PROXY definition missing: cannot test proxy w. 
http 1.1');
+                return;
+            }
+                       $this->method = 'http11'; // not an error the double 
assignment!
+                       $this->client->method = 'http11';
+            $this->client->setProxy($PROXYSERVER, $PROXYPORT);
+                       //$this->client->verifyhost = 0;
+                       //$this->client->verifypeer = 0;
+                       $this->client->keepalive = false;
+                       $this->_runtests();
+               }
+
+               function testHttps()
+               {
+                       global $HTTPSSERVER, $HTTPSURI;
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->fail('CURL missing: cannot test https 
functionality');
+                               return;
+                       }
+                       $this->client->server = $HTTPSSERVER;
+                       $this->method = 'https';
+                       $this->client->method = 'https';
+                       $this->client->path = $HTTPSURI;
+                       $this->_runtests();
+               }
+
+               function testHttpsProxy()
+               {
+                       global $HTTPSSERVER, $HTTPSURI, $PROXYSERVER, 
$PROXYPORT;;
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->fail('CURL missing: cannot test https 
functionality');
+                               return;
+                       }
+            else if ($PROXYSERVER == '')
+            {
+               $this->fail('PROXY definition missing: cannot test proxy w. 
http 1.1');
+                return;
+            }
+                       $this->client->server = $HTTPSSERVER;
+                       $this->method = 'https';
+                       $this->client->method = 'https';
+            $this->client->setProxy($PROXYSERVER, $PROXYPORT);
+                       $this->client->path = $HTTPSURI;
+                       $this->_runtests();
+               }
+
+               function testUTF8Responses()
+               {
+                       global $URI;
+                       //$this->client->path = strpos($URI, '?') === null ? 
$URI.'?RESPONSE_ENCODING=UTF-8' : $URI.'&RESPONSE_ENCODING=UTF-8';
+                       $this->client->path = $URI.'?RESPONSE_ENCODING=UTF-8';
+                       $this->_runtests();
+               }
+
+               function testUTF8Requests()
+               {
+                       $this->client->request_charset_encoding = 'UTF-8';
+                       $this->_runtests();
+               }
+
+               function testISOResponses()
+               {
+                       global $URI;
+                       //$this->client->path = strpos($URI, '?') === null ? 
$URI.'?RESPONSE_ENCODING=UTF-8' : $URI.'&RESPONSE_ENCODING=UTF-8';
+                       $this->client->path = 
$URI.'?RESPONSE_ENCODING=ISO-8859-1';
+                       $this->_runtests();
+               }
+
+               function testISORequests()
+               {
+                       $this->client->request_charset_encoding = 'ISO-8859-1';
+                       $this->_runtests();
+               }
+       }
+
+       class ParsingBugsTests extends PHPUnit_TestCase
+       {
+               function testMinusOneString()
+               {
+                       $v=new xmlrpcval('-1');
+                       $u=new xmlrpcval('-1', 'string');
+                       $this->assertEquals($u->scalarval(), $v->scalarval());
+               }
+
+               function testUnicodeInMemberName(){
+                       $v = array('G\xFCnter, El\xE8ne' => new xmlrpcval(1));
+                       $r = new xmlrpcresp(new xmlrpcval($v, 'struct'));
+                       $r = $r->serialize();
+                       $m = new xmlrpcmsg('dummy');
+                       $r = $m->parseResponse($r);
+                       $v = $r->value();
+                       $this->assertEquals($v->structmemexists('G\xFCnter, 
El\xE8ne'), true);
+               }
+
+               function testUnicodeInErrorString()
+               {
+                       $response = utf8_encode(
+'<?xml version="1.0"?>
+<!-- $Id -->
+<!-- found by G. giunta, covers what happens when lib receives
+  UTF8 chars in reponse text and comments -->
+<!-- \xE0\xFC\xE8&#224;&#252;&#232; -->
+<methodResponse>
+<fault>
+<value>
+<struct>
+<member>
+<name>faultCode</name>
+<value><int>888</int></value>
+</member>
+<member>
+<name>faultString</name>
+<value><string>\xE0\xFC\xE8&#224;&#252;&#232;</string></value>
+</member>
+</struct>
+</value>
+</fault>
+</methodResponse>');
+                       $m=new xmlrpcmsg('dummy');
+                       $r=$m->parseResponse($response);
+                       $v=$r->faultString();
+                       $this->assertEquals('\xE0\xFC\xE8\xE0\xFC\xE8', $v);
+               }
+
+               function testValidNumbers()
+               {
+                       $m=new xmlrpcmsg('dummy');
+                       $fp=
+'<?xml version="1.0"?>
+<methodResponse>
+<params>
+<param>
+<value>
+<struct>
+<member>
+<name>integer1</name>
+<value><int>01</int></value>
+</member>
+<member>
+<name>float1</name>
+<value><double>01.10</double></value>
+</member>
+<member>
+<name>integer2</name>
+<value><int>+1</int></value>
+</member>
+<member>
+<name>float2</name>
+<value><double>+1.10</double></value>
+</member>
+<member>
+<name>float3</name>
+<value><double>-1.10e2</double></value>
+</member>
+</struct>
+</value>
+</param>
+</params>
+</methodResponse>';
+                       $r=$m->parseResponse($fp);
+                       $v=$r->value();
+                       $s=$v->structmem('integer1');
+                       $t=$v->structmem('float1');
+                       $u=$v->structmem('integer2');
+                       $w=$v->structmem('float2');
+                       $x=$v->structmem('float3');
+                       $this->assertEquals(1, $s->scalarval());
+                       $this->assertEquals(1.1, $t->scalarval());
+                       $this->assertEquals(1, $u->scalarval());
+                       $this->assertEquals(1.1, $w->scalarval());
+                       $this->assertEquals(-110.0, $x->scalarval());
+               }
+
+               function testAddScalarToStruct()
+               {
+                       $v=new xmlrpcval(array('a' => 'b'), 'struct');
+                       // use @ operator in case error_log gets on screen
+                       $r= @$v->addscalar('c');
+                       $this->assertEquals(0, $r);
+               }
+
+               function testAddStructToStruct()
+               {
+                       $v=new xmlrpcval(array('a' => new xmlrpcval('b')), 
'struct');
+                       $r=$v->addstruct(array('b' => new xmlrpcval('c')));
+                       $this->assertEquals(2, $v->structsize());
+                       $this->assertEquals(1, $r);
+                       $r=$v->addstruct(array('b' => new xmlrpcval('b')));
+                       $this->assertEquals(2, $v->structsize());
+               }
+
+               function testAddArrayToArray()
+               {
+                       $v=new xmlrpcval(array(new xmlrpcval('a'), new 
xmlrpcval('b')), 'array');
+                       $r=$v->addarray(array(new xmlrpcval('b'), new 
xmlrpcval('c')));
+                       $this->assertEquals(4, $v->arraysize());
+                       $this->assertEquals(1, $r);
+               }
+
+               function testEncodeArray()
+               {
+                       $r=range(1, 100);
+                       $v = php_xmlrpc_encode($r);
+                       $this->assertEquals('array', $v->kindof());
+               }
+
+               function testEncodeRecursive()
+               {
+                       $v = php_xmlrpc_encode(php_xmlrpc_encode('a simple 
string'));
+                       $this->assertEquals('scalar', $v->kindof());
+               }
+
+               function testBrokenRequests()
+               {
+                       $s = new xmlrpc_server();
+// omitting the 'params' tag: not tolerated by the lib anymore
+$f = '<?xml version="1.0"?>
+<methodCall>
+<methodName>system.methodHelp</methodName>
+<param>
+<value><string>system.methodHelp</string></value>
+</param>
+</methodCall>';
+                       $r = $s->parserequest($f);
+                       $this->assertEquals(15, $r->faultCode());
+// omitting a 'param' tag
+$f = '<?xml version="1.0"?>
+<methodCall>
+<methodName>system.methodHelp</methodName>
+<params>
+<value><string>system.methodHelp</string></value>
+</params>
+</methodCall>';
+                       $r = $s->parserequest($f);
+                       $this->assertEquals(15, $r->faultCode());
+// omitting a 'value' tag
+$f = '<?xml version="1.0"?>
+<methodCall>
+<methodName>system.methodHelp</methodName>
+<params>
+<param><string>system.methodHelp</string></param>
+</params>
+</methodCall>';
+                       $r = $s->parserequest($f);
+                       $this->assertEquals(15, $r->faultCode());
+               }
+
+               function testBrokenResponses()
+               {
+                       $m=new xmlrpcmsg('dummy');
+                       //$m->debug = 1;
+// omitting the 'params' tag: no more tolerated by the lib...
+$f = '<?xml version="1.0"?>
+<methodResponse>
+<param>
+<value><string>system.methodHelp</string></value>
+</param>
+</methodResponse>';
+                       $r = $m->parseResponse($f);
+                       $this->assertEquals(2, $r->faultCode());
+// omitting the 'param' tag: no more tolerated by the lib...
+$f = '<?xml version="1.0"?>
+<methodResponse>
+<params>
+<value><string>system.methodHelp</string></value>
+</params>
+</methodResponse>';
+                       $r = $m->parseResponse($f);
+                       $this->assertEquals(2, $r->faultCode());
+// omitting a 'value' tag: KO
+$f = '<?xml version="1.0"?>
+<methodResponse>
+<params>
+<param><string>system.methodHelp</string></param>
+</params>
+</methodResponse>';
+                       $r = $m->parseResponse($f);
+                       $this->assertEquals(2, $r->faultCode());
+               }
+
+               function testBuggyHttp()
+               {
+                       $s = new xmlrpcmsg('dummy');
+$f = 'HTTP/1.1 100 Welcome to the jungle
+
+HTTP/1.0 200 OK
+X-Content-Marx-Brothers: Harpo
+                       Chico and Groucho
+Content-Length: who knows?
+
+
+
+<?xml version="1.0"?>
+<!-- First of all, let\'s check out if the lib properly handles a commented 
</methodResponse> tag... -->
+<methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>hello
 world. 2 newlines follow
+
+
+and there they 
were.</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
+<script type="text\javascript">document.write(\'Hello, my name is added nag, 
I\\\'m happy to serve your content for free\');</script>
+ ';
+                       $r = $s->parseResponse($f);
+                       $v = $r->value();
+                       $s = $v->structmem('content');
+                       $this->assertEquals("hello world. 2 newlines 
follow\n\n\nand there they were.", $s->scalarval());
+               }
+
+               function testStringBug()
+               {
+                       $s = new xmlrpcmsg('dummy');
+$f = '<?xml version="1.0"?>
+<!-- $Id -->
+<!-- found by address@hidden, amongst others
+ covers what happens when there\'s character data after </string>
+ and before </value> -->
+<methodResponse>
+<params>
+<param>
+<value>
+<struct>
+<member>
+<name>success</name>
+<value>
+<boolean>1</boolean>
+</value>
+</member>
+<member>
+<name>sessionID</name>
+<value>
+<string>S300510007I</string>
+</value>
+</member>
+</struct>
+</value>
+</param>
+</params>
+</methodResponse> ';
+                       $r = $s->parseResponse($f);
+                       $v = $r->value();
+                       $s = $v->structmem('sessionID');
+                       $this->assertEquals('S300510007I', $s->scalarval());
+               }
+
+               function testWhiteSpace()
+               {
+                       $s = new xmlrpcmsg('dummy');
+$f = '<?xml 
version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>hello
 world. 2 newlines follow
+
+
+and there they 
were.</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f);
+                       $v = $r->value();
+                       $s = $v->structmem('content');
+                       $this->assertEquals("hello world. 2 newlines 
follow\n\n\nand there they were.", $s->scalarval());
+               }
+
+               function testDoubleDataInArrayTag()
+               {
+                       $s = new xmlrpcmsg('dummy');
+$f = '<?xml version="1.0"?><methodResponse><params><param><value><array>
+<data></data>
+<data></data>
+</array></value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f);
+                       $v = $r->faultCode();
+                       $this->assertEquals(2, $v);
+$f = '<?xml version="1.0"?><methodResponse><params><param><value><array>
+<data><value>Hello world</value></data>
+<data></data>
+</array></value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f);
+                       $v = $r->faultCode();
+                       $this->assertEquals(2, $v);
+               }
+
+               function testDoubleStuffInValueTag()
+               {
+                       $s = new xmlrpcmsg('dummy');
+$f = '<?xml version="1.0"?><methodResponse><params><param><value>
+<string>hello world</string>
+<array><data></data></array>
+</value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f);
+                       $v = $r->faultCode();
+                       $this->assertEquals(2, $v);
+$f = '<?xml version="1.0"?><methodResponse><params><param><value>
+<string>hello</string>
+<string>world</string>
+</value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f);
+                       $v = $r->faultCode();
+                       $this->assertEquals(2, $v);
+$f = '<?xml version="1.0"?><methodResponse><params><param><value>
+<string>hello</string>
+<struct><member><name>hello><value>world</value></member></struct>
+</value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f);
+                       $v = $r->faultCode();
+                       $this->assertEquals(2, $v);
+               }
+
+               function testAutodecodeResponse()
+               {
+                       $s = new xmlrpcmsg('dummy');
+$f = '<?xml 
version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>hello
 world. 2 newlines follow
+
+
+and there they 
were.</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f, true, 'phpvals');
+                       $v = $r->value();
+                       $s = $v['content'];
+                       $this->assertEquals("hello world. 2 newlines 
follow\n\n\nand there they were.", $s);
+               }
+
+               function testNoDecodeResponse()
+               {
+                       $s = new xmlrpcmsg('dummy');
+$f = '<?xml 
version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>hello
 world. 2 newlines follow
+
+
+and there they 
were.</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>';
+                       $r = $s->parseResponse($f, true, 'xml');
+                       $v = $r->value();
+                       $this->assertEquals($f, $v);
+               }
+
+               function testAutoCoDec()
+               {
+                       $data1 = array(1, 1.0, 'hello world', true, 
'20051021T23:43:00', -1, 11.0, 'address@hidden&*()_+|', false, 
'20051021T23:43:00');
+                       $data2 = array('zero' => $data1, 'one' => $data1, 'two' 
=> $data1, 'three' => $data1, 'four' => $data1, 'five' => $data1, 'six' => 
$data1, 'seven' => $data1, 'eight' => $data1, 'nine' => $data1);
+                       $data = array($data2, $data2, $data2, $data2, $data2, 
$data2, $data2, $data2, $data2, $data2);
+                       //$keys = array('zero', 'one', 'two', 'three', 'four', 
'five', 'six', 'seven', 'eight', 'nine');
+                       $v1 = php_xmlrpc_encode($data, array('auto_dates'));
+                       $v2 = php_xmlrpc_decode_xml($v1->serialize());
+                       $this->assertEquals($v1, $v2);
+                       $r1 = new xmlrpcresp($v1);
+                       $r2 = php_xmlrpc_decode_xml($r1->serialize());
+                       $r2->serialize(); // needed to set internal member 
payload
+                       $this->assertEquals($r1, $r2);
+                       $m1 = new xmlrpcmsg('hello dolly', array($v1));
+                       $m2 = php_xmlrpc_decode_xml($m1->serialize());
+                       $m2->serialize(); // needed to set internal member 
payload
+                       $this->assertEquals($m1, $m2);
+               }
+
+               function testUTF8Request()
+               {
+                       $sendstring='κόσμε'; // Greek word 'kosme'. NB: NOT a 
valid ISO8859 string!
+                       $GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
+                       $f = new xmlrpcval($sendstring, 'string');
+                       $v=$f->serialize();
+                       
$this->assertEquals("<value><string>&#954;&#8057;&#963;&#956;&#949;</string></value>\n",
 $v);
+                       $GLOBALS['xmlrpc_internalencoding'] = 'ISO-8859-1';
+               }
+
+               function testUTF8Response()
+               {
+                       $s = new xmlrpcmsg('dummy');
+$f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml 
version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>'.utf8_encode('\xE0\xFC\xE8\xE0\xFC\xE8').'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f, false, 'phpvals');
+                       $v = $r->value();
+                       $v = $v['content'];
+                       $this->assertEquals("\xE0\xFC\xE8\xE0\xFC\xE8", $v);
+$f = '<?xml version="1.0" 
encoding="utf-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
+<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>'.utf8_encode('\xE0\xFC\xE8\xE0\xFC\xE8').'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
+';
+                       $r = $s->parseResponse($f, false, 'phpvals');
+                       $v = $r->value();
+                       $v = $v['content'];
+                       $this->assertEquals("\xE0\xFC\xE8\xE0\xFC\xE8", $v);
+               }
+
+               function testUTF8IntString()
+               {
+                       $v=new xmlrpcval(100, 'int');
+                       $s=$v->serialize('UTF-8');
+                       $this->assertequals("<value><int>100</int></value>\n", 
$s);
+               }
+
+               function testStringInt()
+               {
+                       $v=new xmlrpcval('hello world', 'int');
+                       $s=$v->serialize();
+                       $this->assertequals("<value><int>0</int></value>\n", 
$s);
+               }
+
+               function testStructMemExists()
+               {
+                       $v=php_xmlrpc_encode(array('hello' => 'world'));
+                       $b=$v->structmemexists('hello');
+                       $this->assertequals(true, $b);
+                       $b=$v->structmemexists('world');
+                       $this->assertequals(false, $b);
+               }
+
+               function testNilvalue()
+               {
+                       // default case: we do not accept nil values received
+                       $v = new xmlrpcval('hello', 'null');
+                       $r = new xmlrpcresp($v);
+                       $s = $r->serialize();
+                       $m = new xmlrpcmsg('dummy');
+                       $r = $m->parseresponse($s);
+                       $this->assertequals(2, $r->faultCode());
+                       // enable reception of nil values
+                       $GLOBALS['xmlrpc_null_extension'] = true;
+                       $r = $m->parseresponse($s);
+                       $v = $r->value();
+                       $this->assertequals('null', $v->scalartyp());
+                   // test with the apache version: EX:NIL
+                   $GLOBALS['xmlrpc_null_apache_encoding'] = true;
+                   // serialization
+                   $v = new xmlrpcval('hello', 'null');
+                   $s = $v->serialize();
+                   $this->assertequals(1, preg_match( 
'#<value><ex:nil/></value>#', $s ));
+                   // deserialization
+            $r = new xmlrpcresp($v);
+            $s = $r->serialize();
+            $r = $m->parseresponse($s);
+            $v = $r->value();
+            $this->assertequals('null', $v->scalartyp());
+                   $GLOBALS['xmlrpc_null_extension'] = false;
+                   $r = $m->parseresponse($s);
+                   $this->assertequals(2, $r->faultCode());
+               }
+
+               function TestLocale()
+        {
+            $locale = setlocale(LC_NUMERIC,0);
+            if ( setlocale(LC_NUMERIC,'deu', 'address@hidden', 'de_DE', 'de', 
'ge') !== false )
+            {
+                       $v = new xmlrpcval(1.1,'double');
+                       $r = $v->serialize();
+                       $this->assertequals(false, strpos($r,','));
+                       $this->assertequals(1, strpos($v->scalarval(),','));
+                       setlocale(LC_NUMERIC,$locale);
+               }
+               }
+       }
+
+       class InvalidHostTests extends PHPUnit_TestCase
+       {
+               var $client = null;
+
+               function setUp()
+               {
+                       global $DEBUG,$LOCALSERVER;
+                       $this->client=new xmlrpc_client('/NOTEXIST.php', 
$LOCALSERVER, 80);
+                       if($DEBUG)
+                       {
+                               $this->client->setDebug($DEBUG);
+                       }
+               }
+
+               function test404()
+               {
+                       $f = new xmlrpcmsg('examples.echo',array(
+                               new xmlrpcval('hello', 'string')
+                       ));
+                       $r = $this->client->send($f, 5);
+                       $this->assertEquals(5, $r->faultCode());
+               }
+
+               function testSrvNotFound()
+               {
+                       $f = new xmlrpcmsg('examples.echo',array(
+                               new xmlrpcval('hello', 'string')
+                       ));
+                       $this->client->server .= 'XXX';
+                       $r = $this->client->send($f, 5);
+                       $this->assertEquals(5, $r->faultCode());
+               }
+
+               function testCurlKAErr()
+               {
+                       global $LOCALSERVER, $URI;
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->fail('CURL missing: cannot test curl 
keepalive errors');
+                               return;
+                       }
+                       $f = new xmlrpcmsg('examples.stringecho',array(
+                               new xmlrpcval('hello', 'string')
+                       ));
+                       // test 2 calls w. keepalive: 1st time connection ko, 
second time ok
+                       $this->client->server .= 'XXX';
+                       $this->client->keepalive = true;
+                       $r = $this->client->send($f, 5, 'http11');
+                       $this->assertEquals(8, $r->faultCode());
+
+                       // now test a successful connection
+                       $server = explode(':', $LOCALSERVER);
+                       if(count($server) > 1)
+                       {
+                               $this->client->port = $server[1];
+                       }
+                       $this->client->server = $server[0];
+                       $this->client->path = $URI;
+
+                       $r = $this->client->send($f, 5, 'http11');
+                       $ro = $r->value();
+                       $this->assertEquals('hello', $ro->scalarVal());
+               }
+       }
+
+
+       $suite->addTest(new LocalhostTests('testString'));
+       $suite->addTest(new LocalhostTests('testAdding'));
+       $suite->addTest(new LocalhostTests('testAddingDoubles'));
+       $suite->addTest(new LocalhostTests('testInvalidNumber'));
+       $suite->addTest(new LocalhostTests('testBoolean'));
+       $suite->addTest(new LocalhostTests('testCountEntities'));
+       $suite->addTest(new LocalhostTests('testBase64'));
+       $suite->addTest(new LocalhostTests('testDateTime'));
+       $suite->addTest(new LocalhostTests('testServerMulticall'));
+       $suite->addTest(new LocalhostTests('testClientMulticall1'));
+       $suite->addTest(new LocalhostTests('testClientMulticall2'));
+       $suite->addTest(new LocalhostTests('testClientMulticall3'));
+       $suite->addTest(new LocalhostTests('testCatchWarnings'));
+       $suite->addTest(new LocalhostTests('testCatchExceptions'));
+       $suite->addTest(new LocalhostTests('testZeroParams'));
+       $suite->addTest(new LocalhostTests('testCodeInjectionServerSide'));
+       $suite->addTest(new LocalhostTests('testAutoRegisteredFunction'));
+       $suite->addTest(new LocalhostTests('testAutoRegisteredMethod'));
+       $suite->addTest(new LocalhostTests('testSetCookies'));
+       $suite->addTest(new LocalhostTests('testGetCookies'));
+       $suite->addTest(new LocalhostTests('testSendTwiceSameMsg'));
+
+       $suite->addTest(new LocalhostMultiTests('testUTF8Requests'));
+       $suite->addTest(new LocalhostMultiTests('testUTF8Responses'));
+       $suite->addTest(new LocalhostMultiTests('testISORequests'));
+       $suite->addTest(new LocalhostMultiTests('testISOResponses'));
+       $suite->addTest(new LocalhostMultiTests('testGzip'));
+       $suite->addTest(new LocalhostMultiTests('testDeflate'));
+       $suite->addTest(new LocalhostMultiTests('testProxy'));
+       $suite->addTest(new LocalhostMultiTests('testHttp11'));
+       $suite->addTest(new LocalhostMultiTests('testHttp11Gzip'));
+       $suite->addTest(new LocalhostMultiTests('testHttp11Deflate'));
+       $suite->addTest(new LocalhostMultiTests('testKeepAlives'));
+       $suite->addTest(new LocalhostMultiTests('testHttp11Proxy'));
+       $suite->addTest(new LocalhostMultiTests('testHttps'));
+       $suite->addTest(new LocalhostMultiTests('testHttpsProxy'));
+
+       $suite->addTest(new InvalidHostTests('test404'));
+       //$suite->addTest(new InvalidHostTests('testSrvNotFound'));
+       $suite->addTest(new InvalidHostTests('testCurlKAErr'));
+
+       $suite->addTest(new ParsingBugsTests('testMinusOneString'));
+       $suite->addTest(new ParsingBugsTests('testUnicodeInMemberName'));
+       $suite->addTest(new ParsingBugsTests('testUnicodeInErrorString'));
+       $suite->addTest(new ParsingBugsTests('testValidNumbers'));
+       $suite->addTest(new ParsingBugsTests('testAddScalarToStruct'));
+       $suite->addTest(new ParsingBugsTests('testAddStructToStruct'));
+       $suite->addTest(new ParsingBugsTests('testAddArrayToArray'));
+       $suite->addTest(new ParsingBugsTests('testEncodeArray'));
+       $suite->addTest(new ParsingBugsTests('testEncodeRecursive'));
+       $suite->addTest(new ParsingBugsTests('testBrokenrequests'));
+       $suite->addTest(new ParsingBugsTests('testBrokenresponses'));
+       $suite->addTest(new ParsingBugsTests('testBuggyHttp'));
+       $suite->addTest(new ParsingBugsTests('testStringBug'));
+       $suite->addTest(new ParsingBugsTests('testWhiteSpace'));
+       $suite->addTest(new ParsingBugsTests('testAutodecodeResponse'));
+       $suite->addTest(new ParsingBugsTests('testNoDecodeResponse'));
+       $suite->addTest(new ParsingBugsTests('testAutoCoDec'));
+       $suite->addTest(new ParsingBugsTests('testUTF8Response'));
+       $suite->addTest(new ParsingBugsTests('testUTF8Request'));
+       $suite->addTest(new ParsingBugsTests('testUTF8IntString'));
+       $suite->addTest(new ParsingBugsTests('testStringInt'));
+       $suite->addTest(new ParsingBugsTests('testStructMemExists'));
+       $suite->addTest(new ParsingBugsTests('testDoubleDataInArrayTag'));
+       $suite->addTest(new ParsingBugsTests('testDoubleStuffInValueTag'));
+       $suite->addTest(new ParsingBugsTests('testNilValue'));
+       $suite->addTest(new ParsingBugsTests('testLocale'));
+
+       $title = 'XML-RPC Unit Tests';
+
+       if(isset($only))
+       {
+               $suite = new PHPUnit_TestSuite($only);
+       }
+
+       if(isset($_SERVER['REQUEST_METHOD']))
+       {
+               echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 
Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\n<html 
xmlns=\"http://www.w3.org/1999/xhtml\"; lang=\"en\" 
xml:lang=\"en\">\n<head>\n<title>$title</title>\n</head>\n<body>\n<h1>$title</h1>\n";
+       }
+       else
+       {
+               echo "$title\n\n";
+       }
+
+       if(isset($_SERVER['REQUEST_METHOD']))
+       {
+               echo "<h3>Using lib version: $xmlrpcVersion on PHP version: 
".phpversion()."</h3>\n";
+               echo '<h3>Running '.$suite->testCount().' tests (some of which 
are multiple) against servers: http://'.htmlspecialchars($LOCALSERVER.$URI).' 
and https://'.htmlspecialchars($HTTPSSERVER.$HTTPSURI)."\n ...</h3>\n";
+               flush();
+           @ob_flush();
+       }
+       else
+       {
+               echo "Using lib version: $xmlrpcVersion on PHP version: 
".phpversion()."\n";
+               echo 'Running '.$suite->testCount().' tests (some of which are 
multiple) against servers: http://'.$LOCALSERVER.$URI.' and 
https://'.$HTTPSSERVER.$HTTPSURI."\n\n";
+       }
+
+       // do some basic timing measurement
+       list($micro, $sec) = explode(' ', microtime());
+       $start_time = $sec + $micro;
+
+       $PHPUnit = new PHPUnit;
+       $result = $PHPUnit->run($suite, ($DEBUG == 0 ? '.' : '<hr/>'));
+
+       list($micro, $sec) = explode(' ', microtime());
+       $end_time = $sec + $micro;
+
+       if(!isset($_SERVER['REQUEST_METHOD']))
+       {
+               echo $result->toString()."\n";
+       }
+
+       if(isset($_SERVER['REQUEST_METHOD']))
+       {
+               echo '<h3>'.$result->failureCount()." test failures</h3>\n";
+               printf("Time spent: %.2f secs<br/>\n", $end_time - $start_time);
+       }
+       else
+       {
+               echo $result->failureCount()." test failures\n";
+               printf("Time spent: %.2f secs\n", $end_time - $start_time);
+       }
+
+       if($result->failureCount() && !$DEBUG)
+       {
+               $target = strpos($_SERVER['PHP_SELF'], '?') ? 
$_SERVER['PHP_SELF'].'&amp;DEBUG=1' : $_SERVER['PHP_SELF'].'?DEBUG=1';
+               $t2 = strpos($_SERVER['PHP_SELF'], '?') ? 
$_SERVER['PHP_SELF'].'&amp;DEBUG=2' : $_SERVER['PHP_SELF'].'?DEBUG=2';
+               if(isset($_SERVER['REQUEST_METHOD']))
+               {
+                       echo '<p>Run testsuite with <a 
href="'.$target.'">DEBUG=1</a> to have more detail about tests results. Or with 
<a href="'.$t2.'">DEBUG=2</a> for even more.</p>'."\n";
+               }
+               else
+               {
+                       echo "Run testsuite with DEBUG=1 (or 2) to have more 
detail about tests results\n";
+               }
+       }
+
+       if(isset($_SERVER['REQUEST_METHOD']))
+       {
+?>
+<a href="#" onclick="if (document.getElementById('opts').style.display == 
'block') document.getElementById('opts').style.display = 'none'; else 
document.getElementById('opts').style.display = 'block';">More options...</a>
+<div id="opts" style="display: none;">
+<form method="GET" style="border: 1px solid silver; margin: 5px; padding: 5px; 
font-family: monospace;">
+HTTP Server:&nbsp;&nbsp;<input name="LOCALSERVER" size="30" value="<?php echo 
htmlspecialchars($LOCALSERVER); ?>"/> Path: <input name="URI"  size="30" 
value="<?php echo htmlspecialchars($URI); ?>"/><br/>
+HTTPS Server: <input name="HTTPSSERVER" size="30" value="<?php echo 
htmlspecialchars($HTTPSSERVER); ?>"/> Path: <input name="HTTPSURI"  size="30" 
value="<?php echo htmlspecialchars($HTTPSURI); ?>"/><br/>
+Proxy Server: <input name="PROXY" size="30" value="<?php echo isset($PROXY) ? 
htmlspecialchars($PROXY) : ''; ?>"/> <input type="submit" value="Run 
Testsuite"/>
+</form>
+</div>
+<?php
+               echo $result->toHTML()."\n</body>\n</html>\n";
+       }
+?>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/testsuite.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/verify_compat.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/verify_compat.php    
                        (rev 0)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/verify_compat.php    
2009-11-20 09:44:45 UTC (rev 20836)
@@ -0,0 +1,183 @@
+<?php
+/**
+ * Verify compatibility level of current php install with php-xmlrpc lib
+ *
+ * @version $Id$
+ * @author Gaetano Giunta
+ * @copyright (C) 2006-2009 G. Giunta
+ * @license code licensed under the BSD License: 
http://phpxmlrpc.sourceforge.net/license.txt
+ *
+ * @todo add a test for php output buffering?
+ */
+
+function phpxmlrpc_verify_compat($mode='client')
+{
+  $tests = array();
+
+  if ($mode == 'server')
+  {
+    // test for php version
+    $ver = phpversion();
+    $tests['php_version'] = array();
+    $tests['php_version']['description'] = 'PHP version found: '.$ver.".\n\n";
+    if (version_compare($ver, '5') < 0)
+    {
+      $tests['php_version']['status'] = 0;
+      $tests['php_version']['description'] .= 'This version of PHP is not 
compatible with this release of the PHP XMLRPC library. Please upgrade to php 5 
or later';
+    }
+    else if (version_compare($ver, '5.0.3') < 0)
+    {
+      $tests['php_version']['status'] = 1;
+      $tests['php_version']['description'] .= "This version of PHP is almost 
completely compatible with the PHP XMLRPC library.\nThe only unavailable 
function is automatic mapping of php functions to xmlrpc methods";
+    }
+    else
+    {
+      $tests['php_version']['status'] = 2;
+      $tests['php_version']['description'] .= 'This version of PHP is fully 
compatible with the PHP XMLRPC library';
+    }
+
+    // test for zlib
+    $tests['zlib'] = array();
+    if (!function_exists('gzinflate'))
+    {
+      $tests['zlib']['status'] = 0;
+      $tests['zlib']['description'] = "The zlib extension is not 
enabled.\n\nYou will not be able to receive compressed requests or send 
compressed responses, unless using the cURL library (for 'HTTPS' and 'HTTP 1.1' 
connections)";
+    }
+    else
+    {
+      $tests['zlib']['status'] = 2;
+      $tests['zlib']['description'] = "The zlib extension is enabled.\n\nYou 
will be able to receive compressed requests and send compressed responses for 
the 'HTTP' protocol";
+    }
+
+    // test for dispaly of php errors in xml reponse
+    if (ini_get('display_errors'))
+    {
+      if (intval(ini_get('error_reporting')) && E_NOTICE )
+      {
+        $tests['display_errors']['status'] = 1;
+        $tests['display_errors']['description'] = "Error reporting level 
includes E_NOTICE errors, and display_errors is set to ON.\n\nAny error, 
warning or notice raised while executing php code exposed as xmlrpc method will 
result in an invalid xmlrpc response";
+      }
+      else
+      {
+        $tests['display_errors']['status'] = 1;
+        $tests['display_errors']['description'] = "display_errors is set to 
ON.\n\nAny error raised while executing php code exposed as xmlrpc method will 
result in an invalid xmlrpc response";
+      }
+    }
+
+  }
+  else
+  {
+
+    // test for php version
+    $ver = phpversion();
+    $tests['php_version'] = array();
+    $tests['php_version']['description'] = 'PHP version found: '.$ver.".\n\n";
+    if (version_compare($ver, '5') < 0)
+    {
+      $tests['php_version']['status'] = 0;
+      $tests['php_version']['description'] .= 'This version of PHP is not 
compatible with the PHP XMLRPC library. Please upgrade to 5.0 or later';
+    }
+    else
+    {
+      $tests['php_version']['status'] = 2;
+      $tests['php_version']['description'] .= 'This version of PHP is fully 
compatible with the PHP XMLRPC library';
+    }
+
+    // test for zlib
+    $tests['zlib'] = array();
+    if (!function_exists('gzinflate'))
+    {
+      $tests['zlib']['status'] = 0;
+      $tests['zlib']['description'] = "The zlib extension is not 
enabled.\n\nYou will not be able to send compressed requests or receive 
compressed responses, unless using the cURL library (for 'HTTPS' and 'HTTP 1.1' 
connections)";
+    }
+    else
+    {
+      $tests['zlib']['status'] = 2;
+      $tests['zlib']['description'] = "The zlib extension is enabled.\n\nYou 
will be able to send compressed requests and receive compressed responses for 
the 'HTTP' protocol";
+    }
+
+    // test for CURL
+    $tests['curl'] = array();
+    if (!extension_loaded('curl'))
+    {
+      $tests['curl']['status'] = 0;
+      $tests['curl']['description'] = "The cURL extension is not 
enabled.\n\nYou will not be able to send and receive messages using 'HTTPS' and 
'HTTP 1.1' protocols";
+    }
+    else
+    {
+      $info = curl_version();
+      $tests['curl']['status'] = 2;
+      $tests['curl']['description'] = "The cURL extension is enabled.\n\nYou 
will be able to send and receive messages using 'HTTPS' and 'HTTP 1.1' 
protocols";
+      if (version_compare($ver, '4.3.8') < 0)
+      {
+        $tests['curl']['status'] = 1;
+        $tests['curl']['description'] .= ".\nPlease note that the current cURL 
install does not support keep-alives";
+      }
+      if (!((is_string($info) && strpos($info, 'zlib') !== null) || 
isset($info['libz_version'])))
+      {
+        $tests['curl']['status'] = 1;
+        $tests['curl']['description'] .= ".\nPlease note that the current cURL 
install does not support compressed messages";
+      }
+      if (!((is_string($info) && strpos($info, 'OpenSSL') !== null) || 
isset($info['ssl_version'])))
+      {
+        $tests['curl']['status'] = 1;
+        $tests['curl']['description'] .= ".\nPlease note that the current cURL 
install does not support HTTPS connections";
+      }
+    }
+
+  }
+  return $tests;
+}
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en">
+<head>
+<title>PHP XMLRPC compatibility assessment</title>
+<style type="text/css">
+body, html {background-color: white; font-family: Arial, Verdana, Geneva, 
sans-serif; font-size: small; }
+table { border: 1px solid gray; padding: 0;}
+thead { background-color: silver; color: black; }
+td { margin: 0; padding: 0.5em; }
+tbody td { border-top: 1px solid gray; }
+.res0 { background-color: red; color: black; border-right: 1px solid gray; }
+.res1 { background-color: yellow; color: black; border-right: 1px solid gray; }
+.res2 { background-color: green; color: black; border-right: 1px solid gray; }
+.result { white-space: pre; }
+</style>
+</head>
+<body>
+<h1>PHPXMLRPC compatibility assessment with the current PHP install</h1>
+<h4>For phpxmlrpc version 3.0 or later</h4>
+<h3>Server usage</h3>
+<table cellspacing="0">
+<thead>
+<tr><td>Test</td><td>Result</td></tr>
+</thead>
+<tbody>
+<?php
+  $res = phpxmlrpc_verify_compat('server');
+  foreach($res as $test => $result)
+  {
+      echo '<tr><td 
class="res'.$result['status'].'">'.htmlspecialchars($test).'</td><td 
class="result">'.htmlspecialchars($result['description'])."</td></tr>\n";
+  }
+?>
+</tbody>
+</table>
+<h3>Client usage</h3>
+<table cellspacing="0">
+<thead>
+<tr><td>Test</td><td>Result</td></tr>
+</thead>
+<tbody>
+<?php
+  $res = phpxmlrpc_verify_compat('client');
+  foreach($res as $test => $result)
+  {
+      echo '<tr><td 
class="res'.$result['status'].'">'.htmlspecialchars($test).'</td><td 
class="result">'.htmlspecialchars($result['description'])."</td></tr>\n";
+  }
+?>
+</tbody>
+</table>
+</body>
+</html>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/phpgwapi/trunk/inc/xmlrpc/test/verify_compat.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native





reply via email to

[Prev in Thread] Current Thread [Next in Thread]