From 49eb6e38061d744f4a35b78082dce49fa35f79c8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 15 Jan 2010 19:50:13 +0100 Subject: some more coding standard compliance updates --- inc/IXR_Library.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'inc/IXR_Library.php') diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index 2752e31f2..25d1066b0 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -300,7 +300,7 @@ class IXR_Server { if (!$data) { global $HTTP_RAW_POST_DATA; if (!$HTTP_RAW_POST_DATA) { - die('XML-RPC server accepts POST requests only.'); + die('XML-RPC server accepts POST requests only.'); } $data = $HTTP_RAW_POST_DATA; } @@ -342,14 +342,13 @@ EOD; $method = $this->callbacks[$methodname]; // Perform the callback and send the response -# Removed for DokuWiki to have a more consistent interface -# if (count($args) == 1) { -# // If only one paramater just send that instead of the whole array -# $args = $args[0]; -# } + # Removed for DokuWiki to have a more consistent interface + # if (count($args) == 1) { + # // If only one paramater just send that instead of the whole array + # $args = $args[0]; + # } - -# Adjusted for DokuWiki to use call_user_func_array + # Adjusted for DokuWiki to use call_user_func_array // args need to be an array $args = (array) $args; -- cgit v1.2.3 From 0af14a6e25ba35e88d96762bc73325838868e3fe Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 1 Feb 2010 15:38:41 +0100 Subject: removed more unneeded require_once() calls --- inc/IXR_Library.php | 1 - 1 file changed, 1 deletion(-) (limited to 'inc/IXR_Library.php') diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index 25d1066b0..afa496aed 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -364,7 +364,6 @@ EOD; #$result = $this->$method($args); $result = call_user_func_array(array(&$this,$method),$args); } elseif (substr($method, 0, 7) == 'plugin:') { - require_once(DOKU_INC.'inc/pluginutils.php'); list($pluginname, $callback) = explode(':', substr($method, 7), 2); if(!plugin_isdisabled($pluginname)) { $plugin = plugin_load('action', $pluginname); -- cgit v1.2.3 From cf5b435169f81ea7da106ced2c6401bf83ac199f Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 22 Mar 2010 23:37:31 +0100 Subject: Replace vertical tabs befor parsing XML in XMLRPC It seems that the 0x0B Vertical Tab character breaks the PHP XML parser. This workaround replaces the char with a space before parsing. Not ideal but good enough for now. --- inc/IXR_Library.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/IXR_Library.php') diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index afa496aed..4f8eb31c1 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -150,6 +150,7 @@ class IXR_Message { $this->message = str_replace('&', '&', $this->message); $this->message = str_replace(''', ''', $this->message); $this->message = str_replace('"', '"', $this->message); + $this->message = str_replace("\x0b", ' ', $this->message); //vertical tab if (trim($this->message) == '') { return false; } -- cgit v1.2.3 From eb2cef78be976d583e9089dfc7de0d93d8476f3d Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Tue, 1 Jun 2010 10:55:36 +0200 Subject: bugfix empty strings in untyped value tag. according to the specs a value without a type is recognised as string. This patch handles empty value tags the right way as empty String. --- inc/IXR_Library.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'inc/IXR_Library.php') diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index 4f8eb31c1..9c270b1ce 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -225,11 +225,9 @@ class IXR_Message { break; case 'value': // "If no type is indicated, the type is string." - if (trim($this->_currentTagContents) != '') { - $value = (string)$this->_currentTagContents; - $this->_currentTagContents = ''; - $valueFlag = true; - } + $value = (string)$this->_currentTagContents; + $this->_currentTagContents = ''; + $valueFlag = true; break; case 'boolean': $value = (boolean)trim($this->_currentTagContents); -- cgit v1.2.3 From ccee78424602b02309b2c81b3fa932bbcce1a03b Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Thu, 27 May 2010 09:31:22 +0200 Subject: Changed date format to the xmlrpc spec date format --- inc/IXR_Library.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/IXR_Library.php') diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index 9c270b1ce..b82952d74 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -623,7 +623,7 @@ class IXR_Date { $this->second = substr($iso, 17, 2); } function getIso() { - return $this->year.'-'.$this->month.'-'.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; + return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; } function getXml() { return ''.$this->getIso().''; -- cgit v1.2.3 From 5ab78106b0f9170d5e4930d0901862e4373a686f Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 9 Jun 2010 21:43:10 +0200 Subject: Make XMLRPC date parsing more flexible FS#1966 Since the specs aren't 100% clear, dates might be passed in different formats by various XMLRPC clients. This patch makes date parsing a bit more flexible. Unit tests included. --- inc/IXR_Library.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'inc/IXR_Library.php') diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index b82952d74..2fb7dfe68 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -615,12 +615,14 @@ class IXR_Date { $this->second = gmdate('s', $timestamp); } function parseIso($iso) { - $this->year = substr($iso, 0, 4); - $this->month = substr($iso, 5, 2); - $this->day = substr($iso, 8, 2); - $this->hour = substr($iso, 11, 2); - $this->minute = substr($iso, 14, 2); - $this->second = substr($iso, 17, 2); + if(preg_match('/^(\d\d\d\d)-?(\d\d)-?(\d\d)([T ](\d\d):(\d\d)(:(\d\d))?)?/',$iso,$match)){ + $this->year = (int) $match[1]; + $this->month = (int) $match[2]; + $this->day = (int) $match[3]; + $this->hour = (int) $match[5]; + $this->minute = (int) $match[6]; + $this->second = (int) $match[8]; + } } function getIso() { return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; -- cgit v1.2.3 From 8a52cdf35af9a714e9b330fa0aace6606b071c89 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 1 Jul 2010 19:43:47 +0200 Subject: XML-RPC fix for untyped string values FS#1993 includes unit tests. Extensions welcome. --- inc/IXR_Library.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'inc/IXR_Library.php') diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index 2fb7dfe68..c7f83a6d6 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -136,6 +136,7 @@ class IXR_Message { var $_value; var $_currentTag; var $_currentTagContents; + var $_lastseen; // The XML parser var $_parser; function IXR_Message ($message) { @@ -194,6 +195,7 @@ class IXR_Message { $this->_arraystructs[] = array(); break; } + $this->_lastseen = $tag; } function cdata($parser, $cdata) { $this->_currentTagContents .= $cdata; @@ -225,9 +227,11 @@ class IXR_Message { break; case 'value': // "If no type is indicated, the type is string." - $value = (string)$this->_currentTagContents; - $this->_currentTagContents = ''; - $valueFlag = true; + if($this->_lastseen == 'value'){ + $value = (string)$this->_currentTagContents; + $this->_currentTagContents = ''; + $valueFlag = true; + } break; case 'boolean': $value = (boolean)trim($this->_currentTagContents); @@ -278,6 +282,7 @@ class IXR_Message { $this->params[] = $value; } } + $this->_lastseen = $tag; } } -- cgit v1.2.3