Completed
Push — php51 ( 3c9909...bb9991 )
by Gaetano
10:12
created
lib/xmlrpc_wrappers.inc 1 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);
@@ -347,8 +338,7 @@  discard block
 block discarded – undo
347 338
 				if ($decode_php_objects)
348 339
 				{
349 340
 					$innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i, array('decode_php_objs'));\n";
350
-				}
351
-				else
341
+				} else
352 342
 				{
353 343
 					$innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i);\n";
354 344
 				}
@@ -373,8 +363,7 @@  discard block
 block discarded – undo
373 363
 				// only known good synopsis = no parameters
374 364
 				$parsvariations[] = array();
375 365
 				$minpars = 0;
376
-			}
377
-			else
366
+			} else
378 367
 			{
379 368
 				$minpars = count($parsvariations[0]);
380 369
 			}
@@ -385,8 +374,7 @@  discard block
 block discarded – undo
385 374
 				// NB: this check needs to be done BEFORE decoding param values
386 375
 				$innercode = "\$paramcount = \$msg->getNumParams();\n" .
387 376
 				"if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode;
388
-			}
389
-			else
377
+			} else
390 378
 			{
391 379
 				$innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode;
392 380
 			}
@@ -399,8 +387,7 @@  discard block
 block discarded – undo
399 387
 				$GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] =& $funcname[0];
400 388
 				$innercode .= "\$obj =& \$GLOBALS['xmlrpcWPFObjHolder']['$xmlrpcfuncname'];\n";
401 389
 				$realfuncname = '$obj->'.$funcname[1];
402
-			}
403
-			else
390
+			} else
404 391
 			{
405 392
 				$realfuncname = $plainfuncname;
406 393
 			}
@@ -415,8 +402,7 @@  discard block
 block discarded – undo
415 402
 					if (isset($paramDocs[$i]['type']))
416 403
 					{
417 404
 						$sig[] = php_2_xmlrpc_type($paramDocs[$i]['type']);
418
-					}
419
-					else
405
+					} else
420 406
 					{
421 407
 						$sig[] = $GLOBALS['xmlrpcValue'];
422 408
 					}
@@ -432,13 +418,13 @@  discard block
 block discarded – undo
432 418
 			if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64'])
433 419
 			{
434 420
 				$innercode .= "return new {$prefix}resp(new {$prefix}val(\$retval, '$returns'));";
435
-			}
436
-			else
421
+			} else
437 422
 			{
438
-				if ($encode_php_objects)
439
-					$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n";
440
-				else
441
-					$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval));\n";
423
+				if ($encode_php_objects) {
424
+									$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n";
425
+				} else {
426
+									$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval));\n";
427
+				}
442 428
 			}
443 429
 			// shall we exclude functions returning by ref?
444 430
 			// if($func->returnsReference())
@@ -555,8 +541,7 @@  discard block
 block discarded – undo
555 541
 		{
556 542
 			$signum = $extra_options;
557 543
 			$extra_options = array();
558
-		}
559
-		else
544
+		} else
560 545
 		{
561 546
 			$signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0;
562 547
 			$timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0;
@@ -577,8 +562,7 @@  discard block
 block discarded – undo
577 562
 		{
578 563
 			$decode_fault = true;
579 564
 			$fault_response = $extra_options['return_on_fault'];
580
-		}
581
-		else
565
+		} else
582 566
 		{
583 567
 			$decode_fault = false;
584 568
 			$fault_response = '';
@@ -597,8 +581,7 @@  discard block
 block discarded – undo
597 581
 		{
598 582
 			error_log('XML-RPC: could not retrieve method signature from remote server for method '.$methodname);
599 583
 			return false;
600
-		}
601
-		else
584
+		} else
602 585
 		{
603 586
 			$msig = $response->value();
604 587
 			if ($client->return_type != 'phpvals')
@@ -609,15 +592,13 @@  discard block
 block discarded – undo
609 592
 			{
610 593
 				error_log('XML-RPC: could not retrieve method signature nr.'.$signum.' from remote server for method '.$methodname);
611 594
 				return false;
612
-			}
613
-			else
595
+			} else
614 596
 			{
615 597
 				// pick a suitable name for the new function, avoiding collisions
616 598
 				if($newfuncname != '')
617 599
 				{
618 600
 					$xmlrpcfuncname = $newfuncname;
619
-				}
620
-				else
601
+				} else
621 602
 				{
622 603
 					// take care to insure that methodname is translated to valid
623 604
 					// php function name
@@ -663,14 +644,12 @@  discard block
 block discarded – undo
663 644
 					if($allOK)
664 645
 					{
665 646
 						return $xmlrpcfuncname;
666
-					}
667
-					else
647
+					} else
668 648
 					{
669 649
 						error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap remote method '.$methodname);
670 650
 						return false;
671 651
 					}
