From 0688ac9ad88a03f1c56cfcd9e3c475b83301344d Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 20 Apr 2012 10:25:04 -0400 Subject: Start comment cleanup of libraries --- system/libraries/Xmlrpc.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index fea560c2e..7009deacc 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -104,24 +104,24 @@ class CI_Xmlrpc { ); // Array of Valid Parents for Various XML-RPC elements - $this->valid_parents = array('BOOLEAN' => array('VALUE'), - 'I4' => array('VALUE'), - 'INT' => array('VALUE'), - 'STRING' => array('VALUE'), - 'DOUBLE' => array('VALUE'), - 'DATETIME.ISO8601' => array('VALUE'), - 'BASE64' => array('VALUE'), - 'ARRAY' => array('VALUE'), - 'STRUCT' => array('VALUE'), - 'PARAM' => array('PARAMS'), - 'METHODNAME' => array('METHODCALL'), - 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), - 'MEMBER' => array('STRUCT'), - 'NAME' => array('MEMBER'), - 'DATA' => array('ARRAY'), - 'FAULT' => array('METHODRESPONSE'), - 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT') - ); + $this->valid_parents = array('BOOLEAN' => array('VALUE'), + 'I4' => array('VALUE'), + 'INT' => array('VALUE'), + 'STRING' => array('VALUE'), + 'DOUBLE' => array('VALUE'), + 'DATETIME.ISO8601' => array('VALUE'), + 'BASE64' => array('VALUE'), + 'ARRAY' => array('VALUE'), + 'STRUCT' => array('VALUE'), + 'PARAM' => array('PARAMS'), + 'METHODNAME' => array('METHODCALL'), + 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), + 'MEMBER' => array('STRUCT'), + 'NAME' => array('MEMBER'), + 'DATA' => array('ARRAY'), + 'FAULT' => array('METHODRESPONSE'), + 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT') + ); // XML-RPC Responses -- cgit v1.2.3-24-g4f1b From 306b378525a13d9c5d1a7f0d6d50c2f263f22a04 Mon Sep 17 00:00:00 2001 From: George Petsagourakis Date: Wed, 2 May 2012 20:31:08 +0300 Subject: Fixing some typos in the xmlrpc class. Also, fputs is an alias for fwrite. --- system/libraries/Xmlrpc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 7009deacc..0d2533855 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -436,7 +436,7 @@ class XML_RPC_Client extends CI_Xmlrpc */ public function sendPayload($msg) { - $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstr, $this->timeout); + $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstring, $this->timeout); if ( ! is_resource($fp)) { @@ -458,7 +458,7 @@ class XML_RPC_Client extends CI_Xmlrpc .'Content-Length: '.strlen($msg->payload).$r.$r .$msg->payload; - if ( ! fputs($fp, $op, strlen($op))) + if ( ! fwrite($fp, $op, strlen($op))) { error_log($this->xmlrpcstr['http_error']); return new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']); @@ -1076,7 +1076,7 @@ class XML_RPC_Message extends CI_Xmlrpc // we have an I4/INT // we must check that only 0123456789- are characters here $this->xh[$the_parser]['value'] = preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac']) - ? (int) $this->xh[$the_parset]['ac'] + ? (int) $this->xh[$the_parser]['ac'] : 'ERROR_NON_NUMERIC_FOUND'; } $this->xh[$the_parser]['ac'] = ''; -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Xmlrpc.php | 68 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 0d2533855..6f3542333 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -256,7 +256,7 @@ class CI_Xmlrpc { */ public function set_debug($flag = TRUE) { - $this->debug = ($flag == TRUE); + $this->debug = ($flag === TRUE); } // -------------------------------------------------------------------- @@ -277,7 +277,7 @@ class CI_Xmlrpc { } else { - if (is_array($value[0]) && ($value[1] == 'struct' OR $value[1] == 'array')) + if (is_array($value[0]) && ($value[1] === 'struct' OR $value[1] === 'array')) { while (list($k) = each($value[0])) { @@ -496,7 +496,7 @@ class XML_RPC_Response */ public function __construct($val, $code = 0, $fstr = '') { - if ($code != 0) + if ($code !== 0) { // error $this->errno = $code; @@ -636,11 +636,11 @@ class XML_RPC_Response { $kind = $xmlrpc_val->kindOf(); - if ($kind == 'scalar') + if ($kind === 'scalar') { return $xmlrpc_val->scalarval(); } - elseif ($kind == 'array') + elseif ($kind === 'array') { reset($xmlrpc_val->me); $b = current($xmlrpc_val->me); @@ -652,7 +652,7 @@ class XML_RPC_Response } return $arr; } - elseif ($kind == 'struct') + elseif ($kind === 'struct') { reset($xmlrpc_val->me['struct']); $arr = array(); @@ -680,7 +680,7 @@ class XML_RPC_Response $t = 0; if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $time, $regs)) { - $fnc = ($utc == TRUE) ? 'gmmktime' : 'mktime'; + $fnc = ($utc === TRUE) ? 'gmmktime' : 'mktime'; $t = $fnc($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); } return $t; @@ -873,7 +873,7 @@ class XML_RPC_Message extends CI_Xmlrpc $errstr_v = $v->me['struct']['faultString']; $errno = $errno_v->scalarval(); - if ($errno == 0) + if ($errno === 0) { // FAULT returned, errno needs to reflect that $errno = -1; @@ -921,9 +921,9 @@ class XML_RPC_Message extends CI_Xmlrpc if ($this->xh[$the_parser]['isf'] > 1) return; // Evaluate and check for correct nesting of XML elements - if (count($this->xh[$the_parser]['stack']) == 0) + if (count($this->xh[$the_parser]['stack']) === 0) { - if ($name != 'METHODRESPONSE' && $name != 'METHODCALL') + if ($name !== 'METHODRESPONSE' && $name !== 'METHODCALL') { $this->xh[$the_parser]['isf'] = 2; $this->xh[$the_parser]['isf_reason'] = 'Top level XML-RPC element is missing'; @@ -968,7 +968,7 @@ class XML_RPC_Message extends CI_Xmlrpc case 'DOUBLE': case 'DATETIME.ISO8601': case 'BASE64': - if ($this->xh[$the_parser]['vt'] != 'value') + if ($this->xh[$the_parser]['vt'] !== 'value') { //two data elements inside a value: an error occurred! $this->xh[$the_parser]['isf'] = 2; @@ -1002,7 +1002,7 @@ class XML_RPC_Message extends CI_Xmlrpc // Add current element name to stack, to allow validation of nesting array_unshift($this->xh[$the_parser]['stack'], $name); - $name == 'VALUE' OR $this->xh[$the_parser]['lv'] = 0; + $name === 'VALUE' OR $this->xh[$the_parser]['lv'] = 0; } // -------------------------------------------------------------------- @@ -1045,20 +1045,20 @@ class XML_RPC_Message extends CI_Xmlrpc case 'BASE64': $this->xh[$the_parser]['vt'] = strtolower($name); - if ($name == 'STRING') + if ($name === 'STRING') { $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; } - elseif ($name == 'DATETIME.ISO8601') + elseif ($name === 'DATETIME.ISO8601') { $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; } - elseif ($name == 'BASE64') + elseif ($name === 'BASE64') { $this->xh[$the_parser]['value'] = base64_decode($this->xh[$the_parser]['ac']); } - elseif ($name == 'BOOLEAN') + elseif ($name === 'BOOLEAN') { // Translated BOOLEAN values to TRUE AND FALSE $this->xh[$the_parser]['value'] = (bool) $this->xh[$the_parser]['ac']; @@ -1093,7 +1093,7 @@ class XML_RPC_Message extends CI_Xmlrpc // build the XML-RPC value out of the data received, and substitute it $temp = new XML_RPC_Values($this->xh[$the_parser]['value'], $this->xh[$the_parser]['vt']); - if (count($this->xh[$the_parser]['valuestack']) && $this->xh[$the_parser]['valuestack'][0]['type'] == 'ARRAY') + if (count($this->xh[$the_parser]['valuestack']) && $this->xh[$the_parser]['valuestack'][0]['type'] === 'ARRAY') { // Array $this->xh[$the_parser]['valuestack'][0]['values'][] = $temp; @@ -1151,9 +1151,9 @@ class XML_RPC_Message extends CI_Xmlrpc if ($this->xh[$the_parser]['isf'] > 1) return; // XML Fault found already // If a value has not been found - if ($this->xh[$the_parser]['lv'] != 3) + if ($this->xh[$the_parser]['lv'] !== 3) { - if ($this->xh[$the_parser]['lv'] == 1) + if ($this->xh[$the_parser]['lv'] === 1) { $this->xh[$the_parser]['lv'] = 2; // Found a value } @@ -1204,7 +1204,7 @@ class XML_RPC_Message extends CI_Xmlrpc { // 'bits' is for the MetaWeblog API image bits // @todo - this needs to be made more general purpose - $array[$key] = ($key == 'bits' OR $this->xss_clean == FALSE) ? $array[$key] : $CI->security->xss_clean($array[$key]); + $array[$key] = ($key === 'bits' OR $this->xss_clean === FALSE) ? $array[$key] : $CI->security->xss_clean($array[$key]); } } @@ -1242,11 +1242,11 @@ class XML_RPC_Message extends CI_Xmlrpc { $kind = $param->kindOf(); - if ($kind == 'scalar') + if ($kind === 'scalar') { return $param->scalarval(); } - elseif ($kind == 'array') + elseif ($kind === 'array') { reset($param->me); $b = current($param->me); @@ -1259,7 +1259,7 @@ class XML_RPC_Message extends CI_Xmlrpc return $arr; } - elseif ($kind == 'struct') + elseif ($kind === 'struct') { reset($param->me['struct']); $arr = array(); @@ -1298,19 +1298,19 @@ class XML_RPC_Values extends CI_Xmlrpc { parent::__construct(); - if ($val != -1 OR $type != '') + if ($val !== -1 OR $type !== '') { - $type = $type == '' ? 'string' : $type; + $type = $type === '' ? 'string' : $type; - if ($this->xmlrpcTypes[$type] == 1) + if ($this->xmlrpcTypes[$type] === 1) { $this->addScalar($val,$type); } - elseif ($this->xmlrpcTypes[$type] == 2) + elseif ($this->xmlrpcTypes[$type] === 2) { $this->addArray($val); } - elseif ($this->xmlrpcTypes[$type] == 3) + elseif ($this->xmlrpcTypes[$type] === 3) { $this->addStruct($val); } @@ -1330,24 +1330,24 @@ class XML_RPC_Values extends CI_Xmlrpc { $typeof = $this->xmlrpcTypes[$type]; - if ($this->mytype == 1) + if ($this->mytype === 1) { echo 'XML_RPC_Values: scalar can have only one value
'; return 0; } - if ($typeof != 1) + if ($typeof !== 1) { echo 'XML_RPC_Values: not a scalar type (${typeof})
'; return 0; } - if ($type == $this->xmlrpcBoolean) + if ($type === $this->xmlrpcBoolean) { $val = (int) (strcasecmp($val,'true') === 0 OR $val === 1 OR ($val === TRUE && strcasecmp($val, 'false'))); } - if ($this->mytype == 2) + if ($this->mytype === 2) { // adding to an array here $ar = $this->me['array']; @@ -1374,7 +1374,7 @@ class XML_RPC_Values extends CI_Xmlrpc */ public function addArray($vals) { - if ($this->mytype != 0) + if ($this->mytype !== 0) { echo 'XML_RPC_Values: already initialized as a [' . $this->kindOf() . ']
'; return 0; @@ -1395,7 +1395,7 @@ class XML_RPC_Values extends CI_Xmlrpc */ public function addStruct($vals) { - if ($this->mytype != 0) + if ($this->mytype !== 0) { echo 'XML_RPC_Values: already initialized as a [' . $this->kindOf() . ']
'; return 0; -- cgit v1.2.3-24-g4f1b From 3dad2e714189b992248261c78d780b322b3c73da Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 14 Jun 2012 15:10:56 +0300 Subject: Replace strncmp() usage with strpos() --- system/libraries/Xmlrpc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 6f3542333..eac4ac118 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -778,7 +778,7 @@ class XML_RPC_Message extends CI_Xmlrpc } // Check for HTTP 200 Response - if (strncmp($data, 'HTTP', 4) === 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) + if (strpos($data, 'HTTP') === 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) { $errstr = substr($data, 0, strpos($data, "\n")-1); return new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error'].' ('.$errstr.')'); -- cgit v1.2.3-24-g4f1b From 9dee5350d57523885e9a9f696bff418c1908e72c Mon Sep 17 00:00:00 2001 From: Valio Date: Mon, 2 Jul 2012 10:42:28 +0300 Subject: Added proxy to XML/RPC client --- system/libraries/Xmlrpc.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index eac4ac118..80648c9bd 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -174,7 +174,7 @@ class CI_Xmlrpc { * @param int port * @return void */ - public function server($url, $port = 80) + public function server($url, $port = 80, $proxy=FALSE, $proxy_port = 8080) { if (strpos($url, 'http') !== 0) { @@ -190,7 +190,7 @@ class CI_Xmlrpc { $path .= '?'.$parts['query']; } - $this->client = new XML_RPC_Client($path, $parts['host'], $port); + $this->client = new XML_RPC_Client($path, $parts['host'], $port, $proxy, $proxy_port); } // -------------------------------------------------------------------- @@ -385,6 +385,8 @@ class XML_RPC_Client extends CI_Xmlrpc public $path = ''; public $server = ''; public $port = 80; + public $proxy = FALSE; + public $proxy_port = 8080; public $errno = ''; public $errstring = ''; public $timeout = 5; @@ -398,13 +400,15 @@ class XML_RPC_Client extends CI_Xmlrpc * @param int * @return void */ - public function __construct($path, $server, $port = 80) + public function __construct($path, $server, $port = 80, $proxy = FALSE, $proxy_port = 8080) { parent::__construct(); $this->port = $port; $this->server = $server; $this->path = $path; + $this->proxy = $proxy; + $this->proxy_port = $proxy_port; } // -------------------------------------------------------------------- @@ -436,7 +440,13 @@ class XML_RPC_Client extends CI_Xmlrpc */ public function sendPayload($msg) { - $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstring, $this->timeout); + $server = $this->server; + $port = $this->port; + if ($this->proxy !== FALSE) { + $server = $this->proxy; + $port = $this->proxy_port; + } + $fp = @fsockopen($server, $port, $this->errno, $this->errstring, $this->timeout); if ( ! is_resource($fp)) { -- cgit v1.2.3-24-g4f1b From cfcf34e0bb9fbac5498740711552d04be3b7e63c Mon Sep 17 00:00:00 2001 From: Valentin Sheyretski Date: Mon, 2 Jul 2012 12:04:36 +0300 Subject: Update develop --- system/libraries/Xmlrpc.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 80648c9bd..58389bf32 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -174,7 +174,7 @@ class CI_Xmlrpc { * @param int port * @return void */ - public function server($url, $port = 80, $proxy=FALSE, $proxy_port = 8080) + public function server($url, $port = 80, $proxy = FALSE, $proxy_port = 8080) { if (strpos($url, 'http') !== 0) { @@ -440,12 +440,15 @@ class XML_RPC_Client extends CI_Xmlrpc */ public function sendPayload($msg) { - $server = $this->server; - $port = $this->port; - if ($this->proxy !== FALSE) { + if ($this->proxy === FALSE) + { + $server = $this->server; + $port = $this->port; + } else { $server = $this->proxy; $port = $this->proxy_port; } + $fp = @fsockopen($server, $port, $this->errno, $this->errstring, $this->timeout); if ( ! is_resource($fp)) -- cgit v1.2.3-24-g4f1b From 09217cec2b951a13d5afe7ea8b689085165a9bd5 Mon Sep 17 00:00:00 2001 From: Valentin Sheyretski Date: Mon, 2 Jul 2012 16:27:01 +0300 Subject: Update xmlrpc coding style --- system/libraries/Xmlrpc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 58389bf32..e54030a7c 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -444,7 +444,9 @@ class XML_RPC_Client extends CI_Xmlrpc { $server = $this->server; $port = $this->port; - } else { + } + else + { $server = $this->proxy; $port = $this->proxy_port; } -- cgit v1.2.3-24-g4f1b From c02e7c5d929d17e3448b944e2279a4c6dc338614 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 2 Jul 2012 16:43:43 +0300 Subject: Add changelog entry for pull #1556 --- system/libraries/Xmlrpc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index e54030a7c..cbb91c40a 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -440,7 +440,7 @@ class XML_RPC_Client extends CI_Xmlrpc */ public function sendPayload($msg) { - if ($this->proxy === FALSE) + if ($this->proxy === FALSE) { $server = $this->server; $port = $this->port; -- cgit v1.2.3-24-g4f1b From 3f3f135ed5b47fd87a59d31fb3d1a4c773dcc3b3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 5 Sep 2012 16:39:28 +0300 Subject: Misc. style changes --- system/libraries/Xmlrpc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index cbb91c40a..a8aaa2088 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1359,7 +1359,7 @@ class XML_RPC_Values extends CI_Xmlrpc if ($type === $this->xmlrpcBoolean) { - $val = (int) (strcasecmp($val,'true') === 0 OR $val === 1 OR ($val === TRUE && strcasecmp($val, 'false'))); + $val = (int) (strcasecmp($val, 'true') === 0 OR $val === 1 OR ($val === TRUE && strcasecmp($val, 'false'))); } if ($this->mytype === 2) -- cgit v1.2.3-24-g4f1b From 740480a7513e29e201f56c6481067108a2031509 Mon Sep 17 00:00:00 2001 From: Dimitar Date: Fri, 5 Oct 2012 13:24:59 +0300 Subject: Bug-fix in XML-RPC library $type and $typeof are passed as strings in this function, therefore I took the easy way and simplified the validation. I tested with different requests (strings, numbers ..), no other issues found. --- system/libraries/Xmlrpc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 system/libraries/Xmlrpc.php (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php old mode 100644 new mode 100755 index a8aaa2088..dc5d27f8c --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1317,15 +1317,15 @@ class XML_RPC_Values extends CI_Xmlrpc { $type = $type === '' ? 'string' : $type; - if ($this->xmlrpcTypes[$type] === 1) + if ($this->xmlrpcTypes[$type] == 1) { $this->addScalar($val,$type); } - elseif ($this->xmlrpcTypes[$type] === 2) + elseif ($this->xmlrpcTypes[$type] == 2) { $this->addArray($val); } - elseif ($this->xmlrpcTypes[$type] === 3) + elseif ($this->xmlrpcTypes[$type] == 3) { $this->addStruct($val); } @@ -1351,7 +1351,7 @@ class XML_RPC_Values extends CI_Xmlrpc return 0; } - if ($typeof !== 1) + if ($typeof != 1) { echo 'XML_RPC_Values: not a scalar type (${typeof})
'; return 0; -- cgit v1.2.3-24-g4f1b From 5fd3ae8d33a4f5d3159b86683b9a670e973a63f5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 24 Oct 2012 14:55:35 +0300 Subject: [ci skip] style and phpdoc-related changes (rel #1295) --- system/libraries/Xmlrpc.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index dc5d27f8c..3ed050a2e 100755 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -170,8 +170,10 @@ class CI_Xmlrpc { /** * Parse server URL * - * @param string url - * @param int port + * @param string $url + * @param int $port = 80 + * @param string $proxy = FALSE + * @param int $proxy_port = 8080 * @return void */ public function server($url, $port = 80, $proxy = FALSE, $proxy_port = 8080) @@ -395,9 +397,11 @@ class XML_RPC_Client extends CI_Xmlrpc /** * Constructor * - * @param string - * @param object - * @param int + * @param string $path + * @param object $server + * @param int $port = 80 + * @param string $proxy = FALSE + * @param int $proxy_port = 8080 * @return void */ public function __construct($path, $server, $port = 80, $proxy = FALSE, $proxy_port = 8080) -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/libraries/Xmlrpc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 3ed050a2e..79e6c613f 100755 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1,4 +1,4 @@ - Date: Fri, 2 Nov 2012 00:17:39 +0200 Subject: [ci skip] DocBlocks for Upload and Xmlrpc libraries Partially fixes issue #1295 --- system/libraries/Xmlrpc.php | 369 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 329 insertions(+), 40 deletions(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 79e6c613f..3ef823e29 100755 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -26,6 +26,13 @@ */ defined('BASEPATH') OR exit('No direct script access allowed'); +if ( ! function_exists('xml_parser_create')) +{ + show_error('Your PHP installation does not support XML'); +} + +// ------------------------------------------------------------------------ + /** * XML-RPC request handler class * @@ -35,56 +42,212 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/libraries/xmlrpc.html */ - -if ( ! function_exists('xml_parser_create')) -{ - show_error('Your PHP installation does not support XML'); -} - -// ------------------------------------------------------------------------ - class CI_Xmlrpc { - public $debug = FALSE; // Debugging on or off + /** + * Debug flag + * + * @var bool + */ + public $debug = FALSE; + + /** + * I4 data type + * + * @var string + */ public $xmlrpcI4 = 'i4'; + + /** + * Integer data type + * + * @var string + */ public $xmlrpcInt = 'int'; + + /** + * Boolean data type + * + * @var string + */ public $xmlrpcBoolean = 'boolean'; + + /** + * Double data type + * + * @var string + */ public $xmlrpcDouble = 'double'; + + /** + * String data type + * + * @var string + */ public $xmlrpcString = 'string'; + + /** + * DateTime format + * + * @var string + */ public $xmlrpcDateTime = 'dateTime.iso8601'; + + /** + * Base64 data type + * + * @var string + */ public $xmlrpcBase64 = 'base64'; + + /** + * Array data type + * + * @var string + */ public $xmlrpcArray = 'array'; + + /** + * Struct data type + * + * @var string + */ public $xmlrpcStruct = 'struct'; + /** + * Data types list + * + * @var array + */ public $xmlrpcTypes = array(); + + /** + * Valid parents list + * + * @var array + */ public $valid_parents = array(); - public $xmlrpcerr = array(); // Response numbers - public $xmlrpcstr = array(); // Response strings + /** + * Response error numbers list + * + * @var array + */ + public $xmlrpcerr = array(); + + /** + * Response error messages list + * + * @var string[] + */ + public $xmlrpcstr = array(); + + /** + * Encoding charset + * + * @var string + */ public $xmlrpc_defencoding = 'UTF-8'; + + /** + * XML-RPC client name + * + * @var string + */ public $xmlrpcName = 'XML-RPC for CodeIgniter'; + + /** + * XML-RPC version + * + * @var string + */ public $xmlrpcVersion = '1.1'; - public $xmlrpcerruser = 800; // Start of user errors - public $xmlrpcerrxml = 100; // Start of XML Parse errors - public $xmlrpc_backslash = ''; // formulate backslashes for escaping regexp + /** + * Start of user errors + * + * @var int + */ + public $xmlrpcerruser = 800; + + /** + * Start of XML parse errors + * + * @var int + */ + public $xmlrpcerrxml = 100; + + /** + * Backslash replacement value + * + * @var string + */ + public $xmlrpc_backslash = ''; + + /** + * XML-RPC Client object + * + * @var object + */ public $client; + + /** + * XML-RPC Method name + * + * @var string + */ public $method; + + /** + * XML-RPC Data + * + * @var array + */ public $data; + + /** + * XML-RPC Message + * + * @var string + */ public $message = ''; - public $error = ''; // Error string for request + + /** + * Request error message + * + * @var string + */ + public $error = ''; + + /** + * XML-RPC result object + * + * @var object + */ public $result; + + /** + * XML-RPC Reponse + * + * @var array + */ public $response = array(); // Response from remote server + /** + * XSS Filter flag + * + * @var bool + */ public $xss_clean = TRUE; + // -------------------------------------------------------------------- /** * Constructor * * Initializes property default values * - * @param array + * @param array $config * @return void */ public function __construct($config = array()) @@ -149,7 +312,7 @@ class CI_Xmlrpc { /** * Initialize * - * @param array + * @param array $config * @return void */ public function initialize($config = array()) @@ -172,9 +335,9 @@ class CI_Xmlrpc { * Parse server URL * * @param string $url - * @param int $port = 80 - * @param string $proxy = FALSE - * @param int $proxy_port = 8080 + * @param int $port + * @param string $proxy + * @param int $proxy_port * @return void */ public function server($url, $port = 80, $proxy = FALSE, $proxy_port = 8080) @@ -201,7 +364,7 @@ class CI_Xmlrpc { /** * Set Timeout * - * @param int seconds + * @param int $seconds * @return void */ public function timeout($seconds = 5) @@ -217,7 +380,7 @@ class CI_Xmlrpc { /** * Set Methods * - * @param string method name + * @param string $function Method name * @return void */ public function method($function) @@ -230,7 +393,7 @@ class CI_Xmlrpc { /** * Take Array of Data and Create Objects * - * @param array + * @param array $incoming * @return void */ public function request($incoming) @@ -254,7 +417,7 @@ class CI_Xmlrpc { /** * Set Debug * - * @param bool + * @param bool $flag * @return void */ public function set_debug($flag = TRUE) @@ -267,7 +430,7 @@ class CI_Xmlrpc { /** * Values Parsing * - * @param mixed + * @param mixed $value * @return object */ public function values_parsing($value) @@ -350,8 +513,8 @@ class CI_Xmlrpc { /** * Sends an Error Message for Server Request * - * @param int - * @param string + * @param int $number + * @param string $message * @return object */ public function send_error_message($number, $message) @@ -364,7 +527,7 @@ class CI_Xmlrpc { /** * Send Response for Server Request * - * @param array + * @param array $response * @return object */ public function send_response($response) @@ -385,24 +548,79 @@ class CI_Xmlrpc { */ class XML_RPC_Client extends CI_Xmlrpc { + /** + * Path + * + * @var string + */ public $path = ''; + + /** + * Server hostname + * + * @var string + */ public $server = ''; + + /** + * Server port + * + * @var int + */ public $port = 80; + + /** + * Proxy hostname + * + * @var string + */ public $proxy = FALSE; + + /** + * Proxy port + * + * @var int + */ public $proxy_port = 8080; + + /** + * Error number + * + * @var string + */ public $errno = ''; + + /** + * Error message + * + * @var string + */ public $errstring = ''; + + /** + * Timeout in seconds + * + * @var int + */ public $timeout = 5; + + /** + * No Multicall flag + * + * @var bool + */ public $no_multicall = FALSE; + // -------------------------------------------------------------------- + /** * Constructor * * @param string $path * @param object $server - * @param int $port = 80 - * @param string $proxy = FALSE - * @param int $proxy_port = 8080 + * @param int $port + * @param string $proxy + * @param int $proxy_port * @return void */ public function __construct($path, $server, $port = 80, $proxy = FALSE, $proxy_port = 8080) @@ -421,7 +639,7 @@ class XML_RPC_Client extends CI_Xmlrpc /** * Send message * - * @param mixed + * @param mixed $msg * @return object */ public function send($msg) @@ -440,7 +658,7 @@ class XML_RPC_Client extends CI_Xmlrpc /** * Send payload * - * @param object + * @param object $msg * @return object */ public function sendPayload($msg) @@ -500,18 +718,50 @@ class XML_RPC_Client extends CI_Xmlrpc */ class XML_RPC_Response { + + /** + * Value + * + * @var mixed + */ public $val = 0; + + /** + * Error number + * + * @var int + */ public $errno = 0; + + /** + * Error message + * + * @var string + */ public $errstr = ''; + + /** + * Headers list + * + * @var array + */ public $headers = array(); + + /** + * XSS Filter flag + * + * @var bool + */ public $xss_clean = TRUE; + // -------------------------------------------------------------------- + /** * Constructor * - * @param mixed - * @param int - * @param string + * @param mixed $val + * @param int $code + * @param string $fstr * @return void */ public function __construct($val, $code = 0, $fstr = '') @@ -717,16 +967,42 @@ class XML_RPC_Response */ class XML_RPC_Message extends CI_Xmlrpc { + + /** + * Payload + * + * @var string + */ public $payload; + + /** + * Method name + * + * @var string + */ public $method_name; + + /** + * Parameter list + * + * @var array + */ public $params = array(); + + /** + * XH? + * + * @var array + */ public $xh = array(); + // -------------------------------------------------------------------- + /** * Constructor * - * @param string method name - * @param array + * @param string $method + * @param array $pars * @return void */ public function __construct($method, $pars = FALSE) @@ -1304,14 +1580,27 @@ class XML_RPC_Message extends CI_Xmlrpc */ class XML_RPC_Values extends CI_Xmlrpc { + /** + * Value data + * + * @var array + */ public $me = array(); + + /** + * Value type + * + * @var int + */ public $mytype = 0; + // -------------------------------------------------------------------- + /** * Constructor * - * @param mixed - * @param string + * @param mixed $val + * @param string $type * @return void */ public function __construct($val = -1, $type = '') -- cgit v1.2.3-24-g4f1b From 2eaeee5aa3971932e58ffac48554e554d799249f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 21 Nov 2012 14:31:26 +0200 Subject: Change fs permissions and add some missing index.html files (#2017) --- system/libraries/Xmlrpc.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 system/libraries/Xmlrpc.php (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php old mode 100755 new mode 100644 -- cgit v1.2.3-24-g4f1b From b497d2b70af664caff50c54117d113e3fc692967 Mon Sep 17 00:00:00 2001 From: vkeranov Date: Fri, 23 Nov 2012 23:27:33 +0200 Subject: Minor changes to Xmlrpc.php --- system/libraries/Xmlrpc.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'system/libraries/Xmlrpc.php') diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 3ef823e29..529089914 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -231,7 +231,7 @@ class CI_Xmlrpc { * * @var array */ - public $response = array(); // Response from remote server + public $response = array(); // Response from remote server /** * XSS Filter flag @@ -265,7 +265,7 @@ class CI_Xmlrpc { $this->xmlrpcBase64 => '1', $this->xmlrpcArray => '2', $this->xmlrpcStruct => '3' - ); + ); // Array of Valid Parents for Various XML-RPC elements $this->valid_parents = array('BOOLEAN' => array('VALUE'), @@ -285,14 +285,13 @@ class CI_Xmlrpc { 'DATA' => array('ARRAY'), 'FAULT' => array('METHODRESPONSE'), 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT') - ); - + ); // XML-RPC Responses $this->xmlrpcerr['unknown_method'] = '1'; $this->xmlrpcstr['unknown_method'] = 'This is not a known method for this XML-RPC Server'; $this->xmlrpcerr['invalid_return'] = '2'; - $this->xmlrpcstr['invalid_return'] = 'The XML data received was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.'; + $this->xmlrpcstr['invalid_return'] = 'The XML data received was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.'; $this->xmlrpcerr['incorrect_params'] = '3'; $this->xmlrpcstr['incorrect_params'] = 'Incorrect parameters were passed to method'; $this->xmlrpcerr['introspect_unknown'] = '4'; @@ -300,7 +299,7 @@ class CI_Xmlrpc { $this->xmlrpcerr['http_error'] = '5'; $this->xmlrpcstr['http_error'] = "Did not receive a '200 OK' response from remote server."; $this->xmlrpcerr['no_data'] = '6'; - $this->xmlrpcstr['no_data'] ='No data received from server.'; + $this->xmlrpcstr['no_data'] = 'No data received from server.'; $this->initialize($config); @@ -946,7 +945,7 @@ class XML_RPC_Response */ public function iso8601_decode($time, $utc = FALSE) { - // return a time in the localtime, or UTC + // Return a time in the localtime, or UTC $t = 0; if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $time, $regs)) { @@ -1081,7 +1080,7 @@ class XML_RPC_Message extends CI_Xmlrpc } //------------------------------------- - // Create and Set Up XML Parser + // Create and Set Up XML Parser //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); @@ -1119,7 +1118,7 @@ class XML_RPC_Message extends CI_Xmlrpc $errstr = sprintf('XML error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)); - //error_log($errstr); + $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return']); xml_parser_free($parser); return $r; @@ -1230,7 +1229,7 @@ class XML_RPC_Message extends CI_Xmlrpc elseif ( ! in_array($this->xh[$the_parser]['stack'][0], $this->valid_parents[$name], TRUE)) { $this->xh[$the_parser]['isf'] = 2; - $this->xh[$the_parser]['isf_reason'] = 'XML-RPC element $name cannot be child of '.$this->xh[$the_parser]['stack'][0]; + $this->xh[$the_parser]['isf_reason'] = 'XML-RPC element '.$name.' cannot be child of '.$this->xh[$the_parser]['stack'][0]; return; } @@ -1268,7 +1267,7 @@ class XML_RPC_Message extends CI_Xmlrpc { //two data elements inside a value: an error occurred! $this->xh[$the_parser]['isf'] = 2; - $this->xh[$the_parser]['isf_reason'] = "'Twas a ".$name.' element following a ' + $this->xh[$the_parser]['isf_reason'] = 'There is a '.$name.' element following a ' .$this->xh[$the_parser]['vt'].' element inside a single value'; return; } @@ -1380,7 +1379,7 @@ class XML_RPC_Message extends CI_Xmlrpc break; case 'VALUE': // This if() detects if no scalar was inside - if ($this->xh[$the_parser]['vt']=='value') + if ($this->xh[$the_parser]['vt'] == 'value') { $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; $this->xh[$the_parser]['vt'] = $this->xmlrpcString; @@ -1613,7 +1612,7 @@ class XML_RPC_Values extends CI_Xmlrpc if ($this->xmlrpcTypes[$type] == 1) { - $this->addScalar($val,$type); + $this->addScalar($val, $type); } elseif ($this->xmlrpcTypes[$type] == 2) { -- cgit v1.2.3-24-g4f1b