Rev 835 | Rev 954 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 835 | Rev 929 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | /* |
3 | /* |
4 | * OIDplus 2.0 |
4 | * OIDplus 2.0 |
5 | * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft |
5 | * Copyright 2019 - 2022 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 | * |
Line 34... | Line 34... | ||
34 | if ($this->isRoot()) return array(); |
34 | if ($this->isRoot()) return array(); |
35 | 35 | ||
36 | $ids = array(); |
36 | $ids = array(); |
37 | if ($this->ns() != 'oid') { |
37 | if ($this->ns() != 'oid') { |
38 | // Creates an OIDplus-Hash-OID |
38 | // Creates an OIDplus-Hash-OID |
39 | // If the object type has a better way of defining an OID, please override this method! |
- | |
40 | $sid = OIDplus::getSystemId(true); |
39 | $sid = OIDplus::getSystemId(true); |
41 | if (!empty($sid)) { |
40 | if (!empty($sid)) { |
42 | $ns_oid = $this->getPlugin()->getManifest()->getOid(); |
41 | $ns_oid = $this->getPlugin()->getManifest()->getOid(); |
43 | if (str_starts_with($ns_oid, '1.3.6.1.4.1.37476.2.5.2.')) { |
42 | if (str_starts_with($ns_oid, '1.3.6.1.4.1.37476.2.5.2.')) { |
44 | // Official ViaThinkSoft object type plugins |
43 | // Official ViaThinkSoft object type plugins |
Line 48... | Line 47... | ||
48 | } else { |
47 | } else { |
49 | // Third-party object type plugins |
48 | // Third-party object type plugins |
50 | // Set the hash_payload as '<plugin oid>:<id>' |
49 | // Set the hash_payload as '<plugin oid>:<id>' |
51 | $hash_payload = $ns_oid.':'.$this->nodeId(false); |
50 | $hash_payload = $ns_oid.':'.$this->nodeId(false); |
52 | } |
51 | } |
53 | - | ||
54 | $oid = $sid . '.' . smallhash($hash_payload); |
52 | $oid = $sid . '.' . smallhash($hash_payload); |
55 | $ids[] = new OIDplusAltId('oid', $oid, _L('OIDplus Information Object ID')); |
53 | $ids[] = new OIDplusAltId('oid', $oid, _L('OIDplus Information Object ID')); |
56 | } |
54 | } |
57 | } |
55 | |
- | 56 | // Make a namebased UUID, but... |
|
- | 57 | // ... exclude GUID, because a GUID is already a GUID |
|
- | 58 | // ... exclude OID, because an OID already has a record UUID_NAMEBASED_NS_OID set by class OIDplusOid |
|
58 | if ($this->ns() != 'guid') { |
59 | if ($this->ns() != 'guid') { |
59 | $ids[] = new OIDplusAltId('guid', gen_uuid_md5_namebased(self::UUID_NAMEBASED_NS_OidPlusMisc, $this->nodeId()), _L('Name based version 3 / MD5 UUID with namespace %1','UUID_NAMEBASED_NS_OidPlusMisc')); |
60 | $ids[] = new OIDplusAltId('guid', gen_uuid_md5_namebased(self::UUID_NAMEBASED_NS_OidPlusMisc, $this->nodeId()), _L('Name based version 3 / MD5 UUID with namespace %1','UUID_NAMEBASED_NS_OidPlusMisc')); |
60 | $ids[] = new OIDplusAltId('guid', gen_uuid_sha1_namebased(self::UUID_NAMEBASED_NS_OidPlusMisc, $this->nodeId()), _L('Name based version 5 / SHA1 UUID with namespace %1','UUID_NAMEBASED_NS_OidPlusMisc')); |
61 | $ids[] = new OIDplusAltId('guid', gen_uuid_sha1_namebased(self::UUID_NAMEBASED_NS_OidPlusMisc, $this->nodeId()), _L('Name based version 5 / SHA1 UUID with namespace %1','UUID_NAMEBASED_NS_OidPlusMisc')); |
61 | } |
62 | } |
- | 63 | } |
|
62 | return $ids; |
64 | return $ids; |
63 | } |
65 | } |
64 | 66 | ||
65 | public abstract static function objectTypeTitle(); |
67 | public abstract static function objectTypeTitle(); |
66 | 68 |