@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Please _do not_ copy this file verbatim into your production server. |
10 | 10 | */ |
11 | 11 | |
12 | -require_once __DIR__ . "/_prepend.php"; |
|
12 | +require_once __DIR__."/_prepend.php"; |
|
13 | 13 | |
14 | 14 | use PhpXmlRpc\PhpXmlRpc; |
15 | 15 | use PhpXmlRpc\Response; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ), |
62 | 62 | // Greek word 'kosme'. NB: NOT a valid ISO8859 string! |
63 | 63 | // NB: we can only register this when setting internal encoding to UTF-8, or it will break system.listMethods |
64 | - "tests.utf8methodname." . 'κόσμε' => array( |
|
64 | + "tests.utf8methodname.".'κόσμε' => array( |
|
65 | 65 | "function" => "stringEcho", |
66 | 66 | "signature" => $stringecho_sig, |
67 | 67 | "docstring" => $stringecho_doc, |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } elseif ($_GET['FORCE_AUTH'] == 'Digest') { |
114 | 114 | if (empty($_SERVER['PHP_AUTH_DIGEST'])) { |
115 | 115 | header('HTTP/1.1 401 Unauthorized'); |
116 | - header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"'); |
|
116 | + header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"'); |
|
117 | 117 | die('Text visible if user hits Cancel button'); |
118 | 118 | } |
119 | 119 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license code licensed under the BSD License: see file license.txt |
11 | 11 | */ |
12 | 12 | |
13 | -require_once __DIR__ . "/_prepend.php"; |
|
13 | +require_once __DIR__."/_prepend.php"; |
|
14 | 14 | |
15 | 15 | // *** NB: WE BLOCK THIS FROM RUNNING BY DEFAULT IN CASE ACCESS IS GRANTED TO IT IN PRODUCTION BY MISTAKE *** |
16 | 16 | // Comment out the following safeguard if you want to use it as is, but remember: this is an open relay !!! |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | // NB: here we should validate the received url, using f.e. a whitelist... |
36 | 36 | $client = new PhpXmlRpc\Client($url); |
37 | 37 | |
38 | - if ($req->getNumParams() > 3) { |
|
38 | + if ($req->getNumParams()>3) { |
|
39 | 39 | // we have to set some options onto the client. |
40 | 40 | // Note that if we do not untaint the received values, warnings might be generated... |
41 | 41 | $options = $encoder->decode($req->getParam(3)); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $client->setSSLVerifyPeer($val); |
58 | 58 | break; |
59 | 59 | case 'Timeout': |
60 | - $timeout = (integer)$val; |
|
60 | + $timeout = (integer) $val; |
|
61 | 61 | break; |
62 | 62 | } // switch |
63 | 63 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | // add debug info into response we give back to caller |
78 | - PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: " . $req->serialize()); |
|
78 | + PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: ".$req->serialize()); |
|
79 | 79 | |
80 | 80 | return $client->send($req, $timeout); |
81 | 81 | } |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | if (count($this->xml_iso88591_Entities['in'])) { |
72 | 72 | return; |
73 | 73 | } |
74 | - for ($i = 0; $i < 32; $i++) { |
|
74 | + for ($i = 0; $i<32; $i++) { |
|
75 | 75 | $this->xml_iso88591_Entities["in"][] = chr($i); |
76 | 76 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
77 | 77 | } |
78 | 78 | |
79 | 79 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
80 | 80 | |
81 | - for ($i = 160; $i < 256; $i++) { |
|
81 | + for ($i = 160; $i<256; $i++) { |
|
82 | 82 | $this->xml_iso88591_Entities["in"][] = chr($i); |
83 | 83 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
84 | 84 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | break;*/ |
107 | 107 | |
108 | 108 | default: |
109 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
109 | + throw new \Exception('Unsupported table: '.$tableName); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $destEncoding = 'US-ASCII'; |
150 | 150 | } |
151 | 151 | |
152 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
152 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
153 | 153 | |
154 | 154 | // list ordered with (expected) most common scenarios first |
155 | 155 | switch ($conversion) { |
@@ -167,20 +167,20 @@ discard block |
||
167 | 167 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
168 | 168 | $escapedData = ''; |
169 | 169 | // be kind to users creating string xmlrpc values out of different php types |
170 | - $data = (string)$data; |
|
170 | + $data = (string) $data; |
|
171 | 171 | $ns = strlen($data); |
172 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
172 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
173 | 173 | $ch = $data[$nn]; |
174 | 174 | $ii = ord($ch); |
175 | 175 | // 7 bits in 1 byte: 0bbbbbbb (127) |
176 | - if ($ii < 32) { |
|
176 | + if ($ii<32) { |
|
177 | 177 | if ($conversion == 'UTF-8_US-ASCII') { |
178 | 178 | $escapedData .= sprintf('&#%d;', $ii); |
179 | 179 | } else { |
180 | 180 | $escapedData .= $ch; |
181 | 181 | } |
182 | 182 | } |
183 | - else if ($ii < 128) { |
|
183 | + else if ($ii<128) { |
|
184 | 184 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
185 | 185 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
186 | 186 | switch ($ii) { |
@@ -205,25 +205,25 @@ discard block |
||
205 | 205 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
206 | 206 | elseif ($ii >> 5 == 6) { |
207 | 207 | $b1 = ($ii & 31); |
208 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
209 | - $ii = ($b1 * 64) + $b2; |
|
208 | + $b2 = (ord($data[$nn+1]) & 63); |
|
209 | + $ii = ($b1 * 64)+$b2; |
|
210 | 210 | $escapedData .= sprintf('&#%d;', $ii); |
211 | 211 | $nn += 1; |
212 | 212 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
213 | 213 | elseif ($ii >> 4 == 14) { |
214 | 214 | $b1 = ($ii & 15); |
215 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
216 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
217 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
215 | + $b2 = (ord($data[$nn+1]) & 63); |
|
216 | + $b3 = (ord($data[$nn+2]) & 63); |
|
217 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
218 | 218 | $escapedData .= sprintf('&#%d;', $ii); |
219 | 219 | $nn += 2; |
220 | 220 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
221 | 221 | elseif ($ii >> 3 == 30) { |
222 | 222 | $b1 = ($ii & 7); |
223 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
224 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
225 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
226 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
223 | + $b2 = (ord($data[$nn+1]) & 63); |
|
224 | + $b3 = (ord($data[$nn+2]) & 63); |
|
225 | + $b4 = (ord($data[$nn+3]) & 63); |
|
226 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
227 | 227 | $escapedData .= sprintf('&#%d;', $ii); |
228 | 228 | $nn += 3; |
229 | 229 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | default: |
274 | 274 | $escapedData = ''; |
275 | 275 | /// @todo allow usage of a custom Logger via the DIC(ish) pattern we use in other classes |
276 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
276 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return $escapedData; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | case 'iso88591': |
327 | 327 | return $this->xml_iso88591_Entities; |
328 | 328 | default: |
329 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
329 | + throw new \Exception('Unsupported charset: '.$charset); |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 | } |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | $server = $parts['host']; |
159 | 159 | $path = isset($parts['path']) ? $parts['path'] : ''; |
160 | 160 | if (isset($parts['query'])) { |
161 | - $path .= '?' . $parts['query']; |
|
161 | + $path .= '?'.$parts['query']; |
|
162 | 162 | } |
163 | 163 | if (isset($parts['fragment'])) { |
164 | - $path .= '#' . $parts['fragment']; |
|
164 | + $path .= '#'.$parts['fragment']; |
|
165 | 165 | } |
166 | 166 | if (isset($parts['port'])) { |
167 | 167 | $port = $parts['port']; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | } |
179 | 179 | if ($path == '' || $path[0] != '/') { |
180 | - $this->path = '/' . $path; |
|
180 | + $this->path = '/'.$path; |
|
181 | 181 | } else { |
182 | 182 | $this->path = $path; |
183 | 183 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | }*/ |
216 | 216 | |
217 | 217 | // initialize user_agent string |
218 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
218 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | */ |
595 | 595 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
596 | 596 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
597 | - $method='http') |
|
597 | + $method = 'http') |
|
598 | 598 | { |
599 | 599 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
600 | 600 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * |
628 | 628 | * @return Response |
629 | 629 | */ |
630 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
630 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
631 | 631 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
632 | 632 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
633 | 633 | $sslVersion = 0) |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | */ |
668 | 668 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
669 | 669 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
670 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
670 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
671 | 671 | $sslVersion = 0) |
672 | 672 | { |
673 | 673 | /// @todo log a warning if passed an unsupported method |
@@ -703,16 +703,16 @@ discard block |
||
703 | 703 | // thanks to Grant Rauscher <[email protected]> for this |
704 | 704 | $credentials = ''; |
705 | 705 | if ($username != '') { |
706 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
706 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
707 | 707 | if ($authType != 1) { |
708 | 708 | /// @todo make this a proper error, ie. return a failure |
709 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
709 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | |
713 | 713 | $acceptedEncoding = ''; |
714 | 714 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
715 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
715 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | $proxyCredentials = ''; |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | $connectPort = $proxyPort; |
725 | 725 | $transport = 'tcp'; |
726 | 726 | /// @todo check: should we not use https in some cases? |
727 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
727 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
728 | 728 | if ($proxyUsername != '') { |
729 | 729 | if ($proxyAuthType != 1) { |
730 | 730 | /// @todo make this a proper error, ie. return a failure |
731 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
731 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
732 | 732 | } |
733 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
733 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
734 | 734 | } |
735 | 735 | } else { |
736 | 736 | $connectServer = $server; |
@@ -745,45 +745,45 @@ discard block |
||
745 | 745 | $version = ''; |
746 | 746 | foreach ($this->cookies as $name => $cookie) { |
747 | 747 | if ($cookie['version']) { |
748 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
749 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
748 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
749 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
750 | 750 | if ($cookie['path']) { |
751 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
751 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
752 | 752 | } |
753 | 753 | if ($cookie['domain']) { |
754 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
754 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
755 | 755 | } |
756 | 756 | if ($cookie['port']) { |
757 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
757 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
758 | 758 | } |
759 | 759 | } else { |
760 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
760 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
761 | 761 | } |
762 | 762 | } |
763 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
763 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | // omit port if default |
767 | 767 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
768 | - $port = ''; |
|
768 | + $port = ''; |
|
769 | 769 | } else { |
770 | - $port = ':' . $port; |
|
770 | + $port = ':'.$port; |
|
771 | 771 | } |
772 | 772 | |
773 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
774 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
775 | - 'Host: ' . $server . $port . "\r\n" . |
|
776 | - $credentials . |
|
777 | - $proxyCredentials . |
|
778 | - $acceptedEncoding . |
|
779 | - $encodingHdr . |
|
780 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
781 | - $cookieHeader . |
|
782 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
783 | - strlen($payload) . "\r\n\r\n" . |
|
773 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
774 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
775 | + 'Host: '.$server.$port."\r\n". |
|
776 | + $credentials. |
|
777 | + $proxyCredentials. |
|
778 | + $acceptedEncoding. |
|
779 | + $encodingHdr. |
|
780 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
781 | + $cookieHeader. |
|
782 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
783 | + strlen($payload)."\r\n\r\n". |
|
784 | 784 | $payload; |
785 | 785 | |
786 | - if ($this->debug > 1) { |
|
786 | + if ($this->debug>1) { |
|
787 | 787 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
788 | 788 | } |
789 | 789 | |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | |
811 | 811 | $context = stream_context_create($contextOptions); |
812 | 812 | |
813 | - if ($timeout <= 0) { |
|
813 | + if ($timeout<=0) { |
|
814 | 814 | $connectTimeout = ini_get('default_socket_timeout'); |
815 | 815 | } else { |
816 | 816 | $connectTimeout = $timeout; |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
823 | 823 | STREAM_CLIENT_CONNECT, $context); |
824 | 824 | if ($fp) { |
825 | - if ($timeout > 0) { |
|
825 | + if ($timeout>0) { |
|
826 | 826 | stream_set_timeout($fp, $timeout, 0); |
827 | 827 | } |
828 | 828 | } else { |
@@ -831,8 +831,8 @@ discard block |
||
831 | 831 | $this->errstr = $err['message']; |
832 | 832 | } |
833 | 833 | |
834 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
835 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
834 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
835 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
836 | 836 | |
837 | 837 | return $r; |
838 | 838 | } |
@@ -921,18 +921,18 @@ discard block |
||
921 | 921 | $keyPass, $sslVersion); |
922 | 922 | |
923 | 923 | if (!$curl) { |
924 | - return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details'); |
|
924 | + return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details'); |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | $result = curl_exec($curl); |
928 | 928 | |
929 | - if ($this->debug > 1) { |
|
929 | + if ($this->debug>1) { |
|
930 | 930 | $message = "---CURL INFO---\n"; |
931 | 931 | foreach (curl_getinfo($curl) as $name => $val) { |
932 | 932 | if (is_array($val)) { |
933 | 933 | $val = implode("\n", $val); |
934 | 934 | } |
935 | - $message .= $name . ': ' . $val . "\n"; |
|
935 | + $message .= $name.': '.$val."\n"; |
|
936 | 936 | } |
937 | 937 | $message .= '---END---'; |
938 | 938 | $this->getLogger()->debugMessage($message); |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | /// @todo we should use a better check here - what if we get back '' or '0'? |
943 | 943 | |
944 | 944 | $this->errstr = 'no response'; |
945 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
945 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
946 | 946 | curl_close($curl); |
947 | 947 | if ($keepAlive) { |
948 | 948 | $this->xmlrpc_curl_handle = null; |
@@ -1012,12 +1012,12 @@ discard block |
||
1012 | 1012 | // http, https |
1013 | 1013 | $protocol = $method; |
1014 | 1014 | if (strpos($protocol, ':') !== false) { |
1015 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1015 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'"); |
|
1016 | 1016 | return false; |
1017 | 1017 | } |
1018 | 1018 | } |
1019 | 1019 | } |
1020 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
1020 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
1021 | 1021 | if (!$curl) { |
1022 | 1022 | return false; |
1023 | 1023 | } |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | // results into variable |
1032 | 1032 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
1033 | 1033 | |
1034 | - if ($this->debug > 1) { |
|
1034 | + if ($this->debug>1) { |
|
1035 | 1035 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
1036 | 1036 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
1037 | 1037 | } |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | } |
1057 | 1057 | } |
1058 | 1058 | // extra headers |
1059 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
1059 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
1060 | 1060 | // if no keepalive is wanted, let the server know it in advance |
1061 | 1061 | if (!$keepAlive) { |
1062 | 1062 | $headers[] = 'Connection: close'; |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
1074 | 1074 | // timeout is borked |
1075 | 1075 | if ($timeout) { |
1076 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
1076 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | switch ($method) { |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
1089 | 1089 | } else { |
1090 | 1090 | /// @todo make this a proper error, ie. return a failure |
1091 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1091 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install'); |
|
1092 | 1092 | } |
1093 | 1093 | break; |
1094 | 1094 | case 'h2': |
@@ -1097,12 +1097,12 @@ discard block |
||
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | if ($username && $password) { |
1100 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1100 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1101 | 1101 | if (defined('CURLOPT_HTTPAUTH')) { |
1102 | 1102 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1103 | 1103 | } elseif ($authType != 1) { |
1104 | 1104 | /// @todo make this a proper error, ie. return a failure |
1105 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1105 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | |
@@ -1145,14 +1145,14 @@ discard block |
||
1145 | 1145 | if ($proxyPort == 0) { |
1146 | 1146 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1147 | 1147 | } |
1148 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1148 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1149 | 1149 | if ($proxyUsername) { |
1150 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1150 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1151 | 1151 | if (defined('CURLOPT_PROXYAUTH')) { |
1152 | 1152 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1153 | 1153 | } elseif ($proxyAuthType != 1) { |
1154 | 1154 | /// @todo make this a proper error, ie. return a failure |
1155 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1155 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1156 | 1156 | } |
1157 | 1157 | } |
1158 | 1158 | } |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | if (count($this->cookies)) { |
1163 | 1163 | $cookieHeader = ''; |
1164 | 1164 | foreach ($this->cookies as $name => $cookie) { |
1165 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1165 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1166 | 1166 | } |
1167 | 1167 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1168 | 1168 | } |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | curl_setopt($curl, $opt, $val); |
1172 | 1172 | } |
1173 | 1173 | |
1174 | - if ($this->debug > 1) { |
|
1174 | + if ($this->debug>1) { |
|
1175 | 1175 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
1176 | 1176 | } |
1177 | 1177 | |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | $call['methodName'] = new Value($req->method(), 'string'); |
1272 | 1272 | $numParams = $req->getNumParams(); |
1273 | 1273 | $params = array(); |
1274 | - for ($i = 0; $i < $numParams; $i++) { |
|
1274 | + for ($i = 0; $i<$numParams; $i++) { |
|
1275 | 1275 | $params[$i] = $req->getParam($i); |
1276 | 1276 | } |
1277 | 1277 | $call['params'] = new Value($params, 'array'); |
@@ -1296,15 +1296,15 @@ discard block |
||
1296 | 1296 | } elseif ($this->return_type == 'phpvals') { |
1297 | 1297 | /// @todo test this code branch... |
1298 | 1298 | if (!is_array($rets)) { |
1299 | - return false; // bad return type from system.multicall |
|
1299 | + return false; // bad return type from system.multicall |
|
1300 | 1300 | } |
1301 | 1301 | $numRets = count($rets); |
1302 | 1302 | if ($numRets != count($reqs)) { |
1303 | - return false; // wrong number of return values. |
|
1303 | + return false; // wrong number of return values. |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | $response = array(); |
1307 | - for ($i = 0; $i < $numRets; $i++) { |
|
1307 | + for ($i = 0; $i<$numRets; $i++) { |
|
1308 | 1308 | $val = $rets[$i]; |
1309 | 1309 | if (!is_array($val)) { |
1310 | 1310 | return false; |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | switch (count($val)) { |
1313 | 1313 | case 1: |
1314 | 1314 | if (!isset($val[0])) { |
1315 | - return false; // Bad value |
|
1315 | + return false; // Bad value |
|
1316 | 1316 | } |
1317 | 1317 | // Normal return value |
1318 | 1318 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1338,11 +1338,11 @@ discard block |
||
1338 | 1338 | } else { |
1339 | 1339 | // return type == 'xmlrpcvals' |
1340 | 1340 | if ($rets->kindOf() != 'array') { |
1341 | - return false; // bad return type from system.multicall |
|
1341 | + return false; // bad return type from system.multicall |
|
1342 | 1342 | } |
1343 | 1343 | $numRets = $rets->count(); |
1344 | 1344 | if ($numRets != count($reqs)) { |
1345 | - return false; // wrong number of return values. |
|
1345 | + return false; // wrong number of return values. |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | $response = array(); |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | switch ($val->kindOf()) { |
1351 | 1351 | case 'array': |
1352 | 1352 | if ($val->count() != 1) { |
1353 | - return false; // Bad value |
|
1353 | + return false; // Bad value |
|
1354 | 1354 | } |
1355 | 1355 | // Normal return value |
1356 | 1356 | $response[] = new Response($val[0]); |