@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | $server = $parts['host']; |
152 | 152 | $path = isset($parts['path']) ? $parts['path'] : ''; |
153 | 153 | if (isset($parts['query'])) { |
154 | - $path .= '?' . $parts['query']; |
|
154 | + $path .= '?'.$parts['query']; |
|
155 | 155 | } |
156 | 156 | if (isset($parts['fragment'])) { |
157 | - $path .= '#' . $parts['fragment']; |
|
157 | + $path .= '#'.$parts['fragment']; |
|
158 | 158 | } |
159 | 159 | if (isset($parts['port'])) { |
160 | 160 | $port = $parts['port']; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | if ($path == '' || $path[0] != '/') { |
173 | - $this->path = '/' . $path; |
|
173 | + $this->path = '/'.$path; |
|
174 | 174 | } else { |
175 | 175 | $this->path = $path; |
176 | 176 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | }*/ |
209 | 209 | |
210 | 210 | // initialize user_agent string |
211 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
211 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | */ |
582 | 582 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
583 | 583 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
584 | - $method='http') |
|
584 | + $method = 'http') |
|
585 | 585 | { |
586 | 586 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
587 | 587 | |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | * @param int $sslVersion |
614 | 614 | * @return Response |
615 | 615 | */ |
616 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
616 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
617 | 617 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
618 | 618 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
619 | 619 | $sslVersion = 0) |
@@ -650,11 +650,11 @@ discard block |
||
650 | 650 | */ |
651 | 651 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
652 | 652 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
653 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
653 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
654 | 654 | $sslVersion = 0) |
655 | 655 | { |
656 | 656 | if ($port == 0) { |
657 | - $port = ( $method === 'https' ) ? 443 : 80; |
|
657 | + $port = ($method === 'https') ? 443 : 80; |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | // Only create the payload if it was not created previously |
@@ -684,15 +684,15 @@ discard block |
||
684 | 684 | // thanks to Grant Rauscher <[email protected]> for this |
685 | 685 | $credentials = ''; |
686 | 686 | if ($username != '') { |
687 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
687 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
688 | 688 | if ($authType != 1) { |
689 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
689 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
690 | 690 | } |
691 | 691 | } |
692 | 692 | |
693 | 693 | $acceptedEncoding = ''; |
694 | 694 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
695 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
695 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | $proxyCredentials = ''; |
@@ -703,17 +703,17 @@ discard block |
||
703 | 703 | $connectServer = $proxyHost; |
704 | 704 | $connectPort = $proxyPort; |
705 | 705 | $transport = 'tcp'; |
706 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
706 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
707 | 707 | if ($proxyUsername != '') { |
708 | 708 | if ($proxyAuthType != 1) { |
709 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
709 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
710 | 710 | } |
711 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
711 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
712 | 712 | } |
713 | 713 | } else { |
714 | 714 | $connectServer = $server; |
715 | 715 | $connectPort = $port; |
716 | - $transport = ( $method === 'https' ) ? 'tls' : 'tcp'; |
|
716 | + $transport = ($method === 'https') ? 'tls' : 'tcp'; |
|
717 | 717 | $uri = $this->path; |
718 | 718 | } |
719 | 719 | |
@@ -723,45 +723,45 @@ discard block |
||
723 | 723 | $version = ''; |
724 | 724 | foreach ($this->cookies as $name => $cookie) { |
725 | 725 | if ($cookie['version']) { |
726 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
727 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
726 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
727 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
728 | 728 | if ($cookie['path']) { |
729 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
729 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
730 | 730 | } |
731 | 731 | if ($cookie['domain']) { |
732 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
732 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
733 | 733 | } |
734 | 734 | if ($cookie['port']) { |
735 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
735 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
736 | 736 | } |
737 | 737 | } else { |
738 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
738 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
739 | 739 | } |
740 | 740 | } |
741 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
741 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | // omit port if default |
745 | 745 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
746 | - $port = ''; |
|
746 | + $port = ''; |
|
747 | 747 | } else { |
748 | - $port = ':' . $port; |
|
748 | + $port = ':'.$port; |
|
749 | 749 | } |
750 | 750 | |
751 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
752 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
753 | - 'Host: ' . $server . $port . "\r\n" . |
|
754 | - $credentials . |
|
755 | - $proxyCredentials . |
|
756 | - $acceptedEncoding . |
|
757 | - $encodingHdr . |
|
758 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
759 | - $cookieHeader . |
|
760 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
761 | - strlen($payload) . "\r\n\r\n" . |
|
751 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
752 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
753 | + 'Host: '.$server.$port."\r\n". |
|
754 | + $credentials. |
|
755 | + $proxyCredentials. |
|
756 | + $acceptedEncoding. |
|
757 | + $encodingHdr. |
|
758 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
759 | + $cookieHeader. |
|
760 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
761 | + strlen($payload)."\r\n\r\n". |
|
762 | 762 | $payload; |
763 | 763 | |
764 | - if ($this->debug > 1) { |
|
764 | + if ($this->debug>1) { |
|
765 | 765 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
766 | 766 | } |
767 | 767 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | |
789 | 789 | $context = stream_context_create($contextOptions); |
790 | 790 | |
791 | - if ($timeout <= 0) { |
|
791 | + if ($timeout<=0) { |
|
792 | 792 | $connectTimeout = ini_get('default_socket_timeout'); |
793 | 793 | } else { |
794 | 794 | $connectTimeout = $timeout; |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
801 | 801 | STREAM_CLIENT_CONNECT, $context); |
802 | 802 | if ($fp) { |
803 | - if ($timeout > 0) { |
|
803 | + if ($timeout>0) { |
|
804 | 804 | stream_set_timeout($fp, $timeout); |
805 | 805 | } |
806 | 806 | } else { |
@@ -809,8 +809,8 @@ discard block |
||
809 | 809 | $this->errstr = $err['message']; |
810 | 810 | } |
811 | 811 | |
812 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
813 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
812 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
813 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
814 | 814 | |
815 | 815 | return $r; |
816 | 816 | } |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | $encodingHdr = ''; |
921 | 921 | } |
922 | 922 | |
923 | - if ($this->debug > 1) { |
|
923 | + if ($this->debug>1) { |
|
924 | 924 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
925 | 925 | } |
926 | 926 | |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | $protocol = $method; |
935 | 935 | } |
936 | 936 | } |
937 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
937 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
938 | 938 | if ($keepAlive) { |
939 | 939 | $this->xmlrpc_curl_handle = $curl; |
940 | 940 | } |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | // results into variable |
946 | 946 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
947 | 947 | |
948 | - if ($this->debug > 1) { |
|
948 | + if ($this->debug>1) { |
|
949 | 949 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
950 | 950 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
951 | 951 | } |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | } |
971 | 971 | } |
972 | 972 | // extra headers |
973 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
973 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
974 | 974 | // if no keepalive is wanted, let the server know it in advance |
975 | 975 | if (!$keepAlive) { |
976 | 976 | $headers[] = 'Connection: close'; |
@@ -987,10 +987,10 @@ discard block |
||
987 | 987 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
988 | 988 | // timeout is borked |
989 | 989 | if ($timeout) { |
990 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
990 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
991 | 991 | } |
992 | 992 | |
993 | - switch($method) { |
|
993 | + switch ($method) { |
|
994 | 994 | case 'http10': |
995 | 995 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
996 | 996 | break; |
@@ -1006,11 +1006,11 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | if ($username && $password) { |
1009 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1009 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1010 | 1010 | if (defined('CURLOPT_HTTPAUTH')) { |
1011 | 1011 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1012 | 1012 | } elseif ($authType != 1) { |
1013 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1013 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | |
@@ -1052,13 +1052,13 @@ discard block |
||
1052 | 1052 | if ($proxyPort == 0) { |
1053 | 1053 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1054 | 1054 | } |
1055 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1055 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1056 | 1056 | if ($proxyUsername) { |
1057 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1057 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1058 | 1058 | if (defined('CURLOPT_PROXYAUTH')) { |
1059 | 1059 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1060 | 1060 | } elseif ($proxyAuthType != 1) { |
1061 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1061 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1062 | 1062 | } |
1063 | 1063 | } |
1064 | 1064 | } |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | if (count($this->cookies)) { |
1069 | 1069 | $cookieHeader = ''; |
1070 | 1070 | foreach ($this->cookies as $name => $cookie) { |
1071 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1071 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1072 | 1072 | } |
1073 | 1073 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1074 | 1074 | } |
@@ -1079,13 +1079,13 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | $result = curl_exec($curl); |
1081 | 1081 | |
1082 | - if ($this->debug > 1) { |
|
1082 | + if ($this->debug>1) { |
|
1083 | 1083 | $message = "---CURL INFO---\n"; |
1084 | 1084 | foreach (curl_getinfo($curl) as $name => $val) { |
1085 | 1085 | if (is_array($val)) { |
1086 | 1086 | $val = implode("\n", $val); |
1087 | 1087 | } |
1088 | - $message .= $name . ': ' . $val . "\n"; |
|
1088 | + $message .= $name.': '.$val."\n"; |
|
1089 | 1089 | } |
1090 | 1090 | $message .= '---END---'; |
1091 | 1091 | $this->getLogger()->debugMessage($message); |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1096 | 1096 | |
1097 | 1097 | $this->errstr = 'no response'; |
1098 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1098 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1099 | 1099 | curl_close($curl); |
1100 | 1100 | if ($keepAlive) { |
1101 | 1101 | $this->xmlrpc_curl_handle = null; |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | $call['methodName'] = new Value($req->method(), 'string'); |
1206 | 1206 | $numParams = $req->getNumParams(); |
1207 | 1207 | $params = array(); |
1208 | - for ($i = 0; $i < $numParams; $i++) { |
|
1208 | + for ($i = 0; $i<$numParams; $i++) { |
|
1209 | 1209 | $params[$i] = $req->getParam($i); |
1210 | 1210 | } |
1211 | 1211 | $call['params'] = new Value($params, 'array'); |
@@ -1231,15 +1231,15 @@ discard block |
||
1231 | 1231 | /// @todo test this code branch... |
1232 | 1232 | $rets = $result->value(); |
1233 | 1233 | if (!is_array($rets)) { |
1234 | - return false; // bad return type from system.multicall |
|
1234 | + return false; // bad return type from system.multicall |
|
1235 | 1235 | } |
1236 | 1236 | $numRets = count($rets); |
1237 | 1237 | if ($numRets != count($reqs)) { |
1238 | - return false; // wrong number of return values. |
|
1238 | + return false; // wrong number of return values. |
|
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | $response = array(); |
1242 | - for ($i = 0; $i < $numRets; $i++) { |
|
1242 | + for ($i = 0; $i<$numRets; $i++) { |
|
1243 | 1243 | $val = $rets[$i]; |
1244 | 1244 | if (!is_array($val)) { |
1245 | 1245 | return false; |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | switch (count($val)) { |
1248 | 1248 | case 1: |
1249 | 1249 | if (!isset($val[0])) { |
1250 | - return false; // Bad value |
|
1250 | + return false; // Bad value |
|
1251 | 1251 | } |
1252 | 1252 | // Normal return value |
1253 | 1253 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1275,19 +1275,19 @@ discard block |
||
1275 | 1275 | |
1276 | 1276 | $rets = $result->value(); |
1277 | 1277 | if ($rets->kindOf() != 'array') { |
1278 | - return false; // bad return type from system.multicall |
|
1278 | + return false; // bad return type from system.multicall |
|
1279 | 1279 | } |
1280 | 1280 | $numRets = $rets->count(); |
1281 | 1281 | if ($numRets != count($reqs)) { |
1282 | - return false; // wrong number of return values. |
|
1282 | + return false; // wrong number of return values. |
|
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | $response = array(); |
1286 | - foreach($rets as $val) { |
|
1286 | + foreach ($rets as $val) { |
|
1287 | 1287 | switch ($val->kindOf()) { |
1288 | 1288 | case 'array': |
1289 | 1289 | if ($val->count() != 1) { |
1290 | - return false; // Bad value |
|
1290 | + return false; // Bad value |
|
1291 | 1291 | } |
1292 | 1292 | // Normal return value |
1293 | 1293 | $response[] = new Response($val[0]); |