Passed
Push — master ( 9698e0...1a6dcb )
by
unknown
03:06
created
Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc 1 patch
Braces   +170 added lines, -239 removed lines patch added patch discarded remove patch
@@ -403,14 +403,12 @@  discard block
 block discarded – undo
403 403
 					$GLOBALS['_xh']['isf'] = 2;
404 404
 					$GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';
405 405
 					return;
406
-				}
407
-				else
406
+				} else
408 407
 				{
409 408
 					$GLOBALS['_xh']['rt'] = strtolower($name);
410 409
 					$GLOBALS['_xh']['rt'] = strtolower($name);
411 410
 				}
412
-			}
413
-			else
411
+			} else
414 412
 			{
415 413
 				// not top level element: see if parent is OK
416 414
 				$parent = end($GLOBALS['_xh']['stack']);
@@ -566,21 +564,20 @@  discard block
 block discarded – undo
566 564
 						$temp = new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
567 565
 						// in case we got info about underlying php class, save it
568 566
 						// in the object we're rebuilding
569
-						if (isset($GLOBALS['_xh']['php_class']))
570
-							$temp->_php_class = $GLOBALS['_xh']['php_class'];
567
+						if (isset($GLOBALS['_xh']['php_class'])) {
568
+													$temp->_php_class = $GLOBALS['_xh']['php_class'];
569
+						}
571 570
 						// check if we are inside an array or struct:
572 571
 						// if value just built is inside an array, let's move it into array on the stack
573 572
 						$vscount = count($GLOBALS['_xh']['valuestack']);
574 573
 						if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
575 574
 						{
576 575
 							$GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;
577
-						}
578
-						else
576
+						} else
579 577
 						{
580 578
 							$GLOBALS['_xh']['value'] = $temp;
581 579
 						}
582
-					}
583
-					else
580
+					} else
584 581
 					{
585 582
 						/// @todo this needs to treat correctly php-serialized objects,
586 583
 						/// since std deserializing is done by php_xmlrpc_decode,
@@ -611,8 +608,7 @@  discard block
 block discarded – undo
611 608
 					if ($name=='STRING')
612 609
 					{
613 610
 						$GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
614
-					}
615
-					elseif ($name=='DATETIME.ISO8601')
611
+					} elseif ($name=='DATETIME.ISO8601')
616 612
 					{
617 613
 						if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac']))
618 614
 						{
@@ -620,13 +616,11 @@  discard block
 block discarded – undo
620 616
 						}
621 617
 						$GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];
622 618
 						$GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
623
-					}
624
-					elseif ($name=='BASE64')
619
+					} elseif ($name=='BASE64')
625 620
 					{
626 621
 						/// @todo check for failure of base64 decoding / catch warnings
627 622
 						$GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);
628
-					}
629
-					elseif ($name=='BOOLEAN')
623
+					} elseif ($name=='BOOLEAN')
630 624
 					{
631 625
 						// special case here: we translate boolean 1 or 0 into PHP
632 626
 						// constants true or false.
@@ -637,16 +631,15 @@  discard block
 block discarded – undo
637 631
 						if ($GLOBALS['_xh']['ac']=='1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0)
638 632
 						{
639 633
 							$GLOBALS['_xh']['value']=true;
640
-						}
641
-						else
634
+						} else
642 635
 						{
643 636
 							// log if receiveing something strange, even though we set the value to false anyway
644
-							if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($GLOBALS['_xh']['ac'], 'false') != 0)
645
-								error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
637
+							if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($GLOBALS['_xh']['ac'], 'false') != 0) {
638
+															error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
639
+							}
646 640
 							$GLOBALS['_xh']['value']=false;
647 641
 						}
648
-					}
649
-					elseif ($name=='DOUBLE')
642
+					} elseif ($name=='DOUBLE')
650 643
 					{
651 644
 						// we have a DOUBLE
652 645
 						// we must check that only 0123456789-.<space> are characters here
@@ -656,14 +649,12 @@  discard block
 block discarded – undo
656 649
 							/// @todo: find a better way of throwing an error than this!
657 650
 							error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);
658 651
 							$GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
659
-						}
660
-						else
652
+						} else
661 653
 						{
662 654
 							// it's ok, add it on
663 655
 							$GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];
664 656
 						}
665
-					}
666
-					else
657
+					} else
667 658
 					{
668 659
 						// we have an I4/INT
669 660
 						// we must check that only 0123456789-<space> are characters here
@@ -672,8 +663,7 @@  discard block
 block discarded – undo
672 663
 							/// @todo find a better way of throwing an error than this!
673 664
 							error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']);
674 665
 							$GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
675
-						}
676
-						else
666
+						} else
677 667
 						{
678 668
 							// it's ok, add it on
679 669
 							$GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];
@@ -693,8 +683,9 @@  discard block
 block discarded – undo
693 683
 					{
694 684
 						$vscount = count($GLOBALS['_xh']['valuestack']);
695 685
 						$GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value'];
696
-					} else
697
-						error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
686
+					} else {
687
+											error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
688
+					}
698 689
 					break;
699 690
 				case 'DATA':
700 691
 					//$GLOBALS['_xh']['ac']=''; // is this necessary?
@@ -718,9 +709,9 @@  discard block
 block discarded – undo
718 709
 					{
719 710
 						$GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];
720 711
 						$GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];
712
+					} else {
713
+											error_log('XML-RPC: missing VALUE inside PARAM in received xml');
721 714
 					}
722
-					else
723
-						error_log('XML-RPC: missing VALUE inside PARAM in received xml');
724 715
 					break;
725 716
 				case 'METHODNAME':
726 717
 					$GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']);
@@ -908,8 +899,7 @@  discard block
 block discarded – undo
908 899
 			if($path == '' || $path[0] != '/')
909 900
 			{
910 901
 				$this->path='/'.$path;
911
-			}
912
-			else
902
+			} else
913 903
 			{
914 904
 				$this->path=$path;
915 905
 			}
@@ -990,8 +980,7 @@  discard block
 block discarded – undo
990 980
 			if ($is_dir)
991 981
 			{
992 982
 				$this->cacertdir = $cacert;
993
-			}
994
-			else
983
+			} else
995 984
 			{
996 985
 				$this->cacert = $cacert;
997 986
 			}
@@ -1059,10 +1048,11 @@  discard block
 block discarded – undo
1059 1048
 		*/
1060 1049
 		function setAcceptedCompression($compmethod)
1061 1050
 		{
1062
-			if ($compmethod == 'any')
1063
-				$this->accepted_compression = array('gzip', 'deflate');
1064
-			else
1065
-				$this->accepted_compression = array($compmethod);
1051
+			if ($compmethod == 'any') {
1052
+							$this->accepted_compression = array('gzip', 'deflate');
1053
+			} else {
1054
+							$this->accepted_compression = array($compmethod);
1055
+			}
1066 1056
 		}
1067 1057
 