672
-				}
673
-				else
652
+				} else
674 653
 				{
675 654
 					$results['function'] = $xmlrpcfuncname;
676 655
 					return $results;
@@ -710,8 +689,7 @@  discard block
 block discarded – undo
710 689
 		{
711 690
 			error_log('XML-RPC: could not retrieve method list from remote server');
712 691
 			return false;
713
-		}
714
-		else
692
+		} else
715 693
 		{
716 694
 			$mlist = $response->value();
717 695
 			if ($client->return_type != 'phpvals')
@@ -722,15 +700,13 @@  discard block
 block discarded – undo
722 700
 			{
723 701
 				error_log('XML-RPC: could not retrieve meaningful method list from remote server');
724 702
 				return false;
725
-			}
726
-			else
703
+			} else
727 704
 			{
728 705
 				// pick a suitable name for the new function, avoiding collisions
729 706
 				if($newclassname != '')
730 707
 				{
731 708
 					$xmlrpcclassname = $newclassname;
732
-				}
733
-				else
709
+				} else
734 710
 				{
735 711
 					$xmlrpcclassname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
736 712
 						array('_', ''), $client->server).'_client';
@@ -765,8 +741,7 @@  discard block
 block discarded – undo
765 741
 								$source .= $methodwrap['docstring'];
766 742
 							}
767 743
 							$source .= $methodwrap['source']."\n";
768
-						}
769
-						else
744
+						} else
770 745
 						{
771 746
 							error_log('XML-RPC: will not create class method to wrap remote method '.$mname);
772 747
 						}
@@ -782,14 +757,12 @@  discard block
 block discarded – undo
782 757
 					if($allOK)
783 758
 					{
784 759
 						return $xmlrpcclassname;
785
-					}
786
-					else
760
+					} else
787 761
 					{
788 762
 						error_log('XML-RPC: could not create class '.$xmlrpcclassname.' to wrap remote server '.$client->server);
789 763
 						return false;
790 764
 					}
791
-				}
792
-				else
765
+				} else
793 766
 				{
794 767
 					return array('class' => $xmlrpcclassname, 'code' => $source, 'docstring' => '');
795 768
 				}
@@ -817,8 +790,7 @@  discard block
 block discarded – undo
817 790
 			$innercode = build_client_wrapper_code($client, $client_copy_mode, $prefix);
818 791
 			$innercode .= "\$client->setDebug(\$debug);\n";
819 792
 			$this_ = '';
820
-		}
821
-		else
793
+		} else
822 794
 		{
823 795
 			// client copy mode 2 == no client copy in emitted code
824 796
 			$innercode = '';
@@ -830,8 +802,7 @@  discard block
 block discarded – undo
830 802
 		{
831 803
 			// take care that PHP comment is not terminated unwillingly by method description
832 804
 			$mdesc = "/**\n* ".str_replace('*/', '* /', $mdesc)."\n";
833
-		}
834
-		else
805
+		} else
835 806
 		{
836 807
 			$mdesc = "/**\nFunction $xmlrpcfuncname\n";
837 808
 		}
@@ -848,14 +819,12 @@  discard block
 block discarded – undo
848 819
 			{
849 820
 				// only build directly xmlrpcvals when type is known and scalar
850 821
 				$innercode .= "\$p$i = new {$prefix}val(\$p$i, '$ptype');\n";
851
-			}
852
-			else
822
+			} else
853 823
 			{
854 824
 				if ($encode_php_objects)
855 825
 				{
856 826
 					$innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i, array('encode_php_objs'));\n";
857
-				}
858
-				else
827
+				} else
859 828
 				{
860 829
 					$innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i);\n";
