Completed
Push — php51 ( 617621...a4e868 )
by Gaetano
16:05 queued 06:04
created
demo/client/simple_call.php 2 patches
Doc Comments   -3 removed lines patch added patch discarded remove patch
@@ -24,9 +24,6 @@
 block discarded – undo
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()
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
 		{
36 36
 			// Incorrect
37 37
 			return false;
38
-		}
39
-		else
38
+		} else
40 39
 		{
41 40
 			$varargs = func_get_args();
42 41
 			$client = array_shift($varargs);
Please login to merge, or discard this patch.
lib/xmlrpc_wrappers.inc 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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',
Please login to merge, or discard this patch.
Braces   +46 added lines, -80 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@  discard block
 block discarded – undo
52 52
 				if(class_exists($phptype))
53 53
 				{
54 54
 					return $GLOBALS['xmlrpcStruct'];
55
-				}
56
-				else
55
+				} else
57 56
 				{
58 57
 					// unknown: might be any 'extended' xmlrpc type
59 58
 					return $GLOBALS['xmlrpcValue'];
@@ -163,14 +162,12 @@  discard block
 block discarded – undo
163 162
 			if(is_string($funcname[0]))
164 163
 			{
165 164
 				$plainfuncname = implode('::', $funcname);
166
-			}
167
-			elseif(is_object($funcname[0]))
165
+			} elseif(is_object($funcname[0]))
168 166
 			{
169 167
 				$plainfuncname = get_class($funcname[0]) . '->' . $funcname[1];
170 168
 			}
171 169
 			$exists = method_exists($funcname[0], $funcname[1]);
172
-		}
173
-		else
170
+		} else
174 171
 		{
175 172
 			$plainfuncname = $funcname;
176 173
 			$exists = function_exists($funcname);
@@ -180,25 +177,23 @@  discard block
 block discarded – undo
180 177
 		{
181 178
 			error_log('XML-RPC: function to be wrapped is not defined: '.$plainfuncname);
182 179
 			return false;
183
-		}
184
-		else
180
+		} else
185 181
 		{
186 182
 			// determine name of new php function
187 183
 			if($newfuncname == '')
188 184
 			{
189 185
 				if(is_array($funcname))
190 186
 				{
191
-					if(is_string($funcname[0]))
192
-						$xmlrpcfuncname = "{$prefix}_".implode('_', $funcname);
193
-					else
194
-						$xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1];
195
-				}
196
-				else
187
+					if(is_string($funcname[0])) {
188
+											$xmlrpcfuncname = "{$prefix}_".implode('_', $funcname);
189
+					} else {
190
+											$xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1];
191
+					}
192
+				} else
197 193
 				{
198 194
 					$xmlrpcfuncname = "{$prefix}_$funcname";
199 195
 				}
200
-			}
201
-			else
196
+			} else
202 197
 			{
203 198
 				$xmlrpcfuncname = $newfuncname;
204 199
 			}
@@ -237,8 +232,7 @@  discard block
 block discarded – undo
237 232
 					return false;
238 233
 				}
239 234
 				/// @todo add more checks for static vs. nonstatic?
240
-			}
241
-			else
235
+			} else
242 236
 			{
243 237
 				$func = new ReflectionFunction($funcname);
244 238
 			}
@@ -276,8 +270,7 @@  discard block
 block discarded – undo
276 270
 							$desc .= "\n";
277 271
 						}
278 272
 						$desc .= $doc;
279
-					}
280
-					elseif(strpos($doc, '@param') === 0)
273
+					} elseif(strpos($doc, '@param') === 0)
281 274
 					{
282 275
 						// syntax: @param type [$name] desc
283 276
 						if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches))
@@ -286,8 +279,7 @@  discard block
 block discarded – undo
286 279
 							{
287 280
 								//$paramDocs[$i]['type'] = explode('|', $matches[1]);
288 281
 								$paramDocs[$i]['type'] = 'mixed';
289
-							}
290
-							else
282
+							} else
291 283
 							{
292 284
 								$paramDocs[$i]['type'] = $matches[1];
293 285
 							}
@@ -295,8 +287,7 @@  discard block
 block discarded – undo
295 287
 							$paramDocs[$i]['doc'] = $matches[3];
296 288
 						}
297 289
 						$i++;
298
-					}
299
-					elseif(strpos($doc, '@return') === 0)
290
+					} elseif(strpos($doc, '@return') === 0)
300 291
 					{
301 292
 						// syntax: @return type desc
302 293
 						//$returns = preg_split('/\s+/', $doc);
@@ -348,8 +339,7 @@  discard block
 block discarded – undo
348 339
 				if ($decode_php_objects)
349 340
 				{
350 341
 					$innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i, array('decode_php_objs'));\n";
351
-				}
352
-				else
342
+				} else
353 343
 				{
354 344
 					$innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i);\n";
355 345
 				}
@@ -374,8 +364,7 @@  discard block
 block discarded – undo
374 364
 				// only known good synopsis = no parameters
375 365
 				$parsvariations[] = array();
376 366
 				$minpars = 0;
377
-			}
378
-			else
367
+			} else
379 368
 			{
380 369
 				$minpars = count($parsvariations[0]);
381 370
 			}
@@ -386,8 +375,7 @@  discard block
 block discarded – undo
386 375
 				// NB: this check needs to be done BEFORE decoding param values
387 376
 				$innercode = "\$paramcount = \$msg->getNumParams();\n" .
388 377
 				"if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode;
389
-			}
390
-			else
378
+			} else
391 379
 			{
392 380
 				$innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode;
393 381
 			}
@@ -400,8 +388,7 @@  discard block
 block discarded – undo
400 388
 				$GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] =& $funcname[0];
401 389
 				$innercode .= "\$obj =& \$GLOBALS['xmlrpcWPFObjHolder']['$xmlrpcfuncname'];\n";
402 390
 				$realfuncname = '$obj->'.$funcname[1];
403
-			}
404
-			else
391
+			} else
405 392
 			{
406 393
 				$realfuncname = $plainfuncname;
407 394
 			}
@@ -416,8 +403,7 @@  discard block
 block discarded – undo
416 403
 					if (isset($paramDocs[$i]['type']))
417 404
 					{
418 405
 						$sig[] = php_2_xmlrpc_type($paramDocs[$i]['type']);
419
-					}
420
-					else
406
+					} else
421 407
 					{
422 408
 						$sig[] = $GLOBALS['xmlrpcValue'];
423 409
 					}