1068 1058
 		/**
@@ -1099,8 +1089,7 @@  discard block
 block discarded – undo
1099 1089
 				$this->cookies[$name]['domain'] = $domain;
1100 1090
 				$this->cookies[$name]['port'] = $port;
1101 1091
 				$this->cookies[$name]['version'] = 1;
1102
-			}
1103
-			else
1092
+			} else
1104 1093
 			{
1105 1094
 				$this->cookies[$name]['version'] = 0;
1106 1095
 			}
@@ -1147,8 +1136,7 @@  discard block
 block discarded – undo
1147 1136
 				// $msg is an array of xmlrpcmsg's
1148 1137
 				$r = $this->multicall($msg, $timeout, $method);
1149 1138
 				return $r;
1150
-			}
1151
-			elseif(is_string($msg))
1139
+			} elseif(is_string($msg))
1152 1140
 			{
1153 1141
 				$n = new xmlrpcmsg('');
1154 1142
 				$n->payload = $msg;
@@ -1181,8 +1169,7 @@  discard block
 block discarded – undo
1181 1169
 					$this->key,
1182 1170
 					$this->keypass
1183 1171
 				);
1184
-			}
1185
-			elseif($method == 'http11')
1172
+			} elseif($method == 'http11')
1186 1173
 			{
1187 1174
 				$r =& $this->sendPayloadCURL(
1188 1175
 					$msg,
@@ -1204,8 +1191,7 @@  discard block
 block discarded – undo
1204 1191
 					'http',
1205 1192
 					$this->keepalive
1206 1193
 				);
1207
-			}
1208
-			else
1194
+			} else
1209 1195
 			{
1210 1196
 				$r =& $this->sendPayloadHTTP10(
1211 1197
 					$msg,
@@ -1256,8 +1242,7 @@  discard block
 block discarded – undo
1256 1242
 						$payload = $a;
1257 1243
 						$encoding_hdr = "Content-Encoding: gzip\r\n";
1258 1244
 					}
1259
-				}
1260
-				else
1245
+				} else
1261 1246
 				{
1262 1247
 					$a = @gzcompress($payload);
1263 1248
 					if($a)
@@ -1266,8 +1251,7 @@  discard block
 block discarded – undo
1266 1251
 						$encoding_hdr = "Content-Encoding: deflate\r\n";
1267 1252
 					}
1268 1253
 				}
1269
-			}
1270
-			else
1254
+			} else
1271 1255
 			{
1272 1256
 				$encoding_hdr = '';
1273 1257
 			}
@@ -1307,8 +1291,7 @@  discard block
 block discarded – undo
1307 1291
 					}
1308 1292
 					$proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n";
1309 1293
 				}
1310
-			}
1311
-			else
1294
+			} else
1312 1295
 			{
1313 1296
 				$connectserver = $server;
1314 1297
 				$connectport = $port;
@@ -1327,14 +1310,16 @@  discard block
 block discarded – undo
1327 1310
 					{
1328 1311
 						$version = ' $Version="' . $cookie['version'] . '";';
1329 1312
 						$cookieheader .= ' ' . $name . '="' . $cookie['value'] . '";';
1330
-						if ($cookie['path'])
1331
-							$cookieheader .= ' $Path="' . $cookie['path'] . '";';
1332
-						if ($cookie['domain'])
1333
-							$cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
1334
-						if ($cookie['port'])
1335
-							$cookieheader .= ' $Port="' . $cookie['port'] . '";';
1336
-					}
1337
-					else
1313
+						if ($cookie['path']) {
1314
+													$cookieheader .= ' $Path="' . $cookie['path'] . '";';
1315
+						}
1316
+						if ($cookie['domain']) {
1317
+													$cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
1318
+						}
1319
+						if ($cookie['port']) {
1320
+													$cookieheader .= ' $Port="' . $cookie['port'] . '";';
1321
+						}
1322
+					} else
1338 1323
 					{
1339 1324
 						$cookieheader .= ' ' . $name . '=' . $cookie['value'] . ";";
1340 1325
 					}
@@ -1365,8 +1350,7 @@  discard block
 block discarded – undo
1365 1350
 			if($timeout>0)
1366 1351
 			{
1367 1352
 				$fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);
1368
-			}
1369
-			else
1353
+			} else
1370 1354
 			{
1371 1355
 				$fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr);
1372 1356
 			}
@@ -1376,8 +1360,7 @@  discard block
 block discarded – undo
1376 1360
 				{
1377 1361
 					stream_set_timeout($fp, $timeout);
1378 1362
 				}
1379
-			}
1380
-			else
1363
+			} else
1381 1364
 			{
1382 1365
 				$this->errstr='Connect error: '.$this->errstr;
1383 1366
 				$r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
@@ -1390,8 +1373,7 @@  discard block
 block discarded – undo
1390 1373
 				$this->errstr='Write error';
1391 1374
 				$r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
1392 1375
 				return $r;
1393
-			}
1394
-			else
1376
+			} else
1395 1377
 			{
1396 1378
 				// reset errno and errstr on succesful socket connection
1397 1379
 				$this->errstr = '';
@@ -1458,8 +1440,7 @@  discard block
 block discarded – undo
1458 1440
 				if($method == 'http')
1459 1441
 				{
1460 1442
 					$port = 80;
1461
-				}
1462
-				else
1443
+				} else
1463 1444
 				{
1464 1445
 					$port = 443;
1465 1446
 				}
@@ -1483,8 +1464,7 @@  discard block
 block discarded – undo
1483 1464
 						$payload = $a;
1484 1465
 						$encoding_hdr = 'Content-Encoding: gzip';
1485 1466
 					}
1486
-				}
1487
-				else
1467
+				} else
1488 1468
 				{
1489 1469
 					$a = @gzcompress($payload);
1490 1470
 					if($a)
@@ -1493,8 +1473,7 @@  discard block
 block discarded – undo
1493 1473
 						$encoding_hdr = 'Content-Encoding: deflate';
1494 1474
 					}
1495 1475
 				}
1496
-			}
1497
-			else
1476
+			} else
1498 1477
 			{
1499 1478
 				$encoding_hdr = '';
1500 1479
 			}
@@ -1513,8 +1492,7 @@  discard block
 block discarded – undo
1513 1492
 				{
1514 1493
 					$this->xmlrpc_curl_handle = $curl;
1515 1494
 				}
1516
-			}
1517
-			else
1495
+			} else
1518 1496
 			{
1519 1497
 				$curl = $this->xmlrpc_curl_handle;
1520 1498
 			}
@@ -1546,9 +1524,9 @@  discard block
 block discarded – undo
1546 1524
 				if (count($this->accepted_compression) == 1)
1547 1525
 				{
1548 1526
 					curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]);
1527
+				} else {
1528
+									curl_setopt($curl, CURLOPT_ENCODING, '');
1549 1529
 				}
1550
-				else
1551
-					curl_setopt($curl, CURLOPT_ENCODING, '');
1552 1530
 			}
1553 1531
 			// extra headers
1554 1532
 			$headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
@@ -1576,8 +1554,7 @@  discard block
 block discarded – undo
1576 1554
 				if (defined('CURLOPT_HTTPAUTH'))
1577 1555
 				{
1578 1556
 					curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype);
1579
-				}
1580
-				else if ($authtype != 1)
1557
+				} else if ($authtype != 1)
1581 1558
 				{
1582 1559
 					error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
1583 1560
 				}
@@ -1635,8 +1612,7 @@  discard block
 block discarded – undo
1635 1612
 					if (defined('CURLOPT_PROXYAUTH'))
1636 1613
 					{
1637 1614
 						curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyauthtype);
1638
-					}
1639
-					else if ($proxyauthtype != 1)
1615
+					} else if ($proxyauthtype != 1)
1640 1616
 					{
1641 1617
 						error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1642 1618
 					}
@@ -1666,22 +1642,24 @@  discard block
 block discarded – undo
1666 1642
 			if ($this->debug > 1)
1667 1643
 			{
1668 1644
 				print "<PRE>\n---CURL INFO---\n";
1669
-				foreach(curl_getinfo($curl) as $name => $val)
1670
-					 print $name . ': ' . htmlentities($val). "\n";
1645
+				foreach(curl_getinfo($curl) as $name => $val) {
1646
+									 print $name . ': ' . htmlentities($val). "\n";
1647
+				}
1671 1648
 				print "---END---\n</PRE>";
1672 1649
 			}
1673 1650
 
1674
-			if(!$result) /// @todo we should use a better check here - what if we get back '' or '0'?
1651
+			if(!$result) {
1652
+			    /// @todo we should use a better check here - what if we get back '' or '0'?
1675 1653
 			{
1676 1654
 				$this->errstr='no response';
1655
+			}
1677 1656
 				$resp=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl));
1678 1657
 				curl_close($curl);
1679 1658
 				if($keepalive)
1680 1659
 				{
1681 1660
 					$this->xmlrpc_curl_handle = null;
1682 1661
 				}
1683
-			}
1684
-			else
1662
+			} else
1685 1663
 			{
1686 1664
 				if(!$keepalive)
1687 1665
 				{
@@ -1727,8 +1705,7 @@  discard block
 block discarded – undo
1727 1705
 				{
1728 1706
 					// System.multicall succeeded
1729 1707
 					return $results;
1730
-				}
1731
-				else
1708
+				} else
1732 1709
 				{
1733 1710
 					// either system.multicall is unsupported by server,
1734 1711
 					// or call failed for some other reason.
@@ -1736,21 +1713,18 @@  discard block
 block discarded – undo
1736 1713
 					{
1737 1714
 						// Don't try it next time...
1738 1715
 						$this->no_multicall = true;
1739
-					}
1740
-					else
1716
+					} else
1741 1717
 					{
1742 1718
 						if (is_a($results, 'xmlrpcresp'))
1743 1719
 						{
1744 1720
 							$result = $results;
1745
-						}
1746
-						else
1721
+						} else
1747 1722
 						{
1748 1723
 							$result = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);
1749 1724
 						}
1750 1725
 					}
1751 1726
 				}
1752
-			}
1753
-			else
1727
+			} else
1754 1728
 			{
1755 1729
 				// override fallback, in case careless user tries to do two
1756 1730
 				// opposite things at the same time
@@ -1766,8 +1740,7 @@  discard block
 block discarded – undo
1766 1740
 				{
1767 1741
 					$results[] =& $this->send($msg, $timeout, $method);
1768 1742
 				}
1769
-			}
1770
-			else
1743
+			} else
1771 1744
 			{
1772 1745
 				// user does NOT want to fallback on many single calls:
1773 1746
 				// since we should always return an array of responses,
@@ -1820,8 +1793,7 @@  discard block
 block discarded – undo
1820 1793
 			if ($this->return_type == 'xml')
1821 1794
 			{
1822 1795
 					return $rets;
1823
-			}
1824
-			else if ($this->return_type == 'phpvals')
1796
+			} else if ($this->return_type == 'phpvals')
1825 1797
 			{
1826 1798
 				///@todo test this code branch...
1827 1799
 				$rets = $result->value();
@@ -1871,8 +1843,7 @@  discard block
 block discarded – undo
1871 1843
 					}
1872 1844
 				}
1873 1845
 				return $response;
1874
-			}
1875
-			else // return type == 'xmlrpcvals'
1846
+			} else // return type == 'xmlrpcvals'
1876 1847
 			{
1877 1848
 				$rets = $result->value();
1878 1849
 				if($rets->kindOf() != 'array')
@@ -1951,8 +1922,7 @@  discard block
 block discarded – undo
1951 1922
 				$this->errno = $fcode;
1952 1923
 				$this->errstr = $fstr;
1953 1924
 				//$this->errstr = htmlspecialchars($fstr); // XXX: encoding probably shouldn't be done here; fix later.
1954
-			}
1955
-			else
1925
+			} else
1956 1926
 			{
1957 1927
 				// successful response
1958 1928
 				$this->val = $val;
@@ -1962,18 +1932,15 @@  discard block
 block discarded – undo
1962 1932
 					if (is_object($this->val) && is_a($this->val, 'xmlrpcval'))
1963 1933
 					{
1964 1934
 						$this->valtyp = 'xmlrpcvals';
1965
-					}
1966
-					else if (is_string($this->val))
1935
+					} else if (is_string($this->val))
1967 1936
 					{
1968 1937
 						$this->valtyp = 'xml';
1969 1938
 
1970
-					}
1971
-					else
1939
+					} else
1972 1940
 					{
1973 1941
 						$this->valtyp = 'phpvals';
1974 1942
 					}
1975
-				}
1976
-				else
1943
+				} else
1977 1944
 				{
1978 1945
 					// user declares type of resp value: believe him
1979 1946
 					$this->valtyp = $valtyp;
@@ -2035,10 +2002,11 @@  discard block
 block discarded – undo
2035 2002
 		*/
