@@ -17,7 +17,12 @@ discard block |
||
17 | 17 | <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> |
18 | 18 | <head> |
19 | 19 | <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico"> |
20 | - <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) echo 'JSONRPC'; else echo 'XMLRPC'; ?> Debugger</title> |
|
20 | + <title><?php if (defined('DEFAULT_WSTYPE') && DEFAULT_WSTYPE == 1) { |
|
21 | + echo 'JSONRPC'; |
|
22 | +} else { |
|
23 | + echo 'XMLRPC'; |
|
24 | +} |
|
25 | +?> Debugger</title> |
|
21 | 26 | <meta name="robots" content="index,nofollow"/> |
22 | 27 | <style type="text/css"> |
23 | 28 | <!-- |
@@ -366,7 +371,9 @@ discard block |
||
366 | 371 | echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; |
367 | 372 | if ($x->count() > 1) { |
368 | 373 | foreach($x as $k => $y) { |
369 | - if ($k == 0) continue; |
|
374 | + if ($k == 0) { |
|
375 | + continue; |
|
376 | + } |
|
370 | 377 | echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
371 | 378 | if ($wstype != 1) { |
372 | 379 | $type = $y->scalarval(); |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | <body> |
93 | 93 | <?php |
94 | 94 | |
95 | -include __DIR__ . '/common.php'; |
|
95 | +include __DIR__.'/common.php'; |
|
96 | 96 | |
97 | 97 | if ($action) { |
98 | 98 | |
99 | 99 | // make sure the script waits long enough for the call to complete... |
100 | 100 | if ($timeout) { |
101 | - set_time_limit($timeout + 10); |
|
101 | + set_time_limit($timeout+10); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if ($wstype == 1) { |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | $server = "$host$path"; |
124 | 124 | } |
125 | 125 | if ($protocol == 2) { |
126 | - $server = 'https://' . $server; |
|
126 | + $server = 'https://'.$server; |
|
127 | 127 | } else { |
128 | - $server = 'http://' . $server; |
|
128 | + $server = 'http://'.$server; |
|
129 | 129 | } |
130 | 130 | if ($proxy != '') { |
131 | 131 | $pproxy = explode(':', $proxy); |
132 | - if (count($pproxy) > 1) { |
|
132 | + if (count($pproxy)>1) { |
|
133 | 133 | $pport = $pproxy[1]; |
134 | 134 | } else { |
135 | 135 | $pport = 8080; |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | case 'wrap': |
199 | 199 | $msg[0] = new $requestClass('system.methodHelp', array(), $id); |
200 | 200 | $msg[0]->addparam(new PhpXmlRpc\Value($method)); |
201 | - $msg[1] = new $requestClass('system.methodSignature', array(), (int)$id + 1); |
|
201 | + $msg[1] = new $requestClass('system.methodSignature', array(), (int) $id+1); |
|
202 | 202 | $msg[1]->addparam(new PhpXmlRpc\Value($method)); |
203 | - $actionname = 'Description of method "' . $method . '"'; |
|
203 | + $actionname = 'Description of method "'.$method.'"'; |
|
204 | 204 | break; |
205 | 205 | case 'list': |
206 | 206 | $msg[0] = new $requestClass('system.listMethods', array(), $id); |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | $msg[0] = new $requestClass($method, array(), $id); |
214 | 214 | // hack! build xml payload by hand |
215 | 215 | if ($wstype == 1) { |
216 | - $msg[0]->payload = "{\n" . |
|
217 | - '"method": "' . $method . "\",\n\"params\": [" . |
|
218 | - $payload . |
|
216 | + $msg[0]->payload = "{\n". |
|
217 | + '"method": "'.$method."\",\n\"params\": [". |
|
218 | + $payload. |
|
219 | 219 | "\n],\n\"id\": "; |
220 | 220 | // fix: if user gave an empty string, use NULL, or we'll break json syntax |
221 | 221 | if ($id == "") { |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | } |
229 | 229 | } |
230 | 230 | } else { |
231 | - $msg[0]->payload = $msg[0]->xml_header($inputcharset) . |
|
232 | - '<methodName>' . $method . "</methodName>\n<params>" . |
|
233 | - $payload . |
|
234 | - "</params>\n" . $msg[0]->xml_footer(); |
|
231 | + $msg[0]->payload = $msg[0]->xml_header($inputcharset). |
|
232 | + '<methodName>'.$method."</methodName>\n<params>". |
|
233 | + $payload. |
|
234 | + "</params>\n".$msg[0]->xml_footer(); |
|
235 | 235 | } |
236 | - $actionname = 'Execution of method ' . $method; |
|
236 | + $actionname = 'Execution of method '.$method; |
|
237 | 237 | break; |
238 | 238 | default: // give a warning |
239 | - $actionname = '[ERROR: unknown action] "' . $action . '"'; |
|
239 | + $actionname = '[ERROR: unknown action] "'.$action.'"'; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | // Before calling execute, echo out brief description of action taken + date and time ??? |
243 | 243 | // this gives good user feedback for long-running methods... |
244 | - echo '<h2>' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . ' on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . " ...</h2>\n"; |
|
244 | + echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset)." ...</h2>\n"; |
|
245 | 245 | flush(); |
246 | 246 | |
247 | 247 | $response = null; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | break; |
260 | 260 | } |
261 | 261 | } |
262 | - $time = microtime(true) - $time; |
|
262 | + $time = microtime(true)-$time; |
|
263 | 263 | if ($debug) { |
264 | 264 | echo "</div>\n"; |
265 | 265 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | // call failed! echo out error msg! |
270 | 270 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
271 | 271 | echo "<h3>$protoName call FAILED!</h3>\n"; |
272 | - echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
273 | - "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</p>\n"; |
|
272 | + echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
273 | + "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."'</p>\n"; |
|
274 | 274 | echo(date("d/M/Y:H:i:s\n")); |
275 | 275 | } else { |
276 | 276 | // call succeeded: parse results |
@@ -286,36 +286,36 @@ discard block |
||
286 | 286 | $max = $v->count(); |
287 | 287 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
288 | 288 | echo "<thead>\n<tr><th>Method ($max)</th><th>Description</th></tr>\n</thead>\n<tbody>\n"; |
289 | - foreach($v as $i => $rec) { |
|
289 | + foreach ($v as $i => $rec) { |
|
290 | 290 | if ($i % 2) { |
291 | 291 | $class = ' class="oddrow"'; |
292 | 292 | } else { |
293 | 293 | $class = ' class="evenrow"'; |
294 | 294 | } |
295 | - echo("<tr><td$class>" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">" . |
|
296 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
297 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
298 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
299 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
300 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
301 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
302 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
303 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
304 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
305 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
306 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
307 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
308 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
309 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
310 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
311 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
312 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
313 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
314 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
315 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" . |
|
316 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
317 | - "<input type=\"hidden\" name=\"action\" value=\"describe\" />" . |
|
318 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
295 | + echo("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
|
296 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
297 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
298 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
299 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
300 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
301 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
302 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
303 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
304 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
305 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
306 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
307 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
308 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
309 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
310 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
311 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
312 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
313 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
314 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
315 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."\" />". |
|
316 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
317 | + "<input type=\"hidden\" name=\"action\" value=\"describe\" />". |
|
318 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
319 | 319 | "<input type=\"submit\" value=\"Describe\" /></form></td>"); |
320 | 320 | //echo("</tr>\n"); |
321 | 321 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $r2 = $resp[1]->value(); |
343 | 343 | |
344 | 344 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
345 | - echo "<thead>\n<tr><th>Method</th><th>" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
345 | + echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
346 | 346 | $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
347 | 347 | if ($desc == "") { |
348 | 348 | $desc = "-"; |
@@ -352,41 +352,41 @@ discard block |
||
352 | 352 | if ($r2->kindOf() != "array") { |
353 | 353 | echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
354 | 354 | } else { |
355 | - foreach($r2 as $i => $x) { |
|
355 | + foreach ($r2 as $i => $x) { |
|
356 | 356 | $payload = ""; |
357 | 357 | $alt_payload = ""; |
358 | - if ($i + 1 % 2) { |
|
358 | + if ($i+1 % 2) { |
|
359 | 359 | $class = ' class="oddrow"'; |
360 | 360 | } else { |
361 | 361 | $class = ' class="evenrow"'; |
362 | 362 | } |
363 | - echo "<tr><td$class>Signature " . ($i + 1) . "</td><td$class>"; |
|
363 | + echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
|
364 | 364 | if ($x->kindOf() == "array") { |
365 | 365 | $ret = $x[0]; |
366 | - echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; |
|
367 | - if ($x->count() > 1) { |
|
368 | - foreach($x as $k => $y) { |
|
366 | + echo "<code>OUT: ".htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."<br />IN: ("; |
|
367 | + if ($x->count()>1) { |
|
368 | + foreach ($x as $k => $y) { |
|
369 | 369 | if ($k == 0) continue; |
370 | 370 | echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
371 | 371 | if ($wstype != 1) { |
372 | 372 | $type = $y->scalarval(); |
373 | 373 | $payload .= '<param><value>'; |
374 | - switch($type) { |
|
374 | + switch ($type) { |
|
375 | 375 | case 'undefined': |
376 | 376 | break; |
377 | 377 | case 'null'; |
378 | 378 | $type = 'nil'; |
379 | 379 | // fall thru intentionally |
380 | 380 | default: |
381 | - $payload .= '<' . |
|
382 | - htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
383 | - '></' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
381 | + $payload .= '<'. |
|
382 | + htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
383 | + '></'.htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
384 | 384 | '>'; |
385 | 385 | } |
386 | 386 | $payload .= "</value></param>\n"; |
387 | 387 | } |
388 | 388 | $alt_payload .= $y->scalarval(); |
389 | - if ($k < $x->count() - 1) { |
|
389 | + if ($k<$x->count()-1) { |
|
390 | 390 | $alt_payload .= ';'; |
391 | 391 | echo ", "; |
392 | 392 | } |
@@ -399,63 +399,63 @@ discard block |
||
399 | 399 | echo '</td>'; |
400 | 400 | // button to test this method |
401 | 401 | //$payload="<methodCall>\n<methodName>$method</methodName>\n<params>\n$payload</params>\n</methodCall>"; |
402 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
403 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
404 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
405 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
406 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
407 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
408 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
409 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
410 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
411 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
412 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
413 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
414 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
415 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
416 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
417 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
418 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
419 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
420 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
421 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
422 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
423 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
424 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
425 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
402 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
403 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
404 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
405 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
406 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
407 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
408 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
409 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
410 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
411 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
412 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
413 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
414 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
415 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
416 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
417 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
418 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
419 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
420 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
421 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
422 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
423 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
424 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
425 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
426 | 426 | "<input type=\"hidden\" name=\"action\" value=\"execute\" />"; |
427 | 427 | if ($wstype != 1) { |
428 | 428 | echo "<input type=\"submit\" value=\"Load method synopsis\" />"; |
429 | 429 | } |
430 | 430 | echo "</form></td>\n"; |
431 | 431 | |
432 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
433 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
434 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
435 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
436 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
437 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
438 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
439 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
440 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
441 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
442 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
443 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
444 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
445 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
446 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
447 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
448 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
449 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
450 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
451 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
452 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
453 | - "<input type=\"hidden\" name=\"methodsig\" value=\"" . $i . "\" />" . |
|
454 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
455 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
456 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
457 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
458 | - "<input type=\"hidden\" name=\"action\" value=\"wrap\" />" . |
|
432 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
433 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
434 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
435 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
436 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
437 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
438 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
439 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
440 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
441 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
442 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
443 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
444 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
445 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
446 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
447 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
448 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
449 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
450 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
451 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
452 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
453 | + "<input type=\"hidden\" name=\"methodsig\" value=\"".$i."\" />". |
|
454 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
455 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
456 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
457 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
458 | + "<input type=\"hidden\" name=\"action\" value=\"wrap\" />". |
|
459 | 459 | "<input type=\"submit\" value=\"Generate method call stub code\" />"; |
460 | 460 | echo "</form></td></tr>\n"; |
461 | 461 | } |
@@ -467,14 +467,14 @@ discard block |
||
467 | 467 | case 'wrap': |
468 | 468 | $r1 = $resp[0]->value(); |
469 | 469 | $r2 = $resp[1]->value(); |
470 | - if ($r2->kindOf() != "array" || $r2->count() <= $methodsig) { |
|
470 | + if ($r2->kindOf() != "array" || $r2->count()<=$methodsig) { |
|
471 | 471 | echo "Error: signature unknown\n"; |
472 | 472 | } else { |
473 | 473 | $mdesc = $r1->scalarval(); |
474 | 474 | $encoder = new PhpXmlRpc\Encoder(); |
475 | 475 | $msig = $encoder->decode($r2); |
476 | 476 | $msig = $msig[$methodsig]; |
477 | - $proto = $protocol == 2 ? 'https' : ( $protocol == 1 ? 'http11' : '' ); |
|
477 | + $proto = $protocol == 2 ? 'https' : ($protocol == 1 ? 'http11' : ''); |
|
478 | 478 | if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
479 | 479 | $clientcookies == '' |
480 | 480 | ) { |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | $prefix = 'xmlrpc'; |
489 | 489 | } |
490 | 490 | $wrapper = new PhpXmlRpc\Wrapper(); |
491 | - $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc); |
|
491 | + $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix.'_'.$method), $msig, $mdesc); |
|
492 | 492 | //if ($code) |
493 | 493 | //{ |
494 | 494 | echo "<div id=\"phpcode\">\n"; |
495 | - highlight_string("<?php\n" . $code['docstring'] . $code['source'] . '?>'); |
|
495 | + highlight_string("<?php\n".$code['docstring'].$code['source'].'?>'); |
|
496 | 496 | echo "\n</div>"; |
497 | 497 | //} |
498 | 498 | //else |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | break; |
504 | 504 | |
505 | 505 | case 'execute': |
506 | - echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>'; |
|
506 | + echo '<div id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>'; |
|
507 | 507 | break; |
508 | 508 | |
509 | 509 | default: // give a warning |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | 'scalar' => $val, |
77 | 77 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
78 | 78 | ); |
79 | - return (object)$xmlrpcVal; |
|
79 | + return (object) $xmlrpcVal; |
|
80 | 80 | case 'base64': |
81 | 81 | $xmlrpcVal = array( |
82 | 82 | 'xmlrpc_type' => 'base64', |
83 | 83 | 'scalar' => $val |
84 | 84 | ); |
85 | - return (object)$xmlrpcVal; |
|
85 | + return (object) $xmlrpcVal; |
|
86 | 86 | case 'string': |
87 | 87 | if (isset($options['extension_api_encoding'])) { |
88 | 88 | $dval = @iconv('UTF-8', $options['extension_api_encoding'], $val); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | case 'array': |
118 | 118 | $arr = array(); |
119 | - foreach($xmlrpcVal as $value) { |
|
119 | + foreach ($xmlrpcVal as $value) { |
|
120 | 120 | $arr[] = $this->decode($value, $options); |
121 | 121 | } |
122 | 122 | return $arr; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | case 'msg': |
146 | 146 | $paramCount = $xmlrpcVal->getNumParams(); |
147 | 147 | $arr = array(); |
148 | - for ($i = 0; $i < $paramCount; $i++) { |
|
148 | + for ($i = 0; $i<$paramCount; $i++) { |
|
149 | 149 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
150 | 150 | } |
151 | 151 | return $arr; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | } else { |
241 | 241 | $arr = array(); |
242 | - foreach($phpVal as $k => $v) { |
|
242 | + foreach ($phpVal as $k => $v) { |
|
243 | 243 | $arr[$k] = $this->encode($v, $options); |
244 | 244 | } |
245 | 245 | $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | break; |
262 | 262 | case 'resource': |
263 | 263 | if (in_array('extension_api', $options)) { |
264 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
264 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
265 | 265 | } else { |
266 | 266 | $xmlrpcVal = new Value(); |
267 | 267 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | if (extension_loaded('mbstring')) { |
310 | 310 | $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding); |
311 | 311 | } else { |
312 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
312 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $parserOptions |
332 | 332 | ); |
333 | 333 | |
334 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
334 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
335 | 335 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
336 | 336 | |
337 | 337 | $this->getLogger()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | |
356 | 356 | case 'methodcall': |
357 | 357 | $req = new Request($xmlRpcParser->_xh['method']); |
358 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
358 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
359 | 359 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
360 | 360 | } |
361 | 361 | return $req; |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function buildConversionTable($tableName) |
65 | 65 | { |
66 | - switch($tableName) { |
|
66 | + switch ($tableName) { |
|
67 | 67 | case 'xml_iso88591_Entities': |
68 | 68 | if (count($this->xml_iso88591_Entities['in'])) { |
69 | 69 | return; |
70 | 70 | } |
71 | - for ($i = 0; $i < 32; $i++) { |
|
71 | + for ($i = 0; $i<32; $i++) { |
|
72 | 72 | $this->xml_iso88591_Entities["in"][] = chr($i); |
73 | 73 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
74 | 74 | } |
75 | 75 | |
76 | 76 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
77 | 77 | |
78 | - for ($i = 160; $i < 256; $i++) { |
|
78 | + for ($i = 160; $i<256; $i++) { |
|
79 | 79 | $this->xml_iso88591_Entities["in"][] = chr($i); |
80 | 80 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
81 | 81 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | break;*/ |
104 | 104 | |
105 | 105 | default: |
106 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
106 | + throw new \Exception('Unsupported table: '.$tableName); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $destEncoding = 'US-ASCII'; |
147 | 147 | } |
148 | 148 | |
149 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
149 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
150 | 150 | |
151 | 151 | // list ordered with (expected) most common scenarios first |
152 | 152 | switch ($conversion) { |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
165 | 165 | $escapedData = ''; |
166 | 166 | // be kind to users creating string xmlrpc values out of different php types |
167 | - $data = (string)$data; |
|
167 | + $data = (string) $data; |
|
168 | 168 | $ns = strlen($data); |
169 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
169 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
170 | 170 | $ch = $data[$nn]; |
171 | 171 | $ii = ord($ch); |
172 | 172 | // 7 bits in 1 byte: 0bbbbbbb (127) |
173 | - if ($ii < 32) { |
|
173 | + if ($ii<32) { |
|
174 | 174 | if ($conversion == 'UTF-8_US-ASCII') { |
175 | 175 | $escapedData .= sprintf('&#%d;', $ii); |
176 | 176 | } else { |
177 | 177 | $escapedData .= $ch; |
178 | 178 | } |
179 | 179 | } |
180 | - else if ($ii < 128) { |
|
180 | + else if ($ii<128) { |
|
181 | 181 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
182 | 182 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
183 | 183 | switch ($ii) { |
@@ -202,25 +202,25 @@ discard block |
||
202 | 202 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
203 | 203 | elseif ($ii >> 5 == 6) { |
204 | 204 | $b1 = ($ii & 31); |
205 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
206 | - $ii = ($b1 * 64) + $b2; |
|
205 | + $b2 = (ord($data[$nn+1]) & 63); |
|
206 | + $ii = ($b1 * 64)+$b2; |
|
207 | 207 | $escapedData .= sprintf('&#%d;', $ii); |
208 | 208 | $nn += 1; |
209 | 209 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
210 | 210 | elseif ($ii >> 4 == 14) { |
211 | 211 | $b1 = ($ii & 15); |
212 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
213 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
214 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
212 | + $b2 = (ord($data[$nn+1]) & 63); |
|
213 | + $b3 = (ord($data[$nn+2]) & 63); |
|
214 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
215 | 215 | $escapedData .= sprintf('&#%d;', $ii); |
216 | 216 | $nn += 2; |
217 | 217 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
218 | 218 | elseif ($ii >> 3 == 30) { |
219 | 219 | $b1 = ($ii & 7); |
220 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
221 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
222 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
223 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
220 | + $b2 = (ord($data[$nn+1]) & 63); |
|
221 | + $b3 = (ord($data[$nn+2]) & 63); |
|
222 | + $b4 = (ord($data[$nn+3]) & 63); |
|
223 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
224 | 224 | $escapedData .= sprintf('&#%d;', $ii); |
225 | 225 | $nn += 3; |
226 | 226 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | default: |
270 | 270 | $escapedData = ''; |
271 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
271 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | return $escapedData; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | case 'iso88591': |
323 | 323 | return $this->xml_iso88591_Entities; |
324 | 324 | default: |
325 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
325 | + throw new \Exception('Unsupported charset: '.$charset); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | } |
@@ -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) { |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | { |
28 | 28 | global $stateNames; |
29 | 29 | |
30 | - if (isset($stateNames[$stateNo - 1])) { |
|
31 | - return $stateNames[$stateNo - 1]; |
|
30 | + if (isset($stateNames[$stateNo-1])) { |
|
31 | + return $stateNames[$stateNo-1]; |
|
32 | 32 | } else { |
33 | 33 | // not, there so complain |
34 | - throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
34 | + throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | |
126 | 126 | $findstate10_sig = array( |
127 | 127 | /// @todo add a demo/test with a closure |
128 | - "function" => function ($req) { return findState($req); }, |
|
128 | + "function" => function($req) { return findState($req); }, |
|
129 | 129 | "signature" => array(array(Value::$xmlrpcString, Value::$xmlrpcInt)), |
130 | - "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the ' . |
|
130 | + "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the '. |
|
131 | 131 | 'index of that state name in an alphabetic order.', |
132 | 132 | ); |
133 | 133 | |
134 | -$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return plain_findstate($stateNo); }); |
|
134 | +$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return plain_findstate($stateNo); }); |
|
135 | 135 | |
136 | 136 | /// @todo do we really need a new instance ? |
137 | 137 | $c = new xmlrpcServerMethodsContainer(); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | $namespaceSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'namespacetest.', 'replace_class_name' => true, 'method_filter' => '/^findState$/', 'method_type' => 'static')); |
142 | 142 | |
143 | -$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
143 | +$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
144 | 144 | |
145 | 145 | return array_merge( |
146 | 146 | array( |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | public function xml_header($charsetEncoding = '') |
91 | 91 | { |
92 | 92 | if ($charsetEncoding != '') { |
93 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n"; |
|
93 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n"; |
|
94 | 94 | } else { |
95 | - return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; |
|
95 | + return "<?xml version=\"1.0\"?".">\n<methodCall>\n"; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | public function createPayload($charsetEncoding = '') |
113 | 113 | { |
114 | 114 | if ($charsetEncoding != '') { |
115 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
115 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
116 | 116 | } else { |
117 | 117 | $this->content_type = 'text/xml'; |
118 | 118 | } |
119 | 119 | $this->payload = $this->xml_header($charsetEncoding); |
120 | - $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities( |
|
121 | - $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n"; |
|
120 | + $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities( |
|
121 | + $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n"; |
|
122 | 122 | $this->payload .= "<params>\n"; |
123 | 123 | foreach ($this->params as $p) { |
124 | - $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) . |
|
124 | + $this->payload .= "<param>\n".$p->serialize($charsetEncoding). |
|
125 | 125 | "</param>\n"; |
126 | 126 | } |
127 | 127 | $this->payload .= "</params>\n"; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array()); |
249 | 249 | |
250 | 250 | if ($data == '') { |
251 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.'); |
|
251 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.'); |
|
252 | 252 | return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']); |
253 | 253 | } |
254 | 254 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | // failed processing of HTTP response headers |
262 | 262 | // save into response obj the full payload received, for debugging |
263 | 263 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode())); |
264 | - } catch(\Exception $e) { |
|
264 | + } catch (\Exception $e) { |
|
265 | 265 | return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data)); |
266 | 266 | } |
267 | 267 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib |
276 | 276 | $pos = strrpos($data, '</methodResponse>'); |
277 | 277 | if ($pos !== false) { |
278 | - $data = substr($data, 0, $pos + 17); |
|
278 | + $data = substr($data, 0, $pos+17); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // try to 'guestimate' the character encoding of the received response |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | if ($start) { |
287 | 287 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); |
288 | 288 | $end = strpos($data, '-->', $start); |
289 | - $comments = substr($data, $start, $end - $start); |
|
290 | - $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" . |
|
291 | - str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding); |
|
289 | + $comments = substr($data, $start, $end-$start); |
|
290 | + $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t". |
|
291 | + str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | if (extension_loaded('mbstring')) { |
312 | 312 | $data = mb_convert_encoding($data, 'UTF-8', $respEncoding); |
313 | 313 | } else { |
314 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding); |
|
314 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding); |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | } |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE, $options); |
333 | 333 | |
334 | 334 | // first error check: xml not well formed |
335 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
335 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
336 | 336 | |
337 | 337 | // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL' |
338 | 338 | |
339 | 339 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
340 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', |
|
340 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason'], '', |
|
341 | 341 | $this->httpResponse |
342 | 342 | ); |
343 | 343 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | // second error check: xml well formed but not xml-rpc compliant |
349 | 349 | elseif ($xmlRpcParser->_xh['isf'] == 2) { |
350 | 350 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'], |
351 | - PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', |
|
351 | + PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason'], '', |
|
352 | 352 | $this->httpResponse |
353 | 353 | ); |
354 | 354 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | '', $this->httpResponse |
367 | 367 | ); |
368 | 368 | } else { |
369 | - if ($this->debug > 1) { |
|
369 | + if ($this->debug>1) { |
|
370 | 370 | $this->getLogger()->debugMessage( |
371 | 371 | "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---" |
372 | 372 | ); |
@@ -151,35 +151,35 @@ discard block |
||
151 | 151 | public function serialize($charsetEncoding = '') |
152 | 152 | { |
153 | 153 | if ($charsetEncoding != '') { |
154 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
154 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
155 | 155 | } else { |
156 | 156 | $this->content_type = 'text/xml'; |
157 | 157 | } |
158 | 158 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
159 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
159 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
160 | 160 | } else { |
161 | 161 | $result = "<methodResponse>\n"; |
162 | 162 | } |
163 | 163 | if ($this->errno) { |
164 | 164 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
165 | - $result .= "<fault>\n" . |
|
166 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
167 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
168 | - Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" . |
|
165 | + $result .= "<fault>\n". |
|
166 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
167 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
168 | + Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n". |
|
169 | 169 | "</struct>\n</value>\n</fault>"; |
170 | 170 | } else { |
171 | 171 | if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) { |
172 | 172 | if (is_string($this->val) && $this->valtyp == 'xml') { |
173 | - $result .= "<params>\n<param>\n" . |
|
174 | - $this->val . |
|
173 | + $result .= "<params>\n<param>\n". |
|
174 | + $this->val. |
|
175 | 175 | "</param>\n</params>"; |
176 | 176 | } else { |
177 | 177 | /// @todo try to build something serializable using the Encoder... |
178 | 178 | throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values'); |
179 | 179 | } |
180 | 180 | } else { |
181 | - $result .= "<params>\n<param>\n" . |
|
182 | - $this->val->serialize($charsetEncoding) . |
|
181 | + $result .= "<params>\n<param>\n". |
|
182 | + $this->val->serialize($charsetEncoding). |
|
183 | 183 | "</param>\n</params>"; |
184 | 184 | } |
185 | 185 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | { |
196 | 196 | //trigger_error('getting property Response::' . $name . ' is deprecated', E_USER_DEPRECATED); |
197 | 197 | |
198 | - switch($name) { |
|
198 | + switch ($name) { |
|
199 | 199 | case 'hdrs': |
200 | 200 | return $this->httpResponse['headers']; |
201 | 201 | case '_cookies': |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | return $this->httpResponse['raw_data']; |
205 | 205 | default: |
206 | 206 | $trace = debug_backtrace(); |
207 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
207 | + trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
208 | 208 | return null; |
209 | 209 | } |
210 | 210 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | { |
214 | 214 | //trigger_error('setting property Response::' . $name . ' is deprecated', E_USER_DEPRECATED); |
215 | 215 | |
216 | - switch($name) { |
|
216 | + switch ($name) { |
|
217 | 217 | case 'hdrs': |
218 | 218 | $this->httpResponse['headers'] = $value; |
219 | 219 | break; |
@@ -225,13 +225,13 @@ discard block |
||
225 | 225 | break; |
226 | 226 | default: |
227 | 227 | $trace = debug_backtrace(); |
228 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
228 | + trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | public function __isset($name) |
233 | 233 | { |
234 | - switch($name) { |
|
234 | + switch ($name) { |
|
235 | 235 | case 'hdrs': |
236 | 236 | return isset($this->httpResponse['headers']); |
237 | 237 | case '_cookies': |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | public function __unset($name) |
247 | 247 | { |
248 | - switch($name) { |
|
248 | + switch ($name) { |
|
249 | 249 | case 'hdrs': |
250 | 250 | unset($this->httpResponse['headers']); |
251 | 251 | break; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | break; |
258 | 258 | default: |
259 | 259 | $trace = debug_backtrace(); |
260 | - trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING); |
|
260 | + trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function xmlrpc_debugmsg($msg) |
205 | 205 | { |
206 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
206 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public static function error_occurred($msg) |
217 | 217 | { |
218 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
218 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
235 | 235 | $out = ''; |
236 | 236 | if ($this->debug_info != '') { |
237 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
237 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
238 | 238 | } |
239 | 239 | if (static::$_xmlrpc_debuginfo != '') { |
240 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
240 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
241 | 241 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
242 | 242 | // into return payload AFTER the beginning tag |
243 | 243 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | $this->debug_info = ''; |
268 | 268 | |
269 | 269 | // Save what we received, before parsing it |
270 | - if ($this->debug > 1) { |
|
271 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
270 | + if ($this->debug>1) { |
|
271 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -282,21 +282,21 @@ discard block |
||
282 | 282 | $r->raw_data = $rawData; |
283 | 283 | } |
284 | 284 | |
285 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) { |
|
286 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
287 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
285 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) { |
|
286 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
287 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | $payload = $this->xml_header($respCharset); |
291 | - if ($this->debug > 0) { |
|
292 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
291 | + if ($this->debug>0) { |
|
292 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // Do not create response serialization if it has already happened. Helps building json magic |
296 | 296 | if (empty($r->payload)) { |
297 | 297 | $r->serialize($respCharset); |
298 | 298 | } |
299 | - $payload = $payload . $r->payload; |
|
299 | + $payload = $payload.$r->payload; |
|
300 | 300 | |
301 | 301 | if ($returnPayload) { |
302 | 302 | return $payload; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // if we get a warning/error that has output some text before here, then we cannot |
306 | 306 | // add a new header. We cannot say we are sending xml, either... |
307 | 307 | if (!headers_sent()) { |
308 | - header('Content-Type: ' . $r->content_type); |
|
308 | + header('Content-Type: '.$r->content_type); |
|
309 | 309 | // we do not know if client actually told us an accepted charset, but if he did |
310 | 310 | // we have to tell him what we did |
311 | 311 | header("Vary: Accept-Charset"); |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
335 | 335 | // responses up to 8000 bytes |
336 | 336 | if ($phpNoSelfCompress) { |
337 | - header('Content-Length: ' . (int)strlen($payload)); |
|
337 | + header('Content-Length: '.(int) strlen($payload)); |
|
338 | 338 | } |
339 | 339 | } else { |
340 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
340 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | print $payload; |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | $numParams = count($in); |
393 | 393 | } |
394 | 394 | foreach ($sigs as $curSig) { |
395 | - if (count($curSig) == $numParams + 1) { |
|
395 | + if (count($curSig) == $numParams+1) { |
|
396 | 396 | $itsOK = 1; |
397 | - for ($n = 0; $n < $numParams; $n++) { |
|
397 | + for ($n = 0; $n<$numParams; $n++) { |
|
398 | 398 | if (is_object($in)) { |
399 | 399 | $p = $in->getParam($n); |
400 | 400 | if ($p->kindOf() == 'scalar') { |
@@ -407,10 +407,10 @@ discard block |
||
407 | 407 | } |
408 | 408 | |
409 | 409 | // param index is $n+1, as first member of sig is return type |
410 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
410 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
411 | 411 | $itsOK = 0; |
412 | - $pno = $n + 1; |
|
413 | - $wanted = $curSig[$n + 1]; |
|
412 | + $pno = $n+1; |
|
413 | + $wanted = $curSig[$n+1]; |
|
414 | 414 | $got = $pt; |
415 | 415 | break; |
416 | 416 | } |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | // check if $_SERVER is populated: it might have been disabled via ini file |
438 | 438 | // (this is true even when in CLI mode) |
439 | 439 | if (count($_SERVER) == 0) { |
440 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
440 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
441 | 441 | } |
442 | 442 | |
443 | - if ($this->debug > 1) { |
|
443 | + if ($this->debug>1) { |
|
444 | 444 | if (function_exists('getallheaders')) { |
445 | 445 | $this->debugmsg(''); // empty line |
446 | 446 | foreach (getallheaders() as $name => $val) { |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
465 | 465 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
466 | 466 | $data = $degzdata; |
467 | - if ($this->debug > 1) { |
|
468 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
467 | + if ($this->debug>1) { |
|
468 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
469 | 469 | } |
470 | 470 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
471 | 471 | $data = $degzdata; |
472 | - if ($this->debug > 1) { |
|
473 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
472 | + if ($this->debug>1) { |
|
473 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
474 | 474 | } |
475 | 475 | } else { |
476 | 476 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | if (extension_loaded('mbstring')) { |
565 | 565 | $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding); |
566 | 566 | } else { |
567 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding); |
|
567 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding); |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | } |
@@ -583,16 +583,16 @@ discard block |
||
583 | 583 | |
584 | 584 | $xmlRpcParser = $this->getParser(); |
585 | 585 | $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST, $options); |
586 | - if ($xmlRpcParser->_xh['isf'] > 2) { |
|
586 | + if ($xmlRpcParser->_xh['isf']>2) { |
|
587 | 587 | // (BC) we return XML error as a faultCode |
588 | 588 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
589 | 589 | $r = new Response(0, |
590 | - PhpXmlRpc::$xmlrpcerrxml + $matches[1], |
|
590 | + PhpXmlRpc::$xmlrpcerrxml+$matches[1], |
|
591 | 591 | $xmlRpcParser->_xh['isf_reason']); |
592 | 592 | } elseif ($xmlRpcParser->_xh['isf']) { |
593 | 593 | $r = new Response(0, |
594 | 594 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
595 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
595 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
596 | 596 | } else { |
597 | 597 | // small layering violation in favor of speed and memory usage: |
598 | 598 | // we should allow the 'execute' method handle this, but in the |
@@ -603,20 +603,20 @@ discard block |
||
603 | 603 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
604 | 604 | ) |
605 | 605 | ) { |
606 | - if ($this->debug > 1) { |
|
607 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
606 | + if ($this->debug>1) { |
|
607 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
608 | 608 | } |
609 | 609 | $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
610 | 610 | } else { |
611 | 611 | // build a Request object with data parsed from xml |
612 | 612 | $req = new Request($xmlRpcParser->_xh['method']); |
613 | 613 | // now add parameters in |
614 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
614 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
615 | 615 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
616 | 616 | } |
617 | 617 | |
618 | - if ($this->debug > 1) { |
|
619 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
618 | + if ($this->debug>1) { |
|
619 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
620 | 620 | } |
621 | 621 | $r = $this->execute($req); |
622 | 622 | } |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | return new Response( |
670 | 670 | 0, |
671 | 671 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
672 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}" |
|
672 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}" |
|
673 | 673 | ); |
674 | 674 | } |
675 | 675 | } |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | |
683 | 683 | if (is_array($func)) { |
684 | 684 | if (is_object($func[0])) { |
685 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
685 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
686 | 686 | } else { |
687 | 687 | $funcName = implode('::', $func); |
688 | 688 | } |
@@ -694,17 +694,17 @@ discard block |
||
694 | 694 | |
695 | 695 | // verify that function to be invoked is in fact callable |
696 | 696 | if (!is_callable($func)) { |
697 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
697 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
698 | 698 | return new Response( |
699 | 699 | 0, |
700 | 700 | PhpXmlRpc::$xmlrpcerr['server_error'], |
701 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
701 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
702 | 702 | ); |
703 | 703 | } |
704 | 704 | |
705 | 705 | // If debug level is 3, we should catch all errors generated during |
706 | 706 | // processing of user function, and log them as part of response |
707 | - if ($this->debug > 2) { |
|
707 | + if ($this->debug>2) { |
|
708 | 708 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
709 | 709 | } |
710 | 710 | |
@@ -717,14 +717,14 @@ discard block |
||
717 | 717 | $r = call_user_func($func, $req); |
718 | 718 | } |
719 | 719 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
720 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
720 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
721 | 721 | if (is_a($r, 'PhpXmlRpc\Value')) { |
722 | 722 | $r = new Response($r); |
723 | 723 | } else { |
724 | 724 | $r = new Response( |
725 | 725 | 0, |
726 | 726 | PhpXmlRpc::$xmlrpcerr['server_error'], |
727 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
727 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
728 | 728 | ); |
729 | 729 | } |
730 | 730 | } |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | // mimic EPI behaviour: if we get an array that looks like an error, make it |
741 | 741 | // an error response |
742 | 742 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
743 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
743 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
744 | 744 | } else { |
745 | 745 | // functions using EPI api should NOT return resp objects, |
746 | 746 | // so make sure we encode the return type correctly |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | // in the called function, we wrap it in a proper error-response |
765 | 765 | switch ($this->exception_handling) { |
766 | 766 | case 2: |
767 | - if ($this->debug > 2) { |
|
767 | + if ($this->debug>2) { |
|
768 | 768 | if (self::$_xmlrpcs_prev_ehandler) { |
769 | 769 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
770 | 770 | } else { |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']); |
780 | 780 | } |
781 | 781 | } |
782 | - if ($this->debug > 2) { |
|
782 | + if ($this->debug>2) { |
|
783 | 783 | // note: restore the error handler we found before calling the |
784 | 784 | // user func, even if it has been changed inside the func itself |
785 | 785 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | */ |
800 | 800 | protected function debugmsg($string) |
801 | 801 | { |
802 | - $this->debug_info .= $string . "\n"; |
|
802 | + $this->debug_info .= $string."\n"; |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | /** |
@@ -809,9 +809,9 @@ discard block |
||
809 | 809 | protected function xml_header($charsetEncoding = '') |
810 | 810 | { |
811 | 811 | if ($charsetEncoding != '') { |
812 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
812 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
813 | 813 | } else { |
814 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
814 | + return "<?xml version=\"1.0\"?".">\n"; |
|
815 | 815 | } |
816 | 816 | } |
817 | 817 | |
@@ -1063,12 +1063,12 @@ discard block |
||
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | $req = new Request($methName->scalarval()); |
1066 | - foreach($params as $i => $param) { |
|
1066 | + foreach ($params as $i => $param) { |
|
1067 | 1067 | if (!$req->addParam($param)) { |
1068 | 1068 | $i++; // for error message, we count params from 1 |
1069 | 1069 | return static::_xmlrpcs_multicall_error(new Response(0, |
1070 | 1070 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1071 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1071 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1072 | 1072 | } |
1073 | 1073 | } |
1074 | 1074 | |
@@ -1140,12 +1140,12 @@ discard block |
||
1140 | 1140 | // let accept a plain list of php parameters, beside a single xmlrpc msg object |
1141 | 1141 | if (is_object($req)) { |
1142 | 1142 | $calls = $req->getParam(0); |
1143 | - foreach($calls as $call) { |
|
1143 | + foreach ($calls as $call) { |
|
1144 | 1144 | $result[] = static::_xmlrpcs_multicall_do_call($server, $call); |
1145 | 1145 | } |
1146 | 1146 | } else { |
1147 | 1147 | $numCalls = count($req); |
1148 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1148 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1149 | 1149 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1150 | 1150 | } |
1151 | 1151 | } |
@@ -182,20 +182,20 @@ discard block |
||
182 | 182 | $callable = explode('::', $callable); |
183 | 183 | } |
184 | 184 | if (is_array($callable)) { |
185 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
186 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
185 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
186 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | if (is_string($callable[0])) { |
190 | 190 | $plainFuncName = implode('::', $callable); |
191 | 191 | } elseif (is_object($callable[0])) { |
192 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
192 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
193 | 193 | } |
194 | 194 | $exists = method_exists($callable[0], $callable[1]); |
195 | 195 | } else if ($callable instanceof \Closure) { |
196 | 196 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
197 | 197 | if (!$buildIt) { |
198 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
198 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | if (!$exists) { |
210 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
210 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | |
@@ -251,23 +251,23 @@ discard block |
||
251 | 251 | if (is_array($callable)) { |
252 | 252 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
253 | 253 | if ($func->isPrivate()) { |
254 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
254 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | if ($func->isProtected()) { |
258 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
258 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | if ($func->isConstructor()) { |
262 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
262 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | if ($func->isDestructor()) { |
266 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
266 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 | if ($func->isAbstract()) { |
270 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
270 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | /// @todo add more checks for static vs. nonstatic? |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | if ($func->isInternal()) { |
278 | 278 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
279 | 279 | // instead of getparameters to fully reflect internal php functions ? |
280 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
280 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
281 | 281 | return false; |
282 | 282 | } |
283 | 283 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $i = 0; |
330 | 330 | foreach ($func->getParameters() as $paramObj) { |
331 | 331 | $params[$i] = array(); |
332 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
332 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
333 | 333 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
334 | 334 | $i++; |
335 | 335 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // build a signature |
395 | 395 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
396 | 396 | $pSig = array($funcDesc['returnsDocs']); |
397 | - for ($i = 0; $i < count($pars); $i++) { |
|
397 | + for ($i = 0; $i<count($pars); $i++) { |
|
398 | 398 | $name = strtolower($funcDesc['params'][$i]['name']); |
399 | 399 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
400 | 400 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | } |
450 | 450 | } |
451 | 451 | $numPars = $req->getNumParams(); |
452 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
452 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
453 | 453 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
454 | 454 | } |
455 | 455 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | $result = call_user_func_array($callable, $params); |
464 | 464 | |
465 | - if (! is_a($result, $responseClass)) { |
|
465 | + if (!is_a($result, $responseClass)) { |
|
466 | 466 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
467 | 467 | $result = new $valueClass($result, $funcDesc['returns']); |
468 | 468 | } else { |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | if ($newFuncName == '') { |
498 | 498 | if (is_array($callable)) { |
499 | 499 | if (is_string($callable[0])) { |
500 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
500 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
501 | 501 | } else { |
502 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
502 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
503 | 503 | } |
504 | 504 | } else { |
505 | 505 | if ($callable instanceof \Closure) { |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | { |
536 | 536 | $namespace = '\\PhpXmlRpc\\'; |
537 | 537 | |
538 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
539 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
538 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
539 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
540 | 540 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
541 | 541 | |
542 | 542 | $i = 0; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | // build body of new function |
572 | 572 | |
573 | 573 | $innerCode = "\$paramCount = \$req->getNumParams();\n"; |
574 | - $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
574 | + $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
575 | 575 | |
576 | 576 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
577 | 577 | if ($decodePhpObjects) { |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | if (is_array($callable) && is_object($callable[0])) { |
586 | 586 | self::$objHolder[$newFuncName] = $callable[0]; |
587 | 587 | $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; |
588 | - $realFuncName = '$obj->' . $callable[1]; |
|
588 | + $realFuncName = '$obj->'.$callable[1]; |
|
589 | 589 | } else { |
590 | 590 | $realFuncName = $plainFuncName; |
591 | 591 | } |
592 | 592 | foreach ($parsVariations as $i => $pars) { |
593 | - $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
594 | - if ($i < (count($parsVariations) - 1)) |
|
593 | + $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
594 | + if ($i<(count($parsVariations)-1)) |
|
595 | 595 | $innerCode .= "else\n"; |
596 | 596 | } |
597 | 597 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | // if($func->returnsReference()) |
609 | 609 | // return false; |
610 | 610 | |
611 | - $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}"; |
|
611 | + $code = "function $newFuncName(\$req) {\n".$innerCode."\n}"; |
|
612 | 612 | |
613 | 613 | return $code; |
614 | 614 | } |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array()) |
663 | 663 | { |
664 | 664 | if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) { |
665 | - return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '') . $classMethod; |
|
665 | + return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | if (is_object($className)) { |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | } else { |
671 | 671 | $realClassName = $className; |
672 | 672 | } |
673 | - return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '') . "$realClassName.$classMethod"; |
|
673 | + return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod"; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
@@ -760,21 +760,21 @@ discard block |
||
760 | 760 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
761 | 761 | { |
762 | 762 | $namespace = '\\PhpXmlRpc\\'; |
763 | - $reqClass = $namespace . 'Request'; |
|
764 | - $valClass = $namespace . 'Value'; |
|
765 | - $decoderClass = $namespace . 'Encoder'; |
|
763 | + $reqClass = $namespace.'Request'; |
|
764 | + $valClass = $namespace.'Value'; |
|
765 | + $decoderClass = $namespace.'Encoder'; |
|
766 | 766 | |
767 | 767 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
768 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
768 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
769 | 769 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
770 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
770 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
771 | 771 | |
772 | 772 | $req = new $reqClass('system.methodSignature'); |
773 | 773 | $req->addparam(new $valClass($methodName)); |
774 | 774 | $client->setDebug($debug); |
775 | 775 | $response = $client->send($req, $timeout, $protocol); |
776 | 776 | if ($response->faultCode()) { |
777 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
777 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
778 | 778 | return false; |
779 | 779 | } |
780 | 780 | |
@@ -784,8 +784,8 @@ discard block |
||
784 | 784 | $mSig = $decoder->decode($mSig); |
785 | 785 | } |
786 | 786 | |
787 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
788 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
787 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
788 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
789 | 789 | return false; |
790 | 790 | } |
791 | 791 | |
@@ -801,11 +801,11 @@ discard block |
||
801 | 801 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
802 | 802 | { |
803 | 803 | $namespace = '\\PhpXmlRpc\\'; |
804 | - $reqClass = $namespace . 'Request'; |
|
805 | - $valClass = $namespace . 'Value'; |
|
804 | + $reqClass = $namespace.'Request'; |
|
805 | + $valClass = $namespace.'Value'; |
|
806 | 806 | |
807 | 807 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
808 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
808 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
809 | 809 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
810 | 810 | |
811 | 811 | $mDesc = ''; |
@@ -839,10 +839,10 @@ discard block |
||
839 | 839 | $clientClone = clone $client; |
840 | 840 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
841 | 841 | { |
842 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
842 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
843 | 843 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
844 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
845 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
844 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
845 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
846 | 846 | if (isset($extraOptions['return_on_fault'])) { |
847 | 847 | $decodeFault = true; |
848 | 848 | $faultResponse = $extraOptions['return_on_fault']; |
@@ -851,9 +851,9 @@ discard block |
||
851 | 851 | } |
852 | 852 | |
853 | 853 | $namespace = '\\PhpXmlRpc\\'; |
854 | - $reqClass = $namespace . 'Request'; |
|
855 | - $encoderClass = $namespace . 'Encoder'; |
|
856 | - $valueClass = $namespace . 'Value'; |
|
854 | + $reqClass = $namespace.'Request'; |
|
855 | + $encoderClass = $namespace.'Encoder'; |
|
856 | + $valueClass = $namespace.'Value'; |
|
857 | 857 | |
858 | 858 | $encoder = new $encoderClass(); |
859 | 859 | $encodeOptions = array(); |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | } |
877 | 877 | |
878 | 878 | $xmlrpcArgs = array(); |
879 | - foreach($currentArgs as $i => $arg) { |
|
879 | + foreach ($currentArgs as $i => $arg) { |
|
880 | 880 | if ($i == $maxArgs) { |
881 | 881 | break; |
882 | 882 | } |
@@ -924,13 +924,13 @@ discard block |
||
924 | 924 | * @param string $mDesc |
925 | 925 | * @return string[] keys: source, docstring |
926 | 926 | */ |
927 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
927 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
928 | 928 | { |
929 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
929 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
930 | 930 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
931 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
932 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
933 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
931 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
932 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
933 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
934 | 934 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
935 | 935 | if (isset($extraOptions['return_on_fault'])) { |
936 | 936 | $decodeFault = true; |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | $namespace = '\\PhpXmlRpc\\'; |
944 | 944 | |
945 | 945 | $code = "function $newFuncName ("; |
946 | - if ($clientCopyMode < 2) { |
|
946 | + if ($clientCopyMode<2) { |
|
947 | 947 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
948 | 948 | $verbatimClientCopy = !$clientCopyMode; |
949 | 949 | $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | |
959 | 959 | if ($mDesc != '') { |
960 | 960 | // take care that PHP comment is not terminated unwillingly by method description |
961 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
961 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
962 | 962 | } else { |
963 | 963 | $mDesc = "/**\nFunction $newFuncName\n"; |
964 | 964 | } |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
968 | 968 | $plist = array(); |
969 | 969 | $pCount = count($mSig); |
970 | - for ($i = 1; $i < $pCount; $i++) { |
|
970 | + for ($i = 1; $i<$pCount; $i++) { |
|
971 | 971 | $plist[] = "\$p$i"; |
972 | 972 | $pType = $mSig[$i]; |
973 | 973 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -983,19 +983,19 @@ discard block |
||
983 | 983 | } |
984 | 984 | } |
985 | 985 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
986 | - $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
986 | + $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
987 | 987 | } |
988 | - if ($clientCopyMode < 2) { |
|
988 | + if ($clientCopyMode<2) { |
|
989 | 989 | $plist[] = '$debug=0'; |
990 | 990 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
991 | 991 | } |
992 | 992 | $plist = implode(', ', $plist); |
993 | - $mDesc .= '* @return {$namespace}Response|' . $this->xmlrpc2PhpType($mSig[0]) . " (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
993 | + $mDesc .= '* @return {$namespace}Response|'.$this->xmlrpc2PhpType($mSig[0])." (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
994 | 994 | |
995 | 995 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
996 | 996 | if ($decodeFault) { |
997 | 997 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
998 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
998 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
999 | 999 | } else { |
1000 | 1000 | $respCode = var_export($faultResponse, true); |
1001 | 1001 | } |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
1009 | 1009 | } |
1010 | 1010 | |
1011 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
1011 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
1012 | 1012 | |
1013 | 1013 | return array('source' => $code, 'docstring' => $mDesc); |
1014 | 1014 | } |
@@ -1034,23 +1034,23 @@ discard block |
||
1034 | 1034 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
1035 | 1035 | { |
1036 | 1036 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
1037 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
1037 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
1038 | 1038 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
1039 | 1039 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
1040 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
1041 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
1040 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
1041 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
1042 | 1042 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
1043 | 1043 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
1044 | 1044 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
1045 | 1045 | $namespace = '\\PhpXmlRpc\\'; |
1046 | 1046 | |
1047 | - $reqClass = $namespace . 'Request'; |
|
1048 | - $decoderClass = $namespace . 'Encoder'; |
|
1047 | + $reqClass = $namespace.'Request'; |
|
1048 | + $decoderClass = $namespace.'Encoder'; |
|
1049 | 1049 | |
1050 | 1050 | $req = new $reqClass('system.listMethods'); |
1051 | 1051 | $response = $client->send($req, $timeout, $protocol); |
1052 | 1052 | if ($response->faultCode()) { |
1053 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
1053 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
1054 | 1054 | |
1055 | 1055 | return false; |
1056 | 1056 | } else { |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | $mList = $decoder->decode($mList); |
1061 | 1061 | } |
1062 | 1062 | if (!is_array($mList) || !count($mList)) { |
1063 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
1063 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
1064 | 1064 | |
1065 | 1065 | return false; |
1066 | 1066 | } else { |
@@ -1068,8 +1068,8 @@ discard block |
||
1068 | 1068 | if ($newClassName != '') { |
1069 | 1069 | $xmlrpcClassName = $newClassName; |
1070 | 1070 | } else { |
1071 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1072 | - array('_', ''), $client->server) . '_client'; |
|
1071 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1072 | + array('_', ''), $client->server).'_client'; |
|
1073 | 1073 | } |
1074 | 1074 | while ($buildIt && class_exists($xmlrpcClassName)) { |
1075 | 1075 | $xmlrpcClassName .= 'x'; |
@@ -1100,20 +1100,20 @@ discard block |
||
1100 | 1100 | if (!$buildIt) { |
1101 | 1101 | $source .= $methodWrap['docstring']; |
1102 | 1102 | } |
1103 | - $source .= $methodWrap['source'] . "\n"; |
|
1103 | + $source .= $methodWrap['source']."\n"; |
|
1104 | 1104 | } else { |
1105 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
1105 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | } |
1109 | 1109 | $source .= "}\n"; |
1110 | 1110 | if ($buildIt) { |
1111 | 1111 | $allOK = 0; |
1112 | - eval($source . '$allOK=1;'); |
|
1112 | + eval($source.'$allOK=1;'); |
|
1113 | 1113 | if ($allOK) { |
1114 | 1114 | return $xmlrpcClassName; |
1115 | 1115 | } else { |
1116 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
1116 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
1117 | 1117 | return false; |
1118 | 1118 | } |
1119 | 1119 | } else { |
@@ -1134,10 +1134,10 @@ discard block |
||
1134 | 1134 | * |
1135 | 1135 | * @return string |
1136 | 1136 | */ |
1137 | - protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) |
|
1137 | + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
|
1138 | 1138 | { |
1139 | - $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . |
|
1140 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
1139 | + $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path). |
|
1140 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
1141 | 1141 | |
1142 | 1142 | // copy all client fields to the client that will be generated runtime |
1143 | 1143 | // (this provides for future expansion or subclassing of client obj) |
@@ -591,8 +591,9 @@ |
||
591 | 591 | } |
592 | 592 | foreach ($parsVariations as $i => $pars) { |
593 | 593 | $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
594 | - if ($i < (count($parsVariations) - 1)) |
|
595 | - $innerCode .= "else\n"; |
|
594 | + if ($i < (count($parsVariations) - 1)) { |
|
595 | + $innerCode .= "else\n"; |
|
596 | + } |
|
596 | 597 | } |
597 | 598 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
598 | 599 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | |
25 | 25 | // read chunk-size, chunk-extension (if any) and crlf |
26 | 26 | // get the position of the linebreak |
27 | - $chunkEnd = strpos($buffer, "\r\n") + 2; |
|
27 | + $chunkEnd = strpos($buffer, "\r\n")+2; |
|
28 | 28 | $temp = substr($buffer, 0, $chunkEnd); |
29 | 29 | $chunkSize = hexdec(trim($temp)); |
30 | 30 | $chunkStart = $chunkEnd; |
31 | - while ($chunkSize > 0) { |
|
32 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize); |
|
31 | + while ($chunkSize>0) { |
|
32 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize); |
|
33 | 33 | |
34 | 34 | // just in case we got a broken connection |
35 | 35 | if ($chunkEnd == false) { |
@@ -41,19 +41,19 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | // read chunk-data and crlf |
44 | - $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
44 | + $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
45 | 45 | // append chunk-data to entity-body |
46 | 46 | $new .= $chunk; |
47 | 47 | // length := length + chunk-size |
48 | 48 | $length += strlen($chunk); |
49 | 49 | // read chunk-size and crlf |
50 | - $chunkStart = $chunkEnd + 2; |
|
50 | + $chunkStart = $chunkEnd+2; |
|
51 | 51 | |
52 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2; |
|
52 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2; |
|
53 | 53 | if ($chunkEnd == false) { |
54 | 54 | break; //just in case we got a broken connection |
55 | 55 | } |
56 | - $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
56 | + $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
57 | 57 | $chunkSize = hexdec(trim($temp)); |
58 | 58 | $chunkStart = $chunkEnd; |
59 | 59 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return array with keys 'headers', 'cookies', 'raw_data' and 'status_code' |
71 | 71 | * @throws HttpException |
72 | 72 | */ |
73 | - public function parseResponseHeaders(&$data, $headersProcessed = false, $debug=0) |
|
73 | + public function parseResponseHeaders(&$data, $headersProcessed = false, $debug = 0) |
|
74 | 74 | { |
75 | 75 | $httpResponse = array('raw_data' => $data, 'headers'=> array(), 'cookies' => array(), 'status_code' => null); |
76 | 76 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | // (even though it is not valid http) |
81 | 81 | $pos = strpos($data, "\r\n\r\n"); |
82 | 82 | if ($pos || is_int($pos)) { |
83 | - $bd = $pos + 4; |
|
83 | + $bd = $pos+4; |
|
84 | 84 | } else { |
85 | 85 | $pos = strpos($data, "\n\n"); |
86 | 86 | if ($pos || is_int($pos)) { |
87 | - $bd = $pos + 2; |
|
87 | + $bd = $pos+2; |
|
88 | 88 | } else { |
89 | 89 | // No separation between response headers and body: fault? |
90 | 90 | $bd = 0; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | // maybe we could take them into account, too? |
96 | 96 | $data = substr($data, $bd); |
97 | 97 | } else { |
98 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed'); |
|
99 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
98 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed'); |
|
99 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($httpResponse['status_code'] !== '200') { |
129 | - $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
130 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr); |
|
131 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code'] ); |
|
129 | + $errstr = substr($data, 0, strpos($data, "\n")-1); |
|
130 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr); |
|
131 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // be tolerant to usage of \n instead of \r\n to separate headers and data |
135 | 135 | // (even though it is not valid http) |
136 | 136 | $pos = strpos($data, "\r\n\r\n"); |
137 | 137 | if ($pos || is_int($pos)) { |
138 | - $bd = $pos + 4; |
|
138 | + $bd = $pos+4; |
|
139 | 139 | } else { |
140 | 140 | $pos = strpos($data, "\n\n"); |
141 | 141 | if ($pos || is_int($pos)) { |
142 | - $bd = $pos + 2; |
|
142 | + $bd = $pos+2; |
|
143 | 143 | } else { |
144 | 144 | // No separation between response headers and body: fault? |
145 | 145 | // we could take some action here instead of going on... |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | // be tolerant to line endings, and extra empty lines |
151 | 151 | $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); |
152 | 152 | |
153 | - foreach($ar as $line) { |
|
153 | + foreach ($ar as $line) { |
|
154 | 154 | // take care of multi-line headers and cookies |
155 | 155 | $arr = explode(':', $line, 2); |
156 | - if (count($arr) > 1) { |
|
156 | + if (count($arr)>1) { |
|
157 | 157 | $headerName = strtolower(trim($arr[0])); |
158 | 158 | /// @todo some other headers (the ones that allow a CSV list of values) |
159 | 159 | /// do allow many values to be passed using multiple header lines. |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // glue together all received cookies, using a comma to separate them |
173 | 173 | // (same as php does with getallheaders()) |
174 | 174 | if (isset($httpResponse['headers'][$headerName])) { |
175 | - $httpResponse['headers'][$headerName] .= ', ' . trim($cookie); |
|
175 | + $httpResponse['headers'][$headerName] .= ', '.trim($cookie); |
|
176 | 176 | } else { |
177 | 177 | $httpResponse['headers'][$headerName] = trim($cookie); |
178 | 178 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } elseif (isset($headerName)) { |
203 | 203 | /// @todo version1 cookies might span multiple lines, thus breaking the parsing above |
204 | - $httpResponse['headers'][$headerName] .= ' ' . trim($line); |
|
204 | + $httpResponse['headers'][$headerName] .= ' '.trim($line); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // Decode chunked encoding sent by http 1.1 servers |
226 | 226 | if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') { |
227 | 227 | if (!$data = static::decodeChunked($data)) { |
228 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server'); |
|
228 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server'); |
|
229 | 229 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']); |
230 | 230 | } |
231 | 231 | } |
@@ -240,19 +240,19 @@ discard block |
||
240 | 240 | if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { |
241 | 241 | $data = $degzdata; |
242 | 242 | if ($debug) { |
243 | - Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
243 | + Logger::instance()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
244 | 244 | } |
245 | 245 | } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
246 | 246 | $data = $degzdata; |
247 | 247 | if ($debug) { |
248 | - Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
248 | + Logger::instance()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
249 | 249 | } |
250 | 250 | } else { |
251 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server'); |
|
251 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server'); |
|
252 | 252 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']); |
253 | 253 | } |
254 | 254 | } else { |
255 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
255 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
256 | 256 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']); |
257 | 257 | } |
258 | 258 | } |