Subversion Repositories oidplus

Rev

Rev 1115 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1115 Rev 1201
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 * OIDplus 2.0
4
 * OIDplus 2.0
5
 * Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft
5
 * Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft
6
 *
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with 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
9
 * You may obtain a copy of the License at
10
 *
10
 *
11
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 *
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
17
 * limitations under the License.
18
 */
18
 */
19
 
19
 
20
use ViaThinkSoft\OIDplus\OIDplus;
20
use ViaThinkSoft\OIDplus\OIDplus;
21
 
21
 
22
require_once __DIR__ . '/includes/oidplus.inc.php';
22
require_once __DIR__ . '/includes/oidplus.inc.php';
23
 
23
 
24
header('Content-Type:application/json; charset=UTF-8');
24
header('Content-Type:application/json; charset=UTF-8');
25
 
25
 
26
try {
26
try {
27
        OIDplus::init(false);
27
        OIDplus::init(false);
28
} catch (Exception $e) {
28
} catch (Exception $e) {
29
        OIDplus::invoke_shutdown();
29
        OIDplus::invoke_shutdown();
30
        $out = array(
30
        $out = array(
31
                "error" => $e->getMessage()
31
                "error" => $e->getMessage()
32
        );
32
        );
33
        echo json_encode($out);
33
        echo json_encode($out);
34
        die();
34
        die();
35
}
35
}
36
 
36
 
37
 
37
 
38
# ---
38
# ---
39
 
39
 
40
$out = array();
40
$out = array();
41
 
41
 
42
$sysid_id = OIDplus::getSystemId(false);
42
$sysid_id = OIDplus::getSystemId(false);
43
if (!$sysid_id) $sysid_id = 'unknown'; // do not translate
43
if (!$sysid_id) $sysid_id = 'unknown'; // do not translate
44
$out['SystemID'] = $sysid_id;
44
$out['SystemID'] = $sysid_id;
45
 
45
 
46
$sysid_oid = OIDplus::getSystemId(true);
46
$sysid_oid = OIDplus::getSystemId(true);
47
if (!$sysid_oid) $sysid_oid = 'unknown'; // do not translate
47
if (!$sysid_oid) $sysid_oid = 'unknown'; // do not translate
48
$out['SystemOID'] = $sysid_oid;
48
$out['SystemOID'] = $sysid_oid;
49
 
49
 
50
$sysid_guid = OIDplus::getSystemGuid();
50
$sysid_guid = OIDplus::getSystemGuid();
51
if (!$sysid_guid) $sysid_guid = 'unknown'; // do not translate
51
if (!$sysid_guid) $sysid_guid = 'unknown'; // do not translate
52
$out['SystemGUID'] = $sysid_guid;
52
$out['SystemGUID'] = $sysid_guid;
53
 
53
 
54
$pubKey = OIDplus::getSystemPublicKey();
54
$pubKey = OIDplus::getSystemPublicKey();
55
if (!$pubKey) $pubKey = 'unknown'; // do not translate
55
if (!$pubKey) $pubKey = 'unknown'; // do not translate
56
$out['PublicKey'] = $pubKey;
56
$out['PublicKey'] = $pubKey;
57
 
57
 
58
$sys_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL);
58
$sys_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL);
59
$out['SystemURL'] = $sys_url;
59
$out['SystemURL'] = $sys_url;
60
 
60
 
61
$sys_title = OIDplus::config()->getValue('system_title');
61
$sys_title = OIDplus::config()->getValue('system_title');
62
$out['SystemTitle'] = $sys_title;
62
$out['SystemTitle'] = $sys_title;
63
 
63
 
64
// commented out because of privacy
64
// commented out because of security
65
/*
65
/*
66
$sys_ver = OIDplus::getVersion();
66
$sys_ver = OIDplus::getVersion();
67
if (!$sys_ver) $sys_ver = 'unknown'; // do not translate
67
if (!$sys_ver) $sys_ver = 'unknown'; // do not translate
68
$out['SystemVersion'] = $sys_ver;
68
$out['SystemVersion'] = $sys_ver;
69
*/
69
*/
70
 
70
 
71
// commented out because of privacy
71
// commented out because of security
72
/*
72
/*
73
$sys_install_type = OIDplus::getInstallType();
73
$sys_install_type = OIDplus::getInstallType();
74
$out['SystemInstallType'] = $sys_install_type;
74
$out['SystemInstallType'] = $sys_install_type;
75
*/
75
*/
76
 
76
 
77
// commented out because of privacy
77
// commented out because of privacy
78
/*
78
/*
79
$admin_email = OIDplus::config()->getValue('admin_email');
79
$admin_email = OIDplus::config()->getValue('admin_email');
80
$out['AdminEMail'] = $admin_email;
80
$out['AdminEMail'] = $admin_email;
81
*/
81
*/
82
 
82
 
83
OIDplus::invoke_shutdown();
83
OIDplus::invoke_shutdown();
84
 
84
 
85
echo json_encode($out);
85
echo json_encode($out);
86
 
86