Subversion Repositories oidplus

Rev

Rev 1005 | Rev 1081 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /*
  4.  * OIDplus 2.0
  5.  * Copyright 2019 - 2022 Daniel Marschall, ViaThinkSoft
  6.  *
  7.  * Licensed under the Apache License, Version 2.0 (the "License");
  8.  * you may not use this file except in compliance with the License.
  9.  * You may obtain a copy of the License at
  10.  *
  11.  *     http://www.apache.org/licenses/LICENSE-2.0
  12.  *
  13.  * Unless required by applicable law or agreed to in writing, software
  14.  * distributed under the License is distributed on an "AS IS" BASIS,
  15.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16.  * See the License for the specific language governing permissions and
  17.  * limitations under the License.
  18.  */
  19.  
  20. use ViaThinkSoft\OIDplus\OIDplus;
  21. use ViaThinkSoft\OIDplus\OIDplusGui;
  22. use ViaThinkSoft\OIDplus\OIDplusException;
  23. use ViaThinkSoft\OIDplus\OIDplusOIDIP;
  24.  
  25. require_once __DIR__ . '/../../../../../includes/oidplus.inc.php';
  26.  
  27. OIDplus::init(true);
  28. set_exception_handler(array(OIDplusGui::class, 'html_exception_handler'));
  29.  
  30. if (OIDplus::baseConfig()->getValue('DISABLE_PLUGIN_ViaThinkSoft\OIDplus\OIDplusPagePublicWhois', false)) {
  31.         throw new OIDplusException(_L('This plugin was disabled by the system administrator!'));
  32. }
  33.  
  34. originHeaders();
  35.  
  36. // Step 0: Get request parameter
  37.  
  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.  
  52.  
  53. $x = new OIDplusOIDIP();
  54. list($out_content, $out_type) = $x->oidipQuery($query);
  55.  
  56. OIDplus::invoke_shutdown();
  57.  
  58. if ($out_type) header('Content-Type:'.$out_type);
  59. echo $out_content;
  60.