@@ -433,13 +419,13 @@  discard block
 block discarded – undo
433 419
 			if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64'])
434 420
 			{
435 421
 				$innercode .= "return new {$prefix}resp(new {$prefix}val(\$retval, '$returns'));";
436
-			}
437
-			else
422
+			} else
438 423
 			{
439
-				if ($encode_php_objects)
440
-					$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n";
441
-				else
442
-					$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval));\n";
424
+				if ($encode_php_objects) {
425
+									$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n";
426
+				} else {
427
+									$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval));\n";
428
+				}
443 429
 			}
444 430
 			// shall we exclude functions returning by ref?
445 431
 			// if($func->returnsReference())
@@ -556,8 +542,7 @@  discard block
 block discarded – undo
556 542
 		{
557 543
 			$signum = $extra_options;
558 544
 			$extra_options = array();
559
-		}
560
-		else
545
+		} else
561 546
 		{
562 547
 			$signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0;
563 548
 			$timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0;
@@ -578,8 +563,7 @@  discard block
 block discarded – undo
578 563
 		{
579 564
 			$decode_fault = true;
580 565
 			$fault_response = $extra_options['return_on_fault'];
581
-		}
582
-		else
566
+		} else
583 567
 		{
584 568
 			$decode_fault = false;
585 569
 			$fault_response = '';
@@ -598,8 +582,7 @@  discard block
 block discarded – undo
598 582
 		{
599 583
 			error_log('XML-RPC: could not retrieve method signature from remote server for method '.$methodname);
600 584
 			return false;
601
-		}
602
-		else
585
+		} else
603 586
 		{
604 587
 			$msig = $response->value();
605 588
 			if ($client->return_type != 'phpvals')
@@ -610,15 +593,13 @@  discard block
 block discarded – undo
610 593
 			{
611 594
 				error_log('XML-RPC: could not retrieve method signature nr.'.$signum.' from remote server for method '.$methodname);
612 595
 				return false;
613
-			}
614
-			else
596
+			} else
615 597
 			{
616 598
 				// pick a suitable name for the new function, avoiding collisions
617 599
 				if($newfuncname != '')
618 600
 				{
619 601
 					$xmlrpcfuncname = $newfuncname;
620
-				}
621
-				else
602
+				} else
622 603
 				{
623 604
 					// take care to insure that methodname is translated to valid
624 605
 					// php function name
@@ -664,14 +645,12 @@  discard block
 block discarded – undo
664 645
 					if($allOK)
665 646
 					{
666 647
 						return $xmlrpcfuncname;
667
-					}
668
-					else
648
+					} else
669 649
 					{
670 650
 						error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap remote method '.$methodname);
671 651
 						return false;
672 652
 					}
673
-				}
674
-				else
653
+				} else
675 654
 				{
676 655
 					$results['function'] = $xmlrpcfuncname;
677 656
 					return $results;
@@ -711,8 +690,7 @@  discard block
 block discarded – undo
711 690
 		{
712 691
 			error_log('XML-RPC: could not retrieve method list from remote server');
713 692
 			return false;
714
-		}
715
-		else
693
+		} else
716 694
 		{
717 695
 			$mlist = $response->value();
718 696
 			if ($client->return_type != 'phpvals')
@@ -723,15 +701,13 @@  discard block
 block discarded – undo
723 701
 			{
724 702
 				error_log('XML-RPC: could not retrieve meaningful method list from remote server');
725 703
 				return false;
726
-			}
727
-			else
704
+			} else
728 705
 			{
729 706
 				// pick a suitable name for the new function, avoiding collisions
730 707
 				if($newclassname != '')
731 708
 				{
732 709
 					$xmlrpcclassname = $newclassname;
733
-				}
734
-				else
710
+				} else
735 711
 				{
736 712
 					$xmlrpcclassname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
737 713
 						array('_', ''), $client->server).'_client';
@@ -766,8 +742,7 @@  discard block
 block discarded – undo
766 742
 								$source .= $methodwrap['docstring'];
767 743
 							}
768 744
 							$source .= $methodwrap['source']."\n";
769
-						}
770
-						else
745
+						} else
771 746
 						{
772 747
 							error_log('XML-RPC: will not create class method to wrap remote method '.$mname);
773 748
 						}
@@ -783,14 +758,12 @@  discard block
 block discarded – undo
783 758
 					if($allOK)
784 759
 					{
785 760
 						return $xmlrpcclassname;
786
-					}
787
-					else
761
+					} else
788 762
 					{
789 763
 						error_log('XML-RPC: could not create class '.$xmlrpcclassname.' to wrap remote server '.$client->server);
790 764
 						return false;
791 765
 					}
792
-				}
793
-				else
766
+				} else
794 767
 				{
795 768
 					return array('class' => $xmlrpcclassname, 'code' => $source, 'docstring' => '');
796 769
 				}
@@ -818,8 +791,7 @@  discard block
 block discarded – undo
818 791
 			$innercode = build_client_wrapper_code($client, $client_copy_mode, $prefix);
819 792
 			$innercode .= "\$client->setDebug(\$debug);\n";
820 793
 			$this_ = '';
821
-		}
822
-		else
794
+		} else
823 795
 		{
824 796
 			// client copy mode 2 == no client copy in emitted code
825 797
 			$innercode = '';
@@ -831,8 +803,7 @@  discard block
 block discarded – undo
831 803
 		{
832 804
 			// take care that PHP comment is not terminated unwillingly by method description
833 805
 			$mdesc = "/**\n* ".str_replace('*/', '* /', $mdesc)."\n";
834
-		}
835
-		else
806
+		} else
836 807
 		{
837 808
 			$mdesc = "/**\nFunction $xmlrpcfuncname\n";
838 809
 		}
@@ -849,14 +820,12 @@  discard block
 block discarded – undo
849 820
 			{
850 821
 				// only build directly xmlrpcvals when type is known and scalar
851 822
 				$innercode .= "\$p$i = new {$prefix}val(\$p$i, '$ptype');\n";
852
-			}
853
-			else
823
+			} else
854 824
 			{
855 825
 				if ($encode_php_objects)
856 826
 				{
857 827
 					$innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i, array('encode_php_objs'));\n";
858
-				}
859
-				else
828
+				} else
860 829
 				{
861 830
 					$innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i);\n";
862 831
 				}
