@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | $server = $parts['host']; |
137 | 137 | $path = isset($parts['path']) ? $parts['path'] : ''; |
138 | 138 | if (isset($parts['query'])) { |
139 | - $path .= '?' . $parts['query']; |
|
139 | + $path .= '?'.$parts['query']; |
|
140 | 140 | } |
141 | 141 | if (isset($parts['fragment'])) { |
142 | - $path .= '#' . $parts['fragment']; |
|
142 | + $path .= '#'.$parts['fragment']; |
|
143 | 143 | } |
144 | 144 | if (isset($parts['port'])) { |
145 | 145 | $port = $parts['port']; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | } |
157 | 157 | if ($path == '' || $path[0] != '/') { |
158 | - $this->path = '/' . $path; |
|
158 | + $this->path = '/'.$path; |
|
159 | 159 | } else { |
160 | 160 | $this->path = $path; |
161 | 161 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | }*/ |
194 | 194 | |
195 | 195 | // initialize user_agent string |
196 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
196 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | */ |
567 | 567 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
568 | 568 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
569 | - $method='http') |
|
569 | + $method = 'http') |
|
570 | 570 | { |
571 | 571 | return $this->sendPayloadSocket($req, $server, $port, $timeout, $username, $password, $authType, null, null, |
572 | 572 | null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType); |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | * @param int $sslVersion |
597 | 597 | * @return Response |
598 | 598 | */ |
599 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
599 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
600 | 600 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
601 | 601 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
602 | 602 | $sslVersion = 0) |
@@ -631,11 +631,11 @@ discard block |
||
631 | 631 | */ |
632 | 632 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
633 | 633 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
634 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
634 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
635 | 635 | $sslVersion = 0) |
636 | 636 | { |
637 | 637 | if ($port == 0) { |
638 | - $port = ( $method === 'https' ) ? 443 : 80; |
|
638 | + $port = ($method === 'https') ? 443 : 80; |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | // Only create the payload if it was not created previously |
@@ -666,15 +666,15 @@ discard block |
||
666 | 666 | // thanks to Grant Rauscher <[email protected]> for this |
667 | 667 | $credentials = ''; |
668 | 668 | if ($username != '') { |
669 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
669 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
670 | 670 | if ($authType != 1) { |
671 | - error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
671 | + error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
672 | 672 | } |
673 | 673 | } |
674 | 674 | |
675 | 675 | $acceptedEncoding = ''; |
676 | 676 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
677 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
677 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | $proxyCredentials = ''; |
@@ -685,17 +685,17 @@ discard block |
||
685 | 685 | $connectServer = $proxyHost; |
686 | 686 | $connectPort = $proxyPort; |
687 | 687 | $transport = 'tcp'; |
688 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
688 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
689 | 689 | if ($proxyUsername != '') { |
690 | 690 | if ($proxyAuthType != 1) { |
691 | - error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
691 | + error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
692 | 692 | } |
693 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
693 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
694 | 694 | } |
695 | 695 | } else { |
696 | 696 | $connectServer = $server; |
697 | 697 | $connectPort = $port; |
698 | - $transport = ( $method === 'https' ) ? 'tls' : 'tcp'; |
|
698 | + $transport = ($method === 'https') ? 'tls' : 'tcp'; |
|
699 | 699 | $uri = $this->path; |
700 | 700 | } |
701 | 701 | |
@@ -706,45 +706,45 @@ discard block |
||
706 | 706 | $version = ''; |
707 | 707 | foreach ($this->cookies as $name => $cookie) { |
708 | 708 | if ($cookie['version']) { |
709 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
710 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
709 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
710 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
711 | 711 | if ($cookie['path']) { |
712 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
712 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
713 | 713 | } |
714 | 714 | if ($cookie['domain']) { |
715 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
715 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
716 | 716 | } |
717 | 717 | if ($cookie['port']) { |
718 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
718 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
719 | 719 | } |
720 | 720 | } else { |
721 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
721 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
722 | 722 | } |
723 | 723 | } |
724 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
724 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | // omit port if default |
728 | 728 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
729 | - $port = ''; |
|
729 | + $port = ''; |
|
730 | 730 | } else { |
731 | - $port = ':' . $port; |
|
731 | + $port = ':'.$port; |
|
732 | 732 | } |
733 | 733 | |
734 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
735 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
736 | - 'Host: ' . $server . $port . "\r\n" . |
|
737 | - $credentials . |
|
738 | - $proxyCredentials . |
|
739 | - $acceptedEncoding . |
|
740 | - $encodingHdr . |
|
741 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
742 | - $cookieHeader . |
|
743 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
744 | - strlen($payload) . "\r\n\r\n" . |
|
734 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
735 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
736 | + 'Host: '.$server.$port."\r\n". |
|
737 | + $credentials. |
|
738 | + $proxyCredentials. |
|
739 | + $acceptedEncoding. |
|
740 | + $encodingHdr. |
|
741 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
742 | + $cookieHeader. |
|
743 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
744 | + strlen($payload)."\r\n\r\n". |
|
745 | 745 | $payload; |
746 | 746 | |
747 | - if ($this->debug > 1) { |
|
747 | + if ($this->debug>1) { |
|
748 | 748 | Logger::instance()->debugMessage("---SENDING---\n$op\n---END---"); |
749 | 749 | } |
750 | 750 | |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | } |
771 | 771 | $context = stream_context_create($contextOptions); |
772 | 772 | |
773 | - if ($timeout <= 0) { |
|
773 | + if ($timeout<=0) { |
|
774 | 774 | $connectTimeout = ini_get('default_socket_timeout'); |
775 | 775 | } else { |
776 | 776 | $connectTimeout = $timeout; |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
783 | 783 | STREAM_CLIENT_CONNECT, $context); |
784 | 784 | if ($fp) { |
785 | - if ($timeout > 0) { |
|
785 | + if ($timeout>0) { |
|
786 | 786 | stream_set_timeout($fp, $timeout); |
787 | 787 | } |
788 | 788 | } else { |
@@ -790,8 +790,8 @@ discard block |
||
790 | 790 | $err = error_get_last(); |
791 | 791 | $this->errstr = $err['message']; |
792 | 792 | } |
793 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
794 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
793 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
794 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
795 | 795 | |
796 | 796 | return $r; |
797 | 797 | } |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | $encodingHdr = ''; |
899 | 899 | } |
900 | 900 | |
901 | - if ($this->debug > 1) { |
|
901 | + if ($this->debug>1) { |
|
902 | 902 | Logger::instance()->debugMessage("---SENDING---\n$payload\n---END---"); |
903 | 903 | } |
904 | 904 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | } else { |
909 | 909 | $protocol = $method; |
910 | 910 | } |
911 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
911 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
912 | 912 | if ($keepAlive) { |
913 | 913 | $this->xmlrpc_curl_handle = $curl; |
914 | 914 | } |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | // results into variable |
920 | 920 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
921 | 921 | |
922 | - if ($this->debug > 1) { |
|
922 | + if ($this->debug>1) { |
|
923 | 923 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
924 | 924 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
925 | 925 | } |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | } |
946 | 946 | } |
947 | 947 | // extra headers |
948 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
948 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
949 | 949 | // if no keepalive is wanted, let the server know it in advance |
950 | 950 | if (!$keepAlive) { |
951 | 951 | $headers[] = 'Connection: close'; |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
963 | 963 | // timeout is borked |
964 | 964 | if ($timeout) { |
965 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
965 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | if ($method == 'http10') { |
@@ -972,11 +972,11 @@ discard block |
||
972 | 972 | } |
973 | 973 | |
974 | 974 | if ($username && $password) { |
975 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
975 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
976 | 976 | if (defined('CURLOPT_HTTPAUTH')) { |
977 | 977 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
978 | 978 | } elseif ($authType != 1) { |
979 | - error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
979 | + error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
980 | 980 | } |
981 | 981 | } |
982 | 982 | |
@@ -1017,13 +1017,13 @@ discard block |
||
1017 | 1017 | if ($proxyPort == 0) { |
1018 | 1018 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1019 | 1019 | } |
1020 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1020 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1021 | 1021 | if ($proxyUsername) { |
1022 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1022 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1023 | 1023 | if (defined('CURLOPT_PROXYAUTH')) { |
1024 | 1024 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1025 | 1025 | } elseif ($proxyAuthType != 1) { |
1026 | - error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1026 | + error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1027 | 1027 | } |
1028 | 1028 | } |
1029 | 1029 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | if (count($this->cookies)) { |
1035 | 1035 | $cookieHeader = ''; |
1036 | 1036 | foreach ($this->cookies as $name => $cookie) { |
1037 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1037 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1038 | 1038 | } |
1039 | 1039 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1040 | 1040 | } |
@@ -1045,13 +1045,13 @@ discard block |
||
1045 | 1045 | |
1046 | 1046 | $result = curl_exec($curl); |
1047 | 1047 | |
1048 | - if ($this->debug > 1) { |
|
1048 | + if ($this->debug>1) { |
|
1049 | 1049 | $message = "---CURL INFO---\n"; |
1050 | 1050 | foreach (curl_getinfo($curl) as $name => $val) { |
1051 | 1051 | if (is_array($val)) { |
1052 | 1052 | $val = implode("\n", $val); |
1053 | 1053 | } |
1054 | - $message .= $name . ': ' . $val . "\n"; |
|
1054 | + $message .= $name.': '.$val."\n"; |
|
1055 | 1055 | } |
1056 | 1056 | $message .= '---END---'; |
1057 | 1057 | Logger::instance()->debugMessage($message); |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1062 | 1062 | |
1063 | 1063 | $this->errstr = 'no response'; |
1064 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1064 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1065 | 1065 | curl_close($curl); |
1066 | 1066 | if ($keepAlive) { |
1067 | 1067 | $this->xmlrpc_curl_handle = null; |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | $call['methodName'] = new Value($req->method(), 'string'); |
1172 | 1172 | $numParams = $req->getNumParams(); |
1173 | 1173 | $params = array(); |
1174 | - for ($i = 0; $i < $numParams; $i++) { |
|
1174 | + for ($i = 0; $i<$numParams; $i++) { |
|
1175 | 1175 | $params[$i] = $req->getParam($i); |
1176 | 1176 | } |
1177 | 1177 | $call['params'] = new Value($params, 'array'); |
@@ -1197,15 +1197,15 @@ discard block |
||
1197 | 1197 | /// @todo test this code branch... |
1198 | 1198 | $rets = $result->value(); |
1199 | 1199 | if (!is_array($rets)) { |
1200 | - return false; // bad return type from system.multicall |
|
1200 | + return false; // bad return type from system.multicall |
|
1201 | 1201 | } |
1202 | 1202 | $numRets = count($rets); |
1203 | 1203 | if ($numRets != count($reqs)) { |
1204 | - return false; // wrong number of return values. |
|
1204 | + return false; // wrong number of return values. |
|
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | $response = array(); |
1208 | - for ($i = 0; $i < $numRets; $i++) { |
|
1208 | + for ($i = 0; $i<$numRets; $i++) { |
|
1209 | 1209 | $val = $rets[$i]; |
1210 | 1210 | if (!is_array($val)) { |
1211 | 1211 | return false; |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | switch (count($val)) { |
1214 | 1214 | case 1: |
1215 | 1215 | if (!isset($val[0])) { |
1216 | - return false; // Bad value |
|
1216 | + return false; // Bad value |
|
1217 | 1217 | } |
1218 | 1218 | // Normal return value |
1219 | 1219 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1241,19 +1241,19 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | $rets = $result->value(); |
1243 | 1243 | if ($rets->kindOf() != 'array') { |
1244 | - return false; // bad return type from system.multicall |
|
1244 | + return false; // bad return type from system.multicall |
|
1245 | 1245 | } |
1246 | 1246 | $numRets = $rets->count(); |
1247 | 1247 | if ($numRets != count($reqs)) { |
1248 | - return false; // wrong number of return values. |
|
1248 | + return false; // wrong number of return values. |
|
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | $response = array(); |
1252 | - foreach($rets as $val) { |
|
1252 | + foreach ($rets as $val) { |
|
1253 | 1253 | switch ($val->kindOf()) { |
1254 | 1254 | case 'array': |
1255 | 1255 | if ($val->count() != 1) { |
1256 | - return false; // Bad value |
|
1256 | + return false; // Bad value |
|
1257 | 1257 | } |
1258 | 1258 | // Normal return value |
1259 | 1259 | $response[] = new Response($val[0]); |