| @@ -141,9 +141,9 @@ | ||
| 141 | 141 | * @deprecated | 
| 142 | 142 | */ | 
| 143 | 143 | function build_remote_method_wrapper_code($client, $methodName, $xmlrpcFuncName, | 
| 144 | - $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', | |
| 145 | - $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, | |
| 146 | - $faultResponse = '', $namespace = '\\PhpXmlRpc\\') | |
| 144 | + $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', | |
| 145 | + $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, | |
| 146 | + $faultResponse = '', $namespace = '\\PhpXmlRpc\\') | |
| 147 | 147 |  { | 
| 148 | 148 |      $code = "function $xmlrpcFuncName ("; | 
| 149 | 149 |      if ($clientCopyMode < 2) { | 
| @@ -176,8 +176,7 @@ | ||
| 176 | 176 |                          } else { | 
| 177 | 177 | $escapedData .= $ch; | 
| 178 | 178 | } | 
| 179 | - } | |
| 180 | -                    else if ($ii < 128) { | |
| 179 | +                    } else if ($ii < 128) { | |
| 181 | 180 | /// @todo shall we replace this with a (supposedly) faster str_replace? | 
| 182 | 181 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? | 
| 183 | 182 |                          switch ($ii) { | 
| @@ -26,7 +26,7 @@ | ||
| 26 | 26 | */ | 
| 27 | 27 | function plain_findstate($stateNo) | 
| 28 | 28 |  { | 
| 29 | -     if (isset(exampleMethods::$stateNames[$stateNo - 1])) { | |
| 29 | +        if (isset(exampleMethods::$stateNames[$stateNo - 1])) { | |
| 30 | 30 | return exampleMethods::$stateNames[$stateNo - 1]; | 
| 31 | 31 |      } else { | 
| 32 | 32 | // not, there so complain | 
| @@ -15,7 +15,12 @@ discard block | ||
| 15 | 15 | <html lang="en"> | 
| 16 | 16 | <head> | 
| 17 | 17 | <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico"> | 
| 18 | -    <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) echo 'JSON-RPC'; else echo 'XML-RPC'; ?> Debugger</title> | |
| 18 | +    <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) { | |
| 19 | + echo 'JSON-RPC'; | |
| 20 | +} else { | |
| 21 | + echo 'XML-RPC'; | |
| 22 | +} | |
| 23 | +?> Debugger</title> | |
| 19 | 24 | <meta name="robots" content="index,nofollow"/> | 
| 20 | 25 | <style type="text/css"> | 
| 21 | 26 | <!-- | 
| @@ -367,7 +372,9 @@ discard block | ||
| 367 | 372 |                                  echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; | 
| 368 | 373 |                                  if ($x->count() > 1) { | 
| 369 | 374 |                                      foreach($x as $k => $y) { | 
| 370 | - if ($k == 0) continue; | |
| 375 | +                                        if ($k == 0) { | |
| 376 | + continue; | |
| 377 | + } | |
| 371 | 378 | echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); | 
| 372 | 379 |                                          if ($wstype == 1) { | 
| 373 | 380 |                                              switch($y->scalarval()) { | 
| @@ -13,7 +13,12 @@ | ||
| 13 | 13 | <html lang="en"> | 
| 14 | 14 | <head> | 
| 15 | 15 | <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico"> | 
| 16 | -    <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) echo 'JSON-RPC'; else echo 'XML-RPC'; ?> Debugger</title> | |
| 16 | +    <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) { | |
| 17 | + echo 'JSON-RPC'; | |
| 18 | +} else { | |
| 19 | + echo 'XML-RPC'; | |
| 20 | +} | |
| 21 | +?> Debugger</title> | |
| 17 | 22 | </head> | 
| 18 | 23 | <frameset rows="360,*"> | 
| 19 | 24 | <frame name="frmcontroller" src="controller.php<?php echo htmlspecialchars($query); ?>" marginwidth="0" | 
| @@ -66,7 +66,12 @@ discard block | ||
| 66 | 66 | <html lang="en"> | 
| 67 | 67 | <head> | 
| 68 | 68 | <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico"> | 
| 69 | -    <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) echo 'JSON-RPC'; else echo 'XML-RPC'; ?> Debugger</title> | |
| 69 | +    <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) { | |
| 70 | + echo 'JSON-RPC'; | |
| 71 | +} else { | |
| 72 | + echo 'XML-RPC'; | |
| 73 | +} | |
| 74 | +?> Debugger</title> | |
| 70 | 75 | <meta name="robots" content="index,nofollow"/> | 
| 71 | 76 | <script type="text/javascript" language="Javascript"> | 
| 72 | 77 | if (window.name != 'frmcontroller') | 
| @@ -266,19 +271,26 @@ discard block | ||
| 266 | 271 | </script> | 
| 267 | 272 | </head> | 
| 268 | 273 | <body | 
| 269 | -    onload="<?php if ($hasjsonrpcclient) echo "switchtransport($wstype); " ?>switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) { | |
| 274 | +    onload="<?php if ($hasjsonrpcclient) { | |
| 275 | +    echo "switchtransport($wstype); " ?>switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) { | |
| 270 | 276 | echo ' document.frmaction.submit();'; | 
| 277 | +} | |
| 271 | 278 | } ?>"> | 
| 272 | 279 | <h1>XML-RPC | 
| 273 | 280 |  <?php if ($hasjsonrpcclient) { | 
| 274 | 281 | echo '<form name="frmxmlrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(0);"'; | 
| 275 | 282 | // q: does this if make sense at all? | 
| 276 | -    if (!class_exists('\PhpXmlRpc\Client')) echo ' disabled="disabled"'; | |
| 283 | +    if (!class_exists('\PhpXmlRpc\Client')) { | |
| 284 | + echo ' disabled="disabled"'; | |
| 285 | + } | |
| 277 | 286 | echo ' /></form> / <form name="frmjsonrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(1);"/></form> | 
| 278 | 287 | JSON-RPC'; | 
| 279 | 288 | } ?> | 
| 280 | 289 | Debugger</h1><h3>(based on <a href="https://gggeek.github.io/phpxmlrpc/">PHPXMLRPC</a>, ver. <?php echo htmlspecialchars(\PhpXmlRpc\PhpXmlRpc::$xmlrpcVersion)?> | 
| 281 | -<?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> | |
| 290 | +<?php if (class_exists('\PhpXmlRpc\JsonRpc\PhpJsonRpc')) { | |
| 291 | + echo ' and <a href="https://gggeek.github.io/phpxmlrpc-jsonrpc/">PHPJOSNRPC</a>, ver. ' . htmlspecialchars(\PhpXmlRpc\JsonRpc\PhpJsonRpc::$jsonrpcVersion); | |
| 292 | +} | |
| 293 | +?>)</h3> | |
| 282 | 294 | <form name="frmaction" method="get" action="action.php" target="frmaction" onSubmit="switchFormMethod();"> | 
| 283 | 295 | |
| 284 | 296 | <table id="serverblock"> | 
| @@ -605,8 +605,9 @@ | ||
| 605 | 605 | } | 
| 606 | 606 |          foreach ($parsVariations as $i => $pars) { | 
| 607 | 607 |              $innerCode .= "  if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; | 
| 608 | - if ($i < (count($parsVariations) - 1)) | |
| 609 | - $innerCode .= " else\n"; | |
| 608 | +            if ($i < (count($parsVariations) - 1)) { | |
| 609 | + $innerCode .= " else\n"; | |
| 610 | + } | |
| 610 | 611 | } | 
| 611 | 612 | $innerCode .= " if (is_a(\$retVal, '" . static::$namespace . "Response'))\n return \$retVal;\n else\n"; | 
| 612 | 613 | /// q: why not do the same for int, float, bool, string? | 
| @@ -2011,9 +2011,9 @@ | ||
| 2011 | 2011 | * @return false|\CurlHandle|resource | 
| 2012 | 2012 | */ | 
| 2013 | 2013 | protected function prepareCurlHandle($req, $server, $port, $timeout = 0, $username = '', $password = '', | 
| 2014 | - $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, | |
| 2015 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'https', $keepAlive = false, $key = '', | |
| 2016 | - $keyPass = '', $sslVersion = 0) | |
| 2014 | + $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, | |
| 2015 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'https', $keepAlive = false, $key = '', | |
| 2016 | + $keyPass = '', $sslVersion = 0) | |
| 2017 | 2017 |      { | 
| 2018 | 2018 |          $this->logDeprecationUnlessCalledBy('sendViaCURL'); | 
| 2019 | 2019 | |
| @@ -1274,19 +1274,25 @@ discard block | ||
| 1274 | 1274 | $this->errstr = 'no response'; | 
| 1275 | 1275 | $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . | 
| 1276 | 1276 | ': ' . curl_error($curl)); | 
| 1277 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); | |
| 1277 | +            if (PHP_MAJOR_VERSION < 8) { | |
| 1278 | + curl_close($curl); | |
| 1279 | + } | |
| 1278 | 1280 |              if ($opts['keepalive']) { | 
| 1279 | 1281 | $this->xmlrpc_curl_handle = null; | 
| 1280 | 1282 | } | 
| 1281 | 1283 |          } else { | 
| 1282 | 1284 |              if (!$opts['keepalive']) { | 
| 1283 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); | |
| 1285 | +                if (PHP_MAJOR_VERSION < 8) { | |
| 1286 | + curl_close($curl); | |
| 1287 | + } | |
| 1284 | 1288 | } | 
| 1285 | 1289 | $resp = $req->parseResponse($result, true, $opts['return_type']); | 
| 1286 | 1290 |              if ($opts['keepalive']) { | 
| 1287 | 1291 | /// @todo if we got back a 302 or 308, we should not reuse the curl handle for later calls | 
| 1288 | 1292 |                  if ($resp->faultCode() == PhpXmlRpc::$xmlrpcerr['http_error']) { | 
| 1289 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); | |
| 1293 | +                    if (PHP_MAJOR_VERSION < 8) { | |
| 1294 | + curl_close($curl); | |
| 1295 | + } | |
| 1290 | 1296 | $this->xmlrpc_curl_handle = null; | 
| 1291 | 1297 | } | 
| 1292 | 1298 | } | 
| @@ -1442,7 +1448,9 @@ discard block | ||
| 1442 | 1448 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); | 
| 1443 | 1449 |                  } else { | 
| 1444 | 1450 |                      $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); | 
| 1445 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); | |
| 1451 | +                    if (PHP_MAJOR_VERSION < 8) { | |
| 1452 | + curl_close($curl); | |
| 1453 | + } | |
| 1446 | 1454 | return false; | 
| 1447 | 1455 | } | 
| 1448 | 1456 | break; | 
| @@ -1457,7 +1465,9 @@ discard block | ||
| 1457 | 1465 | curl_setopt($curl, CURLOPT_HTTPAUTH, $opts['authtype']); | 
| 1458 | 1466 |              } elseif ($opts['authtype'] != 1) { | 
| 1459 | 1467 |                  $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); | 
| 1460 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); | |
| 1468 | +                if (PHP_MAJOR_VERSION < 8) { | |
| 1469 | + curl_close($curl); | |
| 1470 | + } | |
| 1461 | 1471 | return false; | 
| 1462 | 1472 | } | 
| 1463 | 1473 | } | 
| @@ -1508,7 +1518,9 @@ discard block | ||
| 1508 | 1518 | curl_setopt($curl, CURLOPT_PROXYAUTH, $opts['proxy_authtype']); | 
| 1509 | 1519 |                  } elseif ($opts['proxy_authtype'] != 1) { | 
| 1510 | 1520 |                      $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); | 
| 1511 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); | |
| 1521 | +                    if (PHP_MAJOR_VERSION < 8) { | |
| 1522 | + curl_close($curl); | |
| 1523 | + } | |
| 1512 | 1524 | return false; | 
| 1513 | 1525 | } | 
| 1514 | 1526 | } | 
| @@ -463,7 +463,7 @@ | ||
| 463 | 463 | public function addToMap($methodName, $function, $sig = null, $doc = false, $sigDoc = false, $parametersType = false, | 
| 464 | 464 | $exceptionHandling = false) | 
| 465 | 465 |      { | 
| 466 | - $this->add_to_map($methodName, $function, $sig, $doc, $sigDoc, $parametersType, $exceptionHandling); | |
| 466 | + $this->add_to_map($methodName, $function, $sig, $doc, $sigDoc, $parametersType, $exceptionHandling); | |
| 467 | 467 | } | 
| 468 | 468 | |
| 469 | 469 | /** |