@@ -878,21 +847,18 @@  discard block
 block discarded – undo
878 847
 			if (is_string($fault_response) && ((strpos($fault_response, '%faultCode%') !== false) || (strpos($fault_response, '%faultString%') !== false)))
879 848
 			{
880 849
 				$respcode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $fault_response)."')";
881
-			}
882
-			else
850
+			} else
883 851
 			{
884 852
 				$respcode = var_export($fault_response, true);
885 853
 			}
886
-		}
887
-		else
854
+		} else
888 855
 		{
889 856
 			$respcode = '$res';
890 857
 		}
891 858
 		if ($decode_php_objects)
892 859
 		{
893 860
 			$innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value(), array('decode_php_objs'));";
894
-		}
895
-		else
861
+		} else
896 862
 		{
897 863
 			$innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value());";
898 864
 		}
Please login to merge, or discard this patch.
debugger/common.php 1 patch
Braces   +40 added lines, -31 removed lines patch added patch discarded remove patch
@@ -42,15 +42,17 @@  discard block
 block discarded – undo
42 42
     if (isset($_GET['wstype']) && $_GET['wstype'] == '1')
43 43
     {
44 44
       $wstype = 1;
45
-      if (isset($_GET['id']))
46
-        $id = $_GET['id'];
45
+      if (isset($_GET['id'])) {
46
+              $id = $_GET['id'];
47
+      }
47 48
     }
48 49
     $host = isset($_GET['host']) ? $_GET['host'] : 'localhost'; // using '' will trigger an xmlrpc error...
49
-    if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2'))
50
-      $protocol = $_GET['protocol'];
51
-    if (strpos($host, 'http://') === 0)
52
-      $host = substr($host, 7);
53
-    else if (strpos($host, 'https://') === 0)
50
+    if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2')) {
51
+          $protocol = $_GET['protocol'];
52
+    }
53
+    if (strpos($host, 'http://') === 0) {
54
+          $host = substr($host, 7);
55
+    } else if (strpos($host, 'https://') === 0)
54 56
     {
55 57
       $host = substr($host, 8);
56 58
       $protocol = 2;
@@ -58,26 +60,31 @@  discard block
 block discarded – undo
58 60
     $port = isset($_GET['port']) ? $_GET['port'] : '';
59 61
     $path = isset($_GET['path']) ? $_GET['path'] : '';
60 62
     // in case user forgot initial '/' in xmlrpc server path, add it back
61
-    if ($path && ($path[0]) != '/')
62
-      $path = '/'.$path;
63
+    if ($path && ($path[0]) != '/') {
64
+          $path = '/'.$path;
65
+    }
63 66
 
64
-    if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] == '2'))
65
-      $debug = $_GET['debug'];
67
+    if (isset($_GET['debug']) && ($_GET['debug'] == '1' || $_GET['debug'] == '2')) {
68
+          $debug = $_GET['debug'];
69
+    }
66 70
 
67 71
     $verifyhost = (isset($_GET['verifyhost']) && ($_GET['verifyhost'] == '1' || $_GET['verifyhost'] == '2')) ? $_GET['verifyhost'] : 0;
68
-    if (isset($_GET['verifypeer']) && $_GET['verifypeer'] == '1')
69
-      $verifypeer = true;
70
-    else
71
-      $verifypeer = false;
72
+    if (isset($_GET['verifypeer']) && $_GET['verifypeer'] == '1') {
73
+          $verifypeer = true;
74
+    } else {
75
+          $verifypeer = false;
76
+    }
72 77
     $cainfo= isset($_GET['cainfo']) ? $_GET['cainfo'] : '';
73 78
     $proxy = isset($_GET['proxy']) ? $_GET['proxy'] : 0;
74
-    if (strpos($proxy, 'http://') === 0)
75
-      $proxy = substr($proxy, 7);
79
+    if (strpos($proxy, 'http://') === 0) {
80
+          $proxy = substr($proxy, 7);
81
+    }
76 82
     $proxyuser= isset($_GET['proxyuser']) ? $_GET['proxyuser'] : '';
77 83
     $proxypwd = isset($_GET['proxypwd']) ? $_GET['proxypwd'] : '';
78 84
     $timeout = isset($_GET['timeout']) ? $_GET['timeout'] : 0;
79
-    if (!is_numeric($timeout))
80
-      $timeout = 0;
85
+    if (!is_numeric($timeout)) {
86
+          $timeout = 0;
87
+    }
81 88
     $action = $_GET['action'];
82 89
 
83 90
     $method = isset($_GET['method']) ? $_GET['method'] : '';
@@ -85,26 +92,28 @@  discard block
 block discarded – undo
85 92
     $payload = isset($_GET['methodpayload']) ? $_GET['methodpayload'] : '';
86 93
     $alt_payload = isset($_GET['altmethodpayload']) ? $_GET['altmethodpayload'] : '';
87 94
 
88
-    if (isset($_GET['run']) && $_GET['run'] == 'now')
89
-      $run = true;
95
+    if (isset($_GET['run']) && $_GET['run'] == 'now') {
96
+          $run = true;
97
+    }
90 98
 
91 99
     $username = isset($_GET['username']) ? $_GET['username'] : '';
92 100
     $password = isset($_GET['password']) ? $_GET['password'] : '';
93 101
 
94 102
     $authtype = (isset($_GET['authtype']) && ($_GET['authtype'] == '2' || $_GET['authtype'] == '8')) ? $_GET['authtype'] : 1;
95 103
 
96
-    if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] == '1' || $_GET['requestcompression'] == '2'))
97
-      $requestcompression = $_GET['requestcompression'];
98
-    else
99
-      $requestcompression = 0;
100
-    if (isset($_GET['responsecompression']) && ($_GET['responsecompression'] == '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression'] == '3'))
101
-      $responsecompression = $_GET['responsecompression'];
102
-    else
103
-      $responsecompression = 0;
104
+    if (isset($_GET['requestcompression']) && ($_GET['requestcompression'] == '1' || $_GET['requestcompression'] == '2')) {
105
+          $requestcompression = $_GET['requestcompression'];
106
+    } else {
107
+          $requestcompression = 0;
108
+    }
109
+    if (isset($_GET['responsecompression']) && ($_GET['responsecompression'] == '1' || $_GET['responsecompression'] == '2' || $_GET['responsecompression'] == '3')) {
110
+          $responsecompression = $_GET['responsecompression'];
111
+    } else {
112
+          $responsecompression = 0;
113
+    }
104 114
 
