dedi lib update
This commit is contained in:
		
				
					committed by
					
						 Steffen Schröder
						Steffen Schröder
					
				
			
			
				
	
			
			
			
						parent
						
							9dc3ba395b
						
					
				
				
					commit
					10bbd5383f
				
			| @@ -73,10 +73,12 @@ class GbxRemote | |||||||
| 	private function connect($host, $port) | 	private function connect($host, $port) | ||||||
| 	{ | 	{ | ||||||
| 		$this->socket = @fsockopen($host, $port, $errno, $errstr, $this->timeouts['open']); | 		$this->socket = @fsockopen($host, $port, $errno, $errstr, $this->timeouts['open']); | ||||||
| 		stream_set_write_buffer($this->socket, 0); |  | ||||||
| 		if(!$this->socket) | 		if(!$this->socket) | ||||||
| 			throw new TransportException('Cannot open socket', TransportException::NOT_INITIALIZED); | 			throw new TransportException('Cannot open socket', TransportException::NOT_INITIALIZED); | ||||||
|  |  | ||||||
|  | 		stream_set_write_buffer($this->socket, 0); | ||||||
|  |  | ||||||
| 		// handshake | 		// handshake | ||||||
| 		$header = $this->read(15); | 		$header = $this->read(15); | ||||||
| 		if($header === false) | 		if($header === false) | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ if(extension_loaded('xmlrpc')) | |||||||
| 	{ | 	{ | ||||||
| 		private static $options = array( | 		private static $options = array( | ||||||
| 			'encoding' => 'utf-8', | 			'encoding' => 'utf-8', | ||||||
| 			'escaping' => 'markup', | 			'escaping' => 'cdata', | ||||||
| 			'verbosity' => 'no_white_space' | 			'verbosity' => 'no_white_space' | ||||||
| 		); | 		); | ||||||
|  |  | ||||||
| @@ -61,7 +61,7 @@ else | |||||||
| 		 */ | 		 */ | ||||||
| 		static function encode($method, $args) | 		static function encode($method, $args) | ||||||
| 		{ | 		{ | ||||||
| 			$xml = '<?xml version="1.0" encoding="utf-8"?><methodCall><methodName>'.$method.'</methodName><params>'; | 			$xml = '<?xml version="1.0" encoding="utf-8"?><methodCall><methodName><![CDATA['.$method.']]></methodName><params>'; | ||||||
| 			foreach($args as $arg) | 			foreach($args as $arg) | ||||||
| 				$xml .= '<param><value>'.self::encodeValue($arg).'</value></param>'; | 				$xml .= '<param><value>'.self::encodeValue($arg).'</value></param>'; | ||||||
| 			$xml .= '</params></methodCall>'; | 			$xml .= '</params></methodCall>'; | ||||||
| @@ -77,24 +77,24 @@ else | |||||||
| 			switch(gettype($v)) | 			switch(gettype($v)) | ||||||
| 			{ | 			{ | ||||||
| 				case 'boolean': | 				case 'boolean': | ||||||
| 					return '<boolean>'.((int) $v).'</boolean>'; | 					return '<boolean><![CDATA['.((int) $v).']]></boolean>'; | ||||||
| 				case 'integer': | 				case 'integer': | ||||||
| 					return '<int>'.$v.'</int>'; | 					return '<int><![CDATA['.$v.']]></int>'; | ||||||
| 				case 'double': | 				case 'double': | ||||||
| 					return '<double>'.$v.'</double>'; | 					return '<double><![CDATA['.$v.']]></double>'; | ||||||
| 				case 'string': | 				case 'string': | ||||||
| 					return '<string>'.htmlspecialchars($v).'</string>'; | 					return '<string><![CDATA['.$v.']]></string>'; | ||||||
| 				case 'object': | 				case 'object': | ||||||
| 					if($v instanceof Base64) | 					if($v instanceof Base64) | ||||||
| 						return '<base64>'.base64_encode($v->scalar).'</base64>'; | 						return '<base64><![CDATA['.base64_encode($v->scalar).']]></base64>'; | ||||||
| 					if($v instanceof \DateTime) | 					if($v instanceof \DateTime) | ||||||
| 						return '<dateTime.iso8601>'.$v->format(self::DATE_FORMAT).'</dateTime.iso8601>'; | 						return '<dateTime.iso8601><![CDATA['.$v->format(self::DATE_FORMAT).']]></dateTime.iso8601>'; | ||||||
| 					$v = get_object_vars($v); | 					$v = get_object_vars($v); | ||||||
| 					// fallthrough | 				// fallthrough | ||||||
| 				case 'array': | 				case 'array': | ||||||
| 					$return = ''; | 					$return = ''; | ||||||
| 					// pure array case | 					// pure array case | ||||||
| 					if(array_keys($v) == range(0, count($v) - 1)) | 					if(array_keys($v) === range(0, count($v) - 1)) | ||||||
| 					{ | 					{ | ||||||
| 						foreach($v as $item) | 						foreach($v as $item) | ||||||
| 							$return .= '<value>'.self::encodeValue($item).'</value>'; | 							$return .= '<value>'.self::encodeValue($item).'</value>'; | ||||||
| @@ -102,7 +102,7 @@ else | |||||||
| 					} | 					} | ||||||
| 					// else it's a struct | 					// else it's a struct | ||||||
| 					foreach($v as $name => $value) | 					foreach($v as $name => $value) | ||||||
| 						$return .= '<member><name>'.$name.'</name><value>'.self::encodeValue($value).'</value></member>'; | 						$return .= '<member><name><![CDATA['.$name.']]></name><value>'.self::encodeValue($value).'</value></member>'; | ||||||
| 					return '<struct>'.$return.'</struct>'; | 					return '<struct>'.$return.'</struct>'; | ||||||
| 			} | 			} | ||||||
| 			return ''; | 			return ''; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user