Rev 1005 | Rev 1200 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
939 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 RDAP |
||
5 | * Copyright 2019 - 2022 Daniel Marschall, ViaThinkSoft |
||
6 | * Authors Daniel Marschall, ViaThinkSoft |
||
7 | * Till Wehowski, Frdlweb |
||
8 | * |
||
9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
10 | * you may not use this file except in compliance with the License. |
||
11 | * You may obtain a copy of the License at |
||
12 | * |
||
13 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
14 | * |
||
15 | * Unless required by applicable law or agreed to in writing, software |
||
16 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
18 | * See the License for the specific language governing permissions and |
||
19 | * limitations under the License. |
||
20 | */ |
||
21 | |||
1050 | daniel-mar | 22 | use ViaThinkSoft\OIDplus\OIDplus; |
23 | use ViaThinkSoft\OIDplus\OIDplusGui; |
||
24 | use ViaThinkSoft\OIDplus\OIDplusException; |
||
25 | use Frdlweb\OIDplus\OIDplusRDAP; |
||
26 | |||
939 | daniel-mar | 27 | require_once __DIR__ . '/../../../../../includes/oidplus.inc.php'; |
28 | |||
29 | OIDplus::init(true); |
||
1050 | daniel-mar | 30 | set_exception_handler(array(OIDplusGui::class, 'html_exception_handler')); |
939 | daniel-mar | 31 | |
1050 | daniel-mar | 32 | if (OIDplus::baseConfig()->getValue('DISABLE_PLUGIN_Frdlweb\OIDplus\OIDplusPagePublicRdap', false)) { |
939 | daniel-mar | 33 | throw new OIDplusException(_L('This plugin was disabled by the system administrator!')); |
34 | } |
||
35 | |||
944 | daniel-mar | 36 | originHeaders(); |
37 | |||
939 | daniel-mar | 38 | if (\PHP_SAPI == 'cli') { |
39 | if ($_SERVER['argc'] != 2) { |
||
40 | echo _L('Syntax').': '.$_SERVER['argv'][0].' <query>'."\n"; |
||
41 | exit(2); |
||
42 | } |
||
43 | $query = $_SERVER['argv'][1]; |
||
44 | } else { |
||
45 | if (!isset($_REQUEST['query'])) { |
||
46 | http_response_code(400); |
||
47 | die('<h1>'._L('Error').'</h1><p>'._L('Argument "%1" is missing','query').'<p>'); |
||
48 | } |
||
49 | $query = $_REQUEST['query']; |
||
50 | } |
||
51 | |||
943 | daniel-mar | 52 | $x = new OIDplusRDAP(); |
53 | list($out_content, $out_type) = $x->rdapQuery($query); |
||
1005 | daniel-mar | 54 | |
55 | OIDplus::invoke_shutdown(); |
||
56 | |||
943 | daniel-mar | 57 | if ($out_type) header('Content-Type:'.$out_type); |
950 | daniel-mar | 58 | echo $out_content; |