105 115
     $clientcookies = isset($_GET['clientcookies']) ? $_GET['clientcookies'] : '';
106
-  }
107
-  else
116
+  } else
108 117
   {
109 118
     $host = '';
110 119
     $port = '';
Please login to merge, or discard this patch.
debugger/action.php 1 patch
Braces   +62 added lines, -53 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
41 41
   {
42 42
 
43 43
     // make sure the script waits long enough for the call to complete...
44
-    if ($timeout)
45
-      set_time_limit($timeout+10);
44
+    if ($timeout) {
45
+          set_time_limit($timeout+10);
46
+    }
46 47
 
47 48
     include('xmlrpc.inc');
48 49
     if ($wstype == 1)
@@ -55,8 +56,7 @@  discard block
 block discarded – undo
55 56
       $clientclass = 'jsonrpc_client';
56 57
       $msgclass = 'jsonrpcmsg';
57 58
       $protoname = 'JSONRPC';
58
-    }
59
-    else
59
+    } else
60 60
     {
61 61
       $clientclass = 'xmlrpc_client';
62 62
       $msgclass = 'xmlrpcmsg';
@@ -74,17 +74,17 @@  discard block
 block discarded – undo
74 74
     if ($protocol == 2)
75 75
     {
76 76
       $server = 'https://'.$server;
77
-    }
78
-    else
77
+    } else
79 78
     {
80 79
       $server = 'http://'.$server;
81 80
     }
82 81
     if ($proxy != '') {
83 82
       $pproxy = explode(':', $proxy);
84
-      if (count($pproxy) > 1)
85
-        $pport = $pproxy[1];
86
-      else
87
-        $pport = 8080;
83
+      if (count($pproxy) > 1) {
84
+              $pport = $pproxy[1];
85
+      } else {
86
+              $pport = 8080;
87
+      }
88 88
       $client->setProxy($pproxy[0], $pport, $proxyuser, $proxypwd);
89 89
     }
90 90
 
@@ -97,14 +97,15 @@  discard block
 block discarded – undo
97 97
         $client->setCaCertificate($cainfo);
98 98
       }
99 99
       $httpprotocol = 'https';
100
+    } else if ($protocol == 1) {
101
+          $httpprotocol = 'http11';
102
+    } else {
103
+          $httpprotocol = 'http';
100 104
     }
101
-    else if ($protocol == 1)
102
-      $httpprotocol = 'http11';
103
-    else
104
-      $httpprotocol = 'http';
105 105
 
106
-    if ($username)
107
-      $client->setCredentials($username, $password, $authtype);
106
+    if ($username) {
107
+          $client->setCredentials($username, $password, $authtype);
108
+    }
108 109
 
109 110
     $client->setDebug($debug);
110 111
 
@@ -168,8 +169,9 @@  discard block
 block discarded – undo
168 169
         $actionname = 'List of available methods';
169 170
         break;
170 171
       case 'execute':
171
-        if (!payload_is_safe($payload))
172
-          die("Tsk tsk tsk, please stop it or I will have to call in the cops!");
172
+        if (!payload_is_safe($payload)) {
173
+                  die("Tsk tsk tsk, please stop it or I will have to call in the cops!");
174
+        }
173 175
         $msg[0] = new $msgclass($method, null, $id);
174 176
         // hack! build xml payload by hand
175 177
         if ($wstype == 1)
@@ -182,24 +184,22 @@  discard block
 block discarded – undo
182 184
             if ($id == "")
183 185
             {
184 186
                 $msg[0]->payload .= "null\n}";
185
-            }
186
-            else
187
+            } else
187 188
             {
188 189
               if (is_numeric($id) || $id == 'false' || $id == 'true' || $id == 'null')
189 190
               {
190 191
                 $msg[0]->payload .= "$id\n}";
191
-              }
192
-              else
192
+              } else
193 193
               {
194 194
                 $msg[0]->payload .= "\"$id\"\n}";
195 195
               }
196 196
             }
197
-        }
198
-        else
199
-          $msg[0]->payload = $msg[0]->xml_header($inputcharset) .
197
+        } else {
198
+                  $msg[0]->payload = $msg[0]->xml_header($inputcharset) .
200 199
             '<methodName>' . $method . "</methodName>\n<params>" .
201 200
             $payload .
202 201
             "</params>\n" . $msg[0]->xml_footer();
202
+        }
203 203
         $actionname = 'Execution of method '.$method;
204 204
         break;
205 205
       default: // give a warning
@@ -213,8 +213,10 @@  discard block
 block discarded – undo
213 213
 
214 214
     $response = null;
215 215
     // execute method(s)
216
-    if ($debug)
217
-      echo '<div class="dbginfo"><h2>Debug info:</h2>';  /// @todo use ob_start instead
216
+    if ($debug) {
217
+          echo '<div class="dbginfo"><h2>Debug info:</h2>';
218
+    }
219
+    /// @todo use ob_start instead
218 220
     $resp = array();
219 221
     $mtime = explode(' ',microtime());
220 222
     $time = (float)$mtime[0] + (float)$mtime[1];
@@ -223,13 +225,15 @@  discard block
 block discarded – undo
223 225
       // catch errors: for older xmlrpc libs, send does not return by ref
224 226
       @$response =& $client->send($message, $timeout, $httpprotocol);
225 227
       $resp[] = $response;
226
-      if (!$response || $response->faultCode())
227
-        break;
228
+      if (!$response || $response->faultCode()) {
229
+              break;
230
+      }
228 231
     }
229 232
     $mtime = explode(' ',microtime());
230 233
     $time = (float)$mtime[0] + (float)$mtime[1] - $time;
231
-    if ($debug)
232
-      echo "</div>\n";
234
+    if ($debug) {
235
+          echo "</div>\n";
236
+    }
233 237
 
234 238
     if ($response)
235 239
     {
@@ -242,8 +246,7 @@  discard block
 block discarded – undo
242 246
       echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) .
243 247
         "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']) . "'</p>\n";
244 248
       echo (strftime("%d/%b/%Y:%H:%M:%S\n"));
