@@ -42,15 +42,17 @@ discard block |
||
42 | 42 | if (isset($_GET['wstype']) && $_GET['wstype'] == '1') |
43 | 43 | { |
44 | 44 | $wstype = 1; |
45 | - if (isset($_GET['id'])) |
|
46 | - $id = $_GET['id']; |
|
45 | + if (isset($_GET['id'])) { |
|
46 | + $id = $_GET['id']; |
|
47 | + } |
|
47 | 48 | } |
48 | 49 | $host = isset($_GET['host']) ? $_GET['host'] : 'localhost'; // using '' will trigger an xmlrpc error... |
49 | - if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2')) |
|
50 | - $protocol = $_GET['protocol']; |
|
51 | - if (strpos($host, 'http://') === 0) |
|
52 | - $host = substr($host, 7); |
|
53 | - else if (strpos($host, 'https://') === 0) |
|
50 | + if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2')) { |
|
51 | + $protocol = $_GET['protocol']; |
|
52 | + } |
|
53 | + if (strpos($host, 'http://') === 0) { |
|
54 | + $host = substr($host, 7); |
|
55 | + } else if (strpos($host, 'https://') === 0) |
|
54 | 56 | { |
55 | 57 | $host = substr($host, 8); |
56 | 58 | $protocol = 2; |
@@ -58,26 +60,31 @@ discard block |
||
58 | 60 | $port = isset($_GET['port']) ? $_GET['port'] : ''; |
59 | 61 | $path = isset($_GET['path']) ? $_GET['path'] : ''; |
60 | 62 | // in case user forgot initial '/' in xmlrpc server path, add it back |
61 | - if ($path && ($path[0]) != '/') |
|
62 | - $path = '/'.$path; |
|
63 | + if ($path && ($path[0]) != '/') { |
|
64 | + $path = '/'.$path; |
|
65 | + } |
|
63 | 66 | |
64 | - if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] == '2')) |
|
65 | - $debug = $_GET['debug']; |
|
67 | + if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] == '2')) { |
|
68 | + $debug = $_GET['debug']; |
|
69 | + } |
|
66 | 70 | |
67 | 71 | $verifyhost = (isset($_GET['verifyhost']) && ($_GET['verifyhost'] == '1' || $_GET['verifyhost'] == '2')) ? $_GET['verifyhost'] : 0; |
68 | - if (isset($_GET['verifypeer']) && $_GET['verifypeer'] == '1') |
|
69 | - $verifypeer = true; |
|
70 | - else |
|
71 | - $verifypeer = false; |
|
72 | + if (isset($_GET['verifypeer']) && $_GET['verifypeer'] == '1') { |
|
73 | + $verifypeer = true; |
|
74 | + } else { |
|
75 | + $verifypeer = false; |
|
76 | + } |
|
72 | 77 | $cainfo= isset($_GET['cainfo']) ? $_GET['cainfo'] : ''; |
73 | 78 | $proxy = isset($_GET['proxy']) ? $_GET['proxy'] : 0; |
74 | - if (strpos($proxy, 'http://') === 0) |
|
75 | - $proxy = substr($proxy, 7); |
|
79 | + if (strpos($proxy, 'http://') === 0) { |
|
80 | + $proxy = substr($proxy, 7); |
|
81 | + } |
|
76 | 82 | $proxyuser= isset($_GET['proxyuser']) ? $_GET['proxyuser'] : ''; |
77 | 83 | $proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : ''; |
78 | 84 | $timeout = isset($_GET['timeout']) ? $_GET['timeout'] : 0; |
79 | - if (!is_numeric($timeout)) |
|
80 | - $timeout = 0; |
|
85 | + if (!is_numeric($timeout)) { |
|
86 | + $timeout = 0; |
|
87 | + } |
|
81 | 88 | $action = $_GET['action']; |
82 | 89 | |
83 | 90 | $method = isset($_GET['method']) ? $_GET['method'] : ''; |
@@ -85,26 +92,28 @@ discard block |
||
85 | 92 | $payload = isset($_GET['methodpayload']) ? $_GET['methodpayload'] : ''; |
86 | 93 | $alt_payload = isset($_GET['altmethodpayload']) ? $_GET['altmethodpayload'] : ''; |
87 | 94 | |
88 | - if (isset($_GET['run']) && $_GET['run'] == 'now') |
|
89 | - $run = true; |
|
95 | + if (isset($_GET['run']) && $_GET['run'] == 'now') { |
|
96 | + $run = true; |
|
97 | + } |
|
90 | 98 | |
91 | 99 | $username = isset($_GET['username']) ? $_GET['username'] : ''; |
92 | 100 | $password = isset($_GET['password']) ? $_GET['password'] : ''; |
93 | 101 | |
94 | 102 | $authtype = (isset($_GET['authtype']) && ($_GET['authtype'] == '2' || $_GET['authtype'] == '8')) ? $_GET['authtype'] : 1; |
95 | 103 | |
96 | - if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] == '1' || $_GET['requestcompression'] == '2')) |
|
97 | - $requestcompression = $_GET['requestcompression']; |
|
98 | - else |
|
99 | - $requestcompression = 0; |
|
100 | - if (isset($_GET['responsecompression']) && ($_GET['responsecompression'] == '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression'] == '3')) |
|
101 | - $responsecompression = $_GET['responsecompression']; |
|
102 | - else |
|
103 | - $responsecompression = 0; |
|
104 | + if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] == '1' || $_GET['requestcompression'] == '2')) { |
|
105 | + $requestcompression = $_GET['requestcompression']; |
|
106 | + } else { |
|
107 | + $requestcompression = 0; |
|
108 | + } |
|
109 | + if (isset($_GET['responsecompression']) && ($_GET['responsecompression'] == '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression'] == '3')) { |
|
110 | + $responsecompression = $_GET['responsecompression']; |
|
111 | + } else { |
|
112 | + $responsecompression = 0; |
|
113 | + } |
|
104 | 114 | |
105 | 115 | $clientcookies = isset($_GET['clientcookies']) ? $_GET['clientcookies'] : ''; |
106 | - } |
|
107 | - else |
|
116 | + } else |
|
108 | 117 | { |
109 | 118 | $host = ''; |
110 | 119 | $port = ''; |
@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | { |
42 | 42 | |
43 | 43 | // make sure the script waits long enough for the call to complete... |
44 | - if ($timeout) |
|
45 | - set_time_limit($timeout+10); |
|
44 | + if ($timeout) { |
|
45 | + set_time_limit($timeout+10); |
|
46 | + } |
|
46 | 47 | |
47 | 48 | include('xmlrpc.inc'); |
48 | 49 | if ($wstype == 1) |
@@ -55,8 +56,7 @@ discard block |
||
55 | 56 | $clientclass = 'jsonrpc_client'; |
56 | 57 | $msgclass = 'jsonrpcmsg'; |
57 | 58 | $protoname = 'JSONRPC'; |
58 | - } |
|
59 | - else |
|
59 | + } else |
|
60 | 60 | { |
61 | 61 | $clientclass = 'xmlrpc_client'; |
62 | 62 | $msgclass = 'xmlrpcmsg'; |
@@ -74,17 +74,17 @@ discard block |
||
74 | 74 | if ($protocol == 2) |
75 | 75 | { |
76 | 76 | $server = 'https://'.$server; |
77 | - } |
|
78 | - else |
|
77 | + } else |
|
79 | 78 | { |
80 | 79 | $server = 'http://'.$server; |
81 | 80 | } |
82 | 81 | if ($proxy != '') { |
83 | 82 | $pproxy = explode(':', $proxy); |
84 | - if (count($pproxy) > 1) |
|
85 | - $pport = $pproxy[1]; |
|
86 | - else |
|
87 | - $pport = 8080; |
|
83 | + if (count($pproxy) > 1) { |
|
84 | + $pport = $pproxy[1]; |
|
85 | + } else { |
|
86 | + $pport = 8080; |
|
87 | + } |
|
88 | 88 | $client->setProxy($pproxy[0], $pport, $proxyuser, $proxypwd); |
89 | 89 | } |
90 | 90 | |
@@ -97,14 +97,15 @@ discard block |
||
97 | 97 | $client->setCaCertificate($cainfo); |
98 | 98 | } |
99 | 99 | $httpprotocol = 'https'; |
100 | + } else if ($protocol == 1) { |
|
101 | + $httpprotocol = 'http11'; |
|
102 | + } else { |
|
103 | + $httpprotocol = 'http'; |
|
100 | 104 | } |
101 | - else if ($protocol == 1) |
|
102 | - $httpprotocol = 'http11'; |
|
103 | - else |
|
104 | - $httpprotocol = 'http'; |
|
105 | 105 | |
106 | - if ($username) |
|
107 | - $client->setCredentials($username, $password, $authtype); |
|
106 | + if ($username) { |
|
107 | + $client->setCredentials($username, $password, $authtype); |
|
108 | + } |
|
108 | 109 | |
109 | 110 | $client->setDebug($debug); |
110 | 111 | |
@@ -168,8 +169,9 @@ discard block |
||
168 | 169 | $actionname = 'List of available methods'; |
169 | 170 | break; |
170 | 171 | case 'execute': |
171 | - if (!payload_is_safe($payload)) |
|
172 | - die("Tsk tsk tsk, please stop it or I will have to call in the cops!"); |
|
172 | + if (!payload_is_safe($payload)) { |
|
173 | + die("Tsk tsk tsk, please stop it or I will have to call in the cops!"); |
|
174 | + } |
|
173 | 175 | $msg[0] = new $msgclass($method, null, $id); |
174 | 176 | // hack! build xml payload by hand |
175 | 177 | if ($wstype == 1) |
@@ -182,24 +184,22 @@ discard block |
||
182 | 184 | if ($id == "") |
183 | 185 | { |
184 | 186 | $msg[0]->payload .= "null\n}"; |
185 | - } |
|
186 | - else |
|
187 | + } else |
|
187 | 188 | { |
188 | 189 | if (is_numeric($id) || $id == 'false' || $id == 'true' || $id == 'null') |
189 | 190 | { |
190 | 191 | $msg[0]->payload .= "$id\n}"; |
191 | - } |
|
192 | - else |
|
192 | + } else |
|
193 | 193 | { |
194 | 194 | $msg[0]->payload .= "\"$id\"\n}"; |
195 | 195 | } |
196 | 196 | } |
197 | - } |
|
198 | - else |
|
199 | - $msg[0]->payload = $msg[0]->xml_header($inputcharset) . |
|
197 | + } else { |
|
198 | + $msg[0]->payload = $msg[0]->xml_header($inputcharset) . |
|
200 | 199 | '<methodName>' . $method . "</methodName>\n<params>" . |
201 | 200 | $payload . |
202 | 201 | "</params>\n" . $msg[0]->xml_footer(); |
202 | + } |
|
203 | 203 | $actionname = 'Execution of method '.$method; |
204 | 204 | break; |
205 | 205 | default: // give a warning |
@@ -213,8 +213,10 @@ discard block |
||
213 | 213 | |
214 | 214 | $response = null; |
215 | 215 | // execute method(s) |
216 | - if ($debug) |
|
217 | - echo '<div class="dbginfo"><h2>Debug info:</h2>'; /// @todo use ob_start instead |
|
216 | + if ($debug) { |
|
217 | + echo '<div class="dbginfo"><h2>Debug info:</h2>'; |
|
218 | + } |
|
219 | + /// @todo use ob_start instead |
|
218 | 220 | $resp = array(); |
219 | 221 | $mtime = explode(' ',microtime()); |
220 | 222 | $time = (float)$mtime[0] + (float)$mtime[1]; |
@@ -223,13 +225,15 @@ discard block |
||
223 | 225 | // catch errors: for older xmlrpc libs, send does not return by ref |
224 | 226 | @$response =& $client->send($message, $timeout, $httpprotocol); |
225 | 227 | $resp[] = $response; |
226 | - if (!$response || $response->faultCode()) |
|
227 | - break; |
|
228 | + if (!$response || $response->faultCode()) { |
|
229 | + break; |
|
230 | + } |
|
228 | 231 | } |
229 | 232 | $mtime = explode(' ',microtime()); |
230 | 233 | $time = (float)$mtime[0] + (float)$mtime[1] - $time; |
231 | - if ($debug) |
|
232 | - echo "</div>\n"; |
|
234 | + if ($debug) { |
|
235 | + echo "</div>\n"; |
|
236 | + } |
|
233 | 237 | |
234 | 238 | if ($response) |
235 | 239 | { |
@@ -242,8 +246,7 @@ discard block |
||
242 | 246 | echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . |
243 | 247 | "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . "'</p>\n"; |
244 | 248 | echo (strftime("%d/%b/%Y:%H:%M:%S\n")); |
245 | - } |
|
246 | - else |
|
249 | + } else |
|
247 | 250 | { |
248 | 251 | // call succeeded: parse results |
249 | 252 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
@@ -263,7 +266,11 @@ discard block |
||
263 | 266 | for($i=0; $i < $max; $i++) |
264 | 267 | { |
265 | 268 | $rec = $v->arraymem($i); |
266 | - if ($i%2) $class=' class="oddrow"'; else $class = ' class="evenrow"'; |
|
269 | + if ($i%2) { |
|
270 | + $class=' class="oddrow"'; |
|
271 | + } else { |
|
272 | + $class = ' class="evenrow"'; |
|
273 | + } |
|
267 | 274 | echo ("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
268 | 275 | "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
269 | 276 | "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
@@ -316,18 +323,23 @@ discard block |
||
316 | 323 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
317 | 324 | echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
318 | 325 | $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']); |
319 | - if ($desc == "") |
|
320 | - $desc = "-"; |
|
326 | + if ($desc == "") { |
|
327 | + $desc = "-"; |
|
328 | + } |
|
321 | 329 | echo "<tr><td class=\"evenrow\">Description</td><td colspan=\"3\" class=\"evenrow\">$desc</td></tr>\n"; |
322 | 330 | $payload=""; |
323 | 331 | $alt_payload=""; |
324 | - if ($r2->kindOf()!="array") |
|
325 | - echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
|
326 | - else |
|
332 | + if ($r2->kindOf()!="array") { |
|
333 | + echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
|
334 | + } else |
|
327 | 335 | { |
328 | 336 | for($i=0; $i < $r2->arraysize(); $i++) |
329 | 337 | { |
330 | - if ($i+1%2) $class=' class="oddrow"'; else $class = ' class="evenrow"'; |
|
338 | + if ($i+1%2) { |
|
339 | + $class=' class="oddrow"'; |
|
340 | + } else { |
|
341 | + $class = ' class="evenrow"'; |
|
342 | + } |
|
331 | 343 | echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
332 | 344 | $x = $r2->arraymem($i); |
333 | 345 | if ($x->kindOf()=="array") |
@@ -353,8 +365,7 @@ discard block |
||
353 | 365 | } |
354 | 366 | } |
355 | 367 | echo ")</code>"; |
356 | - } |
|
357 | - else |
|
368 | + } else |
|
358 | 369 | { |
359 | 370 | echo 'Unknown'; |
360 | 371 | } |
@@ -386,8 +397,9 @@ discard block |
||
386 | 397 | "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
387 | 398 | "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
388 | 399 | "<input type=\"hidden\" name=\"action\" value=\"execute\" />"; |
389 | - if ($wstype != 1) |
|
390 | - echo "<input type=\"submit\" value=\"Load method synopsis\" />"; |
|
400 | + if ($wstype != 1) { |
|
401 | + echo "<input type=\"submit\" value=\"Load method synopsis\" />"; |
|
402 | + } |
|
391 | 403 | echo "</form></td>\n"; |
392 | 404 | |
393 | 405 | echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
@@ -429,9 +441,9 @@ discard block |
||
429 | 441 | case 'wrap': |
430 | 442 | $r1 = $resp[0]->value(); |
431 | 443 | $r2 = $resp[1]->value(); |
432 | - if ($r2->kindOf()!="array" || $r2->arraysize() <= $methodsig) |
|
433 | - echo "Error: signature unknown\n"; |
|
434 | - else |
|
444 | + if ($r2->kindOf()!="array" || $r2->arraysize() <= $methodsig) { |
|
445 | + echo "Error: signature unknown\n"; |
|
446 | + } else |
|
435 | 447 | { |
436 | 448 | $mdesc = $r1->scalarval(); |
437 | 449 | $msig = php_xmlrpc_decode($r2); |
@@ -441,16 +453,14 @@ discard block |
||
441 | 453 | $clientcookies == '') |
442 | 454 | { |
443 | 455 | $opts = 0; // simple client copy in stub code |
444 | - } |
|
445 | - else |
|
456 | + } else |
|
446 | 457 | { |
447 | 458 | $opts = 1; // complete client copy in stub code |
448 | 459 | } |
449 | 460 | if ($wstype == 1) |
450 | 461 | { |
451 | 462 | $prefix = 'jsonrpc'; |
452 | - } |
|
453 | - else |
|
463 | + } else |
|
454 | 464 | { |
455 | 465 | $prefix = 'xmlrpc'; |
456 | 466 | } |
@@ -477,8 +487,7 @@ discard block |
||
477 | 487 | } |
478 | 488 | } // if !$response->faultCode() |
479 | 489 | } // if $response |
480 | - } |
|
481 | - else |
|
490 | + } else |
|
482 | 491 | { |
483 | 492 | // no action taken yet: give some instructions on debugger usage |
484 | 493 | ?> |
@@ -3,8 +3,9 @@ |
||
3 | 3 | if (isset($_GET['run'])) |
4 | 4 | { |
5 | 5 | $path = parse_url($_GET['run']); |
6 | - if (isset($path['query'])) |
|
7 | - $query = '?'.$path['query']; |
|
6 | + if (isset($path['query'])) { |
|
7 | + $query = '?'.$path['query']; |
|
8 | + } |
|
8 | 9 | } |
9 | 10 | ?> |
10 | 11 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | **/ |
15 | 15 | |
16 | 16 | include(dirname(__FILE__).'/common.php'); |
17 | - if ($action == '') |
|
18 | - $action = 'list'; |
|
17 | + if ($action == '') { |
|
18 | + $action = 'list'; |
|
19 | + } |
|
19 | 20 | |
20 | 21 | // relative path to the visual xmlrpc editing dialog |
21 | 22 | $editorpath = '../../javascript/debugger/'; |
@@ -214,7 +215,10 @@ discard block |
||
214 | 215 | //--> |
215 | 216 | </script> |
216 | 217 | </head> |
217 | -<body onload="switchtransport(<?php echo $wstype;?>); switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) echo ' document.forms[2].submit();'; ?>"> |
|
218 | +<body onload="switchtransport(<?php echo $wstype;?>); switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) { |
|
219 | + echo ' document.forms[2].submit();'; |
|
220 | +} |
|
221 | +?>"> |
|
218 | 222 | <h1>XMLRPC <form name="frmxmlrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(0);"/></form> |
219 | 223 | /<form name="frmjsonrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(1);"/></form>JSONRPC Debugger (based on the <a href="http://phpxmlrpc.sourceforge.net">PHP-XMLRPC</a> library)</h1> |
220 | 224 | <form name="frmaction" method="get" action="action.php" target="frmaction" onSubmit="switchFormMethod();" |
@@ -232,10 +236,22 @@ discard block |
||
232 | 236 | <table id="actionblock"> |
233 | 237 | <tr> |
234 | 238 | <td><h2>Action</h2></td> |
235 | -<td>List available methods<input type="radio" name="action" value="list"<?php if ($action=='list') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
236 | -<td>Describe method<input type="radio" name="action" value="describe"<?php if ($action=='describe') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
237 | -<td>Execute method<input type="radio" name="action" value="execute"<?php if ($action=='execute') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
238 | -<td>Generate stub for method call<input type="radio" name="action" value="wrap"<?php if ($action=='wrap') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
239 | +<td>List available methods<input type="radio" name="action" value="list"<?php if ($action=='list') { |
|
240 | + echo ' checked="checked"'; |
|
241 | +} |
|
242 | +?> onclick="switchaction();" /></td> |
|
243 | +<td>Describe method<input type="radio" name="action" value="describe"<?php if ($action=='describe') { |
|
244 | + echo ' checked="checked"'; |
|
245 | +} |
|
246 | +?> onclick="switchaction();" /></td> |
|
247 | +<td>Execute method<input type="radio" name="action" value="execute"<?php if ($action=='execute') { |
|
248 | + echo ' checked="checked"'; |
|
249 | +} |
|
250 | +?> onclick="switchaction();" /></td> |
|
251 | +<td>Generate stub for method call<input type="radio" name="action" value="wrap"<?php if ($action=='wrap') { |
|
252 | + echo ' checked="checked"'; |
|
253 | +} |
|
254 | +?> onclick="switchaction();" /></td> |
|
239 | 255 | </tr> |
240 | 256 | </table> |
241 | 257 | <input type="hidden" name="methodsig" value="<?php echo htmlspecialchars($methodsig, ENT_COMPAT, $inputcharset); ?>" /> |
@@ -255,16 +271,37 @@ discard block |
||
255 | 271 | <tr> |
256 | 272 | <td><h2>Client options</h2></td> |
257 | 273 | <td class="labelcell">Show debug info:</td><td><select name="debug"> |
258 | -<option value="0"<?php if ($debug == 0) echo ' selected="selected"'; ?>>No</option> |
|
259 | -<option value="1"<?php if ($debug == 1) echo ' selected="selected"'; ?>>Yes</option> |
|
260 | -<option value="2"<?php if ($debug == 2) echo ' selected="selected"'; ?>>More</option> |
|
274 | +<option value="0"<?php if ($debug == 0) { |
|
275 | + echo ' selected="selected"'; |
|
276 | +} |
|
277 | +?>>No</option> |
|
278 | +<option value="1"<?php if ($debug == 1) { |
|
279 | + echo ' selected="selected"'; |
|
280 | +} |
|
281 | +?>>Yes</option> |
|
282 | +<option value="2"<?php if ($debug == 2) { |
|
283 | + echo ' selected="selected"'; |
|
284 | +} |
|
285 | +?>>More</option> |
|
261 | 286 | </select> |
262 | 287 | </td> |
263 | -<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) echo $timeout; ?>" /></td> |
|
288 | +<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) { |
|
289 | + echo $timeout; |
|
290 | +} |
|
291 | +?>" /></td> |
|
264 | 292 | <td class="labelcell">Protocol:</td><td><select name="protocol" onchange="switchssl(); switchauth(); swicthcainfo();"> |
265 | -<option value="0"<?php if ($protocol == 0) echo ' selected="selected"'; ?>>HTTP 1.0</option> |
|
266 | -<option value="1"<?php if ($protocol == 1) echo ' selected="selected"'; ?>>HTTP 1.1</option> |
|
267 | -<option value="2"<?php if ($protocol == 2) echo ' selected="selected"'; ?>>HTTPS</option> |
|
293 | +<option value="0"<?php if ($protocol == 0) { |
|
294 | + echo ' selected="selected"'; |
|
295 | +} |
|
296 | +?>>HTTP 1.0</option> |
|
297 | +<option value="1"<?php if ($protocol == 1) { |
|
298 | + echo ' selected="selected"'; |
|
299 | +} |
|
300 | +?>>HTTP 1.1</option> |
|
301 | +<option value="2"<?php if ($protocol == 2) { |
|
302 | + echo ' selected="selected"'; |
|
303 | +} |
|
304 | +?>>HTTPS</option> |
|
268 | 305 | </select></td> |
269 | 306 | </tr> |
270 | 307 | <tr> |
@@ -272,20 +309,41 @@ discard block |
||
272 | 309 | <td class="labelcell">Username:</td><td><input type="text" name="username" value="<?php echo htmlspecialchars($username, ENT_COMPAT, $inputcharset); ?>" /></td> |
273 | 310 | <td class="labelcell">Pwd:</td><td><input type="password" name="password" value="<?php echo htmlspecialchars($password, ENT_COMPAT, $inputcharset); ?>" /></td> |
274 | 311 | <td class="labelcell">Type</td><td><select name="authtype"> |
275 | -<option value="1"<?php if ($authtype == 1) echo ' selected="selected"'; ?>>Basic</option> |
|
276 | -<option value="2"<?php if ($authtype == 2) echo ' selected="selected"'; ?>>Digest</option> |
|
277 | -<option value="8"<?php if ($authtype == 8) echo ' selected="selected"'; ?>>NTLM</option> |
|
312 | +<option value="1"<?php if ($authtype == 1) { |
|
313 | + echo ' selected="selected"'; |
|
314 | +} |
|
315 | +?>>Basic</option> |
|
316 | +<option value="2"<?php if ($authtype == 2) { |
|
317 | + echo ' selected="selected"'; |
|
318 | +} |
|
319 | +?>>Digest</option> |
|
320 | +<option value="8"<?php if ($authtype == 8) { |
|
321 | + echo ' selected="selected"'; |
|
322 | +} |
|
323 | +?>>NTLM</option> |
|
278 | 324 | </select></td> |
279 | 325 | <td></td> |
280 | 326 | </tr> |
281 | 327 | <tr> |
282 | 328 | <td class="labelcell">SSL:</td> |
283 | 329 | <td class="labelcell">Verify Host's CN:</td><td><select name="verifyhost"> |
284 | -<option value="0"<?php if ($verifyhost == 0) echo ' selected="selected"'; ?>>No</option> |
|
285 | -<option value="1"<?php if ($verifyhost == 1) echo ' selected="selected"'; ?>>Check CN existance</option> |
|
286 | -<option value="2"<?php if ($verifyhost == 2) echo ' selected="selected"'; ?>>Check CN match</option> |
|
330 | +<option value="0"<?php if ($verifyhost == 0) { |
|
331 | + echo ' selected="selected"'; |
|
332 | +} |
|
333 | +?>>No</option> |
|
334 | +<option value="1"<?php if ($verifyhost == 1) { |
|
335 | + echo ' selected="selected"'; |
|
336 | +} |
|
337 | +?>>Check CN existance</option> |
|
338 | +<option value="2"<?php if ($verifyhost == 2) { |
|
339 | + echo ' selected="selected"'; |
|
340 | +} |
|
341 | +?>>Check CN match</option> |
|
287 | 342 | </select></td> |
288 | -<td class="labelcell">Verify Cert:</td><td><input type="checkbox" value="1" name="verifypeer" onclick="swicthcainfo();"<?php if ($verifypeer) echo ' checked="checked"'; ?> /></td> |
|
343 | +<td class="labelcell">Verify Cert:</td><td><input type="checkbox" value="1" name="verifypeer" onclick="swicthcainfo();"<?php if ($verifypeer) { |
|
344 | + echo ' checked="checked"'; |
|
345 | +} |
|
346 | +?> /></td> |
|
289 | 347 | <td class="labelcell">CA Cert file:</td><td><input type="text" name="cainfo" value="<?php echo htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset); ?>" /></td> |
290 | 348 | </tr> |
291 | 349 | <tr> |
@@ -297,15 +355,36 @@ discard block |
||
297 | 355 | <tr> |
298 | 356 | <td class="labelcell">COMPRESSION:</td> |
299 | 357 | <td class="labelcell">Request:</td><td><select name="requestcompression"> |
300 | -<option value="0"<?php if ($requestcompression == 0) echo ' selected="selected"'; ?>>None</option> |
|
301 | -<option value="1"<?php if ($requestcompression == 1) echo ' selected="selected"'; ?>>Gzip</option> |
|
302 | -<option value="2"<?php if ($requestcompression == 2) echo ' selected="selected"'; ?>>Deflate</option> |
|
358 | +<option value="0"<?php if ($requestcompression == 0) { |
|
359 | + echo ' selected="selected"'; |
|
360 | +} |
|
361 | +?>>None</option> |
|
362 | +<option value="1"<?php if ($requestcompression == 1) { |
|
363 | + echo ' selected="selected"'; |
|
364 | +} |
|
365 | +?>>Gzip</option> |
|
366 | +<option value="2"<?php if ($requestcompression == 2) { |
|
367 | + echo ' selected="selected"'; |
|
368 | +} |
|
369 | +?>>Deflate</option> |
|
303 | 370 | </select></td> |
304 | 371 | <td class="labelcell">Response:</td><td><select name="responsecompression"> |
305 | -<option value="0"<?php if ($responsecompression == 0) echo ' selected="selected"'; ?>>None</option> |
|
306 | -<option value="1"<?php if ($responsecompression == 1) echo ' selected="selected"'; ?>>Gzip</option> |
|
307 | -<option value="2"<?php if ($responsecompression == 2) echo ' selected="selected"'; ?>>Deflate</option> |
|
308 | -<option value="3"<?php if ($responsecompression == 3) echo ' selected="selected"'; ?>>Any</option> |
|
372 | +<option value="0"<?php if ($responsecompression == 0) { |
|
373 | + echo ' selected="selected"'; |
|
374 | +} |
|
375 | +?>>None</option> |
|
376 | +<option value="1"<?php if ($responsecompression == 1) { |
|
377 | + echo ' selected="selected"'; |
|
378 | +} |
|
379 | +?>>Gzip</option> |
|
380 | +<option value="2"<?php if ($responsecompression == 2) { |
|
381 | + echo ' selected="selected"'; |
|
382 | +} |
|
383 | +?>>Deflate</option> |
|
384 | +<option value="3"<?php if ($responsecompression == 3) { |
|
385 | + echo ' selected="selected"'; |
|
386 | +} |
|
387 | +?>>Any</option> |
|
309 | 388 | </select></td> |
310 | 389 | <td></td> |
311 | 390 | </tr> |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | if(dba_exists($countID, $dbh)) |
29 | 29 | { |
30 | 30 | $count=dba_fetch($countID, $dbh); |
31 | - } |
|
32 | - else |
|
31 | + } else |
|
33 | 32 | { |
34 | 33 | $count=0; |
35 | 34 | } |
@@ -48,8 +47,7 @@ discard block |
||
48 | 47 | if($err) |
49 | 48 | { |
50 | 49 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
51 | - } |
|
52 | - else |
|
50 | + } else |
|
53 | 51 | { |
54 | 52 | // otherwise, we create the right response |
55 | 53 | // with the state name |
@@ -72,8 +70,7 @@ discard block |
||
72 | 70 | if(XMLRPC_EPI_ENABLED == '1') |
73 | 71 | { |
74 | 72 | $msgID=xmlrpc_decode($m->getParam(0)); |
75 | - } |
|
76 | - else |
|
73 | + } else |
|
77 | 74 | { |
78 | 75 | $msgID=php_xmlrpc_decode($m->getParam(0)); |
79 | 76 | } |
@@ -100,8 +97,7 @@ discard block |
||
100 | 97 | if($err) |
101 | 98 | { |
102 | 99 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
103 | - } |
|
104 | - else |
|
100 | + } else |
|
105 | 101 | { |
106 | 102 | // otherwise, we create the right response |
107 | 103 | // with the state name |
@@ -93,8 +93,7 @@ discard block |
||
93 | 93 | if (isset($stateNames[$snv-1])) |
94 | 94 | { |
95 | 95 | $sname=$stateNames[$snv-1]; |
96 | - } |
|
97 | - else |
|
96 | + } else |
|
98 | 97 | { |
99 | 98 | // not, there so complain |
100 | 99 | $err="I don't have a state for the index '" . $snv . "'"; |
@@ -104,8 +103,7 @@ discard block |
||
104 | 103 | if ($err) |
105 | 104 | { |
106 | 105 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
107 | - } |
|
108 | - else |
|
106 | + } else |
|
109 | 107 | { |
110 | 108 | // otherwise, we create the right response |
111 | 109 | // with the state name |
@@ -125,8 +123,7 @@ discard block |
||
125 | 123 | if (isset($stateNames[$stateno-1])) |
126 | 124 | { |
127 | 125 | return $stateNames[$stateno-1]; |
128 | - } |
|
129 | - else |
|
126 | + } else |
|
130 | 127 | { |
131 | 128 | // not, there so complain |
132 | 129 | return "I don't have a state for the index '" . $stateno . "'"; |
@@ -208,8 +205,7 @@ discard block |
||
208 | 205 | if ($b->scalarval()) |
209 | 206 | { |
210 | 207 | $rv->addScalar(false, "boolean"); |
211 | - } |
|
212 | - else |
|
208 | + } else |
|
213 | 209 | { |
214 | 210 | $rv->addScalar(true, "boolean"); |
215 | 211 | } |
@@ -304,8 +300,7 @@ discard block |
||
304 | 300 | } |
305 | 301 | // add this array to the output value |
306 | 302 | $v->addArray($outAr); |
307 | - } |
|
308 | - else |
|
303 | + } else |
|
309 | 304 | { |
310 | 305 | $err="Must be one parameter, an array of structs"; |
311 | 306 | } |
@@ -313,8 +308,7 @@ discard block |
||
313 | 308 | if ($err) |
314 | 309 | { |
315 | 310 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
316 | - } |
|
317 | - else |
|
311 | + } else |
|
318 | 312 | { |
319 | 313 | return new xmlrpcresp($v); |
320 | 314 | } |
@@ -393,8 +387,7 @@ discard block |
||
393 | 387 | if ($err) |
394 | 388 | { |
395 | 389 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
396 | - } |
|
397 | - else |
|
390 | + } else |
|
398 | 391 | { |
399 | 392 | return new xmlrpcresp(new xmlrpcval("true", $xmlrpcBoolean)); |
400 | 393 | } |
@@ -408,15 +401,15 @@ discard block |
||
408 | 401 | if (function_exists('getallheaders')) |
409 | 402 | { |
410 | 403 | return new xmlrpcresp(php_xmlrpc_encode(getallheaders())); |
411 | - } |
|
412 | - else |
|
404 | + } else |
|
413 | 405 | { |
414 | 406 | $headers = array(); |
415 | 407 | // IIS: poor man's version of getallheaders |
416 | - foreach ($_SERVER as $key => $val) |
|
417 | - if (strpos($key, 'HTTP_') === 0) |
|
408 | + foreach ($_SERVER as $key => $val) { |
|
409 | + if (strpos($key, 'HTTP_') === 0) |
|
418 | 410 | { |
419 | 411 | $key = ucfirst(str_replace('_', '-', strtolower(substr($key, 5)))); |
412 | + } |
|
420 | 413 | $headers[$key] = $val; |
421 | 414 | } |
422 | 415 | return new xmlrpcresp(php_xmlrpc_encode($headers)); |
@@ -825,17 +818,21 @@ discard block |
||
825 | 818 | ) |
826 | 819 | ); |
827 | 820 | |
828 | - if ($findstate2_sig) |
|
829 | - $a['examples.php.getStateName'] = $findstate2_sig; |
|
821 | + if ($findstate2_sig) { |
|
822 | + $a['examples.php.getStateName'] = $findstate2_sig; |
|
823 | + } |
|
830 | 824 | |
831 | - if ($findstate3_sig) |
|
832 | - $a['examples.php2.getStateName'] = $findstate3_sig; |
|
825 | + if ($findstate3_sig) { |
|
826 | + $a['examples.php2.getStateName'] = $findstate3_sig; |
|
827 | + } |
|
833 | 828 | |
834 | - if ($findstate4_sig) |
|
835 | - $a['examples.php3.getStateName'] = $findstate4_sig; |
|
829 | + if ($findstate4_sig) { |
|
830 | + $a['examples.php3.getStateName'] = $findstate4_sig; |
|
831 | + } |
|
836 | 832 | |
837 | - if ($findstate5_sig) |
|
838 | - $a['examples.php4.getStateName'] = $findstate5_sig; |
|
833 | + if ($findstate5_sig) { |
|
834 | + $a['examples.php4.getStateName'] = $findstate5_sig; |
|
835 | + } |
|
839 | 836 | |
840 | 837 | $s=new xmlrpc_server($a, false); |
841 | 838 | $s->setdebug(3); |
@@ -843,10 +840,12 @@ discard block |
||
843 | 840 | |
844 | 841 | // out-of-band information: let the client manipulate the server operations. |
845 | 842 | // we do this to help the testsuite script: do not reproduce in production! |
846 | - if (isset($_GET['RESPONSE_ENCODING'])) |
|
847 | - $s->response_charset_encoding = $_GET['RESPONSE_ENCODING']; |
|
848 | - if (isset($_GET['EXCEPTION_HANDLING'])) |
|
849 | - $s->exception_handling = $_GET['EXCEPTION_HANDLING']; |
|
843 | + if (isset($_GET['RESPONSE_ENCODING'])) { |
|
844 | + $s->response_charset_encoding = $_GET['RESPONSE_ENCODING']; |
|
845 | + } |
|
846 | + if (isset($_GET['EXCEPTION_HANDLING'])) { |
|
847 | + $s->exception_handling = $_GET['EXCEPTION_HANDLING']; |
|
848 | + } |
|
850 | 849 | $s->service(); |
851 | 850 | // that should do all we need! |
852 | 851 | ?> |
853 | 852 | \ No newline at end of file |
@@ -51,10 +51,11 @@ discard block |
||
51 | 51 | <h2>Meerkat integration</h2> |
52 | 52 | <?php |
53 | 53 | @$catid=$_GET["catid"]; |
54 | -if (@$_GET["oc"]==$catid) |
|
54 | +if (@$_GET["oc"]==$catid) { |
|
55 | 55 | @$chanid=$_GET["chanid"]; |
56 | -else |
|
56 | +} else { |
|
57 | 57 | $chanid=0; |
58 | +} |
|
58 | 59 | |
59 | 60 | $client=new xmlrpc_client("/meerkat/xml-rpc/server.php", |
60 | 61 | "www.oreillynet.com", 80); |
@@ -81,9 +82,10 @@ discard block |
||
81 | 82 | <?php |
82 | 83 | } else { |
83 | 84 | $categories=dispatch($client, "meerkat.getCategories", array()); |
84 | - if ($catid) |
|
85 | - $sources = dispatch($client, "meerkat.getChannelsByCategory", |
|
85 | + if ($catid) { |
|
86 | + $sources = dispatch($client, "meerkat.getChannelsByCategory", |
|
86 | 87 | array(new xmlrpcval($catid, "int"))); |
88 | + } |
|
87 | 89 | if ($chanid) { |
88 | 90 | $stories = dispatch($client, "meerkat.getItems", |
89 | 91 | array(new xmlrpcval( |
@@ -100,11 +102,14 @@ discard block |
||
100 | 102 | <p>Subject area:<br /> |
101 | 103 | <select name="catid"> |
102 | 104 | <?php |
103 | - if (!$catid) |
|
104 | - print "<option value=\"0\">Choose a category</option>\n"; |
|
105 | + if (!$catid) { |
|
106 | + print "<option value=\"0\">Choose a category</option>\n"; |
|
107 | + } |
|
105 | 108 | while(list($k,$v) = each($categories)) { |
106 | 109 | print "<option value=\"" . $v['id'] ."\""; |
107 | - if ($v['id']==$catid) print " selected=\"selected\""; |
|
110 | + if ($v['id']==$catid) { |
|
111 | + print " selected=\"selected\""; |
|
112 | + } |
|
108 | 113 | print ">". $v['title'] . "</option>\n"; |
109 | 114 | } |
110 | 115 | ?> |
@@ -115,11 +120,14 @@ discard block |
||
115 | 120 | <p>News source:<br /> |
116 | 121 | <select name="chanid"> |
117 | 122 | <?php |
118 | - if (!$chanid) |
|
119 | - print "<option value=\"0\">Choose a source</option>\n"; |
|
123 | + if (!$chanid) { |
|
124 | + print "<option value=\"0\">Choose a source</option>\n"; |
|
125 | + } |
|
120 | 126 | while(list($k,$v) = each($sources)) { |
121 | 127 | print "<option value=\"" . $v['id'] ."\""; |
122 | - if ($v['id']==$chanid) print "\" selected=\"selected\""; |
|
128 | + if ($v['id']==$chanid) { |
|
129 | + print "\" selected=\"selected\""; |
|
130 | + } |
|
123 | 131 | print ">". $v['title'] . "</option>\n"; |
124 | 132 | } |
125 | 133 | ?> |
@@ -17,22 +17,22 @@ |
||
17 | 17 | if($r->faultCode()) |
18 | 18 | { |
19 | 19 | echo "<p>Server methods list could not be retrieved: error '".htmlspecialchars($r->faultString())."'</p>\n"; |
20 | - } |
|
21 | - else |
|
20 | + } else |
|
22 | 21 | { |
23 | 22 | $testcase = ''; |
24 | 23 | echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"; |
25 | - foreach($r->value() as $methodname) // $r->value is an array of strings |
|
24 | + foreach($r->value() as $methodname) { |
|
25 | + // $r->value is an array of strings |
|
26 | 26 | { |
27 | 27 | // do not wrap remote server system methods |
28 | 28 | if (strpos($methodname, 'system.') !== 0) |
29 | 29 | { |
30 | 30 | $funcname = wrap_xmlrpc_method($c, $methodname); |
31 | + } |
|
31 | 32 | if($funcname) |
32 | 33 | { |
33 | 34 | echo "<li>Remote server method ".htmlspecialchars($methodname)." wrapped into php function ".$funcname."</li>\n"; |
34 | - } |
|
35 | - else |
|
35 | + } else |
|
36 | 36 | { |
37 | 37 | echo "<li>Remote server method ".htmlspecialchars($methodname)." could not be wrapped!</li>\n"; |
38 | 38 | } |
@@ -30,15 +30,13 @@ |
||
30 | 30 | . htmlspecialchars($v->scalarval()) . "<br/>"; |
31 | 31 | // print "<HR>I got this value back<BR><PRE>" . |
32 | 32 | // htmlentities($r->serialize()). "</PRE><HR>\n"; |
33 | - } |
|
34 | - else |
|
33 | + } else |
|
35 | 34 | { |
36 | 35 | print "An error occurred: "; |
37 | 36 | print "Code: " . htmlspecialchars($r->faultCode()) |
38 | 37 | . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>"; |
39 | 38 | } |
40 | - } |
|
41 | - else |
|
39 | + } else |
|
42 | 40 | { |
43 | 41 | $stateno = ""; |
44 | 42 | } |