Lines Matching +full:php +full:- +full:versions

1 <?php
12 /** @var float The XML-RPC Version. 0 is our own simplified variant */
20 $this->remote = new Api();
26 …am string $body Should only be set for testing, otherwise the request body is read from php://input
37 throw new RemoteException("JSON-RPC server not enabled.", -32605);
40 header('Access-Control-Allow-Origin: ' . $conf['remotecors']);
42 if ($INPUT->server->str('REQUEST_METHOD') !== 'POST') {
45 throw new RemoteException("JSON-RPC server only accepts POST requests.", -32606);
47 [$contentType] = explode(';', $INPUT->server->str('CONTENT_TYPE'), 2); // ignore charset
48 $contentType = strtolower($contentType); // mime types are case-insensitive
51 … throw new RemoteException("JSON-RPC server only accepts application/json requests.", -32606);
56 $body = file_get_contents('php://input');
65 throw new RemoteException("JSON-RPC server only accepts valid JSON.", -32700);
68 return $this->createResponse($data);
74 * This should handle all JSON-RPC versions and our simplified version
76 * @link https://en.wikipedia.org/wiki/JSON-RPC
91 $this->version = 1;
99 $this->version = (float)$data['jsonrpc'];
105 $this->version = (float)$data['version'];
109 $method = $INPUT->server->str('PATH_INFO');
112 $this->version = 0;
116 $return['result'] = $this->call($method, $params);
117 $this->addErrorData($return); // handles non-error info
130 $this->addErrorData($return, $exception);
146 'code' => $e->getCode() ?: 1, // 0 is success, so we use 1 as default
147 'message' => $e->getMessage()
151 if ($this->version > 0 && $this->version < 2) {
154 } elseif ($this->version < 1) {
176 return $this->remote->call($methodname, $args);
180 … throw new RemoteException("server error. not authorized to call method $methodname", -32603);
183 … throw new RemoteException("server error. forbidden to call the method $methodname", -32604);