245
-    }
246
-    else
249
+    } else
247 250
     {
248 251
       // call succeeded: parse results
249 252
       //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>';
@@ -263,7 +266,11 @@  discard block
 block discarded – undo
263 266
           for($i=0; $i < $max; $i++)
264 267
           {
265 268
             $rec = $v->arraymem($i);
266
-            if ($i%2) $class=' class="oddrow"'; else $class = ' class="evenrow"';
269
+            if ($i%2) {
270
+                $class=' class="oddrow"';
271
+            } else {
272
+                $class = ' class="evenrow"';
273
+            }
267 274
             echo ("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding'])."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">".
268 275
               "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />".
269 276
               "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />".
@@ -316,18 +323,23 @@  discard block
 block discarded – undo
316 323
         echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
317 324
         echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th>&nbsp;</th><th>&nbsp;</th></tr>\n</thead>\n<tbody>\n";
318 325
         $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, $GLOBALS['xmlrpc_internalencoding']);
319
-        if ($desc == "")
320
-          $desc = "-";
326
+        if ($desc == "") {
327
+                  $desc = "-";
328
+        }
321 329
         echo "<tr><td class=\"evenrow\">Description</td><td colspan=\"3\" class=\"evenrow\">$desc</td></tr>\n";
322 330
         $payload="";
323 331
         $alt_payload="";
324
-        if ($r2->kindOf()!="array")
325
-          echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\">&nbsp;</td></tr>\n";
326
-        else
332
+        if ($r2->kindOf()!="array") {
333
+                  echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\">&nbsp;</td></tr>\n";
334
+        } else
327 335
         {
328 336
           for($i=0; $i < $r2->arraysize(); $i++)
329 337
           {
330
-            if ($i+1%2) $class=' class="oddrow"'; else $class = ' class="evenrow"';
338
+            if ($i+1%2) {
339
+                $class=' class="oddrow"';
340
+            } else {
341
+                $class = ' class="evenrow"';
342
+            }
331 343
             echo "<tr><td$class>Signature&nbsp;".($i+1)."</td><td$class>";
332 344
             $x = $r2->arraymem($i);
333 345
             if ($x->kindOf()=="array")
@@ -353,8 +365,7 @@  discard block
 block discarded – undo
353 365
                 }
354 366
               }
355 367
               echo ")</code>";
356
-            }
357
-            else
368
+            } else
358 369
             {
359 370
               echo 'Unknown';
360 371
             }
@@ -386,8 +397,9 @@  discard block
 block discarded – undo
386 397
             "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />".
387 398
             "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />".
388 399
             "<input type=\"hidden\" name=\"action\" value=\"execute\" />";
389
-            if ($wstype != 1)
390
-              echo "<input type=\"submit\" value=\"Load method synopsis\" />";
400
+            if ($wstype != 1) {
401
+                          echo "<input type=\"submit\" value=\"Load method synopsis\" />";
402
+            }
391 403
             echo "</form></td>\n";
392 404
 
393 405
             echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">".
@@ -429,9 +441,9 @@  discard block
 block discarded – undo
429 441
         case 'wrap':
430 442
           $r1 = $resp[0]->value();
431 443
           $r2 = $resp[1]->value();
432
-          if ($r2->kindOf()!="array" || $r2->arraysize() <= $methodsig)
433
-            echo "Error: signature unknown\n";
434
-          else
444
+          if ($r2->kindOf()!="array" || $r2->arraysize() <= $methodsig) {
445
+                      echo "Error: signature unknown\n";
446
+          } else
435 447
           {
436 448
           $mdesc = $r1->scalarval();
437 449
           $msig = php_xmlrpc_decode($r2);
@@ -441,16 +453,14 @@  discard block
 block discarded – undo
441 453
             $clientcookies == '')
442 454
           {
443 455
             $opts = 0; // simple client copy in stub code
444
-          }
445
-          else
456
+          } else
446 457
           {
447 458
             $opts = 1; // complete client copy in stub code
448 459
           }
449 460
           if ($wstype == 1)
450 461
           {
451 462
             $prefix = 'jsonrpc';
452
-          }
453
-          else
463
+          } else
454 464
           {
455 465
             $prefix = 'xmlrpc';
456 466
           }
@@ -477,8 +487,7 @@  discard block
 block discarded – undo
477 487
       }
478 488
     } // if !$response->faultCode()
479 489
     } // if $response
480
-  }
481
-  else
490
+  } else
482 491
   {
483 492
     // no action taken yet: give some instructions on debugger usage
484 493
 ?>
Please login to merge, or discard this patch.
debugger/index.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,9 @@
 block discarded – undo
3 3
   if (isset($_GET['run']))
4 4
   {
5 5
     $path = parse_url($_GET['run']);
6
-    if (isset($path['query']))
7
-      $query = '?'.$path['query'];
6
+    if (isset($path['query'])) {
7
+          $query = '?'.$path['query'];
8
+    }
8 9
   }
9 10
 ?>
10 11
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
Please login to merge, or discard this patch.
debugger/controller.php 1 patch
Braces   +107 added lines, -28 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  **/
15 15
 
16 16
   include(dirname(__FILE__).'/common.php');
17
-  if ($action == '')
18
-    $action = 'list';
17
+  if ($action == '') {
18
+      $action = 'list';
19
+  }
19 20
 
20 21
   // relative path to the visual xmlrpc editing dialog
21 22
   $editorpath = '../../javascript/debugger/';
@@ -214,7 +215,10 @@  discard block
 block discarded – undo
214 215
 //-->
215 216
 </script>
216 217
 </head>
217
-<body onload="switchtransport(<?php echo $wstype;?>); switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) echo ' document.forms[2].submit();'; ?>">
218
+<body onload="switchtransport(<?php echo $wstype;?>); switchaction(); switchssl(); switchauth(); swicthcainfo();<?php if ($run) {
219
+    echo ' document.forms[2].submit();';
220
+}
221
+?>">
218 222
 <h1>XMLRPC <form name="frmxmlrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(0);"/></form>
219 223
 /<form name="frmjsonrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(1);"/></form>JSONRPC Debugger (based on the <a href="http://phpxmlrpc.sourceforge.net">PHP-XMLRPC</a> library)</h1>
220 224
 <form name="frmaction" method="get" action="action.php" target="frmaction" onSubmit="switchFormMethod();"
@@ -232,10 +236,22 @@  discard block
 block discarded – undo
232 236
 <table id="actionblock">
233 237
 <tr>
234 238
 <td><h2>Action</h2></td>