2036 2003
 		function serialize($charset_encoding='')
2037 2004
 		{
2038
-			if ($charset_encoding != '')
2039
-				$this->content_type = 'text/xml; charset=' . $charset_encoding;
2040
-			else
2041
-				$this->content_type = 'text/xml';
2005
+			if ($charset_encoding != '') {
2006
+							$this->content_type = 'text/xml; charset=' . $charset_encoding;
2007
+			} else {
2008
+							$this->content_type = 'text/xml';
2009
+			}
2042 2010
 			$result = "<methodResponse>\n";
2043 2011
 			if($this->errno)
2044 2012
 			{
@@ -2049,8 +2017,7 @@  discard block
 block discarded – undo
2049 2017
 "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
2050 2018
 xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .
2051 2019
 "</struct>\n</value>\n</fault>";
2052
-			}
2053
-			else
2020
+			} else
2054 2021
 			{
2055 2022
 				if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))
2056 2023
 				{
@@ -2059,14 +2026,12 @@  discard block
 block discarded – undo
2059 2026
 						$result .= "<params>\n<param>\n" .
2060 2027
 							$this->val .
2061 2028
 							"</param>\n</params>";
2062
-					}
2063
-					else
2029
+					} else
2064 2030
 					{
2065 2031
 						/// @todo try to build something serializable?
2066 2032
 						die('cannot serialize xmlrpcresp objects whose content is native php values');
2067 2033
 					}
2068
-				}
2069
-				else
2034
+				} else
2070 2035
 				{
2071 2036
 					$result .= "<params>\n<param>\n" .
2072 2037
 						$this->val->serialize($charset_encoding) .
@@ -2111,8 +2076,7 @@  discard block
 block discarded – undo
2111 2076
 			if ($charset_encoding != '')
2112 2077
 			{
2113 2078
 				return "<?xml version=\"1.0\" encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n";
2114
-			}
2115
-			else
2079
+			} else
2116 2080
 			{
2117 2081
 				return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
2118 2082
 			}
@@ -2139,10 +2103,11 @@  discard block
 block discarded – undo
2139 2103
 		*/
2140 2104
 		function createPayload($charset_encoding='')
2141 2105
 		{
2142
-			if ($charset_encoding != '')
2143
-				$this->content_type = 'text/xml; charset=' . $charset_encoding;
2144
-			else
2145
-				$this->content_type = 'text/xml';
2106
+			if ($charset_encoding != '') {
2107
+							$this->content_type = 'text/xml; charset=' . $charset_encoding;
2108
+			} else {
2109
+							$this->content_type = 'text/xml';
2110
+			}
2146 2111
 			$this->payload=$this->xml_header($charset_encoding);
2147 2112
 			$this->payload.='<methodName>' . $this->methodname . "</methodName>\n";
2148 2113
 			$this->payload.="<params>\n";
@@ -2195,8 +2160,7 @@  discard block
 block discarded – undo
2195 2160
 			{
2196 2161
 				$this->params[]=$par;
2197 2162
 				return true;
2198
-			}
2199
-			else
2163
+			} else
2200 2164
 			{
2201 2165
 				return false;
2202 2166
 			}
@@ -2256,15 +2220,13 @@  discard block
 block discarded – undo
2256 2220
 					if($pos || is_int($pos))
2257 2221
 					{
2258 2222
 						$bd = $pos+4;
2259
-					}
2260
-					else
2223
+					} else
2261 2224
 					{
2262 2225
 						$pos = strpos($data,"\n\n");
2263 2226
 						if($pos || is_int($pos))
2264 2227
 						{
2265 2228
 							$bd = $pos+2;
2266
-						}
2267
-						else
2229
+						} else
2268 2230
 						{
2269 2231
 							// No separation between response headers and body: fault?
2270 2232
 							$bd = 0;
@@ -2275,8 +2237,7 @@  discard block
 block discarded – undo
2275 2237
 						// this filters out all http headers from proxy.
2276 2238
 						// maybe we could take them into account, too?
2277 2239
 						$data = substr($data, $bd);
2278
-					}
2279
-					else
2240
+					} else
2280 2241
 					{
2281 2242
 						error_log('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
2282 2243
 						$r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (HTTPS via proxy error, tunnel connection possibly failed)');
@@ -2290,10 +2251,12 @@  discard block
 block discarded – undo
2290 2251
 					$pos = strpos($data, 'HTTP', 12);
2291 2252
 					// server sent a Continue header without any (valid) content following...
2292 2253
 					// give the client a chance to know it
2293
-					if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5
2254
+					if(!$pos && !is_int($pos)) {
2255
+					    // works fine in php 3, 4 and 5
2294 2256
 					{
2295 2257
 						break;
2296 2258
 					}
2259
+					}
2297 2260
 					$data = substr($data, $pos);
2298 2261
 				}
2299 2262
 				if(!preg_match('/^HTTP\/[0-9.]+ 200 /', $data))
@@ -2313,15 +2276,13 @@  discard block
 block discarded – undo
2313 2276
 				if($pos || is_int($pos))
2314 2277
 				{
2315 2278
 					$bd = $pos+4;
2316
-				}
2317
-				else
2279
+				} else
2318 2280
 				{
2319 2281
 					$pos = strpos($data,"\n\n");
2320 2282
 					if($pos || is_int($pos))
2321 2283
 					{
2322 2284
 						$bd = $pos+2;
2323
-					}
2324
-					else
2285
+					} else
2325 2286
 					{
2326 2287
 						// No separation between response headers and body: fault?
2327 2288
 						// we could take some action here instead of going on...
@@ -2348,8 +2309,7 @@  discard block
 block discarded – undo
2348 2309
 								// version 2 cookies:
2349 2310
 								// there could be many cookies on one line, comma separated
2350 2311
 								$cookies = explode(',', $arr[1]);
2351
-							}
2352
-							else
2312
+							} else
2353 2313
 							{
2354 2314
 								$cookies = array($arr[1]);
2355 2315
 							}
@@ -2357,10 +2317,11 @@  discard block
 block discarded – undo
2357 2317
 							{
2358 2318
 								// glue together all received cookies, using a comma to separate them
2359 2319
 								// (same as php does with getallheaders())
2360
-								if (isset($GLOBALS['_xh']['headers'][$header_name]))
2361
-									$GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);
2362
-								else
2363
-									$GLOBALS['_xh']['headers'][$header_name] = trim($cookie);
2320
+								if (isset($GLOBALS['_xh']['headers'][$header_name])) {
2321
+																	$GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);
2322
+								} else {
2323
+																	$GLOBALS['_xh']['headers'][$header_name] = trim($cookie);
2324
+								}
2364 2325
 								// parse cookie attributes, in case user wants to correctly honour them
2365 2326
 								// feature creep: only allow rfc-compliant cookie attributes?
2366 2327
 								// @todo support for server sending multiple time cookie with same name, but using different PATHs
@@ -2376,8 +2337,7 @@  discard block
 block discarded – undo
2376 2337
 										$cookiename = $tag;
2377 2338
 										$GLOBALS['_xh']['cookies'][$tag] = array();
2378 2339
 										$GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
2379
-									}
2380
-									else
2340
+									} else
2381 2341
 									{
2382 2342
 										if ($tag != 'value')
2383 2343
 										{
@@ -2386,13 +2346,11 @@  discard block
 block discarded – undo
2386 2346
 									}
2387 2347
 								}
2388 2348
 							}
2389
-						}
2390
-						else
2349
+						} else
2391 2350
 						{
2392 2351
 							$GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
2393 2352
 						}
2394
-					}
2395
-					elseif(isset($header_name))
2353
+					} elseif(isset($header_name))
2396 2354
 					{
2397 2355
 						///	@todo version1 cookies might span multiple lines, thus breaking the parsing above
2398 2356
 						$GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
@@ -2443,23 +2401,22 @@  discard block
 block discarded – undo
2443 2401
 								if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data))
2444 2402
 								{
2445 2403
 									$data = $degzdata;
2446
-									if($this->debug)
2447
-									print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
2448
-								}
2449
-								elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
2404
+									if($this->debug) {
2405
+																		print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
2406
+									}
2407
+								} elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
2450 2408
 								{
2451 2409
 									$data = $degzdata;
2452
-									if($this->debug)
2453
-									print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
2454
-								}
2455
-								else
2410
+									if($this->debug) {
2411
+																		print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
2412
+									}
2413
+								} else
2456 2414
 								{
2457 2415
 									error_log('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
2458 2416
 									$r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);
2459 2417
 									return $r;
2460 2418
 								}
