summaryrefslogtreecommitdiffstats
path: root/etc/inc/xmlrpc_client.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-07-12 19:57:42 -0400
committerjim-p <jimp@pfsense.org>2011-07-12 19:57:42 -0400
commit8b6313a4d3eb1895b6c855436a50606cc7691ad4 (patch)
tree97784c2235366f00f42961dd4557e82fadf1ce8c /etc/inc/xmlrpc_client.inc
parent13b9dba9aae25edf62d6cd58c7446329b0dd913c (diff)
parentfd3e19f3bf9499b944263c0acaeaa6446260f197 (diff)
downloadpfsense-8b6313a4d3eb1895b6c855436a50606cc7691ad4.zip
pfsense-8b6313a4d3eb1895b6c855436a50606cc7691ad4.tar.gz
Merge remote-tracking branch 'upstream/master'
Conflicts: etc/inc/easyrule.inc etc/inc/filter.inc etc/inc/interfaces.inc etc/inc/services.inc etc/inc/xmlrpc_client.inc usr/local/www/fbegin.inc usr/local/www/services_dhcp.php
Diffstat (limited to 'etc/inc/xmlrpc_client.inc')
-rw-r--r--etc/inc/xmlrpc_client.inc53
1 files changed, 28 insertions, 25 deletions
diff --git a/etc/inc/xmlrpc_client.inc b/etc/inc/xmlrpc_client.inc
index 39d6d70..a192815 100644
--- a/etc/inc/xmlrpc_client.inc
+++ b/etc/inc/xmlrpc_client.inc
@@ -149,13 +149,13 @@ $GLOBALS['XML_RPC_err'] = array(
* @global array $GLOBALS['XML_RPC_str']
*/
$GLOBALS['XML_RPC_str'] = array(
- 'unknown_method' => 'Unknown method',
- 'invalid_return' => 'Invalid return payload: enable debugging to examine incoming payload',
- 'incorrect_params' => 'Incorrect parameters passed to method',
- 'introspect_unknown' => 'Can\'t introspect: method unknown',
- 'http_error' => 'Didn\'t receive 200 OK from remote server.',
- 'not_response_object' => 'The requested method didn\'t return an XML_RPC_Response object.',
- 'invalid_request' => 'Invalid request payload',
+ 'unknown_method' => gettext("Unknown method"),
+ 'invalid_return' => gettext("Invalid return payload: enable debugging to examine incoming payload"),
+ 'incorrect_params' => gettext("Incorrect parameters passed to method"),
+ 'introspect_unknown' => gettext("Can't introspect: method unknown"),
+ 'http_error' => gettext("Didn't receive 200 OK from remote server."),
+ 'not_response_object' => gettext("The requested method didn't return an XML_RPC_Response object."),
+ 'invalid_request' => gettext("Invalid request payload"),
);
@@ -257,7 +257,7 @@ function XML_RPC_se($parser_resource, $name, $attrs)
if (count($XML_RPC_xh[$parser]['stack']) == 0) {
if ($name != 'METHODRESPONSE' && $name != 'METHODCALL') {
$XML_RPC_xh[$parser]['isf'] = 2;
- $XML_RPC_xh[$parser]['isf_reason'] = 'missing top level xmlrpc element';
+ $XML_RPC_xh[$parser]['isf_reason'] = gettext('missing top level xmlrpc element');
return;
}
} else {
@@ -265,7 +265,7 @@ function XML_RPC_se($parser_resource, $name, $attrs)
if (!in_array($XML_RPC_xh[$parser]['stack'][0], $XML_RPC_valid_parents[$name])) {
$name = preg_replace('@[^a-zA-Z0-9._-]@', '', $name);
$XML_RPC_xh[$parser]['isf'] = 2;
- $XML_RPC_xh[$parser]['isf_reason'] = "xmlrpc element $name cannot be child of {$XML_RPC_xh[$parser]['stack'][0]}";
+ $XML_RPC_xh[$parser]['isf_reason'] = sprintf(gettext('xmlrpc element %1$s cannot be child of %2$s'), $name, $XML_RPC_xh[$parser]['stack'][0]);
return;
}
}
@@ -428,7 +428,7 @@ function XML_RPC_ee($parser_resource, $name)
// we have an I4, INT or a DOUBLE
// we must check that only 0123456789-.<space> are characters here
if (!preg_match("@^[+-]?[0123456789 \t\.]+$@", $XML_RPC_xh[$parser]['ac'])) {
- XML_RPC_Base::raiseError('Non-numeric value received in INT or DOUBLE',
+ XML_RPC_Base::raiseError(gettext('Non-numeric value received in INT or DOUBLE'),
XML_RPC_ERROR_NON_NUMERIC_FOUND);
$XML_RPC_xh[$parser]['value'] = XML_RPC_ERROR_NON_NUMERIC_FOUND;
} else {
@@ -853,8 +853,10 @@ class XML_RPC_Client extends XML_RPC_Base {
function send($msg, $timeout = 0)
{
if (!is_a($msg, 'XML_RPC_Message')) {
- $this->errstr = 'send()\'s $msg parameter must be an'
- . ' XML_RPC_Message object.';
+ $this->errstr = sprintf(
+ gettext(
+ "send()'s %s parameter must be an XML_RPC_Message object."
+ ), $msg);
$this->raiseError($this->errstr, XML_RPC_ERROR_PROGRAMMING);
return 0;
}
@@ -944,15 +946,15 @@ class XML_RPC_Client extends XML_RPC_Base {
* but keep it here for backwards compatibility.
*/
if (!$fp && $this->proxy) {
- $this->raiseError('Connection to proxy server '
+ $this->raiseError(gettext('Connection to proxy server ')
. $this->proxy . ':' . $this->proxy_port
- . ' failed. ' . $this->errstr,
+ . gettext(' failed. ') . $this->errstr,
XML_RPC_ERROR_CONNECTION_FAILED);
return 0;
} elseif (!$fp) {
- $this->raiseError('Connection to RPC server '
+ $this->raiseError(gettext('Connection to RPC server ')
. $server . ':' . $port
- . ' failed. ' . $this->errstr,
+ . gettext(' failed. ') . $this->errstr,
XML_RPC_ERROR_CONNECTION_FAILED);
return 0;
}
@@ -1323,7 +1325,7 @@ class XML_RPC_Message extends XML_RPC_Base
if (isset($this->params[$i])) {
return $this->params[$i];
} else {
- $this->raiseError('The submitted request did not contain this parameter',
+ $this->raiseError(gettext('The submitted request did not contain this parameter'),
XML_RPC_ERROR_INCORRECT_PARAMS);
return new XML_RPC_Response(0, $XML_RPC_err['incorrect_params'],
$XML_RPC_str['incorrect_params']);
@@ -1354,7 +1356,7 @@ class XML_RPC_Message extends XML_RPC_Base
function setConvertPayloadEncoding($in)
{
if ($in && !function_exists('mb_convert_encoding')) {
- return $this->raiseError('mb_convert_encoding() is not available',
+ return $this->raiseError(gettext('mb_convert_encoding() is not available'),
XML_RPC_ERROR_PROGRAMMING);
}
$this->convert_payload_encoding = $in;
@@ -1463,7 +1465,7 @@ class XML_RPC_Message extends XML_RPC_Base
!preg_match('@^HTTP/[0-9\.]+ 10[0-9]([A-Z ]+)?[\r\n]+HTTP/[0-9\.]+ 200@', $data))
{
$errstr = substr($data, 0, strpos($data, "\n") - 1);
- error_log('HTTP error, got response: ' . $errstr);
+ error_log(gettext("HTTP error, got response: ") . $errstr);
$r = new XML_RPC_Response(0, $XML_RPC_err['http_error'],
$XML_RPC_str['http_error'] . ' (' .
$errstr . ')');
@@ -1489,7 +1491,7 @@ class XML_RPC_Message extends XML_RPC_Base
if (!xml_parse($parser_resource, $data, sizeof($data))) {
// thanks to Peter Kocks <peter.kocks@baygate.com>
if (xml_get_current_line_number($parser_resource) == 1) {
- $errstr = 'XML error at line 1, check URL';
+ $errstr = gettext("XML error at line 1, check URL");
} else {
$errstr = sprintf('XML error: %s at line %d',
xml_error_string(xml_get_error_code($parser_resource)),
@@ -1584,14 +1586,15 @@ class XML_RPC_Value extends XML_RPC_Base
function addScalar($val, $type = 'string')
{
if ($this->mytype == 1) {
- $this->raiseError('Scalar can have only one value',
+ $this->raiseError(gettext('Scalar can have only one value'),
XML_RPC_ERROR_INVALID_TYPE);
return 0;
}
$typeof = $GLOBALS['XML_RPC_Types'][$type];
if ($typeof != 1) {
- $this->raiseError("Not a scalar type (${typeof})",
- XML_RPC_ERROR_INVALID_TYPE);
+ $this->raiseError(
+ sprintf(gettext("Not a scalar type (%s)"), $typeof),
+ XML_RPC_ERROR_INVALID_TYPE);
return 0;
}
@@ -1626,7 +1629,7 @@ class XML_RPC_Value extends XML_RPC_Base
{
if ($this->mytype != 0) {
$this->raiseError(
- 'Already initialized as a [' . $this->kindOf() . ']',
+ sprintf(gettext('Already initialized as a [%s]'), $this->kindOf()),
XML_RPC_ERROR_ALREADY_INITIALIZED);
return 0;
}
@@ -1642,7 +1645,7 @@ class XML_RPC_Value extends XML_RPC_Base
{
if ($this->mytype != 0) {
$this->raiseError(
- 'Already initialized as a [' . $this->kindOf() . ']',
+ sprintf(gettext('Already initialized as a [%s]'), $this->kindOf()),
XML_RPC_ERROR_ALREADY_INITIALIZED);
return 0;
}
OpenPOWER on IntegriCloud