235
-<td>List available methods<input type="radio" name="action" value="list"<?php if ($action=='list') echo ' checked="checked"'; ?> onclick="switchaction();" /></td>
236
-<td>Describe method<input type="radio" name="action" value="describe"<?php if ($action=='describe') echo ' checked="checked"'; ?> onclick="switchaction();" /></td>
237
-<td>Execute method<input type="radio" name="action" value="execute"<?php if ($action=='execute') echo ' checked="checked"'; ?> onclick="switchaction();" /></td>
238
-<td>Generate stub for method call<input type="radio" name="action" value="wrap"<?php if ($action=='wrap') echo ' checked="checked"'; ?> onclick="switchaction();" /></td>
239
+<td>List available methods<input type="radio" name="action" value="list"<?php if ($action=='list') {
240
+    echo ' checked="checked"';
241
+}
242
+?> onclick="switchaction();" /></td>
243
+<td>Describe method<input type="radio" name="action" value="describe"<?php if ($action=='describe') {
244
+    echo ' checked="checked"';
245
+}
246
+?> onclick="switchaction();" /></td>
247
+<td>Execute method<input type="radio" name="action" value="execute"<?php if ($action=='execute') {
248
+    echo ' checked="checked"';
249
+}
250
+?> onclick="switchaction();" /></td>
251
+<td>Generate stub for method call<input type="radio" name="action" value="wrap"<?php if ($action=='wrap') {
252
+    echo ' checked="checked"';
253
+}
254
+?> onclick="switchaction();" /></td>
239 255
 </tr>
240 256
 </table>
241 257
 <input type="hidden" name="methodsig" value="<?php echo htmlspecialchars($methodsig, ENT_COMPAT, $inputcharset); ?>" />
@@ -255,16 +271,37 @@  discard block
 block discarded – undo
255 271
 <tr>
256 272
 <td><h2>Client options</h2></td>
257 273
 <td class="labelcell">Show debug info:</td><td><select name="debug">
258
-<option value="0"<?php if ($debug == 0) echo ' selected="selected"'; ?>>No</option>
259
-<option value="1"<?php if ($debug == 1) echo ' selected="selected"'; ?>>Yes</option>
260
-<option value="2"<?php if ($debug == 2) echo ' selected="selected"'; ?>>More</option>
274
+<option value="0"<?php if ($debug == 0) {
275
+    echo ' selected="selected"';
276
+}
277
+?>>No</option>
278
+<option value="1"<?php if ($debug == 1) {
279
+    echo ' selected="selected"';
280
+}
281
+?>>Yes</option>
282
+<option value="2"<?php if ($debug == 2) {
283
+    echo ' selected="selected"';
284
+}
285
+?>>More</option>
261 286
 </select>
262 287
 </td>
263
-<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) echo $timeout; ?>" /></td>
288
+<td class="labelcell">Timeout:</td><td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) {
289
+    echo $timeout;
290
+}
291
+?>" /></td>
264 292
 <td class="labelcell">Protocol:</td><td><select name="protocol" onchange="switchssl(); switchauth(); swicthcainfo();">
265
-<option value="0"<?php if ($protocol == 0) echo ' selected="selected"'; ?>>HTTP 1.0</option>
266
-<option value="1"<?php if ($protocol == 1) echo ' selected="selected"'; ?>>HTTP 1.1</option>
267
-<option value="2"<?php if ($protocol == 2) echo ' selected="selected"'; ?>>HTTPS</option>
293
+<option value="0"<?php if ($protocol == 0) {
294
+    echo ' selected="selected"';
295
+}
296
+?>>HTTP 1.0</option>
297
+<option value="1"<?php if ($protocol == 1) {
298
+    echo ' selected="selected"';
299
+}
300
+?>>HTTP 1.1</option>
301
+<option value="2"<?php if ($protocol == 2) {
302
+    echo ' selected="selected"';
303
+}
304
+?>>HTTPS</option>
268 305
 </select></td>
269 306
 </tr>
270 307
 <tr>
@@ -272,20 +309,41 @@  discard block
 block discarded – undo
272 309
 <td class="labelcell">Username:</td><td><input type="text" name="username" value="<?php echo htmlspecialchars($username, ENT_COMPAT, $inputcharset); ?>" /></td>
273 310
 <td class="labelcell">Pwd:</td><td><input type="password" name="password" value="<?php echo htmlspecialchars($password, ENT_COMPAT, $inputcharset); ?>" /></td>
274 311
 <td class="labelcell">Type</td><td><select name="authtype">
275
-<option value="1"<?php if ($authtype == 1) echo ' selected="selected"'; ?>>Basic</option>
276
-<option value="2"<?php if ($authtype == 2) echo ' selected="selected"'; ?>>Digest</option>
277
-<option value="8"<?php if ($authtype == 8) echo ' selected="selected"'; ?>>NTLM</option>
312
+<option value="1"<?php if ($authtype == 1) {
313
+    echo ' selected="selected"';
314
+}
315
+?>>Basic</option>
316
+<option value="2"<?php if ($authtype == 2) {
317
+    echo ' selected="selected"';
318
+}
319
+?>>Digest</option>
320
+<option value="8"<?php if ($authtype == 8) {
321
+    echo ' selected="selected"';
322
+}
323
+?>>NTLM</option>
278 324
 </select></td>
279 325
 <td></td>
280 326
 </tr>
281 327
 <tr>
282 328
 <td class="labelcell">SSL:</td>
283 329
 <td class="labelcell">Verify Host's CN:</td><td><select name="verifyhost">
284
-<option value="0"<?php if ($verifyhost == 0) echo ' selected="selected"'; ?>>No</option>
285
-<option value="1"<?php if ($verifyhost == 1) echo ' selected="selected"'; ?>>Check CN existance</option>
286
-<option value="2"<?php if ($verifyhost == 2) echo ' selected="selected"'; ?>>Check CN match</option>
330
+<option value="0"<?php if ($verifyhost == 0) {
331
+    echo ' selected="selected"';
332
+}
333
+?>>No</option>
334
+<option value="1"<?php if ($verifyhost == 1) {
335
+    echo ' selected="selected"';
336
+}
337
+?>>Check CN existance</option>
338
+<option value="2"<?php if ($verifyhost == 2) {
339
+    echo ' selected="selected"';
340
+}
341
+?>>Check CN match</option>
287 342
 </select></td>