2461
-							}
2462
-							else
2419
+							} else
2463 2420
 							{
2464 2421
 								error_log('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
2465 2422
 								$r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);
@@ -2512,8 +2469,7 @@  discard block
 block discarded – undo
2512 2469
 					$r->raw_data = $data;
2513 2470
 					return $r;
2514 2471
 				}
2515
-			}
2516
-			else
2472
+			} else
2517 2473
 			{
2518 2474
 				$GLOBALS['_xh']['headers'] = array();
2519 2475
 				$GLOBALS['_xh']['cookies'] = array();
@@ -2567,12 +2523,13 @@  discard block
 block discarded – undo
2567 2523
 
2568 2524
 			// if response charset encoding is not known / supported, try to use
2569 2525
 			// the default encoding and parse the xml anyway, but log a warning...
2570
-			if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
2571
-			// the following code might be better for mb_string enabled installs, but
2526
+			if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
2527
+						// the following code might be better for mb_string enabled installs, but
2572 2528
 			// makes the lib about 200% slower...
2573 2529
 			//if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
2574 2530
 			{
2575 2531
 				error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$resp_encoding);
2532
+			}
2576 2533
 				$resp_encoding = $GLOBALS['xmlrpc_defencoding'];
2577 2534
 			}
2578 2535
 			$parser = xml_parser_create($resp_encoding);
@@ -2586,8 +2543,7 @@  discard block
 block discarded – undo
2586 2543
 			if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
2587 2544
 			{
2588 2545
 				xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
2589
-			}
2590
-			else
2546
+			} else
2591 2547
 			{
2592 2548
 				xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
2593 2549
 			}
@@ -2595,8 +2551,7 @@  discard block
 block discarded – undo
2595 2551
 			if ($return_type == 'phpvals')
2596 2552
 			{
2597 2553
 				xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
2598
-			}
2599
-			else
2554
+			} else
2600 2555
 			{
2601 2556
 				xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
2602 2557
 			}
@@ -2611,8 +2566,7 @@  discard block
 block discarded – undo
2611 2566
 				if((xml_get_current_line_number($parser)) == 1)
2612 2567
 				{
2613 2568
 					$errstr = 'XML error at line 1, check URL';
2614
-				}
2615
-				else
2569
+				} else
2616 2570
 				{
2617 2571
 					$errstr = sprintf('XML error: %s at line %d, column %d',
2618 2572
 						xml_error_string(xml_get_error_code($parser)),
@@ -2651,8 +2605,7 @@  discard block
 block discarded – undo
2651 2605
 				// indicating something odd went on
2652 2606
 				$r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
2653 2607
 					$GLOBALS['xmlrpcstr']['invalid_return']);
2654
-			}
2655
-			else
2608
+			} else
2656 2609
 			{
2657 2610
 				if ($this->debug)
2658 2611
 				{
@@ -2676,8 +2629,7 @@  discard block
 block discarded – undo
2676 2629
 						$errstr_v = $v->structmem('faultString');
2677 2630
 						$errno = $errno_v->scalarval();
2678 2631
 						$errstr = $errstr_v->scalarval();
2679
-					}
2680
-					else
2632
+					} else
2681 2633
 					{
2682 2634
 						$errno = $v['faultCode'];
2683 2635
 						$errstr = $v['faultString'];
@@ -2690,8 +2642,7 @@  discard block
 block discarded – undo
2690 2642
 					}
2691 2643
 
2692 2644
 					$r = new xmlrpcresp(0, $errno, $errstr);
2693
-				}
2694
-				else
2645
+				} else
2695 2646
 				{
2696 2647
 					$r=new xmlrpcresp($v, 0, '', $return_type);
2697 2648
 				}
@@ -2791,8 +2742,7 @@  discard block
 block discarded – undo
2791 2742
 				if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false')))
2792 2743
 				{
2793 2744
 					$val=true;
2794
-				}
2795
-				else
2745
+				} else
2796 2746
 				{
2797 2747
 					$val=false;
2798 2748
 				}
@@ -2837,14 +2787,12 @@  discard block
 block discarded – undo
2837 2787
 				$this->mytype=$GLOBALS['xmlrpcTypes']['array'];
2838 2788
 				$this->me['array']=$vals;
2839 2789
 				return 1;
2840
-			}
2841
-			elseif($this->mytype==2)
2790
+			} elseif($this->mytype==2)
2842 2791
 			{
2843 2792
 				// we're adding to an array here
2844 2793
 				$this->me['array'] = array_merge($this->me['array'], $vals);
2845 2794
 				return 1;
2846
-			}
2847
-			else
2795
+			} else
2848 2796
 			{
2849 2797
 				error_log('XML-RPC: '.__METHOD__.': already initialized as a [' . $this->kindOf() . ']');
2850 2798
 				return 0;
@@ -2866,14 +2814,12 @@  discard block
 block discarded – undo
2866 2814
 				$this->mytype=$GLOBALS['xmlrpcTypes']['struct'];
2867 2815
 				$this->me['struct']=$vals;
2868 2816
 				return 1;
2869
-			}
2870
-			elseif($this->mytype==3)
2817
+			} elseif($this->mytype==3)
2871 2818
 			{
2872 2819
 				// we're adding to a struct here
2873 2820
 				$this->me['struct'] = array_merge($this->me['struct'], $vals);
2874 2821
 				return 1;
2875
-			}
2876
-			else
2822
+			} else
2877 2823
 			{
2878 2824
 				error_log('XML-RPC: '.__METHOD__.': already initialized as a [' . $this->kindOf() . ']');
2879 2825
 				return 0;
@@ -2977,8 +2923,7 @@  discard block
 block discarded – undo
2977 2923
 							if ($GLOBALS['xmlrpc_null_apache_encoding'])
2978 2924
 							{
2979 2925
 								$rs.="<ex:nil/>";
2980
-							}
2981
-							else
2926
+							} else
2982 2927
 							{
2983 2928
 								$rs.="<nil/>";
2984 2929
 							}
@@ -2994,8 +2939,7 @@  discard block
 block discarded – undo
2994 2939
 					if ($this->_php_class)
2995 2940
 					{
2996 2941
 						$rs.='<struct php_class="' . $this->_php_class . "\">\n";
2997
-					}
2998
-					else
2942
+					} else
2999 2943
 					{
3000 2944
 						$rs.="<struct>\n";
3001 2945
 					}
@@ -3223,16 +3167,14 @@  discard block
 block discarded – undo
3223 3167
 		if(!$utc)
3224 3168
 		{
3225 3169
 			$t=strftime("%Y%m%dT%H:%M:%S", $timet);
3226
-		}
3227
-		else
3170
+		} else
3228 3171
 		{
3229 3172
 			if(function_exists('gmstrftime'))
3230 3173
 			{
3231 3174
 				// gmstrftime doesn't exist in some versions
3232 3175
 				// of PHP
3233 3176
 				$t=gmstrftime("%Y%m%dT%H:%M:%S", $timet);
3234
-			}
3235
-			else
3177
+			} else
3236 3178
 			{
3237 3179
 				$t=strftime("%Y%m%dT%H:%M:%S", $timet-date('Z'));
3238 3180
 			}
@@ -3254,8 +3196,7 @@  discard block
 block discarded – undo
3254 3196
 			if($utc)
3255 3197
 			{
3256 3198
 				$t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
3257
-			}
3258
-			else
3199
+			} else
3259 3200
 			{
3260 3201
 				$t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
3261 3202
 			}
@@ -3323,8 +3264,7 @@  discard block
 block discarded – undo
3323 3264
 						$result = new Datetime();
3324 3265
 						$result->setTimestamp($out);
3325 3266
 						return $result;
3326
-					}
3327
-					elseif (is_a($out, 'Datetime'))
3267
+					} elseif (is_a($out, 'Datetime'))
3328 3268
 					{
3329 3269
 						return $out;
3330 3270
 					}
@@ -3353,8 +3293,7 @@  discard block
 block discarded – undo
3353 3293
 						$obj->$key = php_xmlrpc_decode($value, $options);
3354 3294
 					}
3355 3295
 					return $obj;
3356
-				}
3357
-				else
3296
+				} else
3358 3297
 				{
3359 3298
 					$arr = array();
3360 3299
 					while(list($key,$value)=$xmlrpc_val->structeach())
@@ -3380,8 +3319,7 @@  discard block
 block discarded – undo
3380 3319
 	if(function_exists('xmlrpc_decode'))
3381 3320
 	{
3382 3321
 		define('XMLRPC_EPI_ENABLED','1');
3383
-	}
3384
-	else
3322
+	} else
3385 3323
 	{
3386 3324
 		define('XMLRPC_EPI_ENABLED','0');
3387 3325
 	}
@@ -3409,10 +3347,11 @@  discard block
 block discarded – undo
3409 3347
 		switch($type)
3410 3348
 		{
3411 3349
 			case 'string':
3412
-				if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val))
3413
-					$xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']);
3414
-				else
3415
-					$xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcString']);
3350
+				if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val)) {
3351
+									$xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']);
3352
+				} else {
3353
+									$xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcString']);
3354
+				}
3416 3355
 				break;
3417 3356
 			case 'integer':
3418 3357
 				$xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcInt']);
@@ -3447,8 +3386,7 @@  discard block
 block discarded – undo
3447 3386
 				if($ko)
3448 3387
 				{
3449 3388
 					$xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
3450
-				}
3451
-				else
3389
+				} else
3452 3390
 				{
3453 3391
 					$xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcArray']);
3454 3392
 				}
