Subversion Repositories oidplus

Rev

Rev 1115 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /*
  4.  * OIDplus 2.0
  5.  * Copyright 2019 - 2023 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.  
  22. require_once __DIR__ . '/includes/oidplus.inc.php';
  23.  
  24. header('Content-Type:application/json; charset=UTF-8');
  25.  
  26. try {
  27.         OIDplus::init(false);
  28. } catch (Exception $e) {
  29.         OIDplus::invoke_shutdown();
  30.         $out = array(
  31.                 "error" => $e->getMessage()
  32.         );
  33.         echo json_encode($out);
  34.         die();
  35. }
  36.  
  37.  
  38. # ---
  39.  
  40. $out = array();
  41.  
  42. $sysid_id = OIDplus::getSystemId(false);
  43. if (!$sysid_id) $sysid_id = 'unknown'; // do not translate
  44. $out['SystemID'] = $sysid_id;
  45.  
  46. $sysid_oid = OIDplus::getSystemId(true);
  47. if (!$sysid_oid) $sysid_oid = 'unknown'; // do not translate
  48. $out['SystemOID'] = $sysid_oid;
  49.  
  50. $sysid_guid = OIDplus::getSystemGuid();
  51. if (!$sysid_guid) $sysid_guid = 'unknown'; // do not translate
  52. $out['SystemGUID'] = $sysid_guid;
  53.  
  54. $pubKey = OIDplus::getSystemPublicKey();
  55. if (!$pubKey) $pubKey = 'unknown'; // do not translate
  56. $out['PublicKey'] = $pubKey;
  57.  
  58. $sys_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL);
  59. $out['SystemURL'] = $sys_url;
  60.  
  61. $sys_title = OIDplus::config()->getValue('system_title');
  62. $out['SystemTitle'] = $sys_title;
  63.  
  64. // commented out because of security
  65. /*
  66. $sys_ver = OIDplus::getVersion();
  67. if (!$sys_ver) $sys_ver = 'unknown'; // do not translate
  68. $out['SystemVersion'] = $sys_ver;
  69. */
  70.  
  71. // commented out because of security
  72. /*
  73. $sys_install_type = OIDplus::getInstallType();
  74. $out['SystemInstallType'] = $sys_install_type;
  75. */
  76.  
  77. // commented out because of privacy
  78. /*
  79. $admin_email = OIDplus::config()->getValue('admin_email');
  80. $out['AdminEMail'] = $admin_email;
  81. */
  82.  
  83. OIDplus::invoke_shutdown();
  84.  
  85. echo json_encode($out);
  86.