[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17467] API: upgrade xmlrpc from upstream
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17467] API: upgrade xmlrpc from upstream |
Date: |
Mon, 25 Dec 2017 13:41:15 -0500 (EST) |
Revision: 17467
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17467
Author: sigurdne
Date: 2017-12-25 13:41:14 -0500 (Mon, 25 Dec 2017)
Log Message:
-----------
API: upgrade xmlrpc from upstream
Modified Paths:
--------------
trunk/phpgwapi/inc/xmlrpc/ChangeLog
trunk/phpgwapi/inc/xmlrpc/NEWS
trunk/phpgwapi/inc/xmlrpc/composer.json
trunk/phpgwapi/inc/xmlrpc/debugger/action.php
trunk/phpgwapi/inc/xmlrpc/debugger/common.php
trunk/phpgwapi/inc/xmlrpc/debugger/controller.php
trunk/phpgwapi/inc/xmlrpc/debugger/index.php
trunk/phpgwapi/inc/xmlrpc/demo/client/agesort.php
trunk/phpgwapi/inc/xmlrpc/demo/client/introspect.php
trunk/phpgwapi/inc/xmlrpc/demo/client/mail.php
trunk/phpgwapi/inc/xmlrpc/demo/client/which.php
trunk/phpgwapi/inc/xmlrpc/demo/client/wrap.php
trunk/phpgwapi/inc/xmlrpc/demo/server/discuss.php
trunk/phpgwapi/inc/xmlrpc/demo/server/proxy.php
trunk/phpgwapi/inc/xmlrpc/demo/server/server.php
trunk/phpgwapi/inc/xmlrpc/demo/vardemo.php
trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc.inc
trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc_wrappers.inc
trunk/phpgwapi/inc/xmlrpc/lib/xmlrpcs.inc
Added Paths:
-----------
trunk/phpgwapi/inc/xmlrpc/INSTALL.md
trunk/phpgwapi/inc/xmlrpc/README.md
trunk/phpgwapi/inc/xmlrpc/demo/client/getstatename.php
trunk/phpgwapi/inc/xmlrpc/demo/client/proxy.php
trunk/phpgwapi/inc/xmlrpc/demo/demo1.xml
trunk/phpgwapi/inc/xmlrpc/demo/demo2.xml
trunk/phpgwapi/inc/xmlrpc/demo/demo3.xml
trunk/phpgwapi/inc/xmlrpc/license.txt
trunk/phpgwapi/inc/xmlrpc/pakefile.php
trunk/phpgwapi/inc/xmlrpc/src/
trunk/phpgwapi/inc/xmlrpc/src/Autoloader.php
trunk/phpgwapi/inc/xmlrpc/src/Client.php
trunk/phpgwapi/inc/xmlrpc/src/Encoder.php
trunk/phpgwapi/inc/xmlrpc/src/Helper/
trunk/phpgwapi/inc/xmlrpc/src/Helper/Charset.php
trunk/phpgwapi/inc/xmlrpc/src/Helper/Date.php
trunk/phpgwapi/inc/xmlrpc/src/Helper/Http.php
trunk/phpgwapi/inc/xmlrpc/src/Helper/Logger.php
trunk/phpgwapi/inc/xmlrpc/src/Helper/XMLParser.php
trunk/phpgwapi/inc/xmlrpc/src/PhpXmlRpc.php
trunk/phpgwapi/inc/xmlrpc/src/Request.php
trunk/phpgwapi/inc/xmlrpc/src/Response.php
trunk/phpgwapi/inc/xmlrpc/src/Server.php
trunk/phpgwapi/inc/xmlrpc/src/Value.php
trunk/phpgwapi/inc/xmlrpc/src/Wrapper.php
Removed Paths:
-------------
trunk/phpgwapi/inc/xmlrpc/INSTALL
trunk/phpgwapi/inc/xmlrpc/Makefile
trunk/phpgwapi/inc/xmlrpc/README
trunk/phpgwapi/inc/xmlrpc/debugger/index.html
trunk/phpgwapi/inc/xmlrpc/demo/client/client.php
trunk/phpgwapi/inc/xmlrpc/demo/client/comment.php
trunk/phpgwapi/inc/xmlrpc/demo/client/simple_call.php
trunk/phpgwapi/inc/xmlrpc/demo/client/zopetest.php
trunk/phpgwapi/inc/xmlrpc/demo/demo1.txt
trunk/phpgwapi/inc/xmlrpc/demo/demo2.txt
trunk/phpgwapi/inc/xmlrpc/demo/demo3.txt
trunk/phpgwapi/inc/xmlrpc/doc/
trunk/phpgwapi/inc/xmlrpc/test/
Modified: trunk/phpgwapi/inc/xmlrpc/ChangeLog
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/ChangeLog 2017-12-25 17:36:09 UTC (rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/ChangeLog 2017-12-25 18:41:14 UTC (rev 17467)
@@ -2,9 +2,22 @@
This file will not be updated further.
See https://github.com/gggeek/phpxmlrpc/commits/master
+2014-05-26 - G. Giunta (address@hidden)
-2014-02-3 - G. Giunta (address@hidden)
+ * removed bundled phpunit
+ * converted all tabs to spaces in php files and removed closing tags
+2014-05-12 - Samu Voutilainen (address@hidden)
+
+ * removed obsolete xml.so open; dl() is deprecated and removed from
5.3.0
+ * removed deprecated xmlEntities
+ * removed deprecated xmlrpc_backslash
+ * converted $GLOBALS to internal class. This makes testing much easier
and should be more flexible regarding other projects
+ * changed verifyhost from 1 to 2. This makes modern php versions work
properly.
+ * split off each class in its own file
+
+2014-02-03 - G. Giunta (address@hidden)
+
* bumped up requirements to php 5.1.0
2014-01-10 - G. Giunta (address@hidden)
Deleted: trunk/phpgwapi/inc/xmlrpc/INSTALL
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/INSTALL 2017-12-25 17:36:09 UTC (rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/INSTALL 2017-12-25 18:41:14 UTC (rev 17467)
@@ -1,38 +0,0 @@
-XMLRPC for PHP
-
-Requirements
-------------
-
-The following requirements should be met prior to using 'XMLRPC for PHP':
-. PHP 5.1.0 or later
-. the php "curl" extension is needed if you wish to use SSL or HTTP 1.1 to
- communicate with remote servers
-
-The php "xmlrpc" native extension is not required, but if it is installed,
-there will be no interference with the operation of this library.
-
-
-Installation instructions
--------------------------
-
-Installation of the library is quite easy:
-
-1. copy the contents of the lib/ folder to any location required by your
- application (it can be inside the web server root or not).
-
-2. make sure your app can include those files. This can be achieved by setting
- the PHP include path, either in the php.ini file or directly in the php code
- of your application, using the 'set_include_path' function
-
-
-Example of php code allowing an application to import the library:
-
-set_include_path(get_include_path() . PATH_SEPARATOR .
'/path/to/phpxmlrpc/lib/');
-require_once( 'xmlrpc.inc' );
-require_once( 'xmlrpcs.inc' );
-require_once( 'xmlrpc_wrappers.inc' );
-
-
-Please note that usage of the 'make' command for installation of the library is
-not recommended, as it will generally involve editing of the makefile for a
-succesfull run.
Added: trunk/phpgwapi/inc/xmlrpc/INSTALL.md
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/INSTALL.md (rev 0)
+++ trunk/phpgwapi/inc/xmlrpc/INSTALL.md 2017-12-25 18:41:14 UTC (rev
17467)
@@ -0,0 +1,88 @@
+XMLRPC for PHP
+==============
+
+Requirements
+------------
+
+The following requirements should be met prior to using 'XMLRPC for PHP':
+
+* PHP 5.3.0 or later
+
+* the php "curl" extension is needed if you wish to use SSL or HTTP 1.1 to
+ communicate with remote servers
+
+The php "xmlrpc" native extension is not required, but if it is installed,
+there will be no interference with the operation of this library.
+
+
+Installation instructions
+-------------------------
+
+Installation of the library is quite easy:
+
+1. Via Composer (highly recommended):
+
+ 1. Install composer if you don't have it already present on your system.
+ Depending on how you install, you may end up with a composer.phar file
in your directory.
+ In that case, no worries! Just substitute 'php composer.phar' for
'composer' in the commands below.
+
+ 2. If you're creating a new project, create a new empty directory for it.
+
+ 3. Open a terminal and use Composer to grab the library.
+
+ $ composer require phpxmlrpc/phpxmlrpc:4.0
+
+ 4. Write your code.
+ Once Composer has downloaded the component(s), all you need to do is
include the vendor/autoload.php file that
+ was generated by Composer. This file takes care of autoloading all of
the libraries so that you can use them
+ immediately, including phpxmlrpc:
+
+ // File example: src/script.php
+
+ // update this to the path to the "vendor/" directory, relative to
this file
+ require_once __DIR__.'/../vendor/autoload.php';
+
+ use PhpXmlRpc\Value;
+ use PhpXmlRpc\Request;
+ use PhpXmlRpc\Client;
+
+ $client = new Client('http://some/server');
+ $response = $client->send(new Request('method', array(new
Value('parameter'))));
+
+ 5. IMPORTANT! Make sure that the vendor/phpxmlrpc directory is not
directly accessible from the internet,
+ as leaving it open to access means that any visitor can trigger
execution of php code such as
+ the built-in debugger.
+
+
+2. Via manual download and autoload configuration
+
+ 1. copy the contents of the src/ folder to any location required by your
+ application (it can be inside the web server root or not).
+
+ 2. configure your app autoloading mechanism so that all classes in the
PhpXmlRpc namespace are loaded
+ from that location: any PSR-4 compliant autoloader can do that, if you
don't have any there is one
+ available in src/Autoloader.php
+
+ 3. Write your code.
+
+ // File example: script.php
+
+ require_once __DIR__.'my_autoloader.php';
+
+ use PhpXmlRpc\Value;
+ use PhpXmlRpc\Request;
+ use PhpXmlRpc\Client;
+
+ $client = new Client('http://some/server');
+ $response = $client->send(new Request('method', array(new
Value('parameter'))));
+
+ 5. IMPORTANT! Make sure that the vendor/phpxmlrpc directory is not
directly accessible from the internet,
+ as leaving it open to access means that any visitor can trigger
execution of php code such as
+ the built-in debugger.
+
+Tips
+----
+
+Please note that usage of the 'pake' command is not required for installation
of the library.
+At this moment it is only useful to build the html and pdf versions of the
documentation, and the tarballs
+for distribution of the library.
Deleted: trunk/phpgwapi/inc/xmlrpc/Makefile
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/Makefile 2017-12-25 17:36:09 UTC (rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/Makefile 2017-12-25 18:41:14 UTC (rev 17467)
@@ -1,122 +0,0 @@
-# Makefile for phpxmlrpc library
-
-### 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:
- 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
Modified: trunk/phpgwapi/inc/xmlrpc/NEWS
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/NEWS 2017-12-25 17:36:09 UTC (rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/NEWS 2017-12-25 18:41:14 UTC (rev 17467)
@@ -1,16 +1,108 @@
-XML-RPC for PHP version 3.0.1 - 201X/Y/Z
+XML-RPC for PHP version 4.0.0 - 2016/1/20
-Taking baby steps to modern-world php, this release is now tested using Travis
( https://travis-ci.org/ ).
+This release does away with the past and starts a transition to modern-world
php.
-Improved: no need to call anymore $client->setSSLVerifyHost(2) to silence a
curl warning when using https with recent curl builds
+Code has been heavily refactored, taking care to preserve backwards
compatibility as much as possible,
+but some breackage is to be expected.
+The minimum required php version has been increased to 5.3, even though we
strongly urge you to use
+more recent versions.
+PLEASE READ CAREFULLY THE NOTES BELOW to insure a smooth upgrade.
+
+* new: introduction of namespaces and full OOP.
+
+ All php classes have been renamed and moved to separate files.
+ Class autoloading can now be done in accord with the PSR-4 standard.
+ All global variables and global functions have been removed.
+ Iterating over xmlrpc value objects is now easier thank to support for
ArrayAccess and Traversable interfaces.
+
+ Backward compatibility is maintained via lib/xmlrpc.inc, lib/xmlrpcs.inc and
lib/xmlrpc_wrappers.inc.
+ For more details, head on to doc/api_changes_v4.md
+
+* changed: the default character encoding delivered from the library to your
code is now utf8.
+ It can be changed at any time setting a value to
PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding
+
+* improved: the library now accepts requests/responses sent using other
character sets than UTF-8/ISO-8859-1/ASCII.
+ This only works when the mbstring php extension is enabled.
+
+* improved: no need to call anymore $client->setSSLVerifyHost(2) to silence a
curl warning when using https
+ with recent curl builds
+
+* improved: the xmlrpcval class now supports the interfaces Countable and
IteratorAggregate
+
+* improved: a specific option allows users to decide the version of SSL to use
for https calls.
+ This is useful f.e. for the testing suite, when the server target of calls
has no proper ssl certificate,
+ and the cURL extension has been compiled with GnuTLS (such as on Travis VMs)
+
+* improved: the function wrap_php_function() now can be used to wrap closures
(it is now a method btw)
+
+* improved: all wrap_something() functions now return a closure by default
instead of a function name
+
+* improved: debug messages are not html-escaped any more when executing from
the command line
+
+* improved: the library is now tested using Travis ( https://travis-ci.org/ ).
+ Tests are executed using all php versions from 5.3 to 7.0 nightly, plus
HHVM; code-coverage information
+ is generated using php 5.6 and uploaded to both Code Coverage and
Scrutinizer online services
+
+* improved: phpunit is now installed via composer, not bundled anymore
+
+* improved: when phpunit is used to generate code-coverage data, the code
executed server-side is accounted for
+
+* improved: the test suite has basic checks for the debugger and demo files
+
+* improved: more tests in the test suite
+
+* fixed: the server would not reset the user-set debug messages between
subsequent service() calls
+
+* fixed: the server would not reset previous php error handlers when an
exception was thrown by user code and
+ exception_handling set to 2
+
+* fixed: the server would fail to decode a request with ISO-8859-1 payload and
character set declaration in the xml
+ prolog only
+
+* fixed: the client would fail to decode a response with ISO-8859-1 payload
and character set declaration in the xml
+ prolog only
+
+* fixed: the function decode_xml() would not decode an xml with character set
declaration in the xml prolog
+
+* fixed: the client can now successfully call methods using ISO-8859-1 or
UTF-8 characters in their name
+
+* fixed: the debugger would fail sending a request with ISO-8859-1 payload (it
missed the character set declaration).
+ It would have a hard time coping with ISO-8859-1 in other fields, such as
e.g. the remote method name
+
+* fixed: the debugger would generate a bad payload via the 'load method
synopsis' button for signatures containing NULL
+ or undefined parameters
+
+* fixed: the debugger would generate a bad payload via the 'load method
synopsis' button for methods with multiple
+ signatures
+
+* improved: the debugger is displayed using UTF-8, making it more useful to
debug any kind of service
+
+* improved: echo all debug messages even when there are characters in them
which php deems to be in a wrong encoding;
+ previously those messages would just disappear (this is visible e.g. in the
debugger)
+
+* changed: debug info handling
+ - at debug level 1, the rebuilt php objects are not dumped to screen
(server-side already did that)
+ - at debug level 1, curl communication info are not dumped to screen
+ - at debug level 1, the tests echo payloads of failures; at debug level 2
all payloads
+
+* improved: makefiles have been replaced with a php_based pakefile
+
+* improved: the source for the manual is stored in asciidoc format, which can
be displayed natively by GitHub
+ with nice html formatting. Also the HTML version generated by hand and
bundled in tarballs is much nicer
+ to look at than previous versions
+
+* improved: all php code is now formatted according to the PSR-2 standard
+
+
XML-RPC for PHP version 3.0.0 - 2014/6/15
This release corrects all bugs that have been reported and successfully
reproduced since
version 3.0.0 beta.
-The requirements have increased to php 5.1.0 - which is still way older than
what you should be running for any serious purpose, really.
+The requirements have increased to php 5.1.0 - which is still way older than
what you should be running for any serious
+purpose, really.
It also is the first release to be installable via composer.
@@ -27,15 +119,19 @@
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: 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 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: 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
@@ -50,13 +146,16 @@
* 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: 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
+* 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
@@ -152,7 +251,7 @@
* 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
+* stricter parsing of incoming 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?)
@@ -247,7 +346,7 @@
$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
+ send() 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
@@ -324,9 +423,9 @@
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).
+development platform (and some warnings will be emitted when running PHP5).
-Notheworthy changes include:
+Noteworthy 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
@@ -351,3 +450,160 @@
Please report bugs to the XML-RPC PHP mailing list or to the sourceforge
project
pages at http://sourceforge.net/projects/phpxmlrpc/
+
+
+XML-RPC for PHP version 1.0
+
+I'm pleased to announce XML-RPC for PHP version 1.0 (final). It's taken
+two years to get to the 1.0 point, but here we are, finally. The major change
+is re-licensing with the BSD open source license, a move from the custom
+license previously used.
+
+After this release I expect to move the project to SourceForge and find
+another primary maintainer for the code. More details will follow to the
+mailing list.
+
+It can be downloaded from http://xmlrpc.usefulinc.com/php.html
+
+Comprehensive documentation is available in the distribution, but you
+can also browse it at http://xmlrpc.usefulinc.com/doc/
+
+Bugfixes in this release include:
+
+ * Small fixes and tidying up.
+
+New features include:
+
+ * experimental support for SSL via the curl extensions to PHP. Needs
+ PHP 4.0.2 or greater, but not PHP 4.0.6 which has broken SSL support.
+
+The changelog is available at: http://xmlrpc.usefulinc.com/ChangeLog.txt
+
+Please report bugs to the XML-RPC PHP mailing list, of which more details are
+available at http://xmlrpc.usefulinc.com/list.html, or to
+<address@hidden>.
+
+
+XML-RPC for PHP version 1.0 beta 9
+
+I'm pleased to announce XML-RPC for PHP version 1.0 beta 9. This is
+is largely a bugfix release.
+
+It can be downloaded from http://xmlrpc.usefulinc.com/php.html
+
+Comprehensive documentation is available in the distribution, but you
+can also browse it at http://xmlrpc.usefulinc.com/doc/
+
+Bugfixes in this release include:
+
+ * Fixed string handling bug where characters between a </string>
+ and </value> tag were not ignored.
+
+ * Added in support for PHP's native boolean type.
+
+New features include:
+
+ * new getval() method (experimental only) which has support for
+ recreating nested arrays.
+ * fledgling unit test suite
+ * server.php has support for basic interop test suite
+
+The changelog is available at: http://xmlrpc.usefulinc.com/ChangeLog.txt
+
+Please test this as hard as possible and report bugs to the XML-RPC PHP
+mailing list, of which more details are available at
+http://xmlrpc.usefulinc.com/list.html, or to <address@hidden>.
+
+
+XML-RPC for PHP version 1.0 beta 8
+
+I'm pleased to announce XML-RPC for PHP version 1.0 beta 8.
+
+This release fixes several bugs and adds a couple of new helper
+functions. The most critical change in this release is that you can no
+longer print debug info in comments inside a server method -- you must
+now use the new xmlrpc_debugmsg() function.
+
+It can be downloaded from http://xmlrpc.usefulinc.com/php.html
+
+Comprehensive documentation is available in the distribution, but you
+can also browse it at http://xmlrpc.usefulinc.com/doc/
+
+Bugfixes in this release include:
+
+ * fixed whitespace handling in values
+ * correct sending of Content-length from the server
+
+New features include:
+
+ * xmlrpc_debugmsg() method allows sending of debug info in comments in
+ the return payload from a server
+
+ * xmlrpc_encode() and xmlrpc_decode() translate between xmlrpcval
+ objects and PHP language arrays. They aren't suitable for all
+ datatypes, but can speed up coding in simple scenarios. Thanks to Dan
+ Libby for these.
+
+The changelog is available at: http://xmlrpc.usefulinc.com/ChangeLog.txt
+
+Please test this as hard as possible and report bugs to the XML-RPC PHP
+mailing list, of which more details are available at
+http://xmlrpc.usefulinc.com/list.html, or to <address@hidden>.
+
+
+XML-RPC for PHP version 1.0 beta 7
+
+I'm pleased to announce XML-RPC for PHP version 1.0 beta 7. This is
+fixes some critical bugs that crept in. If it shows itself to be stable
+then it'll become the 1.0 release.
+
+It can be downloaded from http://xmlrpc.usefulinc.com/php.html
+
+Comprehensive documentation is available in the distribution, but you
+can also browse it at http://xmlrpc.usefulinc.com/doc/
+
+Bugfixes in this release include:
+
+ * Passing of booleans should now work as expected
+ * Dollar signs and backslashes in strings should pass OK
+ * addScalar() now works properly to append to array vals
+
+New features include:
+
+ * Added support for HTTP Basic authorization through the
+ xmlrpc_client::setCredentials method.
+
+ * Added test script and method for verifying correct passing of
+ booleans
+
+The changelog is available at: http://xmlrpc.usefulinc.com/ChangeLog.txt
+
+Please test this as hard as possible and report bugs to the XML-RPC PHP
+mailing list, of which more details are available at
+http://xmlrpc.usefulinc.com/list.html, or to <address@hidden>.
+
+
+XML-RPC for PHP version 1.0 beta 6
+
+I'm pleased to announce XML-RPC for PHP version 1.0 beta 6. This is the
+final beta before the 1.0 release.
+
+It can be downloaded from http://xmlrpc.usefulinc.com/php.html
+
+Comprehensive documentation is available in the distribution, but you
+can also browse it at http://xmlrpc.usefulinc.com/doc/
+
+New features in this release include:
+
+ * Perl and Python test programs for the demo server
+ * Proper fault generation on a non-"200 OK" response from a remote host
+ * Bugfixed base64 decoding
+ * ISO8601 helper routines for translation to and from UNIX timestamps
+ * reorganization of code to allow eventual integration of alternative
+ transports
+
+The changelog is available at: http://xmlrpc.usefulinc.com/ChangeLog.txt
+
+Please test this as hard as possible and report bugs to the XML-RPC PHP
+mailing list, of which more details are available at
+http://xmlrpc.usefulinc.com/list.html, or to <address@hidden>.
Deleted: trunk/phpgwapi/inc/xmlrpc/README
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/README 2017-12-25 17:36:09 UTC (rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/README 2017-12-25 18:41:14 UTC (rev 17467)
@@ -1,15 +0,0 @@
-NAME: XMLRPC for PHP
-
-DESCRIPTION: A php library for building xmlrpc clients and servers
-
-
-
-Installation instructions are in the INSTALL file.
-
-The manual, in HTML and pdf versions, can be found in the doc/ directory.
-
-Recent changes in the ChangeLog file.
-
-Use of this software is subject to the terms in doc/index.html
-
-The passphrase for the rsakey.pem certificate is 'test'.
Added: trunk/phpgwapi/inc/xmlrpc/README.md
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/README.md (rev 0)
+++ trunk/phpgwapi/inc/xmlrpc/README.md 2017-12-25 18:41:14 UTC (rev 17467)
@@ -0,0 +1,48 @@
+XMLRPC for PHP
+==============
+A php library for building xml-rpc clients and servers.
+
+Installation
+------------
+The recommended way to install this library is using Composer.
+
+Detailed installation instructions are in the [INSTALL.md](INSTALL.md) file,
along with system requirements listing.
+
+Documentation
+-------------
+
+*NB: the user manual has not been updated yet with all the changes made in
version 4. Please consider it unreliable!*
+
+*You are encouraged to look instead the code examples found in the demo/
directory*
+
+The user manual can be found in the doc/manual directory, in Asciidoc format:
[phpxmlrpc_manual.adoc](doc/manual/phpxmlrpc_manual.adoc)
+
+Release tarballs also contain the HTML and PDF versions, as well as an
automatically generated API documentation.
+
+Upgrading
+---------
+If you are upgrading from version 3 or earlier you have two options:
+
+1. adapt your code to the new API (all changes needed are described in
[doc/api_changes_v4.md](doc/api_changes_v4.md))
+
+2. use instead the *compatibility layer* which is provided. Instructions and
pitfalls described in
[doc/api_changes_v4.md](doc/api_changes_v4.md##enabling-compatibility-with-legacy-code)
+
+In any case, read carefully the docs in
[doc/api_changes_v4.md](doc/api_changes_v4.md) and report back any undocumented
+issue using GitHub.
+
+License
+-------
+Use of this software is subject to the terms in the [license.txt](license.txt)
file
+
+SSL-certificate
+---------------
+The passphrase for the rsakey.pem certificate is 'test'.
+
+
+[![License](https://poser.pugx.org/phpxmlrpc/phpxmlrpc/license)](https://packagist.org/packages/phpxmlrpc/phpxmlrpc)
+[![Latest Stable
Version](https://poser.pugx.org/phpxmlrpc/phpxmlrpc/v/stable)](https://packagist.org/packages/phpxmlrpc/phpxmlrpc)
+[![Total
Downloads](https://poser.pugx.org/phpxmlrpc/phpxmlrpc/downloads)](https://packagist.org/packages/phpxmlrpc/phpxmlrpc)
+
+[![Build
Status](https://travis-ci.org/gggeek/phpxmlrpc.svg?branch=php53)](https://travis-ci.org/gggeek/phpxmlrpc)
+[![Test
Coverage](https://codeclimate.com/github/gggeek/phpxmlrpc/badges/coverage.svg)](https://codeclimate.com/github/gggeek/phpxmlrpc)
+[![Code
Coverage](https://scrutinizer-ci.com/g/gggeek/phpxmlrpc/badges/coverage.png?b=php53)](https://scrutinizer-ci.com/g/gggeek/phpxmlrpc/?branch=php53)
Modified: trunk/phpgwapi/inc/xmlrpc/composer.json
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/composer.json 2017-12-25 17:36:09 UTC (rev
17466)
+++ trunk/phpgwapi/inc/xmlrpc/composer.json 2017-12-25 18:41:14 UTC (rev
17467)
@@ -5,9 +5,38 @@
"homepage": "http://gggeek.github.io/phpxmlrpc/",
"keywords": [ "xmlrpc", "webservices" ],
"require": {
- "php": ">=5.1.0"
+ "php": ">=5.3.0",
+ "ext-xml": "*"
},
+ "require-dev": {
+ "phpunit/phpunit": ">=4.0.0",
+ "phpunit/phpunit-selenium": "*",
+ "codeclimate/php-test-reporter": "dev-master",
+ "ext-curl": "*",
+ "ext-mbstring": "*",
+ "indeyets/pake": "~1.99",
+ "phpdocumentor/phpdocumentor": "2.*",
+ "docbook/docbook-xsl": "~1.78"
+ },
+ "suggest": {
+ "ext-curl": "Needed for HTTPS and HTTP 1.1 support, NTLM Auth etc...",
+ "ext-zlib": "Needed for sending compressed requests and receiving
compressed responses, if cURL is not available",
+ "ext-mbstring": "Needed to allow reception of requests/responses in
character sets other than ASCII,LATIN-1,UTF-8"
+ },
"autoload": {
- "classmap": [ "lib/xmlrpc.inc", "lib/xmlrpcs.inc" ]
+ "psr-4": {"PhpXmlRpc\\": "src/"}
+ },
+ "repositories": [
+ {
+ "type": "package",
+ "package": {
+ "name": "docbook/docbook-xsl",
+ "version": "1.78.1",
+ "dist": {
+ "url":
"http://sourceforge.net/projects/docbook/files/docbook-xsl/1.78.1/docbook-xsl-1.78.1.zip/download",
+ "type": "zip"
+ }
+ }
}
+ ]
}
\ No newline at end of file
Modified: trunk/phpgwapi/inc/xmlrpc/debugger/action.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/debugger/action.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/debugger/action.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,8 +1,8 @@
<?php
/**
* @author Gaetano Giunta
- * @copyright (C) 2005-2014 G. Giunta
- * @license code licensed under the BSD License:
http://phpxmlrpc.sourceforge.net/license.txt
+ * @copyright (C) 2005-2015 G. Giunta
+ * @license code licensed under the BSD License: see file 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?
@@ -9,6 +9,8 @@
* @todo be smarter in creating client stub for proxy/auth cases: only set
appropriate property of client obj
**/
+header('Content-Type: text/html; charset=utf-8');
+
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -15,96 +17,143 @@
<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>
+ <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(dirname(__FILE__).'/common.php');
- if ($action)
- {
+include __DIR__ . '/common.php';
+if ($action) {
+ include_once __DIR__ . "/../src/Autoloader.php";
+ PhpXmlRpc\Autoloader::register();
+
// make sure the script waits long enough for the call to complete...
- if ($timeout)
- set_time_limit($timeout+10);
+ if ($timeout) {
+ set_time_limit($timeout + 10);
+ }
- include('xmlrpc.inc');
- if ($wstype == 1)
- {
- @include('jsonrpc.inc');
- if (!class_exists('jsonrpc_client'))
- {
+ 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';
+ $clientClass = 'PhpJsRpc\Client';
+ $requestClass = 'PhpJsRpc\Request';
+ $protoName = 'JSONRPC';
+ } else {
+ $clientClass = 'PhpXmlRpc\Client';
+ $requestClass = 'PhpXmlRpc\Request';
+ $protoName = 'XMLRPC';
}
- else
- {
- $clientclass = 'xmlrpc_client';
- $msgclass = 'xmlrpcmsg';
- $protoname = 'XMLRPC';
- }
- if ($port != "")
- {
- $client = new $clientclass($path, $host, $port);
+ if ($port != "") {
+ $client = new $clientClass($path, $host, $port);
$server = "$host:$port$path";
} else {
- $client = new $clientclass($path, $host);
+ $client = new $clientClass($path, $host);
$server = "$host$path";
}
- if ($protocol == 2)
- {
- $server = 'https://'.$server;
+ if ($protocol == 2) {
+ $server = 'https://' . $server;
+ } else {
+ $server = 'http://' . $server;
}
- else
- {
- $server = 'http://'.$server;
- }
if ($proxy != '') {
$pproxy = explode(':', $proxy);
- if (count($pproxy) > 1)
+ if (count($pproxy) > 1) {
$pport = $pproxy[1];
- else
+ } else {
$pport = 8080;
+ }
$client->setProxy($pproxy[0], $pport, $proxyuser, $proxypwd);
}
- if ($protocol == 2)
- {
+ if ($protocol == 2) {
$client->setSSLVerifyPeer($verifypeer);
$client->setSSLVerifyHost($verifyhost);
- if ($cainfo)
- {
+ if ($cainfo) {
$client->setCaCertificate($cainfo);
}
$httpprotocol = 'https';
- }
- else if ($protocol == 1)
+ } elseif ($protocol == 1) {
$httpprotocol = 'http11';
- else
+ } else {
$httpprotocol = 'http';
+ }
- if ($username)
+ if ($username) {
$client->setCredentials($username, $password, $authtype);
+ }
$client->setDebug($debug);
@@ -136,10 +185,8 @@
}
$cookies = explode(',', $clientcookies);
- foreach ($cookies as $cookie)
- {
- if (strpos($cookie, '='))
- {
+ foreach ($cookies as $cookie) {
+ if (strpos($cookie, '=')) {
$cookie = explode('=', $cookie);
$client->setCookie(trim($cookie[0]), trim(@$cookie[1]));
}
@@ -147,151 +194,133 @@
$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.'"';
+ $msg[0] = new $requestClass('system.methodHelp', array(), $id);
+ $msg[0]->addparam(new PhpXmlRpc\Value($method));
+ $msg[1] = new $requestClass('system.methodSignature', array(), $id
+ 1);
+ $msg[1]->addparam(new PhpXmlRpc\Value($method));
+ $actionname = 'Description of method "' . $method . '"';
break;
case 'list':
- $msg[0] = new $msgclass('system.listMethods', null, $id);
+ $msg[0] = new $requestClass('system.listMethods', array(), $id);
$actionname = 'List of available methods';
break;
case 'execute':
- if (!payload_is_safe($payload))
+ 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);
+ }
+ $msg[0] = new $requestClass($method, array(), $id);
// hack! build xml payload by hand
- if ($wstype == 1)
- {
- $msg[0]->payload = "{\n".
+ 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 == "")
- {
+ if ($id == "") {
$msg[0]->payload .= "null\n}";
- }
- else
- {
- if (is_numeric($id) || $id == 'false' || $id == 'true' || $id ==
'null')
- {
+ } else {
+ if (is_numeric($id) || $id == 'false' || $id == 'true' ||
$id == 'null') {
$msg[0]->payload .= "$id\n}";
- }
- else
- {
+ } else {
$msg[0]->payload .= "\"$id\"\n}";
}
}
- }
- else
- $msg[0]->payload = $msg[0]->xml_header() .
+ } else {
+ $msg[0]->payload = $msg[0]->xml_header($inputcharset) .
'<methodName>' . $method . "</methodName>\n<params>" .
$payload .
"</params>\n" . $msg[0]->xml_footer();
- $actionname = 'Execution of method '.$method;
+ }
+ $actionname = 'Execution of method ' . $method;
break;
default: // give a warning
- $actionname = '[ERROR: unknown action] "'.$action.'"';
+ $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";
+ echo '<h2>' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . '
on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . "
...</h2>\n";
flush();
$response = null;
// execute method(s)
- if ($debug)
- echo '<div class="dbginfo"><h2>Debug info:</h2>'; /// @todo use
ob_start instead
+ 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)
- {
+ $time = microtime(true);
+ foreach ($msg as $message) {
// catch errors: for older xmlrpc libs, send does not return by ref
- @$response =& $client->send($message, $timeout, $httpprotocol);
+ @$response = $client->send($message, $timeout, $httpprotocol);
$resp[] = $response;
- if (!$response || $response->faultCode())
+ if (!$response || $response->faultCode()) {
break;
}
- $mtime = explode(' ',microtime());
- $time = (float)$mtime[0] + (float)$mtime[1] - $time;
- if ($debug)
+ }
+ $time = microtime(true) - $time;
+ if ($debug) {
echo "</div>\n";
+ }
- if ($response)
- {
-
- if ($response->faultCode())
- {
+ 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
- {
+ //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT,
$inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT,
$inputcharset).'</h2>';
+ echo "<h3>$protoName call FAILED!</h3>\n";
+ echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(),
ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
+ "] Reason: '" . htmlspecialchars($response->faultString(),
ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</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"));
+ //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT,
$inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT,
$inputcharset).'</h2>';
+ printf("<h3>%s call(s) OK (%.2f secs.)</h3>\n", $protoName, $time);
+ echo(strftime("%d/%b/%Y:%H:%M:%S\n"));
- switch ($action)
- {
+ switch ($action) {
case 'list':
$v = $response->value();
- if ($v->kindOf()=="array")
- {
- $max = $v->arraysize();
+ if ($v->kindOf() == "array") {
+ $max = $v->count();
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\" />".
+ echo "<thead>\n<tr><th>Method
($max)</th><th>Description</th></tr>\n</thead>\n<tbody>\n";
+ foreach($v as $i => $rec) {
+ if ($i % 2) {
+ $class = ' class="oddrow"';
+ } else {
+ $class = ' class="evenrow"';
+ }
+ echo("<tr><td$class>" .
htmlspecialchars($rec->scalarval(), ENT_COMPAT,
\PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "</td><td$class><form
action=\"controller.php\" method=\"get\" target=\"frmcontroller\">" .
+ "<input type=\"hidden\" name=\"host\"
value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"port\"
value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"path\"
value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"id\" value=\""
. htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"debug\"
value=\"$debug\" />" .
+ "<input type=\"hidden\" name=\"username\"
value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"password\"
value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<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, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxy\"
value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxyuser\"
value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxypwd\"
value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\"
name=\"responsecompression\" value=\"$responsecompression\" />" .
+ "<input type=\"hidden\"
name=\"requestcompression\" value=\"$requestcompression\" />" .
+ "<input type=\"hidden\" name=\"clientcookies\"
value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\"
/>" .
+ "<input type=\"hidden\" name=\"protocol\"
value=\"$protocol\" />" .
+ "<input type=\"hidden\" name=\"timeout\"
value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"method\"
value=\"" . htmlspecialchars($rec->scalarval(), ENT_COMPAT,
\PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" .
+ "<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
+ // generate the skeleton for method payload per
possible tests
//$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>".
@@ -314,39 +343,51 @@
$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> </th><th> </th></tr>\n</thead>\n<tbody>\n";
- $desc = htmlspecialchars($r1->scalarval());
- if ($desc == "")
+ echo "<thead>\n<tr><th>Method</th><th>" .
htmlspecialchars($method, ENT_COMPAT, $inputcharset) .
"</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n";
+ $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT,
\PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding);
+ 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")
+
+ if ($r2->kindOf() != "array") {
echo "<tr><td class=\"oddrow\">Signature</td><td
class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </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 ".($i+1)."</td><td$class>";
- $x = $r2->arraymem($i);
- if ($x->kindOf()=="array")
- {
- $ret = $x->arraymem(0);
- echo "<code>OUT: " . 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";
+ } else {
+ foreach($r2 as $i => $x) {
+ $payload = "";
+ $alt_payload = "";
+ if ($i + 1 % 2) {
+ $class = ' class="oddrow"';
+ } else {
+ $class = ' class="evenrow"';
+ }
+ echo "<tr><td$class>Signature " . ($i + 1) .
"</td><td$class>";
+ if ($x->kindOf() == "array") {
+ $ret = $x[0];
+ echo "<code>OUT: " .
htmlspecialchars($ret->scalarval(), ENT_COMPAT,
\PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: (";
+ if ($x->count() > 1) {
+ foreach($x as $k => $y) {
+ if ($k == 0) continue;
+ echo htmlspecialchars($y->scalarval(),
ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding);
+ if ($wstype != 1) {
+ $type = $y->scalarval();
+ $payload .= '<param><value>';
+ switch($type) {
+ case 'undefined':
+ break;
+ case 'null';
+ $type = 'nil';
+ // fall thru intentionally
+ default:
+ $payload .= '<' .
+
htmlspecialchars($type, ENT_COMPAT,
\PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
+ '></' .
htmlspecialchars($type, ENT_COMPAT,
\PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
+ '>';
+ }
+ $payload .= "</value></param>\n";
}
$alt_payload .= $y->scalarval();
- if ($k < $x->arraysize()-1)
- {
+ if ($k < $x->count() - 1) {
$alt_payload .= ';';
echo ", ";
}
@@ -353,73 +394,71 @@
}
}
echo ")</code>";
- }
- else
- {
+ } else {
echo 'Unknown';
}
echo '</td>';
- //bottone per testare questo metodo
+ // button to test this method
//$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\" />".
+ echo "<td$class><form action=\"controller.php\"
target=\"frmcontroller\" method=\"get\">" .
+ "<input type=\"hidden\" name=\"host\"
value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"port\"
value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"path\"
value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"id\" value=\""
. htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"debug\"
value=\"$debug\" />" .
+ "<input type=\"hidden\" name=\"username\"
value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"password\"
value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<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, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxy\"
value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxyuser\"
value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxypwd\"
value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\"
name=\"responsecompression\" value=\"$responsecompression\" />" .
+ "<input type=\"hidden\"
name=\"requestcompression\" value=\"$requestcompression\" />" .
+ "<input type=\"hidden\" name=\"clientcookies\"
value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\"
/>" .
+ "<input type=\"hidden\" name=\"protocol\"
value=\"$protocol\" />" .
+ "<input type=\"hidden\" name=\"timeout\"
value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"method\"
value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"methodpayload\"
value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\"
name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload,
ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"wstype\"
value=\"$wstype\" />" .
"<input type=\"hidden\" name=\"action\" value=\"execute\" />";
- if ($wstype != 1)
+ 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\" />".
+ echo "<td$class><form action=\"controller.php\"
target=\"frmcontroller\" method=\"get\">" .
+ "<input type=\"hidden\" name=\"host\"
value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"port\"
value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"path\"
value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"id\" value=\""
. htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"debug\"
value=\"$debug\" />" .
+ "<input type=\"hidden\" name=\"username\"
value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"password\"
value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<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, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxy\"
value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxyuser\"
value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"proxypwd\"
value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\"
name=\"responsecompression\" value=\"$responsecompression\" />" .
+ "<input type=\"hidden\"
name=\"requestcompression\" value=\"$requestcompression\" />" .
+ "<input type=\"hidden\" name=\"clientcookies\"
value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\"
/>" .
+ "<input type=\"hidden\" name=\"protocol\"
value=\"$protocol\" />" .
+ "<input type=\"hidden\" name=\"timeout\"
value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"method\"
value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\" name=\"methodsig\"
value=\"" . $i . "\" />" .
+ "<input type=\"hidden\" name=\"methodpayload\"
value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" .
+ "<input type=\"hidden\"
name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload,
ENT_COMPAT, $inputcharset) . "\" />" .
+ "<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>";
@@ -429,37 +468,32 @@
case 'wrap':
$r1 = $resp[0]->value();
$r2 = $resp[1]->value();
- if ($r2->kindOf()!="array" || $r2->arraysize() <= $methodsig)
+ if ($r2->kindOf() != "array" || $r2->count() <=
$methodsig) {
echo "Error: signature unknown\n";
- else
- {
+ } else {
$mdesc = $r1->scalarval();
- $msig = php_xmlrpc_decode($r2);
+ $encoder = new PhpXmlRpc\Encoder();
+ $msig = $encoder->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
+ $clientcookies == ''
+ ) {
+ $opts = 1; // simple client copy in stub code
+ } else {
+ $opts = 0; // complete client copy in stub code
}
- else
- {
- $opts = 1; // complete client copy in stub code
- }
- if ($wstype == 1)
- {
+ if ($wstype == 1) {
$prefix = 'jsonrpc';
- }
- else
- {
+ } 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);
+ $wrapper = new PhpXmlRpc\Wrapper();
+ $code = $wrapper->buildWrapMethodSource($client,
$method, array('timeout' => $timeout, 'protocol' => $proto,
'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_',
$prefix . '_' . $method), $msig, $mdesc);
//if ($code)
//{
echo "<div id=\"phpcode\">\n";
-
highlight_string("<?php\n".$code['docstring'].$code['source'].'?>');
+ highlight_string("<?php\n" . $code['docstring'] .
$code['source'] . '?>');
echo "\n</div>";
//}
//else
@@ -470,7 +504,7 @@
break;
case 'execute':
- echo '<div
id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>';
+ echo '<div id="response"><h2>Response:</h2>' .
htmlspecialchars($response->serialize()) . '</div>';
break;
default: // give a warning
@@ -477,50 +511,55 @@
}
} // if !$response->faultCode()
} // if $response
- }
- else
- {
+} 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'))
- {
+ <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>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>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>
+ <h3>Changelog</h3>
+ <ul>
+ <li>2015-05-30: fix problems with generating method payloads for NIL
and Undefined parameters</li>
+ <li>2015-04-19: fix problems with LATIN-1 characters in payload</li>
+ <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>
Modified: trunk/phpgwapi/inc/xmlrpc/debugger/common.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/debugger/common.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/debugger/common.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,16 +1,17 @@
<?php
/**
* @author Gaetano Giunta
- * @copyright (C) 2005-2014 G. Giunta
- * @license code licensed under the BSD License:
http://phpxmlrpc.sourceforge.net/license.txt
+ * @copyright (C) 2005-2015 G. Giunta
+ * @license code licensed under the BSD License: see file license.txt
*
+ * Parses GET/POST variables
+ *
* @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())
- {
+if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
@@ -19,36 +20,39 @@
return $value;
}
+
$_GET = array_map('stripslashes_deep', $_GET);
- }
+}
-
- if ( isset( $_GET['usepost'] ) && $_GET['usepost'] === 'true' )
- {
+$preferredEncodings = 'UTF-8, ASCII, ISO-8859-1, UTF-7, EUC-JP, SJIS,
eucJP-win, SJIS-win, JIS, ISO-2022-JP';
+$inputcharset = mb_detect_encoding(urldecode($_SERVER['REQUEST_URI']),
$preferredEncodings);
+if (isset($_GET['usepost']) && $_GET['usepost'] === 'true') {
$_GET = $_POST;
- }
+ $inputcharset = mb_detect_encoding(implode('', $_GET),
$preferredEncodings);
+}
+/// @todo if $inputcharset is not UTF8, we should probably re-encode $_GET to
make it UTF-8
+
// recover input parameters
- $debug = false;
- $protocol = 0;
- $run = false;
- $wstype = 0;
- $id = '';
- if (isset($_GET['action']))
- {
- if (isset($_GET['wstype']) && $_GET['wstype'] == '1')
- {
+$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']))
+ 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'))
+ if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' ||
$_GET['protocol'] == '2')) {
$protocol = $_GET['protocol'];
- if (strpos($host, 'http://') === 0)
+ }
+ if (strpos($host, 'http://') === 0) {
$host = substr($host, 7);
- else if (strpos($host, 'https://') === 0)
- {
+ } elseif (strpos($host, 'https://') === 0) {
$host = substr($host, 8);
$protocol = 2;
}
@@ -55,26 +59,31 @@
$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 ($path && ($path[0]) != '/') {
+ $path = '/' . $path;
+ }
- if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] ==
'2'))
+ 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')
+ if (isset($_GET['verifypeer']) && $_GET['verifypeer'] == '1') {
$verifypeer = true;
- else
+ } else {
$verifypeer = false;
- $cainfo= isset($_GET['cainfo']) ? $_GET['cainfo'] : '';
+ }
+ $cainfo = isset($_GET['cainfo']) ? $_GET['cainfo'] : '';
$proxy = isset($_GET['proxy']) ? $_GET['proxy'] : 0;
- if (strpos($proxy, 'http://') === 0)
+ if (strpos($proxy, 'http://') === 0) {
$proxy = substr($proxy, 7);
- $proxyuser= isset($_GET['proxyuser']) ? $_GET['proxyuser'] : '';
+ }
+ $proxyuser = isset($_GET['proxyuser']) ? $_GET['proxyuser'] : '';
$proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : '';
$timeout = isset($_GET['timeout']) ? $_GET['timeout'] : 0;
- if (!is_numeric($timeout))
+ if (!is_numeric($timeout)) {
$timeout = 0;
+ }
$action = $_GET['action'];
$method = isset($_GET['method']) ? $_GET['method'] : '';
@@ -82,8 +91,9 @@
$payload = isset($_GET['methodpayload']) ? $_GET['methodpayload'] : '';
$alt_payload = isset($_GET['altmethodpayload']) ?
$_GET['altmethodpayload'] : '';
- if (isset($_GET['run']) && $_GET['run'] == 'now')
+ if (isset($_GET['run']) && $_GET['run'] == 'now') {
$run = true;
+ }
$username = isset($_GET['username']) ? $_GET['username'] : '';
$password = isset($_GET['password']) ? $_GET['password'] : '';
@@ -90,19 +100,19 @@
$authtype = (isset($_GET['authtype']) && ($_GET['authtype'] == '2' ||
$_GET['authtype'] == '8')) ? $_GET['authtype'] : 1;
- if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] ==
'1' || $_GET['requestcompression'] == '2'))
+ if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] ==
'1' || $_GET['requestcompression'] == '2')) {
$requestcompression = $_GET['requestcompression'];
- else
+ } else {
$requestcompression = 0;
- if (isset($_GET['responsecompression']) && ($_GET['responsecompression']
== '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression']
== '3'))
+ }
+ if (isset($_GET['responsecompression']) && ($_GET['responsecompression']
== '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression']
== '3')) {
$responsecompression = $_GET['responsecompression'];
- else
+ } else {
$responsecompression = 0;
+ }
$clientcookies = isset($_GET['clientcookies']) ? $_GET['clientcookies'] :
'';
- }
- else
- {
+} else {
$host = '';
$port = '';
$path = '';
@@ -124,11 +134,10 @@
$requestcompression = 0;
$responsecompression = 0;
$clientcookies = '';
- }
+}
- // check input for known XMLRPC attacks against this or other libs
- function payload_is_safe($input)
- {
+// check input for known XMLRPC attacks against this or other libs
+function payload_is_safe($input)
+{
return true;
- }
-?>
\ No newline at end of file
+}
Modified: trunk/phpgwapi/inc/xmlrpc/debugger/controller.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/debugger/controller.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/debugger/controller.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,57 +1,93 @@
<?php
/**
* @author Gaetano Giunta
- * @copyright (C) 2005-2014 G. Giunta
- * @license code licensed under the BSD License:
http://phpxmlrpc.sourceforge.net/license.txt
+ * @copyright (C) 2005-2015 G. Giunta
+ * @license code licensed under the BSD License: see file 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(dirname(__FILE__).'/common.php');
- if ($action == '')
+// make sure we set the correct charset type for output, so that we can
display all characters
+header('Content-Type: text/html; charset=utf-8');
+
+include __DIR__ . '/common.php';
+if ($action == '') {
$action = 'list';
+}
- // relative path to the visual xmlrpc editing dialog
- $editorpath = '../../javascript/debugger/';
- $editorlibs = '../../javascript/lib/';
+// relative path to the visual xmlrpc editing dialog
+$editorpath = '../../phpjsrpc/debugger/';
+$editorlibs = '../../phpjsrpc/lib/';
?>
<!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 $editorlibs;
?>xmlrpc_lib.js"></script>
-<script type="text/javascript" src="<?php echo $editorlibs;
?>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 == '')
- {
+ <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 $editorlibs;
?>xmlrpc_lib.js"></script>
+ <script type="text/javascript" src="<?php echo $editorlibs;
?>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;
}
@@ -59,43 +95,35 @@
document.frmaction.path.value = '/';
var action = '';
for (counter = 0; counter < document.frmaction.action.length; counter++)
- if (document.frmaction.action[counter].checked)
- {
+ if (document.frmaction.action[counter].checked) {
action = document.frmaction.action[counter].value;
}
- if (document.frmaction.method.value == '' && (action == 'execute' ||
action == 'wrap' || action == 'describe'))
- {
+ 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 == '')
- {
+ if (document.frmaction.authtype.value != '1' &&
document.frmaction.username.value == '') {
alert('No username for authenticating to server: authentication
disabled');
}
return true;
}
- function switchaction()
- {
+ 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)
- {
+ if (document.frmaction.action[counter].checked) {
action = document.frmaction.action[counter].value;
}
- if (action == 'execute')
- {
+ 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
- {
+ else {
document.frmaction.methodpayload.rows = 1;
- if (action == 'describe' || action == 'wrap')
- {
+ 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;
@@ -109,16 +137,13 @@
}
}
- function switchssl()
- {
- if (document.frmaction.protocol.value != '2')
- {
+ function switchssl() {
+ if (document.frmaction.protocol.value != '2') {
document.frmaction.verifypeer.disabled = true;
document.frmaction.verifyhost.disabled = true;
document.frmaction.cainfo.disabled = true;
}
- else
- {
+ else {
document.frmaction.verifypeer.disabled = false;
document.frmaction.verifyhost.disabled = false;
document.frmaction.cainfo.disabled = false;
@@ -125,63 +150,50 @@
}
}
- function switchauth()
- {
- if (document.frmaction.protocol.value != '0')
- {
+ function switchauth() {
+ if (document.frmaction.protocol.value != '0') {
document.frmaction.authtype.disabled = false;
}
- else
- {
+ else {
document.frmaction.authtype.disabled = true;
document.frmaction.authtype.value = 1;
}
}
- function swicthcainfo()
- {
- if (document.frmaction.verifypeer.checked == true)
- {
+ function swicthcainfo() {
+ if (document.frmaction.verifypeer.checked == true) {
document.frmaction.cainfo.disabled = false;
}
- else
- {
+ else {
document.frmaction.cainfo.disabled = true;
}
}
- function switchtransport(is_json)
- {
- if (is_json == 0)
- {
+ 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";
+ document.frmaction.wstype.value = "0";
}
- else
- {
+ else {
document.getElementById("idcell").style.visibility = 'visible';
document.frmjsonrpc.yes.checked = true;
document.frmxmlrpc.yes.checked = false;
- document.frmaction.wstype.value="1";
+ document.frmaction.wstype.value = "1";
}
}
- function displaydialogeditorbtn(show)
- {
- if (show && ((typeof base64_decode) == 'function'))
- {
+ function displaydialogeditorbtn(show) {
+ if (show && ((typeof base64_decode) == 'function')) {
document.getElementById('methodpayloadbtn').innerHTML = '[<a href="#"
onclick="activateeditor(); return false;">Edit</a>]';
}
- else
- {
+ else {
document.getElementById('methodpayloadbtn').innerHTML = '';
}
}
- function activateeditor()
- {
+ function activateeditor() {
var url = '<?php echo $editorpath; ?>visualeditor.php?params=<?php
echo $alt_payload; ?>';
if (document.frmaction.wstype.value == "1")
url += '&type=jsonrpc';
@@ -189,10 +201,8 @@
}
// if javascript version of the lib is found, allow it to send us params
- function buildparams(base64data)
- {
- if (typeof base64_decode == 'function')
- {
+ function buildparams(base64data) {
+ if (typeof base64_decode == 'function') {
if (base64data == '0') // workaround for bug in base64_encode...
document.getElementById('methodpayload').value = '';
else
@@ -201,120 +211,146 @@
}
// 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()
- {
+ 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 )
- {
+ if (document.frmaction.methodpayload.value.length > 1536) {
document.frmaction.action = 'action.php?usepost=true';
document.frmaction.method = 'post';
}
}
-//-->
-</script>
+ //-->
+ </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();"
->
+<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://gggeek.github.io/phpxmlrpc/">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="serverblock">
+ <tr>
+ <td><h2>Target server</h2></td>
+ <td class="labelcell">Address:</td>
+ <td><input type="text" name="host" value="<?php echo
htmlspecialchars($host, ENT_COMPAT, $inputcharset); ?>"/></td>
+ <td class="labelcell">Port:</td>
+ <td><input type="text" name="port" value="<?php echo
htmlspecialchars($port, ENT_COMPAT, $inputcharset); ?>" size="5" maxlength="5"/>
+ </td>
+ <td class="labelcell">Path:</td>
+ <td><input type="text" name="path" value="<?php echo
htmlspecialchars($path, ENT_COMPAT, $inputcharset); ?>"/></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="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, ENT_COMPAT, $inputcharset); ?>"/>
-<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="methodblock">
+ <tr>
+ <td><h2>Method</h2></td>
+ <td class="labelcell">Name:</td>
+ <td><input type="text" name="method" value="<?php echo
htmlspecialchars($method, ENT_COMPAT, $inputcharset); ?>"/></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, ENT_COMPAT, $inputcharset);
?></textarea></td>
+ <td class="labelcell" id="idcell">Msg id: <input type="text"
name="id" size="3" value="<?php echo htmlspecialchars($id, ENT_COMPAT,
$inputcharset); ?>"/></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>
+ <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, ENT_COMPAT, $inputcharset); ?>"/></td>
+ <td class="labelcell">Pwd:</td>
+ <td><input type="password" name="password" value="<?php echo
htmlspecialchars($password, ENT_COMPAT, $inputcharset); ?>"/></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 existence</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, ENT_COMPAT, $inputcharset); ?>"/></td>
+ </tr>
+ <tr>
+ <td class="labelcell">PROXY:</td>
+ <td class="labelcell">Server:</td>
+ <td><input type="text" name="proxy" value="<?php echo
htmlspecialchars($proxy, ENT_COMPAT, $inputcharset); ?>"/></td>
+ <td class="labelcell">Proxy user:</td>
+ <td><input type="text" name="proxyuser" value="<?php echo
htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset); ?>"/></td>
+ <td class="labelcell">Proxy pwd:</td>
+ <td><input type="password" name="proxypwd" value="<?php echo
htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset); ?>"/></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, ENT_COMPAT, $inputcharset); ?>"/></td>
+ <td colspan="2">Format: 'cookie1=value1, cookie2=value2'</td>
+ </tr>
+ </table>
</form>
</body>
Deleted: trunk/phpgwapi/inc/xmlrpc/debugger/index.html
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/debugger/index.html 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/debugger/index.html 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,11 +0,0 @@
-<!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" 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
Modified: trunk/phpgwapi/inc/xmlrpc/debugger/index.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/debugger/index.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/debugger/index.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,20 +1,21 @@
<?php
- $query = '';
- if (isset($_GET['run']))
- {
+$query = '';
+if (isset($_GET['run'])) {
$path = parse_url($_GET['run']);
- if (isset($path['query']))
- $query = '?'.$path['query'];
+ 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>
+ <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" />
+ <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
Modified: trunk/phpgwapi/inc/xmlrpc/demo/client/agesort.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/agesort.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/agesort.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,61 +1,68 @@
-<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>
-<?php
-include("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 request
-print "Now sending request (detailed debug info follows)";
-$r=&$c->send($f);
-
-// check response for errors, and take appropriate action
-if (!$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/>';
-}
-
-?>
-</body>
-</html>
+<html>
+<head><title>xmlrpc - Agesort demo</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>
+<?php
+
+include_once __DIR__ . "/../../src/Autoloader.php";
+PhpXmlRpc\Autoloader::register();
+
+$inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27);
+print "This is the input data:<br/><pre>";
+foreach($inAr as $key => $val) {
+ 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 PhpXmlRpc\Value(
+ array(
+ "name" => new PhpXmlRpc\Value($key),
+ "age" => new PhpXmlRpc\Value($val, "int")
+ ),
+ "struct"
+ );
+}
+$v = new PhpXmlRpc\Value($p, "array");
+print "Encoded into xmlrpc format it looks like this: <pre>\n" .
htmlentities($v->serialize()) . "</pre>\n";
+
+// create client and message objects
+$req = new PhpXmlRpc\Request('examples.sortByAge', array($v));
+$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+
+// set maximum debug level, to have the complete communication printed to
screen
+$client->setDebug(2);
+
+// send request
+print "Now sending request (detailed debug info follows)";
+$resp = $client->send($req);
+
+// check response for errors, and take appropriate action
+if (!$resp->faultCode()) {
+ print "The server gave me these results:<pre>";
+ $value = $resp->value();
+ foreach ($value as $struct) {
+ $name = $struct["name"];
+ $age = $struct["age"];
+ print htmlspecialchars($name->scalarval()) . ", " .
htmlspecialchars($age->scalarval()) . "\n";
+ }
+
+ print "<hr/>For nerds: I got this value back<br/><pre>" .
+ htmlentities($resp->serialize()) . "</pre><hr/>\n";
+} else {
+ print "An error occurred:<pre>";
+ print "Code: " . htmlspecialchars($resp->faultCode()) .
+ "\nReason: '" . htmlspecialchars($resp->faultString()) .
'\'</pre><hr/>';
+}
+
+?>
+</body>
+</html>
Deleted: trunk/phpgwapi/inc/xmlrpc/demo/client/client.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/client.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/client.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,52 +0,0 @@
-<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("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";
- $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>";
-
-?>
-</body>
-</html>
Deleted: trunk/phpgwapi/inc/xmlrpc/demo/client/comment.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/comment.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/comment.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,185 +0,0 @@
-<?php
-include("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>
-</p>
-</body>
-</html>
Added: trunk/phpgwapi/inc/xmlrpc/demo/client/getstatename.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/getstatename.php
(rev 0)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/getstatename.php 2017-12-25
18:41:14 UTC (rev 17467)
@@ -0,0 +1,43 @@
+<html>
+<head><title>xmlrpc - Getstatename demo</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 automatic encoding/decoding of php
variables into xmlrpc values</h3>
+<?php
+
+include_once __DIR__ . "/../../src/Autoloader.php";
+PhpXmlRpc\Autoloader::register();
+
+if (isset($_POST["stateno"]) && $_POST["stateno"] != "") {
+ $stateNo = (integer)$_POST["stateno"];
+ $encoder = new PhpXmlRpc\Encoder();
+ $req = new PhpXmlRpc\Request('examples.getStateName',
+ array($encoder->encode($stateNo))
+ );
+ print "Sending the following request:<pre>\n\n" .
htmlentities($req->serialize()) . "\n\n</pre>Debug info of server data
follows...\n\n";
+ $client = new
PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+ $client->setDebug(1);
+ $r = $client->send($req);
+ if (!$r->faultCode()) {
+ $v = $r->value();
+ print "<br/>State number <b>" . $stateNo . "</b> is <b>"
+ . htmlspecialchars($encoder->decode($v)) . "</b><br/>";
+ } else {
+ print "An error occurred: ";
+ print "Code: " . htmlspecialchars($r->faultCode())
+ . " Reason: '" . htmlspecialchars($r->faultString()) .
"'</pre><br/>";
+ }
+} else {
+ $stateNo = "";
+}
+
+print "<form action=\"getstatename.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>";
+
+?>
+</body>
+</html>
Modified: trunk/phpgwapi/inc/xmlrpc/demo/client/introspect.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/introspect.php 2017-12-25
17:36:09 UTC (rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/introspect.php 2017-12-25
18:41:14 UTC (rev 17467)
@@ -1,212 +1,86 @@
-<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("xmlrpc.inc");
-
-
-
- function display_error($r)
-
- {
-
- print "An error occurred: ";
-
- print "Code: " . $r->faultCode()
-
- . " Reason: '" .$r->faultString()."'<br/>";
-
- }
-
-
-
- // 'new style' client constuctor
-
- $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";
-
- }
-
- }
-
- }
-
-?>
-
-</body>
-
-</html>
-
+<html>
+<head><title>xmlrpc - Introspect demo</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_once __DIR__ . "/../../src/Autoloader.php";
+PhpXmlRpc\Autoloader::register();
+
+function display_error($r)
+{
+ print "An error occurred: ";
+ print "Code: " . $r->faultCode()
+ . " Reason: '" . $r->faultString() . "'<br/>";
+}
+
+$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+
+// First off, let's retrieve the list of methods available on the remote server
+print "<h3>methods available at http://" . $client->server . $client->path .
"</h3>\n";
+$req = new PhpXmlRpc\Request('system.listMethods');
+$resp = $client->send($req);
+
+if ($resp->faultCode()) {
+ display_error($resp);
+} else {
+ $v = $resp->value();
+
+ // Then, retrieve the signature and help text of each available method
+ foreach ($v as $methodName) {
+ print "<h4>" . $methodName->scalarval() . "</h4>\n";
+ // build messages first, add params later
+ $m1 = new PhpXmlRpc\Request('system.methodHelp');
+ $m2 = new PhpXmlRpc\Request('system.methodSignature');
+ $val = new PhpXmlRpc\Value($methodName->scalarval(), "string");
+ $m1->addParam($val);
+ $m2->addParam($val);
+ // Send multiple requests in one http call.
+ // If server does not support multicall, client will automatically
fall back to 2 separate calls
+ $ms = array($m1, $m2);
+ $rs = $client->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";
+ // note: using PhpXmlRpc\Encoder::decode() here would lead to
cleaner code
+ $val = $rs[1]->value();
+ if ($val->kindOf() == "array") {
+ foreach ($val as $x) {
+ $ret = $x[0];
+ print "<code>" . $ret->scalarval() . " "
+ . $methodName->scalarval() . "(";
+ if ($x->count() > 1) {
+ for ($k = 1; $k < $x->count(); $k++) {
+ $y = $x[$k];
+ print $y->scalarval();
+ if ($k < $x->count() - 1) {
+ print ", ";
+ }
+ }
+ }
+ print ")</code><br/>\n";
+ }
+ } else {
+ print "Signature unknown\n";
+ }
+ print "</p>\n";
+ }
+ }
+}
+?>
+</body>
+</html>
Modified: trunk/phpgwapi/inc/xmlrpc/demo/client/mail.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/mail.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/mail.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,69 +1,66 @@
<?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(); }
+if (isset($_GET['showSource']) && $_GET['showSource']) {
+ highlight_file(__FILE__);
+ die();
+}
?>
<html>
-<head><title>xmlrpc</title></head>
+<head><title>xmlrpc - Mail demo</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>This form enables you to send mail via an XML-RPC server.
+ 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>
+ 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("xmlrpc.inc");
-// Play nice to PHP 5 installations with REGISTER_LONG_ARRAYS off
-if (!isset($HTTP_POST_VARS) && isset($_POST))
- $HTTP_POST_VARS = $_POST;
+include_once __DIR__ . "/../../src/Autoloader.php";
+PhpXmlRpc\Autoloader::register();
-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"));
+if (isset($_POST["mailto"]) && $_POST["mailto"]) {
+ $server = "http://phpxmlrpc.sourceforge.net/server.php";
+ $req = new PhpXmlRpc\Request('mail.send', array(
+ new PhpXmlRpc\Value($_POST["mailto"]),
+ new PhpXmlRpc\Value($_POST["mailsub"]),
+ new PhpXmlRpc\Value($_POST["mailmsg"]),
+ new PhpXmlRpc\Value($_POST["mailfrom"]),
+ new PhpXmlRpc\Value($_POST["mailcc"]),
+ new PhpXmlRpc\Value($_POST["mailbcc"]),
+ new PhpXmlRpc\Value("text/plain")
+ ));
- $c=new xmlrpc_client($XP, $XS, 80);
- $c->setDebug(2);
- $r=&$c->send($f);
- if (!$r->faultCode()) {
+ $client = new PhpXmlRpc\Client($server);
+ $client->setDebug(2);
+ $resp = $client->send($req);
+ if (!$resp->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 "Code: " . htmlspecialchars($resp->faultCode()) .
+ " Reason: '" . htmlspecialchars($resp->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"/>
+ 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>
</body>
</html>
Added: trunk/phpgwapi/inc/xmlrpc/demo/client/proxy.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/proxy.php
(rev 0)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/proxy.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -0,0 +1,60 @@
+<html>
+<head><title>xmlrpc - Proxy demo</title></head>
+<body>
+<h1>proxy demo</h1>
+<h2>Query server using a 'proxy' object</h2>
+<h3>The code demonstrates usage for the terminally lazy. For a more complete
proxy, look at at the Wrapper class</h3>
+<?php
+
+include_once __DIR__ . "/../../src/Autoloader.php";
+PhpXmlRpc\Autoloader::register();
+
+class PhpXmlRpcProxy
+{
+ protected $client;
+ protected $prefix = 'examples.';
+
+ public function __construct(PhpXmlRpc\Client $client)
+ {
+ $this->client = $client;
+ }
+
+ /**
+ * Translates any method call to an xmlrpc call.
+ *
+ * @author Toth Istvan
+ *
+ * @param string $name remote function name. Will be prefixed
+ * @param array $arguments
+ *
+ * @return mixed
+ *
+ * @throws Exception
+ */
+ function __call($name, $arguments)
+ {
+ $encoder = new PhpXmlRpc\Encoder();
+ $valueArray = array();
+ foreach ($arguments as $parameter) {
+ $valueArray[] = $encoder->encode($parameter);
+ }
+
+ // just in case this was set to something else
+ $this->client->return_type = 'phpvals';
+
+ $resp = $this->client->send(new PhpXmlRpc\Request($this->prefix.$name,
$valueArray));
+
+ if ($resp->faultCode()) {
+ throw new Exception($resp->faultString(), $resp->faultCode());
+ } else {
+ return $resp->value();
+ }
+ }
+
+}
+
+$stateNo = rand(1, 51);
+$proxy = new PhpXmlRpcProxy(new
\PhpXmlRpc\Client('http://phpxmlrpc.sourceforge.net/server.php'));
+$stateName = $proxy->getStateName($stateNo);
+
+echo "State $stateNo is ".htmlspecialchars($stateName);
\ No newline at end of file
Deleted: trunk/phpgwapi/inc/xmlrpc/demo/client/simple_call.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/simple_call.php 2017-12-25
17:36:09 UTC (rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/simple_call.php 2017-12-25
18:41:14 UTC (rev 17467)
@@ -1,58 +0,0 @@
-<?php
-/**
- * Helper function for the terminally lazy
- *
- * @copyright (c) 2006-2014 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));
- }
- }
-?>
Modified: trunk/phpgwapi/inc/xmlrpc/demo/client/which.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/which.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/which.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,60 +1,30 @@
-<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("xmlrpc.inc");
-
-
-
- $f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());
-
- $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";
-
- }
-
-?>
-
-</body>
-
-</html>
-
+<html>
+<head><title>xmlrpc - Which toolkit demo</title></head>
+<body>
+<h1>Which toolkit demo</h1>
+<h2>Query server for toolkit information</h2>
+<h3>The code demonstrates usage of the PhpXmlRpc\Encoder class</h3>
+<?php
+
+include_once __DIR__ . "/../../src/Autoloader.php";
+PhpXmlRpc\Autoloader::register();
+
+$req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array());
+$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+$resp = $client->send($req);
+if (!$resp->faultCode()) {
+ $encoder = new PhpXmlRpc\Encoder();
+ $value = $encoder->decode($resp->value());
+ print "<pre>";
+ print "name: " . htmlspecialchars($value["toolkitName"]) . "\n";
+ print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n";
+ print "docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n";
+ print "os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n";
+ print "</pre>";
+} else {
+ print "An error occurred: ";
+ print "Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" .
htmlspecialchars($resp->faultString()) . "'\n";
+}
+?>
+</body>
+</html>
Modified: trunk/phpgwapi/inc/xmlrpc/demo/client/wrap.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/wrap.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/wrap.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,56 +1,53 @@
<html>
-<head><title>xmlrpc</title></head>
+<head><title>xmlrpc - Webservice wrappper demo</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>The code demonstrates usage of some the most automagic client usage
possible:<br/>
+ 1) client that returns php values instead of xmlrpc value objects<br/>
+ 2) wrapping of remote methods into php functions<br/>
+ See also proxy.php for an alternative take
</h3>
<?php
- include("xmlrpc.inc");
- include("xmlrpc_wrappers.inc");
- $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 = '';
+include_once __DIR__ . "/../../src/Autoloader.php";
+PhpXmlRpc\Autoloader::register();
+
+$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
+$client->return_type = 'phpvals'; // let client give us back php values
instead of xmlrpcvals
+$resp = $client->send(new PhpXmlRpc\Request('system.listMethods'));
+if ($resp->faultCode()) {
+ echo "<p>Server methods list could not be retrieved: error
{$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n";
+} else {
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";
+ flush();
+
+ $callable = false;
+ $wrapper = new PhpXmlRpc\Wrapper();
+ foreach ($resp->value() as $methodName) {
+ // $resp->value is an array of strings
+ if ($methodName == 'examples.getStateName') {
+ $callable = $wrapper->wrapXmlrpcMethod($client, $methodName);
+ if ($callable) {
+ echo "<li>Remote server method " .
htmlspecialchars($methodName) . " wrapped into php function</li>\n";
+ } else {
+ echo "<li>Remote server method " .
htmlspecialchars($methodName) . " could not be wrapped!</li>\n";
}
- else
- {
- echo "<li>Remote server method
".htmlspecialchars($methodname)." could not be wrapped!</li>\n";
- }
- if($methodname == 'examples.getStateName')
- {
- $testcase = $funcname;
- }
+ break;
}
}
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);
- }
+ flush();
+
+ if ($callable) {
+ echo "Now testing function for remote method to convert U.S. state
number into state name";
+ $stateNum = rand(1, 51);
+ // the 2nd parameter gets added to the closure - it is teh debug level
to be used for the client
+ $stateName = $callable($stateNum, 2);
}
+}
?>
</body>
</html>
Deleted: trunk/phpgwapi/inc/xmlrpc/demo/client/zopetest.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/client/zopetest.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/client/zopetest.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,29 +0,0 @@
-<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("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/>";
- }
-?>
-</body>
-</html>
Deleted: trunk/phpgwapi/inc/xmlrpc/demo/demo1.txt
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/demo1.txt 2017-12-25 17:36:09 UTC (rev
17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/demo1.txt 2017-12-25 18:41:14 UTC (rev
17467)
@@ -1,36 +0,0 @@
-<?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>
Added: trunk/phpgwapi/inc/xmlrpc/demo/demo1.xml
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/demo1.xml (rev 0)
+++ trunk/phpgwapi/inc/xmlrpc/demo/demo1.xml 2017-12-25 18:41:14 UTC (rev
17467)
@@ -0,0 +1,60 @@
+<?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>
Deleted: trunk/phpgwapi/inc/xmlrpc/demo/demo2.txt
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/demo2.txt 2017-12-25 17:36:09 UTC (rev
17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/demo2.txt 2017-12-25 18:41:14 UTC (rev
17467)
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
- <methodResponse>
- <params>
- <param>
- <value><string>South Dakota's own</string></value>
- </param>
- </params>
- </methodResponse>
Added: trunk/phpgwapi/inc/xmlrpc/demo/demo2.xml
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/demo2.xml (rev 0)
+++ trunk/phpgwapi/inc/xmlrpc/demo/demo2.xml 2017-12-25 18:41:14 UTC (rev
17467)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <string>South Dakota's own</string>
+ </value>
+ </param>
+ </params>
+</methodResponse>
Deleted: trunk/phpgwapi/inc/xmlrpc/demo/demo3.txt
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/demo3.txt 2017-12-25 17:36:09 UTC (rev
17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/demo3.txt 2017-12-25 18:41:14 UTC (rev
17467)
@@ -1,17 +0,0 @@
-<?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>
Added: trunk/phpgwapi/inc/xmlrpc/demo/demo3.xml
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/demo3.xml (rev 0)
+++ trunk/phpgwapi/inc/xmlrpc/demo/demo3.xml 2017-12-25 18:41:14 UTC (rev
17467)
@@ -0,0 +1,21 @@
+<?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>
Modified: trunk/phpgwapi/inc/xmlrpc/demo/server/discuss.php
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/demo/server/discuss.php 2017-12-25 17:36:09 UTC
(rev 17466)
+++ trunk/phpgwapi/inc/xmlrpc/demo/server/discuss.php 2017-12-25 18:41:14 UTC
(rev 17467)
@@ -1,38 +1,35 @@
<?php
- include("xmlrpc.inc");
- include("xmlrpcs.inc");
+include_once __DIR__ . "/../../vendor/autoload.php";
- $addcomment_sig=array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString,
$xmlrpcString));
+use PhpXmlRpc\Value;
- $addcomment_doc='Adds a comment to an item. The first parameter
+$addComment_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcString,
Value::$xmlrpcString, Value::$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="";
+function addComment($req)
+{
+ $err = "";
// since validation has already been carried out for us,
// we know we got exactly 3 string values
- $n = php_xmlrpc_decode($m);
+ $encoder = new PhpXmlRpc\Encoder();
+ $n = $encoder->decode($req);
$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);
+ $dbh = dba_open("/tmp/comments.db", "c", "db2");
+ if ($dbh) {
+ $countID = "${msgID}_count";
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17467] API: upgrade xmlrpc from upstream,
sigurdne <=