@@ -3457,12 +3395,10 @@  discard block
 block discarded – undo
3457 3395
 				if(is_a($php_val, 'xmlrpcval'))
3458 3396
 				{
3459 3397
 					$xmlrpc_val = $php_val;
3460
-				}
3461
-				else if(is_a($php_val, 'DateTime'))
3398
+				} else if(is_a($php_val, 'DateTime'))
3462 3399
 				{
3463 3400
 					$xmlrpc_val = new xmlrpcval($php_val->format('Ymd\TH:i:s'), $GLOBALS['xmlrpcStruct']);
3464
-				}
3465
-				else
3401
+				} else
3466 3402
 				{
3467 3403
 					$arr = array();
3468 3404
 					reset($php_val);
@@ -3483,12 +3419,10 @@  discard block
 block discarded – undo
3483 3419
 				if (in_array('extension_api', $options))
3484 3420
 				{
3485 3421
 					$xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']);
3486
-				}
3487
-				else if (in_array('null_extension', $options))
3422
+				} else if (in_array('null_extension', $options))
3488 3423
 				{
3489 3424
 					$xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']);
3490
-				}
3491
-				else
3425
+				} else
3492 3426
 				{
3493 3427
 					$xmlrpc_val = new xmlrpcval();
3494 3428
 				}
@@ -3497,8 +3431,7 @@  discard block
 block discarded – undo
3497 3431
 				if (in_array('extension_api', $options))
3498 3432
 				{
3499 3433
 					$xmlrpc_val = new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);
3500
-				}
3501
-				else
3434
+				} else
3502 3435
 				{
3503 3436
 					$xmlrpc_val = new xmlrpcval();
3504 3437
 				}
@@ -3540,8 +3473,7 @@  discard block
 block discarded – undo
3540 3473
 		if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
3541 3474
 		{
3542 3475
 			xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
3543
-		}
3544
-		else
3476
+		} else
3545 3477
 		{
3546 3478
 			xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
3547 3479
 		}
@@ -3558,9 +3490,11 @@  discard block
 block discarded – undo
3558 3490
 			return false;
3559 3491
 		}
3560 3492
 		xml_parser_free($parser);
3561
-		if ($GLOBALS['_xh']['isf'] > 1) // test that $GLOBALS['_xh']['value'] is an obj, too???
3493
+		if ($GLOBALS['_xh']['isf'] > 1) {
3494
+		    // test that $GLOBALS['_xh']['value'] is an obj, too???
3562 3495
 		{
3563 3496
 			error_log($GLOBALS['_xh']['isf_reason']);
3497
+		}
3564 3498
 			return false;
3565 3499
 		}
3566 3500
 		switch ($GLOBALS['_xh']['rt'])
@@ -3572,8 +3506,7 @@  discard block
 block discarded – undo
3572 3506
 					$vc = $v->structmem('faultCode');
3573 3507
 					$vs = $v->structmem('faultString');
3574 3508
 					$r = new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval());
3575
-				}
3576
-				else
3509
+				} else
3577 3510
 				{
3578 3511
 					$r = new xmlrpcresp($v);
3579 3512
 				}
@@ -3693,12 +3626,10 @@  discard block
 block discarded – undo
3693 3626
 		if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk))
3694 3627
 		{
3695 3628
 			return 'UCS-4';
3696
-		}
3697
-		elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk))
3629
+		} elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk))
3698 3630
 		{
3699 3631
 			return 'UTF-16';
3700
-		}
3701
-		elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))
3632
+		} elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))
3702 3633
 		{
3703 3634
 			return 'UTF-8';
3704 3635
 		}
@@ -3721,8 +3652,7 @@  discard block
 block discarded – undo
3721 3652
 			if($encoding_prefs)
3722 3653
 			{
3723 3654
 				$enc = mb_detect_encoding($xmlchunk, $encoding_prefs);
3724
-			}
3725
-			else
3655
+			} else
3726 3656
 			{
3727 3657
 				$enc = mb_detect_encoding($xmlchunk);
3728 3658
 			}
@@ -3733,8 +3663,7 @@  discard block
 block discarded – undo
3733 3663
 				$enc = 'US-'.$enc;
3734 3664
 			}
3735 3665
 			return $enc;
3736
-		}
3737
-		else
3666
+		} else
3738 3667
 		{
3739 3668
 			// no encoding specified: as per HTTP1.1 assume it is iso-8859-1?
3740 3669
 			// Both RFC 2616 (HTTP 1.1) and 1945 (HTTP 1.0) clearly state that for text/xxx content types
@@ -3759,16 +3688,18 @@  discard block
 block discarded – undo
3759 3688
 				'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',
3760 3689
 				'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN')
3761 3690
 		);
3762
-		if (is_string($validlist))
3763
-			$validlist = explode(',', $validlist);
3764
-		if (@in_array(strtoupper($encoding), $validlist))
3765
-			return true;
3766
-		else
3767
-		{
3768
-			if (array_key_exists($encoding, $charset_supersets))
3769
-				foreach ($validlist as $allowed)
3691
+		if (is_string($validlist)) {
3692
+					$validlist = explode(',', $validlist);
3693
+		}
3694
+		if (@in_array(strtoupper($encoding), $validlist)) {
3695
+					return true;
3696
+		} else
3697
+		{
3698
+			if (array_key_exists($encoding, $charset_supersets)) {
3699
+							foreach ($validlist as $allowed)
3770 3700
 					if (in_array($allowed, $charset_supersets[$encoding]))
3771 3701
 						return true;
3702
+			}
3772 3703
 				return false;
3773 3704
 		}
3774 3705
 	}
Please login to merge, or discard this patch.
Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc_wrappers.inc 1 patch
Braces   +46 added lines, -80 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
 				if(class_exists($phptype))
54 54
 				{
55 55
 					return $GLOBALS['xmlrpcStruct'];
56
-				}
57
-				else
56
+				} else
58 57
 				{
59 58
 					// unknown: might be any 'extended' xmlrpc type
60 59
 					return $GLOBALS['xmlrpcValue'];
@@ -172,8 +171,7 @@  discard block
 block discarded – undo
172 171
             if(is_string($funcname[0]))
173 172
             {
174 173
                 $plainfuncname = implode('::', $funcname);
175
-            }
176
-            elseif(is_object($funcname[0]))
174
+            } elseif(is_object($funcname[0]))
177 175
             {
178 176
                 $plainfuncname = get_class($funcname[0]) . '->' . $funcname[1];
179 177
             }
@@ -183,8 +181,7 @@  discard block
 block discarded – undo
183 181
                // workaround for php 5.0: static class methods are not seen by method_exists
184 182
                $exists = is_callable( $funcname );
185 183
             }
186
-        }
187
-        else
184
+        } else
188 185
         {
189 186
             $plainfuncname = $funcname;
190 187
             $exists = function_exists($funcname);
@@ -194,25 +191,23 @@  discard block
 block discarded – undo
194 191
 		{
195 192
 			error_log('XML-RPC: function to be wrapped is not defined: '.$plainfuncname);
196 193
 			return false;
197
-		}
198
-		else
194
+		} else
199 195
 		{
200 196
 			// determine name of new php function
201 197
 			if($newfuncname == '')
202 198
 			{
203 199
 				if(is_array($funcname))
204 200
 				{
205
-    				if(is_string($funcname[0]))
206
-        				$xmlrpcfuncname = "{$prefix}_".implode('_', $funcname);
207
-    				else
208
-    					$xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1];
209
-				}
210
-				else
201
+    				if(is_string($funcname[0])) {
202
+    				        				$xmlrpcfuncname = "{$prefix}_".implode('_', $funcname);
203
+    				} else {
204
+    				    					$xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1];
205
+    				}
206
+				} else
211 207
 				{
212 208
 					$xmlrpcfuncname = "{$prefix}_$funcname";
213 209
 				}
214
-			}
215
-			else
210
+			} else
216 211
 			{
217 212
 				$xmlrpcfuncname = $newfuncname;
218 213
 			}
@@ -252,8 +247,7 @@  discard block
 block discarded – undo
252 247
     				return false;
253 248
     			}
254 249
                 /// @todo add more checks for static vs. nonstatic?
255
-            }
256
-			else
250
+            } else
257 251
 			{
258 252
     			$func = new ReflectionFunction($funcname);
259 253
             }
@@ -291,8 +285,7 @@  discard block
 block discarded – undo
291 285
 							$desc .= "\n";
292 286
 						}
293 287
 						$desc .= $doc;
294
-					}
295
-					elseif(strpos($doc, '@param') === 0)
288
+					} elseif(strpos($doc, '@param') === 0)
296 289
 					{
297 290
 						// syntax: @param type [$name] desc
298 291
 						if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches))
@@ -301,8 +294,7 @@  discard block
 block discarded – undo
301 294
 							{
302 295
 								//$paramDocs[$i]['type'] = explode('|', $matches[1]);
303 296
 								$paramDocs[$i]['type'] = 'mixed';
304
-							}
305
-							else
297
+							} else
306 298
 							{
307 299
 								$paramDocs[$i]['type'] = $matches[1];
308 300
 							}
@@ -310,8 +302,7 @@  discard block
 block discarded – undo
310 302
 							$paramDocs[$i]['doc'] = $matches[3];
311 303
 						}
312 304
 						$i++;
