Subversion Repositories oidplus

Rev

Rev 805 | Rev 835 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 805 Rev 817
Line 37... Line 37...
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!
39
                        // If the object type has a better way of defining an OID, please override this method!
40
                        $sid = OIDplus::getSystemId(true);
40
                        $sid = OIDplus::getSystemId(true);
41
                        if (!empty($sid)) {
41
                        if (!empty($sid)) {
-
 
42
                                $ns_oid = $this->getPlugin()->getManifest()->getOid();
-
 
43
                                if (strpos($ns_oid, '1.3.6.1.4.1.37476.') === 0) {
-
 
44
                                        // Official ViaThinkSoft object type plugins
-
 
45
                                        // For backwards compatibility with existing IDs,
-
 
46
                                        // set the hash_payload as '<namespace>:<id>'
-
 
47
                                        $hash_payload = $this->nodeId(true);
-
 
48
                                } else {
-
 
49
                                        // Third-party object type plugins
-
 
50
                                        // Set the hash_payload as '<plugin oid>:<id>'
-
 
51
                                        $hash_payload = $ns_oid.':'.$this->nodeId(false);
-
 
52
                                }
-
 
53
 
42
                                $oid = $sid . '.' . smallhash($this->nodeId());
54
                                $oid = $sid . '.' . smallhash($hash_payload);
43
                                $ids[] = new OIDplusAltId('oid', $oid, _L('OIDplus Information Object ID'));
55
                                $ids[] = new OIDplusAltId('oid', $oid, _L('OIDplus Information Object ID'));
44
                        }
56
                        }
45
                }
57
                }
46
                if ($this->ns() != 'guid') {
58
                if ($this->ns() != 'guid') {
47
                        $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'));
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'));
Line 52... Line 64...
52
 
64
 
53
        public abstract static function objectTypeTitle();
65
        public abstract static function objectTypeTitle();
54
 
66
 
55
        public abstract static function objectTypeTitleShort();
67
        public abstract static function objectTypeTitleShort();
56
 
68
 
-
 
69
        public function getPlugin()/*: ?OIDplusObjectTypePlugin */ {
-
 
70
                $res = null;
-
 
71
                $plugins = OIDplus::getObjectTypePlugins();
-
 
72
                foreach ($plugins as $plugin) {
-
 
73
                        if (get_class($this) == $plugin::getObjectTypeClassName($this)) {
-
 
74
                                return $plugin;
-
 
75
                        }
-
 
76
                }
-
 
77
                return $res;
-
 
78
        }
-
 
79
 
57
        public abstract static function ns();
80
        public abstract static function ns();
58
 
81
 
59
        public abstract static function root();
82
        public abstract static function root();
60
 
83
 
61
        public abstract function isRoot();
84
        public abstract function isRoot();