861 830
 				}
@@ -877,21 +846,18 @@  discard block
 block discarded – undo
877 846
 			if (is_string($fault_response) && ((strpos($fault_response, '%faultCode%') !== false) || (strpos($fault_response, '%faultString%') !== false)))
878 847
 			{
879 848
 				$respcode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $fault_response)."')";
880
-			}
881
-			else
849
+			} else
882 850
 			{
883 851
 				$respcode = var_export($fault_response, true);
884 852
 			}
885
-		}
886
-		else
853
+		} else
887 854
 		{
888 855
 			$respcode = '$res';
889 856
 		}
890 857
 		if ($decode_php_objects)
891 858
 		{
892 859
 			$innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value(), array('decode_php_objs'));";
893
-		}
894
-		else
860
+		} else
895 861
 		{
896 862
 			$innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value());";
897 863
 		}
Please login to merge, or discard this patch.
lib/xmlrpcs.inc 1 patch
Braces   +57 added lines, -88 removed lines patch added patch discarded remove patch
@@ -106,16 +106,14 @@  discard block
 block discarded – undo
106 106
 		{
107 107
 			$methName=$m->getParam(0);
108 108
 			$methName=$methName->scalarval();
109
-		}
110
-		else
109
+		} else
111 110
 		{
112 111
 			$methName=$m;
113 112
 		}
114 113
 		if(strpos($methName, "system.") === 0)
115 114
 		{
116 115
 			$dmap=$GLOBALS['_xmlrpcs_dmap']; //$sysCall=1;
117
-		}
118
-		else
116
+		} else
119 117
 		{
120 118
 			$dmap=$server->dmap; //$sysCall=0;
121 119
 		}
@@ -134,15 +132,13 @@  discard block
 block discarded – undo
134 132
 					$sigs[]=new xmlrpcval($cursig, 'array');
135 133
 				}
136 134
 				$r=new xmlrpcresp(new xmlrpcval($sigs, 'array'));
137
-			}
138
-			else
135
+			} else
139 136
 			{
140 137
 				// NB: according to the official docs, we should be returning a
141 138
 				// "none-array" here, which means not-an-array
142 139
 				$r=new xmlrpcresp(new xmlrpcval('undef', 'string'));
143 140
 			}
144
-		}
145
-		else
141
+		} else
146 142
 		{
147 143
 			$r=new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
148 144
 		}
@@ -159,16 +155,14 @@  discard block
 block discarded – undo
159 155
 		{
160 156
 			$methName=$m->getParam(0);
161 157
 			$methName=$methName->scalarval();
162
-		}
163
-		else
158
+		} else
164 159
 		{
165 160
 			$methName=$m;
166 161
 		}
167 162
 		if(strpos($methName, "system.") === 0)
168 163
 		{
169 164
 			$dmap=$GLOBALS['_xmlrpcs_dmap']; //$sysCall=1;
170
-		}
171
-		else
165
+		} else
172 166
 		{
173 167
 			$dmap=$server->dmap; //$sysCall=0;
174 168
 		}
@@ -177,13 +171,11 @@  discard block
 block discarded – undo
177 171
 			if(isset($dmap[$methName]['docstring']))
178 172
 			{
179 173
 				$r=new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string');
180
-			}
181
-			else
174
+			} else
182 175
 			{
183 176
 				$r=new xmlrpcresp(new xmlrpcval('', 'string'));
184 177
 			}
185
-		}
186
-		else
178
+		} else
187 179
 		{
188 180
 			$r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
189 181
 		}
@@ -295,8 +287,9 @@  discard block
 block discarded – undo
295 287
 		// base64 or datetime values, but they will be listed as strings here...
296 288
 		//$numParams = count($call['params']);
297 289
 		$pt = array();
298
-		foreach($call['params'] as $val)
299
-			$pt[] = php_2_xmlrpc_type(gettype($val));
290
+		foreach($call['params'] as $val) {
291
+					$pt[] = php_2_xmlrpc_type(gettype($val));
292
+		}
300 293
 
