[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16682] update xmlrpc
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16682] update xmlrpc |
Date: |
Wed, 3 May 2017 12:03:26 -0400 (EDT) |
Revision: 16682
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16682
Author: sigurdne
Date: 2017-05-03 12:03:25 -0400 (Wed, 03 May 2017)
Log Message:
-----------
update xmlrpc
Modified Paths:
--------------
trunk/phpgwapi/inc/class.acl.inc.php
trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc.inc
trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc_wrappers.inc
trunk/phpgwapi/inc/xmlrpc/lib/xmlrpcs.inc
trunk/xmlrpc.php
Modified: trunk/phpgwapi/inc/class.acl.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.acl.inc.php 2017-05-03 13:31:20 UTC (rev
16681)
+++ trunk/phpgwapi/inc/class.acl.inc.php 2017-05-03 16:03:25 UTC (rev
16682)
@@ -1523,13 +1523,16 @@
}
}
- foreach ( $accounts[$grantor] as
$grantors )
+ if(isset($accounts[$grantor]) &&
is_array($accounts[$grantor]))
{
- if (
!isset($grants['accounts'][$grantors]) )
+ foreach ( $accounts[$grantor]
as $grantors )
{
-
$grants['accounts'][$grantors] = 0;
+ if (
!isset($grants['accounts'][$grantors]) )
+ {
+
$grants['accounts'][$grantors] = 0;
+ }
+
$grants['accounts'][$grantors] |= $rights;
}
- $grants['accounts'][$grantors]
|= $rights;
}
}
}
Modified: trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc.inc
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc.inc 2017-05-03 13:31:20 UTC (rev
16681)
+++ trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc.inc 2017-05-03 16:03:25 UTC (rev
16682)
@@ -205,10 +205,10 @@
// The encoding used internally by PHP.
// String values received as xml will be converted to this, and php
strings will be converted to xml
// as if having been coded with this
- $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';
+ $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';
$GLOBALS['xmlrpcName']='XML-RPC for PHP';
- $GLOBALS['xmlrpcVersion']='3.0.0';
+ $GLOBALS['xmlrpcVersion']='3.0.0';
// let user errors start at 800
$GLOBALS['xmlrpcerruser']=800;
@@ -225,7 +225,7 @@
// set to TRUE to enable encoding of php NULL values to <EX:NIL/>
instead of <NIL/>
$GLOBALS['xmlrpc_null_apache_encoding']=false;
-
$GLOBALS['xmlrpc_null_apache_encoding_ns']='http://ws.apache.org/xmlrpc/namespaces/extensions';
+
$GLOBALS['xmlrpc_null_apache_encoding_ns']='http://ws.apache.org/xmlrpc/namespaces/extensions';
// used to store state during parsing
// quick explanation of components:
@@ -850,7 +850,7 @@
* http://curl.haxx.se/docs/faq.html#7.3)
*/
var $xmlrpc_curl_handle = null;
- /// Whether to use persistent connections for http 1.1 and https
+ /// Whether to use persistent connections for http 1.1 and https
var $keepalive = false;
/// Charset encodings that can be decoded without problems by
the client
var $accepted_charset_encodings = array();
@@ -872,7 +872,7 @@
* @param integer $port the port the server is listening on,
defaults to 80 or 443 depending on protocol used
* @param string $method the http protocol variant: defaults to
'http', 'https' and 'http11' can be used if CURL is installed
*/
- function xmlrpc_client($path, $server='', $port='', $method='')
+ function __construct($path, $server='', $port='', $method='')
{
// allow user to specify all params in $path
if($server == '' and $port == '' and $method == '')
@@ -944,7 +944,7 @@
/**
* Enables/disables the echoing to screen of the xmlrpc
responses received
- * @param integer $in values 0, 1 and 2 are supported (2 = echo
sent msg too, before received response)
+ * @param integer $in values 0, 1 and 2 are supported (2 = echo
sent msg too, before received response)
* @access public
*/
function setDebug($in)
@@ -980,7 +980,7 @@
/**
* Add a CA certificate to verify server with (see man page about
- * CURLOPT_CAINFO for more details)
+ * CURLOPT_CAINFO for more details)
* @param string $cacert certificate file name (or dir holding
certificates)
* @param bool $is_dir set to true to indicate cacert is a dir.
defaults to false
* @access public
@@ -1062,9 +1062,9 @@
if ($compmethod == 'any')
$this->accepted_compression = array('gzip',
'deflate');
else
- if ($compmethod == false )
- $this->accepted_compression = array();
- else
+ if ($compmethod == false )
+ $this->accepted_compression = array();
+ else
$this->accepted_compression =
array($compmethod);
}
@@ -1112,7 +1112,7 @@
/**
* Directly set cURL options, for extra flexibility
* It allows eg. to bind client to a specific IP interface /
address
- * @param array $options
+ * @param array $options
*/
function SetCurlOptions( $options )
{
@@ -1345,12 +1345,12 @@
$cookieheader = 'Cookie:' . $version .
substr($cookieheader, 0, -1) . "\r\n";
}
- // omit port if 80
- $port = ($port == 80) ? '' : (':' . $port);
-
+ // omit port if 80
+ $port = ($port == 80) ? '' : (':' . $port);
+
$op= 'POST ' . $uri. " HTTP/1.0\r\n" .
'User-Agent: ' . $this->user_agent . "\r\n" .
- 'Host: '. $server . $port . "\r\n" .
+ 'Host: '. $server . $port . "\r\n" .
$credentials .
$proxy_credentials .
$accepted_encoding .
@@ -1399,11 +1399,11 @@
}
else
{
- // reset errno and errstr on successful socket
connection
+ // reset errno and errstr on successful socket
connection
$this->errstr = '';
}
// G. Giunta 2005/10/24: close socket before parsing.
- // should yield slightly better execution times, and
make easier recursive calls (e.g. to follow http redirects)
+ // should yield slightly better execution times, and
make easier recursive calls (e.g. to follow http redirects)
$ipd='';
do
{
@@ -1621,13 +1621,13 @@
{
curl_setopt($curl,
CURLOPT_SSLKEYPASSWD, $keypass);
}
-
- // Upgrade transparently to more stringent check for versions
of php which do not support otherwise.
- // Doing it in constructor would be cleaner; doing it here
saves us a couple of function calls
- if($this->verifyhost == 1 && $info = curl_version() &&
version_compare($info['version'], '7.28.1') >= 0)
- {
- $this->verifyhost = 2;
- }
+
+ // Upgrade transparently to more stringent check for versions
of php which do not support otherwise.
+ // Doing it in constructor would be cleaner; doing it here
saves us a couple of function calls
+ if($this->verifyhost == 1 && $info = curl_version() &&
version_compare($info['version'], '7.28.1') >= 0)
+ {
+ $this->verifyhost = 2;
+ }
// whether to verify cert's common name (CN); 0
for no, 1 to verify that it exists, and 2 to verify that it matches the
hostname used
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,
$this->verifyhost);
}
@@ -1679,14 +1679,14 @@
{
print "<PRE>\n---CURL INFO---\n";
foreach(curl_getinfo($curl) as $name => $val)
- {
- if (is_array($val))
- {
- $val = implode("\n", $val);
- }
- print $name . ': ' . htmlentities($val)
. "\n";
- }
-
+ {
+ if (is_array($val))
+ {
+ $val = implode("\n", $val);
+ }
+ print $name . ': ' . htmlentities($val)
. "\n";
+ }
+
print "---END---\n</PRE>";
}
@@ -1707,12 +1707,12 @@
curl_close($curl);
}
$resp =& $msg->parseResponse($result, true,
$this->return_type);
- // if we got back a 302, we can not reuse the curl handle for
later calls
- if($resp->faultCode() == $GLOBALS['xmlrpcerr']['http_error']
&& $keepalive)
- {
- curl_close($curl);
- $this->xmlrpc_curl_handle = null;
- }
+ // if we got back a 302, we can not reuse the curl handle for
later calls
+ if($resp->faultCode() == $GLOBALS['xmlrpcerr']['http_error']
&& $keepalive)
+ {
+ curl_close($curl);
+ $this->xmlrpc_curl_handle = null;
+ }
}
return $resp;
}
@@ -1735,7 +1735,7 @@
* @param array $msgs an array of xmlrpcmsg objects
* @param integer $timeout connection timeout (in seconds)
* @param string $method the http protocol variant to be used
- * @param boolean fallback When true, upon receiving an error
during multicall, multiple single calls will be attempted
+ * @param boolean fallback When true, upon receiving an error
during multicall, multiple single calls will be attempted
* @return array
* @access public
*/
@@ -1968,7 +1968,7 @@
* NB: as of now we do not do it, since it might be either an
xmlrpcval or a plain
* php val, or a complete xml chunk, depending on usage of
xmlrpc_client::send() inside which creator is called...
*/
- function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')
+ function __construct($val, $fcode = 0, $fstr = '', $valtyp='')
{
if($fcode != 0)
{
@@ -2042,7 +2042,7 @@
* with attributes being e.g. 'expires', 'path', domain'.
* NB: cookies sent as 'expired' by the server (i.e. with an
expiry date in the past)
* are still present in the array. It is up to the user-defined
code to decide
- * how to use the received cookies, and whether they have to be
sent back with the next
+ * how to use the received cookies, and whether they have to be
sent back with the next
* request to the server (using xmlrpc_client::setCookie) or not
* @return array array of cookies received from the server
* @access public
@@ -2064,14 +2064,14 @@
$this->content_type = 'text/xml; charset=' .
$charset_encoding;
else
$this->content_type = 'text/xml';
- if ($GLOBALS['xmlrpc_null_apache_encoding'])
- {
- $result = "<methodResponse
xmlns:ex=\"".$GLOBALS['xmlrpc_null_apache_encoding_ns']."\">\n";
- }
- else
- {
+ if ($GLOBALS['xmlrpc_null_apache_encoding'])
+ {
+ $result = "<methodResponse
xmlns:ex=\"".$GLOBALS['xmlrpc_null_apache_encoding_ns']."\">\n";
+ }
+ else
+ {
$result = "<methodResponse>\n";
- }
+ }
if($this->errno)
{
// G. Giunta 2005/2/13: let non-ASCII response
messages be tolerated by clients
@@ -2121,9 +2121,9 @@
/**
* @param string $meth the name of the method to invoke
- * @param array $pars array of parameters to be passed to the
method (xmlrpcval objects)
+ * @param array $pars array of parameters to be passed to the
method (xmlrpcval objects)
*/
- function xmlrpcmsg($meth, $pars=0)
+ function __construct($meth, $pars=0)
{
$this->methodname=$meth;
if(is_array($pars) && count($pars)>0)
@@ -2205,7 +2205,7 @@
/**
* Returns xml representation of the message. XML prologue
included
- * @param string $charset_encoding
+ * @param string $charset_encoding
* @return string the xml representation of the message, xml
prologue included
* @access public
*/
@@ -2259,7 +2259,7 @@
* infinite loop in that case, because we cannot trust the
caller
* to give us a valid pointer to an open file...
* @access public
- * @param resource $fp stream pointer
+ * @param resource $fp stream pointer
* @return xmlrpcresp
* @todo add 2nd & 3rd param to be passed to ParseResponse() ???
*/
@@ -2748,7 +2748,7 @@
* @param mixed $val
* @param string $type any valid xmlrpc type name (lowercase).
If null, 'string' is assumed
*/
- function xmlrpcval($val=-1, $type='')
+ function __construct($val=-1, $type='')
{
/// @todo: optimization creep - do not call addXX, do
it all inline.
/// downside: booleans will not be coerced anymore
@@ -3089,7 +3089,7 @@
}
/**
- * Checks whether a struct member with a given name is present.
+ * Checks whether a struct member with a given name is present.
* Works only on xmlrpcvals of type struct.
* @param string $m the name of the struct member to be looked up
* @return boolean
@@ -3688,10 +3688,10 @@
* we SHOULD assume it is strictly US-ASCII. But we try to be more
tolerant of unconforming (legacy?) clients/servers,
* which will be most probably using UTF-8 anyway...
*
- * @param string $httpheader the http Content-type header
+ * @param string $httpheader the http Content-type header
* @param string $xmlchunk xml content buffer
* @param string $encoding_prefs comma separated list of character
encodings to be used as default (when mb extension is enabled)
- * @return string
+ * @return string
*
* @todo explore usage of mb_http_input(): does it detect http headers +
post data? if so, use it instead of hand-detection!!!
*/
@@ -3784,7 +3784,7 @@
* if it is a valid subset of any encoding in the list
* @param string $encoding charset to be tested
* @param mixed $validlist comma separated list of valid charsets (or
array of charsets)
- * @return bool
+ * @return bool
*/
function is_valid_charset($encoding, $validlist)
{
@@ -3807,6 +3807,4 @@
return true;
return false;
}
- }
-
-?>
+ }
\ No newline at end of file
Modified: trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc_wrappers.inc
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc_wrappers.inc 2017-05-03 13:31:20 UTC
(rev 16681)
+++ trunk/phpgwapi/inc/xmlrpc/lib/xmlrpc_wrappers.inc 2017-05-03 16:03:25 UTC
(rev 16682)
@@ -4,7 +4,7 @@
* Generate stubs to transparently access xmlrpc methods as php functions and
viceversa
*
* @author Gaetano Giunta
- * @copyright (C) 2006-2014 G. Giunta
+ * @copyright (C) 2006-2014 G. Giunta
* @license code licensed under the BSD License:
http://phpxmlrpc.sourceforge.net/license.txt
*
* @todo separate introspection from code generation for func-2-method wrapping
@@ -226,7 +226,7 @@
error_log('XML-RPC: method to be wrapped is the
constructor: '.$plainfuncname);
return false;
}
- if($func->isDestructor())
+ if($func->isDestructor())
{
error_log('XML-RPC: method to be wrapped is the
destructor: '.$plainfuncname);
return false;
@@ -515,12 +515,12 @@
* Given an xmlrpc client and a method name, register a php wrapper
function
* that will call it and return results using native php types for both
* params and results. The generated php function will return an
xmlrpcresp
- * object for failed xmlrpc calls
+ * object for failed xmlrpc calls
*
* Known limitations:
* - server must support system.methodsignature for the wanted xmlrpc
method
* - for methods that expose many signatures, only one can be picked (we
- * could in principle check if signatures differ only by number of
params
+ * could in principle check if signatures differ only by number of
params
* and not by type, but it would be more complication than we can
spare time)
* - nested xmlrpc params: the caller of the generated php function has
to
* encode on its own the params passed to the php function if these
are structs
@@ -536,11 +536,11 @@
*
* @param xmlrpc_client $client an xmlrpc client set up correctly to
communicate with target server
* @param string $methodname the xmlrpc method to be mapped to a
php function
- * @param array $extra_options array of options that specify
conversion details. valid options include
+ * @param array $extra_options array of options that specify
conversion details. valid options include
* integer signum the index of the method signature to
use in mapping (if method exposes many sigs)
* integer timeout timeout (in secs) to be used when
executing function/calling remote method
* string protocol 'http' (default), 'http11' or 'https'
- * string new_function_name the name of php function to
create. If unspecified, lib will pick an appropriate name
+ * string new_function_name the name of php function to
create. If unspecified, lib will pick an appropriate name
* string return_source if true return php code w.
function definition instead fo function name
* bool encode_php_objs let php objects be sent to
server using the 'improved' xmlrpc notation, so server can deserialize them as
php objects
* bool decode_php_objs --- WARNING !!! possible
security hazard. only use it with trusted servers ---
@@ -570,7 +570,7 @@
$encode_php_objects = isset($extra_options['encode_php_objs'])
? (bool)$extra_options['encode_php_objs'] : false;
$decode_php_objects = isset($extra_options['decode_php_objs'])
? (bool)$extra_options['decode_php_objs'] : false;
- // it seems like the meaning of 'simple_client_copy' here is
swapped wrt client_copy_mode later on...
+ // it seems like the meaning of 'simple_client_copy' here is
swapped wrt client_copy_mode later on...
$simple_client_copy =
isset($extra_options['simple_client_copy']) ?
(int)($extra_options['simple_client_copy']) : 0;
$buildit = isset($extra_options['return_source']) ?
!($extra_options['return_source']) : true;
$prefix = isset($extra_options['prefix']) ?
$extra_options['prefix'] : 'xmlrpc';
@@ -930,5 +930,4 @@
$code .= "\$client->return_type = '{$prefix}vals';\n";
//$code .= "\$client->setDebug(\$debug);\n";
return $code;
- }
-?>
\ No newline at end of file
+ }
\ No newline at end of file
Modified: trunk/phpgwapi/inc/xmlrpc/lib/xmlrpcs.inc
===================================================================
--- trunk/phpgwapi/inc/xmlrpc/lib/xmlrpcs.inc 2017-05-03 13:31:20 UTC (rev
16681)
+++ trunk/phpgwapi/inc/xmlrpc/lib/xmlrpcs.inc 2017-05-03 16:03:25 UTC (rev
16682)
@@ -420,7 +420,7 @@
/**
* Add a string to the debug info that can be later seralized by the
server
* as part of the response message.
- * Note that for best compatibility, the debug string should be encoded
using
+ * Note that for best compatibility, the debug string should be encoded
using
* the $GLOBALS['xmlrpc_internalencoding'] character set.
* @param string $m
* @access public
@@ -450,7 +450,7 @@
* @see php_xmlrpc_encode for a list of values
*/
var $phpvals_encoding_options = array( 'auto_dates' );
- /// controls whether the server is going to echo debugging
messages back to the client as comments in response body. valid values: 0,1,2,3
+ /// controls whether the server is going to echo debugging
messages back to the client as comments in response body. valid values: 0,1,2,3
var $debug = 1;
/**
* Controls behaviour of server when invoked user function
throws an exception:
@@ -494,10 +494,10 @@
var $user_data = null;
/**
- * @param array $dispmap the dispatch map with definition of
exposed services
- * @param boolean $servicenow set to false to prevent the server
from running upon construction
+ * @param array $dispmap the dispatch map with definition of
exposed services
+ * @param boolean $servicenow set to false to prevent the server
from running upon construction
*/
- function xmlrpc_server($dispMap=null, $serviceNow=true)
+ function __construct($dispMap=null, $serviceNow=true)
{
// if ZLIB is enabled, let the server by default accept
compressed requests,
// and compress responses sent to clients that support
them
@@ -540,7 +540,7 @@
* with the standard processing of the php function exposed as
method. In
* particular, triggering an USER_ERROR level error will not
halt script
* execution anymore, but just end up logged in the xmlrpc
response)
- * Note that info added at level 2 and 3 will be base64 encoded
+ * Note that info added at level 2 and 3 will be base64 encoded
* @access public
*/
function setDebug($in)
@@ -711,7 +711,7 @@
* Verify type and number of parameters received against a list
of known signatures
* @param array $in array of either xmlrpcval objects or xmlrpc
type definitions
* @param array $sig array of known signatures to match against
- * @return array
+ * @return array
* @access private
*/
function verifySignature($in, $sig)
@@ -777,7 +777,7 @@
/**
* Parse http headers received along with xmlrpc request. If
needed, inflate request
- * @return mixed null on success or an xmlrpcresp
+ * @return mixed null on success or an xmlrpcresp
* @access private
*/
function parseRequestHeaders(&$data, &$req_encoding,
&$resp_encoding, &$resp_compression)
@@ -940,7 +940,7 @@
}
/// @BUG this will fail on PHP 5 if charset is
not specified in the xml prologue,
// the encoding is not UTF8 and there are
non-ascii chars in the text...
- /// @todo use an empty string for php 5 ???
+ /// @todo use an empty string for php 5 ???
$parser = xml_parser_create($req_encoding);
}
else
@@ -1202,7 +1202,7 @@
/**
* add a string to the 'internal debug message' (separate from
'user debug message')
- * @param string $string
+ * @param string $string
* @access private
*/
function debugmsg($string)
@@ -1234,5 +1234,4 @@
$r=new xmlrpcresp(new xmlrpcval( "'Aha said I: '" .
$GLOBALS['HTTP_RAW_POST_DATA'], 'string'));
print $r->serialize();
}
- }
-?>
+ }
\ No newline at end of file
Modified: trunk/xmlrpc.php
===================================================================
--- trunk/xmlrpc.php 2017-05-03 13:31:20 UTC (rev 16681)
+++ trunk/xmlrpc.php 2017-05-03 16:03:25 UTC (rev 16682)
@@ -27,8 +27,8 @@
* @subpackage communication
* @version $Id$
*/
-
+
$GLOBALS['phpgw_info'] = array();
$GLOBALS['phpgw_info']['flags'] = array
@@ -123,7 +123,9 @@
}
else
{
- $request_xml = implode("\r\n", file('php://input'));
+ // $request_xml = implode("\r\n", file('php://input'));
+
+ $request_xml = file_get_contents('php://input');
}
if(!$_domain_info)
@@ -132,7 +134,7 @@
xmlrpc_error(1001,'not a valid domain');
}
- if ( isset($headers['Authorization'])
+ if ( isset($headers['Authorization'])
&& preg_match('/Basic/', $headers['Authorization']) )
{
$tmp = $headers['Authorization'];
@@ -148,6 +150,7 @@
// Find out what method they are calling
// This function is odd, you *NEED* to assign the
results
// to a value, or $method is never returned. (jengo)
+ $method = null;
$null = xmlrpc_decode_request($request_xml, $method);
$GLOBALS['phpgw']->session->xmlrpc_method_called =
$method;
@@ -286,7 +289,7 @@
* Get XMLRPC methods
*
* @param string $method
- * @return array
+ * @return array
*/
function xmlrpc_describe_methods($method)
{
@@ -307,7 +310,7 @@
// and kp3 instead of using HTTP_AUTH features.
// Would be a nice workaround for librarys that don't support it, as its
// not in the XML-RPC spec.
-
+
/**
* XMLRPC call wrapper
*
@@ -314,18 +317,20 @@
* @param string $method_name
* @param array $parameters
* @return unknown
- */
+ */
function xmlrpc_call_wrapper($method_name, $parameters)
{
$a = explode('.',$method_name);
+ $function_name = (string) $a['2'];
+
if (count($parameters) == 0)
{
- $return = $GLOBALS['obj']->$a[2]();
+ $return = $GLOBALS['obj']->$function_name();
}
else if (count($parameters) == 1)
{
- $return = $GLOBALS['obj']->$a[2]($parameters[0]);
+ $return =
$GLOBALS['obj']->$function_name($parameters[0]);
}
else
{
@@ -333,7 +338,7 @@
{
$p[] = '$parameters[' . $i . ']';
}
- eval('$return = $GLOBALS[\'obj\']->$a[2](' .
implode(',',$p) . ');');
+ eval('$return = $GLOBALS[\'obj\']->$function_name(' .
implode(',',$p) . ');');
}
// This needs to be expanded and more fully tested
@@ -348,8 +353,8 @@
}
// The following are common functions used ONLY by XML-RPC
-
-
+
+
/**
* XMLRPC login
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16682] update xmlrpc,
sigurdne <=