Subversion Repositories oidplus

Rev

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

Rev 1086 Rev 1116
Line 17... Line 17...
17
\defined('INSIDE_OIDPLUS') or die;
17
\defined('INSIDE_OIDPLUS') or die;
18
// phpcs:enable PSR1.Files.SideEffects
18
// phpcs:enable PSR1.Files.SideEffects
19
 
19
 
20
class OIDplusPagePublicAltIds extends OIDplusPagePluginPublic {
20
class OIDplusPagePublicAltIds extends OIDplusPagePluginPublic {
21
 
21
 
-
 
22
        /**
-
 
23
         * @param string $actionID
-
 
24
         * @param array $params
-
 
25
         * @return array
-
 
26
         * @throws \ViaThinkSoft\OIDplus\OIDplusException
-
 
27
         */
22
        public function action($actionID, $params) {
28
        public function action(string $actionID, array $params): array {
-
 
29
                return parent::action($actionID, $params);
-
 
30
        }
-
 
31
 
-
 
32
        /**
-
 
33
         * @param string $id
-
 
34
         * @param array $out
-
 
35
         * @param bool $handled
-
 
36
         * @return void
-
 
37
         */
-
 
38
        public function gui(string $id, array &$out, bool &$handled) {
23
 
39
 
24
        }
40
        }
25
 
41
 
-
 
42
        /**
-
 
43
         * @param array $out
-
 
44
         * @return void
-
 
45
         */
26
        public function gui($id, &$out, &$handled) {
46
        public function publicSitemap(array &$out) {
27
 
47
 
28
        }
48
        }
29
 
49
 
-
 
50
        /**
-
 
51
         * @param array $json
30
        public function publicSitemap(&$out) {
52
         * @param string|null $ra_email
31
 
-
 
-
 
53
         * @param bool $nonjs
-
 
54
         * @param string $req_goto
-
 
55
         * @return bool
32
        }
56
         */
33
 
-
 
34
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
57
        public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool {
35
                return false;
58
                return false;
36
        }
59
        }
37
 
60
 
-
 
61
        /**
-
 
62
         * @return string|null
-
 
63
         * @throws \ViaThinkSoft\OIDplus\OIDplusException
-
 
64
         */
38
        private function cache_id() {
65
        private function cache_id() {
39
                static $cache_id = null;
66
                static $cache_id = null;
40
                if (!is_null($cache_id)) return $cache_id;
67
                if (!is_null($cache_id)) return $cache_id;
41
                $cache_id  =  'Create='.OIDplus::db()->getScalar("select max(created) as ts from ###objects where created is not null;");
68
                $cache_id  =  'Create='.OIDplus::db()->getScalar("select max(created) as ts from ###objects where created is not null;");
42
                $cache_id .= '/Update='.OIDplus::db()->getScalar("select max(updated) as ts from ###objects where updated is not null;");
69
                $cache_id .= '/Update='.OIDplus::db()->getScalar("select max(updated) as ts from ###objects where updated is not null;");
Line 48... Line 75...
48
                sort($plugin_versions);
75
                sort($plugin_versions);
49
                $cache_id .= implode('',$plugin_versions);
76
                $cache_id .= implode('',$plugin_versions);
50
                return $cache_id;
77
                return $cache_id;
51
        }
78
        }
52
 
79
 
-
 
80
        /**
-
 
81
         * @param $noCache
-
 
82
         * @return array[]|mixed|null
-
 
83
         * @throws \ViaThinkSoft\OIDplus\OIDplusException
-
 
84
         */
53
        public function readAll($noCache = false) {
85
        public function readAll($noCache = false) {
54
                static $local_cache = null;
86
                static $local_cache = null;
55
 
87
 
56
                $cache_file = OIDplus::localpath().'/userdata/cache/frdl_alt_id.ser';
88
                $cache_file = OIDplus::localpath().'/userdata/cache/frdl_alt_id.ser';
57
                if ($noCache === false) {
89
                if ($noCache === false) {
Line 98... Line 130...
98
                $local_cache = $data;
130
                $local_cache = $data;
99
 
131
 
100
                return $data;
132
                return $data;
101
        }
133
        }
102
 
134
 
-
 
135
        /**
-
 
136
         * @param $id
-
 
137
         * @return array|mixed|string[]
-
 
138
         * @throws \ViaThinkSoft\OIDplus\OIDplusException
-
 
139
         */
103
        public function getAlternativesForQuery($id/* 1.3.6.1.4.1.37476.2.5.2.3.7 signature takes just 1 param!? , $noCache = false*/) {
140
        public function getAlternativesForQuery($id/* 1.3.6.1.4.1.37476.2.5.2.3.7 signature takes just 1 param!? , $noCache = false*/) {
104
 
141
 
105
                static $caches = array();
142
                static $caches = array();
106
 
143
 
107
                if(/*$noCache === false && */isset($caches[$id]) ){
144
                if(/*$noCache === false && */isset($caches[$id]) ){
Line 149... Line 186...
149
                $caches[$id] = $res;
186
                $caches[$id] = $res;
150
 
187
 
151
                return $res;
188
                return $res;
152
        }
189
        }
153
 
190
 
-
 
191
        /**
-
 
192
         * @param string $id
-
 
193
         * @return bool
-
 
194
         */
154
        public function implementsFeature($id) {
195
        public function implementsFeature(string $id): bool {
155
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.4') return true; // whois*Attributes
196
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.4') return true; // whois*Attributes
156
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.7') return true; // getAlternativesForQuery
197
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.7') return true; // getAlternativesForQuery
157
                return false;
198
                return false;
158
        }
199
        }
159
 
200
 
-
 
201
        /**
-
 
202
         * @param string $request
-
 
203
         * @return array|false
-
 
204
         */
160
        public function tree_search($request) {
205
        public function tree_search(string $request) {
161
                return false;
206
                return false;
162
        }
207
        }
163
 
208
 
-
 
209
        /**
-
 
210
         * @param $id
-
 
211
         * @return false|mixed|string
-
 
212
         * @throws \ViaThinkSoft\OIDplus\OIDplusException
-
 
213
         */
164
        public function getCanonical($id){
214
        public function getCanonical($id){
165
                foreach($this->getAlternativesForQuery($id) as $alt){
215
                foreach($this->getAlternativesForQuery($id) as $alt){
166
                        if (strpos($alt,':') !== false) {
216
                        if (strpos($alt,':') !== false) {
167
                                list($ns, $altIdRaw) = explode(':', $alt, 2);
217
                                list($ns, $altIdRaw) = explode(':', $alt, 2);
168
                                if($ns === 'oid'){
218
                                if($ns === 'oid'){
Line 172... Line 222...
172
                }
222
                }
173
 
223
 
174
                return false;
224
                return false;
175
        }
225
        }
176
 
226
 
-
 
227
        /**
-
 
228
         * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.4
-
 
229
         * @param $id
-
 
230
         * @param $out
-
 
231
         * @return void
-
 
232
         * @throws \ViaThinkSoft\OIDplus\OIDplusException
-
 
233
         */
177
        public function whoisObjectAttributes($id, &$out) {
234
        public function whoisObjectAttributes($id, &$out) {
178
                // Interface 1.3.6.1.4.1.37476.2.5.2.3.4
-
 
179
 
-
 
180
                $xmlns = 'oidplus-frdlweb-altids-plugin';
235
                $xmlns = 'oidplus-frdlweb-altids-plugin';
181
                $xmlschema = 'urn:oid:1.3.6.1.4.1.37553.8.1.8.8.53354196964.641310544.1714020422';
236
                $xmlschema = 'urn:oid:1.3.6.1.4.1.37553.8.1.8.8.53354196964.641310544.1714020422';
182
                $xmlschemauri = OIDplus::webpath(__DIR__.'/altids.xsd',OIDplus::PATH_ABSOLUTE);
237
                $xmlschemauri = OIDplus::webpath(__DIR__.'/altids.xsd',OIDplus::PATH_ABSOLUTE);
183
 
238
 
184
                $handleShown = false;
239
                $handleShown = false;
Line 225... Line 280...
225
                        ];
280
                        ];
226
 
281
 
227
                }
282
                }
228
        }
283
        }
229
 
284
 
-
 
285
        /**
-
 
286
         * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.4
-
 
287
         * @param $email
-
 
288
         * @param $out
-
 
289
         * @return void
-
 
290
         */
230
        public function whoisRaAttributes($email, &$out) {
291
        public function whoisRaAttributes($email, &$out) {
231
                // Interface 1.3.6.1.4.1.37476.2.5.2.3.4
-
 
-
 
292
 
232
        }
293
        }
233
 
294
 
234
 }
295
 }