@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @license code licensed under the BSD License: see file license.txt |
16 | 16 | */ |
17 | 17 | |
18 | -require_once __DIR__ . "/_prepend.php"; |
|
18 | +require_once __DIR__."/_prepend.php"; |
|
19 | 19 | |
20 | 20 | // *** NB: WE BLOCK THIS FROM RUNNING BY DEFAULT IN CASE ACCESS IS GRANTED TO IT IN PRODUCTION BY MISTAKE *** |
21 | 21 | // Comment out the following safeguard if you want to use it as is, but remember: this is an open relay !!! |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // fe. any url using the 'file://' protocol might be considered a hacking attempt |
47 | 47 | $client = new Client($url); |
48 | 48 | |
49 | - if ($req->getNumParams() > 3) { |
|
49 | + if ($req->getNumParams()>3) { |
|
50 | 50 | // We have to set some options onto the client. |
51 | 51 | // Note that if we do not untaint the received values, warnings might be generated... |
52 | 52 | $options = $encoder->decode($req->getParam(3)); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $client->setSSLVerifyPeer($val); |
87 | 87 | break; |
88 | 88 | case 'Timeout': |
89 | - $timeout = (integer)$val; |
|
89 | + $timeout = (integer) $val; |
|
90 | 90 | break; |
91 | 91 | } // switch |
92 | 92 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | /// X-forwarded-for anyway, unless they consider this server as trusted...) |
100 | 100 | $reqMethod = $req->getParam(1)->scalarval(); |
101 | 101 | $req = new Request($reqMethod); |
102 | - if ($req->getNumParams() > 1) { |
|
102 | + if ($req->getNumParams()>1) { |
|
103 | 103 | $pars = $req->getParam(2); |
104 | 104 | foreach ($pars as $par) { |
105 | 105 | $req->addParam($par); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // add debug info into response we give back to caller |
110 | - Server::xmlrpc_debugmsg("Sending to server $url the payload: " . $req->serialize()); |
|
110 | + Server::xmlrpc_debugmsg("Sending to server $url the payload: ".$req->serialize()); |
|
111 | 111 | |
112 | 112 | return $client->send($req, $timeout); |
113 | 113 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * `$functions_parameters_type` and `$exception_handling` |
9 | 9 | */ |
10 | 10 | |
11 | -require_once __DIR__ . "/_prepend.php"; |
|
11 | +require_once __DIR__."/_prepend.php"; |
|
12 | 12 | |
13 | 13 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
14 | 14 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | |
20 | 20 | $addComment_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcString, Value::$xmlrpcString, Value::$xmlrpcString)); |
21 | 21 | |
22 | -$addComment_doc = 'Adds a comment to an item. The first parameter is the item ID, the second the name of the commenter, ' . |
|
22 | +$addComment_doc = 'Adds a comment to an item. The first parameter is the item ID, the second the name of the commenter, '. |
|
23 | 23 | 'and the third is the comment itself. Returns the number of comments against that ID.'; |
24 | 24 | |
25 | 25 | $getComments_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcString)); |
26 | 26 | |
27 | -$getComments_doc = 'Returns an array of comments for a given ID, which is the sole argument. Each array item is a struct ' . |
|
27 | +$getComments_doc = 'Returns an array of comments for a given ID, which is the sole argument. Each array item is a struct '. |
|
28 | 28 | 'containing name and comment text.'; |
29 | 29 | |
30 | 30 | $srv = new Server(); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Demoing the charset conversion of the library: create a client class which uses data in the CP-1252 character set, |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $this->me['struct'] = $val; |
130 | 130 | break; |
131 | 131 | default: |
132 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
132 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | if ($typeOf !== 1) { |
156 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
156 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
157 | 157 | return 0; |
158 | 158 | } |
159 | 159 | |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | |
171 | 171 | switch ($this->mytype) { |
172 | 172 | case 1: |
173 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
173 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
174 | 174 | return 0; |
175 | 175 | case 3: |
176 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
176 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
177 | 177 | return 0; |
178 | 178 | case 2: |
179 | 179 | // we're adding a scalar value to an array here |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | return 1; |
216 | 216 | } else { |
217 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
217 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
218 | 218 | return 0; |
219 | 219 | } |
220 | 220 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | return 1; |
246 | 246 | } else { |
247 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
247 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
248 | 248 | return 0; |
249 | 249 | } |
250 | 250 | } |
@@ -286,19 +286,19 @@ discard block |
||
286 | 286 | case 1: |
287 | 287 | switch ($typ) { |
288 | 288 | case static::$xmlrpcBase64: |
289 | - $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
289 | + $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
290 | 290 | break; |
291 | 291 | case static::$xmlrpcBoolean: |
292 | - $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
292 | + $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
293 | 293 | break; |
294 | 294 | case static::$xmlrpcString: |
295 | 295 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
296 | - $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
296 | + $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
297 | 297 | break; |
298 | 298 | case static::$xmlrpcInt: |
299 | 299 | case static::$xmlrpcI4: |
300 | 300 | case static::$xmlrpcI8: |
301 | - $rs .= "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
301 | + $rs .= "<{$typ}>".(int) $val."</{$typ}>"; |
|
302 | 302 | break; |
303 | 303 | case static::$xmlrpcDouble: |
304 | 304 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -306,16 +306,16 @@ discard block |
||
306 | 306 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
307 | 307 | // The code below tries its best at keeping max precision while avoiding exp notation, |
308 | 308 | // but there is of course no limit in the number of decimal places to be used... |
309 | - $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
309 | + $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
310 | 310 | break; |
311 | 311 | case static::$xmlrpcDateTime: |
312 | 312 | if (is_string($val)) { |
313 | 313 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
314 | 314 | // DateTimeInterface is not present in php 5.4... |
315 | 315 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
316 | - $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
316 | + $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
317 | 317 | } elseif (is_int($val)) { |
318 | - $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
318 | + $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
319 | 319 | } else { |
320 | 320 | // not really a good idea here: but what should we output anyway? left for backward compat... |
321 | 321 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | case 3: |
338 | 338 | // struct |
339 | 339 | if ($this->_php_class) { |
340 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
340 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
341 | 341 | } else { |
342 | 342 | $rs .= "<struct>\n"; |
343 | 343 | } |
344 | 344 | $charsetEncoder = $this->getCharsetEncoder(); |
345 | 345 | /** @var Value $val2 */ |
346 | 346 | foreach ($val as $key2 => $val2) { |
347 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
347 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
348 | 348 | //$rs.=$this->serializeval($val2); |
349 | 349 | $rs .= $val2->serialize($charsetEncoding); |
350 | 350 | $rs .= "</member>\n"; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $val = reset($this->me); |
380 | 380 | $typ = key($this->me); |
381 | 381 | |
382 | - return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n"; |
|
382 | + return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n"; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | 'scalar' => $val, |
91 | 91 | 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val) |
92 | 92 | ); |
93 | - return (object)$xmlrpcVal; |
|
93 | + return (object) $xmlrpcVal; |
|
94 | 94 | case 'base64': |
95 | 95 | $xmlrpcVal = array( |
96 | 96 | 'xmlrpc_type' => 'base64', |
97 | 97 | 'scalar' => $val |
98 | 98 | ); |
99 | - return (object)$xmlrpcVal; |
|
99 | + return (object) $xmlrpcVal; |
|
100 | 100 | case 'string': |
101 | 101 | if (isset($options['extension_api_encoding'])) { |
102 | 102 | // if iconv is not available, we use mb_convert_encoding |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | case 'msg': |
166 | 166 | $paramCount = $xmlrpcVal->getNumParams(); |
167 | 167 | $arr = array(); |
168 | - for ($i = 0; $i < $paramCount; $i++) { |
|
168 | + for ($i = 0; $i<$paramCount; $i++) { |
|
169 | 169 | $arr[] = $this->decode($xmlrpcVal->getParam($i), $options); |
170 | 170 | } |
171 | 171 | return $arr; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | break; |
292 | 292 | case 'resource': |
293 | 293 | if (in_array('extension_api', $options)) { |
294 | - $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt); |
|
294 | + $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt); |
|
295 | 295 | } else { |
296 | 296 | $xmlrpcVal = new Value(); |
297 | 297 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | if ($valEncoding == 'ISO-8859-1') { |
341 | 341 | $xmlVal = utf8_encode($xmlVal); |
342 | 342 | } else { |
343 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding); |
|
343 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding); |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $parserOptions |
363 | 363 | ); |
364 | 364 | |
365 | - if ($xmlRpcParser->_xh['isf'] > 1) { |
|
365 | + if ($xmlRpcParser->_xh['isf']>1) { |
|
366 | 366 | // test that $xmlrpc->_xh['value'] is an obj, too??? |
367 | 367 | |
368 | 368 | $this->getLogger()->errorLog($xmlRpcParser->_xh['isf_reason']); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | case 'methodcall': |
388 | 388 | $req = new Request($xmlRpcParser->_xh['method']); |
389 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
389 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
390 | 390 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
391 | 391 | } |
392 | 392 | return $req; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public static function xmlrpc_debugmsg($msg) |
239 | 239 | { |
240 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
240 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public static function error_occurred($msg) |
251 | 251 | { |
252 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
252 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
271 | 271 | $out = ''; |
272 | 272 | if ($this->debug_info != '') { |
273 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
273 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
274 | 274 | } |
275 | 275 | if (static::$_xmlrpc_debuginfo != '') { |
276 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
276 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
277 | 277 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
278 | 278 | // into return payload AFTER the beginning tag |
279 | 279 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | $this->debug_info = ''; |
303 | 303 | |
304 | 304 | // Save what we received, before parsing it |
305 | - if ($this->debug > 1) { |
|
306 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
305 | + if ($this->debug>1) { |
|
306 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | $resp->raw_data = $rawData; |
321 | 321 | } |
322 | 322 | |
323 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
324 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
325 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
323 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
324 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
325 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | $payload = $this->xml_header($respCharset); |
329 | - if ($this->debug > 0) { |
|
330 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
329 | + if ($this->debug>0) { |
|
330 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | // Do not create response serialization if it has already happened. Helps to build json magic |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | if (empty($resp->payload)) { |
336 | 336 | $resp->serialize($respCharset); |
337 | 337 | } |
338 | - $payload = $payload . $resp->payload; |
|
338 | + $payload = $payload.$resp->payload; |
|
339 | 339 | |
340 | 340 | if ($returnPayload) { |
341 | 341 | return $payload; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | // if we get a warning/error that has output some text before here, then we cannot |
345 | 345 | // add a new header. We cannot say we are sending xml, either... |
346 | 346 | if (!headers_sent()) { |
347 | - header('Content-Type: ' . $resp->content_type); |
|
347 | + header('Content-Type: '.$resp->content_type); |
|
348 | 348 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
349 | 349 | header("Vary: Accept-Charset"); |
350 | 350 | |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
368 | 368 | // responses up to 8000 bytes |
369 | 369 | if ($phpNoSelfCompress) { |
370 | - header('Content-Length: ' . (int)strlen($payload)); |
|
370 | + header('Content-Length: '.(int) strlen($payload)); |
|
371 | 371 | } |
372 | 372 | } else { |
373 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
373 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | print $payload; |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | $numParams = count($in); |
429 | 429 | } |
430 | 430 | foreach ($sigs as $curSig) { |
431 | - if (count($curSig) == $numParams + 1) { |
|
431 | + if (count($curSig) == $numParams+1) { |
|
432 | 432 | $itsOK = 1; |
433 | - for ($n = 0; $n < $numParams; $n++) { |
|
433 | + for ($n = 0; $n<$numParams; $n++) { |
|
434 | 434 | if (is_object($in)) { |
435 | 435 | $p = $in->getParam($n); |
436 | 436 | if ($p->kindOf() == 'scalar') { |
@@ -443,10 +443,10 @@ discard block |
||
443 | 443 | } |
444 | 444 | |
445 | 445 | // param index is $n+1, as first member of sig is return type |
446 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
446 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
447 | 447 | $itsOK = 0; |
448 | - $pno = $n + 1; |
|
449 | - $wanted = $curSig[$n + 1]; |
|
448 | + $pno = $n+1; |
|
449 | + $wanted = $curSig[$n+1]; |
|
450 | 450 | $got = $pt; |
451 | 451 | break; |
452 | 452 | } |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | // check if $_SERVER is populated: it might have been disabled via ini file |
474 | 474 | // (this is true even when in CLI mode) |
475 | 475 | if (count($_SERVER) == 0) { |
476 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
476 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
477 | 477 | } |
478 | 478 | |
479 | - if ($this->debug > 1) { |
|
479 | + if ($this->debug>1) { |
|
480 | 480 | if (function_exists('getallheaders')) { |
481 | 481 | $this->debugmsg(''); // empty line |
482 | 482 | foreach (getallheaders() as $name => $val) { |
@@ -501,13 +501,13 @@ discard block |
||
501 | 501 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
502 | 502 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
503 | 503 | $data = $degzdata; |
504 | - if ($this->debug > 1) { |
|
505 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
504 | + if ($this->debug>1) { |
|
505 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
506 | 506 | } |
507 | 507 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
508 | 508 | $data = $degzdata; |
509 | - if ($this->debug > 1) { |
|
510 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
509 | + if ($this->debug>1) { |
|
510 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
511 | 511 | } |
512 | 512 | } else { |
513 | 513 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | // here we check if we can match the client-requested encoding with the encodings we know we can generate. |
535 | 535 | // we parse q=0.x preferences instead of preferring the first charset specified |
536 | 536 | $clientAcceptedCharsets = array(); |
537 | - foreach(explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET'])) as $c) { |
|
537 | + foreach (explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET'])) as $c) { |
|
538 | 538 | if (preg_match('/^([^;]+);Q=([0-9.]+)/', $c, $matches)) { |
539 | 539 | $c = $matches[1]; |
540 | 540 | $w = $matches[2]; |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | if ($reqEncoding == 'ISO-8859-1') { |
614 | 614 | $data = utf8_encode($data); |
615 | 615 | } else { |
616 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
616 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
617 | 617 | } |
618 | 618 | } |
619 | 619 | } |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
641 | 641 | return new Response( |
642 | 642 | 0, |
643 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
643 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
644 | 644 | $xmlRpcParser->_xh['isf_reason']); |
645 | 645 | } elseif ($xmlRpcParser->_xh['isf']) { |
646 | 646 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc, |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | return new Response( |
649 | 649 | 0, |
650 | 650 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
651 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
651 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
652 | 652 | } else { |
653 | 653 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
654 | 654 | // this, but in the most common scenario (xmlrpc values type server with some methods registered as phpvals) |
@@ -658,20 +658,20 @@ discard block |
||
658 | 658 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
659 | 659 | ) |
660 | 660 | ) { |
661 | - if ($this->debug > 1) { |
|
662 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
661 | + if ($this->debug>1) { |
|
662 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
666 | 666 | } else { |
667 | 667 | // build a Request object with data parsed from xml and add parameters in |
668 | 668 | $req = new Request($xmlRpcParser->_xh['method']); |
669 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
669 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
670 | 670 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
671 | 671 | } |
672 | 672 | |
673 | - if ($this->debug > 1) { |
|
674 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
673 | + if ($this->debug>1) { |
|
674 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | return $this->execute($req); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | return new Response( |
724 | 724 | 0, |
725 | 725 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
726 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
726 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
727 | 727 | ); |
728 | 728 | } |
729 | 729 | } |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | // build string representation of function 'name' |
739 | 739 | if (is_array($func)) { |
740 | 740 | if (is_object($func[0])) { |
741 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
741 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
742 | 742 | } else { |
743 | 743 | $funcName = implode('::', $func); |
744 | 744 | } |
@@ -750,17 +750,17 @@ discard block |
||
750 | 750 | |
751 | 751 | // verify that function to be invoked is in fact callable |
752 | 752 | if (!is_callable($func)) { |
753 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
753 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
754 | 754 | return new Response( |
755 | 755 | 0, |
756 | 756 | PhpXmlRpc::$xmlrpcerr['server_error'], |
757 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
757 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
758 | 758 | ); |
759 | 759 | } |
760 | 760 | |
761 | 761 | // If debug level is 3, we should catch all errors generated during processing of user function, and log them |
762 | 762 | // as part of response |
763 | - if ($this->debug > 2) { |
|
763 | + if ($this->debug>2) { |
|
764 | 764 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
765 | 765 | } |
766 | 766 | |
@@ -774,14 +774,14 @@ discard block |
||
774 | 774 | $r = call_user_func($func, $req); |
775 | 775 | } |
776 | 776 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
777 | - $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
777 | + $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
778 | 778 | if (is_a($r, 'PhpXmlRpc\Value')) { |
779 | 779 | $r = new Response($r); |
780 | 780 | } else { |
781 | 781 | $r = new Response( |
782 | 782 | 0, |
783 | 783 | PhpXmlRpc::$xmlrpcerr['server_error'], |
784 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
784 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
785 | 785 | ); |
786 | 786 | } |
787 | 787 | } |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
797 | 797 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
798 | 798 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
799 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
799 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
800 | 800 | } else { |
801 | 801 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
802 | 802 | // return type correctly |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | // proper error-response |
821 | 821 | switch ($this->exception_handling) { |
822 | 822 | case 2: |
823 | - if ($this->debug > 2) { |
|
823 | + if ($this->debug>2) { |
|
824 | 824 | if (self::$_xmlrpcs_prev_ehandler) { |
825 | 825 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
826 | 826 | } else { |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | // proper error-response |
844 | 844 | switch ($this->exception_handling) { |
845 | 845 | case 2: |
846 | - if ($this->debug > 2) { |
|
846 | + if ($this->debug>2) { |
|
847 | 847 | if (self::$_xmlrpcs_prev_ehandler) { |
848 | 848 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
849 | 849 | } else { |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | } |
864 | 864 | } |
865 | 865 | |
866 | - if ($this->debug > 2) { |
|
866 | + if ($this->debug>2) { |
|
867 | 867 | // note: restore the error handler we found before calling the user func, even if it has been changed |
868 | 868 | // inside the func itself |
869 | 869 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | */ |
930 | 930 | protected function debugmsg($string) |
931 | 931 | { |
932 | - $this->debug_info .= $string . "\n"; |
|
932 | + $this->debug_info .= $string."\n"; |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | /** |
@@ -939,9 +939,9 @@ discard block |
||
939 | 939 | protected function xml_header($charsetEncoding = '') |
940 | 940 | { |
941 | 941 | if ($charsetEncoding != '') { |
942 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
942 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
943 | 943 | } else { |
944 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
944 | + return "<?xml version=\"1.0\"?".">\n"; |
|
945 | 945 | } |
946 | 946 | } |
947 | 947 | |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | $i++; // for error message, we count params from 1 |
1235 | 1235 | return static::_xmlrpcs_multicall_error(new Response(0, |
1236 | 1236 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1237 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1237 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1238 | 1238 | } |
1239 | 1239 | } |
1240 | 1240 | |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | } |
1316 | 1316 | } else { |
1317 | 1317 | $numCalls = count($req); |
1318 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1318 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1319 | 1319 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1320 | 1320 | } |
1321 | 1321 | } |