|
@@ -82,13 +82,13 @@ discard block |
|
|
block discarded – undo |
|
82
|
82
|
$method, $methodsig, $payload, $alt_payload, $username, $password, $authtype, $verifyhost, $verifypeer, $cainfo, $proxy, |
|
83
|
83
|
$proxyuser, $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 |
|
|
block discarded – undo |
|
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) { |
|
@@ -128,13 +128,13 @@ discard block |
|
|
block discarded – undo |
|
128
|
128
|
$server = "$host$path"; |
|
129
|
129
|
} |
|
130
|
130
|
if ($protocol == 2 || $protocol == 3) { |
|
131
|
|
- $server = 'https://' . $server; |
|
|
131
|
+ $server = 'https://'.$server; |
|
132
|
132
|
} else { |
|
133
|
|
- $server = 'http://' . $server; |
|
|
133
|
+ $server = 'http://'.$server; |
|
134
|
134
|
} |
|
135
|
135
|
if ($proxy != '') { |
|
136
|
136
|
$pproxy = explode(':', $proxy); |
|
137
|
|
- if (count($pproxy) > 1) { |
|
|
137
|
+ if (count($pproxy)>1) { |
|
138
|
138
|
$pport = $pproxy[1]; |
|
139
|
139
|
} else { |
|
140
|
140
|
$pport = 8080; |
|
@@ -207,9 +207,9 @@ discard block |
|
|
block discarded – undo |
|
207
|
207
|
// fall thru intentionally |
|
208
|
208
|
case 'describe': |
|
209
|
209
|
case 'wrap': |
|
210
|
|
- $msg[0] = new $requestClass('system.methodHelp', array(), (int)$id); |
|
|
210
|
+ $msg[0] = new $requestClass('system.methodHelp', array(), (int) $id); |
|
211
|
211
|
$msg[0]->addparam(new PhpXmlRpc\Value($method)); |
|
212
|
|
- $msg[1] = new $requestClass('system.methodSignature', array(), (int)$id + 1); |
|
|
212
|
+ $msg[1] = new $requestClass('system.methodSignature', array(), (int) $id+1); |
|
213
|
213
|
$msg[1]->addparam(new PhpXmlRpc\Value($method)); |
|
214
|
214
|
if ($wstype == 2) { |
|
215
|
215
|
$msg[0]->setJsonRpcVersion('2.0'); |
|
@@ -218,10 +218,10 @@ discard block |
|
|
block discarded – undo |
|
218
|
218
|
$msg[0]->setJsonRpcVersion('1.0'); |
|
219
|
219
|
$msg[1]->setJsonRpcVersion('1.0'); |
|
220
|
220
|
} |
|
221
|
|
- $actionname = 'Description of method "' . $method . '"'; |
|
|
221
|
+ $actionname = 'Description of method "'.$method.'"'; |
|
222
|
222
|
break; |
|
223
|
223
|
case 'list': |
|
224
|
|
- $msg[0] = new $requestClass('system.listMethods', array(), (int)$id); |
|
|
224
|
+ $msg[0] = new $requestClass('system.listMethods', array(), (int) $id); |
|
225
|
225
|
if ($wstype == 2) { |
|
226
|
226
|
$msg[0]->setJsonRpcVersion('2.0'); |
|
227
|
227
|
} elseif ($wstype == 1 && $hasjsonrpc2) { |
|
@@ -242,10 +242,10 @@ discard block |
|
|
block discarded – undo |
|
242
|
242
|
// hack! build payload by hand |
|
243
|
243
|
if ($wstype == 2) { |
|
244
|
244
|
$payload = rtrim($payload, "\n"); |
|
245
|
|
- $payload = "{\n" . |
|
246
|
|
- '"jsonrpc": "2.0"' . ",\n" . |
|
247
|
|
- '"method": "' . $method . "\",\n\"params\": [\n" . |
|
248
|
|
- $payload . |
|
|
245
|
+ $payload = "{\n". |
|
|
246
|
+ '"jsonrpc": "2.0"'.",\n". |
|
|
247
|
+ '"method": "'.$method."\",\n\"params\": [\n". |
|
|
248
|
+ $payload. |
|
249
|
249
|
"\n]"; |
|
250
|
250
|
if ($action == "notification") { |
|
251
|
251
|
$payload .= "\n"; |
|
@@ -261,9 +261,9 @@ discard block |
|
|
block discarded – undo |
|
261
|
261
|
$msg[0]->setJsonRpcVersion('2.0'); |
|
262
|
262
|
} elseif ($wstype == 1) { |
|
263
|
263
|
$payload = rtrim($payload, "\n"); |
|
264
|
|
- $payload = "{\n" . |
|
265
|
|
- '"method": "' . $method . "\",\n\"params\": [\n" . |
|
266
|
|
- $payload . |
|
|
264
|
+ $payload = "{\n". |
|
|
265
|
+ '"method": "'.$method."\",\n\"params\": [\n". |
|
|
266
|
+ $payload. |
|
267
|
267
|
"\n],\n\"id\": "; |
|
268
|
268
|
if ($action == "notification") { |
|
269
|
269
|
$payload .= "null\n}"; |
|
@@ -281,26 +281,26 @@ discard block |
|
|
block discarded – undo |
|
281
|
281
|
} |
|
282
|
282
|
} else { |
|
283
|
283
|
$msg[0]->setPayload( |
|
284
|
|
- $msg[0]->xml_header($inputcharset) . |
|
285
|
|
- '<methodName>' . $method . "</methodName>\n<params>" . |
|
286
|
|
- $payload . |
|
287
|
|
- "</params>\n" . $msg[0]->xml_footer() |
|
|
284
|
+ $msg[0]->xml_header($inputcharset). |
|
|
285
|
+ '<methodName>'.$method."</methodName>\n<params>". |
|
|
286
|
+ $payload. |
|
|
287
|
+ "</params>\n".$msg[0]->xml_footer() |
|
288
|
288
|
); |
|
289
|
289
|
} |
|
290
|
290
|
if ($action == 'notification') { |
|
291
|
|
- $actionname = 'Execution of notification ' . $method; |
|
|
291
|
+ $actionname = 'Execution of notification '.$method; |
|
292
|
292
|
} else { |
|
293
|
|
- $actionname = 'Execution of method ' . $method; |
|
|
293
|
+ $actionname = 'Execution of method '.$method; |
|
294
|
294
|
} |
|
295
|
295
|
break; |
|
296
|
296
|
default: // give a warning |
|
297
|
|
- $actionname = '[ERROR: unknown action] "' . $action . '"'; |
|
|
297
|
+ $actionname = '[ERROR: unknown action] "'.$action.'"'; |
|
298
|
298
|
} |
|
299
|
299
|
} |
|
300
|
300
|
|
|
301
|
301
|
// Before calling execute, echo out brief description of action taken + date and time ??? |
|
302
|
302
|
// this gives good user feedback for long-running methods... |
|
303
|
|
- echo '<h2>' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . ' on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . " ...</h2>\n"; |
|
|
303
|
+ echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset)." ...</h2>\n"; |
|
304
|
304
|
flush(); |
|
305
|
305
|
|
|
306
|
306
|
$response = null; |
|
@@ -318,7 +318,7 @@ discard block |
|
|
block discarded – undo |
|
318
|
318
|
break; |
|
319
|
319
|
} |
|
320
|
320
|
} |
|
321
|
|
- $time = microtime(true) - $time; |
|
|
321
|
+ $time = microtime(true)-$time; |
|
322
|
322
|
if ($debug) { |
|
323
|
323
|
echo "</div>\n"; |
|
324
|
324
|
} |
|
@@ -332,8 +332,8 @@ discard block |
|
|
block discarded – undo |
|
332
|
332
|
// call failed! echo out error msg! |
|
333
|
333
|
//echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
|
334
|
334
|
echo "<h3>$protoName call FAILED!</h3>\n"; |
|
335
|
|
- echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
336
|
|
- "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</p>\n"; |
|
|
335
|
+ echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
|
336
|
+ "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."'</p>\n"; |
|
337
|
337
|
echo(date("d/M/Y:H:i:s\n")); |
|
338
|
338
|
} else { |
|
339
|
339
|
// call succeeded: parse results |
|
@@ -349,36 +349,36 @@ discard block |
|
|
block discarded – undo |
|
349
|
349
|
$max = $v->count(); |
|
350
|
350
|
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
|
351
|
351
|
echo "<thead>\n<tr><th>Method ($max)</th><th>Description</th></tr>\n</thead>\n<tbody>\n"; |
|
352
|
|
- foreach($v as $i => $rec) { |
|
|
352
|
+ foreach ($v as $i => $rec) { |
|
353
|
353
|
if ($i % 2) { |
|
354
|
354
|
$class = ' class="oddrow"'; |
|
355
|
355
|
} else { |
|
356
|
356
|
$class = ' class="evenrow"'; |
|
357
|
357
|
} |
|
358
|
|
- echo("<tr><td$class>" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">" . |
|
359
|
|
- "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
360
|
|
- "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
361
|
|
- "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
362
|
|
- "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
363
|
|
- "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
364
|
|
- "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
365
|
|
- "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
366
|
|
- "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
367
|
|
- "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
368
|
|
- "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
369
|
|
- "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
370
|
|
- "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
371
|
|
- "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
372
|
|
- "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
373
|
|
- "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
374
|
|
- "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
375
|
|
- "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
376
|
|
- "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
377
|
|
- "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
378
|
|
- "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" . |
|
379
|
|
- "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
380
|
|
- "<input type=\"hidden\" name=\"action\" value=\"describe\" />" . |
|
381
|
|
- "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
|
358
|
+ echo("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
|
|
359
|
+ "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
|
360
|
+ "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
|
361
|
+ "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
|
362
|
+ "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
|
363
|
+ "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
|
364
|
+ "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
|
365
|
+ "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
|
366
|
+ "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
|
367
|
+ "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
|
368
|
+ "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
|
369
|
+ "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
|
370
|
+ "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
|
371
|
+ "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
|
372
|
+ "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
|
373
|
+ "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
|
374
|
+ "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
|
375
|
+ "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
|
376
|
+ "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
|
377
|
+ "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
|
378
|
+ "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."\" />". |
|
|
379
|
+ "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
|
380
|
+ "<input type=\"hidden\" name=\"action\" value=\"describe\" />". |
|
|
381
|
+ "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
382
|
382
|
"<input type=\"submit\" value=\"Describe\" /></form></td>"); |
|
383
|
383
|
//echo("</tr>\n"); |
|
384
|
384
|
|
|
@@ -405,7 +405,7 @@ discard block |
|
|
block discarded – undo |
|
405
|
405
|
$r2 = $resp[1]->value(); |
|
406
|
406
|
|
|
407
|
407
|
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
|
408
|
|
- echo "<thead>\n<tr><th>Method</th><th>" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
|
408
|
+ echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
409
|
409
|
$desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
|
410
|
410
|
if ($desc == "") { |
|
411
|
411
|
$desc = "-"; |
|
@@ -415,24 +415,24 @@ discard block |
|
|
block discarded – undo |
|
415
|
415
|
if ($r2->kindOf() != "array") { |
|
416
|
416
|
echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
|
417
|
417
|
} else { |
|
418
|
|
- foreach($r2 as $i => $x) { |
|
|
418
|
+ foreach ($r2 as $i => $x) { |
|
419
|
419
|
$payload = ""; |
|
420
|
420
|
$alt_payload = ""; |
|
421
|
|
- if ($i + 1 % 2) { |
|
|
421
|
+ if ($i+1 % 2) { |
|
422
|
422
|
$class = ' class="oddrow"'; |
|
423
|
423
|
} else { |
|
424
|
424
|
$class = ' class="evenrow"'; |
|
425
|
425
|
} |
|
426
|
|
- echo "<tr><td$class>Signature " . ($i + 1) . "</td><td$class>"; |
|
|
426
|
+ echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
|
427
|
427
|
if ($x->kindOf() == "array") { |
|
428
|
428
|
$ret = $x[0]; |
|
429
|
|
- echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; |
|
430
|
|
- if ($x->count() > 1) { |
|
431
|
|
- foreach($x as $k => $y) { |
|
|
429
|
+ echo "<code>OUT: ".htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."<br />IN: ("; |
|
|
430
|
+ if ($x->count()>1) { |
|
|
431
|
+ foreach ($x as $k => $y) { |
|
432
|
432
|
if ($k == 0) continue; |
|
433
|
433
|
echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
|
434
|
434
|
if ($wstype == 1 || $wstype == 2) { |
|
435
|
|
- switch($y->scalarval()) { |
|
|
435
|
+ switch ($y->scalarval()) { |
|
436
|
436
|
case 'string': |
|
437
|
437
|
case 'dateTime.iso8601': |
|
438
|
438
|
case 'base64': |
|
@@ -465,22 +465,22 @@ discard block |
|
|
block discarded – undo |
|
465
|
465
|
} else { |
|
466
|
466
|
$type = $y->scalarval(); |
|
467
|
467
|
$payload .= '<param><value>'; |
|
468
|
|
- switch($type) { |
|
|
468
|
+ switch ($type) { |
|
469
|
469
|
case 'undefined': |
|
470
|
470
|
break; |
|
471
|
471
|
case 'null': |
|
472
|
472
|
$type = 'nil'; |
|
473
|
473
|
// fall thru intentionally |
|
474
|
474
|
default: |
|
475
|
|
- $payload .= '<' . |
|
476
|
|
- htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
477
|
|
- '></' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
|
475
|
+ $payload .= '<'. |
|
|
476
|
+ htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
|
477
|
+ '></'.htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
478
|
478
|
'>'; |
|
479
|
479
|
} |
|
480
|
480
|
$payload .= "</value></param>\n"; |
|
481
|
481
|
} |
|
482
|
482
|
$alt_payload .= $y->scalarval(); |
|
483
|
|
- if ($k < $x->count() - 1) { |
|
|
483
|
+ if ($k<$x->count()-1) { |
|
484
|
484
|
$alt_payload .= ';'; |
|
485
|
485
|
if ($wstype == 1 || $wstype == 2) { |
|
486
|
486
|
$payload .= ', '; |
|
@@ -496,63 +496,63 @@ discard block |
|
|
block discarded – undo |
|
496
|
496
|
echo '</td>'; |
|
497
|
497
|
// button to test this method |
|
498
|
498
|
//$payload="<methodCall>\n<methodName>$method</methodName>\n<params>\n$payload</params>\n</methodCall>"; |
|
499
|
|
- echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
500
|
|
- "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
501
|
|
- "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
502
|
|
- "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
503
|
|
- "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
504
|
|
- "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
505
|
|
- "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
506
|
|
- "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
507
|
|
- "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
508
|
|
- "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
509
|
|
- "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
510
|
|
- "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
511
|
|
- "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
512
|
|
- "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
513
|
|
- "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
514
|
|
- "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
515
|
|
- "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
516
|
|
- "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
517
|
|
- "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
518
|
|
- "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
519
|
|
- "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
520
|
|
- "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
521
|
|
- "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
522
|
|
- "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
|
499
|
+ echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
|
500
|
+ "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
|
501
|
+ "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
|
502
|
+ "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
|
503
|
+ "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
|
504
|
+ "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
|
505
|
+ "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
|
506
|
+ "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
|
507
|
+ "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
|
508
|
+ "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
|
509
|
+ "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
|
510
|
+ "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
|
511
|
+ "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
|
512
|
+ "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
|
513
|
+ "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
|
514
|
+ "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
|
515
|
+ "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
|
516
|
+ "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
|
517
|
+ "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
|
518
|
+ "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
|
519
|
+ "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
|
520
|
+ "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
|
521
|
+ "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
|
522
|
+ "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
523
|
523
|
"<input type=\"hidden\" name=\"action\" value=\"execute\" />"; |
|
524
|
524
|
//if ($wstype != 1) { |
|
525
|
525
|
echo "<input type=\"submit\" value=\"Load method synopsis\" />"; |
|
526
|
526
|
//} |
|
527
|
527
|
echo "</form></td>\n"; |
|
528
|
528
|
|
|
529
|
|
- echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
530
|
|
- "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
531
|
|
- "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
532
|
|
- "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
533
|
|
- "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
534
|
|
- "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
535
|
|
- "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
536
|
|
- "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
537
|
|
- "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
538
|
|
- "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
539
|
|
- "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
540
|
|
- "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
541
|
|
- "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
542
|
|
- "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
543
|
|
- "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
544
|
|
- "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
545
|
|
- "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
546
|
|
- "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
547
|
|
- "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
548
|
|
- "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
549
|
|
- "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
550
|
|
- "<input type=\"hidden\" name=\"methodsig\" value=\"" . $i . "\" />" . |
|
551
|
|
- "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
552
|
|
- "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
553
|
|
- "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
554
|
|
- "<input type=\"hidden\" name=\"action\" value=\"wrap\" />" . |
|
555
|
|
- "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
|
529
|
+ echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
|
530
|
+ "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
|
531
|
+ "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
|
532
|
+ "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
|
533
|
+ "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
|
534
|
+ "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
|
535
|
+ "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
|
536
|
+ "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
|
537
|
+ "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
|
538
|
+ "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
|
539
|
+ "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
|
540
|
+ "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
|
541
|
+ "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
|
542
|
+ "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
|
543
|
+ "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
|
544
|
+ "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
|
545
|
+ "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
|
546
|
+ "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
|
547
|
+ "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
|
548
|
+ "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
|
549
|
+ "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
|
550
|
+ "<input type=\"hidden\" name=\"methodsig\" value=\"".$i."\" />". |
|
|
551
|
+ "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
|
552
|
+ "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
|
553
|
+ "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
|
554
|
+ "<input type=\"hidden\" name=\"action\" value=\"wrap\" />". |
|
|
555
|
+ "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
556
|
556
|
"<input type=\"submit\" value=\"Generate method call stub code\" />"; |
|
557
|
557
|
echo "</form></td></tr>\n"; |
|
558
|
558
|
} |
|
@@ -564,14 +564,14 @@ discard block |
|
|
block discarded – undo |
|
564
|
564
|
case 'wrap': |
|
565
|
565
|
$r1 = $resp[0]->value(); |
|
566
|
566
|
$r2 = $resp[1]->value(); |
|
567
|
|
- if ($r2->kindOf() != "array" || $r2->count() <= $methodsig) { |
|
|
567
|
+ if ($r2->kindOf() != "array" || $r2->count()<=$methodsig) { |
|
568
|
568
|
echo "Error: signature unknown\n"; |
|
569
|
569
|
} else { |
|
570
|
570
|
$mdesc = $r1->scalarval(); |
|
571
|
571
|
$encoder = new PhpXmlRpc\Encoder(); |
|
572
|
572
|
$msig = $encoder->decode($r2); |
|
573
|
573
|
$msig = $msig[$methodsig]; |
|
574
|
|
- $proto = ($protocol == 1) ? 'http11' : ( $protocol == 2 ? 'https' : ( $protocol == 3 ? 'h2' : ( $protocol == 4 ? 'h2c' : '' ) ) ); |
|
|
574
|
+ $proto = ($protocol == 1) ? 'http11' : ($protocol == 2 ? 'https' : ($protocol == 3 ? 'h2' : ($protocol == 4 ? 'h2c' : ''))); |
|
575
|
575
|
if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
|
576
|
576
|
$clientcookies == '') { |
|
577
|
577
|
$opts = 1; // simple client copy in stub code |
|
@@ -592,12 +592,12 @@ discard block |
|
|
block discarded – undo |
|
592
|
592
|
$client, |
|
593
|
593
|
$method, |
|
594
|
594
|
array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix, 'throw_on_fault' => true), |
|
595
|
|
- str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc |
|
|
595
|
+ str_replace('.', '_', $prefix.'_'.$method), $msig, $mdesc |
|
596
|
596
|
); |
|
597
|
597
|
//if ($code) |
|
598
|
598
|
//{ |
|
599
|
599
|
echo "<div id=\"phpcode\">\n"; |
|
600
|
|
- highlight_string("<?php\n" . $code['docstring'] . $code['source']); |
|
|
600
|
+ highlight_string("<?php\n".$code['docstring'].$code['source']); |
|
601
|
601
|
echo "\n</div>"; |
|
602
|
602
|
//} |
|
603
|
603
|
//else |
|
@@ -608,11 +608,11 @@ discard block |
|
|
block discarded – undo |
|
608
|
608
|
break; |
|
609
|
609
|
|
|
610
|
610
|
case 'execute': |
|
611
|
|
- echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>'; |
|
|
611
|
+ echo '<div id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>'; |
|
612
|
612
|
break; |
|
613
|
613
|
|
|
614
|
614
|
case 'notification': |
|
615
|
|
- echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>'; |
|
|
615
|
+ echo '<div id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>'; |
|
616
|
616
|
break; |
|
617
|
617
|
|
|
618
|
618
|
default: // give a warning |