@@ -24,9 +24,6 @@ |
||
24 | 24 | * |
25 | 25 | * @param xmlrpc_client client object, properly set up to connect to server |
26 | 26 | * @param string remote function name |
27 | - * @param mixed $parameter1 |
|
28 | - * @param mixed $parameter2 |
|
29 | - * @param mixed $parameter3 ... |
|
30 | 27 | * @return xmlrpcresp or false on error |
31 | 28 | */ |
32 | 29 | function xmlrpccall_simple() |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function xmlrpccall_simple() |
33 | 33 | { |
34 | - if(func_num_args() < 2) |
|
34 | + if (func_num_args()<2) |
|
35 | 35 | { |
36 | 36 | // Incorrect |
37 | 37 | return false; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | $xmlrpcval_array = array(); |
50 | - foreach($varargs as $parameter) |
|
50 | + foreach ($varargs as $parameter) |
|
51 | 51 | { |
52 | 52 | $xmlrpcval_array[] = php_xmlrpc_encode($parameter); |
53 | 53 | } |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * |
537 | 537 | * @param xmlrpc_client $client an xmlrpc client set up correctly to communicate with target server |
538 | 538 | * @param string $methodname the xmlrpc method to be mapped to a php function |
539 | - * @param array $extra_options array of options that specify conversion details. valid options include |
|
539 | + * @param integer $extra_options array of options that specify conversion details. valid options include |
|
540 | 540 | * integer signum the index of the method signature to use in mapping (if method exposes many sigs) |
541 | 541 | * integer timeout timeout (in secs) to be used when executing function/calling remote method |
542 | 542 | * string protocol 'http' (default), 'http11' or 'https' |
@@ -805,6 +805,8 @@ discard block |
||
805 | 805 | * valid php code is emitted. |
806 | 806 | * Note: real spaghetti code follows... |
807 | 807 | * @access private |
808 | + * @param xmlrpc_client $client |
|
809 | + * @param string $methodname |
|
808 | 810 | */ |
809 | 811 | function build_remote_method_wrapper_code($client, $methodname, $xmlrpcfuncname, |
810 | 812 | $msig, $mdesc='', $timeout=0, $protocol='', $client_copy_mode=0, $prefix='xmlrpc', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function php_2_xmlrpc_type($phptype) |
29 | 29 | { |
30 | - switch(strtolower($phptype)) |
|
30 | + switch (strtolower($phptype)) |
|
31 | 31 | { |
32 | 32 | case 'string': |
33 | 33 | return $GLOBALS['xmlrpcString']; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | case 'resource': |
50 | 50 | return ''; |
51 | 51 | default: |
52 | - if(class_exists($phptype)) |
|
52 | + if (class_exists($phptype)) |
|
53 | 53 | { |
54 | 54 | return $GLOBALS['xmlrpcStruct']; |
55 | 55 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | function xmlrpc_2_php_type($xmlrpctype) |
70 | 70 | { |
71 | - switch(strtolower($xmlrpctype)) |
|
71 | + switch (strtolower($xmlrpctype)) |
|
72 | 72 | { |
73 | 73 | case 'base64': |
74 | 74 | case 'datetime.iso8601': |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | * @todo if $newfuncname is empty, we could use create_user_func instead of eval, as it is possibly faster |
141 | 141 | * @todo add a verbatim_object_copy parameter to allow avoiding the same obj instance? |
142 | 142 | */ |
143 | - function wrap_php_function($funcname, $newfuncname='', $extra_options=array()) |
|
143 | + function wrap_php_function($funcname, $newfuncname = '', $extra_options = array()) |
|
144 | 144 | { |
145 | 145 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; |
146 | 146 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; |
147 | - $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; |
|
148 | - $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; |
|
147 | + $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool) $extra_options['encode_php_objs'] : false; |
|
148 | + $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool) $extra_options['decode_php_objs'] : false; |
|
149 | 149 | $catch_warnings = isset($extra_options['suppress_warnings']) && $extra_options['suppress_warnings'] ? '@' : ''; |
150 | 150 | |
151 | 151 | $exists = false; |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | { |
154 | 154 | $funcname = explode('::', $funcname); |
155 | 155 | } |
156 | - if(is_array($funcname)) |
|
156 | + if (is_array($funcname)) |
|
157 | 157 | { |
158 | - if(count($funcname) < 2 || (!is_string($funcname[0]) && !is_object($funcname[0]))) |
|
158 | + if (count($funcname)<2 || (!is_string($funcname[0]) && !is_object($funcname[0]))) |
|
159 | 159 | { |
160 | 160 | error_log('XML-RPC: syntax for function to be wrapped is wrong'); |
161 | 161 | return false; |
162 | 162 | } |
163 | - if(is_string($funcname[0])) |
|
163 | + if (is_string($funcname[0])) |
|
164 | 164 | { |
165 | 165 | $plainfuncname = implode('::', $funcname); |
166 | 166 | } |
167 | - elseif(is_object($funcname[0])) |
|
167 | + elseif (is_object($funcname[0])) |
|
168 | 168 | { |
169 | - $plainfuncname = get_class($funcname[0]) . '->' . $funcname[1]; |
|
169 | + $plainfuncname = get_class($funcname[0]).'->'.$funcname[1]; |
|
170 | 170 | } |
171 | 171 | $exists = method_exists($funcname[0], $funcname[1]); |
172 | 172 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $exists = function_exists($funcname); |
177 | 177 | } |
178 | 178 | |
179 | - if(!$exists) |
|
179 | + if (!$exists) |
|
180 | 180 | { |
181 | 181 | error_log('XML-RPC: function to be wrapped is not defined: '.$plainfuncname); |
182 | 182 | return false; |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | else |
185 | 185 | { |
186 | 186 | // determine name of new php function |
187 | - if($newfuncname == '') |
|
187 | + if ($newfuncname == '') |
|
188 | 188 | { |
189 | - if(is_array($funcname)) |
|
189 | + if (is_array($funcname)) |
|
190 | 190 | { |
191 | - if(is_string($funcname[0])) |
|
191 | + if (is_string($funcname[0])) |
|
192 | 192 | $xmlrpcfuncname = "{$prefix}_".implode('_', $funcname); |
193 | 193 | else |
194 | - $xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1]; |
|
194 | + $xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]).'_'.$funcname[1]; |
|
195 | 195 | } |
196 | 196 | else |
197 | 197 | { |
@@ -202,36 +202,36 @@ discard block |
||
202 | 202 | { |
203 | 203 | $xmlrpcfuncname = $newfuncname; |
204 | 204 | } |
205 | - while($buildit && function_exists($xmlrpcfuncname)) |
|
205 | + while ($buildit && function_exists($xmlrpcfuncname)) |
|
206 | 206 | { |
207 | 207 | $xmlrpcfuncname .= 'x'; |
208 | 208 | } |
209 | 209 | |
210 | 210 | // start to introspect PHP code |
211 | - if(is_array($funcname)) |
|
211 | + if (is_array($funcname)) |
|
212 | 212 | { |
213 | 213 | $func = new ReflectionMethod($funcname[0], $funcname[1]); |
214 | - if($func->isPrivate()) |
|
214 | + if ($func->isPrivate()) |
|
215 | 215 | { |
216 | 216 | error_log('XML-RPC: method to be wrapped is private: '.$plainfuncname); |
217 | 217 | return false; |
218 | 218 | } |
219 | - if($func->isProtected()) |
|
219 | + if ($func->isProtected()) |
|
220 | 220 | { |
221 | 221 | error_log('XML-RPC: method to be wrapped is protected: '.$plainfuncname); |
222 | 222 | return false; |
223 | 223 | } |
224 | - if($func->isConstructor()) |
|
224 | + if ($func->isConstructor()) |
|
225 | 225 | { |
226 | 226 | error_log('XML-RPC: method to be wrapped is the constructor: '.$plainfuncname); |
227 | 227 | return false; |
228 | 228 | } |
229 | - if($func->isDestructor()) |
|
229 | + if ($func->isDestructor()) |
|
230 | 230 | { |
231 | 231 | error_log('XML-RPC: method to be wrapped is the destructor: '.$plainfuncname); |
232 | 232 | return false; |
233 | 233 | } |
234 | - if($func->isAbstract()) |
|
234 | + if ($func->isAbstract()) |
|
235 | 235 | { |
236 | 236 | error_log('XML-RPC: method to be wrapped is abstract: '.$plainfuncname); |
237 | 237 | return false; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | { |
243 | 243 | $func = new ReflectionFunction($funcname); |
244 | 244 | } |
245 | - if($func->isInternal()) |
|
245 | + if ($func->isInternal()) |
|
246 | 246 | { |
247 | 247 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
248 | 248 | // instead of getparameters to fully reflect internal php functions ? |
@@ -262,27 +262,27 @@ discard block |
||
262 | 262 | $paramDocs = array(); |
263 | 263 | |
264 | 264 | $docs = $func->getDocComment(); |
265 | - if($docs != '') |
|
265 | + if ($docs != '') |
|
266 | 266 | { |
267 | 267 | $docs = explode("\n", $docs); |
268 | 268 | $i = 0; |
269 | - foreach($docs as $doc) |
|
269 | + foreach ($docs as $doc) |
|
270 | 270 | { |
271 | 271 | $doc = trim($doc, " \r\t/*"); |
272 | - if(strlen($doc) && strpos($doc, '@') !== 0 && !$i) |
|
272 | + if (strlen($doc) && strpos($doc, '@') !== 0 && !$i) |
|
273 | 273 | { |
274 | - if($desc) |
|
274 | + if ($desc) |
|
275 | 275 | { |
276 | 276 | $desc .= "\n"; |
277 | 277 | } |
278 | 278 | $desc .= $doc; |
279 | 279 | } |
280 | - elseif(strpos($doc, '@param') === 0) |
|
280 | + elseif (strpos($doc, '@param') === 0) |
|
281 | 281 | { |
282 | 282 | // syntax: @param type [$name] desc |
283 | - if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches)) |
|
283 | + if (preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches)) |
|
284 | 284 | { |
285 | - if(strpos($matches[1], '|')) |
|
285 | + if (strpos($matches[1], '|')) |
|
286 | 286 | { |
287 | 287 | //$paramDocs[$i]['type'] = explode('|', $matches[1]); |
288 | 288 | $paramDocs[$i]['type'] = 'mixed'; |
@@ -296,14 +296,14 @@ discard block |
||
296 | 296 | } |
297 | 297 | $i++; |
298 | 298 | } |
299 | - elseif(strpos($doc, '@return') === 0) |
|
299 | + elseif (strpos($doc, '@return') === 0) |
|
300 | 300 | { |
301 | 301 | // syntax: @return type desc |
302 | 302 | //$returns = preg_split('/\s+/', $doc); |
303 | - if(preg_match('/@return\s+(\S+)\s+(.+)/', $doc, $matches)) |
|
303 | + if (preg_match('/@return\s+(\S+)\s+(.+)/', $doc, $matches)) |
|
304 | 304 | { |
305 | 305 | $returns = php_2_xmlrpc_type($matches[1]); |
306 | - if(isset($matches[2])) |
|
306 | + if (isset($matches[2])) |
|
307 | 307 | { |
308 | 308 | $returnsDocs = $matches[2]; |
309 | 309 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | // execute introspection of actual function prototype |
316 | 316 | $params = array(); |
317 | 317 | $i = 0; |
318 | - foreach($func->getParameters() as $paramobj) |
|
318 | + foreach ($func->getParameters() as $paramobj) |
|
319 | 319 | { |
320 | 320 | $params[$i] = array(); |
321 | 321 | $params[$i]['name'] = '$'.$paramobj->getName(); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $parsvariations = array(); |
331 | 331 | $pars = array(); |
332 | 332 | $pnum = count($params); |
333 | - foreach($params as $param) |
|
333 | + foreach ($params as $param) |
|
334 | 334 | { |
335 | 335 | if (isset($paramDocs[$i]['name']) && $paramDocs[$i]['name'] && strtolower($paramDocs[$i]['name']) != strtolower($param['name'])) |
336 | 336 | { |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $paramDocs[$i]['type'] = 'mixed'; |
339 | 339 | } |
340 | 340 | |
341 | - if($param['isoptional']) |
|
341 | + if ($param['isoptional']) |
|
342 | 342 | { |
343 | 343 | // this particular parameter is optional. save as valid previous list of parameters |
344 | 344 | $innercode .= "if (\$paramcount > $i) {\n"; |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | |
357 | 357 | $pars[] = "\$p$i"; |
358 | 358 | $i++; |
359 | - if($param['isoptional']) |
|
359 | + if ($param['isoptional']) |
|
360 | 360 | { |
361 | 361 | $innercode .= "}\n"; |
362 | 362 | } |
363 | - if($i == $pnum) |
|
363 | + if ($i == $pnum) |
|
364 | 364 | { |
365 | 365 | // last allowed parameters combination |
366 | 366 | $parsvariations[] = $pars; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | $sigs = array(); |
371 | 371 | $psigs = array(); |
372 | - if(count($parsvariations) == 0) |
|
372 | + if (count($parsvariations) == 0) |
|
373 | 373 | { |
374 | 374 | // only known good synopsis = no parameters |
375 | 375 | $parsvariations[] = array(); |
@@ -380,24 +380,24 @@ discard block |
||
380 | 380 | $minpars = count($parsvariations[0]); |
381 | 381 | } |
382 | 382 | |
383 | - if($minpars) |
|
383 | + if ($minpars) |
|
384 | 384 | { |
385 | 385 | // add to code the check for min params number |
386 | 386 | // NB: this check needs to be done BEFORE decoding param values |
387 | - $innercode = "\$paramcount = \$msg->getNumParams();\n" . |
|
388 | - "if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode; |
|
387 | + $innercode = "\$paramcount = \$msg->getNumParams();\n". |
|
388 | + "if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n".$innercode; |
|
389 | 389 | } |
390 | 390 | else |
391 | 391 | { |
392 | - $innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode; |
|
392 | + $innercode = "\$paramcount = \$msg->getNumParams();\n".$innercode; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | $innercode .= "\$np = false;\n"; |
396 | 396 | // since there are no closures in php, if we are given an object instance, |
397 | 397 | // we store a pointer to it in a global var... |
398 | - if ( is_array($funcname) && is_object($funcname[0]) ) |
|
398 | + if (is_array($funcname) && is_object($funcname[0])) |
|
399 | 399 | { |
400 | - $GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] =& $funcname[0]; |
|
400 | + $GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] = & $funcname[0]; |
|
401 | 401 | $innercode .= "\$obj =& \$GLOBALS['xmlrpcWPFObjHolder']['$xmlrpcfuncname'];\n"; |
402 | 402 | $realfuncname = '$obj->'.$funcname[1]; |
403 | 403 | } |
@@ -405,13 +405,13 @@ discard block |
||
405 | 405 | { |
406 | 406 | $realfuncname = $plainfuncname; |
407 | 407 | } |
408 | - foreach($parsvariations as $pars) |
|
408 | + foreach ($parsvariations as $pars) |
|
409 | 409 | { |
410 | - $innercode .= "if (\$paramcount == " . count($pars) . ") \$retval = {$catch_warnings}$realfuncname(" . implode(',', $pars) . "); else\n"; |
|
410 | + $innercode .= "if (\$paramcount == ".count($pars).") \$retval = {$catch_warnings}$realfuncname(".implode(',', $pars)."); else\n"; |
|
411 | 411 | // build a 'generic' signature (only use an appropriate return type) |
412 | 412 | $sig = array($returns); |
413 | 413 | $psig = array($returnsDocs); |
414 | - for($i=0; $i < count($pars); $i++) |
|
414 | + for ($i = 0; $i<count($pars); $i++) |
|
415 | 415 | { |
416 | 416 | if (isset($paramDocs[$i]['type'])) |
417 | 417 | { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $innercode .= "if (\$np) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}'); else {\n"; |
431 | 431 | //$innercode .= "if (\$_xmlrpcs_error_occurred) return new xmlrpcresp(0, $GLOBALS['xmlrpcerr']user, \$_xmlrpcs_error_occurred); else\n"; |
432 | 432 | $innercode .= "if (is_a(\$retval, '{$prefix}resp')) return \$retval; else\n"; |
433 | - if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64']) |
|
433 | + if ($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64']) |
|
434 | 434 | { |
435 | 435 | $innercode .= "return new {$prefix}resp(new {$prefix}val(\$retval, '$returns'));"; |
436 | 436 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | // shall we exclude functions returning by ref? |
445 | 445 | // if($func->returnsReference()) |
446 | 446 | // return false; |
447 | - $code = "function $xmlrpcfuncname(\$msg) {\n" . $innercode . "}\n}"; |
|
447 | + $code = "function $xmlrpcfuncname(\$msg) {\n".$innercode."}\n}"; |
|
448 | 448 | //print_r($code); |
449 | 449 | if ($buildit) |
450 | 450 | { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | // alternative |
454 | 454 | //$xmlrpcfuncname = create_function('$m', $innercode); |
455 | 455 | |
456 | - if(!$allOK) |
|
456 | + if (!$allOK) |
|
457 | 457 | { |
458 | 458 | error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap php function '.$plainfuncname); |
459 | 459 | return false; |
@@ -481,26 +481,26 @@ discard block |
||
481 | 481 | * @todo get_class_methods will return both static and non-static methods. |
482 | 482 | * we have to differentiate the action, depending on whether we received a class name or object |
483 | 483 | */ |
484 | - function wrap_php_class($classname, $extra_options=array()) |
|
484 | + function wrap_php_class($classname, $extra_options = array()) |
|
485 | 485 | { |
486 | 486 | $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : ''; |
487 | 487 | $methodtype = isset($extra_options['method_type']) ? $extra_options['method_type'] : 'auto'; |
488 | 488 | |
489 | 489 | $result = array(); |
490 | 490 | $mlist = get_class_methods($classname); |
491 | - foreach($mlist as $mname) |
|
491 | + foreach ($mlist as $mname) |
|
492 | 492 | { |
493 | 493 | if ($methodfilter == '' || preg_match($methodfilter, $mname)) |
494 | 494 | { |
495 | 495 | // echo $mlist."\n"; |
496 | 496 | $func = new ReflectionMethod($classname, $mname); |
497 | - if(!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract()) |
|
497 | + if (!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract()) |
|
498 | 498 | { |
499 | - if(($func->isStatic && ($methodtype == 'all' || $methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) || |
|
499 | + if (($func->isStatic && ($methodtype == 'all' || $methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) || |
|
500 | 500 | (!$func->isStatic && ($methodtype == 'all' || $methodtype == 'nonstatic' || ($methodtype == 'auto' && is_object($classname))))) |
501 | 501 | { |
502 | 502 | $methodwrap = wrap_php_function(array($classname, $mname), '', $extra_options); |
503 | - if ( $methodwrap ) |
|
503 | + if ($methodwrap) |
|
504 | 504 | { |
505 | 505 | $result[$methodwrap['function']] = $methodwrap['function']; |
506 | 506 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * bool debug set it to 1 or 2 to see debug results of querying server for method synopsis |
549 | 549 | * @return string the name of the generated php function (or false) - OR AN ARRAY... |
550 | 550 | */ |
551 | - function wrap_xmlrpc_method($client, $methodname, $extra_options=0, $timeout=0, $protocol='', $newfuncname='') |
|
551 | + function wrap_xmlrpc_method($client, $methodname, $extra_options = 0, $timeout = 0, $protocol = '', $newfuncname = '') |
|
552 | 552 | { |
553 | 553 | // mind numbing: let caller use sane calling convention (as per javadoc, 3 params), |
554 | 554 | // OR the 2.0 calling convention (no options) - we really love backward compat, don't we? |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | } |
560 | 560 | else |
561 | 561 | { |
562 | - $signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0; |
|
563 | - $timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0; |
|
562 | + $signum = isset($extra_options['signum']) ? (int) $extra_options['signum'] : 0; |
|
563 | + $timeout = isset($extra_options['timeout']) ? (int) $extra_options['timeout'] : 0; |
|
564 | 564 | $protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : ''; |
565 | 565 | $newfuncname = isset($extra_options['new_function_name']) ? $extra_options['new_function_name'] : ''; |
566 | 566 | } |
@@ -568,10 +568,10 @@ discard block |
||
568 | 568 | //$verbatim_client_copy = in_array('simple_client_copy', $extra_options) ? 1 : |
569 | 569 | // in_array('build_class_code', $extra_options) ? 2 : 0; |
570 | 570 | |
571 | - $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; |
|
572 | - $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; |
|
571 | + $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool) $extra_options['encode_php_objs'] : false; |
|
572 | + $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool) $extra_options['decode_php_objs'] : false; |
|
573 | 573 | // it seems like the meaning of 'simple_client_copy' here is swapped wrt client_copy_mode later on... |
574 | - $simple_client_copy = isset($extra_options['simple_client_copy']) ? (int)($extra_options['simple_client_copy']) : 0; |
|
574 | + $simple_client_copy = isset($extra_options['simple_client_copy']) ? (int) ($extra_options['simple_client_copy']) : 0; |
|
575 | 575 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; |
576 | 576 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; |
577 | 577 | if (isset($extra_options['return_on_fault'])) |
@@ -593,8 +593,8 @@ discard block |
||
593 | 593 | $msg = new $msgclass('system.methodSignature'); |
594 | 594 | $msg->addparam(new $valclass($methodname)); |
595 | 595 | $client->setDebug($debug); |
596 | - $response =& $client->send($msg, $timeout, $protocol); |
|
597 | - if($response->faultCode()) |
|
596 | + $response = & $client->send($msg, $timeout, $protocol); |
|
597 | + if ($response->faultCode()) |
|
598 | 598 | { |
599 | 599 | error_log('XML-RPC: could not retrieve method signature from remote server for method '.$methodname); |
600 | 600 | return false; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | { |
607 | 607 | $msig = $decodefunc($msig); |
608 | 608 | } |
609 | - if(!is_array($msig) || count($msig) <= $signum) |
|
609 | + if (!is_array($msig) || count($msig)<=$signum) |
|
610 | 610 | { |
611 | 611 | error_log('XML-RPC: could not retrieve method signature nr.'.$signum.' from remote server for method '.$methodname); |
612 | 612 | return false; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | else |
615 | 615 | { |
616 | 616 | // pick a suitable name for the new function, avoiding collisions |
617 | - if($newfuncname != '') |
|
617 | + if ($newfuncname != '') |
|
618 | 618 | { |
619 | 619 | $xmlrpcfuncname = $newfuncname; |
620 | 620 | } |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | $xmlrpcfuncname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
626 | 626 | array('_', ''), $methodname); |
627 | 627 | } |
628 | - while($buildit && function_exists($xmlrpcfuncname)) |
|
628 | + while ($buildit && function_exists($xmlrpcfuncname)) |
|
629 | 629 | { |
630 | 630 | $xmlrpcfuncname .= 'x'; |
631 | 631 | } |
@@ -634,11 +634,11 @@ discard block |
||
634 | 634 | $mdesc = ''; |
635 | 635 | // if in 'offline' mode, get method description too. |
636 | 636 | // in online mode, favour speed of operation |
637 | - if(!$buildit) |
|
637 | + if (!$buildit) |
|
638 | 638 | { |
639 | 639 | $msg = new $msgclass('system.methodHelp'); |
640 | 640 | $msg->addparam(new $valclass($methodname)); |
641 | - $response =& $client->send($msg, $timeout, $protocol); |
|
641 | + $response = & $client->send($msg, $timeout, $protocol); |
|
642 | 642 | if (!$response->faultCode()) |
643 | 643 | { |
644 | 644 | $mdesc = $response->value(); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | eval($results['source'].'$allOK=1;'); |
662 | 662 | // alternative |
663 | 663 | //$xmlrpcfuncname = create_function('$m', $innercode); |
664 | - if($allOK) |
|
664 | + if ($allOK) |
|
665 | 665 | { |
666 | 666 | return $xmlrpcfuncname; |
667 | 667 | } |
@@ -688,15 +688,15 @@ discard block |
||
688 | 688 | * @param array $extra_options list of options for wrapped code |
689 | 689 | * @return mixed false on error, the name of the created class if all ok or an array with code, class name and comments (if the appropriatevoption is set in extra_options) |
690 | 690 | */ |
691 | - function wrap_xmlrpc_server($client, $extra_options=array()) |
|
691 | + function wrap_xmlrpc_server($client, $extra_options = array()) |
|
692 | 692 | { |
693 | 693 | $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : ''; |
694 | 694 | //$signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0; |
695 | - $timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0; |
|
695 | + $timeout = isset($extra_options['timeout']) ? (int) $extra_options['timeout'] : 0; |
|
696 | 696 | $protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : ''; |
697 | 697 | $newclassname = isset($extra_options['new_class_name']) ? $extra_options['new_class_name'] : ''; |
698 | - $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; |
|
699 | - $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; |
|
698 | + $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool) $extra_options['encode_php_objs'] : false; |
|
699 | + $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool) $extra_options['decode_php_objs'] : false; |
|
700 | 700 | $verbatim_client_copy = isset($extra_options['simple_client_copy']) ? !($extra_options['simple_client_copy']) : true; |
701 | 701 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; |
702 | 702 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; |
@@ -706,8 +706,8 @@ discard block |
||
706 | 706 | $decodefunc = 'php_'.$prefix.'_decode'; |
707 | 707 | |
708 | 708 | $msg = new $msgclass('system.listMethods'); |
709 | - $response =& $client->send($msg, $timeout, $protocol); |
|
710 | - if($response->faultCode()) |
|
709 | + $response = & $client->send($msg, $timeout, $protocol); |
|
710 | + if ($response->faultCode()) |
|
711 | 711 | { |
712 | 712 | error_log('XML-RPC: could not retrieve method list from remote server'); |
713 | 713 | return false; |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | { |
720 | 720 | $mlist = $decodefunc($mlist); |
721 | 721 | } |
722 | - if(!is_array($mlist) || !count($mlist)) |
|
722 | + if (!is_array($mlist) || !count($mlist)) |
|
723 | 723 | { |
724 | 724 | error_log('XML-RPC: could not retrieve meaningful method list from remote server'); |
725 | 725 | return false; |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | else |
728 | 728 | { |
729 | 729 | // pick a suitable name for the new function, avoiding collisions |
730 | - if($newclassname != '') |
|
730 | + if ($newclassname != '') |
|
731 | 731 | { |
732 | 732 | $xmlrpcclassname = $newclassname; |
733 | 733 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $xmlrpcclassname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
737 | 737 | array('_', ''), $client->server).'_client'; |
738 | 738 | } |
739 | - while($buildit && class_exists($xmlrpcclassname)) |
|
739 | + while ($buildit && class_exists($xmlrpcclassname)) |
|
740 | 740 | { |
741 | 741 | $xmlrpcclassname .= 'x'; |
742 | 742 | } |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | 'decode_php_objs' => $decode_php_objects |
753 | 753 | ); |
754 | 754 | /// @todo build javadoc for class definition, too |
755 | - foreach($mlist as $mname) |
|
755 | + foreach ($mlist as $mname) |
|
756 | 756 | { |
757 | 757 | if ($methodfilter == '' || preg_match($methodfilter, $mname)) |
758 | 758 | { |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | eval($source.'$allOK=1;'); |
781 | 781 | // alternative |
782 | 782 | //$xmlrpcfuncname = create_function('$m', $innercode); |
783 | - if($allOK) |
|
783 | + if ($allOK) |
|
784 | 784 | { |
785 | 785 | return $xmlrpcclassname; |
786 | 786 | } |
@@ -807,12 +807,12 @@ discard block |
||
807 | 807 | * @access private |
808 | 808 | */ |
809 | 809 | function build_remote_method_wrapper_code($client, $methodname, $xmlrpcfuncname, |
810 | - $msig, $mdesc='', $timeout=0, $protocol='', $client_copy_mode=0, $prefix='xmlrpc', |
|
811 | - $decode_php_objects=false, $encode_php_objects=false, $decode_fault=false, |
|
812 | - $fault_response='') |
|
810 | + $msig, $mdesc = '', $timeout = 0, $protocol = '', $client_copy_mode = 0, $prefix = 'xmlrpc', |
|
811 | + $decode_php_objects = false, $encode_php_objects = false, $decode_fault = false, |
|
812 | + $fault_response = '') |
|
813 | 813 | { |
814 | 814 | $code = "function $xmlrpcfuncname ("; |
815 | - if ($client_copy_mode < 2) |
|
815 | + if ($client_copy_mode<2) |
|
816 | 816 | { |
817 | 817 | // client copy mode 0 or 1 == partial / full client copy in emitted code |
818 | 818 | $innercode = build_client_wrapper_code($client, $client_copy_mode, $prefix); |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | // param parsing |
841 | 841 | $plist = array(); |
842 | 842 | $pcount = count($msig); |
843 | - for($i = 1; $i < $pcount; $i++) |
|
843 | + for ($i = 1; $i<$pcount; $i++) |
|
844 | 844 | { |
845 | 845 | $plist[] = "\$p$i"; |
846 | 846 | $ptype = $msig[$i]; |
847 | - if($ptype == 'i4' || $ptype == 'int' || $ptype == 'boolean' || $ptype == 'double' || |
|
847 | + if ($ptype == 'i4' || $ptype == 'int' || $ptype == 'boolean' || $ptype == 'double' || |
|
848 | 848 | $ptype == 'string' || $ptype == 'dateTime.iso8601' || $ptype == 'base64' || $ptype == 'null') |
849 | 849 | { |
850 | 850 | // only build directly xmlrpcvals when type is known and scalar |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | $innercode .= "\$msg->addparam(\$p$i);\n"; |
865 | 865 | $mdesc .= '* @param '.xmlrpc_2_php_type($ptype)." \$p$i\n"; |
866 | 866 | } |
867 | - if ($client_copy_mode < 2) |
|
867 | + if ($client_copy_mode<2) |
|
868 | 868 | { |
869 | 869 | $plist[] = '$debug=0'; |
870 | 870 | $mdesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | $innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value());"; |
898 | 898 | } |
899 | 899 | |
900 | - $code = $code . $plist. ") {\n" . $innercode . "\n}\n"; |
|
900 | + $code = $code.$plist.") {\n".$innercode."\n}\n"; |
|
901 | 901 | |
902 | 902 | return array('source' => $code, 'docstring' => $mdesc); |
903 | 903 | } |
@@ -908,18 +908,18 @@ discard block |
||
908 | 908 | * valid php code is emitted. |
909 | 909 | * @access private |
910 | 910 | */ |
911 | - function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') |
|
911 | + function build_client_wrapper_code($client, $verbatim_client_copy, $prefix = 'xmlrpc') |
|
912 | 912 | { |
913 | 913 | $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path). |
914 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
914 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
915 | 915 | |
916 | 916 | // copy all client fields to the client that will be generated runtime |
917 | 917 | // (this provides for future expansion or subclassing of client obj) |
918 | 918 | if ($verbatim_client_copy) |
919 | 919 | { |
920 | - foreach($client as $fld => $val) |
|
920 | + foreach ($client as $fld => $val) |
|
921 | 921 | { |
922 | - if($fld != 'debug' && $fld != 'return_type') |
|
922 | + if ($fld != 'debug' && $fld != 'return_type') |
|
923 | 923 | { |
924 | 924 | $val = var_export($val, true); |
925 | 925 | $code .= "\$client->$fld = $val;\n"; |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | function stripslashes_deep($value) |
15 | 15 | { |
16 | 16 | $value = is_array($value) ? |
17 | - array_map('stripslashes_deep', $value) : |
|
18 | - stripslashes($value); |
|
17 | + array_map('stripslashes_deep', $value) : stripslashes($value); |
|
19 | 18 | |
20 | 19 | return $value; |
21 | 20 | } |
@@ -25,7 +24,7 @@ discard block |
||
25 | 24 | $preferredEncodings = 'UTF-8, ASCII, ISO-8859-1, UTF-7, EUC-JP, SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP'; |
26 | 25 | $inputcharset = mb_detect_encoding(urldecode($_SERVER['REQUEST_URI']), $preferredEncodings); |
27 | 26 | |
28 | - if ( isset( $_GET['usepost'] ) && $_GET['usepost'] === 'true' ) |
|
27 | + if (isset($_GET['usepost']) && $_GET['usepost'] === 'true') |
|
29 | 28 | { |
30 | 29 | $_GET = $_POST; |
31 | 30 | $inputcharset = mb_detect_encoding(implode('', $_GET), $preferredEncodings); |
@@ -69,11 +68,11 @@ discard block |
||
69 | 68 | $verifypeer = true; |
70 | 69 | else |
71 | 70 | $verifypeer = false; |
72 | - $cainfo= isset($_GET['cainfo']) ? $_GET['cainfo'] : ''; |
|
71 | + $cainfo = isset($_GET['cainfo']) ? $_GET['cainfo'] : ''; |
|
73 | 72 | $proxy = isset($_GET['proxy']) ? $_GET['proxy'] : 0; |
74 | 73 | if (strpos($proxy, 'http://') === 0) |
75 | 74 | $proxy = substr($proxy, 7); |
76 | - $proxyuser= isset($_GET['proxyuser']) ? $_GET['proxyuser'] : ''; |
|
75 | + $proxyuser = isset($_GET['proxyuser']) ? $_GET['proxyuser'] : ''; |
|
77 | 76 | $proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : ''; |
78 | 77 | $timeout = isset($_GET['timeout']) ? $_GET['timeout'] : 0; |
79 | 78 | if (!is_numeric($timeout)) |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | if ($proxy != '') { |
83 | 83 | $pproxy = explode(':', $proxy); |
84 | - if (count($pproxy) > 1) |
|
84 | + if (count($pproxy)>1) |
|
85 | 85 | $pport = $pproxy[1]; |
86 | 86 | else |
87 | 87 | $pport = 8080; |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | if ($wstype == 1) |
176 | 176 | { |
177 | 177 | $msg[0]->payload = "{\n". |
178 | - '"method": "' . $method . "\",\n\"params\": [" . |
|
179 | - $payload . |
|
178 | + '"method": "'.$method."\",\n\"params\": [". |
|
179 | + $payload. |
|
180 | 180 | "\n],\n\"id\": "; |
181 | 181 | // fix: if user gave an empty string, use NULL, or we'll break json syntax |
182 | 182 | if ($id == "") |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | } |
197 | 197 | } |
198 | 198 | else |
199 | - $msg[0]->payload = $msg[0]->xml_header($inputcharset) . |
|
200 | - '<methodName>' . $method . "</methodName>\n<params>" . |
|
201 | - $payload . |
|
202 | - "</params>\n" . $msg[0]->xml_footer(); |
|
199 | + $msg[0]->payload = $msg[0]->xml_header($inputcharset). |
|
200 | + '<methodName>'.$method."</methodName>\n<params>". |
|
201 | + $payload. |
|
202 | + "</params>\n".$msg[0]->xml_footer(); |
|
203 | 203 | $actionname = 'Execution of method '.$method; |
204 | 204 | break; |
205 | 205 | default: // give a warning |
@@ -214,20 +214,20 @@ discard block |
||
214 | 214 | $response = null; |
215 | 215 | // execute method(s) |
216 | 216 | if ($debug) |
217 | - echo '<div class="dbginfo"><h2>Debug info:</h2>'; /// @todo use ob_start instead |
|
217 | + echo '<div class="dbginfo"><h2>Debug info:</h2>'; /// @todo use ob_start instead |
|
218 | 218 | $resp = array(); |
219 | - $mtime = explode(' ',microtime()); |
|
220 | - $time = (float)$mtime[0] + (float)$mtime[1]; |
|
219 | + $mtime = explode(' ', microtime()); |
|
220 | + $time = (float) $mtime[0]+(float) $mtime[1]; |
|
221 | 221 | foreach ($msg as $message) |
222 | 222 | { |
223 | 223 | // catch errors: for older xmlrpc libs, send does not return by ref |
224 | - @$response =& $client->send($message, $timeout, $httpprotocol); |
|
224 | + @$response = & $client->send($message, $timeout, $httpprotocol); |
|
225 | 225 | $resp[] = $response; |
226 | 226 | if (!$response || $response->faultCode()) |
227 | 227 | break; |
228 | 228 | } |
229 | - $mtime = explode(' ',microtime()); |
|
230 | - $time = (float)$mtime[0] + (float)$mtime[1] - $time; |
|
229 | + $mtime = explode(' ', microtime()); |
|
230 | + $time = (float) $mtime[0]+(float) $mtime[1]-$time; |
|
231 | 231 | if ($debug) |
232 | 232 | echo "</div>\n"; |
233 | 233 | |
@@ -239,15 +239,15 @@ discard block |
||
239 | 239 | // call failed! echo out error msg! |
240 | 240 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
241 | 241 | echo "<h3>$protoname call FAILED!</h3>\n"; |
242 | - echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . |
|
243 | - "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . "'</p>\n"; |
|
242 | + echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']). |
|
243 | + "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."'</p>\n"; |
|
244 | 244 | echo (strftime("%d/%b/%Y:%H:%M:%S\n")); |
245 | 245 | } |
246 | 246 | else |
247 | 247 | { |
248 | 248 | // call succeeded: parse results |
249 | 249 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
250 | - printf ("<h3>%s call(s) OK (%.2f secs.)</h3>\n", $protoname, $time); |
|
250 | + printf("<h3>%s call(s) OK (%.2f secs.)</h3>\n", $protoname, $time); |
|
251 | 251 | echo (strftime("%d/%b/%Y:%H:%M:%S\n")); |
252 | 252 | |
253 | 253 | switch ($action) |
@@ -255,15 +255,15 @@ discard block |
||
255 | 255 | case 'list': |
256 | 256 | |
257 | 257 | $v = $response->value(); |
258 | - if ($v->kindOf()=="array") |
|
258 | + if ($v->kindOf() == "array") |
|
259 | 259 | { |
260 | 260 | $max = $v->arraysize(); |
261 | 261 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
262 | 262 | echo "<thead>\n<tr><th>Method</th><th>Description</th></tr>\n</thead>\n<tbody>\n"; |
263 | - for($i=0; $i < $max; $i++) |
|
263 | + for ($i = 0; $i<$max; $i++) |
|
264 | 264 | { |
265 | 265 | $rec = $v->arraymem($i); |
266 | - if ($i%2) $class=' class="oddrow"'; else $class = ' class="evenrow"'; |
|
266 | + if ($i % 2) $class = ' class="oddrow"'; else $class = ' class="evenrow"'; |
|
267 | 267 | echo ("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
268 | 268 | "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
269 | 269 | "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
@@ -319,33 +319,33 @@ discard block |
||
319 | 319 | if ($desc == "") |
320 | 320 | $desc = "-"; |
321 | 321 | echo "<tr><td class=\"evenrow\">Description</td><td colspan=\"3\" class=\"evenrow\">$desc</td></tr>\n"; |
322 | - $payload=""; |
|
323 | - $alt_payload=""; |
|
324 | - if ($r2->kindOf()!="array") |
|
322 | + $payload = ""; |
|
323 | + $alt_payload = ""; |
|
324 | + if ($r2->kindOf() != "array") |
|
325 | 325 | echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
326 | 326 | else |
327 | 327 | { |
328 | - for($i=0; $i < $r2->arraysize(); $i++) |
|
328 | + for ($i = 0; $i<$r2->arraysize(); $i++) |
|
329 | 329 | { |
330 | - if ($i+1%2) $class=' class="oddrow"'; else $class = ' class="evenrow"'; |
|
330 | + if ($i+1 % 2) $class = ' class="oddrow"'; else $class = ' class="evenrow"'; |
|
331 | 331 | echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
332 | 332 | $x = $r2->arraymem($i); |
333 | - if ($x->kindOf()=="array") |
|
333 | + if ($x->kindOf() == "array") |
|
334 | 334 | { |
335 | 335 | $ret = $x->arraymem(0); |
336 | - echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . "<br />IN: ("; |
|
337 | - if ($x->arraysize() > 1) |
|
336 | + echo "<code>OUT: ".htmlspecialchars($ret->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."<br />IN: ("; |
|
337 | + if ($x->arraysize()>1) |
|
338 | 338 | { |
339 | - for($k = 1; $k < $x->arraysize(); $k++) |
|
339 | + for ($k = 1; $k<$x->arraysize(); $k++) |
|
340 | 340 | { |
341 | 341 | $y = $x->arraymem($k); |
342 | 342 | echo $y->scalarval(); |
343 | 343 | if ($wstype != 1) |
344 | 344 | { |
345 | - $payload = $payload . '<param><value><'.htmlspecialchars($y->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']).'></'.htmlspecialchars($y->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."></value></param>\n"; |
|
345 | + $payload = $payload.'<param><value><'.htmlspecialchars($y->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']).'></'.htmlspecialchars($y->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."></value></param>\n"; |
|
346 | 346 | } |
347 | 347 | $alt_payload .= $y->scalarval(); |
348 | - if ($k < $x->arraysize()-1) |
|
348 | + if ($k<$x->arraysize()-1) |
|
349 | 349 | { |
350 | 350 | $alt_payload .= ';'; |
351 | 351 | echo ", "; |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | case 'wrap': |
430 | 430 | $r1 = $resp[0]->value(); |
431 | 431 | $r2 = $resp[1]->value(); |
432 | - if ($r2->kindOf()!="array" || $r2->arraysize() <= $methodsig) |
|
432 | + if ($r2->kindOf() != "array" || $r2->arraysize()<=$methodsig) |
|
433 | 433 | echo "Error: signature unknown\n"; |
434 | 434 | else |
435 | 435 | { |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $msig = php_xmlrpc_decode($r2); |
438 | 438 | $msig = $msig[$methodsig]; |
439 | 439 | $proto = $protocol == 2 ? 'https' : $protocol == 1 ? 'http11' : ''; |
440 | - if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
|
440 | + if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
|
441 | 441 | $clientcookies == '') |
442 | 442 | { |
443 | 443 | $opts = 0; // simple client copy in stub code |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | //--> |
215 | 215 | </script> |
216 | 216 | </head> |
217 | -<body onload="switchtransport(<?php echo $wstype;?>); switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) echo ' document.forms[2].submit();'; ?>"> |
|
217 | +<body onload="switchtransport(<?php echo $wstype; ?>); switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) echo ' document.forms[2].submit();'; ?>"> |
|
218 | 218 | <h1>XMLRPC <form name="frmxmlrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(0);"/></form> |
219 | 219 | /<form name="frmjsonrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(1);"/></form>JSONRPC Debugger (based on the <a href="http://phpxmlrpc.sourceforge.net">PHP-XMLRPC</a> library)</h1> |
220 | 220 | <form name="frmaction" method="get" action="action.php" target="frmaction" onSubmit="switchFormMethod();" |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | <table id="actionblock"> |
233 | 233 | <tr> |
234 | 234 | <td><h2>Action</h2></td> |
235 | -<td>List available methods<input type="radio" name="action" value="list"<?php if ($action=='list') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
236 | -<td>Describe method<input type="radio" name="action" value="describe"<?php if ($action=='describe') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
237 | -<td>Execute method<input type="radio" name="action" value="execute"<?php if ($action=='execute') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
238 | -<td>Generate stub for method call<input type="radio" name="action" value="wrap"<?php if ($action=='wrap') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
235 | +<td>List available methods<input type="radio" name="action" value="list"<?php if ($action == 'list') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
236 | +<td>Describe method<input type="radio" name="action" value="describe"<?php if ($action == 'describe') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
237 | +<td>Execute method<input type="radio" name="action" value="execute"<?php if ($action == 'execute') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
238 | +<td>Generate stub for method call<input type="radio" name="action" value="wrap"<?php if ($action == 'wrap') echo ' checked="checked"'; ?> onclick="switchaction();" /></td> |
|
239 | 239 | </tr> |
240 | 240 | </table> |
241 | 241 | <input type="hidden" name="methodsig" value="<?php echo htmlspecialchars($methodsig, ENT_COMPAT, $inputcharset); ?>" /> |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | <td class="labelcell">Name:</td><td><input type="text" name="method" value="<?php echo htmlspecialchars($method, ENT_COMPAT, $inputcharset); ?>" /></td> |
247 | 247 | <td class="labelcell">Payload:<br/><div id="methodpayloadbtn"></div></td><td><textarea id="methodpayload" name="methodpayload" rows="1" cols="40"><?php echo htmlspecialchars($payload, ENT_COMPAT, $inputcharset); ?></textarea></td> |
248 | 248 | <td class="labelcell" id="idcell">Msg id: <input type="text" name="id" size="3" value="<?php echo htmlspecialchars($id, ENT_COMPAT, $inputcharset); ?>"/></td> |
249 | -<td><input type="hidden" name="wstype" value="<?php echo $wstype;?>" /> |
|
249 | +<td><input type="hidden" name="wstype" value="<?php echo $wstype; ?>" /> |
|
250 | 250 | <input type="submit" value="Execute" onclick="return verifyserver();"/></td> |
251 | 251 | </tr> |
252 | 252 | </table> |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | <option value="2"<?php if ($debug == 2) echo ' selected="selected"'; ?>>More</option> |
261 | 261 | </select> |
262 | 262 | </td> |
263 | -<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) echo $timeout; ?>" /></td> |
|
263 | +<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" size="3" value="<?php if ($timeout>0) echo $timeout; ?>" /></td> |
|
264 | 264 | <td class="labelcell">Protocol:</td><td><select name="protocol" onchange="switchssl(); switchauth(); swicthcainfo();"> |
265 | 265 | <option value="0"<?php if ($protocol == 0) echo ' selected="selected"'; ?>>HTTP 1.0</option> |
266 | 266 | <option value="1"<?php if ($protocol == 1) echo ' selected="selected"'; ?>>HTTP 1.1</option> |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | $timeout = 0; |
24 | 24 | $url = php_xmlrpc_decode($m->getParam(0)); |
25 | 25 | $c = new xmlrpc_client($url); |
26 | - if ($m->getNumParams() > 3) |
|
26 | + if ($m->getNumParams()>3) |
|
27 | 27 | { |
28 | 28 | // we have to set some options onto the client. |
29 | 29 | // Note that if we do not untaint the received values, warnings might be generated... |
30 | 30 | $options = php_xmlrpc_decode($m->getParam(3)); |
31 | - foreach($options as $key => $val) |
|
31 | + foreach ($options as $key => $val) |
|
32 | 32 | { |
33 | - switch($key) |
|
33 | + switch ($key) |
|
34 | 34 | { |
35 | 35 | case 'Cookie': |
36 | 36 | break; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $method = php_xmlrpc_decode($m->getParam(1)); |
60 | 60 | $pars = $m->getParam(2); |
61 | 61 | $m = new xmlrpcmsg($method); |
62 | - for ($i = 0; $i < $pars->arraySize(); $i++) |
|
62 | + for ($i = 0; $i<$pars->arraySize(); $i++) |
|
63 | 63 | { |
64 | 64 | $m->addParam($pars->arraymem($i)); |
65 | 65 | } |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | include("xmlrpc.inc"); |
4 | 4 | include("xmlrpcs.inc"); |
5 | 5 | |
6 | - $addcomment_sig=array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcString)); |
|
6 | + $addcomment_sig = array(array($xmlrpcInt, $xmlrpcString, $xmlrpcString, $xmlrpcString)); |
|
7 | 7 | |
8 | - $addcomment_doc='Adds a comment to an item. The first parameter |
|
8 | + $addcomment_doc = 'Adds a comment to an item. The first parameter |
|
9 | 9 | is the item ID, the second the name of the commenter, and the third |
10 | 10 | is the comment itself. Returns the number of comments against that |
11 | 11 | ID.'; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | function addcomment($m) |
14 | 14 | { |
15 | 15 | global $xmlrpcerruser; |
16 | - $err=""; |
|
16 | + $err = ""; |
|
17 | 17 | // since validation has already been carried out for us, |
18 | 18 | // we know we got exactly 3 string values |
19 | 19 | $n = php_xmlrpc_decode($m); |
@@ -21,31 +21,31 @@ discard block |
||
21 | 21 | $name = $n[1]; |
22 | 22 | $comment = $n[2]; |
23 | 23 | |
24 | - $dbh=dba_open("/tmp/comments.db", "c", "db2"); |
|
25 | - if($dbh) |
|
24 | + $dbh = dba_open("/tmp/comments.db", "c", "db2"); |
|
25 | + if ($dbh) |
|
26 | 26 | { |
27 | - $countID="${msgID}_count"; |
|
28 | - if(dba_exists($countID, $dbh)) |
|
27 | + $countID = "${msgID}_count"; |
|
28 | + if (dba_exists($countID, $dbh)) |
|
29 | 29 | { |
30 | - $count=dba_fetch($countID, $dbh); |
|
30 | + $count = dba_fetch($countID, $dbh); |
|
31 | 31 | } |
32 | 32 | else |
33 | 33 | { |
34 | - $count=0; |
|
34 | + $count = 0; |
|
35 | 35 | } |
36 | 36 | // add the new comment in |
37 | - dba_insert($msgID . "_comment_${count}", $comment, $dbh); |
|
38 | - dba_insert($msgID . "_name_${count}", $name, $dbh); |
|
37 | + dba_insert($msgID."_comment_${count}", $comment, $dbh); |
|
38 | + dba_insert($msgID."_name_${count}", $name, $dbh); |
|
39 | 39 | $count++; |
40 | 40 | dba_replace($countID, $count, $dbh); |
41 | 41 | dba_close($dbh); |
42 | 42 | } |
43 | 43 | else |
44 | 44 | { |
45 | - $err="Unable to open comments database."; |
|
45 | + $err = "Unable to open comments database."; |
|
46 | 46 | } |
47 | 47 | // if we generated an error, create an error return response |
48 | - if($err) |
|
48 | + if ($err) |
|
49 | 49 | { |
50 | 50 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
51 | 51 | } |
@@ -57,37 +57,37 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - $getcomments_sig=array(array($xmlrpcArray, $xmlrpcString)); |
|
60 | + $getcomments_sig = array(array($xmlrpcArray, $xmlrpcString)); |
|
61 | 61 | |
62 | - $getcomments_doc='Returns an array of comments for a given ID, which |
|
62 | + $getcomments_doc = 'Returns an array of comments for a given ID, which |
|
63 | 63 | is the sole argument. Each array item is a struct containing name |
64 | 64 | and comment text.'; |
65 | 65 | |
66 | 66 | function getcomments($m) |
67 | 67 | { |
68 | 68 | global $xmlrpcerruser; |
69 | - $err=""; |
|
70 | - $ra=array(); |
|
69 | + $err = ""; |
|
70 | + $ra = array(); |
|
71 | 71 | // get the first param |
72 | - if(XMLRPC_EPI_ENABLED == '1') |
|
72 | + if (XMLRPC_EPI_ENABLED == '1') |
|
73 | 73 | { |
74 | - $msgID=xmlrpc_decode($m->getParam(0)); |
|
74 | + $msgID = xmlrpc_decode($m->getParam(0)); |
|
75 | 75 | } |
76 | 76 | else |
77 | 77 | { |
78 | - $msgID=php_xmlrpc_decode($m->getParam(0)); |
|
78 | + $msgID = php_xmlrpc_decode($m->getParam(0)); |
|
79 | 79 | } |
80 | - $dbh=dba_open("/tmp/comments.db", "r", "db2"); |
|
81 | - if($dbh) |
|
80 | + $dbh = dba_open("/tmp/comments.db", "r", "db2"); |
|
81 | + if ($dbh) |
|
82 | 82 | { |
83 | - $countID="${msgID}_count"; |
|
84 | - if(dba_exists($countID, $dbh)) |
|
83 | + $countID = "${msgID}_count"; |
|
84 | + if (dba_exists($countID, $dbh)) |
|
85 | 85 | { |
86 | - $count=dba_fetch($countID, $dbh); |
|
87 | - for($i=0; $i<$count; $i++) |
|
86 | + $count = dba_fetch($countID, $dbh); |
|
87 | + for ($i = 0; $i<$count; $i++) |
|
88 | 88 | { |
89 | - $name=dba_fetch("${msgID}_name_${i}", $dbh); |
|
90 | - $comment=dba_fetch("${msgID}_comment_${i}", $dbh); |
|
89 | + $name = dba_fetch("${msgID}_name_${i}", $dbh); |
|
90 | + $comment = dba_fetch("${msgID}_comment_${i}", $dbh); |
|
91 | 91 | // push a new struct onto the return array |
92 | 92 | $ra[] = array( |
93 | 93 | "name" => $name, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | // if we generated an error, create an error return response |
100 | - if($err) |
|
100 | + if ($err) |
|
101 | 101 | { |
102 | 102 | return new xmlrpcresp(0, $xmlrpcerruser, $err); |
103 | 103 | } |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" |
72 | 72 | ); |
73 | 73 | |
74 | - $findstate_sig=array(array($xmlrpcString, $xmlrpcInt)); |
|
75 | - $findstate_doc='When passed an integer between 1 and 51 returns the |
|
74 | + $findstate_sig = array(array($xmlrpcString, $xmlrpcInt)); |
|
75 | + $findstate_doc = 'When passed an integer between 1 and 51 returns the |
|
76 | 76 | name of a US state, where the integer is the index of that state name |
77 | 77 | in an alphabetic order.'; |
78 | 78 | |
@@ -80,24 +80,24 @@ discard block |
||
80 | 80 | function findstate($m) |
81 | 81 | { |
82 | 82 | global $xmlrpcerruser, $stateNames; |
83 | - $err=""; |
|
83 | + $err = ""; |
|
84 | 84 | // get the first param |
85 | - $sno=$m->getParam(0); |
|
85 | + $sno = $m->getParam(0); |
|
86 | 86 | |
87 | 87 | // param must be there and of the correct type: server object does the |
88 | 88 | // validation for us |
89 | 89 | |
90 | 90 | // extract the value of the state number |
91 | - $snv=$sno->scalarval(); |
|
91 | + $snv = $sno->scalarval(); |
|
92 | 92 | // look it up in our array (zero-based) |
93 | 93 | if (isset($stateNames[$snv-1])) |
94 | 94 | { |
95 | - $sname=$stateNames[$snv-1]; |
|
95 | + $sname = $stateNames[$snv-1]; |
|
96 | 96 | } |
97 | 97 | else |
98 | 98 | { |
99 | 99 | // not, there so complain |
100 | - $err="I don't have a state for the index '" . $snv . "'"; |
|
100 | + $err = "I don't have a state for the index '".$snv."'"; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // if we generated an error, create an error return response |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | else |
130 | 130 | { |
131 | 131 | // not, there so complain |
132 | - return "I don't have a state for the index '" . $stateno . "'"; |
|
132 | + return "I don't have a state for the index '".$stateno."'"; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | $findstate2_sig = wrap_php_function('inner_findstate'); |
@@ -141,70 +141,70 @@ discard block |
||
141 | 141 | $obj = new xmlrpc_server_methods_container(); |
142 | 142 | $findstate4_sig = wrap_php_function(array($obj, 'findstate')); |
143 | 143 | |
144 | - $addtwo_sig=array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt)); |
|
145 | - $addtwo_doc='Add two integers together and return the result'; |
|
144 | + $addtwo_sig = array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt)); |
|
145 | + $addtwo_doc = 'Add two integers together and return the result'; |
|
146 | 146 | function addtwo($m) |
147 | 147 | { |
148 | - $s=$m->getParam(0); |
|
149 | - $t=$m->getParam(1); |
|
150 | - return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(),"int")); |
|
148 | + $s = $m->getParam(0); |
|
149 | + $t = $m->getParam(1); |
|
150 | + return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(), "int")); |
|
151 | 151 | } |
152 | 152 | |
153 | - $addtwodouble_sig=array(array($xmlrpcDouble, $xmlrpcDouble, $xmlrpcDouble)); |
|
154 | - $addtwodouble_doc='Add two doubles together and return the result'; |
|
153 | + $addtwodouble_sig = array(array($xmlrpcDouble, $xmlrpcDouble, $xmlrpcDouble)); |
|
154 | + $addtwodouble_doc = 'Add two doubles together and return the result'; |
|
155 | 155 | function addtwodouble($m) |
156 | 156 | { |
157 | - $s=$m->getParam(0); |
|
158 | - $t=$m->getParam(1); |
|
159 | - return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(),"double")); |
|
157 | + $s = $m->getParam(0); |
|
158 | + $t = $m->getParam(1); |
|
159 | + return new xmlrpcresp(new xmlrpcval($s->scalarval()+$t->scalarval(), "double")); |
|
160 | 160 | } |
161 | 161 | |
162 | - $stringecho_sig=array(array($xmlrpcString, $xmlrpcString)); |
|
163 | - $stringecho_doc='Accepts a string parameter, returns the string.'; |
|
162 | + $stringecho_sig = array(array($xmlrpcString, $xmlrpcString)); |
|
163 | + $stringecho_doc = 'Accepts a string parameter, returns the string.'; |
|
164 | 164 | function stringecho($m) |
165 | 165 | { |
166 | 166 | // just sends back a string |
167 | - $s=$m->getParam(0); |
|
167 | + $s = $m->getParam(0); |
|
168 | 168 | $v = $s->scalarval(); |
169 | 169 | return new xmlrpcresp(new xmlrpcval($s->scalarval())); |
170 | 170 | } |
171 | 171 | |
172 | - $echoback_sig=array(array($xmlrpcString, $xmlrpcString)); |
|
173 | - $echoback_doc='Accepts a string parameter, returns the entire incoming payload'; |
|
172 | + $echoback_sig = array(array($xmlrpcString, $xmlrpcString)); |
|
173 | + $echoback_doc = 'Accepts a string parameter, returns the entire incoming payload'; |
|
174 | 174 | function echoback($m) |
175 | 175 | { |
176 | 176 | // just sends back a string with what i got |
177 | 177 | // sent to me, just escaped, that's all |
178 | 178 | // |
179 | 179 | // $m is an incoming message |
180 | - $s="I got the following message:\n" . $m->serialize(); |
|
180 | + $s = "I got the following message:\n".$m->serialize(); |
|
181 | 181 | return new xmlrpcresp(new xmlrpcval($s)); |
182 | 182 | } |
183 | 183 | |
184 | - $echosixtyfour_sig=array(array($xmlrpcString, $xmlrpcBase64)); |
|
185 | - $echosixtyfour_doc='Accepts a base64 parameter and returns it decoded as a string'; |
|
184 | + $echosixtyfour_sig = array(array($xmlrpcString, $xmlrpcBase64)); |
|
185 | + $echosixtyfour_doc = 'Accepts a base64 parameter and returns it decoded as a string'; |
|
186 | 186 | function echosixtyfour($m) |
187 | 187 | { |
188 | 188 | // accepts an encoded value, but sends it back |
189 | 189 | // as a normal string. this is to test base64 encoding |
190 | 190 | // is working as expected |
191 | - $incoming=$m->getParam(0); |
|
191 | + $incoming = $m->getParam(0); |
|
192 | 192 | return new xmlrpcresp(new xmlrpcval($incoming->scalarval(), "string")); |
193 | 193 | } |
194 | 194 | |
195 | - $bitflipper_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
196 | - $bitflipper_doc='Accepts an array of booleans, and returns them inverted'; |
|
195 | + $bitflipper_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
196 | + $bitflipper_doc = 'Accepts an array of booleans, and returns them inverted'; |
|
197 | 197 | function bitflipper($m) |
198 | 198 | { |
199 | 199 | global $xmlrpcArray; |
200 | 200 | |
201 | - $v=$m->getParam(0); |
|
202 | - $sz=$v->arraysize(); |
|
203 | - $rv=new xmlrpcval(array(), $xmlrpcArray); |
|
201 | + $v = $m->getParam(0); |
|
202 | + $sz = $v->arraysize(); |
|
203 | + $rv = new xmlrpcval(array(), $xmlrpcArray); |
|
204 | 204 | |
205 | - for($j=0; $j<$sz; $j++) |
|
205 | + for ($j = 0; $j<$sz; $j++) |
|
206 | 206 | { |
207 | - $b=$v->arraymem($j); |
|
207 | + $b = $v->arraymem($j); |
|
208 | 208 | if ($b->scalarval()) |
209 | 209 | { |
210 | 210 | $rv->addScalar(false, "boolean"); |
@@ -235,18 +235,18 @@ discard block |
||
235 | 235 | |
236 | 236 | // don't even ask me _why_ these come padded with |
237 | 237 | // hyphens, I couldn't tell you :p |
238 | - $a=str_replace("-", "", $a); |
|
239 | - $b=str_replace("-", "", $b); |
|
238 | + $a = str_replace("-", "", $a); |
|
239 | + $b = str_replace("-", "", $b); |
|
240 | 240 | |
241 | - if ($agesorter_arr[$a]==$agesorter[$b]) |
|
241 | + if ($agesorter_arr[$a] == $agesorter[$b]) |
|
242 | 242 | { |
243 | 243 | return 0; |
244 | 244 | } |
245 | - return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1; |
|
245 | + return ($agesorter_arr[$a]>$agesorter_arr[$b]) ? -1 : 1; |
|
246 | 246 | } |
247 | 247 | |
248 | - $agesorter_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
249 | - $agesorter_doc='Send this method an array of [string, int] structs, eg: |
|
248 | + $agesorter_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
249 | + $agesorter_doc = 'Send this method an array of [string, int] structs, eg: |
|
250 | 250 | <pre> |
251 | 251 | Dave 35 |
252 | 252 | Edd 45 |
@@ -261,43 +261,43 @@ discard block |
||
261 | 261 | |
262 | 262 | xmlrpc_debugmsg("Entering 'agesorter'"); |
263 | 263 | // get the parameter |
264 | - $sno=$m->getParam(0); |
|
264 | + $sno = $m->getParam(0); |
|
265 | 265 | // error string for [if|when] things go wrong |
266 | - $err=""; |
|
266 | + $err = ""; |
|
267 | 267 | // create the output value |
268 | - $v=new xmlrpcval(); |
|
269 | - $agar=array(); |
|
268 | + $v = new xmlrpcval(); |
|
269 | + $agar = array(); |
|
270 | 270 | |
271 | - if (isset($sno) && $sno->kindOf()=="array") |
|
271 | + if (isset($sno) && $sno->kindOf() == "array") |
|
272 | 272 | { |
273 | - $max=$sno->arraysize(); |
|
273 | + $max = $sno->arraysize(); |
|
274 | 274 | // TODO: create debug method to print can work once more |
275 | 275 | // print "<!-- found $max array elements -->\n"; |
276 | - for($i=0; $i<$max; $i++) |
|
276 | + for ($i = 0; $i<$max; $i++) |
|
277 | 277 | { |
278 | - $rec=$sno->arraymem($i); |
|
279 | - if ($rec->kindOf()!="struct") |
|
278 | + $rec = $sno->arraymem($i); |
|
279 | + if ($rec->kindOf() != "struct") |
|
280 | 280 | { |
281 | - $err="Found non-struct in array at element $i"; |
|
281 | + $err = "Found non-struct in array at element $i"; |
|
282 | 282 | break; |
283 | 283 | } |
284 | 284 | // extract name and age from struct |
285 | - $n=$rec->structmem("name"); |
|
286 | - $a=$rec->structmem("age"); |
|
285 | + $n = $rec->structmem("name"); |
|
286 | + $a = $rec->structmem("age"); |
|
287 | 287 | // $n and $a are xmlrpcvals, |
288 | 288 | // so get the scalarval from them |
289 | - $agar[$n->scalarval()]=$a->scalarval(); |
|
289 | + $agar[$n->scalarval()] = $a->scalarval(); |
|
290 | 290 | } |
291 | 291 | |
292 | - $agesorter_arr=$agar; |
|
292 | + $agesorter_arr = $agar; |
|
293 | 293 | // hack, must make global as uksort() won't |
294 | 294 | // allow us to pass any other auxilliary information |
295 | 295 | uksort($agesorter_arr, agesorter_compare); |
296 | - $outAr=array(); |
|
297 | - while (list( $key, $val ) = each( $agesorter_arr ) ) |
|
296 | + $outAr = array(); |
|
297 | + while (list($key, $val) = each($agesorter_arr)) |
|
298 | 298 | { |
299 | 299 | // recreate each struct element |
300 | - $outAr[]=new xmlrpcval(array("name" => |
|
300 | + $outAr[] = new xmlrpcval(array("name" => |
|
301 | 301 | new xmlrpcval($key), |
302 | 302 | "age" => |
303 | 303 | new xmlrpcval($val, "int")), "struct"); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | else |
309 | 309 | { |
310 | - $err="Must be one parameter, an array of structs"; |
|
310 | + $err = "Must be one parameter, an array of structs"; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | if ($err) |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | |
323 | 323 | // signature and instructions, place these in the dispatch |
324 | 324 | // map |
325 | - $mail_send_sig=array(array( |
|
325 | + $mail_send_sig = array(array( |
|
326 | 326 | $xmlrpcBoolean, $xmlrpcString, $xmlrpcString, |
327 | 327 | $xmlrpcString, $xmlrpcString, $xmlrpcString, |
328 | 328 | $xmlrpcString, $xmlrpcString |
329 | 329 | )); |
330 | 330 | |
331 | - $mail_send_doc='mail.send(recipient, subject, text, sender, cc, bcc, mimetype)<br/> |
|
331 | + $mail_send_doc = 'mail.send(recipient, subject, text, sender, cc, bcc, mimetype)<br/> |
|
332 | 332 | recipient, cc, and bcc are strings, comma-separated lists of email addresses, as described above.<br/> |
333 | 333 | subject is a string, the subject of the message.<br/> |
334 | 334 | sender is a string, it\'s the email address of the person sending the message. This string can not be |
@@ -342,51 +342,51 @@ discard block |
||
342 | 342 | function mail_send($m) |
343 | 343 | { |
344 | 344 | global $xmlrpcerruser, $xmlrpcBoolean; |
345 | - $err=""; |
|
345 | + $err = ""; |
|
346 | 346 | |
347 | - $mTo=$m->getParam(0); |
|
348 | - $mSub=$m->getParam(1); |
|
349 | - $mBody=$m->getParam(2); |
|
350 | - $mFrom=$m->getParam(3); |
|
351 | - $mCc=$m->getParam(4); |
|
352 | - $mBcc=$m->getParam(5); |
|
353 | - $mMime=$m->getParam(6); |
|
347 | + $mTo = $m->getParam(0); |
|
348 | + $mSub = $m->getParam(1); |
|
349 | + $mBody = $m->getParam(2); |
|
350 | + $mFrom = $m->getParam(3); |
|
351 | + $mCc = $m->getParam(4); |
|
352 | + $mBcc = $m->getParam(5); |
|
353 | + $mMime = $m->getParam(6); |
|
354 | 354 | |
355 | - if ($mTo->scalarval()=="") |
|
355 | + if ($mTo->scalarval() == "") |
|
356 | 356 | { |
357 | - $err="Error, no 'To' field specified"; |
|
357 | + $err = "Error, no 'To' field specified"; |
|
358 | 358 | } |
359 | 359 | |
360 | - if ($mFrom->scalarval()=="") |
|
360 | + if ($mFrom->scalarval() == "") |
|
361 | 361 | { |
362 | - $err="Error, no 'From' field specified"; |
|
362 | + $err = "Error, no 'From' field specified"; |
|
363 | 363 | } |
364 | 364 | |
365 | - $msghdr="From: " . $mFrom->scalarval() . "\n"; |
|
366 | - $msghdr.="To: ". $mTo->scalarval() . "\n"; |
|
365 | + $msghdr = "From: ".$mFrom->scalarval()."\n"; |
|
366 | + $msghdr .= "To: ".$mTo->scalarval()."\n"; |
|
367 | 367 | |
368 | - if ($mCc->scalarval()!="") |
|
368 | + if ($mCc->scalarval() != "") |
|
369 | 369 | { |
370 | - $msghdr.="Cc: " . $mCc->scalarval(). "\n"; |
|
370 | + $msghdr .= "Cc: ".$mCc->scalarval()."\n"; |
|
371 | 371 | } |
372 | - if ($mBcc->scalarval()!="") |
|
372 | + if ($mBcc->scalarval() != "") |
|
373 | 373 | { |
374 | - $msghdr.="Bcc: " . $mBcc->scalarval(). "\n"; |
|
374 | + $msghdr .= "Bcc: ".$mBcc->scalarval()."\n"; |
|
375 | 375 | } |
376 | - if ($mMime->scalarval()!="") |
|
376 | + if ($mMime->scalarval() != "") |
|
377 | 377 | { |
378 | - $msghdr.="Content-type: " . $mMime->scalarval() . "\n"; |
|
378 | + $msghdr .= "Content-type: ".$mMime->scalarval()."\n"; |
|
379 | 379 | } |
380 | - $msghdr.="X-Mailer: XML-RPC for PHP mailer 1.0"; |
|
380 | + $msghdr .= "X-Mailer: XML-RPC for PHP mailer 1.0"; |
|
381 | 381 | |
382 | - if ($err=="") |
|
382 | + if ($err == "") |
|
383 | 383 | { |
384 | 384 | if (!mail("", |
385 | 385 | $mSub->scalarval(), |
386 | 386 | $mBody->scalarval(), |
387 | 387 | $msghdr)) |
388 | 388 | { |
389 | - $err="Error, could not send the mail."; |
|
389 | + $err = "Error, could not send the mail."; |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | - $getallheaders_sig=array(array($xmlrpcStruct)); |
|
404 | - $getallheaders_doc='Returns a struct containing all the HTTP headers received with the request. Provides limited functionality with IIS'; |
|
403 | + $getallheaders_sig = array(array($xmlrpcStruct)); |
|
404 | + $getallheaders_doc = 'Returns a struct containing all the HTTP headers received with the request. Provides limited functionality with IIS'; |
|
405 | 405 | function getallheaders_xmlrpc($m) |
406 | 406 | { |
407 | 407 | global $xmlrpcerruser; |
@@ -423,12 +423,12 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | - $setcookies_sig=array(array($xmlrpcInt, $xmlrpcStruct)); |
|
427 | - $setcookies_doc='Sends to client a response containing a single \'1\' digit, and sets to it http cookies as received in the request (array of structs describing a cookie)'; |
|
426 | + $setcookies_sig = array(array($xmlrpcInt, $xmlrpcStruct)); |
|
427 | + $setcookies_doc = 'Sends to client a response containing a single \'1\' digit, and sets to it http cookies as received in the request (array of structs describing a cookie)'; |
|
428 | 428 | function setcookies($m) |
429 | 429 | { |
430 | 430 | $m = $m->getParam(0); |
431 | - while(list($name,$value) = $m->structeach()) |
|
431 | + while (list($name, $value) = $m->structeach()) |
|
432 | 432 | { |
433 | 433 | $cookiedesc = php_xmlrpc_decode($value); |
434 | 434 | setcookie($name, @$cookiedesc['value'], @$cookiedesc['expires'], @$cookiedesc['path'], @$cookiedesc['domain'], @$cookiedesc['secure']); |
@@ -436,60 +436,60 @@ discard block |
||
436 | 436 | return new xmlrpcresp(new xmlrpcval(1, 'int')); |
437 | 437 | } |
438 | 438 | |
439 | - $getcookies_sig=array(array($xmlrpcStruct)); |
|
440 | - $getcookies_doc='Sends to client a response containing all http cookies as received in the request (as struct)'; |
|
439 | + $getcookies_sig = array(array($xmlrpcStruct)); |
|
440 | + $getcookies_doc = 'Sends to client a response containing all http cookies as received in the request (as struct)'; |
|
441 | 441 | function getcookies($m) |
442 | 442 | { |
443 | 443 | return new xmlrpcresp(php_xmlrpc_encode($_COOKIE)); |
444 | 444 | } |
445 | 445 | |
446 | - $v1_arrayOfStructs_sig=array(array($xmlrpcInt, $xmlrpcArray)); |
|
447 | - $v1_arrayOfStructs_doc='This handler takes a single parameter, an array of structs, each of which contains at least three elements named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and return the result.'; |
|
446 | + $v1_arrayOfStructs_sig = array(array($xmlrpcInt, $xmlrpcArray)); |
|
447 | + $v1_arrayOfStructs_doc = 'This handler takes a single parameter, an array of structs, each of which contains at least three elements named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and return the result.'; |
|
448 | 448 | function v1_arrayOfStructs($m) |
449 | 449 | { |
450 | - $sno=$m->getParam(0); |
|
451 | - $numcurly=0; |
|
452 | - for($i=0; $i<$sno->arraysize(); $i++) |
|
450 | + $sno = $m->getParam(0); |
|
451 | + $numcurly = 0; |
|
452 | + for ($i = 0; $i<$sno->arraysize(); $i++) |
|
453 | 453 | { |
454 | - $str=$sno->arraymem($i); |
|
454 | + $str = $sno->arraymem($i); |
|
455 | 455 | $str->structreset(); |
456 | - while(list($key,$val)=$str->structeach()) |
|
456 | + while (list($key, $val) = $str->structeach()) |
|
457 | 457 | { |
458 | - if ($key=="curly") |
|
458 | + if ($key == "curly") |
|
459 | 459 | { |
460 | - $numcurly+=$val->scalarval(); |
|
460 | + $numcurly += $val->scalarval(); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | } |
464 | 464 | return new xmlrpcresp(new xmlrpcval($numcurly, "int")); |
465 | 465 | } |
466 | 466 | |
467 | - $v1_easyStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct)); |
|
468 | - $v1_easyStruct_doc='This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.'; |
|
467 | + $v1_easyStruct_sig = array(array($xmlrpcInt, $xmlrpcStruct)); |
|
468 | + $v1_easyStruct_doc = 'This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.'; |
|
469 | 469 | function v1_easyStruct($m) |
470 | 470 | { |
471 | - $sno=$m->getParam(0); |
|
472 | - $moe=$sno->structmem("moe"); |
|
473 | - $larry=$sno->structmem("larry"); |
|
474 | - $curly=$sno->structmem("curly"); |
|
475 | - $num=$moe->scalarval() + $larry->scalarval() + $curly->scalarval(); |
|
471 | + $sno = $m->getParam(0); |
|
472 | + $moe = $sno->structmem("moe"); |
|
473 | + $larry = $sno->structmem("larry"); |
|
474 | + $curly = $sno->structmem("curly"); |
|
475 | + $num = $moe->scalarval()+$larry->scalarval()+$curly->scalarval(); |
|
476 | 476 | return new xmlrpcresp(new xmlrpcval($num, "int")); |
477 | 477 | } |
478 | 478 | |
479 | - $v1_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct)); |
|
480 | - $v1_echoStruct_doc='This handler takes a single parameter, a struct. Your handler must return the struct.'; |
|
479 | + $v1_echoStruct_sig = array(array($xmlrpcStruct, $xmlrpcStruct)); |
|
480 | + $v1_echoStruct_doc = 'This handler takes a single parameter, a struct. Your handler must return the struct.'; |
|
481 | 481 | function v1_echoStruct($m) |
482 | 482 | { |
483 | - $sno=$m->getParam(0); |
|
483 | + $sno = $m->getParam(0); |
|
484 | 484 | return new xmlrpcresp($sno); |
485 | 485 | } |
486 | 486 | |
487 | - $v1_manyTypes_sig=array(array( |
|
487 | + $v1_manyTypes_sig = array(array( |
|
488 | 488 | $xmlrpcArray, $xmlrpcInt, $xmlrpcBoolean, |
489 | 489 | $xmlrpcString, $xmlrpcDouble, $xmlrpcDateTime, |
490 | 490 | $xmlrpcBase64 |
491 | 491 | )); |
492 | - $v1_manyTypes_doc='This handler takes six parameters, and returns an array containing all the parameters.'; |
|
492 | + $v1_manyTypes_doc = 'This handler takes six parameters, and returns an array containing all the parameters.'; |
|
493 | 493 | function v1_manyTypes($m) |
494 | 494 | { |
495 | 495 | return new xmlrpcresp(new xmlrpcval(array( |
@@ -503,58 +503,58 @@ discard block |
||
503 | 503 | )); |
504 | 504 | } |
505 | 505 | |
506 | - $v1_moderateSizeArrayCheck_sig=array(array($xmlrpcString, $xmlrpcArray)); |
|
507 | - $v1_moderateSizeArrayCheck_doc='This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.'; |
|
506 | + $v1_moderateSizeArrayCheck_sig = array(array($xmlrpcString, $xmlrpcArray)); |
|
507 | + $v1_moderateSizeArrayCheck_doc = 'This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.'; |
|
508 | 508 | function v1_moderateSizeArrayCheck($m) |
509 | 509 | { |
510 | - $ar=$m->getParam(0); |
|
511 | - $sz=$ar->arraysize(); |
|
512 | - $first=$ar->arraymem(0); |
|
513 | - $last=$ar->arraymem($sz-1); |
|
514 | - return new xmlrpcresp(new xmlrpcval($first->scalarval() . |
|
510 | + $ar = $m->getParam(0); |
|
511 | + $sz = $ar->arraysize(); |
|
512 | + $first = $ar->arraymem(0); |
|
513 | + $last = $ar->arraymem($sz-1); |
|
514 | + return new xmlrpcresp(new xmlrpcval($first->scalarval(). |
|
515 | 515 | $last->scalarval(), "string")); |
516 | 516 | } |
517 | 517 | |
518 | - $v1_simpleStructReturn_sig=array(array($xmlrpcStruct, $xmlrpcInt)); |
|
519 | - $v1_simpleStructReturn_doc='This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.'; |
|
518 | + $v1_simpleStructReturn_sig = array(array($xmlrpcStruct, $xmlrpcInt)); |
|
519 | + $v1_simpleStructReturn_doc = 'This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.'; |
|
520 | 520 | function v1_simpleStructReturn($m) |
521 | 521 | { |
522 | - $sno=$m->getParam(0); |
|
523 | - $v=$sno->scalarval(); |
|
522 | + $sno = $m->getParam(0); |
|
523 | + $v = $sno->scalarval(); |
|
524 | 524 | return new xmlrpcresp(new xmlrpcval(array( |
525 | - "times10" => new xmlrpcval($v*10, "int"), |
|
526 | - "times100" => new xmlrpcval($v*100, "int"), |
|
527 | - "times1000" => new xmlrpcval($v*1000, "int")), |
|
525 | + "times10" => new xmlrpcval($v * 10, "int"), |
|
526 | + "times100" => new xmlrpcval($v * 100, "int"), |
|
527 | + "times1000" => new xmlrpcval($v * 1000, "int")), |
|
528 | 528 | "struct" |
529 | 529 | )); |
530 | 530 | } |
531 | 531 | |
532 | - $v1_nestedStruct_sig=array(array($xmlrpcInt, $xmlrpcStruct)); |
|
533 | - $v1_nestedStruct_doc='This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one struct for each year. Each year is broken down into months, and months into days. Most of the days are empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.'; |
|
532 | + $v1_nestedStruct_sig = array(array($xmlrpcInt, $xmlrpcStruct)); |
|
533 | + $v1_nestedStruct_doc = 'This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one struct for each year. Each year is broken down into months, and months into days. Most of the days are empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.'; |
|
534 | 534 | function v1_nestedStruct($m) |
535 | 535 | { |
536 | - $sno=$m->getParam(0); |
|
537 | - |
|
538 | - $twoK=$sno->structmem("2000"); |
|
539 | - $april=$twoK->structmem("04"); |
|
540 | - $fools=$april->structmem("01"); |
|
541 | - $curly=$fools->structmem("curly"); |
|
542 | - $larry=$fools->structmem("larry"); |
|
543 | - $moe=$fools->structmem("moe"); |
|
544 | - return new xmlrpcresp(new xmlrpcval($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), "int")); |
|
536 | + $sno = $m->getParam(0); |
|
537 | + |
|
538 | + $twoK = $sno->structmem("2000"); |
|
539 | + $april = $twoK->structmem("04"); |
|
540 | + $fools = $april->structmem("01"); |
|
541 | + $curly = $fools->structmem("curly"); |
|
542 | + $larry = $fools->structmem("larry"); |
|
543 | + $moe = $fools->structmem("moe"); |
|
544 | + return new xmlrpcresp(new xmlrpcval($curly->scalarval()+$larry->scalarval()+$moe->scalarval(), "int")); |
|
545 | 545 | } |
546 | 546 | |
547 | - $v1_countTheEntities_sig=array(array($xmlrpcStruct, $xmlrpcString)); |
|
548 | - $v1_countTheEntities_doc='This handler takes a single parameter, a string, that contains any number of predefined entities, namely <, >, & \' and ".<BR>Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.'; |
|
547 | + $v1_countTheEntities_sig = array(array($xmlrpcStruct, $xmlrpcString)); |
|
548 | + $v1_countTheEntities_doc = 'This handler takes a single parameter, a string, that contains any number of predefined entities, namely <, >, & \' and ".<BR>Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.'; |
|
549 | 549 | function v1_countTheEntities($m) |
550 | 550 | { |
551 | - $sno=$m->getParam(0); |
|
552 | - $str=$sno->scalarval(); |
|
553 | - $gt=0; $lt=0; $ap=0; $qu=0; $amp=0; |
|
554 | - for($i=0; $i<strlen($str); $i++) |
|
551 | + $sno = $m->getParam(0); |
|
552 | + $str = $sno->scalarval(); |
|
553 | + $gt = 0; $lt = 0; $ap = 0; $qu = 0; $amp = 0; |
|
554 | + for ($i = 0; $i<strlen($str); $i++) |
|
555 | 555 | { |
556 | - $c=substr($str, $i, 1); |
|
557 | - switch($c) |
|
556 | + $c = substr($str, $i, 1); |
|
557 | + switch ($c) |
|
558 | 558 | { |
559 | 559 | case ">": |
560 | 560 | $gt++; |
@@ -588,42 +588,42 @@ discard block |
||
588 | 588 | // trivial interop tests |
589 | 589 | // http://www.xmlrpc.com/stories/storyReader$1636 |
590 | 590 | |
591 | - $i_echoString_sig=array(array($xmlrpcString, $xmlrpcString)); |
|
592 | - $i_echoString_doc="Echoes string."; |
|
591 | + $i_echoString_sig = array(array($xmlrpcString, $xmlrpcString)); |
|
592 | + $i_echoString_doc = "Echoes string."; |
|
593 | 593 | |
594 | - $i_echoStringArray_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
595 | - $i_echoStringArray_doc="Echoes string array."; |
|
594 | + $i_echoStringArray_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
595 | + $i_echoStringArray_doc = "Echoes string array."; |
|
596 | 596 | |
597 | - $i_echoInteger_sig=array(array($xmlrpcInt, $xmlrpcInt)); |
|
598 | - $i_echoInteger_doc="Echoes integer."; |
|
597 | + $i_echoInteger_sig = array(array($xmlrpcInt, $xmlrpcInt)); |
|
598 | + $i_echoInteger_doc = "Echoes integer."; |
|
599 | 599 | |
600 | - $i_echoIntegerArray_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
601 | - $i_echoIntegerArray_doc="Echoes integer array."; |
|
600 | + $i_echoIntegerArray_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
601 | + $i_echoIntegerArray_doc = "Echoes integer array."; |
|
602 | 602 | |
603 | - $i_echoFloat_sig=array(array($xmlrpcDouble, $xmlrpcDouble)); |
|
604 | - $i_echoFloat_doc="Echoes float."; |
|
603 | + $i_echoFloat_sig = array(array($xmlrpcDouble, $xmlrpcDouble)); |
|
604 | + $i_echoFloat_doc = "Echoes float."; |
|
605 | 605 | |
606 | - $i_echoFloatArray_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
607 | - $i_echoFloatArray_doc="Echoes float array."; |
|
606 | + $i_echoFloatArray_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
607 | + $i_echoFloatArray_doc = "Echoes float array."; |
|
608 | 608 | |
609 | - $i_echoStruct_sig=array(array($xmlrpcStruct, $xmlrpcStruct)); |
|
610 | - $i_echoStruct_doc="Echoes struct."; |
|
609 | + $i_echoStruct_sig = array(array($xmlrpcStruct, $xmlrpcStruct)); |
|
610 | + $i_echoStruct_doc = "Echoes struct."; |
|
611 | 611 | |
612 | - $i_echoStructArray_sig=array(array($xmlrpcArray, $xmlrpcArray)); |
|
613 | - $i_echoStructArray_doc="Echoes struct array."; |
|
612 | + $i_echoStructArray_sig = array(array($xmlrpcArray, $xmlrpcArray)); |
|
613 | + $i_echoStructArray_doc = "Echoes struct array."; |
|
614 | 614 | |
615 | - $i_echoValue_doc="Echoes any value back."; |
|
616 | - $i_echoValue_sig=array(array($xmlrpcValue, $xmlrpcValue)); |
|
615 | + $i_echoValue_doc = "Echoes any value back."; |
|
616 | + $i_echoValue_sig = array(array($xmlrpcValue, $xmlrpcValue)); |
|
617 | 617 | |
618 | - $i_echoBase64_sig=array(array($xmlrpcBase64, $xmlrpcBase64)); |
|
619 | - $i_echoBase64_doc="Echoes base64."; |
|
618 | + $i_echoBase64_sig = array(array($xmlrpcBase64, $xmlrpcBase64)); |
|
619 | + $i_echoBase64_doc = "Echoes base64."; |
|
620 | 620 | |
621 | - $i_echoDate_sig=array(array($xmlrpcDateTime, $xmlrpcDateTime)); |
|
622 | - $i_echoDate_doc="Echoes dateTime."; |
|
621 | + $i_echoDate_sig = array(array($xmlrpcDateTime, $xmlrpcDateTime)); |
|
622 | + $i_echoDate_doc = "Echoes dateTime."; |
|
623 | 623 | |
624 | 624 | function i_echoParam($m) |
625 | 625 | { |
626 | - $s=$m->getParam(0); |
|
626 | + $s = $m->getParam(0); |
|
627 | 627 | return new xmlrpcresp($s); |
628 | 628 | } |
629 | 629 | |
@@ -639,23 +639,23 @@ discard block |
||
639 | 639 | function i_echoBase64($m) { return i_echoParam($m); } |
640 | 640 | function i_echoDate($m) { return i_echoParam($m); } |
641 | 641 | |
642 | - $i_whichToolkit_sig=array(array($xmlrpcStruct)); |
|
643 | - $i_whichToolkit_doc="Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem."; |
|
642 | + $i_whichToolkit_sig = array(array($xmlrpcStruct)); |
|
643 | + $i_whichToolkit_doc = "Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem."; |
|
644 | 644 | |
645 | 645 | function i_whichToolkit($m) |
646 | 646 | { |
647 | - global $xmlrpcName, $xmlrpcVersion,$SERVER_SOFTWARE; |
|
648 | - $ret=array( |
|
647 | + global $xmlrpcName, $xmlrpcVersion, $SERVER_SOFTWARE; |
|
648 | + $ret = array( |
|
649 | 649 | "toolkitDocsUrl" => "http://phpxmlrpc.sourceforge.net/", |
650 | 650 | "toolkitName" => $xmlrpcName, |
651 | 651 | "toolkitVersion" => $xmlrpcVersion, |
652 | 652 | "toolkitOperatingSystem" => isset ($SERVER_SOFTWARE) ? $SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE'] |
653 | 653 | ); |
654 | - return new xmlrpcresp ( php_xmlrpc_encode($ret)); |
|
654 | + return new xmlrpcresp(php_xmlrpc_encode($ret)); |
|
655 | 655 | } |
656 | 656 | |
657 | - $o=new xmlrpc_server_methods_container; |
|
658 | - $a=array( |
|
657 | + $o = new xmlrpc_server_methods_container; |
|
658 | + $a = array( |
|
659 | 659 | "examples.getStateName" => array( |
660 | 660 | "function" => "findstate", |
661 | 661 | "signature" => $findstate_sig, |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | if ($findstate5_sig) |
838 | 838 | $a['examples.php4.getStateName'] = $findstate5_sig; |
839 | 839 | |
840 | - $s=new xmlrpc_server($a, false); |
|
840 | + $s = new xmlrpc_server($a, false); |
|
841 | 841 | $s->setdebug(3); |
842 | 842 | $s->compress_response = true; |
843 | 843 |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | print "<h3>Testing value serialization</h3>\n"; |
10 | 10 | |
11 | 11 | $v = new xmlrpcval(23, "int"); |
12 | - print "<PRE>" . htmlentities($v->serialize()) . "</PRE>"; |
|
12 | + print "<PRE>".htmlentities($v->serialize())."</PRE>"; |
|
13 | 13 | $v = new xmlrpcval("What are you saying? >> << &&"); |
14 | - print "<PRE>" . htmlentities($v->serialize()) . "</PRE>"; |
|
14 | + print "<PRE>".htmlentities($v->serialize())."</PRE>"; |
|
15 | 15 | |
16 | 16 | $v = new xmlrpcval(array( |
17 | 17 | new xmlrpcval("ABCDEFHIJ"), |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | "array" |
21 | 21 | ); |
22 | 22 | |
23 | - print "<PRE>" . htmlentities($v->serialize()) . "</PRE>"; |
|
23 | + print "<PRE>".htmlentities($v->serialize())."</PRE>"; |
|
24 | 24 | |
25 | 25 | $v = new xmlrpcval( |
26 | 26 | array( |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | "struct" |
49 | 49 | ); |
50 | 50 | |
51 | - print "<PRE>" . htmlentities($v->serialize()) . "</PRE>"; |
|
51 | + print "<PRE>".htmlentities($v->serialize())."</PRE>"; |
|
52 | 52 | |
53 | 53 | $w = new xmlrpcval(array($v, new xmlrpcval("That was the struct!")), "array"); |
54 | 54 | |
55 | - print "<PRE>" . htmlentities($w->serialize()) . "</PRE>"; |
|
55 | + print "<PRE>".htmlentities($w->serialize())."</PRE>"; |
|
56 | 56 | |
57 | 57 | $w = new xmlrpcval("Mary had a little lamb, |
58 | 58 | Whose fleece was white as snow, |
@@ -64,26 +64,26 @@ discard block |
||
64 | 64 | Ten thousand volts went down its back |
65 | 65 | And turned it into nylon", "base64" |
66 | 66 | ); |
67 | - print "<PRE>" . htmlentities($w->serialize()) . "</PRE>"; |
|
68 | - print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>"; |
|
67 | + print "<PRE>".htmlentities($w->serialize())."</PRE>"; |
|
68 | + print "<PRE>Value of base64 string is: '".$w->scalarval()."'</PRE>"; |
|
69 | 69 | |
70 | 70 | $f->method(''); |
71 | 71 | $f->addParam(new xmlrpcval("41", "int")); |
72 | 72 | |
73 | 73 | print "<h3>Testing request serialization</h3>\n"; |
74 | 74 | $op = $f->serialize(); |
75 | - print "<PRE>" . htmlentities($op) . "</PRE>"; |
|
75 | + print "<PRE>".htmlentities($op)."</PRE>"; |
|
76 | 76 | |
77 | 77 | print "<h3>Testing ISO date format</h3><pre>\n"; |
78 | 78 | |
79 | 79 | $t = time(); |
80 | 80 | $date = iso8601_encode($t); |
81 | 81 | print "Now is $t --> $date\n"; |
82 | - print "Or in UTC, that is " . iso8601_encode($t, 1) . "\n"; |
|
82 | + print "Or in UTC, that is ".iso8601_encode($t, 1)."\n"; |
|
83 | 83 | $tb = iso8601_decode($date); |
84 | 84 | print "That is to say $date --> $tb\n"; |
85 | - print "Which comes out at " . iso8601_encode($tb) . "\n"; |
|
86 | - print "Which was the time in UTC at " . iso8601_decode($date, 1) . "\n"; |
|
85 | + print "Which comes out at ".iso8601_encode($tb)."\n"; |
|
86 | + print "Which was the time in UTC at ".iso8601_decode($date, 1)."\n"; |
|
87 | 87 | |
88 | 88 | print "</pre>\n"; |
89 | 89 | ?> |