301 294
 		$result = $server->execute($call['methodName'], $call['params'], $pt);
302 295
 
@@ -321,8 +314,7 @@  discard block
 block discarded – undo
321 314
 				$call = $calls->arraymem($i);
322 315
 				$result[$i] = _xmlrpcs_multicall_do_call($server, $call);
323 316
 			}
324
-		}
325
-		else
317
+		} else
326 318
 		{
327 319
 			$numCalls=count($m);
328 320
 			for($i = 0; $i < $numCalls; $i++)
@@ -377,8 +369,9 @@  discard block
 block discarded – undo
377 369
 	function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, $lineno=null, $context=null)
378 370
 	{
379 371
 		// obey the @ protocol
380
-		if (error_reporting() == 0)
381
-			return;
372
+		if (error_reporting() == 0) {
373
+					return;
374
+		}
382 375
 
383 376
 		//if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode != E_USER_NOTICE && $errcode != E_USER_WARNING)
384 377
 		if($errcode != E_STRICT)
@@ -395,8 +388,7 @@  discard block
 block discarded – undo
395 388
 			{
396 389
 				error_log($errstring);
397 390
 			}
398
-		}
399
-		else
391
+		} else
400 392
 		{
401 393
 			// Pass control on to previous error handler, trying to avoid loops...
402 394
 			if($GLOBALS['_xmlrpcs_prev_ehandler'] != '_xmlrpcs_errorHandler')
@@ -406,8 +398,7 @@  discard block
 block discarded – undo
406 398
 				{
407 399
 					// the following works both with static class methods and plain object methods as error handler
408 400
 					call_user_func_array($GLOBALS['_xmlrpcs_prev_ehandler'], array($errcode, $errstring, $filename, $lineno, $context));
409
-				}
410
-				else
401
+				} else
411 402
 				{
412 403
 					$GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, $context);
413 404
 				}
@@ -663,8 +654,7 @@  discard block
 block discarded – undo
663 654
 						$payload = gzencode($payload);
664 655
 						header("Content-Encoding: gzip");
665 656
 						header("Vary: Accept-Encoding");
666
-					}
667
-					elseif (strpos($resp_encoding, 'deflate') !== false)
657
+					} elseif (strpos($resp_encoding, 'deflate') !== false)
668 658
 					{
669 659
 						$payload = gzcompress($payload);
670 660
 						header("Content-Encoding: deflate");
@@ -678,8 +668,7 @@  discard block
 block discarded – undo
678 668
 				{
679 669
 					header('Content-Length: ' . (int)strlen($payload));
680 670
 				}
681
-			}
682
-			else
671
+			} else
683 672
 			{
684 673
 				error_log('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
685 674
 			}
@@ -728,8 +717,7 @@  discard block
 block discarded – undo
728 717
 			if (is_object($in))
729 718
 			{
730 719
 				$numParams = $in->getNumParams();
731
-			}
732
-			else
720
+			} else
733 721
 			{
734 722
 				$numParams = count($in);
735 723
 			}
@@ -746,13 +734,11 @@  discard block
 block discarded – undo
746 734
 							if($p->kindOf() == 'scalar')
747 735
 							{
748 736
 								$pt=$p->scalartyp();
749
-							}
750
-							else
737
+							} else
751 738
 							{
752 739
 								$pt=$p->kindOf();
753 740
 							}
754
-						}
755
-						else
741
+						} else
756 742
 						{
757 743
 							$pt= $in[$n] == 'i4' ? 'int' : strtolower($in[$n]); // dispatch maps never use i4...
758 744
 						}
@@ -813,8 +799,7 @@  discard block
 block discarded – undo
813 799
 			if(isset($_SERVER['HTTP_CONTENT_ENCODING']))
814 800
 			{
815 801
 				$content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
816
-			}
817
-			else
802
+			} else
818 803
 			{
819 804
 				$content_encoding = '';
820 805
 			}
@@ -834,20 +819,18 @@  discard block
 block discarded – undo
834 819
 							{
835 820
 								$this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
836 821
 							}