288
-<td class="labelcell">Verify Cert:</td><td><input type="checkbox" value="1" name="verifypeer" onclick="swicthcainfo();"<?php if ($verifypeer) echo ' checked="checked"'; ?> /></td>
343
+<td class="labelcell">Verify Cert:</td><td><input type="checkbox" value="1" name="verifypeer" onclick="swicthcainfo();"<?php if ($verifypeer) {
344
+    echo ' checked="checked"';
345
+}
346
+?> /></td>
289 347
 <td class="labelcell">CA Cert file:</td><td><input type="text" name="cainfo" value="<?php echo htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset); ?>" /></td>
290 348
 </tr>
291 349
 <tr>
@@ -297,15 +355,36 @@  discard block
 block discarded – undo
297 355
 <tr>
298 356
 <td class="labelcell">COMPRESSION:</td>
299 357
 <td class="labelcell">Request:</td><td><select name="requestcompression">
300
-<option value="0"<?php if ($requestcompression == 0) echo ' selected="selected"'; ?>>None</option>
301
-<option value="1"<?php if ($requestcompression == 1) echo ' selected="selected"'; ?>>Gzip</option>
302
-<option value="2"<?php if ($requestcompression == 2) echo ' selected="selected"'; ?>>Deflate</option>
358
+<option value="0"<?php if ($requestcompression == 0) {
359
+    echo ' selected="selected"';
360
+}
361
+?>>None</option>
362
+<option value="1"<?php if ($requestcompression == 1) {
363
+    echo ' selected="selected"';
364
+}
365
+?>>Gzip</option>
366
+<option value="2"<?php if ($requestcompression == 2) {
367
+    echo ' selected="selected"';
368
+}
369
+?>>Deflate</option>
303 370
 </select></td>
304 371
 <td class="labelcell">Response:</td><td><select name="responsecompression">
305
-<option value="0"<?php if ($responsecompression == 0) echo ' selected="selected"'; ?>>None</option>
306
-<option value="1"<?php if ($responsecompression == 1) echo ' selected="selected"'; ?>>Gzip</option>
307
-<option value="2"<?php if ($responsecompression == 2) echo ' selected="selected"'; ?>>Deflate</option>
308
-<option value="3"<?php if ($responsecompression == 3) echo ' selected="selected"'; ?>>Any</option>
372
+<option value="0"<?php if ($responsecompression == 0) {
373
+    echo ' selected="selected"';
374
+}
375
+?>>None</option>
376
+<option value="1"<?php if ($responsecompression == 1) {
377
+    echo ' selected="selected"';
378
+}
379
+?>>Gzip</option>
380
+<option value="2"<?php if ($responsecompression == 2) {
381
+    echo ' selected="selected"';
382
+}
383
+?>>Deflate</option>
384
+<option value="3"<?php if ($responsecompression == 3) {
385
+    echo ' selected="selected"';
386
+}
387
+?>>Any</option>
309 388
 </select></td>
310 389
 <td></td>
311 390
 </tr>
Please login to merge, or discard this patch.
demo/server/discuss.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
 			if(dba_exists($countID, $dbh))
29 29
 			{
30 30
 				$count=dba_fetch($countID, $dbh);
31
-			}
32
-			else
31
+			} else
33 32
 			{
34 33
 				$count=0;
35 34
 			}
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
 		if($err)
49 48
 		{
50 49
 			return new xmlrpcresp(0, $xmlrpcerruser, $err);
51
-		}
52
-		else
50
+		} else
53 51
 		{
54 52
 			// otherwise, we create the right response
55 53
 			// with the state name
@@ -72,8 +70,7 @@  discard block
 block discarded – undo
72 70
 		if(XMLRPC_EPI_ENABLED == '1')
73 71
 		{
74 72
 			$msgID=xmlrpc_decode($m->getParam(0));
75
-		}
76
-		else
73
+		} else
77 74
 		{
78 75
 			$msgID=php_xmlrpc_decode($m->getParam(0));
79 76
 		}
@@ -100,8 +97,7 @@  discard block
 block discarded – undo
100 97
 		if($err)
101 98
 		{
102 99
 			return new xmlrpcresp(0, $xmlrpcerruser, $err);
103
-		}
104
-		else
100
+		} else
105 101
 		{
106 102
 			// otherwise, we create the right response
107 103
 			// with the state name
Please login to merge, or discard this patch.
demo/server/server.php 1 patch
Braces   +29 added lines, -30 removed lines patch added patch discarded remove patch
@@ -93,8 +93,7 @@  discard block
 block discarded – undo
93 93
 		if (isset($stateNames[$snv-1]))
94 94
 		{
95 95
 			$sname=$stateNames[$snv-1];
96
-		}
97
-		else
96
+		} else
98 97
 		{
99 98
 			// not, there so complain
100 99
 			$err="I don't have a state for the index '" . $snv . "'";
@@ -104,8 +103,7 @@  discard block
 block discarded – undo
104 103
 		if ($err)
105 104
 		{
106 105
 			return new xmlrpcresp(0, $xmlrpcerruser, $err);
107
-		}
108
-		else
106
+		} else
109 107
 		{
110 108
 			// otherwise, we create the right response
111 109
 			// with the state name
@@ -125,8 +123,7 @@  discard block
 block discarded – undo
125 123
 		if (isset($stateNames[$stateno-1]))
126 124
 		{
127 125
 			return $stateNames[$stateno-1];
128
-		}
129
-		else
126
+		} else
130 127
 		{
131 128
 			// not, there so complain
132 129
 			return "I don't have a state for the index '" . $stateno . "'";
@@ -208,8 +205,7 @@  discard block
 block discarded – undo
208 205
 			if ($b->scalarval())
209 206
 			{
210 207
 				$rv->addScalar(false, "boolean");
211
-			}
212
-			else
208
+			} else
213 209
 			{
214 210
 				$rv->addScalar(true, "boolean");
215 211
 			}
@@ -304,8 +300,7 @@  discard block
 block discarded – undo
304 300
 			}
305 301
 			// add this array to the output value
306 302
 			$v->addArray($outAr);
307
-		}
308
-		else
303
+		} else
309 304
 		{
310 305
 			$err="Must be one parameter, an array of structs";
311 306
 		}
@@ -313,8 +308,7 @@  discard block
 block discarded – undo
313 308
 		if ($err)
314 309
 		{
315 310
 			return new xmlrpcresp(0, $xmlrpcerruser, $err);
316
-		}
317
-		else
311
+		} else
318 312
 		{
319 313
 			return new xmlrpcresp($v);
320 314
 		}
