Permalink
Browse files

Merge remote-tracking branch 'upstream/develop' into unit-tests

  • Loading branch information...
2 parents a8a2e33 + da44bac commit 002b8fac833c53ab431c72090b82cc2e7de396f2 @toopay toopay committed Mar 28, 2012

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -159,22 +159,6 @@ public function reconnect()
// --------------------------------------------------------------------
/**
- * Select the database
- *
- * @return resource
- */
- public function db_select()
- {
- // In CUBRID there is no need to select a database as the database
- // is chosen at the connection time.
- // So, to determine if the database is "selected", all we have to
- // do is ping the server and return that value.
- return cubrid_ping($this->conn_id);
- }
-
- // --------------------------------------------------------------------
-
- /**
* Database version number
*
* @return string
@@ -85,19 +85,6 @@ public function db_pconnect()
// --------------------------------------------------------------------
/**
- * Select the database
- *
- * @return bool
- */
- public function db_select()
- {
- // Connection selects the database
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Database version number
*
* @return string
@@ -186,19 +186,6 @@ public function db_pconnect()
// --------------------------------------------------------------------
/**
- * Select the database
- *
- * @return resource
- */
- public function db_select()
- {
- // Not in Oracle - schemas are actually usernames
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Database version number
*
* @return string
@@ -95,19 +95,6 @@ public function db_pconnect()
// --------------------------------------------------------------------
/**
- * Select the database
- *
- * @return resource
- */
- public function db_select()
- {
- // Not needed for ODBC
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Execute the query
*
* @param string an SQL query
@@ -247,19 +247,6 @@ public function pdo_connect()
// --------------------------------------------------------------------
/**
- * Select the database
- *
- * @return resource
- */
- public function db_select()
- {
- // Not needed for PDO
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Database version number
*
* @return string
@@ -162,19 +162,6 @@ public function reconnect()
// --------------------------------------------------------------------
/**
- * Select the database
- *
- * @return resource
- */
- public function db_select()
- {
- // Not needed for Postgre so we'll return TRUE
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Set client character set
*
* @param string
@@ -106,18 +106,6 @@ public function db_pconnect()
// --------------------------------------------------------------------
/**
- * Select the database
- *
- * @return resource
- */
- public function db_select()
- {
- return TRUE;
- }
-
- // --------------------------------------------------------------------
-
- /**
* Database version number
*
* @return string
@@ -136,10 +136,9 @@ public function __construct($config = array())
$this->initialize($config);
- log_message('debug', "XML-RPC Class Initialized");
+ log_message('debug', 'XML-RPC Class Initialized');
}
-
//-------------------------------------
// Initialize Prefs
//-------------------------------------
@@ -163,7 +162,7 @@ public function initialize($config = array())
// Take URL and parse it
//-------------------------------------
- public function server($url, $port=80)
+ public function server($url, $port = 80)
{
if (strpos($url, 'http') !== 0)
{
@@ -172,9 +171,9 @@ public function server($url, $port=80)
$parts = parse_url($url);
- $path = ( ! isset($parts['path'])) ? '/' : $parts['path'];
+ $path = isset($parts['path']) ? $parts['path'] : '/';
- if (isset($parts['query']) && $parts['query'] != '')
+ if ( ! empty($parts['query']))
{
$path .= '?'.$parts['query'];
}
@@ -244,7 +243,7 @@ public function values_parsing($value, $return = FALSE)
{
if (is_array($value) && array_key_exists(0, $value))
{
- if ( ! isset($value[1]) OR ( ! isset($this->xmlrpcTypes[$value[1]])))
+ if ( ! isset($value[1], $this->xmlrpcTypes[$value[1]]))
{
$temp = new XML_RPC_Values($value[0], (is_array($value[0]) ? 'array' : 'string'));
}
@@ -337,7 +336,6 @@ public function send_response($response)
} // END XML_RPC Class
-
/**
* XML-RPC Client class
*
@@ -355,7 +353,7 @@ class XML_RPC_Client extends CI_Xmlrpc
public $timeout = 5;
public $no_multicall = FALSE;
- public function __construct($path, $server, $port=80)
+ public function __construct($path, $server, $port = 80)
{
parent::__construct();
@@ -383,7 +381,7 @@ public function sendPayload($msg)
if ( ! is_resource($fp))
{
error_log($this->xmlrpcstr['http_error']);
- $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'],$this->xmlrpcstr['http_error']);
+ $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']);
return $r;
}
@@ -394,12 +392,12 @@ public function sendPayload($msg)
}
$r = "\r\n";
- $op = "POST {$this->path} HTTP/1.0$r"
- . "Host: {$this->server}$r"
- . "Content-Type: text/xml$r"
- . "User-Agent: {$this->xmlrpcName}$r"
- . "Content-Length: ".strlen($msg->payload)."$r$r"
- . $msg->payload;
+ $op = 'POST '.$this->path.' HTTP/1.0'.$r
+ .'Host: '.$this->server.$r
+ .'Content-Type: text/xml'.$r
+ .'User-Agent: '.$this->xmlrpcName.$r
+ .'Content-Length: '.strlen($msg->payload).$r.$r
+ .$msg->payload;
if ( ! fputs($fp, $op, strlen($op)))
@@ -446,10 +444,10 @@ public function __construct($val, $code = 0, $fstr = '')
$this->errstr = htmlspecialchars($fstr, ENT_XML1 | ENT_NOQUOTES, 'UTF-8');
}
}
- else if ( ! is_object($val))
+ elseif ( ! is_object($val))
{
// programmer error, not an object
- error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response. Defaulting to empty value.");
+ error_log("Invalid type '".gettype($val)."' (value: ".$val.') passed to XML_RPC_Response. Defaulting to empty value.');
$this->val = new XML_RPC_Values();
}
else
@@ -532,8 +530,6 @@ public function decode($array = FALSE)
return $result;
}
-
-
//-------------------------------------
// XML-RPC Object to PHP Types
//-------------------------------------
@@ -571,7 +567,6 @@ public function xmlrpc_decoder($xmlrpc_val)
}
}
-
//-------------------------------------
// ISO-8601 time to server or UTC time
//-------------------------------------
@@ -605,7 +600,7 @@ class XML_RPC_Message extends CI_Xmlrpc
public $params = array();
public $xh = array();
- public function __construct($method, $pars=0)
+ public function __construct($method, $pars = 0)
{
parent::__construct();
@@ -681,7 +676,7 @@ public function parseResponse($fp)
if (strncmp($data, 'HTTP', 4) === 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data))
{
$errstr= substr($data, 0, strpos($data, "\n")-1);
- $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']. ' (' . $errstr . ')');
+ $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error'].' (' . $errstr . ')');
return $r;
}
@@ -706,7 +701,6 @@ public function parseResponse($fp)
xml_set_character_data_handler($parser, 'character_data');
//xml_set_default_handler($parser, 'default_handler');
-
//-------------------------------------
// GET HEADERS
//-------------------------------------
@@ -765,14 +759,14 @@ public function parseResponse($fp)
if ($this->debug === TRUE)
{
- echo "<pre>";
+ echo '<pre>';
if (count($this->xh[$parser]['headers'] > 0))
{
echo "---HEADERS---\n";
foreach ($this->xh[$parser]['headers'] as $header)
{
- echo "$header\n";
+ echo $header."\n";
}
echo "---END HEADERS---\n\n";
}
@@ -850,7 +844,7 @@ public function open_tag($the_parser, $name, $attrs)
if ( ! 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;
}
}
@@ -861,8 +855,7 @@ public function open_tag($the_parser, $name, $attrs)
case 'ARRAY':
// Creates array for child elements
- $cur_val = array('value' => array(),
- 'type' => $name);
+ $cur_val = array('value' => array(), 'type' => $name);
array_unshift($this->xh[$the_parser]['valuestack'], $cur_val);
break;
@@ -925,7 +918,6 @@ public function open_tag($the_parser, $name, $attrs)
}
// END
-
//-------------------------------------
// End Element Handler
//-------------------------------------
@@ -996,7 +988,7 @@ public function closing_tag($the_parser, $name)
}
else
{
- $this->xh[$the_parser]['value'] = (double)$this->xh[$the_parser]['ac'];
+ $this->xh[$the_parser]['value'] = (float) $this->xh[$the_parser]['ac'];
}
}
else
@@ -1145,7 +1137,6 @@ public function output_parameters($array = FALSE)
return $parameters;
}
-
public function decode_message($param)
{
$kind = $param->kindOf();
@@ -1237,7 +1228,7 @@ public function addScalar($val, $type = 'string')
if ($type == $this->xmlrpcBoolean)
{
- $val = (strcasecmp($val,'true') === 0 OR $val == 1 OR ($val == true && strcasecmp($val, 'false'))) ? 1 : 0;
+ $val = (strcasecmp($val,'true') === 0 OR $val == 1 OR ($val == TRUE && strcasecmp($val, 'false'))) ? 1 : 0;
}
if ($this->mytype == 2)
@@ -1383,4 +1374,4 @@ public function iso8601_encode($time, $utc = 0)
// END XML_RPC_Values Class
/* End of file Xmlrpc.php */
-/* Location: ./system/libraries/Xmlrpc.php */
+/* Location: ./system/libraries/Xmlrpc.php */

0 comments on commit 002b8fa

Please sign in to comment.