837
-						}
838
-						elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
822
+						} elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
839 823
 						{
840 824
 							$data = $degzdata;
841
-							if($this->debug > 1)
842
-								$this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
843
-						}
844
-						else
825
+							if($this->debug > 1) {
826
+															$this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
827
+							}
828
+						} else
845 829
 						{
846 830
 							$r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']);
847 831
 							return $r;
848 832
 						}
849
-					}
850
-					else
833
+					} else
851 834
 					{
852 835
 						//error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
853 836
 						$r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']);
@@ -871,18 +854,19 @@  discard block
 block discarded – undo
871 854
 					$known_charsets = array($GLOBALS['xmlrpc_internalencoding'], 'UTF-8', 'ISO-8859-1', 'US-ASCII');
872 855
 					foreach ($known_charsets as $charset)
873 856
 					{
874
-						foreach ($client_accepted_charsets as $accepted)
875
-							if (strpos($accepted, $charset) === 0)
857
+						foreach ($client_accepted_charsets as $accepted) {
858
+													if (strpos($accepted, $charset) === 0)
876 859
 							{
877 860
 								$resp_encoding = $charset;
861
+						}
878 862
 								break;
879 863
 							}
880
-						if ($resp_encoding)
881
-							break;
864
+						if ($resp_encoding) {
865
+													break;
866
+						}
882 867
 					}
883 868
 				}
884
-			}
885
-			else
869
+			} else
886 870
 			{
887 871
 				$resp_encoding = $this->response_charset_encoding;
888 872
 			}
@@ -890,8 +874,7 @@  discard block
 block discarded – undo
890 874
 			if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
891 875
 			{
892 876
 				$resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING'];
893
-			}
894
-			else
877
+			} else
895 878
 			{
896 879
 				$resp_compression = '';
897 880
 			}
@@ -968,16 +951,16 @@  discard block
 block discarded – undo
968 951
 			if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
969 952
 			{
970 953
 				xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
971
-			}
972
-			else
954
+			} else
973 955
 			{
974 956
 				xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
975 957
 			}
976 958
 
977
-			if ($this->functions_parameters_type != 'xmlrpcvals')
978
-				xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
979
-			else
980
-				xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
959
+			if ($this->functions_parameters_type != 'xmlrpcvals') {
960
+							xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
961
+			} else {
962
+							xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
963
+			}
981 964
 			xml_set_character_data_handler($parser, 'xmlrpc_cd');
982 965
 			xml_set_default_handler($parser, 'xmlrpc_dh');
983 966
 			if(!xml_parse($parser, $data, 1))
@@ -989,15 +972,13 @@  discard block
 block discarded – undo
989 972
 					xml_error_string(xml_get_error_code($parser)),
990 973
 					xml_get_current_line_number($parser), xml_get_current_column_number($parser)));
991 974
 				xml_parser_free($parser);
992
-			}
993
-			elseif ($GLOBALS['_xh']['isf'])
975
+			} elseif ($GLOBALS['_xh']['isf'])
994 976
 			{
995 977
 				xml_parser_free($parser);
996 978
 				$r=new xmlrpcresp(0,
997 979
 					$GLOBALS['xmlrpcerr']['invalid_request'],
998 980
 					$GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']);
999
-			}
1000
-			else
981
+			} else
1001 982
 			{
1002 983
 				xml_parser_free($parser);
1003 984
 				// small layering violation in favor of speed and memory usage:
@@ -1011,8 +992,7 @@  discard block
 block discarded – undo
1011 992
 						$this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], true)."\n+++END+++");
1012 993
 					}
1013 994
 					$r = $this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], $GLOBALS['_xh']['pt']);
1014
-				}
1015
-				else
995
+				} else
1016 996
 				{
1017 997
 					// build an xmlrpcmsg object with data parsed from xml
1018 998
 					$m=new xmlrpcmsg($GLOBALS['_xh']['method']);
@@ -1045,8 +1025,7 @@  discard block
 block discarded – undo
1045 1025
 			if (is_object($m))
1046 1026
 			{
1047 1027
 				$methName = $m->method();
1048
-			}
1049
-			else
1028
+			} else
1050 1029
 			{
1051 1030
 				$methName = $m;
1052 1031
 			}