@@ -393,8 +387,7 @@  discard block
 block discarded – undo
393 387
 		if ($err)
394 388
 		{
395 389
 			return new xmlrpcresp(0, $xmlrpcerruser, $err);
396
-		}
397
-		else
390
+		} else
398 391
 		{
399 392
 			return new xmlrpcresp(new xmlrpcval("true", $xmlrpcBoolean));
400 393
 		}
@@ -408,15 +401,15 @@  discard block
 block discarded – undo
408 401
 		if (function_exists('getallheaders'))
409 402
 		{
410 403
 			return new xmlrpcresp(php_xmlrpc_encode(getallheaders()));
411
-		}
412
-		else
404
+		} else
413 405
 		{
414 406
 			$headers = array();
415 407
 			// IIS: poor man's version of getallheaders
416
-			foreach ($_SERVER as $key => $val)
417
-				if (strpos($key, 'HTTP_') === 0)
408
+			foreach ($_SERVER as $key => $val) {
409
+							if (strpos($key, 'HTTP_') === 0)
418 410
 				{
419 411
 					$key = ucfirst(str_replace('_', '-', strtolower(substr($key, 5))));
412
+			}
420 413
 					$headers[$key] = $val;
421 414
 				}
422 415
 			return new xmlrpcresp(php_xmlrpc_encode($headers));
@@ -825,17 +818,21 @@  discard block
 block discarded – undo
825 818
 		)
826 819
 	);
827 820
 
828
-	if ($findstate2_sig)
829
-		$a['examples.php.getStateName'] = $findstate2_sig;
821
+	if ($findstate2_sig) {
822
+			$a['examples.php.getStateName'] = $findstate2_sig;
823
+	}
830 824
 
831
-	if ($findstate3_sig)
832
-		$a['examples.php2.getStateName'] = $findstate3_sig;
825
+	if ($findstate3_sig) {
826
+			$a['examples.php2.getStateName'] = $findstate3_sig;
827
+	}
833 828
 
834
-	if ($findstate4_sig)
835
-		$a['examples.php3.getStateName'] = $findstate4_sig;
829
+	if ($findstate4_sig) {
830
+			$a['examples.php3.getStateName'] = $findstate4_sig;
831
+	}
836 832
 
837
-    if ($findstate5_sig)
838
-        $a['examples.php4.getStateName'] = $findstate5_sig;
833
+    if ($findstate5_sig) {
834
+            $a['examples.php4.getStateName'] = $findstate5_sig;
835
+    }
839 836
 
840 837
 	$s=new xmlrpc_server($a, false);
841 838
 	$s->setdebug(3);
@@ -843,10 +840,12 @@  discard block
 block discarded – undo
843 840
 
844 841
 	// out-of-band information: let the client manipulate the server operations.
845 842
 	// we do this to help the testsuite script: do not reproduce in production!
846
-	if (isset($_GET['RESPONSE_ENCODING']))
847
-		$s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
848
-	if (isset($_GET['EXCEPTION_HANDLING']))
849
-		$s->exception_handling = $_GET['EXCEPTION_HANDLING'];
843
+	if (isset($_GET['RESPONSE_ENCODING'])) {
844
+			$s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
845
+	}
846
+	if (isset($_GET['EXCEPTION_HANDLING'])) {
847
+			$s->exception_handling = $_GET['EXCEPTION_HANDLING'];
848
+	}
850 849
 	$s->service();
851 850
 	// that should do all we need!
852 851
 ?>
853 852
\ No newline at end of file
Please login to merge, or discard this patch.
demo/client/comment.php 1 patch
Braces   +18 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,10 +51,11 @@  discard block
 block discarded – undo
51 51
 <h2>Meerkat integration</h2>
52 52
 <?php
53 53
 @$catid=$_GET["catid"];
54
-if (@$_GET["oc"]==$catid)
54
+if (@$_GET["oc"]==$catid) {
55 55
 	@$chanid=$_GET["chanid"];
56
-else
56
+} else {
57 57
 	$chanid=0;
58
+}
58 59
 
59 60
 $client=new xmlrpc_client("/meerkat/xml-rpc/server.php",
60 61
 													"www.oreillynet.com", 80);
@@ -81,9 +82,10 @@  discard block
 block discarded – undo
81 82
 <?php
82 83
 } else {
83 84
 	$categories=dispatch($client, "meerkat.getCategories", array());
84
-	if ($catid)
85
-		$sources = dispatch($client, "meerkat.getChannelsByCategory",
85
+	if ($catid) {
86
+			$sources = dispatch($client, "meerkat.getChannelsByCategory",
86 87
 												array(new xmlrpcval($catid, "int")));
88
+	}
87 89
 	if ($chanid) {
88 90
 		$stories = dispatch($client, "meerkat.getItems",
89 91
 					array(new xmlrpcval(
@@ -100,11 +102,14 @@  discard block
 block discarded – undo
100 102
 <p>Subject area:<br />
101 103
 <select name="catid">
102 104
 <?php
103
-	if (!$catid)
104
-		print "<option value=\"0\">Choose a category</option>\n";
105
+	if (!$catid) {
106
+			print "<option value=\"0\">Choose a category</option>\n";
107
+	}
105 108
 	while(list($k,$v) = each($categories)) {
106 109
 		print "<option value=\"" . $v['id'] ."\"";
107
-		if ($v['id']==$catid) print " selected=\"selected\"";
110
+		if ($v['id']==$catid) {
111
+		    print " selected=\"selected\"";
112
+		}
108 113
 			print ">". $v['title'] . "</option>\n";
109 114
 	}
110 115
 ?>
@@ -115,11 +120,14 @@  discard block
 block discarded – undo
115 120
 <p>News source:<br />
116 121
 <select name="chanid">
117 122
 <?php
118
-		if (!$chanid)
119
-			print "<option value=\"0\">Choose a source</option>\n";
123
+		if (!$chanid) {
124
+					print "<option value=\"0\">Choose a source</option>\n";
125
+		}
120 126
 		while(list($k,$v) = each($sources)) {
121 127
 			print "<option value=\"" . $v['id'] ."\"";
122
-			if ($v['id']==$chanid) print "\" selected=\"selected\"";
128
+			if ($v['id']==$chanid) {
129
+			    print "\" selected=\"selected\"";
130
+			}
123 131
 			print ">". $v['title'] . "</option>\n";
124 132
 		}
125 133
 ?>
Please login to merge, or discard this patch.