import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -34,7 +34,7 @@ require_once 'Zend/XmlRpc/Request.php';
|
||||
* @package Zend_XmlRpc
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Http.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
* @version $Id: Http.php 18443 2009-09-30 13:35:47Z lars $
|
||||
*/
|
||||
class Zend_XmlRpc_Request_Http extends Zend_XmlRpc_Request
|
||||
{
|
||||
@ -61,18 +61,13 @@ class Zend_XmlRpc_Request_Http extends Zend_XmlRpc_Request
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$fh = fopen('php://input', 'r');
|
||||
if (!$fh) {
|
||||
$this->_fault = new Zend_XmlRpc_Server_Exception(630);
|
||||
$xml = @file_get_contents('php://input');
|
||||
if (!$xml) {
|
||||
require_once 'Zend/XmlRpc/Fault.php';
|
||||
$this->_fault = new Zend_XmlRpc_Fault(630);
|
||||
return;
|
||||
}
|
||||
|
||||
$xml = '';
|
||||
while (!feof($fh)) {
|
||||
$xml .= fgets($fh);
|
||||
}
|
||||
fclose($fh);
|
||||
|
||||
$this->_xml = $xml;
|
||||
|
||||
$this->loadXml($xml);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Server
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: System.php 17803 2009-08-24 21:22:58Z matthew $
|
||||
* @version $Id: System.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -38,8 +38,8 @@ class Zend_XmlRpc_Server_System
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Zend_XmlRpc_Server $server
|
||||
*
|
||||
* @param Zend_XmlRpc_Server $server
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Zend_XmlRpc_Server $server)
|
||||
@ -137,7 +137,7 @@ class Zend_XmlRpc_Server_System
|
||||
$request->setMethod($method['methodName']);
|
||||
$request->setParams($method['params']);
|
||||
$response = $this->_server->handle($request);
|
||||
if ($response instanceof Zend_XmlRpc_Fault
|
||||
if ($response instanceof Zend_XmlRpc_Fault
|
||||
|| $response->isFault()
|
||||
) {
|
||||
$fault = $response;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Value.php 17786 2009-08-23 22:26:33Z lars $
|
||||
* @version $Id: Value.php 18443 2009-09-30 13:35:47Z lars $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -73,16 +73,19 @@ abstract class Zend_XmlRpc_Value
|
||||
/**
|
||||
* All the XML-RPC native types
|
||||
*/
|
||||
const XMLRPC_TYPE_I4 = 'i4';
|
||||
const XMLRPC_TYPE_INTEGER = 'int';
|
||||
const XMLRPC_TYPE_DOUBLE = 'double';
|
||||
const XMLRPC_TYPE_BOOLEAN = 'boolean';
|
||||
const XMLRPC_TYPE_STRING = 'string';
|
||||
const XMLRPC_TYPE_DATETIME = 'dateTime.iso8601';
|
||||
const XMLRPC_TYPE_BASE64 = 'base64';
|
||||
const XMLRPC_TYPE_ARRAY = 'array';
|
||||
const XMLRPC_TYPE_STRUCT = 'struct';
|
||||
const XMLRPC_TYPE_NIL = 'nil';
|
||||
const XMLRPC_TYPE_I4 = 'i4';
|
||||
const XMLRPC_TYPE_INTEGER = 'int';
|
||||
const XMLRPC_TYPE_I8 = 'i8';
|
||||
const XMLRPC_TYPE_APACHEI8 = 'ex:i8';
|
||||
const XMLRPC_TYPE_DOUBLE = 'double';
|
||||
const XMLRPC_TYPE_BOOLEAN = 'boolean';
|
||||
const XMLRPC_TYPE_STRING = 'string';
|
||||
const XMLRPC_TYPE_DATETIME = 'dateTime.iso8601';
|
||||
const XMLRPC_TYPE_BASE64 = 'base64';
|
||||
const XMLRPC_TYPE_ARRAY = 'array';
|
||||
const XMLRPC_TYPE_STRUCT = 'struct';
|
||||
const XMLRPC_TYPE_NIL = 'nil';
|
||||
const XMLRPC_TYPE_APACHENIL = 'ex:nil';
|
||||
|
||||
|
||||
/**
|
||||
@ -127,6 +130,10 @@ abstract class Zend_XmlRpc_Value
|
||||
return $this->_as_dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DOMDocument $dom
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _stripXmlDeclaration(DOMDocument $dom)
|
||||
{
|
||||
return preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $dom->saveXML());
|
||||
@ -162,30 +169,47 @@ abstract class Zend_XmlRpc_Value
|
||||
case self::XMLRPC_TYPE_I4:
|
||||
// fall through to the next case
|
||||
case self::XMLRPC_TYPE_INTEGER:
|
||||
require_once 'Zend/XmlRpc/Value/Integer.php';
|
||||
return new Zend_XmlRpc_Value_Integer($value);
|
||||
|
||||
case self::XMLRPC_TYPE_I8:
|
||||
// fall through to the next case
|
||||
case self::XMLRPC_TYPE_APACHEI8:
|
||||
require_once 'Zend/XmlRpc/Value/BigInteger.php';
|
||||
return new Zend_XmlRpc_Value_BigInteger($value);
|
||||
|
||||
case self::XMLRPC_TYPE_DOUBLE:
|
||||
require_once 'Zend/XmlRpc/Value/Double.php';
|
||||
return new Zend_XmlRpc_Value_Double($value);
|
||||
|
||||
case self::XMLRPC_TYPE_BOOLEAN:
|
||||
require_once 'Zend/XmlRpc/Value/Boolean.php';
|
||||
return new Zend_XmlRpc_Value_Boolean($value);
|
||||
|
||||
case self::XMLRPC_TYPE_STRING:
|
||||
require_once 'Zend/XmlRpc/Value/String.php';
|
||||
return new Zend_XmlRpc_Value_String($value);
|
||||
|
||||
case self::XMLRPC_TYPE_BASE64:
|
||||
require_once 'Zend/XmlRpc/Value/Base64.php';
|
||||
return new Zend_XmlRpc_Value_Base64($value);
|
||||
|
||||
case self::XMLRPC_TYPE_NIL:
|
||||
// fall through to the next case
|
||||
case self::XMLRPC_TYPE_APACHENIL:
|
||||
require_once 'Zend/XmlRpc/Value/Nil.php';
|
||||
return new Zend_XmlRpc_Value_Nil();
|
||||
|
||||
case self::XMLRPC_TYPE_DATETIME:
|
||||
require_once 'Zend/XmlRpc/Value/DateTime.php';
|
||||
return new Zend_XmlRpc_Value_DateTime($value);
|
||||
|
||||
case self::XMLRPC_TYPE_ARRAY:
|
||||
require_once 'Zend/XmlRpc/Value/Array.php';
|
||||
return new Zend_XmlRpc_Value_Array($value);
|
||||
|
||||
case self::XMLRPC_TYPE_STRUCT:
|
||||
require_once 'Zend/XmlRpc/Value/Struct.php';
|
||||
return new Zend_XmlRpc_Value_Struct($value);
|
||||
|
||||
default:
|
||||
@ -231,6 +255,10 @@ abstract class Zend_XmlRpc_Value
|
||||
require_once 'Zend/XmlRpc/Value/Integer.php';
|
||||
return new Zend_XmlRpc_Value_Integer($value);
|
||||
|
||||
case 'i8':
|
||||
require_once 'Zend/XmlRpc/Value/BigInteger.php';
|
||||
return new Zend_XmlRpc_Value_BigInteger($value);
|
||||
|
||||
case 'double':
|
||||
require_once 'Zend/XmlRpc/Value/Double.php';
|
||||
return new Zend_XmlRpc_Value_Double($value);
|
||||
@ -267,7 +295,7 @@ abstract class Zend_XmlRpc_Value
|
||||
{
|
||||
if (!$xml instanceof SimpleXMLElement) {
|
||||
try {
|
||||
$xml = @new SimpleXMLElement($xml);
|
||||
$xml = new SimpleXMLElement($xml);
|
||||
} catch (Exception $e) {
|
||||
// The given string is not a valid XML
|
||||
require_once 'Zend/XmlRpc/Value/Exception.php';
|
||||
@ -275,8 +303,22 @@ abstract class Zend_XmlRpc_Value
|
||||
}
|
||||
}
|
||||
|
||||
// Get the key (tag name) and value from the simple xml object and convert the value to an XML-RPC native value
|
||||
$type = null;
|
||||
$value = null;
|
||||
list($type, $value) = each($xml);
|
||||
|
||||
if (!$type and $value === null) {
|
||||
$namespaces = array('ex' => 'http://ws.apache.org/xmlrpc/namespaces/extensions');
|
||||
foreach ($namespaces as $namespaceName => $namespaceUri) {
|
||||
$namespaceXml = $xml->children($namespaceUri);
|
||||
list($type, $value) = each($namespaceXml);
|
||||
if ($type !== null) {
|
||||
$type = $namespaceName . ':' . $type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$type) { // If no type was specified, the default is string
|
||||
$type = self::XMLRPC_TYPE_STRING;
|
||||
}
|
||||
@ -287,30 +329,40 @@ abstract class Zend_XmlRpc_Value
|
||||
// Fall through to the next case
|
||||
case self::XMLRPC_TYPE_INTEGER:
|
||||
require_once 'Zend/XmlRpc/Value/Integer.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Integer($value);
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_Integer($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_APACHEI8:
|
||||
// Fall through to the next case
|
||||
case self::XMLRPC_TYPE_I8:
|
||||
require_once 'Zend/XmlRpc/Value/BigInteger.php';
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_BigInteger($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_DOUBLE:
|
||||
require_once 'Zend/XmlRpc/Value/Double.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Double($value);
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_Double($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_BOOLEAN:
|
||||
require_once 'Zend/XmlRpc/Value/Boolean.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Boolean($value);
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_Boolean($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_STRING:
|
||||
require_once 'Zend/XmlRpc/Value/String.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_String($value);
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_String($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_DATETIME: // The value should already be in a iso8601 format
|
||||
require_once 'Zend/XmlRpc/Value/DateTime.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_DateTime($value);
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_DateTime($value);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_BASE64: // The value should already be base64 encoded
|
||||
require_once 'Zend/XmlRpc/Value/Base64.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Base64($value ,true);
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_Base64($value, true);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_NIL: // The value should always be NULL
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Nil();
|
||||
case self::XMLRPC_TYPE_NIL:
|
||||
// Fall through to the next case
|
||||
case self::XMLRPC_TYPE_APACHENIL:
|
||||
// The value should always be NULL
|
||||
require_once 'Zend/XmlRpc/Value/Nil.php';
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_Nil();
|
||||
break;
|
||||
case self::XMLRPC_TYPE_ARRAY:
|
||||
// PHP 5.2.4 introduced a regression in how empty($xml->value)
|
||||
@ -334,7 +386,7 @@ abstract class Zend_XmlRpc_Value
|
||||
$values[] = self::_xmlStringToNativeXmlRpc($element);
|
||||
}
|
||||
require_once 'Zend/XmlRpc/Value/Array.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Array($values);
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_Array($values);
|
||||
break;
|
||||
case self::XMLRPC_TYPE_STRUCT:
|
||||
$values = array();
|
||||
@ -350,19 +402,22 @@ abstract class Zend_XmlRpc_Value
|
||||
$values[(string)$member->name] = self::_xmlStringToNativeXmlRpc($member->value);
|
||||
}
|
||||
require_once 'Zend/XmlRpc/Value/Struct.php';
|
||||
$xmlrpc_val = new Zend_XmlRpc_Value_Struct($values);
|
||||
$xmlrpcValue = new Zend_XmlRpc_Value_Struct($values);
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/XmlRpc/Value/Exception.php';
|
||||
throw new Zend_XmlRpc_Value_Exception('Value type \''. $type .'\' parsed from the XML string is not a known XML-RPC native type');
|
||||
break;
|
||||
}
|
||||
$xmlrpc_val->_setXML($xml->asXML());
|
||||
$xmlrpcValue->_setXML($xml->asXML());
|
||||
|
||||
return $xmlrpc_val;
|
||||
return $xmlrpcValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $xml
|
||||
* @return void
|
||||
*/
|
||||
private function _setXML($xml)
|
||||
{
|
||||
$this->_as_xml = $xml;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Base64.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
* @version $Id: Base64.php 18443 2009-09-30 13:35:47Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ class Zend_XmlRpc_Value_Base64 extends Zend_XmlRpc_Value_Scalar
|
||||
|
||||
/**
|
||||
* Return the XML code representing the base64-encoded value
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function saveXML()
|
||||
|
65
libs/Zend/XmlRpc/Value/BigInteger.php
Normal file
65
libs/Zend/XmlRpc/Value/BigInteger.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Integer.php 17753 2009-08-22 16:09:37Z lars $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Zend_XmlRpc_Value_Integer
|
||||
*/
|
||||
require_once 'Zend/XmlRpc/Value/Integer.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_XmlRpc
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_XmlRpc_Value_BigInteger extends Zend_XmlRpc_Value_Integer
|
||||
{
|
||||
/**
|
||||
* @var Zend_Crypt_Math_BigInteger
|
||||
*/
|
||||
protected $_integer;
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
require_once 'Zend/Crypt/Math/BigInteger.php';
|
||||
$this->_integer = new Zend_Crypt_Math_BigInteger();
|
||||
$this->_value = $this->_integer->init($this->_value);
|
||||
|
||||
$this->_type = self::XMLRPC_TYPE_I8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return bigint value object
|
||||
*
|
||||
* @return Zend_Crypt_Math_BigInteger
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_integer;
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Double.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
* @version $Id: Double.php 17922 2009-08-31 13:54:04Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -45,7 +45,9 @@ class Zend_XmlRpc_Value_Double extends Zend_XmlRpc_Value_Scalar
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->_type = self::XMLRPC_TYPE_DOUBLE;
|
||||
$this->_value = sprintf('%f',(float)$value); // Make sure this value is float (double) and without the scientific notation
|
||||
$precision = (int)ini_get('precision');
|
||||
$formatString = '%1.' . $precision . 'f';
|
||||
$this->_value = sprintf($formatString, (float)$value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,6 +59,4 @@ class Zend_XmlRpc_Value_Double extends Zend_XmlRpc_Value_Scalar
|
||||
{
|
||||
return (float)$this->_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Integer.php 17759 2009-08-22 21:26:21Z lars $
|
||||
* @version $Id: Integer.php 18443 2009-09-30 13:35:47Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -62,6 +62,4 @@ class Zend_XmlRpc_Value_Integer extends Zend_XmlRpc_Value_Scalar
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Value
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Scalar.php 16208 2009-06-21 19:19:26Z thomas $
|
||||
* @version $Id: Scalar.php 18443 2009-09-30 13:35:47Z lars $
|
||||
*/
|
||||
|
||||
|
||||
@ -57,4 +57,3 @@ abstract class Zend_XmlRpc_Value_Scalar extends Zend_XmlRpc_Value
|
||||
return $this->_as_xml;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user