313
-					}
314
-					elseif(strpos($doc, '@return') === 0)
305
+					} elseif(strpos($doc, '@return') === 0)
315 306
 					{
316 307
 						// syntax: @return type desc
317 308
 						//$returns = preg_split('/\s+/', $doc);
@@ -363,8 +354,7 @@  discard block
 block discarded – undo
363 354
 				if ($decode_php_objects)
364 355
 				{
365 356
 					$innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i, array('decode_php_objs'));\n";
366
-				}
367
-				else
357
+				} else
368 358
 				{
369 359
 					$innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i);\n";
370 360
 				}
@@ -389,8 +379,7 @@  discard block
 block discarded – undo
389 379
 				// only known good synopsis = no parameters
390 380
 				$parsvariations[] = array();
391 381
 				$minpars = 0;
392
-			}
393
-			else
382
+			} else
394 383
 			{
395 384
 				$minpars = count($parsvariations[0]);
396 385
 			}
@@ -401,8 +390,7 @@  discard block
 block discarded – undo
401 390
 				// NB: this check needs to be done BEFORE decoding param values
402 391
 				$innercode = "\$paramcount = \$msg->getNumParams();\n" .
403 392
 				"if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode;
404
-			}
405
-			else
393
+			} else
406 394
 			{
407 395
 				$innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode;
408 396
 			}
@@ -415,8 +403,7 @@  discard block
 block discarded – undo
415 403
 			    $GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] =& $funcname[0];
416 404
 			    $innercode .= "\$obj =& \$GLOBALS['xmlrpcWPFObjHolder']['$xmlrpcfuncname'];\n";
417 405
 			    $realfuncname = '$obj->'.$funcname[1];
418
-			}
419
-			else
406
+			} else
420 407
 			{
421 408
     			$realfuncname = $plainfuncname;
422 409
             }
@@ -431,8 +418,7 @@  discard block
 block discarded – undo
431 418
 					if (isset($paramDocs[$i]['type']))
432 419
 					{
433 420
 						$sig[] = php_2_xmlrpc_type($paramDocs[$i]['type']);
434
-					}
435
-					else
421
+					} else
436 422
 					{
437 423
 						$sig[] = $GLOBALS['xmlrpcValue'];
438 424
 					}
@@ -448,13 +434,13 @@  discard block
 block discarded – undo
448 434
 			if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64'])
449 435
 			{
450 436
 				$innercode .= "return new {$prefix}resp(new {$prefix}val(\$retval, '$returns'));";
451
-			}
452
-			else
437
+			} else
453 438
 			{
454
-				if ($encode_php_objects)
455
-					$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n";
456
-				else
457
-					$innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval));\n";
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";
443
+				}
458 444
 			}
459 445
 			// shall we exclude functions returning by ref?
460 446
 			// if($func->returnsReference())
@@ -578,8 +564,7 @@  discard block
 block discarded – undo
578 564
 		{
579 565
 			$signum = $extra_options;
580 566
 			$extra_options = array();
581
-		}
582
-		else
567
+		} else
583 568
 		{
584 569
 			$signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0;
585 570
 			$timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0;
@@ -599,8 +584,7 @@  discard block
 block discarded – undo
599 584
 		{
600 585
 			$decode_fault = true;
601 586
 			$fault_response = $extra_options['return_on_fault'];
602
-		}
603
-		else
587
+		} else
604 588
 		{
605 589
 			$decode_fault = false;
606 590
 			$fault_response = '';
@@ -619,8 +603,7 @@  discard block
 block discarded – undo
619 603
 		{
620 604
 			error_log('XML-RPC: could not retrieve method signature from remote server for method '.$methodname);
621 605
 			return false;
622
-		}
623
-		else
606
+		} else
624 607
 		{
625 608
 			$msig = $response->value();
626 609
 			if ($client->return_type != 'phpvals')
@@ -631,15 +614,13 @@  discard block
 block discarded – undo
631 614
 			{
632 615
 				error_log('XML-RPC: could not retrieve method signature nr.'.$signum.' from remote server for method '.$methodname);
633 616
 				return false;
634
-			}
635
-			else
617
+			} else
636 618
 			{
637 619
 				// pick a suitable name for the new function, avoiding collisions
638 620
 				if($newfuncname != '')
639 621
 				{
640 622
 					$xmlrpcfuncname = $newfuncname;
641
-				}
642
-				else
623
+				} else
643 624
 				{
644 625
 					// take care to insure that methodname is translated to valid
645 626
 					// php function name
@@ -685,14 +666,12 @@  discard block
 block discarded – undo
685 666
 					if($allOK)
686 667
 					{
687 668
 						return $xmlrpcfuncname;
688
-					}
689
-					else
669
+					} else
690 670
 					{
691 671
 						error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap remote method '.$methodname);
692 672
 						return false;
693 673
 					}
694
-				}
695
-				else
674
+				} else
696 675
 				{
697 676
 					$results['function'] = $xmlrpcfuncname;
698 677
 					return $results;
@@ -732,8 +711,7 @@  discard block
 block discarded – undo
732 711
 		{
733 712
 			error_log('XML-RPC: could not retrieve method list from remote server');
734 713
 			return false;
735
-		}
736
-		else
714
+		} else
737 715
 		{
738 716
 			$mlist = $response->value();
739 717
 			if ($client->return_type != 'phpvals')
@@ -744,15 +722,13 @@  discard block
 block discarded – undo
744 722
 			{
745 723
 				error_log('XML-RPC: could not retrieve meaningful method list from remote server');
746 724
 				return false;
747
-			}
748
-			else
725
+			} else
749 726
 			{
750 727
 				// pick a suitable name for the new function, avoiding collisions
751 728
 				if($newclassname != '')
752 729
 				{
753 730
 					$xmlrpcclassname = $newclassname;
754
-				}
755
-				else
731
+				} else
756 732
 				{
757 733
 					$xmlrpcclassname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
758 734
 						array('_', ''), $client->server).'_client';
@@ -787,8 +763,7 @@  discard block
 block discarded – undo
787 763
 								$source .= $methodwrap['docstring'];
788 764
 							}
789 765
 							$source .= $methodwrap['source']."\n";
790
-						}
791
-						else
766
+						} else
792 767
 						{
793 768
 							error_log('XML-RPC: will not create class method to wrap remote method '.$mname);
794 769
 						}
@@ -804,14 +779,12 @@  discard block
 block discarded – undo
804 779
 					if($allOK)
805 780
 					{
806 781
 						return $xmlrpcclassname;
807
-					}
808
-					else
782
+					} else
809 783
 					{
810 784
 						error_log('XML-RPC: could not create class '.$xmlrpcclassname.' to wrap remote server '.$client->server);
811 785
 						return false;
812 786
 					}
813
-				}
814
-				else
787
+				} else
815 788
 				{
816 789
 					return array('class' => $xmlrpcclassname, 'code' => $source, 'docstring' => '');
817 790
 				}
@@ -839,8 +812,7 @@  discard block
 block discarded – undo
839 812
 			$innercode = build_client_wrapper_code($client, $client_copy_mode, $prefix);
840 813
 			$innercode .= "\$client->setDebug(\$debug);\n";
841 814
 			$this_ = '';
842
-		}
843
-		else
815
+		} else
844 816
 		{
845 817
 			// client copy mode 2 == no client copy in emitted code
846 818
 			$innercode = '';
@@ -852,8 +824,7 @@  discard block
 block discarded – undo
852 824
 		{
853 825
 			// take care that PHP comment is not terminated unwillingly by method description
854 826
 			$mdesc = "/**\n* ".str_replace('*/', '* /', $mdesc)."\n";
855
-		}
856
-		else
827
+		} else
857 828
 		{
858 829
 			$mdesc = "/**\nFunction $xmlrpcfuncname\n";
859 830
 		}
@@ -870,14 +841,12 @@  discard block
 block discarded – undo
870 841
 			{
871 842
 				// only build directly xmlrpcvals when type is known and scalar
872 843
 				$innercode .= "\$p$i = new {$prefix}val(\$p$i, '$ptype');\n";
873
-			}
874
-			else
844
+			} else
875 845
 			{
876 846
 				if ($encode_php_objects)
877 847
 				{
878 848
 					$innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i, array('encode_php_objs'));\n";
879
-				}
880
-				else
849
+				} else
881 850
 				{
882 851
 					$innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i);\n";
883 852
 				}
@@ -899,21 +868,18 @@  discard block
 block discarded – undo
899 868
 			if (is_string($fault_response) && ((strpos($fault_response, '%faultCode%') !== false) || (strpos($fault_response, '%faultString%') !== false)))
900 869
 			{
901 870
 				$respcode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $fault_response)."')";
902
-			}
903
-			else
871
+			} else
904 872
 			{
905 873
 				$respcode = var_export($fault_response, true);
906 874
 			}
907
-		}
908
-		else
875
+		} else
909 876
 		{
910 877
 			$respcode = '$res';
911 878
 		}
912 879
 		if ($decode_php_objects)
913 880
 		{
914 881
 			$innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value(), array('decode_php_objs'));";
915
-		}
916
-		else
882
+		} else
917 883
 		{
918 884
 			$innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value());";
919 885
 		}
Please login to merge, or discard this patch.
Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpcs.inc 1 patch
Braces   +62 added lines, -94 removed lines patch added patch discarded remove patch
@@ -107,16 +107,14 @@  discard block
 block discarded – undo
