@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | $server = $parts['host']; |
| 355 | 355 | $path = isset($parts['path']) ? $parts['path'] : ''; |
| 356 | 356 | if (isset($parts['query'])) { |
| 357 | - $path .= '?' . $parts['query']; |
|
| 357 | + $path .= '?'.$parts['query']; |
|
| 358 | 358 | } |
| 359 | 359 | if (isset($parts['fragment'])) { |
| 360 | - $path .= '#' . $parts['fragment']; |
|
| 360 | + $path .= '#'.$parts['fragment']; |
|
| 361 | 361 | } |
| 362 | 362 | if (isset($parts['port'])) { |
| 363 | 363 | $port = $parts['port']; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | if ($path == '' || $path[0] != '/') { |
| 376 | - $this->path = '/' . $path; |
|
| 376 | + $this->path = '/'.$path; |
|
| 377 | 377 | } else { |
| 378 | 378 | $this->path = $path; |
| 379 | 379 | } |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | //$this->accepted_charset_encodings = $ch->knownCharsets(); |
| 406 | 406 | |
| 407 | 407 | // initialize user_agent string |
| 408 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
| 408 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | */ |
| 727 | 727 | public function setSSLVerifyPeer($i) |
| 728 | 728 | { |
| 729 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 729 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 730 | 730 | |
| 731 | 731 | $this->verifypeer = $i; |
| 732 | 732 | return $this; |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | */ |
| 744 | 744 | public function setSSLVerifyHost($i) |
| 745 | 745 | { |
| 746 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 746 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 747 | 747 | |
| 748 | 748 | $this->verifyhost = $i; |
| 749 | 749 | return $this; |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | */ |
| 759 | 759 | public function setSSLVersion($i) |
| 760 | 760 | { |
| 761 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 761 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 762 | 762 | |
| 763 | 763 | $this->sslversion = $i; |
| 764 | 764 | return $this; |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | */ |
| 824 | 824 | public function setRequestCompression($compMethod) |
| 825 | 825 | { |
| 826 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 826 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 827 | 827 | |
| 828 | 828 | $this->request_compression = $compMethod; |
| 829 | 829 | return $this; |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | */ |
| 874 | 874 | public function setCurlOptions($options) |
| 875 | 875 | { |
| 876 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 876 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 877 | 877 | |
| 878 | 878 | $this->extracurlopts = $options; |
| 879 | 879 | return $this; |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | */ |
| 887 | 887 | public function setUseCurl($useCurlMode) |
| 888 | 888 | { |
| 889 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 889 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 890 | 890 | |
| 891 | 891 | $this->use_curl = $useCurlMode; |
| 892 | 892 | return $this; |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | */ |
| 905 | 905 | public function setUserAgent($agentString) |
| 906 | 906 | { |
| 907 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 907 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 908 | 908 | |
| 909 | 909 | $this->user_agent = $agentString; |
| 910 | 910 | return $this; |
@@ -935,12 +935,12 @@ discard block |
||
| 935 | 935 | } |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | - $url = $this->method . '://' . $this->server; |
|
| 938 | + $url = $this->method.'://'.$this->server; |
|
| 939 | 939 | if ($this->port == 0 || ($this->port == 80 && in_array($this->method, array('http', 'http10', 'http11', 'h2c'))) || |
| 940 | 940 | ($this->port == 443 && in_array($this->method, array('https', 'h2')))) { |
| 941 | - return $url . $this->path; |
|
| 941 | + return $url.$this->path; |
|
| 942 | 942 | } else { |
| 943 | - return $url . ':' . $this->port . $this->path; |
|
| 943 | + return $url.':'.$this->port.$this->path; |
|
| 944 | 944 | } |
| 945 | 945 | } |
| 946 | 946 | |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | public function send($req, $timeout = 0, $method = '') |
| 981 | 981 | { |
| 982 | 982 | if ($method !== '' || $timeout !== 0) { |
| 983 | - $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method " . __METHOD__ . ' is deprecated'); |
|
| 983 | + $this->logDeprecation("Using non-default values for arguments 'method' and 'timeout' when calling method ".__METHOD__.' is deprecated'); |
|
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | // if user does not specify http protocol, use native method of this client |
@@ -1106,16 +1106,16 @@ discard block |
||
| 1106 | 1106 | // thanks to Grant Rauscher <[email protected]> for this |
| 1107 | 1107 | $credentials = ''; |
| 1108 | 1108 | if ($opts['username'] != '') { |
| 1109 | - $credentials = 'Authorization: Basic ' . base64_encode($opts['username'] . ':' . $opts['password']) . "\r\n"; |
|
| 1109 | + $credentials = 'Authorization: Basic '.base64_encode($opts['username'].':'.$opts['password'])."\r\n"; |
|
| 1110 | 1110 | if ($opts['authtype'] != 1) { |
| 1111 | 1111 | /// @todo make this a proper error, i.e. return a failure |
| 1112 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 1112 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | 1116 | $acceptedEncoding = ''; |
| 1117 | 1117 | if (is_array($opts['accepted_compression']) && count($opts['accepted_compression'])) { |
| 1118 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $opts['accepted_compression']) . "\r\n"; |
|
| 1118 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $opts['accepted_compression'])."\r\n"; |
|
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | 1121 | if ($port == 0) { |
@@ -1131,14 +1131,14 @@ discard block |
||
| 1131 | 1131 | $connectPort = $opts['proxyport']; |
| 1132 | 1132 | $transport = 'tcp'; |
| 1133 | 1133 | /// @todo check: should we not use https in some cases? |
| 1134 | - $uri = 'http://' . $server . ':' . $port . $path; |
|
| 1134 | + $uri = 'http://'.$server.':'.$port.$path; |
|
| 1135 | 1135 | if ($opts['proxy_user'] != '') { |
| 1136 | 1136 | if ($opts['proxy_authtype'] != 1) { |
| 1137 | 1137 | /// @todo make this a proper error, i.e. return a failure |
| 1138 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 1138 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
| 1139 | 1139 | } |
| 1140 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($opts['proxy_user'] . ':' . |
|
| 1141 | - $opts['proxy_pass']) . "\r\n"; |
|
| 1140 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($opts['proxy_user'].':'. |
|
| 1141 | + $opts['proxy_pass'])."\r\n"; |
|
| 1142 | 1142 | } |
| 1143 | 1143 | } else { |
| 1144 | 1144 | $connectServer = $server; |
@@ -1154,32 +1154,32 @@ discard block |
||
| 1154 | 1154 | $version = ''; |
| 1155 | 1155 | foreach ($opts['cookies'] as $name => $cookie) { |
| 1156 | 1156 | /// @todo should we sanitize the cookie value on behalf of the user? See setCookie comments |
| 1157 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
| 1157 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
| 1158 | 1158 | } |
| 1159 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
| 1159 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | 1162 | // omit port if default |
| 1163 | 1163 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
| 1164 | 1164 | $port = ''; |
| 1165 | 1165 | } else { |
| 1166 | - $port = ':' . $port; |
|
| 1166 | + $port = ':'.$port; |
|
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
| 1170 | - 'User-Agent: ' . $opts['user_agent'] . "\r\n" . |
|
| 1171 | - 'Host: ' . $server . $port . "\r\n" . |
|
| 1172 | - $credentials . |
|
| 1173 | - $proxyCredentials . |
|
| 1174 | - $acceptedEncoding . |
|
| 1175 | - $encodingHdr . |
|
| 1176 | - 'Accept-Charset: ' . implode(',', $opts['accepted_charset_encodings']) . "\r\n" . |
|
| 1177 | - $cookieHeader . |
|
| 1178 | - 'Content-Type: ' . $req->getContentType() . "\r\nContent-Length: " . |
|
| 1179 | - strlen($payload) . "\r\n\r\n" . |
|
| 1169 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
| 1170 | + 'User-Agent: '.$opts['user_agent']."\r\n". |
|
| 1171 | + 'Host: '.$server.$port."\r\n". |
|
| 1172 | + $credentials. |
|
| 1173 | + $proxyCredentials. |
|
| 1174 | + $acceptedEncoding. |
|
| 1175 | + $encodingHdr. |
|
| 1176 | + 'Accept-Charset: '.implode(',', $opts['accepted_charset_encodings'])."\r\n". |
|
| 1177 | + $cookieHeader. |
|
| 1178 | + 'Content-Type: '.$req->getContentType()."\r\nContent-Length: ". |
|
| 1179 | + strlen($payload)."\r\n\r\n". |
|
| 1180 | 1180 | $payload; |
| 1181 | 1181 | |
| 1182 | - if ($opts['debug'] > 1) { |
|
| 1182 | + if ($opts['debug']>1) { |
|
| 1183 | 1183 | $this->getLogger()->debug("---SENDING---\n$op\n---END---"); |
| 1184 | 1184 | } |
| 1185 | 1185 | |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | |
| 1207 | 1207 | $context = stream_context_create($contextOptions); |
| 1208 | 1208 | |
| 1209 | - if ($opts['timeout'] <= 0) { |
|
| 1209 | + if ($opts['timeout']<=0) { |
|
| 1210 | 1210 | $connectTimeout = ini_get('default_socket_timeout'); |
| 1211 | 1211 | } else { |
| 1212 | 1212 | $connectTimeout = $opts['timeout']; |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
| 1219 | 1219 | STREAM_CLIENT_CONNECT, $context); |
| 1220 | 1220 | if ($fp) { |
| 1221 | - if ($opts['timeout'] > 0) { |
|
| 1221 | + if ($opts['timeout']>0) { |
|
| 1222 | 1222 | stream_set_timeout($fp, $opts['timeout'], 0); |
| 1223 | 1223 | } |
| 1224 | 1224 | } else { |
@@ -1227,8 +1227,8 @@ discard block |
||
| 1227 | 1227 | $this->errstr = $err['message']; |
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
| 1231 | - $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
| 1230 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
| 1231 | + $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
| 1232 | 1232 | |
| 1233 | 1233 | return $r; |
| 1234 | 1234 | } |
@@ -1295,19 +1295,19 @@ discard block |
||
| 1295 | 1295 | $opts['keepalive'], $opts['key'], $opts['keypass'], $opts['sslversion']); |
| 1296 | 1296 | |
| 1297 | 1297 | if (!$curl) { |
| 1298 | - return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . |
|
| 1298 | + return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail']. |
|
| 1299 | 1299 | ': error during curl initialization. Check php error log for details'); |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | 1302 | $result = curl_exec($curl); |
| 1303 | 1303 | |
| 1304 | - if ($opts['debug'] > 1) { |
|
| 1304 | + if ($opts['debug']>1) { |
|
| 1305 | 1305 | $message = "---CURL INFO---\n"; |
| 1306 | 1306 | foreach (curl_getinfo($curl) as $name => $val) { |
| 1307 | 1307 | if (is_array($val)) { |
| 1308 | 1308 | $val = implode("\n", $val); |
| 1309 | 1309 | } |
| 1310 | - $message .= $name . ': ' . $val . "\n"; |
|
| 1310 | + $message .= $name.': '.$val."\n"; |
|
| 1311 | 1311 | } |
| 1312 | 1312 | $message .= '---END---'; |
| 1313 | 1313 | $this->getLogger()->debug($message); |
@@ -1317,8 +1317,8 @@ discard block |
||
| 1317 | 1317 | /// @todo we should use a better check here - what if we get back '' or '0'? |
| 1318 | 1318 | |
| 1319 | 1319 | $this->errstr = 'no response'; |
| 1320 | - $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . |
|
| 1321 | - ': ' . curl_error($curl)); |
|
| 1320 | + $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail']. |
|
| 1321 | + ': '.curl_error($curl)); |
|
| 1322 | 1322 | curl_close($curl); |
| 1323 | 1323 | if ($opts['keepalive']) { |
| 1324 | 1324 | $this->xmlrpc_curl_handle = null; |
@@ -1394,12 +1394,12 @@ discard block |
||
| 1394 | 1394 | // http, https |
| 1395 | 1395 | $protocol = $method; |
| 1396 | 1396 | if (strpos($protocol, ':') !== false) { |
| 1397 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
| 1397 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
| 1398 | 1398 | return false; |
| 1399 | 1399 | } |
| 1400 | 1400 | } |
| 1401 | 1401 | } |
| 1402 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $path); |
|
| 1402 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$path); |
|
| 1403 | 1403 | if (!$curl) { |
| 1404 | 1404 | return false; |
| 1405 | 1405 | } |
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | // results into variable |
| 1414 | 1414 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
| 1415 | 1415 | |
| 1416 | - if ($opts['debug'] > 1) { |
|
| 1416 | + if ($opts['debug']>1) { |
|
| 1417 | 1417 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
| 1418 | 1418 | /// @todo redirect curlopt_stderr to some stream which can be piped to the logger |
| 1419 | 1419 | } |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | } |
| 1439 | 1439 | } |
| 1440 | 1440 | // extra headers |
| 1441 | - $headers = array('Content-Type: ' . $req->getContentType(), 'Accept-Charset: ' . implode(',', $opts['accepted_charset_encodings'])); |
|
| 1441 | + $headers = array('Content-Type: '.$req->getContentType(), 'Accept-Charset: '.implode(',', $opts['accepted_charset_encodings'])); |
|
| 1442 | 1442 | // if no keepalive is wanted, let the server know it in advance |
| 1443 | 1443 | if (!$opts['keepalive']) { |
| 1444 | 1444 | $headers[] = 'Connection: close'; |
@@ -1455,7 +1455,7 @@ discard block |
||
| 1455 | 1455 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
| 1456 | 1456 | // timeout is borked |
| 1457 | 1457 | if ($opts['timeout']) { |
| 1458 | - curl_setopt($curl, CURLOPT_TIMEOUT, $opts['timeout'] == 1 ? 1 : $opts['timeout'] - 1); |
|
| 1458 | + curl_setopt($curl, CURLOPT_TIMEOUT, $opts['timeout'] == 1 ? 1 : $opts['timeout']-1); |
|
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | 1461 | switch ($method) { |
@@ -1470,7 +1470,7 @@ discard block |
||
| 1470 | 1470 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
| 1471 | 1471 | } else { |
| 1472 | 1472 | /// @todo make this a proper error, i.e. return a failure |
| 1473 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
| 1473 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
| 1474 | 1474 | } |
| 1475 | 1475 | break; |
| 1476 | 1476 | case 'h2': |
@@ -1479,12 +1479,12 @@ discard block |
||
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | 1481 | if ($opts['username'] && $opts['password']) { |
| 1482 | - curl_setopt($curl, CURLOPT_USERPWD, $opts['username'] . ':' . $opts['password']); |
|
| 1482 | + curl_setopt($curl, CURLOPT_USERPWD, $opts['username'].':'.$opts['password']); |
|
| 1483 | 1483 | if (defined('CURLOPT_HTTPAUTH')) { |
| 1484 | 1484 | curl_setopt($curl, CURLOPT_HTTPAUTH, $opts['authtype']); |
| 1485 | 1485 | } elseif ($opts['authtype'] != 1) { |
| 1486 | 1486 | /// @todo make this a proper error, i.e. return a failure |
| 1487 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 1487 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
| 1488 | 1488 | } |
| 1489 | 1489 | } |
| 1490 | 1490 | |
@@ -1527,14 +1527,14 @@ discard block |
||
| 1527 | 1527 | if ($opts['proxyport'] == 0) { |
| 1528 | 1528 | $opts['proxyport'] = 8080; // NB: even for HTTPS, local connection is on port 8080 |
| 1529 | 1529 | } |
| 1530 | - curl_setopt($curl, CURLOPT_PROXY, $opts['proxy'] . ':' . $opts['proxyport']); |
|
| 1530 | + curl_setopt($curl, CURLOPT_PROXY, $opts['proxy'].':'.$opts['proxyport']); |
|
| 1531 | 1531 | if ($opts['proxy_user']) { |
| 1532 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $opts['proxy_user'] . ':' . $opts['proxy_pass']); |
|
| 1532 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $opts['proxy_user'].':'.$opts['proxy_pass']); |
|
| 1533 | 1533 | if (defined('CURLOPT_PROXYAUTH')) { |
| 1534 | 1534 | curl_setopt($curl, CURLOPT_PROXYAUTH, $opts['proxy_authtype']); |
| 1535 | 1535 | } elseif ($opts['proxy_authtype'] != 1) { |
| 1536 | 1536 | /// @todo make this a proper error, i.e. return a failure |
| 1537 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1537 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
| 1538 | 1538 | } |
| 1539 | 1539 | } |
| 1540 | 1540 | } |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | if (count($opts['cookies'])) { |
| 1545 | 1545 | $cookieHeader = ''; |
| 1546 | 1546 | foreach ($opts['cookies'] as $name => $cookie) { |
| 1547 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
| 1547 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
| 1548 | 1548 | } |
| 1549 | 1549 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
| 1550 | 1550 | } |
@@ -1553,7 +1553,7 @@ discard block |
||
| 1553 | 1553 | curl_setopt($curl, $opt, $val); |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | - if ($opts['debug'] > 1) { |
|
| 1556 | + if ($opts['debug']>1) { |
|
| 1557 | 1557 | $this->getLogger()->debug("---SENDING---\n$payload\n---END---"); |
| 1558 | 1558 | } |
| 1559 | 1559 | |
@@ -1644,7 +1644,7 @@ discard block |
||
| 1644 | 1644 | $call['methodName'] = new Value($req->method(), 'string'); |
| 1645 | 1645 | $numParams = $req->getNumParams(); |
| 1646 | 1646 | $params = array(); |
| 1647 | - for ($i = 0; $i < $numParams; $i++) { |
|
| 1647 | + for ($i = 0; $i<$numParams; $i++) { |
|
| 1648 | 1648 | $params[$i] = $req->getParam($i); |
| 1649 | 1649 | } |
| 1650 | 1650 | $call['params'] = new Value($params, 'array'); |
@@ -1666,7 +1666,7 @@ discard block |
||
| 1666 | 1666 | $response = array(); |
| 1667 | 1667 | |
| 1668 | 1668 | if ($this->return_type == 'xml') { |
| 1669 | - for ($i = 0; $i < count($reqs); $i++) { |
|
| 1669 | + for ($i = 0; $i<count($reqs); $i++) { |
|
| 1670 | 1670 | $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse()); |
| 1671 | 1671 | } |
| 1672 | 1672 | |
@@ -1674,21 +1674,21 @@ discard block |
||
| 1674 | 1674 | if (!is_array($rets)) { |
| 1675 | 1675 | // bad return type from system.multicall |
| 1676 | 1676 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1677 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse()); |
|
| 1677 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse()); |
|
| 1678 | 1678 | } |
| 1679 | 1679 | $numRets = count($rets); |
| 1680 | 1680 | if ($numRets != count($reqs)) { |
| 1681 | 1681 | // wrong number of return values. |
| 1682 | 1682 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1683 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals', |
|
| 1683 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals', |
|
| 1684 | 1684 | $result->httpResponse()); |
| 1685 | 1685 | } |
| 1686 | 1686 | |
| 1687 | - for ($i = 0; $i < $numRets; $i++) { |
|
| 1687 | + for ($i = 0; $i<$numRets; $i++) { |
|
| 1688 | 1688 | $val = $rets[$i]; |
| 1689 | 1689 | if (!is_array($val)) { |
| 1690 | 1690 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1691 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
| 1691 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
| 1692 | 1692 | 'phpvals', $result->httpResponse()); |
| 1693 | 1693 | } |
| 1694 | 1694 | switch (count($val)) { |
@@ -1696,7 +1696,7 @@ discard block |
||
| 1696 | 1696 | if (!isset($val[0])) { |
| 1697 | 1697 | // Bad value |
| 1698 | 1698 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1699 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value", |
|
| 1699 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value", |
|
| 1700 | 1700 | 'phpvals', $result->httpResponse()); |
| 1701 | 1701 | } |
| 1702 | 1702 | // Normal return value |
@@ -1708,20 +1708,20 @@ discard block |
||
| 1708 | 1708 | if (!is_int($code)) { |
| 1709 | 1709 | /// @todo should we check that it is != 0? |
| 1710 | 1710 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1711 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
| 1711 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
| 1712 | 1712 | 'phpvals', $result->httpResponse()); |
| 1713 | 1713 | } |
| 1714 | 1714 | $str = @$val['faultString']; |
| 1715 | 1715 | if (!is_string($str)) { |
| 1716 | 1716 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1717 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString", |
|
| 1717 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString", |
|
| 1718 | 1718 | 'phpvals', $result->httpResponse()); |
| 1719 | 1719 | } |
| 1720 | 1720 | $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse()); |
| 1721 | 1721 | break; |
| 1722 | 1722 | default: |
| 1723 | 1723 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1724 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
| 1724 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
| 1725 | 1725 | 'phpvals', $result->httpResponse()); |
| 1726 | 1726 | } |
| 1727 | 1727 | } |
@@ -1730,14 +1730,14 @@ discard block |
||
| 1730 | 1730 | // return type == 'xmlrpcvals' |
| 1731 | 1731 | if ($rets->kindOf() != 'array') { |
| 1732 | 1732 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1733 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals', |
|
| 1733 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals', |
|
| 1734 | 1734 | $result->httpResponse()); |
| 1735 | 1735 | } |
| 1736 | 1736 | $numRets = $rets->count(); |
| 1737 | 1737 | if ($numRets != count($reqs)) { |
| 1738 | 1738 | // wrong number of return values. |
| 1739 | 1739 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1740 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals', |
|
| 1740 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals', |
|
| 1741 | 1741 | $result->httpResponse()); |
| 1742 | 1742 | } |
| 1743 | 1743 | |
@@ -1746,7 +1746,7 @@ discard block |
||
| 1746 | 1746 | case 'array': |
| 1747 | 1747 | if ($val->count() != 1) { |
| 1748 | 1748 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1749 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
| 1749 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
| 1750 | 1750 | 'phpvals', $result->httpResponse()); |
| 1751 | 1751 | } |
| 1752 | 1752 | // Normal return value |
@@ -1755,28 +1755,28 @@ discard block |
||
| 1755 | 1755 | case 'struct': |
| 1756 | 1756 | if ($val->count() != 2) { |
| 1757 | 1757 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1758 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items", |
|
| 1758 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items", |
|
| 1759 | 1759 | 'phpvals', $result->httpResponse()); |
| 1760 | 1760 | } |
| 1761 | 1761 | /** @var Value $code */ |
| 1762 | 1762 | $code = $val['faultCode']; |
| 1763 | 1763 | if ($code->kindOf() != 'scalar' || $code->scalarTyp() != 'int') { |
| 1764 | 1764 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1765 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
| 1765 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
| 1766 | 1766 | 'xmlrpcvals', $result->httpResponse()); |
| 1767 | 1767 | } |
| 1768 | 1768 | /** @var Value $str */ |
| 1769 | 1769 | $str = $val['faultString']; |
| 1770 | 1770 | if ($str->kindOf() != 'scalar' || $str->scalarTyp() != 'string') { |
| 1771 | 1771 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1772 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode", |
|
| 1772 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode", |
|
| 1773 | 1773 | 'xmlrpcvals', $result->httpResponse()); |
| 1774 | 1774 | } |
| 1775 | 1775 | $response[] = new Response(0, $code->scalarVal(), $str->scalarVal(), 'xmlrpcvals', $result->httpResponse()); |
| 1776 | 1776 | break; |
| 1777 | 1777 | default: |
| 1778 | 1778 | return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'], |
| 1779 | - PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct", |
|
| 1779 | + PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct", |
|
| 1780 | 1780 | 'xmlrpcvals', $result->httpResponse()); |
| 1781 | 1781 | } |
| 1782 | 1782 | } |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
| 1810 | 1810 | $method = 'http') |
| 1811 | 1811 | { |
| 1812 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 1812 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 1813 | 1813 | |
| 1814 | 1814 | return $this->sendPayloadSocket($req, $server, $port, $timeout, $username, $password, $authType, null, null, |
| 1815 | 1815 | null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType, $method); |
@@ -1845,7 +1845,7 @@ discard block |
||
| 1845 | 1845 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
| 1846 | 1846 | $sslVersion = 0) |
| 1847 | 1847 | { |
| 1848 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 1848 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 1849 | 1849 | |
| 1850 | 1850 | return $this->sendPayloadCURL($req, $server, $port, $timeout, $username, |
| 1851 | 1851 | $password, $authType, $cert, $certPass, $caCert, $caCertDir, $proxyHost, $proxyPort, |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | public function getOptions() |
| 261 | 261 | { |
| 262 | 262 | $values = array(); |
| 263 | - foreach($this->options as $opt) { |
|
| 263 | + foreach ($this->options as $opt) { |
|
| 264 | 264 | $values[$opt] = $this->getOption($opt); |
| 265 | 265 | } |
| 266 | 266 | return $values; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | public function setOptions($options) |
| 275 | 275 | { |
| 276 | - foreach($options as $name => $value) { |
|
| 276 | + foreach ($options as $name => $value) { |
|
| 277 | 277 | $this->setOption($name, $value); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public static function xmlrpc_debugmsg($msg) |
| 313 | 313 | { |
| 314 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
| 314 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | public static function error_occurred($msg) |
| 325 | 325 | { |
| 326 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
| 326 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -344,10 +344,10 @@ discard block |
||
| 344 | 344 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
| 345 | 345 | $out = ''; |
| 346 | 346 | if ($this->debug_info != '') { |
| 347 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
| 347 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
| 348 | 348 | } |
| 349 | 349 | if (static::$_xmlrpc_debuginfo != '') { |
| 350 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
| 350 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
| 351 | 351 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
| 352 | 352 | // into return payload AFTER the beginning tag |
| 353 | 353 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | $this->debug_info = ''; |
| 377 | 377 | |
| 378 | 378 | // Save what we received, before parsing it |
| 379 | - if ($this->debug > 1) { |
|
| 380 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
| 379 | + if ($this->debug>1) { |
|
| 380 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -394,13 +394,13 @@ discard block |
||
| 394 | 394 | $resp->raw_data = $rawData; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
| 398 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
| 399 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
| 397 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
| 398 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
| 399 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | $header = $resp->xml_header($respCharset); |
| 403 | - if ($this->debug > 0) { |
|
| 403 | + if ($this->debug>0) { |
|
| 404 | 404 | $header .= $this->serializeDebug($respCharset); |
| 405 | 405 | } |
| 406 | 406 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | if (empty($payload)) { |
| 412 | 412 | $payload = $resp->serialize($respCharset); |
| 413 | 413 | } |
| 414 | - $payload = $header . $payload; |
|
| 414 | + $payload = $header.$payload; |
|
| 415 | 415 | |
| 416 | 416 | if ($returnPayload) { |
| 417 | 417 | return $payload; |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | // if we get a warning/error that has output some text before here, then we cannot |
| 421 | 421 | // add a new header. We cannot say we are sending xml, either... |
| 422 | 422 | if (!headers_sent()) { |
| 423 | - header('Content-Type: ' . $resp->getContentType()); |
|
| 423 | + header('Content-Type: '.$resp->getContentType()); |
|
| 424 | 424 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
| 425 | 425 | header("Vary: Accept-Charset"); |
| 426 | 426 | |
@@ -443,10 +443,10 @@ discard block |
||
| 443 | 443 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
| 444 | 444 | // responses up to 8000 bytes |
| 445 | 445 | if ($phpNoSelfCompress) { |
| 446 | - header('Content-Length: ' . (int)strlen($payload)); |
|
| 446 | + header('Content-Length: '.(int) strlen($payload)); |
|
| 447 | 447 | } |
| 448 | 448 | } else { |
| 449 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 449 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | print $payload; |
@@ -509,9 +509,9 @@ discard block |
||
| 509 | 509 | $numParams = count($in); |
| 510 | 510 | } |
| 511 | 511 | foreach ($sigs as $curSig) { |
| 512 | - if (count($curSig) == $numParams + 1) { |
|
| 512 | + if (count($curSig) == $numParams+1) { |
|
| 513 | 513 | $itsOK = 1; |
| 514 | - for ($n = 0; $n < $numParams; $n++) { |
|
| 514 | + for ($n = 0; $n<$numParams; $n++) { |
|
| 515 | 515 | if (is_object($in)) { |
| 516 | 516 | $p = $in->getParam($n); |
| 517 | 517 | if ($p->kindOf() == 'scalar') { |
@@ -524,10 +524,10 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | // param index is $n+1, as first member of sig is return type |
| 527 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
| 527 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
| 528 | 528 | $itsOK = 0; |
| 529 | - $pno = $n + 1; |
|
| 530 | - $wanted = $curSig[$n + 1]; |
|
| 529 | + $pno = $n+1; |
|
| 530 | + $wanted = $curSig[$n+1]; |
|
| 531 | 531 | $got = $pt; |
| 532 | 532 | break; |
| 533 | 533 | } |
@@ -554,10 +554,10 @@ discard block |
||
| 554 | 554 | // check if $_SERVER is populated: it might have been disabled via ini file |
| 555 | 555 | // (this is true even when in CLI mode) |
| 556 | 556 | if (count($_SERVER) == 0) { |
| 557 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
| 557 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - if ($this->debug > 1) { |
|
| 560 | + if ($this->debug>1) { |
|
| 561 | 561 | if (function_exists('getallheaders')) { |
| 562 | 562 | $this->debugmsg(''); // empty line |
| 563 | 563 | foreach (getallheaders() as $name => $val) { |
@@ -582,13 +582,13 @@ discard block |
||
| 582 | 582 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
| 583 | 583 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 584 | 584 | $data = $degzdata; |
| 585 | - if ($this->debug > 1) { |
|
| 586 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 585 | + if ($this->debug>1) { |
|
| 586 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 587 | 587 | } |
| 588 | 588 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 589 | 589 | $data = $degzdata; |
| 590 | - if ($this->debug > 1) { |
|
| 591 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 590 | + if ($this->debug>1) { |
|
| 591 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 592 | 592 | } |
| 593 | 593 | } else { |
| 594 | 594 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | if ($reqEncoding == 'ISO-8859-1') { |
| 676 | 676 | $data = utf8_encode($data); |
| 677 | 677 | } else { |
| 678 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
| 678 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | } |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | preg_match('/^XML error ([0-9]+)/', $_xh['isf_reason'], $matches); |
| 704 | 704 | return new Response( |
| 705 | 705 | 0, |
| 706 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
| 706 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
| 707 | 707 | $_xh['isf_reason']); |
| 708 | 708 | } elseif ($_xh['isf']) { |
| 709 | 709 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | return new Response( |
| 712 | 712 | 0, |
| 713 | 713 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
| 714 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $_xh['isf_reason']); |
|
| 714 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$_xh['isf_reason']); |
|
| 715 | 715 | } else { |
| 716 | 716 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
| 717 | 717 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -721,20 +721,20 @@ discard block |
||
| 721 | 721 | ($this->dmap[$_xh['method']]['parameters_type'] != 'xmlrpcvals') |
| 722 | 722 | ) |
| 723 | 723 | ) { |
| 724 | - if ($this->debug > 1) { |
|
| 725 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($_xh['params'], true) . "\n+++END+++"); |
|
| 724 | + if ($this->debug>1) { |
|
| 725 | + $this->debugmsg("\n+++PARSED+++\n".var_export($_xh['params'], true)."\n+++END+++"); |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | return $this->execute($_xh['method'], $_xh['params'], $_xh['pt']); |
| 729 | 729 | } else { |
| 730 | 730 | // build a Request object with data parsed from xml and add parameters in |
| 731 | 731 | $req = new Request($_xh['method']); |
| 732 | - for ($i = 0; $i < count($_xh['params']); $i++) { |
|
| 732 | + for ($i = 0; $i<count($_xh['params']); $i++) { |
|
| 733 | 733 | $req->addParam($_xh['params'][$i]); |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | - if ($this->debug > 1) { |
|
| 737 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
| 736 | + if ($this->debug>1) { |
|
| 737 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | return $this->execute($req); |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | return new Response( |
| 785 | 785 | 0, |
| 786 | 786 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 787 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
| 787 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
| 788 | 788 | ); |
| 789 | 789 | } |
| 790 | 790 | } |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | // build string representation of function 'name' |
| 800 | 800 | if (is_array($func)) { |
| 801 | 801 | if (is_object($func[0])) { |
| 802 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
| 802 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
| 803 | 803 | } else { |
| 804 | 804 | $funcName = implode('::', $func); |
| 805 | 805 | } |
@@ -811,23 +811,23 @@ discard block |
||
| 811 | 811 | |
| 812 | 812 | // verify that function to be invoked is in fact callable |
| 813 | 813 | if (!is_callable($func)) { |
| 814 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
| 814 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
| 815 | 815 | return new Response( |
| 816 | 816 | 0, |
| 817 | 817 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 818 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
| 818 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
| 819 | 819 | ); |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | if (isset($dmap[$methodName]['exception_handling'])) { |
| 823 | - $exception_handling = (int)$dmap[$methodName]['exception_handling']; |
|
| 823 | + $exception_handling = (int) $dmap[$methodName]['exception_handling']; |
|
| 824 | 824 | } else { |
| 825 | 825 | $exception_handling = $this->exception_handling; |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | // If debug level is 3, we should catch all errors generated during processing of user function, and log them |
| 829 | 829 | // as part of response |
| 830 | - if ($this->debug > 2) { |
|
| 830 | + if ($this->debug>2) { |
|
| 831 | 831 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
| 832 | 832 | } |
| 833 | 833 | |
@@ -841,14 +841,14 @@ discard block |
||
| 841 | 841 | $r = call_user_func($func, $req); |
| 842 | 842 | } |
| 843 | 843 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
| 844 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
| 844 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
| 845 | 845 | if (is_a($r, 'PhpXmlRpc\Value')) { |
| 846 | 846 | $r = new Response($r); |
| 847 | 847 | } else { |
| 848 | 848 | $r = new Response( |
| 849 | 849 | 0, |
| 850 | 850 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 851 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
| 851 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
| 852 | 852 | ); |
| 853 | 853 | } |
| 854 | 854 | } |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
| 864 | 864 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
| 865 | 865 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
| 866 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
| 866 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
| 867 | 867 | } else { |
| 868 | 868 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
| 869 | 869 | // return type correctly |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | // proper error-response |
| 889 | 889 | switch ($exception_handling) { |
| 890 | 890 | case 2: |
| 891 | - if ($this->debug > 2) { |
|
| 891 | + if ($this->debug>2) { |
|
| 892 | 892 | if (self::$_xmlrpcs_prev_ehandler) { |
| 893 | 893 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
| 894 | 894 | } else { |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | // proper error-response |
| 912 | 912 | switch ($exception_handling) { |
| 913 | 913 | case 2: |
| 914 | - if ($this->debug > 2) { |
|
| 914 | + if ($this->debug>2) { |
|
| 915 | 915 | if (self::$_xmlrpcs_prev_ehandler) { |
| 916 | 916 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
| 917 | 917 | } else { |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | } |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - if ($this->debug > 2) { |
|
| 934 | + if ($this->debug>2) { |
|
| 935 | 935 | // note: restore the error handler we found before calling the user func, even if it has been changed |
| 936 | 936 | // inside the func itself |
| 937 | 937 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | */ |
| 998 | 998 | protected function debugmsg($string) |
| 999 | 999 | { |
| 1000 | - $this->debug_info .= $string . "\n"; |
|
| 1000 | + $this->debug_info .= $string."\n"; |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | /** |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | $i++; // for error message, we count params from 1 |
| 1289 | 1289 | return static::_xmlrpcs_multicall_error(new Response(0, |
| 1290 | 1290 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 1291 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
| 1291 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
| 1292 | 1292 | } |
| 1293 | 1293 | } |
| 1294 | 1294 | |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | } |
| 1370 | 1370 | } else { |
| 1371 | 1371 | $numCalls = count($req); |
| 1372 | - for ($i = 0; $i < $numCalls; $i++) { |
|
| 1372 | + for ($i = 0; $i<$numCalls; $i++) { |
|
| 1373 | 1373 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
| 1374 | 1374 | } |
| 1375 | 1375 | } |
@@ -1434,12 +1434,12 @@ discard block |
||
| 1434 | 1434 | */ |
| 1435 | 1435 | protected function xml_header($charsetEncoding = '') |
| 1436 | 1436 | { |
| 1437 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 1437 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 1438 | 1438 | |
| 1439 | 1439 | if ($charsetEncoding != '') { |
| 1440 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 1440 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 1441 | 1441 | } else { |
| 1442 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 1442 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 1443 | 1443 | } |
| 1444 | 1444 | } |
| 1445 | 1445 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | // user declares the type of resp value: we "almost" trust it... but log errors just in case |
| 74 | 74 | if (($this->valtyp == 'xmlrpcvals' && (!is_a($this->val, 'PhpXmlRpc\Value'))) || |
| 75 | 75 | ($this->valtyp == 'xml' && (!is_string($this->val)))) { |
| 76 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in does not match type ' . $valType); |
|
| 76 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in does not match type '.$valType); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -152,34 +152,34 @@ discard block |
||
| 152 | 152 | public function serialize($charsetEncoding = '') |
| 153 | 153 | { |
| 154 | 154 | if ($charsetEncoding != '') { |
| 155 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 155 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 156 | 156 | } else { |
| 157 | 157 | $this->content_type = 'text/xml'; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
| 161 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
| 161 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
| 162 | 162 | } else { |
| 163 | 163 | $result = "<methodResponse>\n"; |
| 164 | 164 | } |
| 165 | 165 | if ($this->errno) { |
| 166 | 166 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
| 167 | - $result .= "<fault>\n" . |
|
| 168 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
| 169 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
| 170 | - $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . |
|
| 167 | + $result .= "<fault>\n". |
|
| 168 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
| 169 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
| 170 | + $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding). |
|
| 171 | 171 | "</string></value>\n</member>\n</struct>\n</value>\n</fault>"; |
| 172 | 172 | } else { |
| 173 | 173 | if (is_object($this->val) && is_a($this->val, 'PhpXmlRpc\Value')) { |
| 174 | - $result .= "<params>\n<param>\n" . $this->val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
| 174 | + $result .= "<params>\n<param>\n".$this->val->serialize($charsetEncoding)."</param>\n</params>"; |
|
| 175 | 175 | } else if (is_string($this->val) && $this->valtyp == 'xml') { |
| 176 | - $result .= "<params>\n<param>\n" . |
|
| 177 | - $this->val . |
|
| 176 | + $result .= "<params>\n<param>\n". |
|
| 177 | + $this->val. |
|
| 178 | 178 | "</param>\n</params>"; |
| 179 | 179 | } else if ($this->valtyp == 'phpvals') { |
| 180 | 180 | $encoder = new Encoder(); |
| 181 | 181 | $val = $encoder->encode($this->val); |
| 182 | - $result .= "<params>\n<param>\n" . $val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
| 182 | + $result .= "<params>\n<param>\n".$val->serialize($charsetEncoding)."</param>\n</params>"; |
|
| 183 | 183 | } else { |
| 184 | 184 | throw new StateErrorException('cannot serialize xmlrpc response objects whose content is native php values'); |
| 185 | 185 | } |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | public function xml_header($charsetEncoding = '') |
| 199 | 199 | { |
| 200 | 200 | if ($charsetEncoding != '') { |
| 201 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 201 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 202 | 202 | } else { |
| 203 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 203 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
@@ -211,18 +211,18 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | switch ($name) { |
| 213 | 213 | case 'hdrs': |
| 214 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 214 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 215 | 215 | return $this->httpResponse['headers']; |
| 216 | 216 | case '_cookies': |
| 217 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 217 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 218 | 218 | return $this->httpResponse['cookies']; |
| 219 | 219 | case 'raw_data': |
| 220 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 220 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 221 | 221 | return $this->httpResponse['raw_data']; |
| 222 | 222 | default: |
| 223 | 223 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 224 | 224 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 225 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 225 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 226 | 226 | $result = null; |
| 227 | 227 | return $result; |
| 228 | 228 | } |
@@ -232,21 +232,21 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | switch ($name) { |
| 234 | 234 | case 'hdrs': |
| 235 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 235 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 236 | 236 | $this->httpResponse['headers'] = $value; |
| 237 | 237 | break; |
| 238 | 238 | case '_cookies': |
| 239 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 239 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 240 | 240 | $this->httpResponse['cookies'] = $value; |
| 241 | 241 | break; |
| 242 | 242 | case 'raw_data': |
| 243 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 243 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 244 | 244 | $this->httpResponse['raw_data'] = $value; |
| 245 | 245 | break; |
| 246 | 246 | default: |
| 247 | 247 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 248 | 248 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 249 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 249 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
@@ -254,13 +254,13 @@ discard block |
||
| 254 | 254 | { |
| 255 | 255 | switch ($name) { |
| 256 | 256 | case 'hdrs': |
| 257 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 257 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 258 | 258 | return isset($this->httpResponse['headers']); |
| 259 | 259 | case '_cookies': |
| 260 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 260 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 261 | 261 | return isset($this->httpResponse['cookies']); |
| 262 | 262 | case 'raw_data': |
| 263 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 263 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 264 | 264 | return isset($this->httpResponse['raw_data']); |
| 265 | 265 | default: |
| 266 | 266 | return false; |
@@ -271,21 +271,21 @@ discard block |
||
| 271 | 271 | { |
| 272 | 272 | switch ($name) { |
| 273 | 273 | case 'hdrs': |
| 274 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 274 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 275 | 275 | unset($this->httpResponse['headers']); |
| 276 | 276 | break; |
| 277 | 277 | case '_cookies': |
| 278 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 278 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 279 | 279 | unset($this->httpResponse['cookies']); |
| 280 | 280 | break; |
| 281 | 281 | case 'raw_data': |
| 282 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 282 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 283 | 283 | unset($this->httpResponse['raw_data']); |
| 284 | 284 | break; |
| 285 | 285 | default: |
| 286 | 286 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 287 | 287 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 288 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 288 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->me['struct'] = $val; |
| 97 | 97 | break; |
| 98 | 98 | default: |
| 99 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
| 99 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if ($typeOf !== 1) { |
| 129 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
| 129 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
| 130 | 130 | return 0; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | switch ($this->mytype) { |
| 145 | 145 | case 1: |
| 146 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
| 146 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
| 147 | 147 | return 0; |
| 148 | 148 | case 3: |
| 149 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
| 149 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
| 150 | 150 | return 0; |
| 151 | 151 | case 2: |
| 152 | 152 | // we're adding a scalar value to an array here |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | return 1; |
| 192 | 192 | } else { |
| 193 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
| 193 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
| 194 | 194 | return 0; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | return 1; |
| 223 | 223 | } else { |
| 224 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
| 224 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
| 225 | 225 | return 0; |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $val = reset($this->me); |
| 287 | 287 | $typ = key($this->me); |
| 288 | 288 | |
| 289 | - return '<value>' . $this->serializeData($typ, $val, $charsetEncoding) . "</value>\n"; |
|
| 289 | + return '<value>'.$this->serializeData($typ, $val, $charsetEncoding)."</value>\n"; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -309,19 +309,19 @@ discard block |
||
| 309 | 309 | case 1: |
| 310 | 310 | switch ($typ) { |
| 311 | 311 | case static::$xmlrpcBase64: |
| 312 | - $rs = "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
| 312 | + $rs = "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
| 313 | 313 | break; |
| 314 | 314 | case static::$xmlrpcBoolean: |
| 315 | - $rs = "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
| 315 | + $rs = "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
| 316 | 316 | break; |
| 317 | 317 | case static::$xmlrpcString: |
| 318 | 318 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
| 319 | - $rs = "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
| 319 | + $rs = "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
| 320 | 320 | break; |
| 321 | 321 | case static::$xmlrpcInt: |
| 322 | 322 | case static::$xmlrpcI4: |
| 323 | 323 | case static::$xmlrpcI8: |
| 324 | - $rs = "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
| 324 | + $rs = "<{$typ}>".(int) $val."</{$typ}>"; |
|
| 325 | 325 | break; |
| 326 | 326 | case static::$xmlrpcDouble: |
| 327 | 327 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -329,16 +329,16 @@ discard block |
||
| 329 | 329 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
| 330 | 330 | // The code below tries its best at keeping max precision while avoiding exp notation, |
| 331 | 331 | // but there is of course no limit in the number of decimal places to be used... |
| 332 | - $rs = "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
| 332 | + $rs = "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
| 333 | 333 | break; |
| 334 | 334 | case static::$xmlrpcDateTime: |
| 335 | 335 | if (is_string($val)) { |
| 336 | 336 | $rs = "<{$typ}>{$val}</{$typ}>"; |
| 337 | 337 | // DateTimeInterface is not present in php 5.4... |
| 338 | 338 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
| 339 | - $rs = "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
| 339 | + $rs = "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
| 340 | 340 | } elseif (is_int($val)) { |
| 341 | - $rs = "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
| 341 | + $rs = "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
| 342 | 342 | } else { |
| 343 | 343 | // not really a good idea here: but what should we output anyway? left for backward compat... |
| 344 | 344 | $rs = "<{$typ}>{$val}</{$typ}>"; |
@@ -360,14 +360,14 @@ discard block |
||
| 360 | 360 | case 3: |
| 361 | 361 | // struct |
| 362 | 362 | if ($this->_php_class) { |
| 363 | - $rs = '<struct php_class="' . $this->_php_class . "\">\n"; |
|
| 363 | + $rs = '<struct php_class="'.$this->_php_class."\">\n"; |
|
| 364 | 364 | } else { |
| 365 | 365 | $rs = "<struct>\n"; |
| 366 | 366 | } |
| 367 | 367 | $charsetEncoder = $this->getCharsetEncoder(); |
| 368 | 368 | /** @var Value $val2 */ |
| 369 | 369 | foreach ($val as $key2 => $val2) { |
| 370 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
| 370 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
| 371 | 371 | $rs .= $val2->serialize($charsetEncoding); |
| 372 | 372 | $rs .= "</member>\n"; |
| 373 | 373 | } |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | */ |
| 582 | 582 | public function structMemExists($key) |
| 583 | 583 | { |
| 584 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 584 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 585 | 585 | |
| 586 | 586 | return array_key_exists($key, $this->me['struct']); |
| 587 | 587 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | */ |
| 598 | 598 | public function structMem($key) |
| 599 | 599 | { |
| 600 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 600 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 601 | 601 | |
| 602 | 602 | return $this->me['struct'][$key]; |
| 603 | 603 | } |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | */ |
| 611 | 611 | public function structReset() |
| 612 | 612 | { |
| 613 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 613 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 614 | 614 | |
| 615 | 615 | reset($this->me['struct']); |
| 616 | 616 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | public function structEach() |
| 626 | 626 | { |
| 627 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 627 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 628 | 628 | |
| 629 | 629 | $key = key($this->me['struct']); |
| 630 | 630 | $value = current($this->me['struct']); |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | */ |
| 644 | 644 | public function arrayMem($key) |
| 645 | 645 | { |
| 646 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 646 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 647 | 647 | |
| 648 | 648 | return $this->me['array'][$key]; |
| 649 | 649 | } |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | */ |
| 658 | 658 | public function arraySize() |
| 659 | 659 | { |
| 660 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 660 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 661 | 661 | |
| 662 | 662 | return count($this->me['array']); |
| 663 | 663 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | */ |
| 672 | 672 | public function structSize() |
| 673 | 673 | { |
| 674 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 674 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 675 | 675 | |
| 676 | 676 | return count($this->me['struct']); |
| 677 | 677 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | return true; |
| 79 | 79 | } else { |
| 80 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value'); |
|
| 80 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value'); |
|
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | $this->logDeprecationUnlessCalledBy('serialize'); |
| 128 | 128 | |
| 129 | 129 | if ($charsetEncoding != '') { |
| 130 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 130 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 131 | 131 | } else { |
| 132 | 132 | $this->content_type = 'text/xml'; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $result = $this->xml_header($charsetEncoding); |
| 136 | - $result .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
| 137 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
| 136 | + $result .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
| 137 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
| 138 | 138 | $result .= "<params>\n"; |
| 139 | 139 | foreach ($this->params as $p) { |
| 140 | - $result .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
| 140 | + $result .= "<param>\n".$p->serialize($charsetEncoding). |
|
| 141 | 141 | "</param>\n"; |
| 142 | 142 | } |
| 143 | 143 | $result .= "</params>\n"; |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | $this->logDeprecationUnlessCalledBy('createPayload'); |
| 158 | 158 | |
| 159 | 159 | if ($charsetEncoding != '') { |
| 160 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
| 160 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
| 161 | 161 | } else { |
| 162 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
| 162 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -221,14 +221,14 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS) |
| 223 | 223 | { |
| 224 | - if ($this->debug > 0) { |
|
| 224 | + if ($this->debug>0) { |
|
| 225 | 225 | $this->getLogger()->debug("---GOT---\n$data\n---END---"); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
| 229 | 229 | |
| 230 | 230 | if ($data == '') { |
| 231 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
| 231 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
| 232 | 232 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | if (substr($data, 0, 4) == 'HTTP') { |
| 237 | 237 | $httpParser = new Http(); |
| 238 | 238 | try { |
| 239 | - $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0); |
|
| 239 | + $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0); |
|
| 240 | 240 | } catch (HttpException $e) { |
| 241 | 241 | // failed processing of HTTP response headers |
| 242 | 242 | // save into response obj the full payload received, for debugging |
| 243 | 243 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
| 244 | - } catch(\Exception $e) { |
|
| 244 | + } catch (\Exception $e) { |
|
| 245 | 245 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
| 246 | 246 | } |
| 247 | 247 | } else { |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
| 258 | 258 | $pos = strrpos($data, '</methodResponse>'); |
| 259 | 259 | if ($pos !== false) { |
| 260 | - $data = substr($data, 0, $pos + 17); |
|
| 260 | + $data = substr($data, 0, $pos+17); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // try to 'guestimate' the character encoding of the received response |
@@ -266,21 +266,21 @@ discard block |
||
| 266 | 266 | $data |
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | - if ($this->debug >= 0) { |
|
| 269 | + if ($this->debug>=0) { |
|
| 270 | 270 | $this->httpResponse = $httpResponse; |
| 271 | 271 | } else { |
| 272 | 272 | $httpResponse = null; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if ($this->debug > 0) { |
|
| 275 | + if ($this->debug>0) { |
|
| 276 | 276 | $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 277 | 277 | if ($start) { |
| 278 | 278 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
| 279 | 279 | /// @todo what if there is no end tag? |
| 280 | 280 | $end = strpos($data, '-->', $start); |
| 281 | - $comments = substr($data, $start, $end - $start); |
|
| 282 | - $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t" . |
|
| 283 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding)); |
|
| 281 | + $comments = substr($data, $start, $end-$start); |
|
| 282 | + $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t". |
|
| 283 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding)); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | if ($respEncoding == 'ISO-8859-1') { |
| 303 | 303 | $data = utf8_encode($data); |
| 304 | 304 | } else { |
| 305 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding); |
|
| 305 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding); |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | } |
@@ -329,16 +329,16 @@ discard block |
||
| 329 | 329 | // there could be proxies meddling with the request, or network data corruption... |
| 330 | 330 | |
| 331 | 331 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'], |
| 332 | - PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $_xh['isf_reason'], '', $httpResponse); |
|
| 332 | + PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$_xh['isf_reason'], '', $httpResponse); |
|
| 333 | 333 | |
| 334 | - if ($this->debug > 0) { |
|
| 334 | + if ($this->debug>0) { |
|
| 335 | 335 | $this->getLogger()->debug($_xh['isf_reason']); |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | // second error check: xml well-formed but not xml-rpc compliant |
| 339 | 339 | elseif ($_xh['isf'] == 2) { |
| 340 | 340 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'], |
| 341 | - PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $_xh['isf_reason'], '', $httpResponse); |
|
| 341 | + PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$_xh['isf_reason'], '', $httpResponse); |
|
| 342 | 342 | |
| 343 | 343 | /// @todo echo something for the user? check if it was already done by the parser... |
| 344 | 344 | //if ($this->debug > 0) { |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | // third error check: parsing of the response has somehow gone boink. |
| 349 | 349 | /// @todo shall we omit this check, since we trust the parsing code? |
| 350 | - elseif ($_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($_xh['value'])) { |
|
| 350 | + elseif ($_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($_xh['value'])) { |
|
| 351 | 351 | // something odd has happened and it's time to generate a client side error indicating something odd went on |
| 352 | 352 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'], |
| 353 | 353 | '', $httpResponse |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | /// @todo echo something for the user? |
| 357 | 357 | } else { |
| 358 | - if ($this->debug > 1) { |
|
| 358 | + if ($this->debug>1) { |
|
| 359 | 359 | $this->getLogger()->debug( |
| 360 | 360 | "---PARSED---\n".var_export($_xh['value'], true)."\n---END---" |
| 361 | 361 | ); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | if ($errNo == 0) { |
| 380 | 380 | // FAULT returned, errno needs to reflect that |
| 381 | 381 | /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr |
| 382 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 382 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1'); |
|
| 383 | 383 | $errNo = -1; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | <body> |
| 79 | 79 | <?php |
| 80 | 80 | |
| 81 | -include __DIR__ . '/common.php'; |
|
| 81 | +include __DIR__.'/common.php'; |
|
| 82 | 82 | |
| 83 | 83 | if ($action) { |
| 84 | 84 | |
| 85 | 85 | // avoid php hanging when using the builtin webserver and sending requests to itself |
| 86 | 86 | $skip = false; |
| 87 | - if (php_sapi_name() === 'cli-server' && ((int)getenv('PHP_CLI_SERVER_WORKERS') < 2)) { |
|
| 87 | + if (php_sapi_name() === 'cli-server' && ((int) getenv('PHP_CLI_SERVER_WORKERS')<2)) { |
|
| 88 | 88 | $localHost = explode(':', $_SERVER['HTTP_HOST']); |
| 89 | 89 | /// @todo support also case where port is null (on either side), and when there is a Proxy in the parameters, |
| 90 | 90 | /// and that proxy is us |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | if (!$skip) { |
| 98 | 98 | // make sure the script waits long enough for the call to complete... |
| 99 | 99 | if ($timeout) { |
| 100 | - set_time_limit($timeout + 10); |
|
| 100 | + set_time_limit($timeout+10); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | if ($wstype == 1) { |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | $server = "$host$path"; |
| 119 | 119 | } |
| 120 | 120 | if ($protocol == 2 || $protocol == 3) { |
| 121 | - $server = 'https://' . $server; |
|
| 121 | + $server = 'https://'.$server; |
|
| 122 | 122 | } else { |
| 123 | - $server = 'http://' . $server; |
|
| 123 | + $server = 'http://'.$server; |
|
| 124 | 124 | } |
| 125 | 125 | if ($proxy != '') { |
| 126 | 126 | $pproxy = explode(':', $proxy); |
| 127 | - if (count($pproxy) > 1) { |
|
| 127 | + if (count($pproxy)>1) { |
|
| 128 | 128 | $pport = $pproxy[1]; |
| 129 | 129 | } else { |
| 130 | 130 | $pport = 8080; |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | case 'wrap': |
| 200 | 200 | $msg[0] = new $requestClass('system.methodHelp', array(), $id); |
| 201 | 201 | $msg[0]->addparam(new PhpXmlRpc\Value($method)); |
| 202 | - $msg[1] = new $requestClass('system.methodSignature', array(), (int)$id + 1); |
|
| 202 | + $msg[1] = new $requestClass('system.methodSignature', array(), (int) $id+1); |
|
| 203 | 203 | $msg[1]->addparam(new PhpXmlRpc\Value($method)); |
| 204 | - $actionname = 'Description of method "' . $method . '"'; |
|
| 204 | + $actionname = 'Description of method "'.$method.'"'; |
|
| 205 | 205 | break; |
| 206 | 206 | case 'list': |
| 207 | 207 | $msg[0] = new $requestClass('system.listMethods', array(), $id); |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | $msg[0] = new $requestClass($method, array(), $id); |
| 215 | 215 | // hack! build payload by hand |
| 216 | 216 | if ($wstype == 1) { |
| 217 | - $payload = "{\n" . |
|
| 218 | - '"method": "' . $method . "\",\n\"params\": [" . |
|
| 219 | - $payload . |
|
| 217 | + $payload = "{\n". |
|
| 218 | + '"method": "'.$method."\",\n\"params\": [". |
|
| 219 | + $payload. |
|
| 220 | 220 | "\n],\n\"id\": "; |
| 221 | 221 | // fix: if user gave an empty string, use NULL, or we'll break json syntax |
| 222 | 222 | if ($id == "") { |
@@ -231,22 +231,22 @@ discard block |
||
| 231 | 231 | $msg[0]->setPayload($payload); |
| 232 | 232 | } else { |
| 233 | 233 | $msg[0]->setPayload( |
| 234 | - $msg[0]->xml_header($inputcharset) . |
|
| 235 | - '<methodName>' . $method . "</methodName>\n<params>" . |
|
| 236 | - $payload . |
|
| 237 | - "</params>\n" . $msg[0]->xml_footer() |
|
| 234 | + $msg[0]->xml_header($inputcharset). |
|
| 235 | + '<methodName>'.$method."</methodName>\n<params>". |
|
| 236 | + $payload. |
|
| 237 | + "</params>\n".$msg[0]->xml_footer() |
|
| 238 | 238 | ); |
| 239 | 239 | } |
| 240 | - $actionname = 'Execution of method ' . $method; |
|
| 240 | + $actionname = 'Execution of method '.$method; |
|
| 241 | 241 | break; |
| 242 | 242 | default: // give a warning |
| 243 | - $actionname = '[ERROR: unknown action] "' . $action . '"'; |
|
| 243 | + $actionname = '[ERROR: unknown action] "'.$action.'"'; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // Before calling execute, echo out brief description of action taken + date and time ??? |
| 248 | 248 | // this gives good user feedback for long-running methods... |
| 249 | - echo '<h2>' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . ' on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . " ...</h2>\n"; |
|
| 249 | + echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset)." ...</h2>\n"; |
|
| 250 | 250 | flush(); |
| 251 | 251 | |
| 252 | 252 | $response = null; |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | break; |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | - $time = microtime(true) - $time; |
|
| 266 | + $time = microtime(true)-$time; |
|
| 267 | 267 | if ($debug) { |
| 268 | 268 | echo "</div>\n"; |
| 269 | 269 | } |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | // call failed! echo out error msg! |
| 274 | 274 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
| 275 | 275 | echo "<h3>$protoName call FAILED!</h3>\n"; |
| 276 | - echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
| 277 | - "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</p>\n"; |
|
| 276 | + echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
| 277 | + "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."'</p>\n"; |
|
| 278 | 278 | echo(date("d/M/Y:H:i:s\n")); |
| 279 | 279 | } else { |
| 280 | 280 | // call succeeded: parse results |
@@ -290,36 +290,36 @@ discard block |
||
| 290 | 290 | $max = $v->count(); |
| 291 | 291 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
| 292 | 292 | echo "<thead>\n<tr><th>Method ($max)</th><th>Description</th></tr>\n</thead>\n<tbody>\n"; |
| 293 | - foreach($v as $i => $rec) { |
|
| 293 | + foreach ($v as $i => $rec) { |
|
| 294 | 294 | if ($i % 2) { |
| 295 | 295 | $class = ' class="oddrow"'; |
| 296 | 296 | } else { |
| 297 | 297 | $class = ' class="evenrow"'; |
| 298 | 298 | } |
| 299 | - echo("<tr><td$class>" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">" . |
|
| 300 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 301 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 302 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 303 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 304 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
| 305 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 306 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 307 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
| 308 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
| 309 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
| 310 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 311 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 312 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 313 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 314 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
| 315 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
| 316 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 317 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
| 318 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 319 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" . |
|
| 320 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
| 321 | - "<input type=\"hidden\" name=\"action\" value=\"describe\" />" . |
|
| 322 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
| 299 | + echo("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
|
| 300 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
| 301 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
| 302 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
| 303 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
| 304 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
| 305 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
| 306 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
| 307 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
| 308 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
| 309 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
| 310 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
| 311 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
| 312 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
| 313 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
| 314 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
| 315 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
| 316 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
| 317 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
| 318 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
| 319 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."\" />". |
|
| 320 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
| 321 | + "<input type=\"hidden\" name=\"action\" value=\"describe\" />". |
|
| 322 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
| 323 | 323 | "<input type=\"submit\" value=\"Describe\" /></form></td>"); |
| 324 | 324 | //echo("</tr>\n"); |
| 325 | 325 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $r2 = $resp[1]->value(); |
| 347 | 347 | |
| 348 | 348 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
| 349 | - echo "<thead>\n<tr><th>Method</th><th>" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
| 349 | + echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
| 350 | 350 | $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
| 351 | 351 | if ($desc == "") { |
| 352 | 352 | $desc = "-"; |
@@ -356,24 +356,24 @@ discard block |
||
| 356 | 356 | if ($r2->kindOf() != "array") { |
| 357 | 357 | echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
| 358 | 358 | } else { |
| 359 | - foreach($r2 as $i => $x) { |
|
| 359 | + foreach ($r2 as $i => $x) { |
|
| 360 | 360 | $payload = ""; |
| 361 | 361 | $alt_payload = ""; |
| 362 | - if ($i + 1 % 2) { |
|
| 362 | + if ($i+1 % 2) { |
|
| 363 | 363 | $class = ' class="oddrow"'; |
| 364 | 364 | } else { |
| 365 | 365 | $class = ' class="evenrow"'; |
| 366 | 366 | } |
| 367 | - echo "<tr><td$class>Signature " . ($i + 1) . "</td><td$class>"; |
|
| 367 | + echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
|
| 368 | 368 | if ($x->kindOf() == "array") { |
| 369 | 369 | $ret = $x[0]; |
| 370 | - echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; |
|
| 371 | - if ($x->count() > 1) { |
|
| 372 | - foreach($x as $k => $y) { |
|
| 370 | + echo "<code>OUT: ".htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."<br />IN: ("; |
|
| 371 | + if ($x->count()>1) { |
|
| 372 | + foreach ($x as $k => $y) { |
|
| 373 | 373 | if ($k == 0) continue; |
| 374 | 374 | echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
| 375 | 375 | if ($wstype == 1) { |
| 376 | - switch($y->scalarval()) { |
|
| 376 | + switch ($y->scalarval()) { |
|
| 377 | 377 | case 'string': |
| 378 | 378 | case 'dateTime.iso8601': |
| 379 | 379 | case 'base64': |
@@ -406,22 +406,22 @@ discard block |
||
| 406 | 406 | } else { |
| 407 | 407 | $type = $y->scalarval(); |
| 408 | 408 | $payload .= '<param><value>'; |
| 409 | - switch($type) { |
|
| 409 | + switch ($type) { |
|
| 410 | 410 | case 'undefined': |
| 411 | 411 | break; |
| 412 | 412 | case 'null'; |
| 413 | 413 | $type = 'nil'; |
| 414 | 414 | // fall thru intentionally |
| 415 | 415 | default: |
| 416 | - $payload .= '<' . |
|
| 417 | - htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
| 418 | - '></' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
| 416 | + $payload .= '<'. |
|
| 417 | + htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
| 418 | + '></'.htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
| 419 | 419 | '>'; |
| 420 | 420 | } |
| 421 | 421 | $payload .= "</value></param>\n"; |
| 422 | 422 | } |
| 423 | 423 | $alt_payload .= $y->scalarval(); |
| 424 | - if ($k < $x->count() - 1) { |
|
| 424 | + if ($k<$x->count()-1) { |
|
| 425 | 425 | $alt_payload .= ';'; |
| 426 | 426 | if ($wstype == 1) { |
| 427 | 427 | $payload .= ', '; |
@@ -437,63 +437,63 @@ discard block |
||
| 437 | 437 | echo '</td>'; |
| 438 | 438 | // button to test this method |
| 439 | 439 | //$payload="<methodCall>\n<methodName>$method</methodName>\n<params>\n$payload</params>\n</methodCall>"; |
| 440 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
| 441 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 442 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 443 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 444 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 445 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
| 446 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 447 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 448 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
| 449 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
| 450 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
| 451 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 452 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 453 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 454 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 455 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
| 456 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
| 457 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 458 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
| 459 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 460 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 461 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 462 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 463 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
| 440 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
| 441 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
| 442 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
| 443 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
| 444 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
| 445 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
| 446 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
| 447 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
| 448 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
| 449 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
| 450 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
| 451 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
| 452 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
| 453 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
| 454 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
| 455 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
| 456 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
| 457 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
| 458 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
| 459 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
| 460 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
| 461 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
| 462 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
| 463 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
| 464 | 464 | "<input type=\"hidden\" name=\"action\" value=\"execute\" />"; |
| 465 | 465 | //if ($wstype != 1) { |
| 466 | 466 | echo "<input type=\"submit\" value=\"Load method synopsis\" />"; |
| 467 | 467 | //} |
| 468 | 468 | echo "</form></td>\n"; |
| 469 | 469 | |
| 470 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
| 471 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 472 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 473 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 474 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 475 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
| 476 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 477 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 478 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
| 479 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
| 480 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
| 481 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 482 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 483 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 484 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 485 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
| 486 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
| 487 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 488 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
| 489 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 490 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 491 | - "<input type=\"hidden\" name=\"methodsig\" value=\"" . $i . "\" />" . |
|
| 492 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 493 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 494 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
| 495 | - "<input type=\"hidden\" name=\"action\" value=\"wrap\" />" . |
|
| 496 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
| 470 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
| 471 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
| 472 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
| 473 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
| 474 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
| 475 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
| 476 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
| 477 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
| 478 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
| 479 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
| 480 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
| 481 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
| 482 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
| 483 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
| 484 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
| 485 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
| 486 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
| 487 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
| 488 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
| 489 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
| 490 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
| 491 | + "<input type=\"hidden\" name=\"methodsig\" value=\"".$i."\" />". |
|
| 492 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
| 493 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
| 494 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
| 495 | + "<input type=\"hidden\" name=\"action\" value=\"wrap\" />". |
|
| 496 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
| 497 | 497 | "<input type=\"submit\" value=\"Generate method call stub code\" />"; |
| 498 | 498 | echo "</form></td></tr>\n"; |
| 499 | 499 | } |
@@ -505,14 +505,14 @@ discard block |
||
| 505 | 505 | case 'wrap': |
| 506 | 506 | $r1 = $resp[0]->value(); |
| 507 | 507 | $r2 = $resp[1]->value(); |
| 508 | - if ($r2->kindOf() != "array" || $r2->count() <= $methodsig) { |
|
| 508 | + if ($r2->kindOf() != "array" || $r2->count()<=$methodsig) { |
|
| 509 | 509 | echo "Error: signature unknown\n"; |
| 510 | 510 | } else { |
| 511 | 511 | $mdesc = $r1->scalarval(); |
| 512 | 512 | $encoder = new PhpXmlRpc\Encoder(); |
| 513 | 513 | $msig = $encoder->decode($r2); |
| 514 | 514 | $msig = $msig[$methodsig]; |
| 515 | - $proto = ($protocol == 1) ? 'http11' : ( $protocol == 2 ? 'https' : ( $protocol == 3 ? 'h2' : ( $protocol == 4 ? 'h2c' : '' ) ) ); |
|
| 515 | + $proto = ($protocol == 1) ? 'http11' : ($protocol == 2 ? 'https' : ($protocol == 3 ? 'h2' : ($protocol == 4 ? 'h2c' : ''))); |
|
| 516 | 516 | if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
| 517 | 517 | $clientcookies == '') { |
| 518 | 518 | $opts = 1; // simple client copy in stub code |
@@ -533,12 +533,12 @@ discard block |
||
| 533 | 533 | $client, |
| 534 | 534 | $method, |
| 535 | 535 | array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix, 'throw_on_fault' => true), |
| 536 | - str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc |
|
| 536 | + str_replace('.', '_', $prefix.'_'.$method), $msig, $mdesc |
|
| 537 | 537 | ); |
| 538 | 538 | //if ($code) |
| 539 | 539 | //{ |
| 540 | 540 | echo "<div id=\"phpcode\">\n"; |
| 541 | - highlight_string("<?php\n" . $code['docstring'] . $code['source']); |
|
| 541 | + highlight_string("<?php\n".$code['docstring'].$code['source']); |
|
| 542 | 542 | echo "\n</div>"; |
| 543 | 543 | //} |
| 544 | 544 | //else |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | break; |
| 550 | 550 | |
| 551 | 551 | case 'execute': |
| 552 | - echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>'; |
|
| 552 | + echo '<div id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>'; |
|
| 553 | 553 | break; |
| 554 | 554 | |
| 555 | 555 | default: // give a warning |