Changeset 2622
- Timestamp:
- 06/07/2005 07:39:39 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/class-IXR.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-IXR.php
r2139 r2622 1 1 <?php 2 3 2 /* 4 IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002 5 Version 1.62WP - Simon Willison, 11th July 2003 (htmlentities -> htmlspecialchars) 6 ^^^^^^ (We've made some changes) 3 IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002-2005 4 Version 1.7 (beta) - Simon Willison, 23rd May 2005 7 5 Site: http://scripts.incutio.com/xmlrpc/ 8 6 Manual: http://scripts.incutio.com/xmlrpc/manual.php 9 7 Made available under the BSD License: http://www.opensource.org/licenses/bsd-license.php 10 8 */ 11 12 9 13 10 class IXR_Value { … … 91 88 $return = '<struct>'."\n"; 92 89 foreach ($this->data as $name => $value) { 90 $name = htmlspecialchars($name); 93 91 $return .= " <member><name>$name</name><value>"; 94 92 $return .= $value->getXml()."</value></member>\n"; … … 166 164 } 167 165 function tag_open($parser, $tag, $attr) { 166 $this->_currentTagContents = ''; 168 167 $this->currentTag = $tag; 169 168 switch($tag) { … … 192 191 case 'int': 193 192 case 'i4': 194 $value = (int)trim($this->_currentTagContents); 195 $this->_currentTagContents = ''; 193 $value = (int) trim($this->_currentTagContents); 196 194 $valueFlag = true; 197 195 break; 198 196 case 'double': 199 $value = (double)trim($this->_currentTagContents); 200 $this->_currentTagContents = ''; 197 $value = (double) trim($this->_currentTagContents); 201 198 $valueFlag = true; 202 199 break; 203 200 case 'string': 204 $value = (string)trim($this->_currentTagContents); 205 $this->_currentTagContents = ''; 201 $value = $this->_currentTagContents; 206 202 $valueFlag = true; 207 203 break; … … 209 205 $value = new IXR_Date(trim($this->_currentTagContents)); 210 206 // $value = $iso->getTimestamp(); 211 $this->_currentTagContents = '';212 207 $valueFlag = true; 213 208 break; … … 216 211 if (trim($this->_currentTagContents) != '') { 217 212 $value = (string)$this->_currentTagContents; 218 $this->_currentTagContents = '';219 213 $valueFlag = true; 220 214 } 221 215 break; 222 216 case 'boolean': 223 $value = (boolean)trim($this->_currentTagContents); 224 $this->_currentTagContents = ''; 217 $value = (boolean) trim($this->_currentTagContents); 225 218 $valueFlag = true; 226 219 break; 227 220 case 'base64': 228 $value = base64_decode( trim($this->_currentTagContents) ); 229 $this->_currentTagContents = ''; 221 $value = base64_decode( trim( $this->_currentTagContents ) ); 230 222 $valueFlag = true; 231 223 break; … … 242 234 case 'name': 243 235 $this->_currentStructName[] = trim($this->_currentTagContents); 244 $this->_currentTagContents = '';245 236 break; 246 237 case 'methodName': 247 238 $this->methodName = trim($this->_currentTagContents); 248 $this->_currentTagContents = '';249 239 break; 250 240 } 251 241 if ($valueFlag) { 252 /*253 if (!is_array($value) && !is_object($value)) {254 $value = trim($value);255 }256 */257 242 if (count($this->_arraystructs) > 0) { 258 243 // Add value to struct or array … … 269 254 } 270 255 } 256 $this->_currentTagContents = ''; 271 257 } 272 258 } … … 470 456 var $useragent; 471 457 var $response; 472 var $timeout;473 var $vendor = '';474 458 var $message = false; 475 459 var $debug = false; 460 var $timeout; 476 461 // Storage place for an error message 477 462 var $error = false; 478 function IXR_Client($server, $path = false, $port = 80, $timeout = 30, $vendor = '') {463 function IXR_Client($server, $path = false, $port = 80, $timeout = false) { 479 464 if (!$path) { 480 465 // Assume we have been given a URL instead … … 491 476 $this->path = $path; 492 477 $this->port = $port; 493 $this->timeout = $timeout;494 }495 $this->useragent = 'The Incutio XML-RPC PHP Library';478 } 479 $this->useragent = 'Incutio XML-RPC'; 480 $this->timeout = $timeout; 496 481 } 497 482 function query() { … … 512 497 echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n"; 513 498 } 514 $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout); 499 if ($this->timeout) { 500 $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout); 501 } else { 502 $fp = @fsockopen($this->server, $this->port, $errno, $errstr); 503 } 515 504 if (!$fp) { 516 $this->error = new IXR_Error(-32300, 'transport error - could not open socket');505 $this->error = new IXR_Error(-32300, "transport error - could not open socket: $errno $errstr"); 517 506 return false; 518 507 } … … 611 600 var $minute; 612 601 var $second; 613 var $timezone;614 602 function IXR_Date($time) { 615 603 // $time can be a PHP timestamp or an ISO one … … 622 610 function parseTimestamp($timestamp) { 623 611 $this->year = date('Y', $timestamp); 624 $this->month = date(' Y', $timestamp);625 $this->day = date(' Y', $timestamp);612 $this->month = date('m', $timestamp); 613 $this->day = date('d', $timestamp); 626 614 $this->hour = date('H', $timestamp); 627 615 $this->minute = date('i', $timestamp); … … 638 626 } 639 627 function getIso() { 640 return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second .$this->timezone;628 return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; 641 629 } 642 630 function getXml() { … … 714 702 // Check the number of arguments 715 703 if (count($args) != count($signature)) { 716 // print 'Num of args: '.count($args).' Num in signature: '.count($signature);717 704 return new IXR_Error(-32602, 'server error. wrong number of method parameters'); 718 705 }
Note: See TracChangeset
for help on using the changeset viewer.