107 107
 		{
108 108
 			$methName=$m->getParam(0);
109 109
 			$methName=$methName->scalarval();
110
-		}
111
-		else
110
+		} else
112 111
 		{
113 112
 			$methName=$m;
114 113
 		}
115 114
 		if(strpos($methName, "system.") === 0)
116 115
 		{
117 116
 			$dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
118
-		}
119
-		else
117
+		} else
120 118
 		{
121 119
 			$dmap=$server->dmap; $sysCall=0;
122 120
 		}
@@ -135,15 +133,13 @@  discard block
 block discarded – undo
135 133
 					$sigs[]=new xmlrpcval($cursig, 'array');
136 134
 				}
137 135
 				$r=new xmlrpcresp(new xmlrpcval($sigs, 'array'));
138
-			}
139
-			else
136
+			} else
140 137
 			{
141 138
 				// NB: according to the official docs, we should be returning a
142 139
 				// "none-array" here, which means not-an-array
143 140
 				$r=new xmlrpcresp(new xmlrpcval('undef', 'string'));
144 141
 			}
145
-		}
146
-		else
142
+		} else
147 143
 		{
148 144
 			$r=new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
149 145
 		}
@@ -160,16 +156,14 @@  discard block
 block discarded – undo
160 156
 		{
161 157
 			$methName=$m->getParam(0);
162 158
 			$methName=$methName->scalarval();
163
-		}
164
-		else
159
+		} else
165 160
 		{
166 161
 			$methName=$m;
167 162
 		}
168 163
 		if(strpos($methName, "system.") === 0)
169 164
 		{
170 165
 			$dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
171
-		}
172
-		else
166
+		} else
173 167
 		{
174 168
 			$dmap=$server->dmap; $sysCall=0;
175 169
 		}
@@ -178,13 +172,11 @@  discard block
 block discarded – undo
178 172
 			if(isset($dmap[$methName]['docstring']))
179 173
 			{
180 174
 				$r=new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string');
181
-			}
182
-			else
175
+			} else
183 176
 			{
184 177
 				$r=new xmlrpcresp(new xmlrpcval('', 'string'));
185 178
 			}
186
-		}
187
-		else
179
+		} else
188 180
 		{
189 181
 			$r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
190 182
 		}
@@ -296,8 +288,9 @@  discard block
 block discarded – undo
296 288
 		// base64 or datetime values, but they will be listed as strings here...
297 289
 		$numParams = count($call['params']);
298 290
 		$pt = array();
299
-		foreach($call['params'] as $val)
300
-			$pt[] = php_2_xmlrpc_type(gettype($val));
291
+		foreach($call['params'] as $val) {
292
+					$pt[] = php_2_xmlrpc_type(gettype($val));
293
+		}
301 294
 
302 295
 		$result = $server->execute($call['methodName'], $call['params'], $pt);
303 296
 
@@ -322,8 +315,7 @@  discard block
 block discarded – undo
322 315
 				$call = $calls->arraymem($i);
323 316
 				$result[$i] = _xmlrpcs_multicall_do_call($server, $call);
324 317
 			}
325
-		}
326
-		else
318
+		} else
327 319
 		{
328 320
 			$numCalls=count($m);
329 321
 			for($i = 0; $i < $numCalls; $i++)
@@ -378,8 +370,9 @@  discard block
 block discarded – undo
378 370
 	function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, $lineno=null, $context=null)
379 371
 	{
380 372
 		// obey the @ protocol
381
-		if (error_reporting() == 0)
382
-			return;
373
+		if (error_reporting() == 0) {
374
+					return;
375
+		}
383 376
 
384 377
 		//if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode != E_USER_NOTICE && $errcode != E_USER_WARNING)
385 378
 		if($errcode != E_STRICT)
@@ -396,8 +389,7 @@  discard block
 block discarded – undo
396 389
 			{
397 390
 				error_log($errstring);
398 391
 			}
399
-		}
400
-		else
392
+		} else
401 393
 		{
402 394
 			// Pass control on to previous error handler, trying to avoid loops...
403 395
 			if($GLOBALS['_xmlrpcs_prev_ehandler'] != '_xmlrpcs_errorHandler')
@@ -407,8 +399,7 @@  discard block
 block discarded – undo
407 399
 				{
408 400
 					// the following works both with static class methods and plain object methods as error handler
409 401
 					call_user_func_array($GLOBALS['_xmlrpcs_prev_ehandler'], array($errcode, $errstring, $filename, $lineno, $context));
410
-				}
411
-				else
402
+				} else
412 403
 				{
413 404
 					$GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, $context);
414 405
 				}
@@ -592,8 +583,7 @@  discard block
 block discarded – undo
592 583
 				if ($ver[0] >= 5)
593 584
 				{
594 585
 					$data = file_get_contents('php://input');
595
-				}
596
-				else
586
+				} else
597 587
 				{
598 588
 					$data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
599 589
 				}
@@ -664,8 +654,7 @@  discard block
 block discarded – undo
664 654
 						$payload = gzencode($payload);
665 655
 						header("Content-Encoding: gzip");
666 656
 						header("Vary: Accept-Encoding");
667
-					}
668
-					elseif (strpos($resp_encoding, 'deflate') !== false)
657
+					} elseif (strpos($resp_encoding, 'deflate') !== false)
669 658
 					{
670 659
 						$payload = gzcompress($payload);
671 660
 						header("Content-Encoding: deflate");
@@ -679,8 +668,7 @@  discard block
 block discarded – undo
679 668
 				{
680 669
 					header('Content-Length: ' . (int)strlen($payload));
681 670
 				}
682
-			}
683
-			else
671
+			} else
684 672
 			{
685 673
 				error_log('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
686 674
 			}
@@ -728,8 +716,7 @@  discard block
 block discarded – undo
728 716
 			if (is_object($in))
729 717
 			{
730 718
 				$numParams = $in->getNumParams();
731
-			}
732
-			else
719
+			} else
733 720
 			{
734 721
 				$numParams = count($in);
735 722
 			}
@@ -746,13 +733,11 @@  discard block
 block discarded – undo
746 733
 							if($p->kindOf() == 'scalar')
747 734
 							{
748 735
 								$pt=$p->scalartyp();
749
-							}
750
-							else
736
+							} else
751 737
 							{
752 738
 								$pt=$p->kindOf();
753 739
 							}
754
-						}
755
-						else
740
+						} else
756 741
 						{
757 742
 							$pt= $in[$n] == 'i4' ? 'int' : strtolower($in[$n]); // dispatch maps never use i4...
758 743
 						}
@@ -813,8 +798,7 @@  discard block
 block discarded – undo
813 798
 			if(isset($_SERVER['HTTP_CONTENT_ENCODING']))
814 799
 			{
815 800
 				$content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
816
-			}
817
-			else
801
+			} else
818 802
 			{
819 803
 				$content_encoding = '';
820 804
 			}
@@ -834,20 +818,18 @@  discard block
 block discarded – undo
834 818
 							{
835 819
 								$this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
836 820
 							}
837
-						}
838
-						elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
821
+						} elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
839 822
 						{
840 823
 							$data = $degzdata;
841
-							if($this->debug > 1)
842
-								$this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
843
-						}
844
-						else
824
+							if($this->debug > 1) {
825
+															$this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
826
+							}
827
+						} else
845 828
 						{
846 829
 							$r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']);
847 830
 							return $r;
848 831
 						}
849
-					}
850
-					else
832
+					} else
851 833
 					{
852 834
 						//error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
853 835
 						$r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']);
@@ -871,18 +853,19 @@  discard block
 block discarded – undo
871 853
 					$known_charsets = array($GLOBALS['xmlrpc_internalencoding'], 'UTF-8', 'ISO-8859-1', 'US-ASCII');
872 854
 					foreach ($known_charsets as $charset)
873 855
 					{
874
-						foreach ($client_accepted_charsets as $accepted)
875
-							if (strpos($accepted, $charset) === 0)
856
+						foreach ($client_accepted_charsets as $accepted) {
857
+													if (strpos($accepted, $charset) === 0)
876 858
 							{
877 859
 								$resp_encoding = $charset;
860
+						}
878 861
 								break;
879 862
 							}
880
-						if ($resp_encoding)
881
-							break;
863
+						if ($resp_encoding) {
864
+													break;
865
+						}
882 866
 					}
883 867
 				}
884
-			}
885
-			else
868
+			} else
886 869
 			{
887 870
 				$resp_encoding = $this->response_charset_encoding;
888 871
 			}
@@ -890,8 +873,7 @@  discard block
 block discarded – undo
890 873
 			if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
891 874
 			{
892 875
 				$resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING'];
893
-			}
894
-			else
876
+			} else
895 877
 			{
896 878
 				$resp_compression = '';
897 879
 			}
@@ -938,20 +920,20 @@  discard block
 block discarded – undo
938 920
 			// decompose incoming XML into request structure
939 921
 			if ($req_encoding != '')
940 922
 			{
941
-				if (!in_array($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
942
-				// the following code might be better for mb_string enabled installs, but
923
+				if (!in_array($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
924
+								// the following code might be better for mb_string enabled installs, but
943 925
 				// makes the lib about 200% slower...
944 926
 				//if (!is_valid_charset($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
945 927
 				{
946 928
 					error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$req_encoding);
929
+				}
947 930
 					$req_encoding = $GLOBALS['xmlrpc_defencoding'];
948 931
 				}
949 932
 				/// @BUG this will fail on PHP 5 if charset is not specified in the xml prologue,
950 933
 				// the encoding is not UTF8 and there are non-ascii chars in the text...
951 934
 				/// @todo use an ampty string for php 5 ???
952 935
 				$parser = xml_parser_create($req_encoding);
953
-			}
954
-			else
936
+			} else
955 937
 			{
956 938
 				$parser = xml_parser_create();
957 939
 			}
@@ -966,16 +948,16 @@  discard block
 block discarded – undo
966 948
 			if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
967 949
 			{
968 950
 				xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
969
-			}
970
-			else
951
+			} else
971 952
 			{
972 953
 				xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
973 954
 			}