@@ -1068,8 +1047,7 @@  discard block
 block discarded – undo
1068 1047
 				if (is_object($m))
1069 1048
 				{
1070 1049
 					list($ok, $errstr) = $this->verifySignature($m, $sig);
1071
-				}
1072
-				else
1050
+				} else
1073 1051
 				{
1074 1052
 					list($ok, $errstr) = $this->verifySignature($paramtypes, $sig);
1075 1053
 				}
@@ -1115,8 +1093,7 @@  discard block
 block discarded – undo
1115 1093
 					if ($sysCall)
1116 1094
 					{
1117 1095
 						$r = call_user_func($func, $this, $m);
1118
-					}
1119
-					else
1096
+					} else
1120 1097
 					{
1121 1098
 						$r = call_user_func($func, $m);
1122 1099
 					}
@@ -1126,8 +1103,7 @@  discard block
 block discarded – undo
1126 1103
 						if (is_a($r, 'xmlrpcval'))
1127 1104
 						{
1128 1105
 							$r = new xmlrpcresp($r);
1129
-						}
1130
-						else
1106
+						} else
1131 1107
 						{
1132 1108
 							$r = new xmlrpcresp(
1133 1109
 								0,
@@ -1136,16 +1112,14 @@  discard block
 block discarded – undo
1136 1112
 							);
1137 1113
 						}
1138 1114
 					}
1139
-				}
1140
-				else
1115
+				} else
1141 1116
 				{
1142 1117
 					// call a 'plain php' function
1143 1118
 					if($sysCall)
1144 1119
 					{
1145 1120
 						array_unshift($params, $this);
1146 1121
 						$r = call_user_func_array($func, $params);
1147
-					}
1148
-					else
1122
+					} else
1149 1123
 					{
1150 1124
 						// 3rd API convention for method-handling functions: EPI-style
1151 1125
 						if ($this->functions_parameters_type == 'epivals')
@@ -1156,15 +1130,13 @@  discard block
 block discarded – undo
1156 1130
 							if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r))
1157 1131
 							{
1158 1132
 								$r = new xmlrpcresp(0, (integer)$r['faultCode'], (string)$r['faultString']);
1159
-							}
1160
-							else
1133
+							} else
1161 1134
 							{
1162 1135
 								// functions using EPI api should NOT return resp objects,
1163 1136
 								// so make sure we encode the return type correctly
1164 1137
 								$r = new xmlrpcresp(php_xmlrpc_encode($r, array('extension_api')));
1165 1138
 							}
1166
-						}
1167
-						else
1139
+						} else
1168 1140
 						{
1169 1141
 							$r = call_user_func_array($func, $params);
1170 1142
 						}
@@ -1177,8 +1149,7 @@  discard block
 block discarded – undo
1177 1149
 						$r = new xmlrpcresp(php_xmlrpc_encode($r, $this->phpvals_encoding_options));
1178 1150
 					}
1179 1151
 				}
1180
-			}
1181
-			catch(Exception $e)
1152
+			} catch(Exception $e)
1182 1153
 			{
1183 1154
 				// (barring errors in the lib) an uncatched exception happened
1184 1155
 				// in the called function, we wrap it in a proper error-response
@@ -1201,8 +1172,7 @@  discard block
 block discarded – undo
1201 1172
 				if($GLOBALS['_xmlrpcs_prev_ehandler'])
1202 1173
 				{
1203 1174
 					set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);
1204
-				}
1205
-				else
1175
+				} else
1206 1176
 				{
1207 1177
 					restore_error_handler();
1208 1178
 				}
@@ -1228,8 +1198,7 @@  discard block
 block discarded – undo
1228 1198
 			if ($charset_encoding != '')
1229 1199
 			{
1230 1200
 				return "<?xml version=\"1.0\" encoding=\"$charset_encoding\"?" . ">\n";
1231
-			}
1232
-			else
1201
+			} else
1233 1202
 			{
1234 1203
 				return "<?xml version=\"1.0\"?" . ">\n";
1235 1204
 			}
Please login to merge, or discard this patch.