@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | // user declares the type of resp value: we "almost" trust it... but log errors just in case |
| 79 | 79 | if (($this->valtyp == 'xmlrpcvals' && (!is_a($this->val, 'PhpXmlRpc\Value'))) || |
| 80 | 80 | ($this->valtyp == 'xml' && (!is_string($this->val)))) { |
| 81 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in does not match type ' . $valType); |
|
| 81 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in does not match type '.$valType); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -165,34 +165,34 @@ discard block |
||
| 165 | 165 | public function serialize($charsetEncoding = '') |
| 166 | 166 | { |
| 167 | 167 | if ($charsetEncoding != '') { |
| 168 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
| 168 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
| 169 | 169 | } else { |
| 170 | 170 | $this->content_type = 'text/xml'; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
| 174 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
| 174 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
| 175 | 175 | } else { |
| 176 | 176 | $result = "<methodResponse>\n"; |
| 177 | 177 | } |
| 178 | 178 | if ($this->errno) { |
| 179 | 179 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
| 180 | - $result .= "<fault>\n" . |
|
| 181 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
| 182 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
| 183 | - $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . |
|
| 180 | + $result .= "<fault>\n". |
|
| 181 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
| 182 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
| 183 | + $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding). |
|
| 184 | 184 | "</string></value>\n</member>\n</struct>\n</value>\n</fault>"; |
| 185 | 185 | } else { |
| 186 | 186 | if (is_object($this->val) && is_a($this->val, 'PhpXmlRpc\Value')) { |
| 187 | - $result .= "<params>\n<param>\n" . $this->val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
| 187 | + $result .= "<params>\n<param>\n".$this->val->serialize($charsetEncoding)."</param>\n</params>"; |
|
| 188 | 188 | } else if (is_string($this->val) && $this->valtyp == 'xml') { |
| 189 | - $result .= "<params>\n<param>\n" . |
|
| 190 | - $this->val . |
|
| 189 | + $result .= "<params>\n<param>\n". |
|
| 190 | + $this->val. |
|
| 191 | 191 | "</param>\n</params>"; |
| 192 | 192 | } else if ($this->valtyp == 'phpvals') { |
| 193 | 193 | $encoder = new Encoder(); |
| 194 | 194 | $val = $encoder->encode($this->val); |
| 195 | - $result .= "<params>\n<param>\n" . $val->serialize($charsetEncoding) . "</param>\n</params>"; |
|
| 195 | + $result .= "<params>\n<param>\n".$val->serialize($charsetEncoding)."</param>\n</params>"; |
|
| 196 | 196 | } else { |
| 197 | 197 | throw new StateErrorException('cannot serialize xmlrpc response objects whose content is native php values'); |
| 198 | 198 | } |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | public function xml_header($charsetEncoding = '') |
| 212 | 212 | { |
| 213 | 213 | if ($charsetEncoding != '') { |
| 214 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 214 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 215 | 215 | } else { |
| 216 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 216 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
@@ -229,21 +229,21 @@ discard block |
||
| 229 | 229 | case 'errstr': |
| 230 | 230 | case 'payload': |
| 231 | 231 | case 'content_type': |
| 232 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 232 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 233 | 233 | return $this->$name; |
| 234 | 234 | case 'hdrs': |
| 235 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 235 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 236 | 236 | return $this->httpResponse['headers']; |
| 237 | 237 | case '_cookies': |
| 238 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 238 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 239 | 239 | return $this->httpResponse['cookies']; |
| 240 | 240 | case 'raw_data': |
| 241 | - $this->logDeprecation('Getting property Response::' . $name . ' is deprecated'); |
|
| 241 | + $this->logDeprecation('Getting property Response::'.$name.' is deprecated'); |
|
| 242 | 242 | return $this->httpResponse['raw_data']; |
| 243 | 243 | default: |
| 244 | 244 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 245 | 245 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 246 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 246 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 247 | 247 | $result = null; |
| 248 | 248 | return $result; |
| 249 | 249 | } |
@@ -258,25 +258,25 @@ discard block |
||
| 258 | 258 | case 'errstr': |
| 259 | 259 | case 'payload': |
| 260 | 260 | case 'content_type': |
| 261 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 261 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 262 | 262 | $this->$name = $value; |
| 263 | 263 | break; |
| 264 | 264 | case 'hdrs': |
| 265 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 265 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 266 | 266 | $this->httpResponse['headers'] = $value; |
| 267 | 267 | break; |
| 268 | 268 | case '_cookies': |
| 269 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 269 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 270 | 270 | $this->httpResponse['cookies'] = $value; |
| 271 | 271 | break; |
| 272 | 272 | case 'raw_data': |
| 273 | - $this->logDeprecation('Setting property Response::' . $name . ' is deprecated'); |
|
| 273 | + $this->logDeprecation('Setting property Response::'.$name.' is deprecated'); |
|
| 274 | 274 | $this->httpResponse['raw_data'] = $value; |
| 275 | 275 | break; |
| 276 | 276 | default: |
| 277 | 277 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 278 | 278 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 279 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 279 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | |
@@ -289,16 +289,16 @@ discard block |
||
| 289 | 289 | case 'errstr': |
| 290 | 290 | case 'payload': |
| 291 | 291 | case 'content_type': |
| 292 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 292 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 293 | 293 | return isset($this->$name); |
| 294 | 294 | case 'hdrs': |
| 295 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 295 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 296 | 296 | return isset($this->httpResponse['headers']); |
| 297 | 297 | case '_cookies': |
| 298 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 298 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 299 | 299 | return isset($this->httpResponse['cookies']); |
| 300 | 300 | case 'raw_data': |
| 301 | - $this->logDeprecation('Checking property Response::' . $name . ' is deprecated'); |
|
| 301 | + $this->logDeprecation('Checking property Response::'.$name.' is deprecated'); |
|
| 302 | 302 | return isset($this->httpResponse['raw_data']); |
| 303 | 303 | default: |
| 304 | 304 | return false; |
@@ -314,25 +314,25 @@ discard block |
||
| 314 | 314 | case 'errstr': |
| 315 | 315 | case 'payload': |
| 316 | 316 | case 'content_type': |
| 317 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 317 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 318 | 318 | unset($this->$name); |
| 319 | 319 | break; |
| 320 | 320 | case 'hdrs': |
| 321 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 321 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 322 | 322 | unset($this->httpResponse['headers']); |
| 323 | 323 | break; |
| 324 | 324 | case '_cookies': |
| 325 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 325 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 326 | 326 | unset($this->httpResponse['cookies']); |
| 327 | 327 | break; |
| 328 | 328 | case 'raw_data': |
| 329 | - $this->logDeprecation('Unsetting property Response::' . $name . ' is deprecated'); |
|
| 329 | + $this->logDeprecation('Unsetting property Response::'.$name.' is deprecated'); |
|
| 330 | 330 | unset($this->httpResponse['raw_data']); |
| 331 | 331 | break; |
| 332 | 332 | default: |
| 333 | 333 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 334 | 334 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 335 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 335 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | public function getOptions() |
| 252 | 252 | { |
| 253 | 253 | $values = array(); |
| 254 | - foreach(static::$options as $opt) { |
|
| 254 | + foreach (static::$options as $opt) { |
|
| 255 | 255 | $values[$opt] = $this->getOption($opt); |
| 256 | 256 | } |
| 257 | 257 | return $values; |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | public function setOptions($options) |
| 266 | 266 | { |
| 267 | - foreach($options as $name => $value) { |
|
| 267 | + foreach ($options as $name => $value) { |
|
| 268 | 268 | $this->setOption($name, $value); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public static function xmlrpc_debugmsg($msg) |
| 304 | 304 | { |
| 305 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
| 305 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | public static function error_occurred($msg) |
| 316 | 316 | { |
| 317 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
| 317 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
@@ -335,10 +335,10 @@ discard block |
||
| 335 | 335 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
| 336 | 336 | $out = ''; |
| 337 | 337 | if ($this->debug_info != '') { |
| 338 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
| 338 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
| 339 | 339 | } |
| 340 | 340 | if (static::$_xmlrpc_debuginfo != '') { |
| 341 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
| 341 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
| 342 | 342 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
| 343 | 343 | // into return payload AFTER the beginning tag |
| 344 | 344 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | $this->debug_info = ''; |
| 368 | 368 | |
| 369 | 369 | // Save what we received, before parsing it |
| 370 | - if ($this->debug > 1) { |
|
| 371 | - $this->debugMsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
| 370 | + if ($this->debug>1) { |
|
| 371 | + $this->debugMsg("+++GOT+++\n".$data."\n+++END+++"); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -385,9 +385,9 @@ discard block |
||
| 385 | 385 | $resp->raw_data = $rawData; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
| 389 | - $this->debugMsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
| 390 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
| 388 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
| 389 | + $this->debugMsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
| 390 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | $payload = $this->generatePayload($resp, $respCharset); |
@@ -482,9 +482,9 @@ discard block |
||
| 482 | 482 | $numParams = count($in); |
| 483 | 483 | } |
| 484 | 484 | foreach ($sigs as $curSig) { |
| 485 | - if (count($curSig) == $numParams + 1) { |
|
| 485 | + if (count($curSig) == $numParams+1) { |
|
| 486 | 486 | $itsOK = 1; |
| 487 | - for ($n = 0; $n < $numParams; $n++) { |
|
| 487 | + for ($n = 0; $n<$numParams; $n++) { |
|
| 488 | 488 | if (is_object($in)) { |
| 489 | 489 | $p = $in->getParam($n); |
| 490 | 490 | if ($p->kindOf() == 'scalar') { |
@@ -497,10 +497,10 @@ discard block |
||
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | // param index is $n+1, as first member of sig is return type |
| 500 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
| 500 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
| 501 | 501 | $itsOK = 0; |
| 502 | - $pno = $n + 1; |
|
| 503 | - $wanted = $curSig[$n + 1]; |
|
| 502 | + $pno = $n+1; |
|
| 503 | + $wanted = $curSig[$n+1]; |
|
| 504 | 504 | $got = $pt; |
| 505 | 505 | break; |
| 506 | 506 | } |
@@ -527,10 +527,10 @@ discard block |
||
| 527 | 527 | // check if $_SERVER is populated: it might have been disabled via ini file |
| 528 | 528 | // (this is true even when in CLI mode) |
| 529 | 529 | if (count($_SERVER) == 0) { |
| 530 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
| 530 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - if ($this->debug > 1) { |
|
| 533 | + if ($this->debug>1) { |
|
| 534 | 534 | if (function_exists('getallheaders')) { |
| 535 | 535 | $this->debugMsg(''); // empty line |
| 536 | 536 | foreach (getallheaders() as $name => $val) { |
@@ -555,13 +555,13 @@ discard block |
||
| 555 | 555 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
| 556 | 556 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 557 | 557 | $data = $degzdata; |
| 558 | - if ($this->debug > 1) { |
|
| 559 | - $this->debugMsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 558 | + if ($this->debug>1) { |
|
| 559 | + $this->debugMsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 560 | 560 | } |
| 561 | 561 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 562 | 562 | $data = $degzdata; |
| 563 | - if ($this->debug > 1) { |
|
| 564 | - $this->debugMsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
| 563 | + if ($this->debug>1) { |
|
| 564 | + $this->debugMsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
| 565 | 565 | } |
| 566 | 566 | } else { |
| 567 | 567 | $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | if ($reqEncoding == 'ISO-8859-1') { |
| 650 | 650 | $data = utf8_encode($data); |
| 651 | 651 | } else { |
| 652 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
| 652 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
| 653 | 653 | } |
| 654 | 654 | } |
| 655 | 655 | } |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | preg_match('/^XML error ([0-9]+)/', $_xh['isf_reason'], $matches); |
| 684 | 684 | return new static::$responseClass( |
| 685 | 685 | 0, |
| 686 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
| 686 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
| 687 | 687 | $_xh['isf_reason']); |
| 688 | 688 | } elseif ($_xh['isf']) { |
| 689 | 689 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | return new static::$responseClass( |
| 692 | 692 | 0, |
| 693 | 693 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
| 694 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $_xh['isf_reason']); |
|
| 694 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$_xh['isf_reason']); |
|
| 695 | 695 | } else { |
| 696 | 696 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
| 697 | 697 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -701,8 +701,8 @@ discard block |
||
| 701 | 701 | ($this->dmap[$_xh['method']]['parameters_type'] != 'xmlrpcvals') |
| 702 | 702 | ) |
| 703 | 703 | ) { |
| 704 | - if ($this->debug > 1) { |
|
| 705 | - $this->debugMsg("\n+++PARSED+++\n" . var_export($_xh['params'], true) . "\n+++END+++"); |
|
| 704 | + if ($this->debug>1) { |
|
| 705 | + $this->debugMsg("\n+++PARSED+++\n".var_export($_xh['params'], true)."\n+++END+++"); |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | return $this->execute($_xh['method'], $_xh['params'], $_xh['pt']); |
@@ -710,12 +710,12 @@ discard block |
||
| 710 | 710 | // build a Request object with data parsed from xml and add parameters in |
| 711 | 711 | $req = new Request($_xh['method']); |
| 712 | 712 | /// @todo for more speed, we could just pass in the array to the constructor (and loose the type validation)... |
| 713 | - for ($i = 0; $i < count($_xh['params']); $i++) { |
|
| 713 | + for ($i = 0; $i<count($_xh['params']); $i++) { |
|
| 714 | 714 | $req->addParam($_xh['params'][$i]); |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | - if ($this->debug > 1) { |
|
| 718 | - $this->debugMsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
| 717 | + if ($this->debug>1) { |
|
| 718 | + $this->debugMsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | return $this->execute($req); |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | return new static::$responseClass( |
| 766 | 766 | 0, |
| 767 | 767 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 768 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
| 768 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
| 769 | 769 | ); |
| 770 | 770 | } |
| 771 | 771 | } |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | // build string representation of function 'name' |
| 781 | 781 | if (is_array($func)) { |
| 782 | 782 | if (is_object($func[0])) { |
| 783 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
| 783 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
| 784 | 784 | } else { |
| 785 | 785 | $funcName = implode('::', $func); |
| 786 | 786 | } |
@@ -792,16 +792,16 @@ discard block |
||
| 792 | 792 | |
| 793 | 793 | // verify that function to be invoked is in fact callable |
| 794 | 794 | if (!is_callable($func)) { |
| 795 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
| 795 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
| 796 | 796 | return new static::$responseClass( |
| 797 | 797 | 0, |
| 798 | 798 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 799 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
| 799 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
| 800 | 800 | ); |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | if (isset($dmap[$methodName]['exception_handling'])) { |
| 804 | - $exception_handling = (int)$dmap[$methodName]['exception_handling']; |
|
| 804 | + $exception_handling = (int) $dmap[$methodName]['exception_handling']; |
|
| 805 | 805 | } else { |
| 806 | 806 | $exception_handling = $this->exception_handling; |
| 807 | 807 | } |
@@ -822,14 +822,14 @@ discard block |
||
| 822 | 822 | $r = call_user_func($func, $req); |
| 823 | 823 | } |
| 824 | 824 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
| 825 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
| 825 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
| 826 | 826 | if (is_a($r, 'PhpXmlRpc\Value')) { |
| 827 | 827 | $r = new static::$responseClass($r); |
| 828 | 828 | } else { |
| 829 | 829 | $r = new static::$responseClass( |
| 830 | 830 | 0, |
| 831 | 831 | PhpXmlRpc::$xmlrpcerr['server_error'], |
| 832 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
| 832 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
| 833 | 833 | ); |
| 834 | 834 | } |
| 835 | 835 | } |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
| 845 | 845 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
| 846 | 846 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
| 847 | - $r = new static::$responseClass(0, (int)$r['faultCode'], (string)$r['faultString']); |
|
| 847 | + $r = new static::$responseClass(0, (int) $r['faultCode'], (string) $r['faultString']); |
|
| 848 | 848 | } else { |
| 849 | 849 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
| 850 | 850 | // return type correctly |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | protected function generatePayload($resp, $respCharset) |
| 931 | 931 | { |
| 932 | 932 | $header = $resp->xml_header($respCharset); |
| 933 | - if ($this->debug > 0) { |
|
| 933 | + if ($this->debug>0) { |
|
| 934 | 934 | $header .= $this->serializeDebug($respCharset); |
| 935 | 935 | } |
| 936 | 936 | |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | $payload = $resp->serialize($respCharset); |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | - return $header . $payload; |
|
| 945 | + return $header.$payload; |
|
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | /** |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | // if we get a warning/error that has output some text before here, then we cannot |
| 957 | 957 | // add a new header. We cannot say we are sending xml, either... |
| 958 | 958 | if (!headers_sent()) { |
| 959 | - header('Content-Type: ' . $respContentType); |
|
| 959 | + header('Content-Type: '.$respContentType); |
|
| 960 | 960 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
| 961 | 961 | header("Vary: Accept-Charset"); |
| 962 | 962 | |
@@ -979,12 +979,12 @@ discard block |
||
| 979 | 979 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
| 980 | 980 | // responses up to 8000 bytes |
| 981 | 981 | if ($phpNoSelfCompress) { |
| 982 | - header('Content-Length: ' . (int)strlen($payload)); |
|
| 982 | + header('Content-Length: '.(int) strlen($payload)); |
|
| 983 | 983 | } |
| 984 | 984 | } else { |
| 985 | 985 | /// @todo allow the user to easily subclass this in a way which allows the resp. headers to be already sent |
| 986 | 986 | /// by now without flagging it as an error. Possibly check for presence of Content-Type header |
| 987 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 987 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | print $payload; |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | */ |
| 1044 | 1044 | protected function debugMsg($string) |
| 1045 | 1045 | { |
| 1046 | - $this->debug_info .= $string . "\n"; |
|
| 1046 | + $this->debug_info .= $string."\n"; |
|
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | /** |
@@ -1335,7 +1335,7 @@ discard block |
||
| 1335 | 1335 | $i++; // for error message, we count params from 1 |
| 1336 | 1336 | return static::_xmlrpcs_multicall_error(new static::$responseClass(0, |
| 1337 | 1337 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
| 1338 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
| 1338 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
| 1339 | 1339 | } |
| 1340 | 1340 | } |
| 1341 | 1341 | |
@@ -1416,7 +1416,7 @@ discard block |
||
| 1416 | 1416 | } |
| 1417 | 1417 | } else { |
| 1418 | 1418 | $numCalls = count($req); |
| 1419 | - for ($i = 0; $i < $numCalls; $i++) { |
|
| 1419 | + for ($i = 0; $i<$numCalls; $i++) { |
|
| 1420 | 1420 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
| 1421 | 1421 | } |
| 1422 | 1422 | } |
@@ -1444,7 +1444,7 @@ discard block |
||
| 1444 | 1444 | // From PHP 8.4 the E_STRICT constant has been deprecated and will emit deprecation notices. |
| 1445 | 1445 | // PHP core and core extensions since PHP 8.0 and later do not emit E_STRICT notices at all. |
| 1446 | 1446 | // On PHP 7 series before PHP 7.4, some functions conditionally emit E_STRICT notices. |
| 1447 | - if (PHP_VERSION_ID >= 70400) { |
|
| 1447 | + if (PHP_VERSION_ID>=70400) { |
|
| 1448 | 1448 | static::error_occurred($errString); |
| 1449 | 1449 | } elseif ($errCode != E_STRICT) { |
| 1450 | 1450 | static::error_occurred($errString); |
@@ -1485,12 +1485,12 @@ discard block |
||
| 1485 | 1485 | */ |
| 1486 | 1486 | protected function xml_header($charsetEncoding = '') |
| 1487 | 1487 | { |
| 1488 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 1488 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 1489 | 1489 | |
| 1490 | 1490 | if ($charsetEncoding != '') { |
| 1491 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
| 1491 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
| 1492 | 1492 | } else { |
| 1493 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
| 1493 | + return "<?xml version=\"1.0\"?".">\n"; |
|
| 1494 | 1494 | } |
| 1495 | 1495 | } |
| 1496 | 1496 | |
@@ -1506,7 +1506,7 @@ discard block |
||
| 1506 | 1506 | case self::OPT_FUNCTIONS_PARAMETERS_TYPE: |
| 1507 | 1507 | case self::OPT_PHPVALS_ENCODING_OPTIONS: |
| 1508 | 1508 | case self::OPT_RESPONSE_CHARSET_ENCODING: |
| 1509 | - $this->logDeprecation('Getting property Request::' . $name . ' is deprecated'); |
|
| 1509 | + $this->logDeprecation('Getting property Request::'.$name.' is deprecated'); |
|
| 1510 | 1510 | return $this->$name; |
| 1511 | 1511 | case 'accepted_charset_encodings': |
| 1512 | 1512 | // manually implement the 'protected property' behaviour |
@@ -1518,16 +1518,16 @@ discard block |
||
| 1518 | 1518 | } |
| 1519 | 1519 | } |
| 1520 | 1520 | if ($canAccess) { |
| 1521 | - $this->logDeprecation('Getting property Request::' . $name . ' is deprecated'); |
|
| 1521 | + $this->logDeprecation('Getting property Request::'.$name.' is deprecated'); |
|
| 1522 | 1522 | return $this->accepted_compression; |
| 1523 | 1523 | } else { |
| 1524 | - trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR); |
|
| 1524 | + trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR); |
|
| 1525 | 1525 | } |
| 1526 | 1526 | break; |
| 1527 | 1527 | default: |
| 1528 | 1528 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 1529 | 1529 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 1530 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1530 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1531 | 1531 | $result = null; |
| 1532 | 1532 | return $result; |
| 1533 | 1533 | } |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | case self::OPT_FUNCTIONS_PARAMETERS_TYPE: |
| 1545 | 1545 | case self::OPT_PHPVALS_ENCODING_OPTIONS: |
| 1546 | 1546 | case self::OPT_RESPONSE_CHARSET_ENCODING: |
| 1547 | - $this->logDeprecation('Setting property Request::' . $name . ' is deprecated'); |
|
| 1547 | + $this->logDeprecation('Setting property Request::'.$name.' is deprecated'); |
|
| 1548 | 1548 | $this->$name = $value; |
| 1549 | 1549 | break; |
| 1550 | 1550 | case 'accepted_charset_encodings': |
@@ -1557,16 +1557,16 @@ discard block |
||
| 1557 | 1557 | } |
| 1558 | 1558 | } |
| 1559 | 1559 | if ($canAccess) { |
| 1560 | - $this->logDeprecation('Setting property Request::' . $name . ' is deprecated'); |
|
| 1560 | + $this->logDeprecation('Setting property Request::'.$name.' is deprecated'); |
|
| 1561 | 1561 | $this->accepted_compression = $value; |
| 1562 | 1562 | } else { |
| 1563 | - trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR); |
|
| 1563 | + trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR); |
|
| 1564 | 1564 | } |
| 1565 | 1565 | break; |
| 1566 | 1566 | default: |
| 1567 | 1567 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 1568 | 1568 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 1569 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1569 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1570 | 1570 | } |
| 1571 | 1571 | } |
| 1572 | 1572 | |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | case self::OPT_FUNCTIONS_PARAMETERS_TYPE: |
| 1582 | 1582 | case self::OPT_PHPVALS_ENCODING_OPTIONS: |
| 1583 | 1583 | case self::OPT_RESPONSE_CHARSET_ENCODING: |
| 1584 | - $this->logDeprecation('Checking property Request::' . $name . ' is deprecated'); |
|
| 1584 | + $this->logDeprecation('Checking property Request::'.$name.' is deprecated'); |
|
| 1585 | 1585 | return isset($this->$name); |
| 1586 | 1586 | case 'accepted_charset_encodings': |
| 1587 | 1587 | // manually implement the 'protected property' behaviour |
@@ -1593,7 +1593,7 @@ discard block |
||
| 1593 | 1593 | } |
| 1594 | 1594 | } |
| 1595 | 1595 | if ($canAccess) { |
| 1596 | - $this->logDeprecation('Checking property Request::' . $name . ' is deprecated'); |
|
| 1596 | + $this->logDeprecation('Checking property Request::'.$name.' is deprecated'); |
|
| 1597 | 1597 | return isset($this->accepted_compression); |
| 1598 | 1598 | } |
| 1599 | 1599 | // break through voluntarily |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | case self::OPT_FUNCTIONS_PARAMETERS_TYPE: |
| 1614 | 1614 | case self::OPT_PHPVALS_ENCODING_OPTIONS: |
| 1615 | 1615 | case self::OPT_RESPONSE_CHARSET_ENCODING: |
| 1616 | - $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated'); |
|
| 1616 | + $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated'); |
|
| 1617 | 1617 | unset($this->$name); |
| 1618 | 1618 | break; |
| 1619 | 1619 | case 'accepted_charset_encodings': |
@@ -1626,16 +1626,16 @@ discard block |
||
| 1626 | 1626 | } |
| 1627 | 1627 | } |
| 1628 | 1628 | if ($canAccess) { |
| 1629 | - $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated'); |
|
| 1629 | + $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated'); |
|
| 1630 | 1630 | unset($this->accepted_compression); |
| 1631 | 1631 | } else { |
| 1632 | - trigger_error("Cannot access protected property Server::accepted_charset_encodings in " . __FILE__, E_USER_ERROR); |
|
| 1632 | + trigger_error("Cannot access protected property Server::accepted_charset_encodings in ".__FILE__, E_USER_ERROR); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | break; |
| 1635 | 1635 | default: |
| 1636 | 1636 | /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout... |
| 1637 | 1637 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 1638 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
| 1638 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
| 1639 | 1639 | } |
| 1640 | 1640 | } |
| 1641 | 1641 | } |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | // read chunk-size, chunk-extension (if any) and crlf |
| 30 | 30 | // get the position of the linebreak |
| 31 | - $chunkEnd = strpos($buffer, "\r\n") + 2; |
|
| 31 | + $chunkEnd = strpos($buffer, "\r\n")+2; |
|
| 32 | 32 | $temp = substr($buffer, 0, $chunkEnd); |
| 33 | 33 | $chunkSize = hexdec(trim($temp)); |
| 34 | 34 | $chunkStart = $chunkEnd; |
| 35 | - while ($chunkSize > 0) { |
|
| 36 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize); |
|
| 35 | + while ($chunkSize>0) { |
|
| 36 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize); |
|
| 37 | 37 | |
| 38 | 38 | // just in case we got a broken connection |
| 39 | 39 | if ($chunkEnd == false) { |
@@ -45,19 +45,19 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // read chunk-data and crlf |
| 48 | - $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
| 48 | + $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
| 49 | 49 | // append chunk-data to entity-body |
| 50 | 50 | $new .= $chunk; |
| 51 | 51 | // length := length + chunk-size |
| 52 | 52 | $length += strlen($chunk); |
| 53 | 53 | // read chunk-size and crlf |
| 54 | - $chunkStart = $chunkEnd + 2; |
|
| 54 | + $chunkStart = $chunkEnd+2; |
|
| 55 | 55 | |
| 56 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2; |
|
| 56 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2; |
|
| 57 | 57 | if ($chunkEnd == false) { |
| 58 | 58 | break; // just in case we got a broken connection |
| 59 | 59 | } |
| 60 | - $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
| 60 | + $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
| 61 | 61 | $chunkSize = hexdec(trim($temp)); |
| 62 | 62 | $chunkStart = $chunkEnd; |
| 63 | 63 | } |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | // Look for CR/LF or simple LF as line separator (even though it is not valid http) |
| 87 | 87 | $pos = strpos($data, "\r\n\r\n"); |
| 88 | 88 | if ($pos || is_int($pos)) { |
| 89 | - $bd = $pos + 4; |
|
| 89 | + $bd = $pos+4; |
|
| 90 | 90 | } else { |
| 91 | 91 | $pos = strpos($data, "\n\n"); |
| 92 | 92 | if ($pos || is_int($pos)) { |
| 93 | - $bd = $pos + 2; |
|
| 93 | + $bd = $pos+2; |
|
| 94 | 94 | } else { |
| 95 | 95 | // No separation between response headers and body: fault? |
| 96 | 96 | $bd = 0; |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | // this filters out all http headers from proxy. maybe we could take them into account, too? |
| 101 | 101 | $data = substr($data, $bd); |
| 102 | 102 | } else { |
| 103 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed'); |
|
| 104 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
| 103 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed'); |
|
| 104 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -134,19 +134,19 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if (!in_array($httpResponse['status_code'], $this->acceptedStatusCodes)) { |
| 137 | - $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
| 138 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr); |
|
| 139 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
| 137 | + $errstr = substr($data, 0, strpos($data, "\n")-1); |
|
| 138 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr); |
|
| 139 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http) |
| 143 | 143 | $pos = strpos($data, "\r\n\r\n"); |
| 144 | 144 | if ($pos || is_int($pos)) { |
| 145 | - $bd = $pos + 4; |
|
| 145 | + $bd = $pos+4; |
|
| 146 | 146 | } else { |
| 147 | 147 | $pos = strpos($data, "\n\n"); |
| 148 | 148 | if ($pos || is_int($pos)) { |
| 149 | - $bd = $pos + 2; |
|
| 149 | + $bd = $pos+2; |
|
| 150 | 150 | } else { |
| 151 | 151 | // No separation between response headers and body: fault? |
| 152 | 152 | // we could take some action here instead of going on... |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | foreach ($ar as $line) { |
| 161 | 161 | // take care of (multi-line) headers and cookies |
| 162 | 162 | $arr = explode(':', $line, 2); |
| 163 | - if (count($arr) > 1) { |
|
| 163 | + if (count($arr)>1) { |
|
| 164 | 164 | /// @todo according to https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should reject with error |
| 165 | 165 | /// 400 any messages where a space is present between the header name and colon |
| 166 | 166 | $headerName = strtolower(trim($arr[0])); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $cookie = $arr[1]; |
| 169 | 169 | // glue together all received cookies, using a comma to separate them (same as php does with getallheaders()) |
| 170 | 170 | if (isset($httpResponse['headers'][$headerName])) { |
| 171 | - $httpResponse['headers'][$headerName] .= ', ' . trim($cookie); |
|
| 171 | + $httpResponse['headers'][$headerName] .= ', '.trim($cookie); |
|
| 172 | 172 | } else { |
| 173 | 173 | $httpResponse['headers'][$headerName] = trim($cookie); |
| 174 | 174 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } elseif (isset($headerName)) { |
| 200 | 200 | /// @todo improve this: 1. check that the line starts with a space or tab; 2. according to |
| 201 | 201 | /// https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should flat out refuse these messages |
| 202 | - $httpResponse['headers'][$headerName] .= ' ' . trim($line); |
|
| 202 | + $httpResponse['headers'][$headerName] .= ' '.trim($line); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | // Decode chunked encoding sent by http 1.1 servers |
| 223 | 223 | if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') { |
| 224 | 224 | if (!$data = static::decodeChunked($data)) { |
| 225 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server'); |
|
| 225 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server'); |
|
| 226 | 226 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']); |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -237,19 +237,19 @@ discard block |
||
| 237 | 237 | if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { |
| 238 | 238 | $data = $degzdata; |
| 239 | 239 | if ($debug) { |
| 240 | - $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
| 240 | + $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
| 241 | 241 | } |
| 242 | 242 | } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
| 243 | 243 | $data = $degzdata; |
| 244 | 244 | if ($debug) { |
| 245 | - $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
| 245 | + $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
| 246 | 246 | } |
| 247 | 247 | } else { |
| 248 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server'); |
|
| 248 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server'); |
|
| 249 | 249 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']); |
| 250 | 250 | } |
| 251 | 251 | } else { |
| 252 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
| 252 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
| 253 | 253 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']); |
| 254 | 254 | } |
| 255 | 255 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | public function parseAcceptHeader($header) |
| 270 | 270 | { |
| 271 | 271 | $accepted = array(); |
| 272 | - foreach(explode(',', $header) as $c) { |
|
| 272 | + foreach (explode(',', $header) as $c) { |
|
| 273 | 273 | if (preg_match('/^([^;]+); *q=([0-9.]+)/', $c, $matches)) { |
| 274 | 274 | $c = $matches[1]; |
| 275 | 275 | $w = $matches[2]; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $payload, $alt_payload, $username, $password, $authtype, $verifyhost, $verifypeer, $cainfo, $proxy, $proxyuser, |
| 22 | 22 | $proxypwd, $timeout, $requestcompression, $responsecompression, $clientcookies; |
| 23 | 23 | |
| 24 | -include __DIR__ . '/common.php'; |
|
| 24 | +include __DIR__.'/common.php'; |
|
| 25 | 25 | |
| 26 | 26 | if ($action == '') { |
| 27 | 27 | $action = 'list'; |
@@ -38,30 +38,30 @@ discard block |
||
| 38 | 38 | /// @const JSXMLRPC_PATH Path to the visual xml-rpc editing dialog's containing folder. Can be absolute, or |
| 39 | 39 | /// relative to this debugger's folder. |
| 40 | 40 | if (defined('JSXMLRPC_PATH')) { |
| 41 | - $editorpaths = array(JSXMLRPC_PATH[0] === '/' ? JSXMLRPC_PATH : (__DIR__ . '/' . JSXMLRPC_PATH)); |
|
| 41 | + $editorpaths = array(JSXMLRPC_PATH[0] === '/' ? JSXMLRPC_PATH : (__DIR__.'/'.JSXMLRPC_PATH)); |
|
| 42 | 42 | } else { |
| 43 | 43 | $editorpaths = array( |
| 44 | - __DIR__ . '/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via taskfile |
|
| 45 | - __DIR__ . '/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer inside the debugger |
|
| 46 | - __DIR__ . '/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm inside the debugger |
|
| 47 | - __DIR__ . '/../vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer |
|
| 48 | - __DIR__ . '/../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm |
|
| 49 | - __DIR__ . '/../../jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc too |
|
| 50 | - __DIR__ . '/../../../../debugger/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level via taskfile (ie. jsonrpc) |
|
| 51 | - __DIR__ . '/../../../../debugger/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level debugger via composer |
|
| 52 | - __DIR__ . '/../../../../debugger/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level debugger via npm |
|
| 53 | - __DIR__ . '/../../../../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed via npm in the top-level project |
|
| 44 | + __DIR__.'/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via taskfile |
|
| 45 | + __DIR__.'/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer inside the debugger |
|
| 46 | + __DIR__.'/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm inside the debugger |
|
| 47 | + __DIR__.'/../vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer |
|
| 48 | + __DIR__.'/../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm |
|
| 49 | + __DIR__.'/../../jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc too |
|
| 50 | + __DIR__.'/../../../../debugger/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level via taskfile (ie. jsonrpc) |
|
| 51 | + __DIR__.'/../../../../debugger/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level debugger via composer |
|
| 52 | + __DIR__.'/../../../../debugger/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed in the top-level debugger via npm |
|
| 53 | + __DIR__.'/../../../../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed via npm in the top-level project |
|
| 54 | 54 | ); |
| 55 | 55 | } |
| 56 | - foreach($editorpaths as $editorpath) { |
|
| 57 | - if (is_file(realpath($editorpath . 'visualeditor.html'))) { |
|
| 56 | + foreach ($editorpaths as $editorpath) { |
|
| 57 | + if (is_file(realpath($editorpath.'visualeditor.html'))) { |
|
| 58 | 58 | $haseditor = true; |
| 59 | 59 | break; |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | if ($haseditor) { |
| 63 | - $controllerRootUrl = str_replace('/controller.php', '', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); |
|
| 64 | - $editorurlpath = $controllerRootUrl . '/' . preg_replace('|^' . preg_quote(__DIR__, '|') .'|', '', $editorpath); |
|
| 63 | + $controllerRootUrl = str_replace('/controller.php', '', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); |
|
| 64 | + $editorurlpath = $controllerRootUrl.'/'.preg_replace('|^'.preg_quote(__DIR__, '|').'|', '', $editorpath); |
|
| 65 | 65 | /// @todo for cases above 4 and up, look at $controllerRootUrl and check if the web root is not pointing directly |
| 66 | 66 | /// at this folder, as in that case the link to the visualeditor will not |
| 67 | 67 | /// work, as it will be in the form http(s)://domain/../../jsxmlrpc/debugger/visualeditor.html |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | function activateeditor() { |
| 249 | - var url = '<?php echo $editorurlpath; ?>visualeditor.html?params=<?php echo str_replace(array("\\", "'"), array( "\\\\", "\\'"), $alt_payload); ?>'; |
|
| 249 | + var url = '<?php echo $editorurlpath; ?>visualeditor.html?params=<?php echo str_replace(array("\\", "'"), array("\\\\", "\\'"), $alt_payload); ?>'; |
|
| 250 | 250 | if (document.frmaction.wstype.value == "1" || document.frmaction.wstype.value == "2") |
| 251 | 251 | url += '&type=jsonrpc'; |
| 252 | 252 | var wnd = window.open(url, '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1'); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | JSON-RPC 1.0 '; |
| 295 | 295 | } ?> |
| 296 | 296 | Debugger</h1><h3>(based on <a href="https://gggeek.github.io/phpxmlrpc/">PHPXMLRPC</a>, ver. <?php echo htmlspecialchars(\PhpXmlRpc\PhpXmlRpc::$xmlrpcVersion)?> |
| 297 | -<?php if (class_exists('\PhpXmlRpc\JsonRpc\PhpJsonRpc')) echo ' and <a href="https://gggeek.github.io/phpxmlrpc-jsonrpc/">PHPJOSNRPC</a>, ver. ' . htmlspecialchars(\PhpXmlRpc\JsonRpc\PhpJsonRpc::$jsonrpcVersion); ?>)</h3> |
|
| 297 | +<?php if (class_exists('\PhpXmlRpc\JsonRpc\PhpJsonRpc')) echo ' and <a href="https://gggeek.github.io/phpxmlrpc-jsonrpc/">PHPJOSNRPC</a>, ver. '.htmlspecialchars(\PhpXmlRpc\JsonRpc\PhpJsonRpc::$jsonrpcVersion); ?>)</h3> |
|
| 298 | 298 | <form name="frmaction" method="get" action="action.php" target="frmaction" onSubmit="switchFormMethod();"> |
| 299 | 299 | |
| 300 | 300 | <table id="serverblock"> |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | </select> |
| 356 | 356 | </td> |
| 357 | 357 | <td class="labelcell">Timeout:</td> |
| 358 | - <td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) { echo $timeout; } ?>"/></td> |
|
| 358 | + <td><input type="text" name="timeout" size="3" value="<?php if ($timeout>0) { echo $timeout; } ?>"/></td> |
|
| 359 | 359 | <td></td> |
| 360 | 360 | <td></td> |
| 361 | 361 | </tr> |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | // assume this is either a standalone install, or installed as Composer dependency |
| 21 | 21 | /// @todo if the latter is true, should we just not skip using the custom Autoloader, and let a top-level |
| 22 | 22 | /// debugger include this one, taking care of autoloading? |
| 23 | - include_once __DIR__ . "/../src/Autoloader.php"; |
|
| 23 | + include_once __DIR__."/../src/Autoloader.php"; |
|
| 24 | 24 | PhpXmlRpc\Autoloader::register(); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // Variables that shouldn't be unset |
| 37 | - $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES'); |
|
| 37 | + $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES'); |
|
| 38 | 38 | |
| 39 | 39 | $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, |
| 40 | 40 | isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array() |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | $wstype = defined('DEFAULT_WSTYPE') ? DEFAULT_WSTYPE : 0; |
| 86 | 86 | $id = ''; |
| 87 | 87 | if (isset($_GET['action'])) { |
| 88 | - if (isset($_GET['wstype']) && ($_GET['wstype'] == '2' || $_GET['wstype'] == '1' || $_GET['wstype'] == '0')) { |
|
| 89 | - $wstype = (int)$_GET['wstype']; |
|
| 88 | + if (isset($_GET['wstype']) && ($_GET['wstype'] == '2' || $_GET['wstype'] == '1' || $_GET['wstype'] == '0')) { |
|
| 89 | + $wstype = (int) $_GET['wstype']; |
|
| 90 | 90 | if (($wstype === 1 || $wstype === 2) && !$hasjsonrpcclient) { |
| 91 | 91 | $wstype = 0; |
| 92 | 92 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $host = isset($_GET['host']) ? $_GET['host'] : 'localhost'; // using '' will trigger an xml-rpc error... |
| 98 | 98 | if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2' || $_GET['protocol'] == '3' |
| 99 | 99 | || $_GET['protocol'] == '4')) { |
| 100 | - $protocol = (int)$_GET['protocol']; |
|
| 100 | + $protocol = (int) $_GET['protocol']; |
|
| 101 | 101 | } |
| 102 | 102 | if (strpos($host, 'http://') === 0) { |
| 103 | 103 | // NB: if protocol is https or h2, it will override http:// |
@@ -109,18 +109,18 @@ discard block |
||
| 109 | 109 | $protocol = 2; |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | - $port = isset($_GET['port']) ? (int)$_GET['port'] : ''; |
|
| 112 | + $port = isset($_GET['port']) ? (int) $_GET['port'] : ''; |
|
| 113 | 113 | if ($port === 0) { |
| 114 | 114 | $port = ''; |
| 115 | 115 | } |
| 116 | 116 | $path = isset($_GET['path']) ? $_GET['path'] : ''; |
| 117 | 117 | // in case user forgot initial '/' in xml-rpc server path, add it back |
| 118 | 118 | if ($path && ($path[0]) != '/') { |
| 119 | - $path = '/' . $path; |
|
| 119 | + $path = '/'.$path; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] == '2')) { |
| 123 | - $debug = (int)$_GET['debug']; |
|
| 123 | + $debug = (int) $_GET['debug']; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $verifyhost = (isset($_GET['verifyhost']) && ($_GET['verifyhost'] == '1' || $_GET['verifyhost'] == '2')) ? $_GET['verifyhost'] : 0; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | /// @todo what about an https proxy? |
| 138 | 138 | $proxyuser = isset($_GET['proxyuser']) ? $_GET['proxyuser'] : ''; |
| 139 | 139 | $proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : ''; |
| 140 | - $timeout = isset($_GET['timeout']) ? (int)$_GET['timeout'] : 0; |
|
| 140 | + $timeout = isset($_GET['timeout']) ? (int) $_GET['timeout'] : 0; |
|
| 141 | 141 | $action = $_GET['action']; |
| 142 | 142 | |
| 143 | 143 | $method = isset($_GET['method']) ? $_GET['method'] : ''; |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | $username = isset($_GET['username']) ? $_GET['username'] : ''; |
| 153 | 153 | $password = isset($_GET['password']) ? $_GET['password'] : ''; |
| 154 | 154 | |
| 155 | - $authtype = (isset($_GET['authtype']) && ($_GET['authtype'] == '2' || $_GET['authtype'] == '8')) ? (int)$_GET['authtype'] : 1; |
|
| 155 | + $authtype = (isset($_GET['authtype']) && ($_GET['authtype'] == '2' || $_GET['authtype'] == '8')) ? (int) $_GET['authtype'] : 1; |
|
| 156 | 156 | |
| 157 | 157 | if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] == '1' || $_GET['requestcompression'] == '2')) { |
| 158 | - (int)$requestcompression = $_GET['requestcompression']; |
|
| 158 | + (int) $requestcompression = $_GET['requestcompression']; |
|
| 159 | 159 | } else { |
| 160 | 160 | $requestcompression = 0; |
| 161 | 161 | } |
| 162 | 162 | if (isset($_GET['responsecompression']) && ($_GET['responsecompression'] == '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression'] == '3')) { |
| 163 | - $responsecompression = (int)$_GET['responsecompression']; |
|
| 163 | + $responsecompression = (int) $_GET['responsecompression']; |
|
| 164 | 164 | } else { |
| 165 | 165 | $responsecompression = 0; |
| 166 | 166 | } |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | $payload, $alt_payload, $username, $password, $authtype, $verifyhost, $verifypeer, $cainfo, $proxy, $proxyuser, |
| 83 | 83 | $proxypwd, $timeout, $requestcompression, $responsecompression, $clientcookies; |
| 84 | 84 | |
| 85 | -include __DIR__ . '/common.php'; |
|
| 85 | +include __DIR__.'/common.php'; |
|
| 86 | 86 | |
| 87 | 87 | if ($action) { |
| 88 | 88 | |
| 89 | 89 | // avoid php hanging when using the builtin webserver and sending requests to itself |
| 90 | 90 | $skip = false; |
| 91 | - if (php_sapi_name() === 'cli-server' && ((int)getenv('PHP_CLI_SERVER_WORKERS') < 2)) { |
|
| 91 | + if (php_sapi_name() === 'cli-server' && ((int) getenv('PHP_CLI_SERVER_WORKERS')<2)) { |
|
| 92 | 92 | $localHost = explode(':', $_SERVER['HTTP_HOST']); |
| 93 | 93 | /// @todo support also case where port is null (on either side), and when there is a Proxy in the parameters, |
| 94 | 94 | /// and that proxy is us |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | if (!$skip) { |
| 102 | 102 | // make sure the script waits long enough for the call to complete... |
| 103 | 103 | if ($timeout) { |
| 104 | - set_time_limit($timeout + 10); |
|
| 104 | + set_time_limit($timeout+10); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if ($wstype == 1 || $wstype == 2) { |
@@ -122,13 +122,13 @@ discard block |
||
| 122 | 122 | $server = "$host$path"; |
| 123 | 123 | } |
| 124 | 124 | if ($protocol == 2 || $protocol == 3) { |
| 125 | - $server = 'https://' . $server; |
|
| 125 | + $server = 'https://'.$server; |
|
| 126 | 126 | } else { |
| 127 | - $server = 'http://' . $server; |
|
| 127 | + $server = 'http://'.$server; |
|
| 128 | 128 | } |
| 129 | 129 | if ($proxy != '') { |
| 130 | 130 | $pproxy = explode(':', $proxy); |
| 131 | - if (count($pproxy) > 1) { |
|
| 131 | + if (count($pproxy)>1) { |
|
| 132 | 132 | $pport = $pproxy[1]; |
| 133 | 133 | } else { |
| 134 | 134 | $pport = 8080; |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | // fall thru intentionally |
| 202 | 202 | case 'describe': |
| 203 | 203 | case 'wrap': |
| 204 | - $msg[0] = new $requestClass('system.methodHelp', array(), (int)$id); |
|
| 204 | + $msg[0] = new $requestClass('system.methodHelp', array(), (int) $id); |
|
| 205 | 205 | $msg[0]->addparam(new PhpXmlRpc\Value($method)); |
| 206 | - $msg[1] = new $requestClass('system.methodSignature', array(), (int)$id + 1); |
|
| 206 | + $msg[1] = new $requestClass('system.methodSignature', array(), (int) $id+1); |
|
| 207 | 207 | $msg[1]->addparam(new PhpXmlRpc\Value($method)); |
| 208 | 208 | if ($wstype == 2) { |
| 209 | 209 | $msg[0]->setJsonRpcVersion('2.0'); |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | $msg[0]->setJsonRpcVersion('1.0'); |
| 213 | 213 | $msg[1]->setJsonRpcVersion('1.0'); |
| 214 | 214 | } |
| 215 | - $actionname = 'Description of method "' . $method . '"'; |
|
| 215 | + $actionname = 'Description of method "'.$method.'"'; |
|
| 216 | 216 | break; |
| 217 | 217 | case 'list': |
| 218 | - $msg[0] = new $requestClass('system.listMethods', array(), (int)$id); |
|
| 218 | + $msg[0] = new $requestClass('system.listMethods', array(), (int) $id); |
|
| 219 | 219 | if ($wstype == 2) { |
| 220 | 220 | $msg[0]->setJsonRpcVersion('2.0'); |
| 221 | 221 | } elseif ($wstype == 1) { |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | $msg[0] = new $requestClass($method, array(), $id); |
| 231 | 231 | // hack! build payload by hand |
| 232 | 232 | if ($wstype == 2) { |
| 233 | - $payload = "{\n" . |
|
| 234 | - '"jsonrpc": "2.0"' . "\n" . |
|
| 235 | - '"method": "' . $method . "\",\n\"params\": [" . |
|
| 236 | - $payload . |
|
| 233 | + $payload = "{\n". |
|
| 234 | + '"jsonrpc": "2.0"'."\n". |
|
| 235 | + '"method": "'.$method."\",\n\"params\": [". |
|
| 236 | + $payload. |
|
| 237 | 237 | "\n],\n"; |
| 238 | 238 | // fix: if user gave an empty string, use NULL, or we'll break json syntax |
| 239 | 239 | if ($id != "") { |
@@ -247,9 +247,9 @@ discard block |
||
| 247 | 247 | $msg[0]->setPayload($payload); |
| 248 | 248 | $msg[0]->setJsonRpcVersion('2.0'); |
| 249 | 249 | } elseif ($wstype == 1) { |
| 250 | - $payload = "{\n" . |
|
| 251 | - '"method": "' . $method . "\",\n\"params\": [" . |
|
| 252 | - $payload . |
|
| 250 | + $payload = "{\n". |
|
| 251 | + '"method": "'.$method."\",\n\"params\": [". |
|
| 252 | + $payload. |
|
| 253 | 253 | "\n],\n\"id\": "; |
| 254 | 254 | // fix: if user gave an empty string, use NULL, or we'll break json syntax |
| 255 | 255 | if ($id == "") { |
@@ -265,22 +265,22 @@ discard block |
||
| 265 | 265 | $msg[0]->setJsonRpcVersion('1.0'); |
| 266 | 266 | } else { |
| 267 | 267 | $msg[0]->setPayload( |
| 268 | - $msg[0]->xml_header($inputcharset) . |
|
| 269 | - '<methodName>' . $method . "</methodName>\n<params>" . |
|
| 270 | - $payload . |
|
| 271 | - "</params>\n" . $msg[0]->xml_footer() |
|
| 268 | + $msg[0]->xml_header($inputcharset). |
|
| 269 | + '<methodName>'.$method."</methodName>\n<params>". |
|
| 270 | + $payload. |
|
| 271 | + "</params>\n".$msg[0]->xml_footer() |
|
| 272 | 272 | ); |
| 273 | 273 | } |
| 274 | - $actionname = 'Execution of method ' . $method; |
|
| 274 | + $actionname = 'Execution of method '.$method; |
|
| 275 | 275 | break; |
| 276 | 276 | default: // give a warning |
| 277 | - $actionname = '[ERROR: unknown action] "' . $action . '"'; |
|
| 277 | + $actionname = '[ERROR: unknown action] "'.$action.'"'; |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Before calling execute, echo out brief description of action taken + date and time ??? |
| 282 | 282 | // this gives good user feedback for long-running methods... |
| 283 | - echo '<h2>' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . ' on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . " ...</h2>\n"; |
|
| 283 | + echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset)." ...</h2>\n"; |
|
| 284 | 284 | flush(); |
| 285 | 285 | |
| 286 | 286 | $response = null; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | break; |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | - $time = microtime(true) - $time; |
|
| 300 | + $time = microtime(true)-$time; |
|
| 301 | 301 | if ($debug) { |
| 302 | 302 | echo "</div>\n"; |
| 303 | 303 | } |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | // call failed! echo out error msg! |
| 308 | 308 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
| 309 | 309 | echo "<h3>$protoName call FAILED!</h3>\n"; |
| 310 | - echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
| 311 | - "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</p>\n"; |
|
| 310 | + echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
| 311 | + "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."'</p>\n"; |
|
| 312 | 312 | echo(date("d/M/Y:H:i:s\n")); |
| 313 | 313 | } else { |
| 314 | 314 | // call succeeded: parse results |
@@ -324,36 +324,36 @@ discard block |
||
| 324 | 324 | $max = $v->count(); |
| 325 | 325 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
| 326 | 326 | echo "<thead>\n<tr><th>Method ($max)</th><th>Description</th></tr>\n</thead>\n<tbody>\n"; |
| 327 | - foreach($v as $i => $rec) { |
|
| 327 | + foreach ($v as $i => $rec) { |
|
| 328 | 328 | if ($i % 2) { |
| 329 | 329 | $class = ' class="oddrow"'; |
| 330 | 330 | } else { |
| 331 | 331 | $class = ' class="evenrow"'; |
| 332 | 332 | } |
| 333 | - echo("<tr><td$class>" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">" . |
|
| 334 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 335 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 336 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 337 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 338 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
| 339 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 340 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 341 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
| 342 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
| 343 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
| 344 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 345 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 346 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 347 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 348 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
| 349 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
| 350 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 351 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
| 352 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 353 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" . |
|
| 354 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
| 355 | - "<input type=\"hidden\" name=\"action\" value=\"describe\" />" . |
|
| 356 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
| 333 | + echo("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
|
| 334 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
| 335 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
| 336 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
| 337 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
| 338 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
| 339 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
| 340 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
| 341 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
| 342 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
| 343 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
| 344 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
| 345 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
| 346 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
| 347 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
| 348 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
| 349 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
| 350 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
| 351 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
| 352 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
| 353 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."\" />". |
|
| 354 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
| 355 | + "<input type=\"hidden\" name=\"action\" value=\"describe\" />". |
|
| 356 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
| 357 | 357 | "<input type=\"submit\" value=\"Describe\" /></form></td>"); |
| 358 | 358 | //echo("</tr>\n"); |
| 359 | 359 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $r2 = $resp[1]->value(); |
| 381 | 381 | |
| 382 | 382 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
| 383 | - echo "<thead>\n<tr><th>Method</th><th>" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
| 383 | + echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
| 384 | 384 | $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
| 385 | 385 | if ($desc == "") { |
| 386 | 386 | $desc = "-"; |
@@ -390,24 +390,24 @@ discard block |
||
| 390 | 390 | if ($r2->kindOf() != "array") { |
| 391 | 391 | echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
| 392 | 392 | } else { |
| 393 | - foreach($r2 as $i => $x) { |
|
| 393 | + foreach ($r2 as $i => $x) { |
|
| 394 | 394 | $payload = ""; |
| 395 | 395 | $alt_payload = ""; |
| 396 | - if ($i + 1 % 2) { |
|
| 396 | + if ($i+1 % 2) { |
|
| 397 | 397 | $class = ' class="oddrow"'; |
| 398 | 398 | } else { |
| 399 | 399 | $class = ' class="evenrow"'; |
| 400 | 400 | } |
| 401 | - echo "<tr><td$class>Signature " . ($i + 1) . "</td><td$class>"; |
|
| 401 | + echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
|
| 402 | 402 | if ($x->kindOf() == "array") { |
| 403 | 403 | $ret = $x[0]; |
| 404 | - echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; |
|
| 405 | - if ($x->count() > 1) { |
|
| 406 | - foreach($x as $k => $y) { |
|
| 404 | + echo "<code>OUT: ".htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."<br />IN: ("; |
|
| 405 | + if ($x->count()>1) { |
|
| 406 | + foreach ($x as $k => $y) { |
|
| 407 | 407 | if ($k == 0) continue; |
| 408 | 408 | echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
| 409 | 409 | if ($wstype == 1 || $wstype == 2) { |
| 410 | - switch($y->scalarval()) { |
|
| 410 | + switch ($y->scalarval()) { |
|
| 411 | 411 | case 'string': |
| 412 | 412 | case 'dateTime.iso8601': |
| 413 | 413 | case 'base64': |
@@ -440,22 +440,22 @@ discard block |
||
| 440 | 440 | } else { |
| 441 | 441 | $type = $y->scalarval(); |
| 442 | 442 | $payload .= '<param><value>'; |
| 443 | - switch($type) { |
|
| 443 | + switch ($type) { |
|
| 444 | 444 | case 'undefined': |
| 445 | 445 | break; |
| 446 | 446 | case 'null': |
| 447 | 447 | $type = 'nil'; |
| 448 | 448 | // fall thru intentionally |
| 449 | 449 | default: |
| 450 | - $payload .= '<' . |
|
| 451 | - htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
| 452 | - '></' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
| 450 | + $payload .= '<'. |
|
| 451 | + htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
| 452 | + '></'.htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
| 453 | 453 | '>'; |
| 454 | 454 | } |
| 455 | 455 | $payload .= "</value></param>\n"; |
| 456 | 456 | } |
| 457 | 457 | $alt_payload .= $y->scalarval(); |
| 458 | - if ($k < $x->count() - 1) { |
|
| 458 | + if ($k<$x->count()-1) { |
|
| 459 | 459 | $alt_payload .= ';'; |
| 460 | 460 | if ($wstype == 1 || $wstype == 2) { |
| 461 | 461 | $payload .= ', '; |
@@ -471,63 +471,63 @@ discard block |
||
| 471 | 471 | echo '</td>'; |
| 472 | 472 | // button to test this method |
| 473 | 473 | //$payload="<methodCall>\n<methodName>$method</methodName>\n<params>\n$payload</params>\n</methodCall>"; |
| 474 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
| 475 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 476 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 477 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 478 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 479 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
| 480 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 481 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 482 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
| 483 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
| 484 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
| 485 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 486 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 487 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 488 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 489 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
| 490 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
| 491 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 492 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
| 493 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 494 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 495 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 496 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 497 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
| 474 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
| 475 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
| 476 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
| 477 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
| 478 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
| 479 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
| 480 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
| 481 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
| 482 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
| 483 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
| 484 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
| 485 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
| 486 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
| 487 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
| 488 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
| 489 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
| 490 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
| 491 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
| 492 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
| 493 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
| 494 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
| 495 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
| 496 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
| 497 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
| 498 | 498 | "<input type=\"hidden\" name=\"action\" value=\"execute\" />"; |
| 499 | 499 | //if ($wstype != 1) { |
| 500 | 500 | echo "<input type=\"submit\" value=\"Load method synopsis\" />"; |
| 501 | 501 | //} |
| 502 | 502 | echo "</form></td>\n"; |
| 503 | 503 | |
| 504 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
| 505 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 506 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 507 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 508 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 509 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
| 510 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 511 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 512 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
| 513 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
| 514 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
| 515 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 516 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 517 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 518 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 519 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
| 520 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
| 521 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 522 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
| 523 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 524 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 525 | - "<input type=\"hidden\" name=\"methodsig\" value=\"" . $i . "\" />" . |
|
| 526 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 527 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
| 528 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
| 529 | - "<input type=\"hidden\" name=\"action\" value=\"wrap\" />" . |
|
| 530 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
| 504 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
| 505 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
| 506 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
| 507 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
| 508 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
| 509 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
| 510 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
| 511 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
| 512 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
| 513 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
| 514 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
| 515 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
| 516 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
| 517 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
| 518 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
| 519 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
| 520 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
| 521 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
| 522 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
| 523 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
| 524 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
| 525 | + "<input type=\"hidden\" name=\"methodsig\" value=\"".$i."\" />". |
|
| 526 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
| 527 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
| 528 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
| 529 | + "<input type=\"hidden\" name=\"action\" value=\"wrap\" />". |
|
| 530 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
| 531 | 531 | "<input type=\"submit\" value=\"Generate method call stub code\" />"; |
| 532 | 532 | echo "</form></td></tr>\n"; |
| 533 | 533 | } |
@@ -539,14 +539,14 @@ discard block |
||
| 539 | 539 | case 'wrap': |
| 540 | 540 | $r1 = $resp[0]->value(); |
| 541 | 541 | $r2 = $resp[1]->value(); |
| 542 | - if ($r2->kindOf() != "array" || $r2->count() <= $methodsig) { |
|
| 542 | + if ($r2->kindOf() != "array" || $r2->count()<=$methodsig) { |
|
| 543 | 543 | echo "Error: signature unknown\n"; |
| 544 | 544 | } else { |
| 545 | 545 | $mdesc = $r1->scalarval(); |
| 546 | 546 | $encoder = new PhpXmlRpc\Encoder(); |
| 547 | 547 | $msig = $encoder->decode($r2); |
| 548 | 548 | $msig = $msig[$methodsig]; |
| 549 | - $proto = ($protocol == 1) ? 'http11' : ( $protocol == 2 ? 'https' : ( $protocol == 3 ? 'h2' : ( $protocol == 4 ? 'h2c' : '' ) ) ); |
|
| 549 | + $proto = ($protocol == 1) ? 'http11' : ($protocol == 2 ? 'https' : ($protocol == 3 ? 'h2' : ($protocol == 4 ? 'h2c' : ''))); |
|
| 550 | 550 | if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
| 551 | 551 | $clientcookies == '') { |
| 552 | 552 | $opts = 1; // simple client copy in stub code |
@@ -567,12 +567,12 @@ discard block |
||
| 567 | 567 | $client, |
| 568 | 568 | $method, |
| 569 | 569 | array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix, 'throw_on_fault' => true), |
| 570 | - str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc |
|
| 570 | + str_replace('.', '_', $prefix.'_'.$method), $msig, $mdesc |
|
| 571 | 571 | ); |
| 572 | 572 | //if ($code) |
| 573 | 573 | //{ |
| 574 | 574 | echo "<div id=\"phpcode\">\n"; |
| 575 | - highlight_string("<?php\n" . $code['docstring'] . $code['source']); |
|
| 575 | + highlight_string("<?php\n".$code['docstring'].$code['source']); |
|
| 576 | 576 | echo "\n</div>"; |
| 577 | 577 | //} |
| 578 | 578 | //else |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | break; |
| 584 | 584 | |
| 585 | 585 | case 'execute': |
| 586 | - echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>'; |
|
| 586 | + echo '<div id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>'; |
|
| 587 | 587 | break; |
| 588 | 588 | |
| 589 | 589 | default: // give a warning |