974 955
 
975
-			if ($this->functions_parameters_type != 'xmlrpcvals')
976
-				xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
977
-			else
978
-				xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
956
+			if ($this->functions_parameters_type != 'xmlrpcvals') {
957
+							xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
958
+			} else {
959
+							xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
960
+			}
979 961
 			xml_set_character_data_handler($parser, 'xmlrpc_cd');
980 962
 			xml_set_default_handler($parser, 'xmlrpc_dh');
981 963
 			if(!xml_parse($parser, $data, 1))
@@ -987,15 +969,13 @@  discard block
 block discarded – undo
987 969
 					xml_error_string(xml_get_error_code($parser)),
988 970
 					xml_get_current_line_number($parser), xml_get_current_column_number($parser)));
989 971
 				xml_parser_free($parser);
990
-			}
991
-			elseif ($GLOBALS['_xh']['isf'])
972
+			} elseif ($GLOBALS['_xh']['isf'])
992 973
 			{
993 974
 				xml_parser_free($parser);
994 975
 				$r=new xmlrpcresp(0,
995 976
 					$GLOBALS['xmlrpcerr']['invalid_request'],
996 977
 					$GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']);
997
-			}
998
-			else
978
+			} else
999 979
 			{
1000 980
 				xml_parser_free($parser);
1001 981
 				// small layering violation in favor of speed and memory usage:
@@ -1009,8 +989,7 @@  discard block
 block discarded – undo
1009 989
 						$this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], true)."\n+++END+++");
1010 990
 					}
1011 991
 					$r = $this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], $GLOBALS['_xh']['pt']);
1012
-				}
1013
-				else
992
+				} else
1014 993
 				{
1015 994
 					// build an xmlrpcmsg object with data parsed from xml
1016 995
 					$m=new xmlrpcmsg($GLOBALS['_xh']['method']);
@@ -1043,8 +1022,7 @@  discard block
 block discarded – undo
1043 1022
 			if (is_object($m))
1044 1023
 			{
1045 1024
 				$methName = $m->method();
1046
-			}
1047
-			else
1025
+			} else
1048 1026
 			{
1049 1027
 				$methName = $m;
1050 1028
 			}
@@ -1066,8 +1044,7 @@  discard block
 block discarded – undo
1066 1044
 				if (is_object($m))
1067 1045
 				{
1068 1046
 					list($ok, $errstr) = $this->verifySignature($m, $sig);
1069
-				}
1070
-				else
1047
+				} else
1071 1048
 				{
1072 1049
 					list($ok, $errstr) = $this->verifySignature($paramtypes, $sig);
1073 1050
 				}
@@ -1113,8 +1090,7 @@  discard block
 block discarded – undo
1113 1090
 					if($sysCall)
1114 1091
 					{
1115 1092
 						$r = call_user_func($func, $this, $m);
1116
-					}
1117
-					else
1093
+					} else
1118 1094
 					{
1119 1095
 						$r = call_user_func($func, $m);
1120 1096
 					}
@@ -1124,8 +1100,7 @@  discard block
 block discarded – undo
1124 1100
 						if (is_a($r, 'xmlrpcval'))
1125 1101
 						{
1126 1102
 							$r = new xmlrpcresp($r);
1127
-						}
1128
-						else
1103
+						} else
1129 1104
 						{
1130 1105
 							$r = new xmlrpcresp(
1131 1106
 								0,
@@ -1134,16 +1109,14 @@  discard block
 block discarded – undo
1134 1109
 							);
1135 1110
 						}
1136 1111
 					}
1137
-				}
1138
-				else
1112
+				} else
1139 1113
 				{
1140 1114
 					// call a 'plain php' function
1141 1115
 					if($sysCall)
1142 1116
 					{
1143 1117
 						array_unshift($params, $this);
1144 1118
 						$r = call_user_func_array($func, $params);
1145
-					}
1146
-					else
1119
+					} else
1147 1120
 					{
1148 1121
 						// 3rd API convention for method-handling functions: EPI-style
1149 1122
 						if ($this->functions_parameters_type == 'epivals')
@@ -1154,15 +1127,13 @@  discard block
 block discarded – undo
1154 1127
 							if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r))
1155 1128
 							{
1156 1129
 								$r = new xmlrpcresp(0, (integer)$r['faultCode'], (string)$r['faultString']);
1157
-							}
1158
-							else
1130
+							} else
1159 1131
 							{
1160 1132
 								// functions using EPI api should NOT return resp objects,
1161 1133
 								// so make sure we encode the return type correctly
1162 1134
 								$r = new xmlrpcresp(php_xmlrpc_encode($r, array('extension_api')));
1163 1135
 							}
1164
-						}
1165
-						else
1136
+						} else
1166 1137
 						{
1167 1138
 							$r = call_user_func_array($func, $params);
1168 1139
 						}
@@ -1175,8 +1146,7 @@  discard block
 block discarded – undo
1175 1146
 						$r = new xmlrpcresp(php_xmlrpc_encode($r, $this->phpvals_encoding_options));
1176 1147
 					}
1177 1148
 				}
1178
-			}
1179
-			catch(Exception $e)
1149
+			} catch(Exception $e)
1180 1150
 			{
1181 1151
 				// (barring errors in the lib) an uncatched exception happened
1182 1152
 				// in the called function, we wrap it in a proper error-response
@@ -1199,8 +1169,7 @@  discard block
 block discarded – undo
1199 1169
 				if($GLOBALS['_xmlrpcs_prev_ehandler'])
1200 1170
 				{
1201 1171
 					set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);
1202
-				}
1203
-				else
1172
+				} else
1204 1173
 				{
1205 1174
 					restore_error_handler();
1206 1175
 				}
@@ -1226,8 +1195,7 @@  discard block
 block discarded – undo
1226 1195
 			if ($charset_encoding != '')
1227 1196
 			{
1228 1197
 				return "<?xml version=\"1.0\" encoding=\"$charset_encoding\"?" . ">\n";
1229
-			}
1230
-			else
1198
+			} else
1231 1199
 			{
1232 1200
 				return "<?xml version=\"1.0\"?" . ">\n";
1233 1201
 			}
Please login to merge, or discard this patch.
Components/Klarna/Klarna.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3429,8 +3429,7 @@  discard block
 block discarded – undo
3429 3429
             //Attempt to load previously stored pclasses, so they aren't
3430 3430
             // accidentially removed.
3431 3431
             $pclasses->load($this->pcURI);
3432
-        }
3433
-        catch(Exception $e) {
3432
+        } catch(Exception $e) {
3434 3433
             self::printDebug('load pclasses', $e->getMessage());
3435 3434
         }
3436 3435
 
@@ -3779,12 +3778,10 @@  discard block
 block discarded – undo
3779 3778
             }
3780 3779
 
3781 3780
             return php_xmlrpc_decode($xmlrpcresp->value());
3782
-        }
3783
-        catch(KlarnaException $e) {
3781
+        } catch(KlarnaException $e) {
3784 3782
             //Otherwise it is caught below, and rethrown.
3785 3783
             throw $e;
3786
-        }
3787
-        catch(Exception $e) {
3784
+        } catch(Exception $e) {
3788 3785
             throw new KlarnaException($e->getMessage(), $e->getCode());
3789 3786
         }
3790 3787
     }
Please login to merge, or discard this patch.
Controllers/Frontend/PaymentKlarna.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -220,8 +220,7 @@
 block discarded – undo
220 220
             $this->session['klarnaPreFill'] = true;
221 221
             if (empty($session['sCountry'])) {
222 222
                 $countryId = $this->getCountryByShop($shop);
223
-            }
224
-            else {
223
+            } else {
225 224
                 $countryId = $session['sCountry'];
226 225
             }
227 226
             if ($user ['additional']['countryShipping']['id'] == $countryId
Please login to merge, or discard this patch.
Bootstrap.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -597,10 +597,11 @@  discard block
 block discarded – undo
597 597
             $index++;
598 598
             if ($index == count($addressParts) || $houseNumberFound) {
599 599
                 // at least last element should be streetnr
600
-                if (!empty($streetnr)) $streetnr .= ' ';
600
+                if (!empty($streetnr)) {
601
+                    $streetnr .= ' ';
602
+                }
601 603
                 $streetnr .= (string)$addressPart;
602
-            }
603
-            else  {
604
+            } else  {
604 605
                 $street .= (string)' '.$addressPart;
605 606
             }
606 607
         }
@@ -1545,8 +1546,7 @@  discard block
 block discarded – undo
1545 1546
             // compatibility to shopware plugin custom products
1546 1547
             if (isset($basketItem['custom_product_prices'])) {
1547 1548
                 $basketItemPrice = (double)$basketItem['custom_product_prices']['total'];
1548
-            }
1549
-            else {
1549
+            } else {
1550 1550
                 $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']);
1551 1551
             }
1552 1552
             $unitPrice = round($basketItemPrice * 100);
Please login to merge, or discard this patch.